:root {
  color-scheme:dark;
  --gold:#f4c542;
  --blue:#177ddc;
  /* TG-2.4 (field feedback 2026-11-11): colors switched — blue = correct letter in the correct place
     (solves and the placed dice hint), gold = in the word; gold 10% less intense than before
     (#e4a900 → #cd9800, border #ffcf3f → #e5ba39). */
  --correct:#177ddc;
  --correct-border:#75baff;
  --correct-ink:#ffffff;
  --present:#cd9800;
  --present-border:#e5ba39;
  --present-ink:#17120a;
  --red:#d94b4b;
  --panel:#172033;
  --ink:#f5f7fb;
}

* { box-sizing:border-box; }
body {
  min-height:100vh;
  margin:0;
  color:var(--ink);
  background:radial-gradient(circle at top,#24385c,#0b1020 55%);
  font-family:Segoe UI,Arial,sans-serif;
}
header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:1rem;
  padding:1rem 1.5rem;
  border-bottom:2px solid var(--gold);
  background:#080c16cc;
}
h1,h2,h3,p { margin-top:0; }
h1 { margin-bottom:0; font-size:clamp(1.3rem,3vw,2rem); letter-spacing:.05em; }
main { width:min(1180px,96vw); margin:1.25rem auto; }
.panel {
  margin-bottom:1rem;
  padding:1rem;
  border:1px solid #405071;
  border-radius:14px;
  background:var(--panel);
  box-shadow:0 8px 30px #0005;
}
.grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:1rem; }
.row { display:flex; flex-wrap:wrap; align-items:center; gap:.65rem; }
label { display:grid; gap:.35rem; font-weight:600; }
input,select,textarea,button { font:inherit; }
input,select,textarea {
  padding:.65rem;
  color:var(--ink);
  border:1px solid #607092;
  border-radius:8px;
  background:#0c1426;
}
textarea { width:100%; min-height:8rem; resize:vertical; }
button,.button {
  display:inline-block;
  padding:.7rem 1rem;
  color:#07101d;
  border:0;
  border-radius:8px;
  background:var(--gold);
  font-weight:800;
  text-decoration:none;
  cursor:pointer;
}
button.secondary,.button.secondary { color:var(--ink); background:#385075; }
button.danger { color:white; background:#9a3030; }
button:disabled { opacity:.4; cursor:not-allowed; }
.status { padding:.4rem .7rem; border-radius:999px; background:#33415f; font-size:.8rem; font-weight:700; text-transform:uppercase; }
.header-status { display:flex; align-items:center; gap:.45rem; }
.version { color:#aab8d2; font-size:.75rem; font-weight:700; letter-spacing:.06em; }
.connected { color:#74efad; }
.disconnected { color:#ff8e8e; }
.message { min-height:1.5rem; color:#ffd27a; font-weight:700; }
.small,.key-help { color:#aab8d2; font-size:.8rem; font-weight:700; }
.hidden { display:none !important; }
.winner { color:var(--gold); font-size:clamp(1.5rem,4vw,3rem); text-align:center; }
.score-calc { padding:.45rem .6rem; border-left:3px solid var(--gold); background:#0e1729; }
.setup-grid { display:grid; grid-template-columns:minmax(280px,1.25fr) minmax(320px,1fr); gap:1rem; }
.settings-grid { display:grid; grid-template-columns:1fr 1fr; gap:.7rem; align-content:start; }
.bank-workflow {
  display:grid;
  grid-template-columns:minmax(260px,.85fr) minmax(420px,1.4fr);
  gap:.7rem 1rem;
  margin-bottom:.8rem;
  padding:.75rem;
  border:1px solid #526586;
  border-radius:10px;
  background:#0e1729;
}
.bank-workflow > div:first-child { display:grid; align-content:start; gap:.2rem; }
.bank-workflow strong { color:var(--gold); font-size:1.05rem; }
.bank-details { color:#c8d6ea; font-size:.82rem; }
.bank-actions { display:grid; grid-template-columns:minmax(230px,1fr) auto auto; align-items:end; gap:.5rem; }
.bank-actions .file-picker { font-size:.8rem; }
.bank-actions input[type=file] { width:100%; padding:.4rem; font-weight:400; }
.bank-workflow .message { grid-column:1/-1; margin:0; min-height:0; }
.configuration-actions { display:flex; flex-wrap:wrap; gap:.55rem; align-items:center; }
.section-heading,.progress-card-head,.progress-status,.progress-metrics,.progress-qpi {
  display:flex; align-items:center; justify-content:space-between; gap:.5rem;
}
.section-heading h2 { margin-bottom:0; }
.control-strip { display:grid; grid-template-columns:1fr 1fr 1.2fr auto auto; align-items:center; gap:.65rem; }
.control-strip > div { display:grid; gap:.15rem; }
.control-strip .message { grid-column:1/-1; margin:0; min-height:0; }
.progress-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:.55rem; }
.progress-card { padding:.65rem; border:1px solid #526586; border-radius:10px; background:#0e1729; }
.progress-card.offline { border-color:#9a4d58; opacity:.78; }
.progress-card-head { padding-bottom:.4rem; border-bottom:1px solid #354765; }
.progress-card-head span { font-size:.7rem; font-weight:800; }
.progress-status { margin:.45rem 0; color:#bcd0ef; font-size:.77rem; font-weight:800; }
.progress-challenge { min-height:1.8rem; margin:.35rem 0; color:var(--gold); text-align:center; font-size:1.05rem; font-weight:900; }
.operator-answer { margin-left:.45rem; color:#f5f7fb; }
.progress-metrics,.progress-qpi { flex-wrap:wrap; font-size:.76rem; }
.progress-qpi { margin-top:.45rem; padding-top:.4rem; border-top:1px solid #354765; color:#c9d9ef; }
.progress-qpi b { color:var(--gold); }

.challenge { text-align:center; }
.dice { display:flex; justify-content:center; gap:1rem; margin:1rem; }
.die {
  display:grid;
  width:88px;
  height:88px;
  place-items:center;
  color:#111;
  border-radius:14px;
  background:#fff;
  box-shadow:inset 0 0 0 4px #d4d7dd;
  font-size:2.8rem;
  font-weight:900;
}
.die.rolling { animation:diceRoll 3s cubic-bezier(.2,.8,.2,1); }
.die.off { opacity:.28; }
@keyframes diceRoll {
  0% { transform:rotate(0) scale(.65); filter:blur(5px); }
  70% { transform:rotate(690deg) scale(1.12); filter:blur(1px); }
  100% { transform:rotate(720deg) scale(1); filter:none; }
}
.hint { color:var(--gold); font-size:2rem; font-weight:900; letter-spacing:.35em; }
.hint-grid { display:grid; grid-template-columns:repeat(5,42px); justify-content:center; gap:.35rem; margin:.45rem auto; }
.hint-tile {
  display:grid;
  width:42px;
  height:42px;
  place-items:center;
  border:2px solid #556481;
  border-radius:7px;
  background:#111a2b;
  font-size:1.35rem;
  font-weight:900;
}
.hint-tile.correct { border-color:var(--correct-border); background:var(--correct); color:var(--correct-ink); }
.clock { color:#8fc6ff; font-size:2.2rem; font-weight:900; font-variant-numeric:tabular-nums; }

.table-wrap { width:100%; overflow-x:auto; }
table { width:100%; border-collapse:collapse; }
th,td { padding:.6rem; border-bottom:1px solid #384967; text-align:left; white-space:nowrap; }
th { color:#bcd0ef; }
.rank { font-size:1.25rem; font-weight:900; }
.qualifier { background:#1c5b3b66; }

.guess-grid { display:grid; width:max-content; gap:.45rem; margin:1rem auto; }
.guess-row { display:grid; grid-template-columns:repeat(5,52px); gap:.4rem; }
.tile {
  display:grid;
  width:52px;
  height:52px;
  place-items:center;
  border:2px solid #556481;
  border-radius:7px;
  background:#111a2b;
  font-size:1.4rem;
  font-weight:900;
}
.tile.correct { border-color:var(--correct-border); background:var(--correct); color:var(--correct-ink); }
.tile.present { border-color:var(--present-border); background:var(--present); color:var(--present-ink); }
.tile.absent { border-color:#805462; background:#462f38; }
.tile.violation { border-color:#ff9292; background:var(--red); }
.guess-row.input-row .tile { border-color:var(--gold); }
.guess-row.input-row .tile.cursor { box-shadow:inset 0 -4px 0 var(--gold); }
.key-help { margin:.25rem 0 0; text-align:center; }

.screen-gate {
  position:fixed;
  z-index:100;
  inset:0;
  display:grid;
  place-items:center;
  padding:1rem;
  background:rgba(0,0,0,.9);
  backdrop-filter:grayscale(1) brightness(.35);
}
.screen-gate.waiting { background:rgba(4,9,20,.78); backdrop-filter:grayscale(.75) brightness(.5); }
.screen-gate.qualified { background:rgba(5,20,14,.86); backdrop-filter:grayscale(.5) brightness(.45); }
.screen-gate.disconnected { background:rgba(24,3,7,.9); }
.screen-gate-card {
  width:min(680px,92vw);
  padding:clamp(1.2rem,4vw,2.4rem);
  border:2px solid #596984;
  border-radius:18px;
  background:#0b1220f2;
  box-shadow:0 18px 70px #000c;
  text-align:center;
}
.screen-gate.waiting .screen-gate-card { border-color:#75baff; }
.screen-gate.qualified .screen-gate-card { border-color:#74efad; }
.screen-gate.disconnected .screen-gate-card { border-color:#ff8e8e; }
.screen-gate-name { color:#aab8d2; font-weight:800; letter-spacing:.08em; text-transform:uppercase; }
.screen-gate h2 { margin:.7rem 0; color:var(--gold); font-size:clamp(2rem,6vw,4rem); }
.screen-gate p { margin:0 auto 1rem; max-width:54ch; color:#edf3ff; font-size:clamp(1rem,2.5vw,1.35rem); }
.screen-gate-connection { color:#74efad; font-size:.85rem; font-weight:900; letter-spacing:.08em; }
.screen-gate.disconnected .screen-gate-connection { color:#ff8e8e; }

/* Operator dimensions were approved during v2.2R1 human testing. */
.operator header { padding:.32rem .72rem; }
.operator header h1 { font-size:1.47rem; }
.operator main { margin:.25rem auto; }
.operator .panel { margin-bottom:.28rem; padding:.42rem .58rem; }
.operator .grid { gap:.52rem; }
.operator #links h2 { margin:0; }
.operator .die { width:52px; height:52px; border-radius:9px; font-size:1.67rem; }
.operator .dice { margin:.25rem; }
.operator .hint { font-size:1.32rem; }
.operator .hint-grid { grid-template-columns:repeat(5,30px); gap:.25rem; margin:.25rem auto; }
.operator .hint-tile { width:30px; height:30px; border-radius:5px; font-size:1rem; }
.operator .clock { font-size:1.57rem; }
.operator .challenge p { margin-bottom:.3rem; }
.operator h2 { margin-bottom:.33rem; font-size:1.25rem; }
.operator h3,.operator p { margin-bottom:.35rem; }
.operator th,.operator td { padding:.25rem .35rem; }
.operator button,.operator .button { padding:.45rem .7rem; }
.operator .winner { font-size:1.55rem; }
.operator .standings-table { font-size:.86rem; }
.operator .standings-table th,.operator .standings-table td { padding:.2rem .27rem; }
.operator .standings-table th { white-space:normal; }
.operator .standings-table td[rowspan] { vertical-align:middle; }
.operator .standings-table .playoff-stage td { border-bottom:2px solid #536586; background:#10192a; }
.operator .guess-history-scroll { max-height:12rem; overflow:auto; }
.operator .guess-history-table thead { position:sticky; top:0; z-index:1; background:var(--panel); }
.history-tiles { display:inline-flex; gap:.16rem; }
.history-tile {
  display:grid;
  width:25px;
  height:25px;
  place-items:center;
  border:1px solid #556481;
  border-radius:4px;
  background:#111a2b;
  font-size:.78rem;
  font-weight:900;
}
.history-tile.correct { border-color:var(--correct-border); background:var(--correct); color:var(--correct-ink); }
.history-tile.present { border-color:var(--present-border); background:var(--present); color:var(--present-ink); }
.history-tile.absent { border-color:#805462; background:#462f38; }
.history-tile.violation { border-color:#ff9292; background:var(--red); }

@media (max-height:900px) {
  body:not(.operator) header { padding:.38rem .85rem; }
  body:not(.operator) main { margin:.32rem auto; }
  body:not(.operator) .panel { margin-bottom:.25rem; padding:.4rem; }
  body:not(.operator) .grid { gap:.6rem; }
  body:not(.operator) .die { width:54px; height:54px; font-size:1.75rem; }
  body:not(.operator) .dice { margin:.22rem; }
  body:not(.operator) .hint { font-size:1.32rem; }
  body:not(.operator) .hint-grid { margin:.25rem auto; }
  body:not(.operator) .clock { font-size:1.55rem; }
  body:not(.operator) h2,body:not(.operator) p { margin-bottom:.3rem; }
  body:not(.operator) th,body:not(.operator) td { padding:.28rem; }
  body:not(.operator) .tile { width:35px; height:35px; font-size:1rem; }
  body:not(.operator) .guess-row { grid-template-columns:repeat(5,35px); gap:.22rem; }
  body:not(.operator) .guess-grid { gap:.14rem; margin:.18rem auto; }
  body:not(.operator) .message { min-height:1.25rem; }
  body:not(.operator) .key-help { margin-top:.12rem; }
}

@media (max-width:800px) {
  header { align-items:flex-start; flex-direction:column; }
  .setup-grid,.settings-grid,.control-strip,.bank-workflow,.bank-actions { grid-template-columns:1fr; }
  .guess-row { grid-template-columns:repeat(5,44px); }
  .tile { width:44px; height:44px; }
}

/* v3.0h — on-screen letter keyboard on every contestant screen. Colors match the guess grid:
   blue = correct place, gold = in the word (TG-2.4), dark = not in the word; plain keys are still available. */
.vb-keyboard { width:min(100%,520px); margin:.5rem auto 0; display:flex; flex-direction:column; gap:5px; user-select:none; -webkit-user-select:none; touch-action:manipulation; contain:inline-size; }
.vb-keyboard.hidden { display:none; }
.vb-key-row { display:flex; justify-content:center; gap:5px; }
.vb-key { flex:0 1 calc((100% - 45px) / 10); min-width:0; height:var(--kb-key-h,46px); padding:0; border:1px solid #5f7894; border-radius:7px; background:#3a5068; color:#fff; font:800 1.1rem/1 Segoe UI,Arial,sans-serif; cursor:pointer; -webkit-tap-highlight-color:transparent; }
.vb-key-wide { flex-basis:calc((100% - 45px) / 10 * 1.5); font-size:.78rem; letter-spacing:.03em; }
.vb-key:active { transform:translateY(1px); filter:brightness(1.15); }
.vb-key.kb-correct { border-color:var(--correct-border); background:var(--correct); color:var(--correct-ink); }
.vb-key.kb-present { border-color:var(--present-border); background:var(--present); color:var(--present-ink); }
.vb-key.kb-absent { border-color:#2b3a4a; background:#18222d; color:#6e8193; }
.vb-keyboard-idle .vb-key { opacity:.55; cursor:default; }
.vb-keyboard-idle .vb-key:active { transform:none; filter:none; }
@media (max-height:900px) { body:not(.operator) { --kb-key-h:36px; } body:not(.operator) .vb-keyboard { margin-top:.25rem; gap:4px; } body:not(.operator) .vb-key-row { gap:4px; } }
@media (max-height:700px) { body:not(.operator) { --kb-key-h:30px; } }

/* v3.0i — T3 contestant seats: OPEN HERE (this laptop) and the seat link for another device. */
.seat-help { margin:.35rem 0 .5rem; color:#bcd0ef; font-size:.85rem; line-height:1.35; }
.seat-list { display:grid; gap:.35rem; }
.seat-row { display:grid; grid-template-columns:5.2rem minmax(8rem,14rem) 10rem auto 1fr; align-items:center; gap:.5rem; padding:.3rem .45rem; border:1px solid #384967; border-radius:8px; background:#111a2b; }
.seat-row.unused { opacity:.45; }
.seat-id { font-size:1.05rem; }
.seat-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.seat-state { font-size:.75rem; font-weight:800; letter-spacing:.04em; }
.seat-state.on { color:#5be39a; }
.seat-state.off { color:#ffb15c; }
.seat-state.dnf { color:#ff7d7d; }
.seat-row:not(:has(.seat-state)) .seat-open { grid-column:4; }
.seat-lan { display:flex; flex-wrap:wrap; align-items:center; gap:.35rem; min-width:0; }
.seat-link { min-width:0; max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; padding:.2rem .4rem; border-radius:5px; background:#0b1020; color:#cfe3ff; font-size:.78rem; user-select:all; }
.seat-none { color:#9aaccb; font-size:.8rem; }
@media (max-width:900px) { .seat-row { grid-template-columns:5.2rem 1fr auto; } .seat-lan { grid-column:1/-1; } .seat-row:not(:has(.seat-state)) .seat-open { grid-column:auto; } }

/* v3.0i — contestant seat waiting before T3 locks the field. */
.seat-wait { font-size:1.05rem; color:#cfe3ff; }

/* v3.0j — T3 device assignment under the contestant names. */
.device-assign-title { display:block; margin-top:.5rem; color:#bcd0ef; font-size:.85rem; }
.device-assign { display:grid; gap:.3rem; margin-top:.3rem; }
.device-pick { display:grid; grid-template-columns:1fr auto; align-items:center; gap:.5rem; font-size:.9rem; }
.device-pick span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.device-pick select { min-width:7.5rem; }
.seat-row .seat-id { white-space:nowrap; font-size:.95rem; }

/* v3.0k — T3 device-change requests (another browser asks for a device link). */
.device-requests { position:fixed; top:.6rem; left:50%; transform:translateX(-50%); z-index:200; display:grid; gap:.4rem; width:min(980px,96vw); }
.device-requests.hidden { display:none; }
.device-request { display:flex; flex-wrap:wrap; align-items:center; gap:.5rem .8rem; padding:.6rem .9rem; border:2px solid #62d4ff; border-radius:10px; background:#0b2a3d; color:#eaf7ff; box-shadow:0 6px 24px #000a; }
.device-request strong { color:#62d4ff; letter-spacing:.03em; }
.device-request span { flex:1 1 18rem; font-size:.9rem; }
.device-request .device-approve { background:#1d7a4c; border:1px solid #5be39a; color:#fff; }
.device-request .device-deny { background:#5a1d24; border:1px solid #ff7d7d; color:#fff; }

/* v3.0l: VA PASS (QB only). */
.pass-row { display:flex; justify-content:center; margin-top:.4rem; }
.pass-button { background:#6b2fa3; color:#fff; border:1px solid #b788ff; font-weight:800; letter-spacing:.03em; padding:.45rem 1rem; }
.pass-button.hidden { display:none; }
@media (max-height:900px) { body:not(.operator) .pass-row { margin-top:.2rem; } body:not(.operator) .pass-button { padding:.3rem .8rem; font-size:.85rem; } }
.idle-flag { color:#17120a; background:#ffd27a; border-radius:4px; padding:0 .35rem; font-weight:800; }

/* TG-1.0: guess time limit per line, time-out hints. */
.clock-row { display:flex; align-items:baseline; justify-content:center; gap:1rem; flex-wrap:wrap; }
.line-clock { font-size:1.2rem; font-weight:900; color:#ffd27a; font-variant-numeric:tabular-nums; border:1px solid #5d4a1e; border-radius:6px; padding:.1rem .5rem; }
.line-clock.low { color:#fff; background:#a51d2d; border-color:#ff6678; }
.line-clock.hidden, .hint-box.hidden { display:none; }
.tile.timed-out { border-style:dashed; border-color:#4a5a6e; background:transparent; }
.tile.timeout { background:transparent; }
.hint-box { width:min(100%,520px); margin:.4rem auto 0; display:flex; flex-direction:column; gap:.25rem; }
.hint-line { display:flex; align-items:center; gap:.6rem; padding:.3rem .6rem; border-radius:6px; background:#2a1730; border:1px solid #6e2a5e; color:#f3d6ea; font-weight:700; font-size:.9rem; }
.hint-line.newest { border-color:#ff4fa3; background:#3a1638; color:#fff; }
.hint-number { font-size:.72rem; letter-spacing:.06em; color:#ff9fd0; }
.hint-letter { display:inline-grid; place-items:center; width:2rem; height:2rem; border-radius:5px; background:#d81b78; color:#fff; font-weight:900; font-size:1.2rem; }
.hint-line.newest .hint-letter { animation:vbq-hint-pulse 1s ease-in-out infinite alternate; }
@keyframes vbq-hint-pulse { from { opacity:1; } to { opacity:.35; } }
@media (prefers-reduced-motion: reduce) { .hint-line.newest .hint-letter { animation:none; outline:2px solid #fff; } }
.vb-key.kb-hint { background:#d81b78; border-color:#ff7fbd; color:#fff; }
.progress-hints { margin-top:.25rem; color:#ff9fd0; font-weight:800; font-size:.8rem; }
@media (max-height:900px) { body:not(.operator) .hint-line { padding:.15rem .5rem; } body:not(.operator) .hint-letter { width:1.6rem; height:1.6rem; font-size:1rem; } }

/* TG-1.1: one-line hint box of fixed height (never grows); PASS clearer and above the keyboard. */
.hint-box { height:2.5rem; min-height:2.5rem; max-height:2.5rem; overflow:hidden; display:flex; flex-direction:row; align-items:stretch; }
.hint-box.empty { border:1px dashed #3b2a40; border-radius:6px; align-items:center; justify-content:center; }
.hint-placeholder { color:#6f5a78; font-size:.66rem; font-weight:800; letter-spacing:.06em; }
.hint-box .hint-line { flex:1; min-width:0; padding:.2rem .5rem; white-space:nowrap; }
.hint-box .hint-message { overflow:hidden; text-overflow:ellipsis; min-width:0; flex:1; }
.hint-box .hint-letter { width:1.8rem; height:1.8rem; font-size:1.1rem; flex:none; }
.hint-earlier { flex:none; display:inline-flex; align-items:center; gap:.2rem; color:#ff9fd0; font-size:.66rem; letter-spacing:.05em; }
.hint-chip { display:inline-grid; place-items:center; width:1.25rem; height:1.25rem; border-radius:4px; background:#7a1149; color:#fff; font-size:.75rem; font-weight:900; }
.pass-row { margin:.35rem 0 .1rem; }
.pass-button { background:transparent; color:#9d8bb0; border:1px dashed #5d4a75; font-size:.82rem; }
.pass-button.pass-usable { background:#8a2be2; color:#fff; border:2px solid #e0c4ff; box-shadow:0 0 0 2px rgba(224,196,255,.25); }
.pass-button.pass-ready { animation:vbq-pass-ready .6s ease-in-out 3; }
@keyframes vbq-pass-ready { 50% { box-shadow:0 0 14px 4px rgba(224,196,255,.85); } }
@media (prefers-reduced-motion: reduce) { .pass-button.pass-ready { animation:none; } }
@media (max-height:900px) { body:not(.operator) .hint-box { height:2.1rem; min-height:2.1rem; max-height:2.1rem; } body:not(.operator) .hint-box .hint-letter { width:1.5rem; height:1.5rem; font-size:.95rem; } }

/* TG-1.5: Total QPI first and emphasised. */
.standings-table td.qpi-total strong { color:#ffd27a; font-size:1.05em; }
.standings-table th small { color:#7f8ea8; font-weight:600; }

/* TG-1.9: practice bots / TEST session. */
.test-banner { position:sticky; top:0; z-index:40; margin:0; padding:.5rem 1rem; background:#5a3a00; color:#ffe2a8; border-bottom:2px solid #ffb300; font-weight:800; text-align:center; }
.test-banner.hidden { display:none; }
.bot-tag { margin-left:.4rem; padding:.05rem .4rem; border-radius:4px; background:#5a3a00; color:#ffe2a8; font-size:.7rem; letter-spacing:.05em; }
.seat-row.bot-seat { border-style:dashed; }
.bot-tag { white-space:nowrap; display:inline-block; }
.seat-row.bot-seat .seat-id { white-space:nowrap; margin-right:.75rem; }

/* TG-2.1 competition level word mix */
.word-mix { margin:10px 0 4px; padding:10px 12px; border:1px solid rgba(255,255,255,.14); border-radius:10px; }
.word-mix > label { max-width:320px; }
.mix-row { display:flex; flex-wrap:wrap; gap:10px; align-items:flex-end; margin-top:8px; }
.mix-row label { width:96px; }
.mix-row input { width:100%; }
.mix-row button { margin-bottom:2px; }

/* TG-2.6: T3 warning before Start QA / playoff when a waiting contestant is disconnected. */
.start-warning { margin:.4rem 0 0; padding:.35rem .6rem; border:1px solid #ff8e8e; border-radius:6px; background:#3a1820; color:#ffd0d0; font-weight:700; }
.start-warning.hidden { display:none; }

/* TG-2.7: the roll's rule and letters it does not allow. */
/* TG-2.8 — roll color code + insignia (color-blind safe: Okabe-Ito bluish green / vermillion, and the
   mark itself carries the meaning). YES = ✓ solid ring; NO = ✕ dashed ring. Same marks on T3 and keys. */
:root { --roll-yes:#009e73; --roll-yes-ink:#ffffff; --roll-no:#d55e00; --roll-no-ink:#ffffff; }
.roll-rule { margin:.35rem 0 .2rem; font-weight:800; letter-spacing:.01em; }
.roll-rule.roll-no { color:#ffb27a; }
.roll-rule.roll-yes { color:#7fe0c2; }
.die { position:relative; }
.die-sc.roll-yes { box-shadow:inset 0 0 0 5px var(--roll-yes); }
.die-sc.roll-no { box-shadow:inset 0 0 0 5px var(--roll-no); color:#8a8a8a; background:repeating-linear-gradient(135deg,#fff 0 9px,#f1e2d8 9px 12px); }
.die-mark { position:absolute; top:3px; right:5px; font-size:.42em; line-height:1; font-weight:900; }
.die-sc.roll-yes .die-mark { color:var(--roll-yes); }
.die-sc.roll-no .die-mark { color:var(--roll-no); }
.die-yn { display:flex; flex-direction:column; justify-content:center; align-items:center; gap:.1em; }
.die-yn.roll-yes { background:var(--roll-yes); color:var(--roll-yes-ink); box-shadow:inset 0 0 0 4px #7fe0c2; }
.die-yn.roll-no { background:var(--roll-no); color:var(--roll-no-ink); box-shadow:none; outline:4px dashed #ffb27a; outline-offset:-8px; }
.die-yn .yn-mark { font-size:.85em; line-height:1; }
.die-yn .yn-word { font-size:.36em; letter-spacing:.08em; line-height:1; }
.die-yn.rolling { background:#fff; }
.roll-badge { display:inline-flex; align-items:center; gap:.2em; padding:.05em .45em; border-radius:999px; font-weight:900; font-size:.85em; letter-spacing:.04em; vertical-align:middle; }
.roll-badge.roll-yes { background:var(--roll-yes); color:var(--roll-yes-ink); }
.roll-badge.roll-no { background:var(--roll-no); color:var(--roll-no-ink); border:2px dashed #ffb27a; }
.vb-key.kb-blocked { position:relative; border-color:#5a2f14; background:#141414; color:#6b5454; text-decoration:line-through; text-decoration-thickness:2px; text-decoration-color:var(--roll-no); cursor:not-allowed; opacity:.8; }
.vb-key.kb-blocked::after { content:'✕'; position:absolute; top:1px; right:3px; font-size:.6em; color:var(--roll-no); text-decoration:none; }

/* QF-1.0 — FIELD Qualifier (field testing / data gathering only). Purple marks field play everywhere;
   it is not used for any game meaning (YES/NO, blue/gold, warnings). Pulses are slow (one cycle every
   2 s, a glow, never a flash) and stop for devices set to reduce motion. */
:root { --field:#6a3fb5; --field-deep:#2a1748; --field-ink:#efe6ff; }
.field-band { position:sticky; top:0; z-index:45; margin:0; padding:.35rem 1rem; background:var(--field); color:#fff; font-weight:900; letter-spacing:.06em; text-align:center; font-size:.85rem; border-bottom:2px solid #b89cf0; }
.field-mode header h1 { color:#d8c6ff; }
.field-strip { position:sticky; top:2rem; z-index:44; margin:.4rem auto 0; width:fit-content; padding:.3rem .9rem; border-radius:999px; background:var(--field-deep); color:var(--field-ink); border:1px solid var(--field); font-weight:800; }
.field-overlay { position:fixed; inset:0; z-index:300; display:grid; place-items:center; background:rgba(10,6,20,.82); padding:1rem; }
.field-card { width:min(640px, 94vw); background:var(--field-deep); color:var(--field-ink); border:3px solid var(--field); border-radius:18px; padding:1.4rem 1.6rem; text-align:center; box-shadow:0 0 0 0 rgba(106,63,181,.0); }
.field-card h2 { margin:.2rem 0 .5rem; font-size:clamp(1.4rem, 4.5vw, 2.2rem); color:#fff; }
.field-card p { font-size:clamp(1rem, 3vw, 1.2rem); line-height:1.4; margin:.3rem 0; }
.field-kicker { font-weight:900; letter-spacing:.12em; color:#b89cf0; font-size:.85rem; }
.field-count { font-size:clamp(2.6rem, 10vw, 4.4rem); font-weight:900; font-variant-numeric:tabular-nums; margin:.4rem 0; color:#fff; }
.field-count:empty { display:none; }
.field-actions { display:flex; gap:.7rem; justify-content:center; flex-wrap:wrap; margin-top:.6rem; }
.field-actions button { min-width:9rem; min-height:3rem; font-size:1.1rem; font-weight:900; }
.field-note { color:#cdb8f5; font-size:.95rem !important; min-height:1.2em; }
.field-card.field-warn { border-color:#d55e00; }
.field-pulse { animation:fieldGlow 2s ease-in-out infinite; }
@keyframes fieldGlow { 0%, 100% { box-shadow:0 0 0 0 rgba(184,156,240,.0); } 50% { box-shadow:0 0 34px 8px rgba(184,156,240,.55); } }
.field-card.field-warn.field-pulse { animation-name:fieldGlowWarn; }
@keyframes fieldGlowWarn { 0%, 100% { box-shadow:0 0 0 0 rgba(213,94,0,0); } 50% { box-shadow:0 0 34px 8px rgba(213,94,0,.5); } }
.sign-off { position:fixed; right:1rem; bottom:1rem; z-index:250; padding:.55rem 1.1rem; border-radius:999px; background:var(--field-deep); color:#fff; border:2px solid var(--field); font-weight:900; letter-spacing:.04em; animation:fieldGlow 2s ease-in-out infinite; }
.sign-off:hover, .sign-off:focus-visible { background:var(--field); }
.field-panel { border-color:var(--field); }
.field-now { font-weight:800; }
.device-pick.locked select { opacity:.75; }
@media (prefers-reduced-motion: reduce) { .field-pulse, .sign-off { animation:none !important; } }

/* QF-1.1 — rule cards */
.field-card { max-height:92vh; overflow-y:auto; }
.field-card.field-rules { text-align:left; }
.field-card.field-rules h2, .field-card.field-rules .field-kicker, .field-card.field-rules .field-actions, .field-card.field-rules .field-note { text-align:center; }
.rules-lines { margin:.4rem 0 .2rem 1.1rem; padding:0; font-size:clamp(1rem, 3vw, 1.15rem); line-height:1.4; }
.rules-lines li { margin:.25rem 0; }
.rules-check { display:flex; align-items:center; gap:.5rem; font-weight:900; font-size:1.1rem; padding:.4rem .8rem; border:2px solid #b89cf0; border-radius:10px; cursor:pointer; }
.rules-check input { width:1.5rem; height:1.5rem; accent-color:#b89cf0; }
.field-actions button:disabled { opacity:.45; cursor:not-allowed; }
.known-people { display:block; margin-top:.35rem; }
.chip { padding:.15rem .55rem; margin:.15rem .1rem; border-radius:999px; border:1px solid var(--field); background:var(--field-deep); color:var(--field-ink); font-weight:800; font-size:.85rem; }

/* QF-1.2 — Sign Off lives in the header (no longer floats over the guess grid). */
.header-status { display:flex; align-items:center; gap:.5rem; flex-wrap:wrap; }
.header-status .sign-off { position:static; padding:.35rem .9rem; font-size:.9rem; }

/* QF-1.2 — phones: one screen (word, guesses and keyboard together), keys at least 42px tall. */
@media (max-width:600px) {
  body:not(.operator) header { flex-direction:row; align-items:center; padding:.3rem .55rem; gap:.4rem; }
  body:not(.operator) header h1 { font-size:.8rem; letter-spacing:.03em; }
  body:not(.operator) .header-status { gap:.3rem; font-size:.75rem; flex-wrap:nowrap; }
  body:not(.operator) .header-status .version { display:none; }
  body:not(.operator) .header-status .status { padding:.1rem .4rem; font-size:.7rem; }
  body:not(.operator) .header-status .sign-off { padding:.3rem .65rem; font-size:.8rem; }
  body:not(.operator) .field-band { padding:.12rem .5rem; font-size:.65rem; }
  body:not(.operator) main { width:calc(100vw - .5rem); margin:.25rem auto; }
  body:not(.operator) #game .grid { grid-template-columns:1fr; gap:.3rem; }
  body:not(.operator) .panel { padding:.35rem .4rem; margin-bottom:.25rem; border-radius:10px; }
  body:not(.operator) #game .panel > h2:not(#name) { display:none; }
  body:not(.operator) #name { font-size:.8rem; margin:0 0 .1rem; }
  body:not(.operator) .challenge { display:grid; grid-template-columns:1fr auto; align-items:center; column-gap:.4rem; }
  body:not(.operator) .challenge #name, body:not(.operator) .challenge .message { grid-column:1 / -1; }
  body:not(.operator) .challenge .dice { margin:.15rem 0; gap:.4rem; justify-content:flex-start; }
  body:not(.operator) .challenge .die { width:40px; height:40px; font-size:1.35rem; border-radius:8px; }
  body:not(.operator) .challenge .hint, body:not(.operator) .challenge .hint-grid { margin:.1rem 0; }
  body:not(.operator) .challenge .clock-row { gap:.5rem; justify-content:flex-end; }
  body:not(.operator) .clock { font-size:1.4rem; }
  body:not(.operator) .message { font-size:.85rem; margin:.1rem 0 0; min-height:1.1em; }
  body:not(.operator) .guess-grid { gap:3px; margin:.1rem auto; }
  body:not(.operator) .guess-row { grid-template-columns:repeat(5,40px); gap:3px; }
  body:not(.operator) .tile { width:40px; height:40px; font-size:1.15rem; }
  body:not(.operator) .key-help { display:none; }
  body:not(.operator) { --kb-key-h:46px; }
  body:not(.operator) .vb-keyboard { width:100%; margin-top:.2rem; gap:5px; }
  body:not(.operator) .vb-key-row { gap:4px; }
  body:not(.operator) .vb-key { font-size:1.15rem; }
  body:not(.operator) .field-card { padding:1rem; }
  body:not(.operator) .field-actions button { min-width:7.5rem; }
}
@media (max-width:600px) and (max-height:700px) {
  body:not(.operator) { --kb-key-h:42px; }
  body:not(.operator) .guess-row { grid-template-columns:repeat(5,34px); }
  body:not(.operator) .tile { width:34px; height:34px; font-size:1rem; }
  body:not(.operator) .challenge .die { width:34px; height:34px; font-size:1.15rem; }
  body:not(.operator) .field-band { display:none; }
}

/* QF-1.2 — Join page */
.join-page main.join-main { width:min(480px, 94vw); margin:1rem auto; }
.join-header { padding:.6rem 1rem; }
.join-header h1 { font-size:1rem; }
.join-panel h2 { margin-bottom:.3rem; }
.join-help { color:#cdd6ea; margin:.2rem 0 .8rem; }
.join-note { background:var(--field-deep); border:1px solid var(--field); border-radius:10px; padding:.5rem .7rem; color:var(--field-ink); }
.join-names { display:grid; grid-template-columns:repeat(auto-fill, minmax(9rem, 1fr)); gap:.5rem; margin-bottom:.9rem; }
.join-name { min-height:3.2rem; font-size:1.1rem; font-weight:800; }
.join-primary, .join-secondary { width:100%; min-height:3rem; font-size:1.05rem; font-weight:800; margin-top:.5rem; }
.join-secondary { background:transparent; border:2px solid #5f7894; color:#dbe6f7; }
.join-label { display:block; font-weight:800; margin:.4rem 0 .3rem; }
.join-input { width:100%; box-sizing:border-box; font-size:1.2rem; padding:.7rem; border-radius:10px; }
.join-error { color:#ffb4a8; font-weight:800; min-height:1.2em; margin:.4rem 0 0; }
.pin-dots { display:flex; justify-content:center; gap:.9rem; margin:.6rem 0 1rem; }
.pin-dot { width:1.1rem; height:1.1rem; border-radius:50%; border:2px solid #b89cf0; }
.pin-dot.filled { background:#b89cf0; }
.pin-pad { display:grid; grid-template-columns:repeat(3, 1fr); gap:.55rem; max-width:20rem; margin:0 auto; }
.pin-key { min-height:3.6rem; font-size:1.6rem; font-weight:900; border-radius:12px; }
.join-spin { width:2.4rem; height:2.4rem; margin:1rem auto; border-radius:50%; border:4px solid #405071; border-top-color:#b89cf0; animation:joinSpin 1s linear infinite; }
@keyframes joinSpin { to { transform:rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .join-spin { animation:none; } }
.join-link { display:inline-block; padding:.6rem 1rem; border-radius:10px; background:var(--field); color:#fff; font-weight:900; text-decoration:none; }

/* QF-1.2 — T3 access panels */
.access-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(300px, 1fr)); gap:.6rem; }
.qr-box { background:#fff; padding:8px; border-radius:8px; width:fit-content; }
.qr-box img, .qr-box svg { display:block; width:168px; height:168px; }
.join-url { font-family:Consolas,monospace; font-size:.85rem; word-break:break-all; }
.request-row, .person-row { display:flex; align-items:center; gap:.4rem; flex-wrap:wrap; padding:.3rem 0; border-bottom:1px solid #2c3a55; }
.request-row strong, .person-row strong { min-width:7rem; }
.badge { padding:.05rem .45rem; border-radius:999px; font-size:.75rem; font-weight:800; border:1px solid #5f7894; }
.badge.warn { border-color:#d55e00; color:#ffb27a; }
.net-row { display:flex; gap:.4rem; align-items:center; margin:.2rem 0; }
.approval-alert { animation:fieldGlow 2s ease-in-out infinite; border-color:#b89cf0 !important; }
@media (max-width:600px) {
  body:not(.operator) .challenge .hint { font-size:1.2rem; letter-spacing:.2em; }
  body:not(.operator) .challenge .hint-grid { grid-template-columns:repeat(5,26px); gap:.2rem; justify-content:start; }
  body:not(.operator) .challenge .hint-tile { width:26px; height:26px; font-size:.9rem; border-radius:5px; }
}
label.check { display:flex; align-items:center; gap:.45rem; font-weight:700; margin:.3rem 0; }
label.check input { width:1.2rem; height:1.2rem; }
/* QF-1.2 — phones, second pass (iPhone SE 320×568 must fit on one screen). */
@media (max-width:600px) {
  body:not(.operator) header h1 { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; min-width:0; flex:1 1 auto; font-size:.72rem; }
  body:not(.operator) .header-status { flex:none; }
  body:not(.operator) .header-status .status { white-space:nowrap; max-width:7.5rem; overflow:hidden; text-overflow:ellipsis; }
  body:not(.operator) .header-status .sign-off { padding:.25rem .55rem; font-size:.75rem; white-space:nowrap; }
  body:not(.operator) .message { font-size:.75rem; line-height:1.2; }
  body:not(.operator) .line-clock { font-size:.95rem; padding:.05rem .4rem; }
  body:not(.operator) .hint-box { height:1.6rem; min-height:1.6rem; max-height:1.6rem; margin-top:.15rem; }
  body:not(.operator) .hint-placeholder { font-size:.55rem; }
  body:not(.operator) .hint-box .hint-letter { width:1.3rem; height:1.3rem; font-size:.85rem; }
  body:not(.operator) .pass-row { margin-top:.15rem; }
  body:not(.operator) .pass-button { padding:.2rem .5rem; font-size:.68rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:100%; }
}
@media (max-width:600px) and (max-height:700px) {
  body:not(.operator) .guess-row { grid-template-columns:repeat(5,32px); }
  body:not(.operator) .tile { width:32px; height:32px; font-size:.95rem; }
  body:not(.operator) .guess-grid, body:not(.operator) .guess-row { gap:2px; }
}
/* QF-1.2 — phones, third pass: nothing may be wider than the screen (a wide row made phones zoom out). */
@media (max-width:600px) {
  body:not(.operator) #game .grid > *, body:not(.operator) .challenge > * { min-width:0; }
  body:not(.operator) .challenge .clock-row { flex-direction:column; align-items:flex-end; gap:.1rem; flex-wrap:nowrap; }
  body:not(.operator) .clock { font-size:1.3rem; line-height:1.1; }
  body:not(.operator) .line-clock { font-size:.8rem; white-space:nowrap; }
  body:not(.operator) .challenge .message { white-space:normal; overflow-wrap:anywhere; }
  body:not(.operator) .vb-key-wide { font-size:.62rem; letter-spacing:0; }
  body:not(.operator) .vb-key { overflow:hidden; }
  body:not(.operator) .guess-grid { width:auto; max-width:100%; }
}
@media (max-width:600px) { body:not(.operator) .guess-grid { width:max-content; max-width:100%; margin-left:auto; margin-right:auto; } }
label.check input { flex:none; }

/* QF-1.3 — ENTER pulses slowly once all five letters are in (waiting for the player to send the guess). */
.vb-key.vb-key-ready { background:var(--field, #7b4fd6); color:#fff; border-color:#e4d6ff; animation:enterReady 1.8s ease-in-out infinite; }
@keyframes enterReady { 0%, 100% { box-shadow:0 0 0 0 rgba(184,156,240,.0); filter:brightness(1); } 50% { box-shadow:0 0 0 5px rgba(184,156,240,.55); filter:brightness(1.25); } }
@media (prefers-reduced-motion: reduce) { .vb-key.vb-key-ready { animation:none; box-shadow:0 0 0 3px rgba(184,156,240,.8); } }
