@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:wght@400;500&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  --ink: #20201e;
  --muted: #858580;
  --red: #ce302c;
  --mono: 'DM Mono', monospace;
  --display: 'Space Grotesk', sans-serif;
  --sans: 'DM Sans', sans-serif;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: #fff; color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
.game { position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh; overflow: hidden; }
.field { position: absolute; inset: 0; background: #fff; }
canvas { display: block; width: 100%; height: 100%; cursor: crosshair; touch-action: manipulation; }
.game-header {
  position: absolute;
  z-index: 2;
  top: max(24px, env(safe-area-inset-top));
  left: max(28px, env(safe-area-inset-left));
  right: max(28px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}
body[data-state="ready"] .game-header,
body[data-state="ready"] canvas { visibility: hidden; }
.brand { margin: 0; font: 700 27px/1 var(--display); letter-spacing: -.04em; white-space: nowrap; }
.brand span { color: var(--red); }
.score-readout { display: flex; align-items: center; gap: 12px; font: 10px var(--mono); letter-spacing: 1.3px; }
.score-readout > span { color: var(--muted); }
.score-readout b { font-size: 20px; font-weight: 500; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.overlay { position: absolute; z-index: 3; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; background: #ffffff55; }
.overlay[hidden] { display: none; }
.overlay-card { text-align: center; width: 330px; max-width: 100%; padding: 26px; background: #fffffff2; }
.eyebrow { margin: 0 0 24px; font: 10px/1.7 var(--mono); color: var(--muted); }
h2 { margin: 0 0 12px; font: 600 43px/1.1 var(--display); letter-spacing: -2px; }
h2 span { color: var(--red); }
body[data-state="ready"] .overlay-card { width: 440px; }
body[data-state="ready"] h2 { margin-bottom: 20px; font-size: clamp(40px, 7.5vw, 68px); font-weight: 700; line-height: .98; letter-spacing: -.055em; }
#overlay-copy { margin: 0 0 22px; font-size: 12px; line-height: 1.8; color: var(--muted); }
button { cursor: pointer; color: inherit; -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 2px solid var(--red); outline-offset: 5px; }
.start-button { width: 100%; display: flex; align-items: center; justify-content: space-between; background: var(--ink); color: #fff; border: 1px solid var(--ink); padding: 14px 18px; font: 10px var(--mono); letter-spacing: 1.3px; transition: background .15s; }
.start-button:hover { background: var(--red); border-color: var(--red); }
.start-button span { font-size: 17px; line-height: 14px; }
kbd { font: inherit; padding: 2px 5px; border: 1px solid #deded8; border-radius: 2px; background: #fafaf8; }
.control-hints { margin: 18px 0 0; font: 10px/2.2 var(--mono); color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
#mobile-input { position: absolute; opacity: 0; width: 1px; height: 1px; bottom: 0; left: 0; pointer-events: none; font-size: 16px; }
.error { animation: error .18s ease-out; }
@keyframes error { 50% { color: var(--red); } }
@media (max-width: 540px) {
  .game-header { top: max(20px, env(safe-area-inset-top)); left: max(20px, env(safe-area-inset-left)); right: max(20px, env(safe-area-inset-right)); }
  .brand { font-size: clamp(13px, 3.7vw, 20px); }
  .score-readout { gap: 8px; font-size: 8px; }
  .score-readout b { font-size: 18px; }
  h2 { font-size: 38px; }
}
@media (prefers-reduced-motion: reduce) { .error { animation: none; } }
