:root {
  --bg: #0D1117;
  --panel: rgba(9, 12, 18, 0.72);
  --text: #E8ECF1;
  --muted: #9AA4B2;
  --cyan: #4FD1FF;
  --amber: #FFB547;
  --red: #FF5A4A;
  --display: 'Chakra Petch', 'Trebuchet MS', sans-serif;
  --body: 'Saira', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #05070b; color: var(--text); overflow: hidden; }
body { display: grid; place-items: center; font-family: var(--body); }

.stage { position: relative; }
canvas { display: block; }
.cyan { color: var(--cyan); }
.amber { color: var(--amber); }
.muted { color: var(--muted); }

/* ---------- HUD ---------- */
.hud { position: absolute; inset: 0; pointer-events: none; font-size: 1.6vmin; }
.hud[hidden] { display: none; }
.pbox { position: absolute; top: 1.6%; min-width: 17%; padding: 0.7em 1.1em; border-radius: 0.9em; background: var(--panel); display: flex; flex-direction: column; gap: 0.35em; }
.p1 { left: 1.6%; border: 1px solid rgba(79, 209, 255, 0.35); }
.p2 { right: 1.6%; border: 1px solid rgba(255, 181, 71, 0.35); align-items: flex-end; }
.prow { display: flex; justify-content: space-between; align-items: baseline; align-self: stretch; gap: 1em; }
.pname { font-family: var(--display); font-weight: 700; font-size: 1.1em; }
.p1 .pname { color: var(--cyan); }
.p2 .pname { color: var(--amber); }
.lives { font-size: 0.9em; color: #C9D1DC; }
.score { font-family: var(--display); font-weight: 600; font-size: 1.8em; line-height: 1; letter-spacing: 0.04em; }
.power { display: flex; gap: 0.3em; }
.power span { width: 2em; height: 0.4em; border-radius: 0.2em; background: rgba(255, 255, 255, 0.18); }
.p1 .power span.on { background: var(--cyan); }
.p2 .power span.on { background: var(--amber); }
.join { display: none; font-family: var(--display); font-weight: 600; letter-spacing: 0.06em; animation: pulse 1.2s ease-in-out infinite; }
.pbox.inactive .score, .pbox.inactive .power, .pbox.inactive .lives { display: none; }
.pbox.inactive .join { display: block; }
.pbox.out .score { opacity: 0.5; }
@keyframes pulse { 50% { opacity: 0.45; } }

.hi { position: absolute; top: 1.6%; left: 50%; transform: translateX(-50%); padding: 0.5em 1.1em; border-radius: 0.8em; background: var(--panel); display: flex; flex-direction: column; align-items: center; gap: 0.1em; }
.hi span { font-size: 0.8em; letter-spacing: 0.14em; color: var(--muted); font-weight: 600; }
.hi b { font-family: var(--display); font-weight: 600; font-size: 1.35em; letter-spacing: 0.04em; }

.boss { position: absolute; left: 50%; top: 13%; transform: translateX(-50%); width: 40%; display: flex; flex-direction: column; align-items: center; gap: 0.3em; }
.boss[hidden] { display: none; }
.boss span { font-family: var(--display); font-weight: 700; letter-spacing: 0.2em; color: var(--red); text-shadow: 0 1px 4px #000; }
.boss .bar { width: 100%; height: 0.6em; border-radius: 0.3em; background: rgba(9, 12, 18, 0.75); overflow: hidden; }
.boss .bar div { height: 100%; width: 100%; background: var(--red); }

.tag { position: absolute; padding: 0.1em 0.5em; border-radius: 0.35em; font-family: var(--display); font-weight: 700; font-size: 0.85em; transform: translate(-50%, -100%); }
.t1 { background: var(--cyan); color: #04141C; }
.t2 { background: var(--amber); color: #1A1206; }

.banner { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); white-space: nowrap; font-family: var(--display); font-weight: 700; font-style: italic; font-size: 3.4em; letter-spacing: 0.08em; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8); }
.banner[hidden] { display: none; }

.fade { position: absolute; inset: 0; background: #05070b; opacity: 0; pointer-events: none; }

/* ---------- screens ---------- */
.screen { position: absolute; inset: 0; display: flex; align-items: center; justify-content: flex-end; font-size: 1.6vmin; }
.screen[hidden] { display: none; }
.title { background: linear-gradient(90deg, rgba(5, 7, 11, 0) 35%, rgba(5, 7, 11, 0.8) 62%); }
.title .panel { width: 40%; margin-right: 5%; display: flex; flex-direction: column; gap: 1.8em; }
.title h1 { margin: 0; font-family: var(--display); font-style: italic; font-weight: 700; font-size: 6em; line-height: 0.95; }
.title h1 span { color: var(--amber); }
.tagline { margin: -0.6em 0 0; font-size: 1.3em; color: #C9D1DC; }
.menu { display: flex; flex-direction: column; gap: 0.7em; }
.menu button { min-height: 3.2em; padding: 0 1.3em; display: flex; align-items: center; justify-content: space-between; border: 1px solid #2A3240; border-radius: 0.8em; background: rgba(22, 27, 34, 0.92); color: var(--text); font-family: var(--display); font-weight: 600; font-size: 1.3em; cursor: pointer; pointer-events: auto; }
.menu button small { font-family: var(--body); font-weight: 500; font-size: 0.7em; }
.menu button.primary { background: var(--amber); color: #1A1206; border-color: var(--amber); }
.menu button.sel { outline: 3px solid #FFFFFF; outline-offset: 2px; }
.menu button:focus-visible { outline: 3px solid #FFFFFF; outline-offset: 2px; }
.dot { width: 0.6em; height: 0.6em; border-radius: 50%; }
.dot.cyan { background: var(--cyan); }
.dot.amber { background: var(--amber); }
.controls { display: flex; flex-direction: column; gap: 0.35em; font-size: 0.95em; color: #C9D1DC; }
.back { position: absolute; left: 2%; top: 2.5%; color: #C9D1DC; text-decoration: none; font-size: 1em; text-shadow: 0 1px 3px #000; }
.back:hover, .back:focus-visible { color: #FFFFFF; }

.dim { justify-content: center; background: rgba(5, 7, 11, 0.6); }
.card { padding: 1.6em 2.6em; border-radius: 1em; background: rgba(13, 17, 23, 0.94); border: 1px solid #2A3240; text-align: center; }
.card h2 { margin: 0 0 0.3em; font-family: var(--display); font-style: italic; font-weight: 700; font-size: 3em; }
.card p { margin: 0.3em 0; font-size: 1.2em; }

@media (prefers-reduced-motion: reduce) { .join { animation: none; } }
