:root {
  --ink: #e8eef6;
  --dim: #9fb0c4;
  --panel: rgba(8, 14, 24, 0.82);
  --line: rgba(160, 190, 230, 0.22);
  --accent: #ffb347;
  --go: #6fdc8c;
  --stop: #ff6b6b;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #05080d; overflow: hidden; }
canvas#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
button {
  font: inherit; color: var(--ink); background: #1b2738; border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 12px; cursor: pointer; min-height: 32px;
}
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: 0.45; cursor: default; }
button.on { background: var(--accent); color: #111; border-color: var(--accent); }

#bar {
  position: fixed; top: 0; left: 0; right: 0; height: 36px; z-index: 5;
  display: flex; gap: 16px; align-items: center; padding: 0 16px;
  background: rgba(4, 7, 12, 0.85); border-bottom: 1px solid var(--line); font-size: 13px;
}
.brand { font-weight: 700; letter-spacing: 0.12em; }
.disclosure { color: var(--accent); }
#foot {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; text-align: center;
  font-size: 12px; color: var(--dim); padding: 4px; background: rgba(4, 7, 12, 0.7);
}

.screen { position: fixed; inset: 36px 0 24px 0; z-index: 2; }
.screen[hidden] { display: none; }
#picker { overflow: auto; padding: 48px max(16px, 8vw); background: radial-gradient(circle at 70% 20%, #16263d, #05080d 70%); }
#picker h1 { font-size: 40px; margin: 0 0 8px; }
.lead { color: var(--dim); max-width: 46em; }
#scenes { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-top: 24px; }
.scene {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px;
}
.scene h2 { margin: 0 0 4px; }
.scene h3 { margin: 12px 0 4px; color: var(--accent); font-size: 16px; }
.scene p { color: var(--dim); font-size: 14px; line-height: 1.45; }
.note { border-left: 3px solid var(--accent); padding-left: 8px; }
.status { color: var(--dim); }

