:root {
  --fg: #eef0ff;
  --dim: #9aa0c8;
  --accent: #33e1ff;
  --panel: rgba(10, 9, 28, 0.72);
  --line: rgba(255, 255, 255, 0.12);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #04030c; color: var(--fg);
  font-family: "Space Grotesk", system-ui, sans-serif; }
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- intro ---------- */
.panel { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(520px, calc(100% - 32px)); padding: 32px; border: 1px solid var(--line);
  background: var(--panel); backdrop-filter: blur(14px); border-radius: 18px; text-align: center;
  transition: opacity .8s, transform .8s; }
.panel.gone { opacity: 0; transform: translate(-50%, -46%); pointer-events: none; }
.kicker { font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--dim); }
h1 { font-family: "Unbounded", sans-serif; font-weight: 900; font-size: clamp(48px, 12vw, 88px);
  margin: 10px 0 8px; letter-spacing: -.02em;
  background: linear-gradient(90deg, #fff, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.panel p { color: #cfd3f5; line-height: 1.5; margin: 0 0 18px; }
.panel .fine { font-size: 12px; color: var(--dim); margin: 14px 0 0; }
.btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
button { font: inherit; color: var(--fg); background: rgba(255,255,255,.06); border: 1px solid var(--line);
  border-radius: 999px; padding: 10px 18px; cursor: pointer; transition: background .2s, border-color .2s; }
button:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.3); }
button.primary { background: var(--accent); color: #04030c; border-color: transparent; font-weight: 700; }
button.primary:hover { filter: brightness(1.1); background: var(--accent); }

/* ---------- letterbox + lyrics ---------- */
:root { --bar: clamp(44px, 11vh, 120px); }
.bar { position: fixed; left: 0; right: 0; height: var(--bar); background: #000; pointer-events: none;
  transform: scaleY(0); transition: transform 1.6s cubic-bezier(.6,0,.2,1); }
#barTop { top: 0; transform-origin: top; }
#barBot { bottom: 0; transform-origin: bottom; display: grid; place-items: center; padding: 0 16px; }
body.playing .bar { transform: none; }

/* subtitles: regular lines, sit in the bottom bar like a film */
#subs { display: grid; place-items: center; width: 100%; }
#subs .line { grid-area: 1 / 1; text-align: center; font-weight: 500; font-size: clamp(15px, 2.2vw, 24px);
  letter-spacing: .01em; color: #ecebe6; transition: opacity .35s ease; }
#subs .line.out { opacity: 0; }
#subs .w { display: inline-block; margin: 0 .12em; opacity: .28; transition: opacity .3s; }
#subs .w.on { opacity: 1; }
#subs .line.whisper { font-style: italic; font-weight: 400; color: #b9b8c6; letter-spacing: .08em; }
#subs .line.warn .w.on { color: #ff6b70; }

/* chorus hits: big title cards in the frame, no neon */
#lyrics { position: fixed; left: 0; right: 0; top: calc(var(--bar) + 6vh); display: grid; place-items: center;
  pointer-events: none; padding: 0 16px; }
#lyrics .line { grid-area: 1 / 1; text-align: center; font-family: "Unbounded", sans-serif; font-weight: 900;
  text-transform: uppercase; font-size: clamp(30px, 7.5vw, 96px); letter-spacing: .04em; line-height: 1;
  color: rgba(240, 238, 232, .92); text-shadow: 0 2px 30px rgba(0,0,0,.7);
  transition: opacity .7s ease, filter .7s, letter-spacing 1.4s ease; }
#lyrics .line.out { opacity: 0; filter: blur(8px); letter-spacing: .14em; }
#lyrics .w { display: inline-block; margin: 0 .12em; opacity: 0; transform: translateY(8px); transition: opacity .3s, transform .4s ease-out; }
#lyrics .w.on { opacity: 1; transform: none; animation: stamp .28s ease-out; }
@keyframes stamp { 0% { transform: scale(1.18); opacity: .4; } 100% { transform: none; opacity: 1; } }

/* ---------- HUD ---------- */
#hud { position: fixed; left: 50%; top: calc(var(--bar) / 2 - 22px); transform: translateX(-50%); width: min(720px, calc(100% - 32px));
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 999px;
  background: rgba(8, 7, 22, .55); border: 1px solid var(--line); backdrop-filter: blur(10px);
  opacity: .25; transition: opacity .4s; }
