:root {
  color-scheme: dark;
  --ink: #edf4ff;
  --muted: #9caccc;
  --line: rgba(196, 220, 255, .18);
  --glass: rgba(17, 25, 59, .62);
  --cyan: #44e9ff;
  --violet: #a979ff;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 14% 16%, rgba(86, 55, 210, .33), transparent 28rem),
    radial-gradient(circle at 88% 82%, rgba(0, 205, 225, .19), transparent 27rem),
    linear-gradient(135deg, #050614, #0b1030 52%, #061522);
  user-select: none;
  -webkit-user-select: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .3;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 36px 36px;
}

.game-shell { display: grid; min-height: 100vh; place-items: center; padding: clamp(16px, 4vw, 48px); }

.game-card {
  width: min(1040px, 100%);
  padding: clamp(16px, 3vw, 30px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(31, 43, 93, .72), rgba(7, 12, 35, .65));
  box-shadow: 0 28px 80px rgba(0,0,0,.38), inset 0 1px rgba(255,255,255,.08);
  backdrop-filter: blur(18px);
}

.game-header { display: flex; justify-content: space-between; gap: 24px; align-items: end; margin-bottom: 22px; }
.eyebrow { margin: 0 0 5px; color: var(--cyan); font-size: .7rem; font-weight: 800; letter-spacing: .19em; }
h1 { margin: 0; font-size: clamp(1.65rem, 4vw, 2.55rem); letter-spacing: -.06em; }
.stats { display: flex; gap: clamp(10px, 2vw, 23px); }
.stat { display: grid; gap: 3px; min-width: 65px; }
.stat span { color: var(--muted); font-size: .67rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.stat strong { color: #fff; font-size: .93rem; letter-spacing: .04em; text-shadow: 0 0 16px rgba(68,233,255,.45); white-space: nowrap; }
#lives { color: #ff68bd; font-size: .72rem; letter-spacing: .12em; }

.canvas-wrap {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(151, 205, 255, .23);
  border-radius: 18px;
  background: #060b20;
  box-shadow: inset 0 0 40px rgba(41, 104, 205, .22), 0 16px 36px rgba(0,0,0,.25);
  touch-action: none;
}

canvas { display: block; width: 100%; height: auto; aspect-ratio: 8 / 5; cursor: none; }
.status-overlay { position: absolute; inset: 0; display: grid; place-content: center; gap: 5px; padding: 20px; text-align: center; background: rgba(3, 7, 25, .36); transition: opacity .25s ease, visibility .25s ease; pointer-events: none; }
.status-overlay.hidden { opacity: 0; visibility: hidden; }
.status-overlay span { color: var(--cyan); font-size: .72rem; font-weight: 800; letter-spacing: .19em; }
.status-overlay strong { font-size: clamp(1.5rem, 4vw, 2.35rem); letter-spacing: -.045em; text-shadow: 0 0 22px rgba(169,121,255,.6); }
.status-overlay small { color: #c6d1ed; font-size: .82rem; }

.controls-row { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-top: 20px; }
.button-group { display: flex; gap: 10px; }
button { border: 0; border-radius: 11px; padding: 11px 16px; color: var(--ink); font: inherit; font-size: .84rem; font-weight: 760; cursor: pointer; transition: transform .18s ease, filter .18s ease; }
button:hover { filter: brightness(1.14); transform: translateY(-2px); }
button:active { transform: translateY(0); }
.button-primary { background: linear-gradient(115deg, #00c9e9, #7e6aff); box-shadow: 0 8px 22px rgba(65, 126, 255, .3); }
.button-secondary { border: 1px solid var(--line); background: rgba(255,255,255,.065); }
.help { margin: 0; color: var(--muted); font-size: .76rem; line-height: 1.65; text-align: right; }
kbd { display: inline-block; min-width: 19px; padding: 1px 4px; border: 1px solid rgba(219,234,255,.25); border-radius: 4px; color: #eaf5ff; background: rgba(255,255,255,.08); font-family: inherit; font-size: .7rem; text-align: center; }

@media (max-width: 680px) {
  .game-card { border-radius: 20px; }
  .game-header { align-items: start; flex-direction: column; gap: 15px; }
  .stats { width: 100%; justify-content: space-between; }
  .controls-row { align-items: stretch; flex-direction: column; }
  .button-group { display: grid; grid-template-columns: 1fr 1fr; }
  .help { text-align: center; }
}

@media (max-width: 380px) { .game-shell { padding: 10px; } .game-card { padding: 13px; } .stat { min-width: auto; } }
