:root {
  color-scheme: dark;
  --bg: #070b13;
  --panel: #0d1421;
  --line: rgba(185, 211, 241, .17);
  --text: #eef6ff;
  --muted: #77879d;
  --you: #52d7ff;
  --bot: #ff5478;
  --pull: #54e4ff;
  --push: #ffbc52;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 25%, rgba(46, 103, 149, .16), transparent 45%),
    linear-gradient(155deg, #050810, #09111d 70%, #07121a);
}
button { font: inherit; }

.game-shell { width: min(1480px, 100vw); height: 100vh; min-height: 520px; margin: 0 auto; padding: 10px 16px 12px; display: grid; grid-template-rows: 70px minmax(0, 1fr) 34px; }
.hud { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.logo { font-size: clamp(18px, 2vw, 28px); font-weight: 950; letter-spacing: .18em; }
.score { display: grid; grid-template-columns: auto 42px 94px 42px auto; align-items: center; justify-content: center; gap: 8px; }
.score strong { font: 950 35px/1 ui-monospace, SFMono-Regular, Consolas, monospace; text-align: center; }
.score > span { font-size: 10px; font-weight: 950; letter-spacing: .12em; }
.score small { color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .12em; text-align: center; }
.you-label { color: var(--you); }
.bot-label { color: var(--bot); }
.hud-actions { justify-self: end; display: flex; align-items: center; gap: 9px; }
.polarity-readout { min-width: 116px; padding: 7px 11px; border: 1px solid currentColor; border-radius: 10px; text-align: center; box-shadow: inset 0 0 20px rgba(84,228,255,.06); }
.polarity-readout span { display: block; font-size: 13px; font-weight: 950; letter-spacing: .13em; }
.polarity-readout small { display: block; margin-top: 2px; color: var(--muted); font-size: 7px; font-weight: 900; letter-spacing: .08em; }
.polarity-readout.pull { color: var(--pull); }
.polarity-readout.push { color: var(--push); box-shadow: inset 0 0 20px rgba(255,188,82,.08); }
#muteButton { color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 9px; padding: 10px; font-size: 8px; font-weight: 900; letter-spacing: .08em; cursor: pointer; }

.arena-wrap { position: relative; min-height: 0; display: grid; place-items: center; }
#gameCanvas { width: min(100%, calc((100vh - 126px) * 1.8462)); height: auto; max-height: calc(100vh - 126px); aspect-ratio: 1200/650; display: block; border: 1px solid var(--line); border-radius: 18px; background: #080e18; box-shadow: 0 24px 70px rgba(0,0,0,.32); }
.round-message { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%) scale(.9); opacity: 0; pointer-events: none; font-size: clamp(32px, 8vw, 88px); font-weight: 950; letter-spacing: -.045em; text-shadow: 0 0 40px currentColor; transition: opacity .12s ease, transform .12s ease; }
.round-message.visible { opacity: 1; transform: translate(-50%,-50%) scale(1); }
.round-message.you { color: var(--you); }
.round-message.bot { color: var(--bot); }

.controls-hint { display: flex; align-items: end; justify-content: center; gap: 24px; color: var(--muted); font-size: 8px; font-weight: 850; letter-spacing: .07em; }
kbd { display: inline-block; padding: 3px 6px; border: 1px solid rgba(200,220,245,.25); border-bottom-width: 2px; border-radius: 5px; color: #c8d6e8; background: rgba(255,255,255,.05); font: 800 9px/1 ui-monospace, monospace; }

.overlay { position: fixed; z-index: 20; inset: 0; display: none; place-items: center; padding: 18px; background: rgba(3,6,11,.83); backdrop-filter: blur(10px); }
.overlay.visible { display: grid; animation: fadeIn .16s ease-out; }
.overlay-card { width: min(520px,100%); padding: clamp(28px,5vw,48px); text-align: center; border: 1px solid rgba(173,207,238,.23); border-radius: 22px; background: linear-gradient(155deg,#142238,#080e18 76%); box-shadow: 0 30px 90px rgba(0,0,0,.5); }
.eyebrow { color: var(--pull); font-size: 9px; font-weight: 950; letter-spacing: .23em; }
.overlay h1 { margin: 10px 0 22px; font-size: clamp(49px,10vw,82px); line-height: 1; letter-spacing: .08em; }
.rules { display: flex; justify-content: center; align-items: center; gap: 14px; font-size: clamp(23px,5vw,36px); }
.rules span { color: var(--muted); }
.overlay p { color: #9aa9bb; font-size: 12px; }
.key-row { display: flex; justify-content: center; gap: 6px; margin: 21px 0; }
.primary { width: min(280px,100%); border: 0; border-radius: 12px; padding: 15px; color: #031017; background: linear-gradient(90deg,var(--you),#84ffd7); font-weight: 950; letter-spacing: .12em; cursor: pointer; box-shadow: 0 10px 35px rgba(82,215,255,.18); }
.overlay-card > small { display: block; margin-top: 14px; color: var(--muted); font-size: 8px; font-weight: 900; letter-spacing: .15em; }
.result-card h2 { margin: 12px 0 6px; font-size: clamp(40px,9vw,72px); letter-spacing: -.04em; }
.final-score { display: flex; justify-content: center; align-items: center; gap: 20px; margin: 10px 0 25px; font: 950 48px/1 ui-monospace,monospace; }
.final-score span { color: var(--muted); }
.final-score strong:first-child { color: var(--you); }
.final-score strong:last-child { color: var(--bot); }

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

@media (max-width: 760px) {
  .game-shell { min-height: 430px; padding: 6px 7px; grid-template-rows: 58px minmax(0,1fr) 28px; }
  .logo { font-size: 13px; letter-spacing: .1em; }
  .hud { gap: 5px; }
  .score { grid-template-columns: auto 22px 56px 22px auto; gap: 3px; }
  .score strong { font-size: 24px; }
  .score > span { font-size: 7px; }
  .score small { font-size: 6px; }
  .hud-actions { gap: 3px; }
  .polarity-readout { min-width: 71px; padding: 6px 4px; }
  .polarity-readout span { font-size: 10px; }
  .polarity-readout small { display:none; }
  #muteButton { padding: 8px 5px; font-size: 6px; }
  #gameCanvas { border-radius: 10px; }
  .controls-hint { gap: 8px; font-size: 6px; }
  .controls-hint span:last-child { display:none; }
}

@media (max-height: 570px) {
  .game-shell { min-height: 360px; grid-template-rows: 50px minmax(0,1fr) 24px; }
  .logo { font-size: 14px; }
  .score strong { font-size: 25px; }
  .polarity-readout { padding-block: 5px; }
}
