/* ==========================================================================
   ENSAMien · ENERGY LAB LIVE — design system
   Palette and typography taken from the ENERGY LAB CRASH TEST #05 deck:
   graphite #0E1116 / #12161C, safety amber #FFB400, off-white #F4F6F8,
   Arial Black / Arial Narrow.
   ========================================================================== */

:root {
  color-scheme: dark;
  --bg: #0e1116;
  --bg-2: #12161c;
  --panel: #151a22;
  --panel-2: #1a2029;
  --line: #2a3240;
  --line-2: #323c4a;
  --text: #f4f6f8;
  --sand: #d5d0c4;
  --muted: #a9b3c0;
  --dim: #6f7a89;
  --amber: #ffb400;
  --amber-soft: #d9b55a;
  --amber-dim: #8a6a1a;
  --amber-wash: rgba(255, 180, 0, 0.08);
  --ok: #4fd18b;
  --ok-wash: rgba(79, 209, 139, 0.12);
  --bad: #ff5a4e;
  --bad-wash: rgba(255, 90, 78, 0.12);

  --font-display: "Arial Black", "Arial Bold", "Helvetica Neue", Arial, sans-serif;
  --font-narrow: "Arial Narrow", "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
  --font-body: Arial, "Helvetica Neue", Helvetica, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, "Roboto Mono", Consolas, monospace;

  --radius: 4px;
  --gutter: 16px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: -1px -1px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--amber); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
[hidden] { display: none !important; }

h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 900; letter-spacing: 0.01em; line-height: 1.02; text-transform: uppercase; }

.narrow { font-family: var(--font-narrow); font-stretch: condensed; text-transform: uppercase; letter-spacing: 0.08em; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.amber { color: var(--amber); }

/* ---- Brand mark (crash-test target) ------------------------------------ */
.mark { width: 28px; height: 28px; flex: none; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand__text { display: flex; flex-direction: column; line-height: 1; }
.brand__name { font-family: var(--font-display); font-size: 15px; letter-spacing: 0.04em; }
.brand__sub { font-family: var(--font-narrow); font-size: 11px; letter-spacing: 0.18em; color: var(--amber); margin-top: 3px; }

/* ---- Hazard stripe accent ---------------------------------------------- */
.hazard {
  height: 6px;
  background: repeating-linear-gradient(-45deg, var(--amber) 0 10px, var(--bg) 10px 20px);
  opacity: 0.9;
}

/* ---- Labels & tags ------------------------------------------------------- */
.eyebrow {
  font-family: var(--font-narrow);
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--amber);
}
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  font-family: var(--font-narrow);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.tag--amber { border-color: var(--amber-dim); color: var(--amber); background: var(--amber-wash); }
.tag--ok { border-color: rgba(79, 209, 139, 0.4); color: var(--ok); background: var(--ok-wash); }
.tag--bad { border-color: rgba(255, 90, 78, 0.4); color: var(--bad); background: var(--bad-wash); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex: none; }
.dot--on { background: var(--ok); box-shadow: 0 0 0 3px rgba(79, 209, 139, 0.15); }
.dot--off { background: var(--bad); }
.dot--wait { background: var(--amber); animation: blink 1.4s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.25; } }

