:root {
  --bg: #0d0b1a;
  --bg2: #16122b;
  --panel: #1d1838;
  --line: #2e2758;
  --text: #ece9ff;
  --muted: #9a93c7;
  --pink: #ff4fa3;
  --cyan: #3ef0e0;
  --yellow: #ffd23f;
  --green: #7cff6b;
  --pixel: "Press Start 2P", monospace;
  --body: "Nunito", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(1200px 600px at 50% -200px, #2a1d5c 0%, transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: var(--body);
  min-height: 100vh;
}
a { color: var(--cyan); }

/* CRT scanlines */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,0.12) 0 1px, transparent 1px 3px);
  z-index: 50;
}

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

header.site {
  padding: 40px 0 24px;
  text-align: center;
}
.logo {
  font-family: var(--pixel);
  font-size: clamp(22px, 5vw, 44px);
  letter-spacing: 2px;
  margin: 0;
  color: var(--yellow);
  text-shadow: 3px 3px 0 var(--pink), 6px 6px 0 #5b2a86;
}
.logo a { color: inherit; text-decoration: none; }
.tagline { color: var(--muted); margin: 18px 0 0; font-size: 17px; }

.toolbar {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
  margin: 8px 0 28px;
}
.chip {
  font-family: var(--pixel); font-size: 10px;
  padding: 10px 12px; border-radius: 6px;
  border: 2px solid var(--line); background: var(--panel); color: var(--muted);
  cursor: pointer;
}
.chip[aria-pressed="true"] { border-color: var(--cyan); color: var(--cyan); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  padding-bottom: 60px;
}
.card {
  position: relative;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  display: flex; flex-direction: column;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
a.card:hover, a.card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--cyan);
  box-shadow: 0 8px 0 #000, 0 0 24px rgba(62,240,224,.25);
  outline: none;
}
.card .thumb { aspect-ratio: 16 / 9; display: block; width: 100%; background: #000; }
.card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card h2 { font-family: var(--pixel); font-size: 13px; margin: 0; line-height: 1.5; }
.card p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.4; flex: 1; }
.meta { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.tag {
  font-family: var(--pixel); font-size: 8px; padding: 5px 7px; border-radius: 4px;
  background: var(--bg2); color: var(--cyan); border: 1px solid var(--line);
}
.best { color: var(--yellow); font-weight: 700; }
.card.soon { opacity: .55; }
.card.soon .thumb { filter: grayscale(.8); }
.ribbon {
  position: absolute; top: 12px; right: -34px; transform: rotate(35deg);
  background: var(--pink); color: #fff; font-family: var(--pixel); font-size: 8px;
  padding: 6px 40px;
}
.card.new .ribbon { background: var(--green); color: #0d0b1a; }

footer.site {
  text-align: center; color: var(--muted); font-size: 13px; padding: 24px 0 40px;
  border-top: 2px solid var(--line);
}

/* Game page */
.game-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 0; flex-wrap: wrap;
}
.back {
  font-family: var(--pixel); font-size: 10px; text-decoration: none;
  color: var(--muted); border: 2px solid var(--line); padding: 10px 12px; border-radius: 6px;
}
.back:hover { color: var(--cyan); border-color: var(--cyan); }
.game-title { font-family: var(--pixel); font-size: clamp(14px, 3vw, 22px); color: var(--yellow); margin: 0; text-shadow: 2px 2px 0 var(--pink); }
.stage {
  position: relative;
  border: 3px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 0 0 6px var(--bg2), 0 0 40px rgba(255,79,163,.15);
  touch-action: none;
  user-select: none; -webkit-user-select: none;
}
.stage canvas { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; }
.icon-btn {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 36px; height: 36px; border-radius: 6px;
  border: 2px solid rgba(255,255,255,.25); background: rgba(0,0,0,.4); color: #fff;
  font-size: 16px; cursor: pointer;
}
.howto {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px;
  margin: 24px 0 48px;
}
.howto div { background: var(--panel); border: 2px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.howto h3 { font-family: var(--pixel); font-size: 10px; color: var(--cyan); margin: 0 0 10px; }
.howto p { margin: 0; color: var(--muted); line-height: 1.5; }
kbd {
  font-family: var(--pixel); font-size: 9px; background: var(--bg2); border: 1px solid var(--line);
  border-bottom-width: 3px; border-radius: 4px; padding: 3px 6px; color: var(--text);
}
