:root {
  --teal: #2A9D8F;
  --teal-dark: #237F74;
  --navy: #264653;
  --orange: #F4A261;
  --bg: #F7FAFC;
  --border: #E2E8F0;
  --text: #334155;
  --muted: #64748B;
  --white: #ffffff;
  --danger: #ef4444;
  --shadow: 0 18px 45px rgba(38, 70, 83, 0.16);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 10%, rgba(42, 157, 143, 0.18), transparent 30%),
    radial-gradient(circle at 85% 20%, rgba(244, 162, 97, 0.18), transparent 28%),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 55%, #eef8f6 100%);
}

button, a { font: inherit; }
button { cursor: pointer; border: 0; }
a { color: inherit; }

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand img {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  box-shadow: 0 12px 24px rgba(42, 157, 143, .25);
}
.eyebrow {
  margin: 0;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .12em;
}
h1 { margin: 0; color: var(--navy); font-size: clamp(24px, 4vw, 42px); line-height: 1; }
.site-link {
  text-decoration: none;
  background: var(--navy);
  color: #fff;
  border-radius: 999px;
  padding: 11px 15px;
  font-weight: 800;
  box-shadow: var(--shadow);
}

.game-card, .leaderboard, .growth-note {
  border: 1px solid var(--border);
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(14px);
  border-radius: 26px;
  box-shadow: var(--shadow);
}
.game-card { padding: 14px; }
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
.stats div {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 10px;
  background: #fff;
  min-width: 0;
}
.stats span {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  font-weight: 800;
}
.stats strong { display: block; color: var(--navy); font-size: clamp(18px, 4vw, 28px); }
.canvas-wrap {
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 24px;
  overflow: hidden;
  background: var(--navy);
  touch-action: none;
}
canvas {
  display: block;
  width: min(100%, 560px);
  aspect-ratio: 7 / 12;
  background: #0f2730;
}
.overlay {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  padding: 16px;
  background: linear-gradient(180deg, rgba(38,70,83,.72), rgba(20,42,50,.9));
  color: white;
}
.overlay.show { display: grid; }
.panel {
  width: min(92%, 520px);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 28px;
  padding: 24px;
  background: rgba(255,255,255,.1);
  box-shadow: 0 25px 70px rgba(0,0,0,.28);
  text-align: center;
}
.tag {
  display: inline-flex;
  margin: 0 0 8px;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(42,157,143,.22);
  color: #dffdf8;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.panel h2 { margin: 4px 0 10px; font-size: clamp(26px, 5vw, 44px); line-height: 1; }
.copy { margin: 0 auto 16px; color: rgba(255,255,255,.82); max-width: 44ch; }
.mode-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.mode {
  border: 1px solid rgba(255,255,255,.24);
  background: rgba(255,255,255,.08);
  color: #fff;
  border-radius: 14px;
  padding: 11px 8px;
  font-weight: 900;
}
.mode.active { background: var(--orange); color: #172b32; }
.primary, .secondary {
  display: block;
  width: 100%;
  border-radius: 16px;
  padding: 14px 18px;
  font-weight: 950;
  margin-top: 10px;
}
.primary { background: var(--teal); color: #fff; box-shadow: 0 14px 24px rgba(42,157,143,.32); }
.secondary { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.2); }
.how-box {
  text-align: left;
  margin-top: 12px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(0,0,0,.16);
  font-size: 14px;
}
.how-box p { margin: 8px 0; }
.toast {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%) translateY(16px);
  opacity: 0;
  pointer-events: none;
  background: rgba(255,255,255,.96);
  color: var(--navy);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 900;
  box-shadow: var(--shadow);
  transition: .25s ease;
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.controls {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.control, .shoot, .actions button {
  border-radius: 18px;
  padding: 14px 10px;
  color: #fff;
  font-weight: 950;
  box-shadow: 0 10px 18px rgba(38,70,83,.12);
}
.control { background: var(--navy); }
.shoot { background: var(--orange); color: #172b32; }
.actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.actions button { background: var(--teal-dark); }
.leaderboard, .growth-note { padding: 18px; margin-top: 16px; }
.leaderboard h2, .growth-note h2 { margin: 0 0 10px; color: var(--navy); }
.leaderboard ol { margin: 0; padding-left: 28px; }
.leaderboard li { padding: 7px 0; font-weight: 800; color: var(--text); }
.growth-note p { margin: 0; color: var(--muted); line-height: 1.6; }

@media (min-width: 860px) {
  .shell { display: grid; grid-template-columns: 1fr 330px; gap: 18px; align-items: start; }
  .topbar { grid-column: 1 / -1; }
  .leaderboard, .growth-note { margin-top: 0; }
  .growth-note { grid-column: 2; }
}

@media (max-width: 520px) {
  .shell { width: min(100% - 12px, 1120px); padding-top: 8px; }
  .game-card { padding: 8px; border-radius: 20px; }
  .stats { gap: 6px; }
  .stats div { padding: 8px 6px; border-radius: 14px; }
  .stats strong { font-size: 18px; }
  .site-link { display: none; }
  .panel { padding: 18px; border-radius: 22px; }
  .mode-row { grid-template-columns: 1fr; }
  .controls { position: sticky; bottom: 6px; z-index: 5; }
}
