:root {
  --bg: #0b0f1a;
  --panel: #111827;
  --line: #1f2937;
  --blue: #2775CA;
  --blue-shade: #0d3b7a;
  --blue-deep: #061c3d;
  --yellow: #FFD400;
  --yellow-dark: #c99700;
  --pink: #FF3B6B;
  --white: #f4f4f4;
  --muted: #8a96b3;
  --dim: #4b5566;
  --display: 'Press Start 2P', 'Courier New', monospace;   /* headings, buttons, scores */
  --label: 'Silkscreen', 'Courier New', monospace;         /* short labels, nav, table heads */
  --body: 'VT323', 'Courier New', monospace;               /* readable paragraphs */
  --nav-h: 60px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body {
  margin: 0; max-width: 100vw; overflow-x: hidden;
  background: var(--bg);
  color: var(--white);
  font-family: var(--body);
  font-size: 21px;
  line-height: 1.35;
}
a { color: var(--blue); }
a:hover { color: var(--yellow); }
img { display: block; image-rendering: pixelated; }
svg { image-rendering: pixelated; max-width: 100%; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; margin: 0; line-height: 1.5; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font: inherit; cursor: pointer; }

.scanlines {
  position: fixed; inset: 0; z-index: 50; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,0.05) 0 1px, transparent 1px 4px);
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 10px 18px;
  font-family: var(--display); font-size: 11px; line-height: 1.2; letter-spacing: 0.5px; text-transform: uppercase;
  text-decoration: none; border: 0; color: var(--white); white-space: nowrap;
  transition: transform 60ms steps(1), box-shadow 60ms steps(1);
}
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--blue-deep) !important; }
.btn--blue { background: var(--blue); box-shadow: 4px 4px 0 var(--blue-deep); }
.btn--blue:hover { color: var(--white); background: #3182d6; }
.btn--yellow { background: var(--yellow); color: var(--bg); box-shadow: 4px 4px 0 var(--yellow-dark); }
.btn--yellow:hover { color: var(--bg); background: #ffe14a; }
.btn--ghost { background: transparent; border: 3px solid var(--white); box-shadow: 4px 4px 0 var(--dim); }
.btn--ghost:hover { color: var(--yellow); border-color: var(--yellow); }
.btn--dim { background: var(--line); color: var(--dim); box-shadow: none; cursor: not-allowed; }
.btn--lg { padding: 16px 28px; font-size: 13px; }

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 40; height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 24px; background: var(--bg); border-bottom: 3px solid var(--line);
}
.nav__logo img { height: 32px; width: auto; }
.nav__links { display: flex; gap: 22px; font-family: var(--label); font-size: 15px; text-transform: uppercase; letter-spacing: 1px; }
.nav__links a { color: var(--muted); text-decoration: none; }
.nav__links a:hover { color: var(--yellow); }

/* Hero */
.hero {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 22px;
  padding: 72px 24px 56px; max-width: 900px; margin: 0 auto;
}
.hero__logo { width: min(560px, 88vw); height: auto; }
.hero__insert {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--display); font-size: 12px; color: var(--yellow); text-transform: uppercase;
}
.blink { width: 12px; height: 12px; background: var(--yellow); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
.hero__title { font-size: clamp(18px, 4vw, 34px); line-height: 1.6; text-shadow: 4px 4px 0 var(--blue-deep); text-wrap: balance; }
.hero__sub { max-width: 560px; color: var(--muted); font-size: 23px; text-wrap: pretty; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; }
.stats { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0 0; width: 100%; max-width: 640px; }
.stats > div { flex: 1 1 150px; background: var(--panel); border: 3px solid var(--line); padding: 14px; }
.stats dt { font-family: var(--label); font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.stats dd { margin: 6px 0 0; font-family: var(--display); font-size: 16px; color: var(--yellow); }

/* Sections */
.section { max-width: 1040px; margin: 0 auto; padding: 56px 24px; border-top: 3px dashed var(--line); scroll-margin-top: var(--nav-h); }
.section__title { font-size: clamp(13px, 2.4vw, 20px); margin-bottom: 28px; text-transform: uppercase; }
.section__title::before { content: '> '; color: var(--blue); }
.section__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px; }
.section__note { color: var(--muted); font-size: 19px; margin-bottom: 28px; }

/* Cabinets */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.cab {
  display: flex; flex-direction: column; gap: 12px;
  background: var(--panel); border: 4px solid var(--blue); box-shadow: 8px 8px 0 var(--blue-deep);
  padding: 16px;
}
.cab--soon { border-color: var(--line); box-shadow: 8px 8px 0 #05070d; }
.cab--soon .cab__screen svg { opacity: 0.6; }
.cab--vote { border-style: dashed; border-color: var(--dim); box-shadow: none; justify-content: center; }
.cab__screen { background: var(--bg); border: 2px solid var(--line); height: 170px; display: flex; align-items: center; justify-content: center; padding: 10px; overflow: hidden; }
.cab__screen svg { display: block; width: 100%; height: auto; max-height: 100%; }
.cab__name { font-size: 12px; text-transform: uppercase; }
.cab__desc { color: var(--muted); font-size: 20px; flex: 1; }
.cab__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cab__best { font-family: var(--display); font-size: 10px; color: var(--yellow); }
.cab--soon .cab__best { color: var(--dim); }

/* Steps */
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.step { display: flex; flex-direction: column; gap: 10px; background: var(--panel); border: 3px solid var(--line); padding: 20px; }
.step__n { display: inline-flex; width: 40px; height: 40px; align-items: center; justify-content: center; background: var(--blue); font-family: var(--display); font-size: 14px; box-shadow: 3px 3px 0 var(--blue-deep); }
.step h3 { font-size: 11px; text-transform: uppercase; }
.step p { color: var(--muted); font-size: 20px; }

/* Leaderboard */
.board { width: 100%; border-collapse: collapse; border: 3px solid var(--line); background: var(--panel); }
.board th, .board td { text-align: left; padding: 12px 14px; border-top: 1px solid var(--line); font-size: 20px; }
.board th { background: var(--bg); color: var(--muted); font-family: var(--label); font-weight: 400; text-transform: uppercase; letter-spacing: 1px; font-size: 12px; border-top: 0; }
.board td:first-child { color: var(--yellow); font-family: var(--display); font-size: 11px; }
.board td:last-child { font-family: var(--display); font-size: 11px; }
.board.is-empty { display: none; }
.board__empty { color: var(--dim); font-family: var(--display); font-size: 11px; padding: 24px; border: 3px dashed var(--line); text-align: center; }
.board__empty[hidden] { display: none; }

/* Token */
.token { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-bottom: 28px; }
.panel { background: var(--panel); border: 3px solid var(--line); padding: 20px; }
.panel h3 { font-size: 11px; text-transform: uppercase; margin-bottom: 14px; }
.panel li { color: var(--muted); font-size: 20px; padding: 6px 0; border-top: 1px dashed var(--line); }
.panel li:first-child { border-top: 0; }
.panel code { font-family: var(--label); font-size: 15px; color: var(--white); word-break: break-all; }

.socials { display: flex; flex-wrap: wrap; gap: 18px; }

.footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px;
  max-width: 1040px; margin: 0 auto; padding: 32px 24px 48px;
  border-top: 3px dashed var(--line); color: var(--dim); font-family: var(--label); font-size: 13px; text-transform: uppercase; letter-spacing: 1px;
}

/* Game modal */
.modal {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  padding: 12px; background: rgba(3,5,10,0.92); overflow-y: auto;
}
.modal[hidden] { display: none; }
.cabinet {
  display: flex; flex-direction: column; width: min(100%, 520px); max-height: 100%;
  background: var(--panel); border: 4px solid var(--blue); box-shadow: 10px 10px 0 var(--blue-deep);
}
.cabinet__top { display: flex; align-items: center; gap: 14px; padding: 8px 8px 8px 14px; border-bottom: 3px solid var(--line); font-family: var(--display); font-size: 10px; text-transform: uppercase; }
.cabinet__title { flex: 1; }
.cabinet__score b { color: var(--yellow); font-weight: 400; }
.cabinet__close { flex: 0 0 auto; width: 44px; height: 44px; background: var(--pink); color: var(--white); border: 0; font-family: var(--display); font-size: 12px; box-shadow: 3px 3px 0 #7a0f2b; }
.cabinet__screen { position: relative; background: var(--bg); padding: 10px; min-height: 0; flex: 1 1 auto; display: flex; align-items: center; justify-content: center; }
#game-canvas {
  display: block; width: min(100%, calc((100dvh - 190px) * 0.75)); height: auto; aspect-ratio: 3 / 4; margin: 0 auto;
  image-rendering: pixelated; image-rendering: crisp-edges; background: #0a0e18; border: 2px solid var(--line);
  touch-action: none; outline: none;
}
.overlay {
  position: absolute; inset: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: rgba(11,15,26,0.84); text-align: center; padding: 20px;
}
.overlay[hidden] { display: none; }
.overlay__big { font-family: var(--display); font-size: 18px; color: var(--yellow); text-shadow: 3px 3px 0 var(--yellow-dark); }
.overlay__small { color: var(--muted); font-size: 20px; }
.overlay__row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.overlay__row[hidden] { display: none; }
.cabinet__bottom { padding: 8px 14px; border-top: 3px solid var(--line); color: var(--muted); font-family: var(--label); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; text-align: center; }

@media (max-width: 860px) {
  .grid, .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  :root { --nav-h: 52px; }
  .scanlines { display: none; }               /* moiré on retina phones */
  .nav { padding: 0 14px; gap: 10px; }
  .nav__logo img { height: 26px; }
  .nav__links { display: none; }
  .nav .btn { min-height: 36px; padding: 6px 12px; font-size: 9px; box-shadow: 3px 3px 0 var(--blue-deep); }
  .hero { padding: 36px 16px 32px; gap: 16px; }
  .hero__logo { width: 82vw; }
  .hero__insert { font-size: 10px; }
  .hero__title { text-shadow: 3px 3px 0 var(--blue-deep); }
  .hero__sub { font-size: 21px; }
  .hero__cta { gap: 12px; width: 100%; }
  .hero__cta .btn { flex: 1 1 140px; }
  .btn--lg { padding: 14px 16px; font-size: 11px; }
  .stats { gap: 8px; }
  .stats > div { flex: 1 1 100px; padding: 10px; }
  .stats dt { font-size: 11px; }
  .stats dd { font-size: 13px; }
  .section { padding: 36px 16px; }
  .section__title { margin-bottom: 20px; }
  .grid, .steps, .token { grid-template-columns: 1fr; gap: 16px; }
  .cab { padding: 12px; box-shadow: 5px 5px 0 var(--blue-deep); }
  .cab--soon { box-shadow: 5px 5px 0 #05070d; }
  .cab__screen { aspect-ratio: 15 / 6; }
  .board th, .board td { padding: 10px; }
  .board th:nth-child(3), .board td:nth-child(3) { display: none; }
  .footer { padding: 24px 16px 40px; flex-direction: column; }
  .modal { padding: 0; align-items: stretch; }
  .cabinet { width: 100%; max-height: none; min-height: 100dvh; border-width: 0; box-shadow: none; }
  #game-canvas { width: min(100%, calc((100dvh - 130px) * 0.75)); }
}