#hud:hover, body.idle-off #hud { opacity: 1; }
#hud button { padding: 6px 12px; font-size: 13px; }
#playBtn { width: 38px; padding: 6px 0 !important; }
#bar { flex: 1; height: 6px; background: rgba(255,255,255,.1); border-radius: 4px; cursor: pointer; position: relative; }
#fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent); border-radius: 4px; }
#time { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--dim); min-width: 36px; }
@media (max-width: 560px) { #recenter, #editBtn { display: none; } }

/* ---------- camera preview ---------- */
#cam { position: fixed; top: calc(var(--bar) + 12px); right: 16px; width: 168px; aspect-ratio: 4/3; object-fit: cover;
  border-radius: 12px; border: 1px solid var(--line); transform: scaleX(-1); opacity: 0; pointer-events: none; transition: opacity .3s; }
#cam.show { opacity: .85; }
#trackDot { position: fixed; top: calc(var(--bar) + 14px); left: 18px; width: 10px; height: 10px; border-radius: 50%; background: #3dffc5;
  box-shadow: 0 0 10px #3dffc5; transition: background .3s, box-shadow .3s; }
#trackDot.lost { background: #ff4a5c; box-shadow: 0 0 10px #ff4a5c; }

/* ---------- editor ---------- */
#editor { position: fixed; top: calc(var(--bar) + 12px); left: 16px; bottom: calc(var(--bar) + 12px); width: min(420px, calc(100% - 32px));
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; backdrop-filter: blur(14px);
  display: flex; flex-direction: column; font-size: 13px; }
.edHead { padding: 12px 14px; border-bottom: 1px solid var(--line); display: grid; gap: 4px; }
.edHead span { color: var(--dim); font-size: 12px; }
#edList { margin: 0; padding: 6px 0; overflow: auto; flex: 1; list-style: none; }
#edList li { display: flex; gap: 10px; padding: 5px 14px; cursor: pointer; }
#edList li:hover { background: rgba(255,255,255,.05); }
#edList li.cur { color: var(--accent); }
#edList li.next { background: rgba(51,225,255,.1); }
#edList li.sel { outline: 1px solid var(--accent); outline-offset: -1px; }
#edList code { color: var(--dim); min-width: 56px; font-variant-numeric: tabular-nums; }
.edBtns { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.edBtns button { padding: 6px 12px; font-size: 12px; }

/* ---------- preview toast ---------- */
#toast { position: fixed; left: 50%; top: calc(var(--bar) + 16px); transform: translate(-50%, -8px); padding: 8px 14px;
  border-radius: 999px; background: rgba(8,7,22,.7); border: 1px solid var(--line); font-size: 13px; color: var(--fg);
  opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s; z-index: 5; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- opening: panel sits left so the sleeping nerd is visible on the right ---------- */
#intro { left: 4vw; top: auto; bottom: 5vh; transform: none; width: min(400px, calc(100% - 32px)); padding: 22px 24px; text-align: left; }
#intro h1 { font-size: clamp(40px, 6vw, 64px); margin: 4px 0 6px; }
#intro p { font-size: 14px; margin-bottom: 14px; }
#intro .btns { justify-content: flex-start; }
#intro.gone { transform: translateY(14px); }
@media (max-width: 760px) {
  #intro { left: 16px; right: 16px; top: auto; bottom: 16px; transform: none; width: auto; padding: 20px; }
  #intro.gone { transform: translateY(12px); }
  #intro h1 { font-size: 44px; margin: 4px 0; }
}

/* ---------- pause prompt + end card ---------- */
#idle { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 18px 26px; border-radius: 14px;
  background: rgba(8, 7, 22, .75); border: 1px solid var(--line); font-size: 20px; text-align: center; opacity: 0; pointer-events: none; transition: opacity .6s; }
#idle small { display: block; margin-top: 6px; font-size: 13px; color: var(--dim); }
#idle.show { opacity: 1; }
#endcard { position: fixed; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; opacity: 0; transition: opacity 2s; z-index: 4; }
#endcard p { margin: 6px 0; font-size: clamp(18px, 2.6vw, 28px); letter-spacing: .02em; }
#endcard .dim { color: var(--dim); font-size: clamp(14px, 1.8vw, 18px); }
#endcard.show { opacity: 1; pointer-events: auto; }
#endcard button { margin: 22px auto 0; }
#bar { cursor: default; }

/* ---------- type: Roboto Mono everywhere, weight does the work ---------- */
:root { --font-sub: "Roboto Mono", ui-monospace, monospace; --font-big: "Roboto Mono", ui-monospace, monospace; --big-track: .02em; }
html, body, button { font-family: "Roboto Mono", ui-monospace, monospace; }
#subs .line { font-family: var(--font-sub); font-weight: 400; letter-spacing: 0; }
#subs .line.warn { font-weight: 500; }
#subs .line.whisper { font-weight: 300; }
#lyrics .line { font-family: var(--font-big); font-weight: 700; letter-spacing: var(--big-track); }


