:root {
  color-scheme: dark;
  --bg: #06070d;
  --panel: #0f1320;
  --ink: #eaf0ff;
  --muted: #a5b4da;
  --line: #2b3253;
  --accent: #63f3ff;
  --accent-2: #ff7ad7;
  --danger: #ff5f6d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", "Roboto", system-ui, sans-serif;
  background:
    radial-gradient(circle at 20% 0%, rgba(99, 243, 255, 0.16), transparent 42%),
    radial-gradient(circle at 80% 0%, rgba(255, 122, 215, 0.16), transparent 36%),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
  padding: clamp(14px, 2.8vw, 30px);
}

.deck {
  width: min(1100px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 14px;
}

.topbar h1 {
  margin: 0.25rem 0 0;
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
  letter-spacing: 0.02em;
}

.kicker {
  margin: 0;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.74rem;
  font-weight: 700;
}

.subtitle {
  margin: 0.55rem 0 0;
  max-width: 70ch;
  color: var(--muted);
}

.panel {
  position: relative;
  background: linear-gradient(170deg, rgba(16, 22, 38, 0.96), rgba(10, 13, 24, 0.95));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
  transform: translateX(-120%);
  pointer-events: none;
}

.controls {
  display: grid;
  gap: 12px;
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

button {
  border: 1px solid #4e5885;
  background: #18203b;
  color: var(--ink);
  padding: 0.58rem 0.95rem;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
}

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

.primary {
  border-color: rgba(99, 243, 255, 0.75);
  background: linear-gradient(135deg, rgba(99, 243, 255, 0.2), rgba(51, 154, 255, 0.16));
}

.ghost {
  border-color: rgba(255, 122, 215, 0.75);
  background: linear-gradient(135deg, rgba(255, 122, 215, 0.2), rgba(150, 100, 255, 0.12));
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
}

.stats p {
  margin: 0;
  background: #0f1430;
  border: 1px solid #2f3967;
  border-radius: 10px;
  padding: 8px 10px;
  display: grid;
  gap: 3px;
}

.stats span {
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stats strong {
  font-size: 1.05rem;
}

.status {
  margin: 0;
  color: #d9e2ff;
  min-height: 1.25rem;
}

.stage {
  padding: 0;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #05070f;
}

.scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.03) 0,
    rgba(255, 255, 255, 0.03) 2px,
    rgba(0, 0, 0, 0.2) 2px,
    rgba(0, 0, 0, 0.2) 4px
  );
  mix-blend-mode: soft-light;
}

.touch {
  display: none;
}

.touch-grid {
  display: grid;
  grid-template-columns: repeat(3, 58px);
  grid-template-rows: repeat(2, 52px);
  gap: 8px;
  justify-content: center;
}

.touch-grid button {
  font-size: 1.1rem;
}

.touch-grid button[data-dir="up"] { grid-column: 2; grid-row: 1; }
.touch-grid button[data-dir="left"] { grid-column: 1; grid-row: 2; }
.touch-grid button[data-dir="down"] { grid-column: 2; grid-row: 2; }
.touch-grid button[data-dir="right"] { grid-column: 3; grid-row: 2; }

.notes h2 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.notes ul {
  margin: 0;
  padding-left: 1rem;
  color: var(--muted);
  display: grid;
  gap: 4px;
}

@media (max-width: 880px) {
  .touch {
    display: block;
  }
}