/* ---- Panels -------------------------------------------------------------- */
.panel {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  position: relative;
}
.panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.panel__title { font-family: var(--font-narrow); font-size: 13px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
.panel__body { padding: 16px; }
.corners::before,
.corners::after {
  content: ""; position: absolute; width: 14px; height: 14px; border-color: var(--amber); border-style: solid; pointer-events: none;
}
.corners::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.corners::after { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }

/* ---- Buttons ------------------------------------------------------------- */
.btn {
  -webkit-appearance: none; appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  font-family: var(--font-narrow);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.08s, opacity 0.15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:hover:not(:disabled) { border-color: var(--muted); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.32; cursor: not-allowed; }
.btn--primary { background: var(--amber); border-color: var(--amber); color: #111; }
.btn--primary:hover:not(:disabled) { background: #ffc534; border-color: #ffc534; }
.btn--ghost { background: transparent; }
.btn--danger { border-color: rgba(255, 90, 78, 0.5); color: var(--bad); background: transparent; }
.btn--danger:hover:not(:disabled) { background: var(--bad-wash); border-color: var(--bad); }
.btn--block { width: 100%; }
.btn--xl { min-height: 60px; font-size: 18px; }
.btn--sm { min-height: 34px; padding: 6px 10px; font-size: 13px; }
.btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-busy::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--text) transparent var(--text) transparent;
  animation: spin 0.7s linear infinite;
}
.btn--primary.is-busy::after { border-color: #111 transparent #111 transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Forms --------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.field label { font-family: var(--font-narrow); font-size: 13px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
.input {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 18px;
  font-family: var(--font-body);
}
.input:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-wash); }
.input--big { font-family: var(--font-display); font-size: 22px; text-transform: uppercase; letter-spacing: 0.04em; }

.alert {
  display: flex; gap: 10px; align-items: center;
  padding: 12px 14px; margin-bottom: 18px;
  border: 1px solid rgba(255, 90, 78, 0.45);
  border-left: 4px solid var(--bad);
  background: var(--bad-wash);
  border-radius: var(--radius);
  font-family: var(--font-narrow); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: #ffd2ce;
}

/* ---- Six-digit code input ----------------------------------------------- */
.code-input { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 6px 0 22px; }
.code-input input {
  width: 100%; aspect-ratio: 0.82; min-width: 0;
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-bottom: 3px solid var(--line-2);
  border-radius: var(--radius);
  color: var(--text);
  text-align: center;
  font-family: var(--font-mono);
  font-size: clamp(26px, 8vw, 40px);
  font-weight: 700;
  caret-color: var(--amber);
  padding: 0;
}
.code-input input:focus { outline: none; border-color: var(--amber); border-bottom-color: var(--amber); background: var(--amber-wash); }
.code-input input.filled { border-bottom-color: var(--amber); }

/* ---- Public / mobile shell ---------------------------------------------- */
.mobile {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  padding: 0 var(--gutter) calc(20px + env(safe-area-inset-bottom));
}
.mobile__top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(14px + env(safe-area-inset-top)) 0 14px;
  border-bottom: 1px solid var(--line);
}
.mobile__main { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 26px 0; }
.mobile__foot { text-align: center; color: var(--dim); font-size: 12px; font-family: var(--font-narrow); letter-spacing: 0.14em; text-transform: uppercase; padding-top: 10px; }

.hero-title { font-size: clamp(44px, 15vw, 72px); line-height: 0.92; }
.hero-title span { color: var(--amber); display: block; font-size: 0.42em; letter-spacing: 0.1em; margin-top: 10px; font-family: var(--font-narrow); font-weight: 700; }

