/* ── IELTS Speaking with Veronica (2026-11) ──
   Dark-only stage. One accent (MockPoint orange) used for lines, glows
   and the active state; everything else is near-black with a faint navy
   undertone, warm-white type. Vertical positions are in vh so the
   composition holds at any desktop height; phones get their own rules
   at the bottom. */
:root {
  --bg: #07080d;
  --orange: #ff6a13;
  --orange-soft: rgba(255, 106, 19, 0.14);
  --text: #f3ece0;
  --text-rgb: 243, 236, 224;
  --ui: #f2f2f2;
  --ui-strong: #ffffff;
  --muted: #8d9098;
  --muted-2: #a9abb2;
  --fg-rgb: 255, 255, 255;
  --line: rgba(var(--fg-rgb), 0.11);
  --glass: rgba(var(--fg-rgb), 0.022);
  --panel-bg: rgba(16, 18, 24, 0.92);
  --panel-solid: #14161c;
  --on-orange: #160800;
  --bg-grad:
    radial-gradient(40% 40% at 50% 44%, rgba(60, 24, 8, 0.16), rgba(7, 8, 13, 0) 70%),
    radial-gradient(70% 60% at 0% 100%, rgba(10, 30, 44, 0.55), rgba(7, 8, 13, 0) 60%),
    radial-gradient(70% 60% at 100% 100%, rgba(10, 26, 40, 0.45), rgba(7, 8, 13, 0) 60%);
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Newsreader', 'Source Serif 4', Georgia, 'Times New Roman', serif;
  /* layout anchors (reference: 1672 × 941) */
  --orb-y: 43.8vh;
  --wave-y: 62.7vh;
  --lower-top: 71vh;
  --orb-box: min(60vh, 120vw);
  color-scheme: dark;
}
/* ── Light theme (2026-11-20) — html[data-stage-theme="light"] ── */
:root[data-stage-theme="light"] {
  --bg: #f6f2ea;
  --text: #1f1a14;
  --text-rgb: 31, 26, 20;
  --ui: #1c1a17;
  --ui-strong: #15120f;
  --muted: #7a746b;
  --muted-2: #5e5850;
  --fg-rgb: 30, 22, 14;
  --orange-soft: rgba(255, 106, 19, 0.12);
  --panel-bg: rgba(255, 253, 249, 0.95);
  --panel-solid: #ffffff;
  --q-shadow: none;
  --bg-grad:
    radial-gradient(40% 40% at 50% 44%, rgba(255, 140, 60, 0.10), rgba(246, 242, 234, 0) 70%),
    radial-gradient(70% 60% at 0% 100%, rgba(214, 196, 168, 0.35), rgba(246, 242, 234, 0) 60%),
    radial-gradient(70% 60% at 100% 100%, rgba(220, 205, 180, 0.30), rgba(246, 242, 234, 0) 60%);
  color-scheme: light;
}
:root[data-stage-theme="light"] .settings { box-shadow: 0 24px 60px rgba(60, 40, 20, 0.18); }
:root[data-stage-theme="light"] .part.done { color: #a4552a; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--bg-grad), var(--bg);
  transition: background-color .3s, color .3s;
  color: var(--ui);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ── Header ── */
.top {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  height: 150px;
  pointer-events: none;
}
.top > * { pointer-events: auto; }
.brand {
  --lg: 1;
  position: absolute; left: 62px; top: 70px; transform: translateY(-50%);
  display: flex; align-items: center; gap: calc(32px * var(--lg));
  text-decoration: none;
}
/* mockpoint.png has wide transparent margins — crop to the mark itself */
.brand .mark { width: calc(42px * var(--lg)); height: calc(53px * var(--lg)); position: relative; overflow: visible; flex: none; }
.brand .mark img { position: absolute; width: calc(94.6px * var(--lg)); height: calc(94.6px * var(--lg)); left: calc(-27.2px * var(--lg)); top: calc(-18.9px * var(--lg)); max-width: none; }
.brand .word { font-family: 'Outfit', var(--sans); font-weight: 700; font-size: calc(25px * var(--lg)); letter-spacing: -0.2px; color: var(--ui-strong); line-height: 1; }
.brand .word b { color: var(--orange); font-weight: 700; }

.exam {
  position: absolute; left: 50%; top: 31px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center;
}
.exam-title {
  display: flex; align-items: center; gap: 20px;
  font-size: 18px; font-weight: 400; color: var(--muted-2); letter-spacing: 0.1px;
  height: 34px;
}
.exam-title::before, .exam-title::after {
  content: ''; width: 111px; height: 1px;
  background: linear-gradient(90deg, rgba(var(--fg-rgb), 0.03), rgba(var(--fg-rgb), 0.13));
}
.exam-title::after { background: linear-gradient(90deg, rgba(var(--fg-rgb), 0.13), rgba(var(--fg-rgb), 0.03)); }
.parts { display: flex; gap: 23px; margin-top: 15px; list-style: none; padding: 0; margin-bottom: 0; }
.part {
  width: 118px; height: 46px; border-radius: 23px;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 18px; font-weight: 400; color: var(--muted);
  border: 1px solid rgba(var(--fg-rgb), 0.10);
  background: rgba(var(--fg-rgb), 0.018);
  transition: color .45s, border-color .45s, box-shadow .45s, background .45s;
  user-select: none;
}
.part.active {
  color: var(--ui);
  border: 2px solid var(--orange);
  background: radial-gradient(120% 140% at 50% 50%, rgba(255, 106, 19, 0.16), rgba(255, 106, 19, 0.04));
  box-shadow: 0 0 18px rgba(255, 106, 19, 0.28), inset 0 0 12px rgba(255, 106, 19, 0.10);
}
.part.done { color: #c9a58c; border-color: rgba(255, 106, 19, 0.28); }
.part.done::after {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--orange);
  box-shadow: 0 0 6px rgba(255, 106, 19, 0.8);
}

.gear {
  position: absolute; right: 56px; top: 70px; transform: translateY(-50%);
  width: 62px; height: 62px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--line); background: var(--glass);
  transition: border-color .25s, background .25s;
}
.gear:hover, .gear[aria-expanded="true"] { border-color: rgba(var(--fg-rgb), 0.24); background: rgba(var(--fg-rgb), 0.05); }
.gear { color: var(--ui-strong); }
.gear svg { width: 27px; height: 27px; }

