/* Build Linux01 - dark terminal theme. Green on near-black, amber accents. */
:root {
  --bg: #0a0f0b;
  --panel: #101812;
  --line: #1f3326;
  --fg: #c9f7d4;
  --dim: #6f9079;
  --green: #4ade80;
  --amber: #fbbf24;
  --red: #f87171;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 17px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3, p { margin: 0 0 0.6em; }
h1 { font-size: 1.7em; color: var(--green); line-height: 1.2; }
h2 { font-size: 1.25em; }
h3 { font-size: 0.85em; letter-spacing: 0.08em; color: var(--dim); }
small { font-size: 0.75em; font-weight: normal; }
.dim { color: var(--dim); }
.green { color: var(--green); }
.amber { color: var(--amber); }
.red { color: var(--red); }
.center { text-align: center; }

/* ---- shared pieces ---- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  max-width: 760px;
  margin: 0 auto;
}
.btn {
  font: inherit;
  color: var(--green);
  background: transparent;
  border: 1px solid var(--green);
  border-radius: 6px;
  padding: 10px 16px;
  cursor: pointer;
}
.btn:hover, .btn:focus-visible { background: rgba(74, 222, 128, 0.12); outline: none; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.big { display: block; width: 100%; padding: 16px; font-size: 1.15em; font-weight: bold; margin-top: 14px; }
.btn.primary { background: var(--green); color: #04130a; font-weight: bold; }
.btn.primary:hover { background: #86efac; }
.btn.danger { color: var(--red); border-color: var(--red); }
.btn kbd { margin-left: 8px; font: inherit; font-size: 0.7em; opacity: 0.7; border: 1px solid currentColor; border-radius: 3px; padding: 0 4px; }
.input {
  display: block; width: 100%; font: inherit; font-size: 1.15em;
  color: var(--fg); background: #060a07; border: 1px solid var(--line); border-radius: 6px; padding: 12px;
}
.input:focus { outline: none; border-color: var(--green); }
.input.code { text-transform: uppercase; letter-spacing: 0.4em; text-align: center; font-size: 1.5em; }
label { display: block; margin: 12px 0 4px; color: var(--dim); font-size: 0.85em; }
.error { color: var(--red); min-height: 1.4em; margin: 10px 0 0; }
.join { max-width: 420px; }
.mute { font: inherit; font-size: 0.75em; color: var(--dim); background: none; border: 0; cursor: pointer; margin-left: auto; padding: 6px; }
.tag { font-size: 0.75em; border: 1px solid currentColor; border-radius: 4px; padding: 1px 6px; }
.stepline { color: var(--dim); font-size: 0.8em; letter-spacing: 0.08em; text-transform: uppercase; }
.label { color: var(--amber); font-size: 0.8em; letter-spacing: 0.06em; text-transform: uppercase; margin: 14px 0 4px; }
.concept { font-size: 1.05em; }
pre { margin: 0 0 8px; padding: 12px; border-radius: 6px; background: #050806; border: 1px solid var(--line); white-space: pre-wrap; word-break: break-word; font: inherit; }
pre.cmd { color: var(--green); font-weight: bold; }
pre.out { color: var(--dim); }
.okline { color: var(--green); }
.badline { color: var(--red); }
.explain { border-left: 3px solid var(--amber); padding-left: 12px; margin-top: 12px; }
.banner { border: 1px solid; border-radius: 6px; padding: 8px 12px; font-weight: bold; }
.banner.hint { color: var(--green); background: rgba(74, 222, 128, 0.08); }
.banner.sab { color: var(--amber); background: rgba(251, 191, 36, 0.08); }
.banner.celebrate { animation: pop 0.6s ease-out 2; }

.timer { display: flex; align-items: center; gap: 12px; margin: 6px 0 14px; }
.timer .num { font-size: 1.6em; font-weight: bold; min-width: 2.2ch; text-align: right; color: var(--green); }
.timer .track { flex: 1; height: 10px; background: #050806; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.timer .fill { height: 100%; background: var(--green); transition: width 0.1s linear; }
.timer.low .num { color: var(--red); }
.timer.low .fill { background: var(--red); }

.opts { display: grid; gap: 10px; margin: 12px 0; }
.opt {
  display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left;
  font: inherit; color: var(--fg); background: #0c130e; border: 2px solid var(--line); border-radius: 8px;
  padding: 16px 14px; min-height: 64px; cursor: pointer;
}
.opt .letter { color: var(--amber); font-weight: bold; }
.opt .text { flex: 1; word-break: break-word; }
button.opt:hover:not(:disabled), button.opt:focus-visible { border-color: var(--green); outline: none; }
button.opt:disabled { cursor: default; opacity: 0.6; }
.opt.static { cursor: default; }
.opt.chosen { border-color: var(--amber); opacity: 1 !important; background: rgba(251, 191, 36, 0.1); }
.opt.removed { opacity: 0.25 !important; text-decoration: line-through; }
.opt.correct { border-color: var(--green); background: rgba(74, 222, 128, 0.14); color: var(--green); font-weight: bold; }
.opt.wrong { border-color: var(--red); background: rgba(248, 113, 113, 0.1); }
.opt.faded { opacity: 0.55; }
.opt .count { display: flex; align-items: center; gap: 8px; min-width: 120px; justify-content: flex-end; }
.opt .countbar { display: inline-block; height: 10px; max-width: 90px; background: currentColor; border-radius: 3px; opacity: 0.7; }

.verdict { border: 2px solid; border-radius: 8px; padding: 14px; margin-bottom: 14px; text-align: center; }
.verdict b { display: block; font-size: 1.7em; letter-spacing: 0.05em; }
.verdict.good { color: var(--green); background: rgba(74, 222, 128, 0.08); }
.verdict.bad { color: var(--red); background: rgba(248, 113, 113, 0.08); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: inherit; }
.center .chips { justify-content: center; }
.chip { font: inherit; font-size: 0.8em; color: var(--fg); background: #0c130e; border: 1px solid var(--line); border-radius: 12px; padding: 2px 10px; }
.chip.me { border-color: var(--amber); color: var(--amber); }
.chip.out { border-color: var(--red); color: var(--red); }
.board { list-style: none; counter-reset: rank; padding: 0; margin: 0 0 10px; text-align: left; }
.board li { counter-increment: rank; display: flex; justify-content: space-between; gap: 12px; padding: 5px 8px; border-bottom: 1px solid var(--line); }
.board li::before { content: counter(rank) "."; color: var(--dim); min-width: 2.5ch; }
.board li span:first-of-type { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.board li.me { color: var(--amber); font-weight: bold; }
.board li.outrow { color: var(--dim); }
.review { text-align: left; color: var(--amber); padding-left: 1.2em; margin: 0 0 10px; }

.overlay {
  position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center;
  background: rgba(5, 8, 6, 0.82); pointer-events: none;
}
.overlay .card { border-color: var(--amber); min-width: 280px; }
.overlay h1 { color: var(--amber); letter-spacing: 0.2em; }

/* ---- player screen ---- */
.player { display: flex; flex-direction: column; min-height: 100%; }
.bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 5; }
.brand { color: var(--green); font-weight: bold; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lives { color: var(--red); letter-spacing: 2px; }
.lives.edge { animation: blink 1s steps(2) infinite; }
.score { color: var(--amber); white-space: nowrap; }
.app { flex: 1; padding: 14px; }
.conn { font-size: 0.7em; color: var(--dim); text-align: center; padding: 6px; }
.conn.bad { color: var(--red); }
.vote .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vote .btn { padding: 16px 8px; font-weight: bold; }
.vote .btn small { display: block; margin-top: 4px; opacity: 0.8; }
.vote-sab { color: var(--amber); border-color: var(--amber); }
.vote .btn.on { background: rgba(74, 222, 128, 0.2); }
.vote .vote-sab.on { background: rgba(251, 191, 36, 0.2); }

/* ---- host screen (projector) ---- */
.host { display: flex; flex-direction: column; height: 100%; font-size: clamp(15px, 1.25vw, 24px); }
.top { display: flex; align-items: center; gap: 24px; padding: 10px 20px; border-bottom: 1px solid var(--line); background: var(--panel); }
.top .joinat { font-size: 1.1em; }
.top .roundno { color: var(--dim); }
.layout { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 26vw); gap: 12px; padding: 12px; min-height: 0; }
.stage { overflow-y: auto; min-height: 0; }
.stage .card { max-width: none; min-height: 100%; padding: 26px; }
.stage .join { max-width: 460px; min-height: 0; margin-top: 6vh; }
.stage h1 { font-size: 2.2em; }
.stage .prompt { font-size: 1.7em; }
.stage .concept { font-size: 1.35em; }
.stage pre { font-size: 1.4em; }
.stage .opts { grid-template-columns: 1fr 1fr; }
.stage .opt { font-size: 1.2em; }
.stage .timer .num { font-size: 2.6em; }
.stage .timer .track { height: 16px; }
.side { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; }
.login .side, .login .controls { display: none; }
.login .layout { grid-template-columns: 1fr; }
.huge { font-size: 4em; font-weight: bold; margin: 0 0 0.2em; line-height: 1.1; }
.huge.code { font-size: 7em; letter-spacing: 0.15em; }
.huge.url { color: var(--green); word-break: break-all; }
.huge-label { color: var(--dim); text-transform: uppercase; letter-spacing: 0.1em; margin: 0.8em 0 0; }
.livecount { font-size: 1.6em; color: var(--amber); margin-top: 0.8em; }
.liverow { display: flex; gap: 30px; font-size: 1.2em; margin-top: 14px; }
.okline.big, .badline.big { font-size: 1.5em; font-weight: bold; }
.cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; text-align: left; margin-top: 10px; }