/* ---- Team play app ------------------------------------------------------- */
.status-strip { display: flex; align-items: center; gap: 8px; font-family: var(--font-narrow); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.team-chip { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.05; }
.team-chip__name { font-family: var(--font-display); font-size: 15px; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-chip__score { font-family: var(--font-mono); font-size: 13px; color: var(--amber); }

.stage { display: flex; flex-direction: column; gap: 18px; animation: rise 0.35s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.stage__big { font-size: clamp(34px, 11vw, 52px); }
.stage__center { text-align: center; align-items: center; }

.pulse-ring { width: 120px; height: 120px; margin: 4px auto 8px; position: relative; }
.pulse-ring::before, .pulse-ring::after {
  content: ""; position: absolute; inset: 0; border: 2px solid var(--amber); border-radius: 50%;
  animation: ping 2.2s var(--ease) infinite; opacity: 0;
}
.pulse-ring::after { animation-delay: 1.1s; }
.pulse-ring svg { position: absolute; inset: 28px; width: 64px; height: 64px; }
@keyframes ping { 0% { transform: scale(0.55); opacity: 0.9; } 100% { transform: scale(1.15); opacity: 0; } }

.question-card { padding: 18px; }
.question-card__label { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.question-card__context { font-family: var(--font-display); font-size: clamp(20px, 6vw, 26px); line-height: 1.15; margin: 0 0 8px; text-transform: none; }
.question-card__prompt { color: var(--muted); font-family: var(--font-narrow); letter-spacing: 0.1em; text-transform: uppercase; font-size: 14px; }

.timer { display: flex; align-items: center; gap: 12px; }
.timer__bar { flex: 1; height: 8px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.timer__fill { height: 100%; width: 100%; background: var(--amber); transform-origin: left; transition: transform 0.25s linear, background 0.3s; }
.timer__num { font-family: var(--font-mono); font-weight: 700; font-size: 22px; min-width: 3ch; text-align: right; }
.timer.is-low .timer__fill { background: var(--bad); }
.timer.is-low .timer__num { color: var(--bad); }
.timer.is-paused .timer__fill { background: var(--dim); }

.options { display: grid; gap: 10px; }
.option {
  -webkit-appearance: none; appearance: none;
  display: flex; align-items: center; gap: 14px;
  width: 100%; min-height: 64px;
  padding: 12px 14px;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 17px; font-weight: 700; line-height: 1.25;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s, background 0.15s, opacity 0.2s;
}
.option:active:not(:disabled) { background: var(--panel-2); }
.option:hover:not(:disabled) { border-color: var(--amber-dim); }
.option__key {
  flex: none; width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--amber-dim); border-radius: 2px;
  font-family: var(--font-display); color: var(--amber); font-size: 18px;
}
.option.is-chosen { border-color: var(--amber); background: var(--amber-wash); }
.option.is-chosen .option__key { background: var(--amber); color: #111; }
.option.is-correct { border-color: var(--ok); background: var(--ok-wash); }
.option.is-correct .option__key { background: var(--ok); border-color: var(--ok); color: #0b1a12; }
.option.is-wrong { border-color: var(--bad); background: var(--bad-wash); }
.option.is-faded { opacity: 0.4; }
.option:disabled { cursor: default; }
.options--tf { grid-template-columns: 1fr 1fr; }
.options--tf .option { flex-direction: column; justify-content: center; min-height: 110px; text-align: center; font-family: var(--font-display); font-size: 22px; }

.receipt { padding: 18px; display: flex; flex-direction: column; gap: 8px; border-left: 4px solid var(--amber); }
.receipt__head { font-family: var(--font-display); font-size: 22px; }
.result-banner { padding: 22px 18px; border-radius: var(--radius); text-align: center; border: 1px solid; }
.result-banner--ok { border-color: var(--ok); background: var(--ok-wash); }
.result-banner--bad { border-color: var(--bad); background: var(--bad-wash); }
.result-banner--none { border-color: var(--line-2); background: var(--panel); }
.result-banner h2 { font-size: clamp(30px, 9vw, 42px); }
.result-banner--ok h2 { color: var(--ok); }
.result-banner--bad h2 { color: var(--bad); }
.result-banner__pts { font-family: var(--font-mono); font-size: 20px; margin-top: 6px; }

.explain { padding: 16px; font-size: 16px; line-height: 1.5; color: var(--sand); }
.explain strong { color: var(--text); }
.note { margin-top: 10px; padding: 12px; border: 1px dashed var(--line-2); border-radius: var(--radius); font-size: 14px; color: var(--muted); }
.note b { color: var(--amber-soft); font-family: var(--font-narrow); letter-spacing: 0.12em; text-transform: uppercase; font-size: 12px; display: block; margin-bottom: 4px; }

/* Matching */
.match-defs { display: grid; gap: 8px; }
.match-def { display: flex; gap: 10px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); font-size: 15px; }
.match-def b { color: var(--amber); font-family: var(--font-display); }
.match-row { display: grid; gap: 8px; padding: 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); }
.match-row__word { font-family: var(--font-display); font-size: 18px; text-transform: none; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.seg button {
  min-height: 48px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--panel); color: var(--text);
  font-family: var(--font-display); font-size: 18px; cursor: pointer; touch-action: manipulation;
}
.seg button.is-on { background: var(--amber); border-color: var(--amber); color: #111; }
.seg button.is-correct { background: var(--ok); border-color: var(--ok); color: #0b1a12; }
.seg button.is-wrong { border-color: var(--bad); color: var(--bad); }

/* Sequence (Final Boss) */
.seq-slots { display: grid; gap: 6px; }
.seq-slot__num { margin-left: 2px; }
.question-card--compact { padding: 14px; }
.question-card--compact .question-card__context { font-size: 18px; margin-bottom: 4px; }
.question-card--compact .question-card__label { margin-bottom: 8px; }
.seq-slot {
  display: flex; align-items: center; gap: 12px;
  min-height: 52px; padding: 5px 8px;
  border: 1px dashed var(--line-2); border-radius: var(--radius);
  background: var(--bg-2);
  transition: border-color 0.15s, background 0.15s;
}
.seq-slot.is-target { border-color: var(--amber); background: var(--amber-wash); }
.seq-slot__num { flex: none; width: 34px; height: 34px; display: grid; place-items: center; font-family: var(--font-display); color: var(--amber); border: 1px solid var(--amber-dim); border-radius: 50%; }
.seq-slot__empty { color: var(--dim); font-family: var(--font-narrow); letter-spacing: 0.14em; text-transform: uppercase; font-size: 13px; }
.seq-card {
  flex: 1; display: flex; align-items: center; gap: 10px;
  min-height: 42px; padding: 7px 10px;
  background: var(--panel-2); border: 1px solid var(--line-2); border-left: 4px solid var(--amber);
  border-radius: var(--radius);
  font-family: var(--font-narrow); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; font-size: 15px; line-height: 1.12;
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
}
.seq-card__key { font-family: var(--font-display); color: var(--amber); }
.seq-card__tools { margin-left: auto; display: flex; gap: 4px; }
.seq-card__tools button { width: 34px; height: 34px; border: 1px solid var(--line-2); background: var(--bg); color: var(--text); border-radius: var(--radius); font-size: 16px; cursor: pointer; touch-action: manipulation; }
.seq-pool { display: grid; gap: 6px; }
.seq-pool .seq-card { border-left-color: var(--line-2); }
.seq-ghost { position: fixed; z-index: 1000; pointer-events: none; opacity: 0.92; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5); transform: rotate(-1.5deg); }
.seq-card.is-dragging { opacity: 0.35; }
.seq-card.is-correct { border-left-color: var(--ok); }
.seq-card.is-wrong { border-left-color: var(--bad); }

.leader-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.leader-row { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 10px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.leader-row.is-me { border-color: var(--amber); background: var(--amber-wash); }
.leader-row__rank { font-family: var(--font-display); color: var(--amber); }
.leader-row__name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leader-row__score { font-family: var(--font-mono); font-weight: 700; }

.big-rank { font-family: var(--font-display); font-size: 88px; line-height: 1; color: var(--amber); }

.overlay {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center; padding: 24px;
  background: rgba(14, 17, 22, 0.88);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  text-align: center;
}
.overlay__box { display: grid; gap: 12px; justify-items: center; }
.overlay h2 { font-size: clamp(34px, 10vw, 64px); color: var(--amber); }

.net-banner {
  position: fixed; left: 0; right: 0; top: 0; z-index: 60;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  background: #2b1d00; border-bottom: 1px solid var(--amber-dim);
  font-family: var(--font-narrow); font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; text-align: center; color: var(--amber);
}

.toast-stack { position: fixed; z-index: 70; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 440px); }
.toast {
  padding: 12px 14px; border-radius: var(--radius); background: var(--panel-2); border: 1px solid var(--line-2); border-left: 4px solid var(--amber);
  font-family: var(--font-narrow); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; font-size: 14px;
  animation: rise 0.25s var(--ease);
}
.toast--error { border-left-color: var(--bad); }
.toast--ok { border-left-color: var(--ok); }

/* ---- Host ---------------------------------------------------------------- */
.host { min-height: 100vh; display: flex; flex-direction: column; }
.host-top {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 10px 20px;
  background: rgba(18, 22, 28, 0.96);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.host-top__stats { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; flex: 1; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat__label { font-family: var(--font-narrow); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--dim); }
.stat__value { font-family: var(--font-display); font-size: 18px; white-space: nowrap; }
.stat__value--code { font-family: var(--font-mono); font-weight: 700; color: var(--amber); font-size: 24px; letter-spacing: 0.12em; }
.host-top__actions { display: flex; gap: 8px; align-items: center; }

.host-grid {
  display: grid; gap: 16px; padding: 16px 20px 24px;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: start;
  flex: 1;
}
.host-col { display: grid; gap: 16px; min-width: 0; }
@media (max-width: 1100px) { .host-grid { grid-template-columns: 1fr; } }

.missions-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.mstep { padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); min-width: 0; }
.mstep__code { font-family: var(--font-display); color: var(--dim); font-size: 13px; }
.mstep__title { font-family: var(--font-narrow); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mstep.is-current { border-color: var(--amber); background: var(--amber-wash); }
.mstep.is-current .mstep__code { color: var(--amber); }
.mstep.is-done .mstep__code { color: var(--ok); }

.phase-title { font-size: 34px; }
.stage-grid { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 16px; }
@media (max-width: 1300px) { .stage-grid { grid-template-columns: 1fr; } }
.host-q__context { font-family: var(--font-display); font-size: 24px; line-height: 1.15; text-transform: none; margin: 6px 0; }
.host-opts { display: grid; gap: 6px; margin-top: 12px; }
.host-opt { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); font-size: 15px; }
.host-opt b { font-family: var(--font-display); color: var(--amber); min-width: 18px; }
.host-opt.is-key { border-color: var(--ok); background: var(--ok-wash); }
.host-opt.is-key b { color: var(--ok); }
.gauge { display: grid; gap: 10px; align-content: start; }
.gauge__big { font-family: var(--font-mono); font-size: 54px; font-weight: 700; line-height: 1; }
.gauge__big small { font-size: 22px; color: var(--dim); }
.gauge .timer__num { font-size: 40px; }

.controls { display: grid; gap: 10px; }
.controls__row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 1300px) { .controls__row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.controls__primary { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }

.team-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.team-table th { text-align: left; padding: 8px 10px; font-family: var(--font-narrow); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--dim); font-weight: 400; border-bottom: 1px solid var(--line); }
.team-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.team-table tr:last-child td { border-bottom: 0; }
.team-table .num { font-family: var(--font-mono); text-align: right; }
.team-name { font-weight: 700; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-sub { font-size: 12px; color: var(--dim); }
.menu-btn { width: 32px; height: 32px; border-radius: var(--radius); border: 1px solid var(--line-2); background: transparent; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; }
.menu-btn:hover { border-color: var(--amber); color: var(--amber); }
.empty { padding: 26px 16px; text-align: center; color: var(--dim); font-family: var(--font-narrow); letter-spacing: 0.14em; text-transform: uppercase; font-size: 13px; }

.log { max-height: 260px; overflow: auto; font-family: var(--font-mono); font-size: 12.5px; }
.log__row { display: grid; grid-template-columns: 76px 1fr; gap: 10px; padding: 5px 16px; border-bottom: 1px solid rgba(42, 50, 64, 0.6); }
.log__time { color: var(--dim); }

dialog {
  border: 1px solid var(--line-2); border-radius: var(--radius); padding: 0;
  background: var(--bg-2); color: var(--text); width: min(92vw, 460px);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.dialog__body { padding: 20px; display: grid; gap: 14px; }
.dialog__title { font-size: 22px; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
.recovery-code { font-family: var(--font-mono); font-size: 44px; font-weight: 700; color: var(--amber); letter-spacing: 0.2em; text-align: center; padding: 10px; border: 1px dashed var(--amber-dim); border-radius: var(--radius); }

.page { max-width: 1100px; margin: 0 auto; padding: 24px 20px 60px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 18px 0 22px; flex-wrap: wrap; }
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.session-card { padding: 16px; display: grid; gap: 10px; }
.session-card__code { font-family: var(--font-mono); font-size: 32px; font-weight: 700; color: var(--amber); letter-spacing: 0.12em; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { font-family: var(--font-narrow); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--dim); font-weight: 400; }
.table-wrap { overflow-x: auto; }
.table td.mono { white-space: nowrap; }
.cell-ok { color: var(--ok); }
.cell-bad { color: var(--bad); }

/* ---- Projector ----------------------------------------------------------- */
.display {
  height: 100vh; overflow: hidden;
  display: grid; grid-template-rows: auto 1fr auto;
  font-size: 1.2vw;
  cursor: default;
}
.display.hide-cursor { cursor: none; }
.d-top { display: flex; justify-content: space-between; align-items: center; padding: 1.6vw 2.6vw 1vw; }
.d-top .mark { width: 2.6vw; height: 2.6vw; }
.d-top .brand__name { font-size: 1.3vw; }
.d-top .brand__sub { font-size: 0.9vw; }
.d-top__right { display: flex; align-items: center; gap: 1.6vw; font-family: var(--font-narrow); letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); font-size: 1vw; }
.d-code-mini { font-family: var(--font-mono); color: var(--amber); font-weight: 700; letter-spacing: 0.14em; font-size: 1.5vw; }
.d-main { padding: 0 2.6vw; min-height: 0; position: relative; }
.d-foot { padding: 1vw 2.6vw 1.4vw; display: flex; justify-content: space-between; align-items: center; font-family: var(--font-narrow); letter-spacing: 0.2em; text-transform: uppercase; color: var(--dim); font-size: 0.9vw; }
.d-progress { display: flex; gap: 0.5vw; }
.d-progress span { width: 3.2vw; height: 0.35vw; background: var(--line-2); }
.d-progress span.is-done { background: var(--amber-dim); }
.d-progress span.is-current { background: var(--amber); }

.d-scene { height: 100%; animation: rise 0.5s var(--ease); }
.d-eyebrow { font-family: var(--font-narrow); letter-spacing: 0.3em; text-transform: uppercase; color: var(--amber); font-size: 1.3vw; }
.d-huge { font-size: 7.4vw; line-height: 0.9; }
.d-big { font-size: 4.6vw; line-height: 0.95; }

.d-lobby { display: grid; grid-template-columns: 1.35fr 1fr; grid-template-rows: minmax(0, 1fr) auto; column-gap: 3vw; row-gap: 1.2vw; height: 100%; align-items: center; }
.d-lobby .d-huge { font-size: 6.2vw; }
.d-join__url { font-family: var(--font-mono); font-size: 2vw; color: var(--text); margin: 1.1vw 0 0; }
.d-join__label { font-family: var(--font-narrow); font-size: 1.15vw; letter-spacing: 0.3em; color: var(--muted); text-transform: uppercase; margin-top: 1.4vw; }
.d-code { display: flex; gap: 0.7vw; margin-top: 0.6vw; }
.d-code span {
  width: 5.4vw; height: 6.8vw; display: grid; place-items: center;
  background: var(--bg-2); border: 1px solid var(--line-2); border-bottom: 0.35vw solid var(--amber);
  font-family: var(--font-mono); font-weight: 700; font-size: 4.8vw; color: var(--text);
}
.d-qr { justify-self: center; display: grid; gap: 1vw; justify-items: center; }
.d-qr svg { display: block; width: 17vw; height: 17vw; border-radius: 0.4vw; }
.d-qr__cap { font-family: var(--font-narrow); letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); font-size: 0.95vw; text-align: center; margin: 0; }
.d-teams { grid-column: 1 / -1; align-self: end; }
.d-teams__head { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--line); padding-top: 0.8vw; margin-bottom: 0.8vw; }
.d-teams__count { font-family: var(--font-mono); font-size: 2vw; font-weight: 700; }
.d-teams__count b { color: var(--amber); }
.d-team-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.6vw; }
.d-team {
  display: flex; align-items: center; gap: 0.8vw; padding: 0.6vw 1vw; min-width: 0; min-height: 3.6vw;
  background: var(--bg-2); border: 1px solid var(--line); border-left: 0.3vw solid var(--amber);
  animation: arrive 0.7s var(--ease);
}
.d-team.is-off { border-left-color: var(--bad); opacity: 0.6; }
.d-team__name { font-family: var(--font-display); font-size: 1.35vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-team__st { font-family: var(--font-narrow); letter-spacing: 0.16em; font-size: 0.85vw; color: var(--muted); text-transform: uppercase; }
.d-team--empty { border: 1px dashed var(--line); border-left: 1px dashed var(--line); background: transparent; color: var(--dim); font-family: var(--font-narrow); letter-spacing: 0.2em; font-size: 0.9vw; justify-content: center; animation: none; }
@keyframes arrive { 0% { opacity: 0; transform: translateY(1vw) scale(0.96); background: var(--amber-wash); } 60% { background: var(--amber-wash); } 100% { opacity: 1; transform: none; } }

.d-intro { height: 100%; display: grid; align-content: center; gap: 1.6vw; max-width: 80vw; }
.d-intro__code { font-family: var(--font-display); font-size: 14vw; line-height: 0.8; color: transparent; -webkit-text-stroke: 0.15vw var(--amber); }
.d-intro__obj { font-size: 2vw; color: var(--sand); max-width: 62vw; }
.d-intro__meta { display: flex; gap: 1vw; }
.d-intro__meta .tag { font-size: 1vw; padding: 0.4vw 0.8vw; }

.d-question { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 1.4vw; padding-bottom: 0.4vw; }
.d-question > .d-options, .d-question > .d-match, .d-question > .d-seq { align-self: center; }
.d-q__head { display: flex; justify-content: space-between; align-items: center; gap: 2vw; }
.d-q__context { font-family: var(--font-display); font-size: 3.3vw; line-height: 1.08; text-transform: none; max-width: 92%; }
.d-q__prompt { font-family: var(--font-narrow); letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); font-size: 1.4vw; margin-top: 0.6vw; }
.d-options { display: grid; grid-template-columns: 1fr 1fr; gap: 1vw; align-content: start; }
.d-options--3 { grid-template-columns: repeat(3, 1fr); }
.d-option {
  display: flex; align-items: center; gap: 1.2vw; padding: 1.6vw 1.6vw;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 0.3vw;
  font-size: 2.3vw; font-weight: 700; line-height: 1.15;
  transition: opacity 0.5s, border-color 0.4s, background 0.4s;
}
.d-option__key { flex: none; width: 3.4vw; height: 3.4vw; display: grid; place-items: center; border: 1px solid var(--amber-dim); color: var(--amber); font-family: var(--font-display); font-size: 1.9vw; }
.d-option.is-correct { border-color: var(--ok); background: var(--ok-wash); }
.d-option.is-correct .d-option__key { background: var(--ok); color: #0b1a12; border-color: var(--ok); }
.d-option.is-faded { opacity: 0.25; }
.d-match { display: grid; grid-template-columns: 1fr 2fr; gap: 1.4vw; }
.d-match__words { display: grid; gap: 0.8vw; align-content: start; }
.d-match__word { padding: 1vw 1.2vw; background: var(--bg-2); border: 1px solid var(--line-2); font-family: var(--font-display); font-size: 1.8vw; text-transform: none; display: flex; gap: 1vw; align-items: center; }
.d-match__word b { color: var(--amber); }
.d-match__word em { margin-left: auto; font-style: normal; font-family: var(--font-display); color: var(--ok); }
.d-match .d-option { font-size: 1.6vw; padding: 1vw 1.2vw; }

.d-bottom { display: grid; grid-template-columns: 1fr auto; gap: 2vw; align-items: center; }
.d-timer .timer__bar { height: 1vw; }
.d-timer .timer__num { font-size: 3.6vw; min-width: 4ch; }
.d-subs { font-family: var(--font-mono); font-size: 2.2vw; font-weight: 700; text-align: right; white-space: nowrap; }
.d-subs small { display: block; font-family: var(--font-narrow); font-size: 0.95vw; letter-spacing: 0.2em; color: var(--muted); font-weight: 400; }
.d-band {
  display: flex; align-items: center; justify-content: center; gap: 1.2vw; padding: 1.2vw;
  background: var(--amber); color: #111; font-family: var(--font-display); font-size: 2.2vw; letter-spacing: 0.04em;
}
.d-reveal { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1.6vw; align-items: start; }
.d-explain { padding: 1.4vw 1.6vw; background: var(--bg-2); border: 1px solid var(--line-2); border-left: 0.35vw solid var(--ok); font-size: 1.55vw; line-height: 1.4; color: var(--sand); }
.d-explain h3 { font-family: var(--font-narrow); letter-spacing: 0.24em; font-size: 1vw; color: var(--ok); margin-bottom: 0.6vw; font-weight: 700; }
.d-explain .note { font-size: 1.15vw; margin-top: 1vw; padding: 0.9vw; }
.d-explain .note b { font-size: 0.85vw; }
.d-results { display: flex; flex-wrap: wrap; gap: 0.6vw; margin-top: 1vw; }
.d-results .tag { font-size: 1vw; padding: 0.35vw 0.7vw; }

.d-seq { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.2vw; align-items: stretch; }
.d-seq--reveal { gap: 3vw; }
.d-seq__card {
  position: relative; padding: 1.6vw 1.4vw; min-height: 11vw;
  display: grid; align-content: space-between; gap: 1vw;
  background: var(--bg-2); border: 1px solid var(--line-2); border-top: 0.4vw solid var(--amber);
  font-family: var(--font-display); font-size: 1.9vw; line-height: 1.05;
}
.d-seq__card .d-seq__key { color: var(--amber); font-size: 2.4vw; }
.d-seq--reveal .d-seq__card { border-top-color: var(--ok); opacity: 0; animation: seqIn 0.6s var(--ease) forwards; }
.d-seq--reveal .d-seq__card:not(:last-child)::after {
  content: "→"; position: absolute; right: -1.5vw; top: 50%; transform: translate(50%, -50%);
  color: var(--ok); font-size: 2.2vw; line-height: 1; z-index: 2;
}
.d-seq__step { font-family: var(--font-narrow); font-size: 1vw; letter-spacing: 0.22em; color: var(--ok); }
@keyframes seqIn { from { opacity: 0; transform: translateX(-2vw); } to { opacity: 1; transform: none; } }

.d-board { display: grid; gap: 0.7vw; max-width: 72vw; margin: 0 auto; width: 100%; }
.d-board__row {
  display: grid; grid-template-columns: 5vw 1fr 1fr 11vw; align-items: center; gap: 1.4vw;
  padding: 0.9vw 1.4vw; background: var(--bg-2); border: 1px solid var(--line);
  animation: rise 0.5s var(--ease) both;
}
.d-board__row:first-child { border-color: var(--amber); background: var(--amber-wash); }
.d-board__rank { font-family: var(--font-display); font-size: 2.4vw; color: var(--amber); }
.d-board__name { font-family: var(--font-display); font-size: 2vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-board__bar { height: 0.8vw; background: var(--panel-2); }
.d-board__bar i { display: block; height: 100%; background: var(--amber); transform-origin: left; animation: grow 0.9s var(--ease) both; }
.d-board__score { font-family: var(--font-mono); font-size: 2.2vw; font-weight: 700; text-align: right; white-space: nowrap; }
.d-board--compact { gap: 0.5vw; }
.d-board--compact .d-board__row { grid-template-columns: 3.6vw 1fr 0.7fr 10vw; gap: 1vw; padding: 0.55vw 1.1vw; }
.d-board--compact .d-board__rank { font-size: 1.7vw; }
.d-board--compact .d-board__name { font-size: 1.5vw; }
.d-board--compact .d-board__score { font-size: 1.6vw; }
.d-board--compact .d-board__bar { height: 0.6vw; }
@keyframes grow { from { transform: scaleX(0); } }

.d-final { height: 100%; display: grid; grid-template-columns: 1fr 1.1fr; gap: 3vw; align-items: center; overflow: hidden; }
.d-winner { display: grid; gap: 0.8vw; align-content: center; }
.d-winner .d-big { font-size: 4.4vw; }
.d-winner__name { font-size: 5vw !important; line-height: 0.95; color: var(--amber); overflow-wrap: anywhere; }
.d-winner__score { font-family: var(--font-mono); font-size: 2.2vw; }
.d-winner .d-intro__obj { font-size: 1.4vw; }

.d-pause { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(14, 17, 22, 0.9); z-index: 5; }
.d-pause h2 { font-size: 7vw; color: var(--amber); }

.d-offline { position: fixed; top: 0; left: 0; right: 0; padding: 0.5vw; text-align: center; background: #2b1d00; color: var(--amber); font-family: var(--font-narrow); letter-spacing: 0.2em; font-size: 0.9vw; z-index: 30; }
.d-fs { position: fixed; right: 1vw; bottom: 1vw; z-index: 40; opacity: 0; transition: opacity 0.3s; }
.display:hover .d-fs { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
