:root {
  color-scheme: dark;
  --bg: #090b10;
  --panel: #111722;
  --panel-strong: #172132;
  --text: #f6f8fb;
  --muted: #9aa8ba;
  --line: rgba(255, 255, 255, 0.14);
  --accent: #2ee6a6;
  --accent-strong: #16b7ff;
  --danger: #ff5f7a;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.44);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at 18% 0%, rgba(46, 230, 166, 0.16), transparent 28rem),
    radial-gradient(circle at 88% 18%, rgba(22, 183, 255, 0.13), transparent 24rem),
    linear-gradient(135deg, #090b10 0%, #0f1320 45%, #07080c 100%);
  color: var(--text);
  display: flex;
  justify-content: center;
  padding: 24px;
  overflow-x: hidden;
}

.game-shell {
  width: min(100%, 980px);
  display: grid;
  gap: 14px;
}

.top-panel,
.controls {
  background: linear-gradient(180deg, rgba(23, 33, 50, 0.92), rgba(13, 18, 28, 0.92));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.top-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 16px;
}

.brand-block {
  min-width: 0;
}

.eyebrow {
  display: block;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 4px 0 0;
  font-size: clamp(1.45rem, 4vw, 2.4rem);
  line-height: 1;
  letter-spacing: 0;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(74px, 1fr));
  gap: 10px;
  width: min(100%, 360px);
}

.stat {
  min-height: 58px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  display: grid;
  align-content: center;
  gap: 2px;
}

.stat span {
  color: var(--muted);
  font-size: 0.72rem;
}

.stat strong {
  font-size: 1.18rem;
}

.canvas-frame {
  width: 100%;
  aspect-ratio: 900 / 620;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #05070a;
  box-shadow: var(--shadow);
  overflow: hidden;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  user-select: none;
  cursor: crosshair;
}

.controls {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px;
}

button {
  appearance: none;
  min-width: 112px;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--text);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

button:hover,
button:focus-visible {
  background: #1d2a3f;
  border-color: rgba(46, 230, 166, 0.75);
  outline: none;
  transform: translateY(-1px);
}

#startButton {
  background: linear-gradient(135deg, #1fcf92, #138dff);
  color: #061014;
}

#restartButton {
  border-color: rgba(255, 95, 122, 0.44);
}

@media (max-width: 720px) {
  body {
    padding: 12px;
  }

  .top-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .stats {
    width: 100%;
  }
}

@media (max-width: 430px) {
  .stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .stat {
    min-height: 52px;
    padding: 8px 6px;
  }

  .stat strong {
    font-size: 1rem;
  }

  button {
    flex: 1 1 30%;
    min-width: 94px;
    padding: 0 10px;
    font-size: 0.88rem;
  }
}
