:root {
  --ink: #1d2126;
  --muted: #5d6670;
  --panel: rgba(244, 246, 248, 0.95);
  --line: #c9d0d6;
  --blue: #2f9bff;
  --orange: #ff8a1f;
  --bad: #d7263d;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #9aa3ab;
  color: var(--ink);
  font: 16px/1.4 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

#hud { position: fixed; inset: 0; pointer-events: none; }

#chamber {
  position: absolute; top: 12px; left: 16px;
  background: var(--panel); border-left: 8px solid var(--ink); border-radius: 4px; padding: 6px 14px;
}
#chamber-num { display: block; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
#chamber-name { font-size: 20px; }

#timer {
  position: absolute; top: 12px; right: 16px;
  background: var(--panel); border-radius: 4px; padding: 8px 14px;
  font: 600 20px/1 ui-monospace, "Cascadia Mono", Consolas, monospace;
}

#crosshair {
  position: absolute; top: 50%; left: 50%; width: 28px; height: 28px; transform: translate(-50%, -50%);
}
#crosshair span { position: absolute; top: 0; width: 14px; height: 28px; border: 3px solid; }
#crosshair .l { left: 0; border-color: var(--blue); border-right: 0; border-radius: 14px 0 0 14px; }
#crosshair .r { right: 0; border-color: var(--orange); border-left: 0; border-radius: 0 14px 14px 0; }
#crosshair .l.on { background: rgba(47, 155, 255, 0.55); }
#crosshair .r.on { background: rgba(255, 138, 31, 0.55); }
#crosshair .r.off { opacity: 0.2; }

#controls {
  position: absolute; left: 16px; bottom: 12px; margin: 0;
  color: #f4f6f8; font-size: 13px; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}
.blue { color: var(--blue); font-weight: 700; }
.orange { color: var(--orange); font-weight: 700; }

#subtitle {
  position: fixed; left: 50%; bottom: 52px; transform: translateX(-50%);
  width: min(720px, calc(100% - 32px)); margin: 0; padding: 10px 16px;
  background: rgba(10, 12, 14, 0.8); color: #f3f3f3; border-radius: 4px;
  font-size: clamp(15px, 2.4vw, 19px); pointer-events: none;
}
#subtitle b { color: #ffd76a; }

.panel {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(470px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow-y: auto;
  background: var(--panel); border-top: 10px solid var(--ink); border-radius: 4px;
  padding: 18px 24px; text-align: center; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}
.panel h1 { margin: 0 0 8px; font-size: 34px; }
.panel h2 { font-size: 15px; margin: 18px 0 6px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.panel label { display: block; margin: 12px 0 4px; color: var(--muted); }
.kicker { margin: 0; font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.small { font-size: 14px; color: var(--muted); }
.disclaimer { font-size: 12px; color: var(--muted); margin: 16px 0 0; }

input {
  width: 100%; padding: 10px; font-size: 16px; border-radius: 4px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
}

button { font: inherit; cursor: pointer; }
.big {
  display: block; width: 100%; margin-top: 14px; padding: 12px;
  font-size: 19px; font-weight: 700; border: 0; border-radius: 4px; background: var(--ink); color: #fff;
}
.big:hover { background: #000; }
.big.secondary { background: #d9dee3; color: var(--ink); }
.big:disabled { opacity: 0.6; cursor: wait; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

.error { color: var(--bad); min-height: 1.4em; margin: 8px 0 0; }
.final { font-size: 28px; margin: 4px 0; }

.leaderboard { text-align: left; margin: 0; padding-left: 28px; }
.leaderboard li { padding: 2px 0; }
.leaderboard .pts { float: right; font-weight: 700; font-family: ui-monospace, Consolas, monospace; }

#fade {
  position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none;
  transition: opacity 0.35s;
}
#fade.on { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  #fade { transition: none; }
}

/* Slow-mo (Z) */
#slowmo {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  width: 220px; text-align: center; color: #f4f6f8; font-size: 12px;
  letter-spacing: 0.12em; text-transform: uppercase; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}
#slowmo .bar { height: 6px; margin-top: 4px; border-radius: 3px; background: rgba(0, 0, 0, 0.45); overflow: hidden; }
#slowmo-fill { height: 100%; background: #7fd3ff; transform-origin: left; }
#slowmo.charging #slowmo-fill { background: #8a9096; }
#slowmo-tint {
  position: fixed; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.3s;
  background: radial-gradient(ellipse at center, rgba(90, 170, 255, 0.08) 40%, rgba(40, 90, 180, 0.45) 100%);
}
body.slowmo #slowmo-tint { opacity: 1; }
@media (prefers-reduced-motion: reduce) { #slowmo-tint { transition: none; } }

/* Developer console (`) */
#console {
  position: fixed; top: 8%; left: 50%; transform: translateX(-50%); z-index: 20;
  width: min(760px, calc(100% - 32px)); height: min(440px, 70%);
  display: flex; flex-direction: column;
  background: rgba(38, 40, 36, 0.94); border: 1px solid #5c5f57; border-radius: 3px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  font: 13px/1.35 ui-monospace, "Cascadia Mono", Consolas, monospace; color: #d8dcc8;
}
#console[hidden] { display: none; }
.console-title { padding: 6px 10px; background: #4a4c45; color: #f0f2e6; font-weight: 600; }
.console-title span { font-weight: 400; color: #b5b8aa; }
#console-log { flex: 1; overflow-y: auto; padding: 8px 10px; white-space: pre-wrap; }
#console-log .cmd { color: #f0f2e6; }
#console-log .err { color: #ff9a7a; }
#console-input {
  margin: 0; border: 0; border-top: 1px solid #5c5f57; border-radius: 0;
  background: #2b2d28; color: #f0f2e6; font: inherit; padding: 8px 10px;
}
#devinfo {
  position: fixed; top: 64px; right: 16px; margin: 0; padding: 6px 10px; z-index: 5;
  background: rgba(0, 0, 0, 0.55); color: #e8ffe0; border-radius: 3px; pointer-events: none;
  font: 12px/1.4 ui-monospace, Consolas, monospace;
}

/* Cleaner, Portal-like HUD: small see-through chamber label, controls fade out after a while */
#controls { transition: opacity 1.2s; }
#controls.faded { opacity: 0; }
#chamber { background: rgba(244, 246, 248, 0.7); border-left-width: 5px; padding: 4px 10px; }
#chamber-num { font-size: 10px; }
#chamber-name { font-size: 15px; }
#timer { background: rgba(244, 246, 248, 0.7); font-size: 15px; padding: 6px 10px; }
