:root {
  --paper: #08111d;
  --paper-2: #0f2233;
  --ink: #f4f8fb;
  --muted: #8da6b8;
  --teal: #00c7be;
  --teal-deep: #067a76;
  --amber: #f59e0b;
  --line: #274255;
  --good: #22c55e;
  --miss: #f43f5e;
  --stage: #071018;
  --card: #122437;
  --card-2: #10283a;
  --serif: Arial, Helvetica, sans-serif;
  --sans: Arial, Helvetica, sans-serif;
  --choice-bg: #10283a;
  --choice-text: #ffffff;
  --choice-radius: 18px;
  --action-radius: 999px;
  --caption-size: 18px;
  --shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(820px 460px at 12% 0%, color-mix(in srgb, var(--teal) 28%, transparent), transparent 62%),
    radial-gradient(640px 380px at 92% 8%, rgba(124, 58, 237, 0.16), transparent 58%),
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: auto, auto, 32px 32px, 32px 32px;
  background-blend-mode: normal, normal, soft-light, soft-light;
}
button, input, select, textarea { font-family: inherit; color-scheme: dark; }
button { cursor: pointer; }
.hidden { display: none !important; }

header {
  position: sticky;
  top: 16px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 22px;
  width: min(1240px, calc(100% - 32px));
  margin: 16px auto 0;
  padding: 12px 18px;
  background: #0b1724;
  border: 1px solid #1e3244;
  border-radius: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  text-align: left;
}
.mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #10283a;
  border: 1px solid #274255;
  position: relative;
  flex: none;
}
.mark::before, .mark::after {
  content: "";
  position: absolute;
  width: 3px;
  border-radius: 2px;
  bottom: 6px;
}
.mark::before { height: 14px; left: 7px; background: #00c7be; }
.mark::after { height: 9px; left: 16px; background: #f59e0b; }
.brand strong { display: block; font-size: 0.95rem; letter-spacing: 0.08em; text-transform: uppercase; }
.brand span { display: block; color: var(--muted); font-size: 0.75rem; }
.logos { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.logos img { display: block; height: 34px; width: auto; max-width: 120px; object-fit: contain; }
.extra-row, .logo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.extra-card, .logo-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  color: inherit;
}
.logo-card img { height: 72px; width: 100%; object-fit: contain; background: #0b1724; border-radius: 10px; }
.extra-stage { background: #121816; }
.extra-stage video { width: 100%; max-height: 72vh; background: black; }
nav { display: flex; gap: 6px; }
nav button, .ghost, .primary, .choice, .clip, .block {
  border: 1px solid transparent;
}
nav button {
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 500;
}
nav button[aria-current="page"] {
  background: #10283a;
  color: #ffffff;
  border-color: var(--teal);
}
.pill {
  border: 1px solid var(--line);
  background: #10283a;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.82rem;
  color: #c6d7e5;
}

main { padding: 28px; max-width: 1240px; margin: 0 auto; }
html:has(body.game) { height: 100%; overflow: hidden; }
body.game {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background-color: #08111d;
}
body.game header { display: none; }
body.game main {
  height: 100%;
  max-width: none;
  padding: 10px 14px;
  box-sizing: border-box;
  display: flex;
  overflow: hidden;
}
body.game .player {
  flex: 1;
  min-width: 0;
  min-height: 0;
  width: 100%;
  max-width: none;
  display: flex;
  flex-direction: column;
}
body.game .player-top { flex: none; margin-bottom: 8px; }
body.game .stage-wrap {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  container-type: size;
}
body.game .stage {
  width: min(100cqw, calc(100cqh * 16 / 9));
  height: min(100cqh, calc(100cqw * 9 / 16));
}
body.game .player.results-mode { overflow: auto; }
body.game .player.results-mode .stage {
  width: 100%;
  height: 100%;
  max-height: none;
}
body.game .logos img { height: 28px; }
.stage.home-stage {
  aspect-ratio: auto;
  height: auto;
  overflow: auto;
  display: block;
  padding: 22px 26px 32px;
}
.home-stage .gate {
  width: 100%;
  height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.game-footer {
  flex: none;
  margin: 8px 0 0;
  text-align: center;
}
.game-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.game-footer-brand {
  color: #4cd4d1;
  font-weight: 700;
  text-decoration: none;
}
a.game-footer-brand:hover, a.game-footer-brand:focus-visible {
  text-decoration: underline;
}
.player.results-mode .game-footer { position: relative; z-index: 2; }
body.game .player.game-home .stage-wrap {
  overflow: hidden;
  display: block;
}
body.game .player.game-home .stage.home-stage {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
  padding: 6px 16px 8px;
  display: flex;
}
.hero {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 28px;
  align-items: stretch;
  background: #0b1623;
  border: 1px solid #203648;
  border-radius: 36px;
  padding: 36px 40px;
}
.kicker {
  margin: 0 0 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 800; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.2rem, 4vw, 3.4rem); line-height: 1.08; margin: 0 0 14px; }
.lede { font-size: 1.08rem; line-height: 1.5; color: #c4d4e0; max-width: 46rem; margin: 0 0 18px; }
.note { color: var(--muted); font-size: 0.92rem; line-height: 1.45; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0; }
.primary, .ghost {
  border-radius: var(--action-radius);
  padding: 12px 18px;
  font-weight: 600;
}
.primary { background: var(--teal); color: #071018; }
.primary:hover { filter: brightness(1.08); }
.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.ghost:hover { border-color: var(--teal); }
.primary:disabled, .ghost:disabled { opacity: 0.45; cursor: not-allowed; }

.flow {
  background: linear-gradient(180deg, #122437 0%, #0d1b2a 100%);
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.flow ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.flow li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: start;
}
.step-n {
  width: 28px; height: 28px; border-radius: 50%;
  background: #10283a; color: var(--teal); border: 1px solid var(--line);
  display: grid; place-items: center; font-size: 0.8rem; font-weight: 700;
}
.flow strong { display: block; }
.flow span { color: var(--muted); font-size: 0.88rem; }

.board-title { margin: 36px 0 12px; font-size: 1.4rem; }
.comp-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.comp {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px 14px;
}
.comp header { position: static; background: none; border: 0; padding: 0; backdrop-filter: none; display: block; }
.comp h3 { margin: 0 0 8px; font-size: 1.05rem; }
.pair { display: flex; gap: 8px; flex-wrap: wrap; }
.mini {
  border: 1px solid var(--line);
  background: var(--card-2);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.78rem;
  color: #c6d7e5;
}
.mini.ready { border-color: #166534; background: #052e1b; color: #86efac; }
.mini.partial { border-color: #92400e; background: #3b2508; color: #fcd34d; }
.mini button { background: none; border: 0; padding: 0; color: inherit; font: inherit; }

.studio { display: grid; grid-template-columns: 270px minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.blocks, .preview, .work {
  background: linear-gradient(180deg, #122437 0%, #0d1b2a 100%);
  border: 1px solid var(--line);
  border-radius: 24px;
}
.blocks { padding: 8px; max-height: calc(100vh - 110px); overflow: auto; position: sticky; top: 78px; }
.block {
  width: 100%;
  text-align: left;
  background: transparent;
  border-radius: 12px;
  padding: 10px 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
}
.block small { grid-column: 1 / -1; color: var(--muted); }
.block[aria-current="true"] { background: #1a3d52; }
.badge { font-size: 0.72rem; color: var(--muted); }
.badge.ready { color: var(--good); }
.badge.partial { color: var(--amber); }
.work { padding: 16px; }
.work-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; margin-bottom: 8px; }
.work h2 { margin: 0 0 4px; font-size: 1.7rem; }
.group { margin-top: 16px; }
.group h3 { margin: 0 0 8px; font-size: 1rem; }
.clip-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.clip {
  text-align: left;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  color: inherit;
}
.clip.selected { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(0, 199, 190, 0.18); }
.clip .id { font-weight: 600; letter-spacing: 0.03em; }
.clip p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.status { font-size: 0.75rem; font-weight: 600; }
.status.on { color: var(--good); }
.status.off { color: var(--miss); }
.tag {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.72rem;
  border-radius: 999px;
  padding: 1px 7px;
  background: #052e1b;
  color: #86efac;
}
.preview { padding: 12px; position: sticky; top: 78px; max-height: calc(100vh - 110px); overflow: auto; }
.preview video, .preview .ph {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--stage);
  border-radius: 12px;
  object-fit: contain;
}
.ph { display: grid; place-items: center; color: #8da6b8; padding: 16px; text-align: center; }
.preview h3 { margin: 12px 0 6px; font-size: 1.15rem; }
.preview p { margin: 0 0 8px; line-height: 1.4; }
.checks { list-style: none; padding: 0; margin: 8px 0 0; }
.checks li { margin: 6px 0; font-size: 0.86rem; }
.checks label { display: flex; gap: 8px; align-items: flex-start; }
details { margin-top: 8px; }
summary { cursor: pointer; color: var(--teal); font-weight: 700; }
.prompt { white-space: pre-wrap; color: var(--muted); font-size: 0.84rem; line-height: 1.4; }

.drop {
  margin-top: 14px;
  border: 1.5px dashed #3d5a70;
  border-radius: 18px;
  padding: 14px;
  color: var(--muted);
  background: rgba(16, 40, 58, 0.55);
}
body.drag .drop { border-color: var(--teal); background: #10283a; color: var(--ink); }

.player { max-width: 1100px; margin: 0 auto; }
.player-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  background: #0b1724;
  border: 1px solid #1e3244;
  border-radius: 24px;
  padding: 10px 14px;
}
.ticks { display: flex; gap: 3px; flex: 1; }
.ticks i {
  height: 6px;
  flex: 1;
  border-radius: 99px;
  background: #1d3448;
  display: block;
}
.ticks i.on { background: var(--teal); }
.ticks i.now { background: var(--amber); }
.meta { font-size: 0.88rem; color: var(--muted); white-space: nowrap; }
.stage-wrap { position: relative; }
.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--stage);
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid #203648;
  box-shadow: var(--shadow);
}
.reel {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #000;
}
.clip-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  z-index: 0;
  background: #000;
  transition: opacity 1.2s ease;
}
.clip-layer.on { opacity: 1; z-index: 1; }
.clip-layer.hold { opacity: 1; z-index: 1; transition: none; }
.clip-layer.front { z-index: 2; }
.stage video.clip {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
  opacity: 1;
  transition: filter 0.45s ease;
}
.stage.asking video { filter: brightness(0.62) saturate(0.85); }
.slate, .ask, .caption, .skip, .veil, .qsting { position: absolute; }
.ask, .caption { z-index: 3; }
.slate { z-index: 3;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  padding: 36px 40px 32px;
  background:
    radial-gradient(620px 260px at 18% 0%, rgba(0, 199, 190, 0.28), transparent 62%),
    linear-gradient(165deg, #122437 0%, #0b1623 58%, #071018 100%);
  color: #f4f8fb;
}
.slate h2 { margin: 0; font-size: clamp(1.6rem, 3vw, 2.4rem); line-height: 1.15; max-width: 18em; }
.slate p { margin: 0; max-width: 40rem; line-height: 1.45; font-size: 1.05rem; }
.slate .actions { margin-top: 8px; }
.caption {
  left: 8%;
  right: 8%;
  bottom: 28px;
  margin: 0;
  text-align: center;
  color: var(--caption-color, #fff);
  font-size: var(--caption-size);
  font-family: var(--sans);
  line-height: 1.4;
  text-shadow: 0 2px 12px rgba(0,0,0,0.75);
}
.caption.back-plate {
  left: 50%;
  right: auto;
  width: max-content;
  max-width: 84%;
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: 14px;
  background: rgba(5, 10, 16, 0.82);
  text-shadow: none;
}
.caption.back-band {
  left: 0;
  right: 0;
  bottom: 0;
  padding: 42px 8% 18px;
  background: linear-gradient(180deg, transparent, rgba(5, 10, 16, 0.9));
  text-shadow: none;
}
.ask {
  left: 0; right: 0; bottom: 0;
  padding: 54px 28px 22px;
  background: linear-gradient(180deg, transparent, rgba(8,12,10,0.45) 20%, rgba(8,12,10,0.9));
  color: white;
}
.ask h2 { margin: 4px 0 14px; font-size: clamp(1.25rem, 2.4vw, 1.85rem); line-height: 1.2; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice {
  text-align: left;
  background: var(--choice-bg);
  color: var(--choice-text);
  border: 1px solid #274255;
  border-radius: var(--choice-radius);
  padding: 14px 14px 12px;
  line-height: 1.35;
  font-size: 0.98rem;
  font-family: var(--sans);
  font-weight: 700;
}
.choice:hover, .choice:focus-visible { outline: 2px solid var(--teal); }
.choice small { display: block; color: var(--muted); font-size: 0.72rem; margin-bottom: 4px; }
.skip {
  top: 14px;
  right: 14px;
  z-index: 4;
  background: rgba(16,22,20,0.55);
  color: white;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--action-radius);
  padding: 6px 12px;
}
.veil {
  inset: 0;
  z-index: 6;
  background: #05080c;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}
.veil.on { opacity: 1; pointer-events: auto; }
.veil::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 4px;
  background: var(--teal);
  box-shadow: 0 0 18px var(--teal);
  transform: scaleX(0);
  transform-origin: left center;
}
.veil.on::after { animation: veil-wipe 0.28s ease forwards; }
@keyframes veil-wipe { to { transform: scaleX(1); } }
.qsting {
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 28px;
  cursor: pointer;
  color: white;
  background:
    radial-gradient(520px 260px at 50% 42%, color-mix(in srgb, var(--teal) 28%, transparent), transparent 68%),
    rgba(5, 10, 16, 0.62);
}
.qcard {
  width: min(520px, 100%);
  margin: 0;
  padding: 26px 32px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--teal) 75%, white);
  border-radius: 28px;
  background: rgba(8, 16, 28, 0.94);
  color: white;
  font: inherit;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.55);
  animation: sting-in 0.46s cubic-bezier(.2, .85, .2, 1);
}
.qcard:focus { outline: none; }
.qcard:focus-visible { outline: 2px solid white; outline-offset: 8px; }
.qcard .mark {
  width: 84px;
  height: 84px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--teal);
  color: #08111d;
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1;
  animation: qpulse 1.15s ease-out infinite;
}
.qsting .kicker { margin: 0; color: var(--teal); }
.qcard h2 { margin: 8px 0 10px; font-size: clamp(1.8rem, 4vw, 2.8rem); }
.qcard .hint { margin: 0; color: #c6d7e5; font-size: 0.95rem; }
@keyframes sting-in {
  from { opacity: 0; transform: translateY(18px) scale(0.94); }
  to { opacity: 1; transform: none; }
}
@keyframes qpulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--teal) 55%, transparent); }
  100% { box-shadow: 0 0 0 18px transparent; }
}
.ask.enter { animation: ask-up 0.48s cubic-bezier(.2, .8, .2, 1); }
.ask.enter .choice { animation: choice-in 0.42s cubic-bezier(.2, .8, .2, 1) both; }
.ask.enter .choice:nth-child(2) { animation-delay: 0.08s; }
@keyframes ask-up {
  from { opacity: 0; transform: translateY(32px); }
  to { opacity: 1; transform: none; }
}
@keyframes choice-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .veil, .stage video, .clip-layer, .ask.enter, .ask.enter .choice, .qcard, .qcard .mark { animation: none; transition: none; }
}
.sheet {
  margin-top: 16px;
  background: linear-gradient(180deg, #122437 0%, #0b1724 100%);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.score-row { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid #1d3448; font-size: 0.92rem; }
.pips { display: flex; gap: 4px; }
.pips b { width: 10px; height: 10px; border-radius: 50%; background: #1d3448; display: block; }
.pips b.on { background: var(--teal); }
.results-grid { display: grid; grid-template-columns: 280px 1fr; gap: 18px; align-items: center; }
.jobs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.job {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: var(--card-2);
}
.job .rank { color: var(--amber); font-weight: 600; font-size: 0.78rem; letter-spacing: 0.08em; }
.job h3 { margin: 4px 0; font-size: 1.25rem; }
.job a, .sheet a { color: var(--teal); font-weight: 700; }
.log { margin-top: 8px; }
.log li { margin: 6px 0; font-size: 0.88rem; line-height: 1.35; }
.toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: #0b1724;
  border: 1px solid var(--teal);
  color: white;
  padding: 12px 16px;
  border-radius: 999px;
  z-index: 9;
  max-width: min(560px, calc(100% - 24px));
}
.player.results-mode .stage-wrap {
  position: fixed;
  inset: 0;
  z-index: 0;
}
.player.results-mode .stage {
  height: 100%;
  aspect-ratio: auto;
  border-radius: 0;
  background:
    radial-gradient(900px 420px at 15% 0%, rgba(0, 199, 190, 0.28), transparent 55%),
    linear-gradient(165deg, #122437 0%, #0b1623 48%, #071018 100%);
}
.player.results-mode .reel { position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; aspect-ratio: auto; }
.player.results-mode .stage video { object-fit: cover; filter: brightness(0.55) saturate(0.85); }
.player.results-mode .player-top,
.player.results-mode .sheet { position: relative; z-index: 2; }
.player.results-mode .player-top {
  background: #0b1724;
  border-radius: 14px;
  padding: 8px;
}
.player.results-mode .sheet { margin-top: 6vh; }

.personal { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; align-items: start; }
.personal-side, .personal-main {
  background: linear-gradient(180deg, #122437 0%, #0d1b2a 100%);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 16px;
}
.personal-side { position: sticky; top: 78px; max-height: calc(100vh - 96px); overflow: auto; }
.side-nav { display: grid; gap: 6px; margin: 8px 0 16px; }
.side-nav button { text-align: left; border-radius: 12px; }
.side-nav button[aria-current="true"] { background: #1a3d52; color: #ffffff; }
.look-grid, .text-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.88rem; margin-bottom: 12px; }
.field.inline { flex-direction: row; align-items: center; justify-content: space-between; }
.field input[type="text"], .field input[type="number"], .field select, .field textarea, .lang-select, .save-row input {
  font: inherit;
  color: var(--ink);
  background: #0b1724;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
}
.field textarea { min-height: 78px; resize: vertical; width: 100%; }
.field input[type="color"] { width: 100%; height: 40px; padding: 4px; background: #0b1724; border: 1px solid var(--line); border-radius: 12px; }
.original { color: var(--muted); font-size: 0.8rem; line-height: 1.35; }
.preview-stage {
  background: #121816;
  border-radius: 16px;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
  gap: 12px;
  padding: 18px;
  margin-top: 8px;
}
.preview-stage .caption {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  transform: none;
  width: auto;
  max-width: 100%;
  margin: 0;
}
.preview-stage .caption.back-band {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(5, 10, 16, 0.88);
}
.preview-stage .qcard {
  position: relative;
  width: 100%;
  animation: none;
  cursor: default;
  box-shadow: none;
}
.preview-stage .ask { position: relative; background: none; padding: 0; }
.save-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#save-status, #export-status { color: var(--muted); font-size: 0.85rem; }
.export-box { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.export-box .primary { width: 100%; }
#export-status a { color: var(--teal); }
.span-2 { grid-column: 1 / -1; }

.score-mark {
  margin: 8px 0 10px;
  font-family: var(--serif);
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  line-height: 1;
  color: var(--teal);
}
.score-mark .score-got { color: var(--amber); }
.score-pips b.on { background: var(--amber); }
.sheet .pips { margin: 0 0 16px; }
.gate {
  width: min(1080px, 100%);
  margin: 8px auto 48px;
}
.gate-top { display: flex; align-items: center; justify-content: flex-end; gap: 16px; margin-bottom: 22px; }
.gate-top:has(.logos), .gate-top:has(.gate-brand) { justify-content: space-between; }
.gate-brand { letter-spacing: 0.08em; }
.gate-top .logos img { height: 36px; }
.gate-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
  flex: none;
}
.gate-intro h1 {
  font-size: 32px;
  line-height: 1.1;
  margin: 0 0 4px;
  white-space: nowrap;
}
.gate-sub {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}
.gate-intro .lede {
  font-size: 0.92rem;
  line-height: 1.35;
  margin: 0;
  max-width: none;
}
.gate-intro .primary { flex: none; white-space: nowrap; }
.gate-aside {
  padding: 18px;
  border-radius: 24px;
  background: rgba(15, 34, 51, 0.88);
  border: 1px solid var(--line);
}
.gate-aside p { margin: 0 0 14px; color: #c4d4e0; }
.gate-aside .primary { width: 100%; }
.pair-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.pair-legend span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #10283a;
  border: 1px solid color-mix(in srgb, var(--teal) 55%, var(--line));
  color: var(--teal);
  font-family: var(--serif);
  font-weight: 800;
}
.pair-legend b { color: var(--muted); font-weight: 700; }
.pair-legend strong { color: var(--ink); }
.gate-board {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.gate-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 8px 14px;
  border-radius: 16px;
  background: rgba(15, 34, 51, 0.9);
  border: 1px solid var(--line);
  color: inherit;
}
.gate-card:hover, .gate-card:focus-visible {
  border-color: var(--teal);
  outline: none;
}
.gate-index {
  font-family: var(--serif);
  font-size: 1.35rem;
  color: var(--teal);
  font-weight: 800;
}
.gate-copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.gate-copy strong { font-size: 1.02rem; }
.gate-copy span {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}
.gate-go {
  color: #071018;
  background: var(--teal);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 700;
}

@media (max-width: 1100px) {
  .gate-intro h1 { font-size: clamp(18px, 2.9vw, 32px); }
}
@media (max-width: 980px) {
  .hero, .studio, .comp-list, .results-grid, .jobs, .choices, .clip-grid, .personal, .look-grid, .text-grid, .gate-intro, .gate-board { grid-template-columns: 1fr; }
  body.game .gate-intro { display: flex; }
  body.game .gate-board { grid-template-columns: 1fr 1fr; grid-template-rows: repeat(5, minmax(0, 1fr)); }
  .hero { padding: 22px; border-radius: 24px; }
  .studio { grid-template-columns: 1fr; }
  .blocks, .preview, .personal-side { position: static; max-height: none; }
  header { flex-wrap: wrap; top: 8px; width: calc(100% - 16px); padding: 12px 14px; }
  main { padding: 16px; }
  .slate { padding: 22px; }
}

@media (max-width: 820px), (max-height: 520px) and (max-width: 980px) {
  html { -webkit-text-size-adjust: 100%; }
  .toast { bottom: calc(12px + env(safe-area-inset-bottom)); }

  header {
    gap: 8px;
    margin-top: max(8px, env(safe-area-inset-top));
    padding: 8px 10px;
    border-radius: 18px;
  }
  header .logos img { height: 22px; max-width: 72px; }
  .brand { min-width: 0; }
  .brand strong { font-size: 0.82rem; letter-spacing: 0.04em; }
  .brand > span:last-child > span { display: none; }
  nav { width: 100%; }
  nav button { flex: 1; min-height: 40px; padding: 8px 10px; }
  .pill { margin-left: auto; }
  h1 { font-size: clamp(1.65rem, 7vw, 2.3rem); }
  .hero { padding: 16px; border-radius: 20px; gap: 16px; }
  .hero .actions { flex-direction: column; align-items: stretch; }
  .hero .actions .primary { width: 100%; min-height: 46px; }
  .hero .actions .ghost { min-height: 44px; }
  .field.inline { flex-direction: column; align-items: stretch; gap: 6px; }
  .field input[type="text"], .field input[type="number"], .field select, .field textarea, .lang-select, .save-row input { font-size: 16px; }
  .work-head { flex-direction: column; }
  .work h2 { font-size: 1.35rem; }
  .side-nav { grid-template-columns: 1fr; }
  .side-nav button { min-height: 44px; }

  .player-top {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 16px;
  }
  .player-top .ghost, .player-top .lang-select, #sub-toggle { min-height: 42px; }
  .lang-select { max-width: 46vw; }
  .meta {
    white-space: normal;
    flex: 1 0 100%;
    order: 5;
    min-width: 0;
    font-size: 0.78rem;
    line-height: 1.3;
  }
  .ticks { flex: 1 0 100%; order: 6; }
  .logos img { height: 26px; max-width: 84px; }
  .stage { border-radius: 16px; }
  .skip { min-height: 40px; padding: 8px 14px; }
  .caption { font-size: min(var(--caption-size), 16px); }
  .slate { padding: 18px 16px 16px; gap: 8px; }
  .slate h2 { font-size: clamp(1.3rem, 5.5vw, 1.7rem); }
  .slate p { font-size: 0.98rem; }
  .slate .actions .primary, .slate .actions .ghost { min-height: 46px; }
  .qcard { padding: 18px 16px 16px; border-radius: 22px; }
  .qcard .mark { width: 64px; height: 64px; font-size: 2rem; margin-bottom: 8px; }
  .qcard h2 { font-size: clamp(1.45rem, 6vw, 2rem); }
  .ask { padding: 16px 12px 14px; }
  .ask h2 { font-size: 1.12rem; }
  .choice { min-height: 48px; font-size: 0.95rem; padding: 12px; }

  .stage:has(.qsting:not(.hidden)) {
    width: 100%;
    height: min(68dvh, 640px);
    max-height: none;
    aspect-ratio: auto;
  }
  .stage:has(.qsting:not(.hidden)) .qsting { overflow: auto; }
  .stage:has(.slate:not(.hidden)) {
    display: block;
    width: 100%;
    height: auto;
    min-height: 0;
    max-height: none;
    aspect-ratio: auto;
    overflow: hidden;
  }
  .stage:has(.slate:not(.hidden)) .reel { display: none; }
  .stage:has(.slate:not(.hidden)) .slate {
    position: relative;
    inset: auto;
    overflow: visible;
    justify-content: flex-start;
  }
  .stage:not(.asking):not(.home-stage):not(:has(.slate:not(.hidden))):not(:has(.qsting:not(.hidden))) {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: auto;
    aspect-ratio: auto;
    overflow: hidden;
  }
  .stage:not(.asking):not(.home-stage):not(:has(.slate:not(.hidden))):not(:has(.qsting:not(.hidden))) .reel {
    position: relative;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    max-height: 56dvh;
    flex: none;
  }
  .stage:not(.asking):not(.home-stage):not(:has(.slate:not(.hidden))):not(:has(.qsting:not(.hidden))) .caption,
  .stage:not(.asking):not(.home-stage):not(:has(.slate:not(.hidden))):not(:has(.qsting:not(.hidden))) .caption.back-plate,
  .stage:not(.asking):not(.home-stage):not(:has(.slate:not(.hidden))):not(:has(.qsting:not(.hidden))) .caption.back-band {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    transform: none;
    width: auto;
    max-width: 100%;
    margin: 0;
    padding: 10px 12px;
    border-radius: 0;
    font-size: 15px;
    line-height: 1.35;
    background: rgba(5, 10, 16, 0.92);
    text-shadow: none;
  }

  .stage.asking:not(:has(.qsting:not(.hidden))) {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: auto;
    min-height: 0;
    max-height: none;
    aspect-ratio: auto;
    overflow: visible;
  }
  .stage.asking:not(:has(.qsting:not(.hidden))) .reel {
    position: relative;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    max-height: 46dvh;
    flex: none;
  }
  .stage.asking:not(:has(.qsting:not(.hidden))) .ask {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    padding: 14px 12px calc(14px + env(safe-area-inset-bottom));
    background: #0b1623;
  }

  .sheet { padding: 16px; border-radius: 18px; }
  .player.results-mode .sheet { margin-top: 10px; }
  .sheet .actions { flex-direction: column; }
  .sheet .actions .primary, .sheet .actions .ghost { width: 100%; min-height: 46px; }
  .score-row { flex-wrap: wrap; align-items: flex-start; }
  .score-row > span { flex: 1 1 12rem; min-width: 0; }
  .results-grid canvas { width: min(100%, 260px); height: auto; justify-self: center; }
  .job h3 { font-size: 1.1rem; }
  .game-footer p { letter-spacing: 0.04em; font-size: 0.65rem; line-height: 1.45; }

  .stage.home-stage { padding: 12px 10px 16px; }
  .gate { margin-bottom: 16px; }
  .gate-intro {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .gate-intro h1 {
    white-space: normal;
    font-size: clamp(1.35rem, 6.2vw, 1.75rem);
  }
  .gate-intro .lede { font-size: 0.9rem; }
  .gate-intro .primary {
    width: 100%;
    white-space: normal;
    min-height: 46px;
  }
  .gate-board {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-auto-rows: auto;
    gap: 8px;
  }
  .gate-card {
    min-height: 64px;
    padding: 12px;
    gap: 10px;
  }
  .gate-index { font-size: 1.15rem; }
  .gate-copy strong { font-size: 0.98rem; line-height: 1.25; }
  .gate-go { min-height: 36px; display: inline-flex; align-items: center; }

  html:has(body.game) { height: auto; overflow: visible; }
  body.game {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }
  body.game main {
    display: block;
    height: auto;
    overflow: visible;
    padding:
      calc(8px + env(safe-area-inset-top))
      calc(10px + env(safe-area-inset-right))
      calc(10px + env(safe-area-inset-bottom))
      calc(10px + env(safe-area-inset-left));
  }
  body.game .player { flex: none; min-height: 0; }
  body.game .player-top {
    position: sticky;
    top: env(safe-area-inset-top);
    z-index: 6;
  }
  body.game .stage-wrap {
    display: block;
    container-type: normal;
    flex: none;
    overflow: visible;
  }
  body.game .stage {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    max-height: none;
  }
  body.game .player.game-home .stage.home-stage {
    aspect-ratio: auto;
    height: auto;
    max-height: none;
    overflow: visible;
    display: block;
  }
  body.game .home-stage .gate { height: auto; }
  body.game .player.game-home .stage-wrap {
    overflow: visible;
    height: auto;
  }
  body.game .gate-board {
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }
}

@media (max-width: 820px), (max-height: 740px) and (max-width: 980px) {
  html:has(body.answering) {
    height: 100%;
    overflow: hidden;
  }
  body.answering {
    height: 100dvh;
    max-height: 100dvh;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  body.answering header {
    position: static;
    flex: none;
    top: auto;
    margin-top: 8px;
  }
  body.answering main {
    flex: 1;
    min-height: 0;
    height: auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  body.answering .player {
    flex: 1;
    min-height: 0;
    width: 100%;
    max-width: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  body.answering .player-top {
    position: static;
    flex: none;
  }
  body.answering .game-footer { display: none; }
  body.answering .stage-wrap {
    flex: 1;
    min-height: 0;
    display: block;
    overflow: auto;
    container-type: normal;
    -webkit-overflow-scrolling: touch;
  }
  body.answering .stage.asking {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: auto;
    min-height: 0;
    max-height: none;
    aspect-ratio: auto;
    overflow: visible;
  }
  body.answering .stage.asking .reel {
    position: relative;
    width: 100%;
    height: auto;
    flex: none;
    aspect-ratio: 16 / 9;
    max-height: min(30dvh, 220px);
  }
  body.answering .stage.asking .ask {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    flex: none;
    background: #0b1623;
  }
}

@media (max-height: 520px) and (min-width: 640px) {
  .stage.asking .choices { grid-template-columns: 1fr 1fr; }
  .stage.asking .ask h2 { font-size: 1rem; margin-bottom: 8px; }
}
