* { box-sizing: border-box; }
:root {
  --bg-1: #0f172a;
  --bg-2: #172554;
  --panel: rgba(15, 23, 42, 0.82);
  --text: #e2e8f0;
  --muted: #93c5fd;
  --accent: #f8fafc;
  --red: #ef4444;
  --blue: #3b82f6;
  --yellow: #facc15;
  --border: rgba(255,255,255,0.1);
}
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Trebuchet MS", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(96, 165, 250, 0.24), transparent 34%),
    linear-gradient(180deg, var(--bg-2), var(--bg-1) 55%, #020617 100%);
}
.shell {
  width: min(100%, 540px);
  margin: 0 auto;
  padding: 16px 14px 28px;
}
.topnav {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.98rem;
}
.topnav a {
  color: #fde68a;
  text-decoration: none;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 16px 36px rgba(2, 6, 23, 0.28);
  backdrop-filter: blur(8px);
}
.hero, .hud, .game-panel, .info {
  padding: 16px;
}
.hero { margin-bottom: 12px; }
.eyebrow {
  margin: 0 0 6px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.74rem;
  color: #93c5fd;
}
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2rem, 7vw, 2.6rem); }
.subtitle {
  margin-top: 8px;
  line-height: 1.45;
  color: #dbeafe;
}
.hud {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 12px;
  text-align: center;
}
.hud .label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.8rem;
  color: #93c5fd;
}
.hud strong {
  font-size: 1.05rem;
}
.game-panel { margin-bottom: 12px; }
.canvas-wrap {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.8), rgba(30, 41, 59, 0.9));
  border-radius: 18px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.08);
}
canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  touch-action: manipulation;
}
.legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  color: #cbd5e1;
  font-size: 0.9rem;
}
.swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  margin-right: 6px;
  vertical-align: middle;
}
.swatch.red { background: var(--red); }
.swatch.blue { background: var(--blue); }
.swatch.yellow { background: var(--yellow); }
.message {
  margin-top: 12px;
  min-height: 44px;
  text-align: center;
  line-height: 1.45;
  color: #f8fafc;
}
.controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 10px;
}
.chute, .restart {
  border: 0;
  border-radius: 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.chute {
  padding: 14px 10px;
  color: #fff;
  min-height: 60px;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,0.2);
}
.chute.red { background: linear-gradient(180deg, #f87171, #dc2626); }
.chute.blue { background: linear-gradient(180deg, #60a5fa, #2563eb); }
.chute.yellow { background: linear-gradient(180deg, #fde047, #eab308); color: #1f2937; }
.chute:active { transform: translateY(1px) scale(0.99); }
.chute.flash {
  outline: 3px solid rgba(255,255,255,0.75);
  transform: translateY(1px) scale(0.98);
}
.footer-row {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.hint {
  color: #93c5fd;
  font-size: 0.9rem;
}
.restart {
  padding: 12px 16px;
  background: #e2e8f0;
  color: #0f172a;
}
.info ul {
  margin: 10px 0 0;
  padding-left: 18px;
  color: #dbeafe;
  line-height: 1.5;
}
@media (max-width: 460px) {
  .hud {
    grid-template-columns: repeat(2, 1fr);
  }
  .controls {
    grid-template-columns: 1fr;
  }
  .chute {
    min-height: 56px;
  }
}
