:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #f5f5fb;
  background: #090913;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 50% 0, rgb(253 121 0 / 14%), transparent 48rem),
    #090913;
}

a { color: #ff9a43; }

.arcade {
  width: min(100% - 32px, 560px);
  margin: 0 auto;
  padding: 28px 0 32px;
}

.back-link { display: inline-block; margin-bottom: 24px; text-decoration: none; }
.back-link:hover, footer a:hover { text-decoration: underline; }

.arcade-header { margin-bottom: 20px; text-align: center; }
.eyebrow { margin: 0 0 8px; color: #ff9a43; font-size: 0.75rem; font-weight: 800; letter-spacing: 0.16em; }
h1 { margin: 0; font-size: clamp(2rem, 8vw, 3rem); }
.arcade-header > p:last-child { margin: 10px 0 0; color: #c4c4d2; line-height: 1.5; }

.game-panel {
  padding: clamp(14px, 4vw, 24px);
  border: 1px solid #2e2e42;
  border-radius: 18px;
  background: rgb(19 19 34 / 94%);
  box-shadow: 0 24px 70px rgb(0 0 0 / 32%);
}

.game-toolbar { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.score-box { display: grid; gap: 2px; min-width: 112px; color: #b7b7c8; font-size: 0.82rem; }
.score-box strong { color: #fff; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.board-wrap { position: relative; overflow: hidden; width: 100%; border: 1px solid #37374b; border-radius: 12px; background: #0c1018; }
canvas { display: block; width: 100%; height: auto; aspect-ratio: 1; outline-offset: -4px; touch-action: none; }

.game-message {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  background: rgb(9 9 19 / 78%);
  text-align: center;
}

.game-message[hidden] { display: none; }
.game-message strong { font-size: clamp(1.35rem, 6vw, 1.8rem); }
.game-message span { color: #d1d1dc; line-height: 1.5; }

.arcade-button, .touch-controls button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: #fd7900;
  color: #fff;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.arcade-button { padding: 10px 18px; }
.arcade-button:hover, .touch-controls button:hover { background: #e66c00; }
.arcade-button:focus-visible, .touch-controls button:focus-visible, a:focus-visible, canvas:focus-visible { outline: 3px solid #ffd1a8; outline-offset: 3px; }
.arcade-button:disabled { cursor: not-allowed; opacity: 0.5; }
.arcade-button.secondary { border-color: #49495d; background: #222235; }
.arcade-button.secondary:hover:not(:disabled) { background: #303047; }
.game-actions { display: flex; justify-content: center; gap: 10px; margin-top: 14px; }

.touch-controls { display: none; margin-top: 18px; }
.touch-controls > button { display: block; margin: 0 auto 6px; }
.touch-controls div { display: flex; justify-content: center; gap: 6px; }
.touch-controls button { width: 52px; font-size: 1.25rem; touch-action: manipulation; }

.instructions { margin: 18px 0 0; color: #b7b7c8; font-size: 0.9rem; line-height: 1.8; text-align: center; }
.ad-container { margin-top: 20px; }
kbd { padding: 2px 6px; border: 1px solid #49495d; border-radius: 4px; background: #222235; color: #fff; font: inherit; }
footer { margin-top: 18px; color: #9c9caf; font-size: 0.85rem; text-align: center; }

@media (pointer: coarse), (max-width: 600px) {
  .touch-controls { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
