/* ---------- tokens ---------- */
:root {
  --bg: #07070d;
  --bg-2: #0e0e18;
  --panel: #12121f;
  --line: #23233a;
  --text: #e8e8f0;
  --muted: #8d8da6;
  --cyan: #4fd8ff;
  --magenta: #ff4fd8;
  --yellow: #ffcc33;
  --green: #7cff4f;
  --font-pixel: 'Press Start 2P', 'Courier New', monospace;
  --font-body: 'VT323', 'Courier New', monospace;
  --gutter: 16px;
  --max: 1180px;
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font-body);
  font-size: 22px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* subtle CRT scanlines over the whole page */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 9; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,.18) 0, rgba(0,0,0,.18) 1px, transparent 1px, transparent 3px);
  mix-blend-mode: multiply;
}
a { color: var(--cyan); text-decoration: none; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--yellow); outline-offset: 3px; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.sr { position: absolute; left: -9999px; }

/* ---------- header ---------- */
.site-head {
  position: sticky; top: 0; z-index: 20;
  background: rgba(7,7,13,.9);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.site-head .wrap { display: flex; align-items: center; gap: 18px; height: 60px; }
.logo { display: flex; align-items: center; gap: 12px; color: var(--text); font-family: var(--font-pixel); font-size: 13px; letter-spacing: 1px; }
.logo svg { width: 28px; height: 28px; image-rendering: pixelated; }
.logo b { color: var(--magenta); }
.site-head nav { margin-left: auto; display: flex; gap: 22px; font-size: 20px; text-transform: uppercase; letter-spacing: 1px; }
.site-head nav a { color: var(--muted); }
.site-head nav a:hover { color: var(--text); }

/* ---------- hero ---------- */
.hero { padding: 64px 0 40px; position: relative; overflow: hidden; }
.hero::after {
  content: ""; position: absolute; inset: auto -20% -60% -20%; height: 70%; z-index: -1;
  background: radial-gradient(ellipse at center, rgba(255,79,216,.18), transparent 60%);
}
.hero h1 {
  font-family: var(--font-pixel);
  font-size: clamp(22px, 4.6vw, 44px);
  line-height: 1.5;
  margin: 0 0 18px;
  text-shadow: 3px 3px 0 #3b0f3b, 0 0 22px rgba(255,79,216,.35);
}
.hero h1 span { color: var(--cyan); text-shadow: 3px 3px 0 #0f2f3b, 0 0 22px rgba(79,216,255,.35); }
.hero p { max-width: 640px; font-size: 24px; color: var(--muted); margin: 0 0 28px; }
.hero .cta { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.stats { display: flex; flex-wrap: wrap; gap: 28px; margin-top: 36px; font-size: 20px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.stats b { display: block; color: var(--yellow); font-family: var(--font-pixel); font-size: 18px; margin-bottom: 6px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--font-pixel); font-size: 12px; letter-spacing: 1px; text-transform: uppercase;
  padding: 14px 20px; border: 2px solid var(--text); color: var(--text); background: transparent;
  cursor: pointer; box-shadow: 4px 4px 0 var(--line); transition: transform .08s, box-shadow .08s;
  user-select: none;
}
.btn:hover { transform: translate(-1px,-1px); box-shadow: 5px 5px 0 var(--line); }
.btn:active { transform: translate(3px,3px); box-shadow: 1px 1px 0 var(--line); }
.btn.primary { background: var(--magenta); border-color: var(--magenta); color: #130313; box-shadow: 4px 4px 0 #7a1f6b; }
.btn.primary:hover { box-shadow: 5px 5px 0 #7a1f6b; }
.btn.primary:active { box-shadow: 1px 1px 0 #7a1f6b; }
.blink { animation: blink 1.1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }

/* ---------- filters ---------- */
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 16px 28px; margin: 36px 0 18px; }
.section-head h2 { font-family: var(--font-pixel); font-size: 16px; margin: 0; color: var(--yellow); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: var(--font-body); font-size: 19px; text-transform: uppercase; letter-spacing: 1px;
  padding: 4px 12px; border: 1px solid var(--line); background: var(--bg-2); color: var(--muted); cursor: pointer;
}
.chip:hover { color: var(--text); border-color: var(--muted); }
.chip[aria-pressed="true"] { color: #07070d; background: var(--cyan); border-color: var(--cyan); }

/* ---------- game grid ---------- */
.grid {
  display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  padding-bottom: 60px;
}
.card {
  --accent: var(--cyan);
  position: relative; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line);
  transition: transform .12s, border-color .12s, box-shadow .12s;
}
.card:hover, .card:focus-within { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 12px 40px -12px var(--accent); }
.card.hidden { display: none; }
.thumb { position: relative; aspect-ratio: 16 / 9; background: #000; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; image-rendering: pixelated; }
.thumb::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 62%, rgba(0,0,0,.45) 100%);
}
.thumb .tag {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  font-family: var(--font-pixel); font-size: 9px; letter-spacing: 1px; text-transform: uppercase;
  padding: 6px 8px; background: rgba(0,0,0,.75); color: var(--accent); border: 1px solid var(--accent);
}
.thumb .touch {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  font-size: 16px; padding: 3px 8px; background: rgba(0,0,0,.7); color: var(--muted); border: 1px solid var(--line);
  text-transform: uppercase; letter-spacing: 1px;
}
.card .body { padding: 16px 16px 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card h3 { font-family: var(--font-pixel); font-size: 13px; margin: 0; line-height: 1.6; color: var(--text); }
.card h3 a { color: inherit; }
.card h3 a::after { content: ""; position: absolute; inset: 0; } /* whole card is clickable */
.card p { margin: 0; color: var(--muted); font-size: 20px; }
.card .controls { font-size: 17px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 10px; letter-spacing: .5px; }
.card .foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 6px; }
.card .best { font-size: 18px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.card .best b { color: var(--yellow); font-family: var(--font-pixel); font-size: 11px; }
.card .play { font-family: var(--font-pixel); font-size: 11px; color: var(--accent); letter-spacing: 1px; }
.card:hover .play { animation: blink 1.1s steps(2, start) infinite; }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }

/* ---------- about ---------- */
.about { border-top: 1px solid var(--line); padding: 56px 0 40px; }
.about .cols { display: grid; gap: 28px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.about h2 { font-family: var(--font-pixel); font-size: 16px; color: var(--yellow); margin: 0 0 20px; }
.about h3 { font-family: var(--font-pixel); font-size: 11px; color: var(--cyan); margin: 0 0 10px; line-height: 1.6; }
.about p { margin: 0; color: var(--muted); }

/* ---------- footer ---------- */
.site-foot { border-top: 1px solid var(--line); padding: 26px 0 40px; color: var(--muted); font-size: 18px; display: flex; flex-wrap: wrap; gap: 10px 24px; }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 10px 24px; width: 100%; }
.site-foot a { color: var(--muted); }
.site-foot a:hover { color: var(--text); }
.site-foot .right { margin-left: auto; }

/* ---------- play page ---------- */
.play-body { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.play-bar {
  flex: none; display: flex; align-items: center; gap: 14px; height: 48px; padding: 0 12px;
  background: var(--bg-2); border-bottom: 1px solid var(--line); font-size: 19px;
}
.play-bar .back { font-family: var(--font-pixel); font-size: 10px; color: var(--muted); white-space: nowrap; }
.play-bar .back:hover { color: var(--text); }
.play-bar .title { font-family: var(--font-pixel); font-size: 12px; color: var(--yellow); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.play-bar .hint { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; letter-spacing: .5px; }
.play-bar .tools { margin-left: auto; display: flex; gap: 8px; }
.play-bar button, .play-bar .ibtn {
  font-family: var(--font-body); font-size: 18px; text-transform: uppercase; letter-spacing: 1px;
  padding: 4px 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer;
}
.play-bar button:hover { border-color: var(--muted); }
.stage { flex: 1; position: relative; background: #000; }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: #000; }
.stage .focus-hint {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  background: rgba(0,0,0,.75); border: 1px solid var(--line); color: var(--muted); padding: 4px 12px; font-size: 18px;
  pointer-events: none; opacity: 0; transition: opacity .2s;
}
.stage.unfocused .focus-hint { opacity: 1; }

@media (max-width: 640px) {
  body { font-size: 20px; }
  .site-head nav { display: none; }
  .hero { padding: 40px 0 28px; }
  .play-bar .hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .blink, .card:hover .play { animation: none; }
  html { scroll-behavior: auto; }
}