/* ── Settings popover ── */
.settings {
  position: fixed; right: 56px; top: 114px; z-index: 30;
  width: 320px; max-width: calc(100vw - 32px);
  padding: 18px 18px 8px;
  border-radius: 20px;
  background: var(--panel-bg);
  border: 1px solid rgba(var(--fg-rgb), 0.10);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  opacity: 0; transform: translateY(-6px) scale(.98); transform-origin: top right;
  pointer-events: none; transition: opacity .2s, transform .2s;
}
.settings.open { opacity: 1; transform: none; pointer-events: auto; }
.settings h2 { margin: 0 0 12px; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.set-row { padding: 11px 0; border-top: 1px solid rgba(var(--fg-rgb), 0.06); }
.set-row:first-of-type { border-top: 0; }
.set-row label, .set-row .lbl { display: block; font-size: 14px; color: var(--ui); margin-bottom: 8px; }
.set-row.inline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.set-row.inline .lbl { margin: 0; }
.set-row small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.select {
  width: 100%; height: 38px; border-radius: 10px; padding: 0 10px;
  background: rgba(var(--fg-rgb), 0.05); color: var(--ui);
  border: 1px solid rgba(var(--fg-rgb), 0.10); font: 14px var(--sans);
}
.select option { background: var(--panel-solid); color: var(--ui); }
.meter { height: 4px; border-radius: 2px; background: rgba(var(--fg-rgb), 0.07); margin-top: 8px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--orange); border-radius: 2px; transition: width .08s linear; }
input[type=range] { width: 100%; accent-color: var(--orange); }
.seg { display: inline-flex; border: 1px solid rgba(var(--fg-rgb), .12); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 6px 12px; font-size: 13px; color: var(--muted-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--orange-soft); color: var(--ui); }

