:root {
  --bg: #0b0d0c;
  --bg-2: #111513;
  --surface: #161b18;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f4efe8;
  --muted: #9aa39d;
  --green: #32cd32;
  --green-2: #7dff6a;
  --gold: #ffc940;
  --pink: #ff5c8a;
  --radius: 18px;
  --font: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-snap-type: y mandatory;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

::selection { background: var(--green); color: var(--bg); }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  overflow: hidden;
  scroll-snap-align: start;
  background:
    radial-gradient(60% 50% at 50% 45%, rgba(50, 205, 50, 0.10), transparent 70%),
    var(--bg);
  isolation: isolate;
}

#net {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 30%;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
  z-index: -1;
}

.hero-inner {
  text-align: center;
  padding: 0 16px;
  animation: rise 0.9s cubic-bezier(.2, .8, .2, 1) both;
}

.eyebrow {
  margin: 0 0 18px;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted);
}

.title {
  margin: 0;
  font-size: clamp(2.6rem, 11vw, 7.5rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.title span {
  font-weight: 300;
  background: linear-gradient(100deg, var(--green) 20%, var(--green-2) 50%, var(--green) 80%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shine 6s linear infinite;
}

.tagline {
  margin: 22px auto 0;
  max-width: 34ch;
  font-size: clamp(1rem, 2.4vw, 1.25rem);
  color: var(--muted);
}

.tagline em {
  font-style: normal;
  color: var(--text);
  border-bottom: 2px solid var(--green);
}

.actions {
  margin-top: 36px;
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  appearance: none;
  border: 0;
  font: inherit;
  font-weight: 500;
  font-size: 1rem;
  padding: 13px 26px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
}

.btn:active { transform: scale(0.97); }

.btn:focus-visible {
  outline: 2px solid var(--green-2);
  outline-offset: 3px;
}

.btn-primary {
  background: var(--green);
  color: #06200a;
  box-shadow: 0 0 0 0 rgba(50, 205, 50, .5), 0 10px 30px -10px rgba(50, 205, 50, .6);
}

.btn-primary:hover {
  background: var(--green-2);
  box-shadow: 0 0 0 6px rgba(50, 205, 50, .15), 0 14px 40px -10px rgba(50, 205, 50, .7);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line);
  backdrop-filter: blur(6px);
}

.btn-ghost:hover { box-shadow: inset 0 0 0 1px rgba(50, 205, 50, .6); color: var(--green-2); }

.scroll-hint {
  position: absolute;
  bottom: 28px;
  left: 50%;
  translate: -50% 0;
  width: 26px;
  height: 42px;
  border-radius: 14px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .25);
}

.scroll-hint span {
  position: absolute;
  left: 50%;
  top: 9px;
  width: 4px;
  height: 8px;
  margin-left: -2px;
  border-radius: 2px;
  background: var(--green);
  animation: wheel 1.6s ease-in-out infinite;
}

/* ---------- Game ---------- */

/* exactly one screen tall so it snaps as a single page */
.game-section {
  max-width: 1040px;
  margin: 0 auto;
  height: 100vh;
  height: 100svh;
  min-height: 560px;
  padding: clamp(16px, 4vh, 40px) 16px 0;
  display: flex;
  flex-direction: column;
  scroll-snap-align: start;
}

.section-head { text-align: center; margin-bottom: clamp(12px, 2.5vh, 24px); }

.section-head h2 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.4rem);
  line-height: 1;
  letter-spacing: -0.03em;
}

.section-head h2 span { color: var(--green); }

.section-head p {
  margin: 10px auto 0;
  max-width: 58ch;
  color: var(--muted);
}

.tag {
  display: inline-block;
  padding: 0 8px;
  border-radius: 999px;
  font-size: .9em;
  font-weight: 500;
}

.tag-no { background: rgba(50, 205, 50, .15); color: var(--green-2); }
.tag-yes { background: rgba(255, 92, 138, .15); color: var(--pink); }
.tag-gold { background: rgba(255, 201, 64, .15); color: var(--gold); }

.game-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: calc(var(--radius) + 6px);
  padding: 6px;
  background: linear-gradient(160deg, rgba(50, 205, 50, .35), rgba(255, 255, 255, .04) 40%, rgba(255, 255, 255, .02));
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .8);
}

.hud {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 6px;
}

.hud-item {
  background: var(--surface);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.hud-item:first-child { border-top-left-radius: var(--radius); }
.hud-item:last-child { border-top-right-radius: var(--radius); }

.hud-label {
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--muted);
}

.hud-value {
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stage {
  position: relative;
  flex: 1;
  min-height: 240px;
  border-radius: 12px 12px var(--radius) var(--radius);
  overflow: hidden;
  background:
    radial-gradient(80% 60% at 50% 110%, rgba(50, 205, 50, .14), transparent 70%),
    linear-gradient(var(--bg-2), var(--bg));
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#game-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

/* on-screen controls, touch devices only */
.dpad {
  display: none;
  grid-template-columns: repeat(3, 56px);
  grid-template-rows: repeat(2, 48px);
  gap: 6px;
  justify-content: center;
  padding-top: 8px;
}

.dpad button {
  appearance: none;
  border: 0;
  border-radius: 14px;
  background: var(--surface);
  color: var(--green);
  font-size: 1.1rem;
  box-shadow: inset 0 0 0 1px var(--line);
  touch-action: manipulation;
}

.dpad button:active { background: rgba(50, 205, 50, .2); }
.dpad [data-dir="up"] { grid-column: 2; }
.dpad [data-dir="left"] { grid-column: 1; grid-row: 2; }
.dpad [data-dir="down"] { grid-column: 2; grid-row: 2; }
.dpad [data-dir="right"] { grid-column: 3; grid-row: 2; }

@media (pointer: coarse) {
  .dpad { display: grid; }
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(8, 10, 9, .55);
  backdrop-filter: blur(4px);
  transition: opacity .25s ease, visibility .25s;
}

.overlay.hidden { opacity: 0; visibility: hidden; }

.overlay-card {
  text-align: center;
  max-width: 380px;
  padding: 28px 26px 22px;
  border-radius: var(--radius);
  background: rgba(22, 27, 24, .92);
  box-shadow: inset 0 0 0 1px var(--line), 0 20px 60px -20px rgba(0, 0, 0, .8);
}

.overlay-card h3 { margin: 0 0 8px; font-size: 1.6rem; letter-spacing: -0.01em; }
.overlay-card p { margin: 0 0 20px; color: var(--muted); }
.overlay-card .hint { margin: 16px 0 0; font-family: var(--mono); font-size: .72rem; opacity: .7; }

/* ---------- Footer & toast ---------- */

.footer {
  margin-top: clamp(12px, 2.5vh, 24px);
  padding: 14px 0 18px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: .9rem;
  border-top: 1px solid var(--line);
}

.footer a { text-decoration: none; }
.footer a:hover { color: var(--green); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  translate: -50% 20px;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--green);
  color: #06200a;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, translate .25s ease;
  z-index: 10;
  white-space: nowrap;
}

.toast.show { opacity: 1; translate: -50% 0; }

/* ---------- Animations ---------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}

@keyframes shine {
  to { background-position: -200% 0; }
}

@keyframes wheel {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(12px); opacity: 0; }
  100% { opacity: 0; }
}

@media (max-width: 640px) {
  .hud-item { padding: 8px 10px; }
  .hud-label { font-size: .58rem; letter-spacing: .1em; }
  .hud-value { font-size: 1.1rem; }
  .section-head p { font-size: .9rem; }
}

@media (max-height: 700px) {
  .section-head p { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}