#play { pointer-events: none; }
#play > * { pointer-events: auto; }
.banner {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%); max-width: min(720px, 90vw);
  background: rgba(60, 40, 0, 0.75); border: 1px solid var(--accent); border-radius: 8px;
  padding: 6px 12px; font-size: 12px; text-align: center;
}
.flown-play {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); width: min(560px, 92vw);
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px;
  font-size: 12px; max-height: 45%; overflow: auto; z-index: 2;
}
.flown summary { cursor: pointer; font-weight: 700; color: var(--accent); }
.flown h3 { font-size: 13px; margin: 10px 0 2px; }
.flown p { margin: 2px 0; }
.flown .as-of, .flown .sources { color: #9aa3ad; font-size: 11px; }
.flown .sources a { color: inherit; }
.panel {
  position: absolute; top: 56px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; max-height: calc(100% - 72px); overflow: auto;
}
#hud { left: 12px; width: 280px; }
#controls { right: 12px; width: 340px; }
.clock { font-size: 28px; font-variant-numeric: tabular-nums; font-weight: 700; margin-bottom: 6px; }
#readouts { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 0; font-size: 13px; }
#readouts dt { color: var(--dim); }
#readouts dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.cameras { display: flex; gap: 6px; margin-top: 10px; }
.cameras button, .warp button { padding: 4px 8px; font-size: 12px; }
#controls h2 { font-size: 15px; margin: 0 0 8px; }
.pace { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.item { border-top: 1px solid var(--line); padding: 8px 0; }
.item .head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.item .label { font-weight: 600; }
.item .display { color: var(--accent); font-variant-numeric: tabular-nums; }
.item input[type=range] { width: 100%; }
.item .note { font-size: 11.5px; color: var(--dim); margin: 4px 0 0; border: 0; padding: 0; }
.item.locked .label::after { content: "  locked"; color: var(--dim); font-weight: 400; font-size: 11px; }
.item button.primary { width: 100%; background: #6b3a00; border-color: var(--accent); font-weight: 700; margin-top: 4px; }
.item .toggle { display: flex; gap: 6px; margin-top: 4px; }
.item .toggle button { flex: 1; }
.item .toggle button.go.on { background: var(--go); border-color: var(--go); color: #062; }
.item .toggle button.nogo.on { background: var(--stop); border-color: var(--stop); color: #300; }
.assist { font-size: 12px; color: var(--dim); border-top: 1px solid var(--line); padding-top: 8px; }
.toast { font-size: 12px; color: var(--accent); }
.feed {
  position: absolute; left: 12px; bottom: 8px; width: min(460px, 60vw); margin: 0; padding: 8px 12px 8px 28px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; font-size: 12px;
  max-height: 140px; overflow: auto;
}

.card {
  overflow: auto; padding: 32px max(16px, 10vw); background: rgba(5, 8, 13, 0.94);
}
.card h1 { margin: 4px 0; font-size: 34px; }
.total { font-size: 20px; color: var(--accent); margin: 4px 0 8px; }
.why { font-size: 16px; max-width: 52em; }
.disclosure-line { color: var(--accent); font-size: 13px; margin: 0; }
table { border-collapse: collapse; width: 100%; max-width: 980px; margin: 16px 0; font-size: 14px; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--dim); font-weight: 500; }
td.points { white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.miss td:first-child { color: var(--stop); }
details summary { cursor: pointer; color: var(--dim); font-size: 12px; margin-top: 4px; }
details p { color: var(--dim); font-size: 13px; line-height: 1.45; max-width: 60em; }
.source { color: var(--dim); font-size: 11px; }
.miss-line { color: var(--ink); font-size: 12.5px; margin: 4px 0 0; max-width: 46em; }
.model-note { color: var(--dim); font-size: 13px; max-width: 60em; border-left: 3px solid var(--accent); padding-left: 8px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.fineprint { color: var(--dim); font-size: 11px; }
.busy {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(60, 40, 0, 0.9); border: 1px solid var(--accent); border-radius: 8px; padding: 10px 16px;
}
#replay-log { font-size: 11px; color: var(--dim); white-space: pre-wrap; max-height: 260px; overflow: auto; }
.share { margin: 12px 0; max-width: 980px; }
.share label { font-size: 13px; color: var(--dim); }
.share input { flex: 1; min-width: 0; font: inherit; font-size: 12px; color: var(--ink); background: #0d1520; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
.leaderboard { max-width: 980px; margin-top: 20px; border-top: 1px solid var(--line); }
.leaderboard h2 { font-size: 18px; margin: 12px 0 4px; }
#board, #online-board { max-width: 520px; }
#board tr.mine td, #online-board tr.mine td { color: var(--accent); }
#board a, #online-board a { color: var(--accent); }
#error pre { white-space: pre-wrap; color: var(--stop); }

.cue { font-size: 12.5px; line-height: 1.4; color: var(--accent); margin: 0 0 8px; }
kbd {
  font: 11px ui-monospace, monospace; color: var(--dim); border: 1px solid var(--line);
  border-radius: 4px; padding: 0 4px; margin-left: auto;
}
.item .head kbd { align-self: center; }
.item .toggle.pad button { touch-action: none; user-select: none; min-height: 40px; }

@media (max-width: 900px) {
  #hud { width: 200px; font-size: 12px; }
  #controls { width: 260px; }
  .feed { display: none; }
}

@media (max-width: 600px) {
  #bar { gap: 8px; padding: 0 16px; font-size: 11px; }
  .brand { display: none; }
  .banner { display: none; }
  .flown-play { top: 8px; bottom: auto; max-height: 40%; }
  .panel { position: absolute; left: 8px; right: 8px; width: auto; }
  #hud { top: 8px; max-height: 34%; padding: 8px 10px; }
  #hud .clock { font-size: 20px; }
  #readouts { font-size: 11px; }
  #controls { top: auto; bottom: 8px; max-height: 46%; padding: 8px 10px; }
  .item { padding: 6px 0; }
  .item .note { display: none; }
  .item .toggle button { min-height: 40px; }
  kbd { display: none; }
  #foot { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #picker { padding: 24px 16px; }
  #picker h1 { font-size: 28px; }
  #scenes { grid-template-columns: 1fr; }
  .card { padding: 20px 16px; }
  .card h1 { font-size: 24px; }
  table { font-size: 12px; }
  th, td { padding: 6px 4px; }
}

.provenance-note { font-size: 11px; color: var(--dim); max-width: 65em; }