/* toggle switch (also used in the subtitles pill) */
.switch { position: relative; width: 44px; height: 26px; flex: none; cursor: pointer; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span {
  position: absolute; inset: 0; border-radius: 13px;
  background: rgba(var(--fg-rgb), 0.14); transition: background .25s;
}
.switch span::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #e9e9ea; box-shadow: 0 1px 3px rgba(0,0,0,.35); transition: transform .25s;
}
.switch input:checked + span { background: var(--orange); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid rgba(var(--fg-rgb), .6); outline-offset: 2px; }

/* ── Stage ── */
.orb {
  position: fixed; left: 50%; top: var(--orb-y);
  width: var(--orb-box); height: var(--orb-box);
  transform: translate(-50%, -50%);
  transition: top .9s cubic-bezier(.2,.7,.2,1);
  pointer-events: none;
}
.waves {
  position: fixed; left: 0; right: 0; top: var(--wave-y);
  height: 30vh; width: 100%;
  transform: translateY(-50%);
  transition: top .9s cubic-bezier(.2,.7,.2,1);
  pointer-events: none;
}

.lower {
  position: fixed; left: 0; right: 0; top: var(--lower-top); bottom: 0;
  display: flex; flex-direction: column; align-items: center;
  padding: 0 24px max(16px, calc(14.5vh - 29px));
  transition: top .9s cubic-bezier(.2,.7,.2,1);
}
.question {
  margin: 0; max-width: 980px; text-align: center;
  font-family: var(--serif); font-weight: 400; color: var(--text);
  font-size: clamp(24px, min(4.45vh, 4.6vw), 46px); line-height: 1.22; letter-spacing: -0.2px;
  text-shadow: var(--q-shadow, 0 0 28px rgba(255, 220, 180, 0.08));
  transition: opacity .45s ease, transform .45s ease, filter .45s ease;
  min-height: 1.22em;
}
.question.out { opacity: 0; transform: translateY(8px); filter: blur(3px); }
.question.long { font-size: clamp(22px, min(3.7vh, 3.9vw), 38px); }
body.q-long:not(.cue-mode) { --lower-top: 67vh; }

