:root {
  color-scheme: dark;
  --ink: #f5f7ff;
  --muted: #97a0c3;
  --panel: rgba(10, 15, 42, 0.82);
  --line: rgba(148, 163, 255, 0.2);
  --cyan: #57f2e1;
  --violet: #9b7cff;
  --danger: #ff4f87;
  --yellow: #ffe36b;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 10%, rgba(90, 77, 220, 0.24), transparent 28rem),
    radial-gradient(circle at 80% 80%, rgba(0, 216, 190, 0.14), transparent 26rem),
    #050817;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.3;
  background-image: radial-gradient(rgba(255,255,255,.65) 0.7px, transparent 0.7px);
  background-size: 36px 36px;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
}

button { font: inherit; }
button:focus-visible { outline: 3px solid var(--yellow); outline-offset: 4px; }
canvas:focus-visible { outline: 3px solid var(--yellow); outline-offset: -5px; }

.shell {
  width: min(100% - 28px, 460px);
  margin: 0 auto;
  padding: 24px 0 18px;
}

.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  aspect-ratio: 1;
  color: #07121a;
  font-size: 25px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--cyan), #8fffe1);
  box-shadow: 0 0 30px rgba(87, 242, 225, .28);
}
.eyebrow { margin: 0 0 2px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .24em; }
h1 { margin: 0; font-size: clamp(21px, 6vw, 28px); line-height: 1; letter-spacing: -.04em; }
h1 span { color: var(--cyan); }

.game-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .48), inset 0 1px rgba(255,255,255,.05);
  backdrop-filter: blur(18px);
}

.hud { display: grid; grid-template-columns: repeat(3, 1fr); padding: 5px 8px 13px; text-align: center; }
.hud > div + div { border-left: 1px solid var(--line); }
.hud-label { display: block; margin-bottom: 3px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .18em; }
.hud strong { font-variant-numeric: tabular-nums; font-size: 16px; letter-spacing: .06em; }
#lives { color: var(--danger); font-size: 12px; }

.canvas-wrap {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 9 / 16;
  border: 1px solid rgba(136, 157, 255, .2);
  border-radius: 18px;
  background: #070b1d;
}

canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .1;
  background: repeating-linear-gradient(to bottom, transparent 0 3px, rgba(255,255,255,.18) 4px);
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 28px;
  text-align: center;
  background: radial-gradient(circle at center, rgba(26, 34, 86, .75), rgba(5, 8, 23, .94));
  transition: opacity .25s ease, visibility .25s ease;
}
.overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.overlay-icon {
  display: grid;
  place-items: center;
  width: 68px;
  aspect-ratio: 1;
  margin-bottom: 22px;
  color: var(--yellow);
  font-size: 34px;
  border: 1px solid rgba(255, 227, 107, .32);
  border-radius: 50%;
  background: rgba(255, 227, 107, .08);
  box-shadow: 0 0 42px rgba(255, 227, 107, .16);
  animation: pulse 2s ease-in-out infinite;
}
.kicker { margin: 0 0 9px; color: var(--cyan); font-size: 10px; font-weight: 900; letter-spacing: .22em; }
h2 { margin: 0; font-size: clamp(27px, 8vw, 38px); line-height: 1.05; letter-spacing: -.045em; }
#overlay-copy { max-width: 290px; margin: 16px 0 24px; color: var(--muted); font-size: 13px; line-height: 1.6; }
#start {
  min-width: 190px;
  padding: 14px 18px;
  color: #07121a;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .1em;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--cyan), #9bffcf);
  box-shadow: 0 10px 32px rgba(87, 242, 225, .22);
  cursor: pointer;
}
#start:hover { transform: translateY(-1px); filter: brightness(1.07); }

.controls { display: grid; grid-template-columns: 56px 1fr 56px; align-items: center; gap: 8px; padding-top: 12px; }
.controls p { margin: 0; color: var(--muted); font-size: 11px; text-align: center; }
kbd { padding: 2px 6px; border: 1px solid var(--line); border-radius: 5px; background: rgba(255,255,255,.05); }
.control {
  height: 42px;
  color: var(--ink);
  font-size: 19px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255,255,255,.055);
  cursor: pointer;
  touch-action: none;
}
.control:active { background: rgba(87, 242, 225, .17); transform: scale(.96); }

footer { display: flex; justify-content: center; gap: 11px; margin-top: 14px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .12em; }
footer span:first-child { color: var(--yellow); }
footer span:last-child { color: var(--danger); }
.separator { opacity: .45; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes pulse { 50% { transform: scale(1.07) rotate(8deg); } }

@media (max-height: 760px) and (min-width: 500px) {
  .shell { width: min(94vw, 380px); padding-top: 12px; }
  .brand { margin-bottom: 9px; }
  .brand-mark { width: 38px; }
  .canvas-wrap { aspect-ratio: 9 / 16; }
  .controls { padding-top: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
