:root {
  color-scheme: dark;
  --ink: #e9f2f2;
  --muted: #8ea2a5;
  --panel: #0d1b21;
  --panel-strong: #10252b;
  --line: rgba(184, 242, 5, 0.22);
  --acid: #b8f205;
  --acid-soft: #d8ff62;
  --orange: #ff8a3d;
  --shadow: rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: transparent;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: transparent;
  font-family: "Arial Narrow", "Roboto Condensed", Inter, system-ui, sans-serif;
}

button {
  font: inherit;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 24px;
}

.game-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.identity {
  display: flex;
  align-items: baseline;
  gap: 16px;
}

.eyebrow,
.score-label,
.panel-number,
.overlay-kicker,
.speed-meta,
.status-chip {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

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

h1 {
  margin: 0;
  color: var(--acid);
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(2.4rem, 5.7vw, 4.85rem);
  font-weight: 900;
  letter-spacing: 0.025em;
  line-height: 0.86;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 104px;
  justify-content: center;
  padding: 10px 13px;
  border: 1px solid rgba(233, 242, 242, 0.14);
  background: rgba(13, 27, 33, 0.82);
  color: var(--muted);
}

.status-light {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--acid);
  box-shadow: 0 0 12px rgba(184, 242, 5, 0.8);
}

.status-chip.paused .status-light {
  background: #ffd55c;
  box-shadow: 0 0 12px rgba(255, 213, 92, 0.7);
}

.status-chip.over .status-light {
  background: var(--orange);
  box-shadow: 0 0 12px rgba(255, 138, 61, 0.7);
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 18px;
}

.game-console,
.control-panel {
  border: 1px solid rgba(233, 242, 242, 0.12);
  background: rgba(13, 27, 33, 0.88);
  box-shadow: 0 26px 70px var(--shadow);
  backdrop-filter: blur(8px);
}

.game-console {
  padding: 14px;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid rgba(233, 242, 242, 0.11);
  border-bottom: 0;
  background: #09161b;
}

.score-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 12px 16px;
  border-right: 1px solid rgba(233, 242, 242, 0.1);
}

.score-item:last-child {
  border-right: 0;
}

.score-label {
  color: var(--muted);
}

.score-item strong {
  color: var(--acid-soft);
  font-family: "Courier New", monospace;
  font-size: 1.25rem;
  letter-spacing: 0.06em;
}

.screen-wrap {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(184, 242, 5, 0.38);
  background:
    linear-gradient(rgba(4, 14, 19, 0.42), rgba(4, 14, 19, 0.52)),
    url("./valdez-mountains.jpg") 50% 50% / cover no-repeat;
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.55);
  touch-action: none;
}

canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1;
}

.scanlines {
  pointer-events: none;
  position: absolute;
  inset: 0;
  opacity: 0.16;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 3px,
    rgba(255, 255, 255, 0.035) 4px
  );
}

.game-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(5, 14, 18, 0.64);
  backdrop-filter: blur(3px);
  transition: opacity 180ms ease, visibility 180ms ease;
}

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

.overlay-card {
  width: min(430px, 100%);
  padding: clamp(24px, 6vw, 42px);
  border-left: 4px solid var(--acid);
  background: rgba(13, 27, 33, 0.94);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.45);
}

.overlay-kicker {
  color: var(--acid);
}

.overlay-card h2 {
  margin: 10px 0 12px;
  font-size: clamp(1.9rem, 5vw, 3.2rem);
  line-height: 0.98;
}

.overlay-card p {
  margin: 0 0 24px;
  color: #b6c6c8;
  font-family: Inter, system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  width: 100%;
  border: 0;
  padding: 15px 17px;
  background: var(--acid);
  color: #0a1214;
  font-weight: 900;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease;
}

.primary-button:hover {
  transform: translateY(-2px);
  background: var(--acid-soft);
}

.primary-button:focus-visible,
.control-button:focus-visible,
.text-control:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.control-panel {
  display: flex;
  flex-direction: column;
  padding: 22px;
}

.control-panel h2 {
  margin: 6px 0 14px;
  font-size: 1.35rem;
}

.panel-number {
  color: var(--acid);
}

.panel-block {
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid rgba(233, 242, 242, 0.11);
}

.key-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.key {
  display: inline-flex;
  min-width: 31px;
  min-height: 31px;
  align-items: center;
  justify-content: center;
  padding: 4px 7px;
  border: 1px solid rgba(233, 242, 242, 0.19);
  border-bottom-width: 3px;
  background: #09161b;
  color: #d8e2e3;
  font-family: "Courier New", monospace;
  font-size: 0.76rem;
  font-weight: 700;
}

.key.wide {
  min-width: 72px;
}

.text-control {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  border: 0;
  border-top: 1px solid rgba(233, 242, 242, 0.08);
  padding: 10px 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.text-control:hover span:first-child {
  color: var(--acid);
}

.speed-readout {
  margin-top: auto;
}

.speed-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  color: var(--muted);
}

#speedLabel {
  color: var(--acid);
}

.speed-track {
  height: 8px;
  overflow: hidden;
  background: #071116;
}

.speed-track span {
  display: block;
  width: 20%;
  height: 100%;
  background: linear-gradient(90deg, var(--acid), var(--orange));
  transition: width 220ms ease;
}

.mobile-controls {
  display: none;
  grid-template-columns: repeat(3, 58px);
  grid-template-areas:
    ". up ."
    "left down right";
  justify-content: center;
  gap: 8px;
  padding: 16px 0 2px;
}

.control-button {
  width: 58px;
  height: 48px;
  border: 1px solid rgba(233, 242, 242, 0.18);
  border-bottom-width: 3px;
  background: #09161b;
  color: var(--acid-soft);
  font-size: 1.2rem;
  font-weight: 900;
  cursor: pointer;
  touch-action: manipulation;
}

.control-button:active {
  transform: translateY(2px);
  border-bottom-width: 1px;
}

.up { grid-area: up; }
.left { grid-area: left; }
.down { grid-area: down; }
.right { grid-area: right; }

.keyboard-hint {
  margin: 13px 0 0;
  color: var(--muted);
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.82rem;
  text-align: center;
}

.keyboard-hint strong {
  color: #c7d3d4;
}

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

@media (max-width: 820px) {
  .app-shell {
    width: min(680px, calc(100% - 22px));
    padding-top: 20px;
  }

  .game-layout {
    grid-template-columns: 1fr;
  }

  .control-panel {
    display: none;
  }

  .mobile-controls {
    display: grid;
  }

  .keyboard-hint {
    display: none;
  }
}

@media (max-width: 520px) {
  .game-header {
    align-items: center;
  }

  .identity {
    display: block;
  }

  .eyebrow {
    display: block;
    margin-bottom: 7px;
    font-size: 0.66rem;
  }

  .status-chip {
    min-width: 88px;
    font-size: 0.66rem;
  }

  .game-console {
    padding: 8px;
  }

  .score-item {
    display: block;
    min-height: 50px;
    padding: 8px 10px;
  }

  .score-label {
    display: block;
    margin-bottom: 3px;
    font-size: 0.62rem;
  }

  .score-item strong {
    font-size: 1.05rem;
  }

  .overlay-card {
    padding: 23px 20px;
  }

  .overlay-card p {
    font-size: 0.92rem;
  }
}

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