/* sung words glow briefly (driven by --vox from the lyric clock) */
#subs .w.on, #lyrics .w.on { text-shadow: 0 0 calc(var(--vox, 0) * 16px) rgba(255, 255, 255, calc(var(--vox, 0) * .55)), 0 2px 20px rgba(0,0,0,.6); }

/* hyperdrive: letterbox bands slowly slide away, then return for the landing */
body.playing.fullbleed .bar { transform: scaleY(0); }   /* slides back out the way it came in; subtitles live on their own layer */
body.fullbleed #subs .line { text-shadow: 0 2px 12px rgba(0,0,0,.9), 0 0 2px rgba(0,0,0,.9); }

#intro .warn-epi { color: #ffcf8a; margin-top: 10px; }

/* ---------- landing: a movie title card ---------- */
#intro { position: fixed; inset: 0; left: 0; right: 0; top: 0; bottom: 0; width: auto; padding: 0; margin: 0; transform: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2.2vh; text-align: center;
  background: radial-gradient(ellipse at 50% 45%, rgba(0,0,0,.5) 0%, rgba(0,0,0,.9) 70%); border: 0; border-radius: 0;
  backdrop-filter: none; opacity: 1; transition: opacity 1.4s ease; z-index: 6; }
#intro.gone { opacity: 0; transform: none; pointer-events: none; }
#intro .logo { width: min(320px, 58vw); opacity: .95; margin-bottom: 1vh; }
#intro h1 { margin: 0; padding-left: .55em; font-family: "Roboto Mono", monospace; font-weight: 300; font-size: clamp(26px, 5.4vw, 68px);
  letter-spacing: .55em; color: #f3eed9; background: none; -webkit-background-clip: border-box; background-clip: border-box;
  -webkit-text-fill-color: currentColor; text-shadow: 0 0 30px rgba(255, 240, 180, .18); }
#startPlay { margin-top: 3.5vh; width: 68px; height: 68px; padding: 0; border-radius: 50%; border: 1px solid rgba(243,238,217,.45);
  background: transparent; color: #f3eed9; font-size: 20px; display: grid; place-items: center; transition: background .3s, border-color .3s, transform .3s; }
#startPlay span { transform: translateX(2px); }
#startPlay:hover { background: rgba(243,238,217,.1); border-color: #f3eed9; transform: scale(1.05); }
#intro .epi { position: absolute; bottom: 3vh; margin: 0; font-size: 10px; font-weight: 400; letter-spacing: .25em; text-transform: uppercase; color: rgba(243,238,217,.35); }
@media (max-width: 760px) { #intro { left: 0; right: 0; top: 0; bottom: 0; padding: 0; } #intro h1 { font-size: 26px; letter-spacing: .4em; } }

/* ---------- phones/tablets: desktop-only message ---------- */
#mobileMsg { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 24px; text-align: center; background: #000; }
#mobileMsg[hidden] { display: none; }
#mobileMsg .logo { width: min(260px, 64vw); }
#mobileMsg h1 { margin: 0; padding-left: .45em; font-family: "Roboto Mono", monospace; font-weight: 300; font-size: 24px; letter-spacing: .45em;
  color: #f3eed9; background: none; -webkit-text-fill-color: currentColor; }
#mobileMsg p { margin: 8px 0 0; font-family: "Roboto Mono", monospace; font-weight: 400; font-size: 13px; line-height: 1.7; color: rgba(243,238,217,.6); }

/* ---------- loader: thin bar under the title, then the play button fades in ---------- */
#loader { margin-top: 3.5vh; height: 68px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; transition: opacity .6s; }
#loader .track { width: 160px; height: 1px; background: rgba(243,238,217,.18); overflow: hidden; }
#loader .track i { display: block; height: 100%; width: 0; background: #f3eed9; transition: width .5s ease; }
#loader span { font-size: 10px; font-weight: 400; letter-spacing: .35em; text-transform: uppercase; color: rgba(243,238,217,.5); padding-left: .35em; }
#startPlay { display: none; }
body.loaded #loader { display: none; }
body.loaded #startPlay { display: grid; animation: playIn .8s ease both; }
@keyframes playIn { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }

/* subtitles: own layer sitting where the bottom band is, so the band can slide away underneath */
#subsWrap { position: fixed; left: 0; right: 0; bottom: 0; height: var(--bar); display: grid; place-items: center; padding: 0 16px; pointer-events: none; z-index: 3; }
