:root {
  color-scheme: dark;
  --ink: #edf6df;
  --muted: #91a187;
  --ground: #080d09;
  --panel: rgba(14, 23, 16, 0.88);
  --line: #2a3c2e;
  --line-bright: #456045;
  --acid: #c7ff64;
  --acid-dim: #83b83e;
  --amber: #ffbf47;
  --danger: #ff6b57;
  --display: "Avenir Next Condensed", "DIN Condensed", "Franklin Gothic Medium", sans-serif;
  --mono: "Cascadia Mono", "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--ground);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--mono);
  background:
    radial-gradient(circle at 78% 12%, rgba(105, 158, 56, 0.15), transparent 34rem),
    radial-gradient(circle at 8% 80%, rgba(255, 191, 71, 0.07), transparent 30rem),
    linear-gradient(135deg, #080d09 0%, #0b120d 54%, #070b08 100%);
  overflow-x: hidden;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  content: "";
  opacity: 0.16;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 3px, rgba(198, 255, 100, 0.055) 4px);
  mix-blend-mode: screen;
}

button,
canvas {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

button:focus-visible,
canvas:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 4px;
}

.page-shell {
  position: relative;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: clamp(22px, 4vw, 64px);
}

.page-shell::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: clamp(22px, 4vw, 64px);
  width: 1px;
  content: "";
  background: linear-gradient(transparent, var(--line) 12%, var(--line) 88%, transparent);
}

.masthead {
  position: relative;
  margin-bottom: clamp(28px, 4vw, 52px);
  padding-left: clamp(14px, 2vw, 30px);
}

.brand-line {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.brand-mark {
  display: inline-flex;
  gap: 3px;
  align-items: flex-end;
  height: 17px;
}

.brand-mark i {
  display: block;
  width: 6px;
  height: 6px;
  background: var(--acid);
  box-shadow: 0 0 12px rgba(199, 255, 100, 0.45);
}

.brand-mark i:nth-child(2) {
  height: 11px;
}

.brand-mark i:nth-child(3) {
  height: 16px;
}

.eyebrow,
.section-index,
.metric-label,
.local-badge,
.game-topline,
.game-footer,
.page-footer,
.overlay-kicker {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow {
  color: var(--acid);
}

.local-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 8px 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  background: rgba(8, 13, 9, 0.64);
}

.pulse,
.feed-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--acid);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--acid);
  animation: pulse 2s ease-in-out infinite;
}

h1 {
  max-width: 1100px;
  margin: 0;
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(4.2rem, 11vw, 9.5rem);
  font-stretch: condensed;
  font-weight: 800;
  line-height: 0.78;
  letter-spacing: -0.075em;
  text-transform: uppercase;
  text-shadow: 0 10px 40px rgba(0, 0, 0, 0.38);
}

h1 span {
  color: var(--acid);
  font-weight: 400;
}

.tagline {
  max-width: 580px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: clamp(0.78rem, 1.4vw, 0.94rem);
  line-height: 1.8;
}

.arcade-layout {
  display: grid;
  grid-template-columns: minmax(250px, 0.7fr) minmax(480px, 1.3fr);
  gap: clamp(18px, 3vw, 44px);
  align-items: start;
}

.side-panel,
.game-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(16px);
}

.side-panel {
  position: relative;
  padding: clamp(20px, 3vw, 34px);
}

.side-panel::after {
  position: absolute;
  top: -1px;
  left: -1px;
  width: 42%;
  height: 3px;
  content: "";
  background: var(--acid);
  box-shadow: 0 0 20px rgba(199, 255, 100, 0.28);
}

.score-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: clamp(30px, 4vw, 48px);
}

.metric {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.metric-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
}

.metric strong {
  color: var(--acid);
  font-family: var(--display);
  font-size: clamp(2.8rem, 5vw, 4.6rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.055em;
}

.metric:last-child strong {
  color: var(--amber);
}

.section-index {
  display: block;
  margin-bottom: 14px;
  color: var(--acid-dim);
}

.instruction {
  margin-bottom: clamp(28px, 4vw, 44px);
}

.instruction h2 {
  margin: 0 0 12px;
  font-family: var(--display);
  font-size: clamp(1.65rem, 3vw, 2.3rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
}

.instruction p {
  margin: 0;
  color: var(--muted);
  font-size: 0.77rem;
  line-height: 1.9;
}

.control-group {
  margin-top: 24px;
}

.speed-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
}

.speed-button {
  min-height: 42px;
  padding: 8px;
  color: var(--muted);
  cursor: pointer;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  transition: color 160ms ease, background 160ms ease;
}

.speed-button:last-child {
  border-right: 0;
}

.speed-button:hover {
  color: var(--ink);
  background: rgba(199, 255, 100, 0.07);
}

.speed-button.is-active {
  color: #10170d;
  background: var(--acid);
}

.system-buttons {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 10px;
}

.button {
  min-height: 46px;
  padding: 12px 18px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button:active {
  transform: translateY(0);
}

.button-primary {
  color: #11180c;
  background: var(--acid);
  box-shadow: 0 8px 28px rgba(199, 255, 100, 0.12);
}

.button-primary:hover {
  box-shadow: 0 12px 34px rgba(199, 255, 100, 0.24);
}

.button-secondary {
  color: var(--ink);
  border-color: var(--line-bright);
  background: transparent;
}

.button-secondary:hover {
  background: rgba(255, 255, 255, 0.04);
}

.key-guide {
  display: grid;
  gap: 10px;
  margin-top: 28px;
  padding-top: 22px;
  color: var(--muted);
  font-size: 0.67rem;
  border-top: 1px solid var(--line);
}

.key-guide div {
  display: flex;
  align-items: center;
  gap: 12px;
}

kbd {
  min-width: 58px;
  padding: 4px 7px;
  color: var(--ink);
  font: inherit;
  text-align: center;
  border: 1px solid var(--line-bright);
  background: #111a12;
  box-shadow: inset 0 -2px 0 rgba(255, 255, 255, 0.05);
}

.game-panel {
  padding: clamp(12px, 2vw, 22px);
}

.game-topline,
.game-footer,
.page-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.game-topline {
  padding: 4px 2px 16px;
}

.game-topline > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

#status-text {
  color: var(--acid);
}

.board-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line-bright);
  background: #071009;
  box-shadow: inset 0 0 70px rgba(0, 0, 0, 0.45);
}

