:root {
  --font-size: 36px;
  --lines: 2;
  --bg-opacity: 0.6;
  --line-height: 1.3;
  --lane-gap: 6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  color: #fff;
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;  /* Inter = 3SS brand font, falls back offline */
}

body { display: flex; flex-direction: column; }

/* ---------- toolbar ---------- */
#toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #1a1a1a;
  font-size: 14px;
  flex: 0 0 auto;
}
#toolbar .spacer { flex: 1; }
#toolbar button, #toolbar select {
  background: #2b2b2b;
  color: #fff;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 14px;
  cursor: pointer;
}
#toolbar button.primary { background: #1e7e34; border-color: #1e7e34; }
#toolbar button.primary.running { background: #b02a37; border-color: #b02a37; }
#micDevice { max-width: 220px; }
#status { color: #aaa; }
#status.error { color: #ff6b6b; }

#vu { display: inline-block; width: 60px; height: 8px; background: #333; border-radius: 4px; overflow: hidden; }
#vuBar { display: block; height: 100%; width: 0; background: #4caf50; transition: width 80ms linear; }

body:fullscreen #toolbar { display: none; }

/* ---------- subtitle stage ---------- */
#stage {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #000 center / cover no-repeat;
}
/* Limitless 2026: the designer's clean poster background (no title, no
   speakers). Centred so the event line and limitl3ss.ro sit mid-screen; the event line
   at the top and limitl3ss.ro at the bottom are part of the image, so the
   lanes keep clear of those strips. */
#stage.limitless-clean { background: #130b4a url(bg/limitless-clean.png) center center / cover no-repeat; }
#stage.limitless-clean #lanes.bottom { bottom: 6.5%; }
#stage.limitless-clean #lanes.top { top: 6%; }

/* Limitless 2026: the real poster, blurred until the title and faces dissolve
   into colour, so the palette and the neon glows are the genuine ones. Both
   layers use the same geometry (right-aligned, scaled to height) so the sharp
   robot crop in the "poster" variant lines up with its blurred shadow. */
#stage.limitless, #stage.limitless-poster { background: #130b4a; }
#stage.limitless::before, #stage.limitless-poster::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url(bg/limitless-poster.webp) right center / auto 100% no-repeat;
  filter: blur(42px) saturate(1.2);
  pointer-events: none;
}
#stage.limitless #lanes, #stage.limitless-poster #lanes { z-index: 1; }
#poster { display: none; }
#stage.limitless-poster #poster {
  display: block;
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 37%;  /* only the rightmost ~27% of the poster: past the title, just the robots */
  background: url(bg/limitless-poster.webp) right center / auto 100% no-repeat;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 18%);
  mask-image: linear-gradient(to right, transparent 0%, #000 18%);
}


/* Official 3SS Hero AI backgrounds, extracted from the brand kit. */
#stage.bg1 { background-image: url(bg/background-01.jpg); }
#stage.bg2 { background-image: url(bg/background-02.jpg); }
#stage.bg3 { background-image: url(bg/background-03.jpg); }
#stage.bg4 { background-image: url(bg/background-04.jpg); }
#lanes {
  position: absolute;
  left: 0; right: 0;
  display: flex;
  flex-direction: column;
  gap: var(--lane-gap);
  padding: 12px 4vw;
}
body.settings-open #lanes { right: 340px; }
#lanes.bottom { bottom: 0; }
#lanes.top { top: 0; }

.lane {
  display: flex;
  align-items: flex-start;  /* text fills from the top, flag sits next to the first line */
  gap: 0.4em;
  font-size: var(--font-size);
  line-height: var(--line-height);
  height: calc(var(--font-size) * var(--line-height) * var(--lines) + 0.4em);
  padding: 0.2em 0.4em;
  background: rgba(0, 0, 0, var(--bg-opacity));
  border-radius: 6px;
  text-shadow: 0 0 6px #000, 0 2px 2px #000;
}
/* Flag lives in its own fixed column, so it never scrolls with the text. */
.lane .flag {
  flex: 0 0 auto;
  width: 1.5em;
  height: 1em;
  margin-top: calc((var(--line-height) - 1) * 0.5em);
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 0 2px #000;
}
/* The text block is a scroll container: text starts at the top; only when a
   new line no longer fits do we scroll to the bottom (smoothly), so the top
   line slides out of view. */
.lane .text {
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  scroll-behavior: smooth;
  overflow-wrap: break-word;
}
.lane .flag svg { display: block; width: 100%; height: 100%; }
.lane .interim { color: #bbb; }
.lane .speaker { color: #ffd54f; font-weight: 600; }
.lane.idle { opacity: 0.35; }
.lane.disconnected .flag { filter: grayscale(1); }

/* ---------- settings drawer ---------- */
#settings {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 340px;
  background: #1a1a1a;
  border-left: 1px solid #333;
  padding: 16px;
  overflow-y: auto;
  font-size: 14px;
  z-index: 10;
}
#settings .head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
#settings h2 { margin: 0; font-size: 18px; }
#settings .head button { margin: 0; padding: 2px 8px; font-size: 16px; }
#settings h3 { margin: 16px 0 6px; font-size: 13px; text-transform: uppercase; color: #999; }
#settings label { display: block; margin: 6px 0; }
#settings label input[type=range] { width: 100%; }
#settings label output { float: right; color: #aaa; }
#settings input[type=text] {
  width: 100%; background: #2b2b2b; color: #fff; border: 1px solid #444; padding: 4px; border-radius: 4px;
}
#settings .hint { color: #888; font-size: 12px; margin: 4px 0 0; }
#settings .flag { display: inline-block; width: 21px; height: 14px; vertical-align: -2px; }
#langList .row { display: flex; align-items: center; gap: 6px; margin: 4px 0; }
#langList .row .name { flex: 1; }
#langList .row button { margin: 0; padding: 0 6px; font-size: 11px; line-height: 18px; }
#langList .row button:disabled { opacity: 0.3; cursor: default; }
#settings .flag svg { display: block; width: 100%; height: 100%; }
#settings button {
  margin-top: 20px; background: #2b2b2b; color: #fff; border: 1px solid #444; border-radius: 4px; padding: 6px 10px; cursor: pointer;
}