.rack, .roster { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.roster { order: -1; flex: none; max-height: 42%; overflow-y: auto; }
.rack h3, .roster h3 { margin-bottom: 4px; }
.unit { border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; margin-bottom: 4px; background: #0c130e; }
.unit:last-child { margin-bottom: 0; }
.unit-title { font-size: 0.8em; font-weight: bold; color: var(--dim); display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.unit.done { border-color: var(--green); animation: pop 0.6s ease-out 2; }
.unit.done .unit-title { color: var(--green); }
.unit.errors { border-color: var(--amber); }
.unit.errors .unit-title { color: var(--amber); }
.led { display: inline-block; width: 0.6em; height: 0.6em; border-radius: 50%; background: #1b2a20; flex: none; }
.unit.done .unit-title .led { background: var(--green); box-shadow: 0 0 8px var(--green); }
.unit.errors .unit-title .led { background: var(--amber); }
.step { display: flex; align-items: center; gap: 8px; font-size: 0.68em; line-height: 1.2; color: #5a7a64; }
.step .sn { opacity: 0.7; }
.step .sl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step.ok { color: var(--green); }
.step.ok .led { background: var(--green); box-shadow: 0 0 8px var(--green); animation: pop 0.5s ease-out; }
.step.failed { color: #7a4444; text-decoration: line-through; }
.step.failed .led { background: #5c2020; }
.step.current { color: var(--amber); }
.step.current .led { background: var(--amber); animation: blink 1s steps(2) infinite; }

.roster .chip { cursor: pointer; font-size: 0.68em; padding: 1px 8px; }
.roster .chips { gap: 4px; }
.roster .chip:hover { border-color: var(--red); }
.roster .chip.answered { border-color: var(--green); color: var(--green); }
.roster .chip.edge { border-color: var(--amber); }
.roster .chip.offline { opacity: 0.4; border-style: dashed; }
.roster .chip.p-eliminated { color: var(--dim); text-decoration: line-through; }
.roster .chip.p-watcher { color: var(--dim); font-style: italic; }
.roster .hp { color: var(--red); }

.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 20px; border-top: 1px solid var(--line); background: var(--panel); font-size: 0.85em; }
.controls .error { margin: 0; }

.elims { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin: 20px 0; min-height: 3em; }
.elim { font-size: 2em; font-weight: bold; color: var(--red); border: 2px solid var(--red); border-radius: 8px; padding: 6px 18px; opacity: 0; animation: drop 0.5s ease-out forwards; }

.podium { display: flex; align-items: flex-end; justify-content: center; gap: 14px; margin: 24px 0; }
.place { display: flex; flex-direction: column; align-items: center; width: 22%; min-width: 120px; }
.place .pname { font-size: 1.4em; font-weight: bold; word-break: break-word; }
.place .pscore { color: var(--amber); margin-bottom: 6px; }
.place .pblock { width: 100%; display: flex; align-items: center; justify-content: center; font-size: 2.4em; font-weight: bold; color: #04130a; border-radius: 6px 6px 0 0; }
.p1 .pblock { height: 150px; background: var(--amber); }
.p2 .pblock { height: 105px; background: #cbd5e1; }
.p3 .pblock { height: 75px; background: #d08b5b; }
.p1 .pname { color: var(--amber); }

@keyframes blink { 50% { opacity: 0.25; } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.04); } 100% { transform: scale(1); } }
@keyframes drop { from { opacity: 0; transform: translateY(-30px) scale(1.4); } to { opacity: 1; transform: none; } }

@media (max-width: 900px) {
  .host { height: auto; min-height: 100%; }
  .layout { grid-template-columns: 1fr; }
  .stage .opts, .cols { grid-template-columns: 1fr; }
  .huge.code { font-size: 4em; }
  .huge { font-size: 2.2em; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .elim { opacity: 1; }
}
