:root {
  color-scheme: dark;
  --bg: #07101a;
  --panel: rgba(13, 25, 39, 0.88);
  --panel-solid: #0e1b2b;
  --line: rgba(160, 190, 220, 0.15);
  --muted: #8b9caf;
  --text: #f3f8ff;
  --accent: #74f6c1;
  --accent-strong: #39dca1;
  --accent-soft: rgba(116, 246, 193, 0.12);
  --gold: #ffd166;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 0%, rgba(47, 117, 128, 0.22), transparent 32rem),
    radial-gradient(circle at 100% 100%, rgba(75, 55, 124, 0.2), transparent 28rem),
    var(--bg);
}

button {
  font: inherit;
}

.game-shell {
  width: min(100%, 650px);
  padding: 34px 22px 24px;
}

.topbar,
.game-meta,
.control-row,
.brand,
.top-actions {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.brand {
  gap: 13px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #06141a;
  font-size: 24px;
  font-weight: 900;
  background: var(--accent);
  border-radius: 13px;
  box-shadow: 0 0 28px rgba(116, 246, 193, 0.28);
  transform: rotate(-8deg);
}

.eyebrow,
.stat span,
.overlay-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin: 3px 0 0;
  font-size: clamp(22px, 5vw, 28px);
  letter-spacing: -0.04em;
}

.top-actions {
  gap: 15px;
}

.stat {
  min-width: 45px;
  text-align: right;
}

.stat strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 18px;
  line-height: 1;
}

.icon-button,
.direction-button,
.primary-button {
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: var(--accent);
  font-size: 20px;
  background: var(--accent-soft);
  border: 1px solid rgba(116, 246, 193, 0.25);
  border-radius: 12px;
  transition: transform 160ms ease, background 160ms ease;
}

.icon-button:hover,
.icon-button:focus-visible {
  background: rgba(116, 246, 193, 0.2);
  outline: none;
  transform: translateY(-1px);
}

.game-card {
  padding: 15px;
  background: linear-gradient(145deg, rgba(19, 36, 55, 0.92), rgba(8, 19, 31, 0.95));
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.28), inset 0 1px rgba(255, 255, 255, 0.04);
}

.game-meta {
  justify-content: space-between;
  min-height: 32px;
  padding: 0 6px 12px;
  color: var(--muted);
  font-size: 12px;
}

.game-meta p {
  margin: 0;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 7px;
  height: 7px;
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 11px rgba(255, 209, 102, 0.7);
}

.status-dot.is-live {
  background: var(--accent);
  box-shadow: 0 0 11px rgba(116, 246, 193, 0.8);
}

.status-dot.is-paused {
  background: #9ea9ff;
  box-shadow: 0 0 11px rgba(158, 169, 255, 0.75);
}

.canvas-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #08121f;
  border: 1px solid rgba(116, 246, 193, 0.12);
  border-radius: 16px;
  box-shadow: 0 0 0 5px rgba(3, 9, 16, 0.24), 0 14px 38px rgba(0, 0, 0, 0.28);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
}

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

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

.overlay-panel {
  width: min(100%, 345px);
  padding: 28px 24px 23px;
  text-align: center;
  background: rgba(14, 28, 44, 0.92);
  border: 1px solid rgba(116, 246, 193, 0.2);
  border-radius: 18px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
}

.overlay-kicker {
  color: var(--accent);
  font-size: 9px;
}

.overlay h2 {
  margin: 7px 0 9px;
  font-size: clamp(26px, 7vw, 34px);
  letter-spacing: -0.055em;
}

.overlay-panel > p:not(.overlay-kicker):not(.overlay-hint) {
  margin-bottom: 20px;
  color: #b0bdcc;
  font-size: 14px;
  line-height: 1.55;
}

.primary-button {
  width: 100%;
  padding: 12px 18px;
  color: #06141a;
  font-weight: 800;
  background: var(--accent);
  border-radius: 11px;
  box-shadow: 0 7px 20px rgba(57, 220, 161, 0.22);
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.primary-button:hover,
.primary-button:focus-visible {
  background: #9bffda;
  outline: none;
  box-shadow: 0 9px 26px rgba(57, 220, 161, 0.32);
  transform: translateY(-1px);
}

.overlay-hint {
  margin: 17px 0 0;
  color: var(--muted);
  font-size: 11px;
}

kbd {
  display: inline-block;
  min-width: 20px;
  padding: 2px 4px;
  color: #d9e6f4;
  font-size: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 4px;
}

.control-row {
  justify-content: space-between;
  gap: 18px;
  padding: 16px 5px 2px;
}

.keyboard-hint {
  max-width: 265px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.keyboard-hint span {
  margin-right: 4px;
  color: var(--accent);
}

.keyboard-hint strong {
  color: #ced9e6;
  font-weight: 700;
}

.touch-controls {
  display: grid;
  grid-template-columns: repeat(3, 34px);
  grid-template-rows: repeat(2, 34px);
  gap: 4px;
}

.direction-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #c7d7e7;
  font-size: 18px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 9px;
  transition: color 140ms ease, background 140ms ease, transform 140ms ease;
}

.direction-button:hover,
.direction-button:focus-visible,
.direction-button:active {
  color: var(--accent);
  background: var(--accent-soft);
  outline: none;
  transform: scale(0.94);
}

.direction-button.up {
  grid-column: 2;
  grid-row: 1;
}

.direction-button.left {
  grid-column: 1;
  grid-row: 2;
}

.direction-button.down {
  grid-column: 2;
  grid-row: 2;
}

.direction-button.right {
  grid-column: 3;
  grid-row: 2;
}

.footer-note {
  padding-top: 18px;
  color: rgba(139, 156, 175, 0.72);
  font-size: 11px;
  text-align: center;
}

@media (max-width: 500px) {
  .game-shell {
    padding: 20px 13px 17px;
  }

  .topbar {
    margin-bottom: 16px;
  }

  .game-card {
    padding: 10px;
    border-radius: 19px;
  }

  .control-row {
    align-items: flex-end;
    padding-top: 12px;
  }

  .keyboard-hint {
    max-width: 190px;
  }
}

@media (max-width: 370px) {
  .eyebrow {
    font-size: 8px;
  }

  .top-actions {
    gap: 9px;
  }

  .stat {
    min-width: 38px;
  }

  .keyboard-hint {
    display: none;
  }

  .control-row {
    justify-content: flex-end;
  }
}

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