.cue { display: none; margin-top: 12px; max-width: 760px; text-align: center; transition: opacity .45s ease; }
.cue.on { display: block; }
.cue-say { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.cue ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; }
.cue li { font-size: 16px; color: var(--muted-2); position: relative; }
.cue li::before { content: ''; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--orange); opacity: .8; margin-right: 9px; vertical-align: 3px; }
.timer {
  display: none; margin-top: 14px; align-items: baseline; gap: 10px;
  font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.timer.on { display: inline-flex; }
.timer b { font: 500 22px/1 var(--sans); letter-spacing: .02em; color: var(--ui); font-variant-numeric: tabular-nums; text-transform: none; }
.timer.warn b { color: var(--orange); }

.caption {
  flex: 1; width: 100%; max-width: 860px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 10px 0;
  min-height: calc(3em + 20px);
}
.caption p {
  margin: 0; font-size: 17px; line-height: 1.5; color: rgba(var(--text-rgb), 0.62);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  transition: opacity .3s;
}
body.subs-large .caption p { font-size: 20px; }
.caption p .who { color: var(--orange); font-size: .78em; letter-spacing: .1em; text-transform: uppercase; margin-right: 10px; vertical-align: 1px; }
.caption p.hint { color: var(--muted); font-size: 15px; letter-spacing: .02em; }
.caption p.hint::before {
  content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 10px; vertical-align: 1px;
  background: var(--orange); box-shadow: 0 0 10px rgba(255,106,19,.9); animation: ping 1.6s ease-in-out infinite;
}
body.subs-off .caption p:not(.hint):not(.always) { opacity: 0; }
@keyframes ping { 50% { opacity: .35; } }

.subs {
  height: 58px; padding: 0 17px 0 26px; border-radius: 29px;
  display: inline-flex; align-items: center; gap: 0;
  border: 1px solid rgba(var(--fg-rgb), 0.11);
  background: rgba(var(--fg-rgb), 0.02);
  cursor: pointer; user-select: none;
  transition: opacity .5s;
}
.subs { color: var(--ui-strong); }
.subs svg { width: 25px; height: 25px; flex: none; }
.subs .lbl { font-size: 17px; color: var(--muted-2); margin: 0 38px 0 16px; }

/* start / end panel (replaces the subtitles pill before and after the test) */
.panel { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.panel p { margin: 0; color: var(--muted-2); font-size: 15px; line-height: 1.55; max-width: 560px; }
.btn {
  height: 52px; padding: 0 30px; border-radius: 26px; border: 0; cursor: pointer;
  background: var(--orange); color: var(--on-orange); font-weight: 600; font-size: 16px;
  box-shadow: 0 0 24px rgba(255, 106, 19, 0.35);
  transition: transform .15s, box-shadow .2s, opacity .2s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 0 32px rgba(255, 106, 19, 0.5); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.ghost { background: transparent; color: var(--ui); border: 1px solid rgba(var(--fg-rgb), .18); box-shadow: none; }
.panel-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.link { background: none; border: 0; color: var(--muted); font-size: 14px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; padding: 4px; }
.link:hover { color: var(--ui); }
.err { color: #ffb08a !important; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Part 2: the cue card needs room, so the stage lifts up ── */
body.cue-mode { --orb-y: 32vh; --wave-y: 48vh; --lower-top: 55vh; }

/* ── Smaller desktops / tablets ── */
@media (max-width: 1100px) {
  .brand { left: 32px; }
  .gear { right: 28px; }
  .settings { right: 28px; }
}
@media (max-width: 900px) and (min-width: 761px) {
  .brand .word { display: none; }
}
/* Tablets in portrait: more height than width, so stack like a phone */
@media (orientation: portrait) and (min-width: 761px) {
  :root { --orb-y: 36vh; --wave-y: 52vh; --lower-top: 60vh; --orb-box: min(54vh, 100vw); }
  body.cue-mode { --orb-y: 30vh; --wave-y: 44vh; --lower-top: 51vh; }
}
/* ── Phones and narrow tablets in portrait ── */
@media (max-width: 760px) {
  :root { --orb-y: 37vh; --wave-y: 53vh; --lower-top: 61vh; --orb-box: min(58vh, 104vw); }
  body.cue-mode { --orb-y: 29vh; --wave-y: 42vh; --lower-top: 48vh; }
  .top { height: 150px; }
  .brand { left: 16px; top: 34px; --lg: .7; }
  .brand .word { display: block; }
  .gear { right: 16px; top: 34px; width: 44px; height: 44px; }
  .gear svg { width: 21px; height: 21px; }
  .settings { right: 16px; top: 64px; }
  .exam { top: 70px; width: 100%; }
  .exam-title { font-size: 14px; height: 22px; gap: 12px; }
  .exam-title::before, .exam-title::after { width: 48px; }
  .parts { gap: 10px; margin-top: 10px; }
  .part { width: min(30vw, 104px); height: 40px; font-size: 15px; }
  .question { font-size: clamp(22px, 6.4vw, 30px); }
  .lower { padding-bottom: calc(26px + env(safe-area-inset-bottom)); }
  .caption p { font-size: 15px; }
  .subs { height: 50px; padding: 0 12px 0 18px; }
  .subs .lbl { font-size: 15px; margin: 0 22px 0 12px; }
  .cue li { font-size: 14px; }
}
/* Short landscape screens (e.g. phones sideways, 1366×640 windows) */
@media (max-height: 620px) and (min-width: 761px) {
  .top { height: 110px; }
  .brand, .gear { top: 44px; }
  .exam { top: 10px; }
  .exam-title { height: 26px; font-size: 15px; }
  .parts { margin-top: 6px; }
  .part { height: 38px; }
  .settings { top: 84px; }
  :root { --orb-y: 40vh; --wave-y: 60vh; --lower-top: 69vh; }
  .lower { padding-bottom: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .orb, .waves, .lower, .question { transition: none; }
}