#game-board {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  cursor: crosshair;
  touch-action: none;
}

.game-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  background: rgba(5, 10, 6, 0.79);
  backdrop-filter: blur(7px);
  transition: opacity 180ms ease;
}

.game-overlay.is-hidden {
  pointer-events: none;
  opacity: 0;
}

.overlay-content {
  max-width: 390px;
}

.overlay-kicker {
  display: block;
  margin-bottom: 18px;
  color: var(--amber);
}

.overlay-content h2 {
  margin: 0 0 16px;
  font-family: var(--display);
  font-size: clamp(2.6rem, 6vw, 5rem);
  line-height: 0.95;
  letter-spacing: -0.045em;
}

.overlay-content p {
  margin: 0 0 26px;
  color: #b1bea7;
  font-size: 0.76rem;
  line-height: 1.8;
}

.overlay-content .button {
  min-width: 150px;
}

.mobile-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(56px, 78px));
  grid-template-rows: repeat(3, 48px);
  justify-content: center;
  gap: 7px;
  margin: 20px auto 4px;
}

.direction-button {
  color: var(--acid);
  font-size: 1.3rem;
  cursor: pointer;
  border: 1px solid var(--line-bright);
  background: #101a12;
  user-select: none;
}

.direction-button:active {
  color: #10170d;
  background: var(--acid);
}

.direction-button.up { grid-column: 2; grid-row: 1; }
.direction-button.left { grid-column: 1; grid-row: 2; }
.direction-center { grid-column: 2; grid-row: 2; border: 1px solid var(--line); }
.direction-button.right { grid-column: 3; grid-row: 2; }
.direction-button.down { grid-column: 2; grid-row: 3; }

.game-footer {
  flex-wrap: wrap;
  margin-top: 20px;
  padding: 14px 2px 2px;
  border-top: 1px solid var(--line);
  font-size: 0.58rem;
}

.page-footer {
  margin-top: 30px;
  padding: 22px 0 0 clamp(14px, 2vw, 30px);
  border-top: 1px solid var(--line);
  font-size: 0.6rem;
  line-height: 1.7;
}

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

.noscript {
  position: fixed;
  right: 20px;
  bottom: 20px;
  left: 20px;
  z-index: 30;
  padding: 20px;
  color: #161008;
  background: var(--amber);
}

@keyframes pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

@media (pointer: fine) {
  .mobile-controls {
    display: none;
  }
}

@media (max-width: 900px) {
  .arcade-layout {
    grid-template-columns: 1fr;
  }

  .side-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }

  .score-grid,
  .instruction {
    margin-bottom: 0;
  }

  .score-grid,
  .instruction {
    grid-column: span 2;
  }

.audio-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.62rem;
  line-height: 1.5;
}

#audio-state {
  color: var(--acid);
  font-weight: 800;
  letter-spacing: 0.1em;
}

.audio-buttons {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 8px;
}

.audio-buttons .button {
  min-height: 40px;
  padding: 9px 10px;
  font-size: 0.66rem;
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.62rem;
}

.volume-control input {
  width: 100%;
  accent-color: var(--acid);
  cursor: pointer;
}

.key-guide {

    display: none;
  }
}

@media (max-width: 600px) {
  .page-shell {
    padding: 18px 14px 24px;
  }

  .page-shell::before {
    display: none;
  }

  .masthead {
    padding-left: 0;
  }

  .brand-line {
    flex-wrap: wrap;
    gap: 10px;
  }

  .local-badge {
    margin-left: 0;
    font-size: 0.56rem;
  }

  h1 {
    font-size: clamp(3.55rem, 19vw, 6rem);
  }

  .tagline {
    margin-top: 18px;
  }

  .side-panel {
    padding: 18px;
  }

  .metric strong {
    font-size: 3rem;
  }

  .game-panel {
    padding: 10px;
  }

  .game-footer {
    justify-content: flex-start;
    font-size: 0.52rem;
  }

  .page-footer {
    align-items: flex-start;
    flex-direction: column;
    padding-left: 0;
  }
}

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