:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #070916;
  color: #f7f7fb;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at top, #151a3a, #070916 55%); }
button, input, select { font: inherit; }
button { cursor: pointer; }

.app-shell { width: min(1200px, calc(100% - 32px)); margin: 0 auto; padding: 32px 0; }
.panel { background: rgba(14, 18, 43, 0.92); border: 1px solid #30385f; border-radius: 18px; box-shadow: 0 18px 60px rgba(0,0,0,.35); }
.home-panel, #lobbyPanel { width: min(520px, 100%); margin: 7vh auto 0; padding: 30px; display: grid; gap: 18px; }
.hidden { display: none !important; }
.eyebrow { margin: 0 0 6px; text-transform: uppercase; letter-spacing: .14em; color: #8ea0ff; font-size: .75rem; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(2.4rem, 8vw, 4rem); }
.lead { color: #bdc6e8; line-height: 1.55; }
label { display: grid; gap: 8px; color: #dce2ff; }
input, select { width: 100%; border: 1px solid #46517c; border-radius: 10px; background: #0b1027; color: white; padding: 12px 14px; }
button { border: 1px solid #4a5687; border-radius: 10px; background: #20284e; color: white; padding: 12px 16px; }
button:hover { filter: brightness(1.12); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { border-color: #6578ff; background: #5065f5; }
.separator { display: flex; align-items: center; gap: 12px; color: #7780a5; }
.separator::before, .separator::after { content: ""; height: 1px; flex: 1; background: #30385f; }
.join-row, .button-row { display: flex; gap: 10px; }
.join-row input { text-transform: uppercase; letter-spacing: .18em; font-weight: 700; }
.error { min-height: 1.2em; color: #ff8e9f; margin-bottom: 0; }
.status { color: #b9c2e6; }
.player-list { display: grid; gap: 8px; }
.player-card { padding: 10px 12px; border-radius: 10px; background: #111733; border: 1px solid #283056; }

.game-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 18px; align-items: start; }
.hud { padding: 20px; position: sticky; top: 20px; display: grid; gap: 18px; }
.timer { font-size: 2rem; font-variant-numeric: tabular-nums; font-weight: 800; }
.score-row { display: grid; grid-template-columns: 12px 1fr auto; gap: 8px; align-items: center; padding: 7px 0; border-bottom: 1px solid #252d54; font-size: .9rem; }
.score-dot { width: 10px; height: 10px; border-radius: 50%; }
.controls { margin: 0; color: #8f9ac5; font-size: .82rem; }
.canvas-wrap { position: relative; width: 100%; display: grid; place-items: center; min-width: 0; }
canvas { display: block; max-width: 100%; max-height: calc(100vh - 64px); width: auto; height: auto; image-rendering: pixelated; border: 1px solid #323b68; border-radius: 14px; background: #02030a; }
.game-overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 32px; text-align: center; background: rgba(2, 3, 10, .78); border-radius: 14px; font-size: clamp(1.2rem, 3vw, 2rem); }
.overlay-content { display: grid; gap: 18px; justify-items: center; max-width: min(560px, 100%); }
.overlay-title { font-weight: 800; line-height: 1.2; }
.overlay-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; font-size: 1rem; }

@media (max-width: 800px) {
  .game-layout { grid-template-columns: 1fr; }
  .hud { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hud > * { min-width: 0; }
}
