:root {
  --bg: #07070f;
  --bg2: #0d0e1c;
  --panel: rgba(20, 22, 44, 0.72);
  --line: rgba(255, 255, 255, 0.08);
  --line2: rgba(255, 255, 255, 0.16);
  --text: #eef0ff;
  --muted: #8f94b3;
  --accent: #f9c74f;
  --pink: #ff4fa3;
  --cyan: #4cc9f0;
  --lime: #9ef01a;
  --pix: "Press Start 2P", "Courier New", monospace;
  --sans: "Space Grotesk", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); }
body { overflow-x: hidden; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- background */
#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.blobs { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; filter: blur(70px) saturate(1.2); opacity: 0.55; }
.blobs i { position: absolute; width: 46vw; height: 46vw; border-radius: 50%; mix-blend-mode: screen; animation: blob 26s ease-in-out infinite alternate; }
.blobs i:nth-child(1) { left: -10vw; top: -10vw; background: radial-gradient(circle, #ff4fa3, transparent 62%); }
.blobs i:nth-child(2) { right: -12vw; top: 10vh; background: radial-gradient(circle, #4cc9f0, transparent 62%); animation-delay: -8s; animation-duration: 32s; }
.blobs i:nth-child(3) { left: 30vw; bottom: -20vw; background: radial-gradient(circle, #f9c74f, transparent 62%); animation-delay: -15s; animation-duration: 38s; }
@keyframes blob { from { transform: translate(0, 0) scale(1); } to { transform: translate(8vw, 6vh) scale(1.18); } }

header.top, .hero, .marquee, .games, .make, footer { position: relative; z-index: 1; }

/* ---------------------------------------------------------------- header */
header.top { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; padding: 14px 28px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); background: linear-gradient(to bottom, rgba(7,7,15,0.85), rgba(7,7,15,0.55)); border-bottom: 1px solid var(--line); z-index: 20; }
.brand { font-family: var(--pix); font-size: 13px; letter-spacing: 1px; display: flex; align-items: baseline; gap: 2px; }
.brand .px { color: #fff; }
.brand .px.alt { color: var(--accent); }
.brand .tld { font-family: var(--sans); font-weight: 700; color: var(--muted); margin-left: 4px; font-size: 14px; }
header nav { display: flex; align-items: center; gap: 18px; font-weight: 500; font-size: 15px; }
header nav a { color: #c9cce6; position: relative; }
header nav a::after { content: ""; position: absolute; left: 0; right: 100%; bottom: -4px; height: 2px; background: var(--accent); transition: right .2s; }
header nav a:hover { color: #fff; }
header nav a:hover::after { right: 0; }

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 999px; border: 1px solid var(--line2); background: rgba(255,255,255,0.05); color: #fff; font: 600 15px var(--sans); cursor: pointer; transition: transform .15s, background .15s, box-shadow .15s, border-color .15s; }
.btn:hover { transform: translateY(-2px); background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.3); }
.btn:active { transform: translateY(0); }
.btn.primary { background: linear-gradient(120deg, var(--accent), #ff9f43); color: #1a1200; border-color: transparent; box-shadow: 0 10px 30px -10px rgba(249,199,79,0.7); }
.btn.primary:hover { box-shadow: 0 14px 40px -10px rgba(249,199,79,0.9); background: linear-gradient(120deg, #ffd66b, #ffab5a); }
.btn.ghost { padding: 8px 14px; font-size: 14px; }

/* ---------------------------------------------------------------- hero */
.hero { min-height: calc(100vh - 62px); display: grid; place-items: center; padding: 60px 24px 40px; text-align: center; position: relative; overflow: hidden; }
.hero-inner { max-width: 900px; position: relative; z-index: 2; }
.kicker { font-family: var(--pix); font-size: 10px; letter-spacing: 1px; color: var(--muted); margin: 0 0 26px; display: inline-flex; gap: 10px; align-items: center; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: rgba(0,0,0,0.3); }
.kicker b { color: var(--lime); }
.live { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 0 rgba(158,240,26,0.7); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(158,240,26,0.7); } 70% { box-shadow: 0 0 0 10px rgba(158,240,26,0); } 100% { box-shadow: 0 0 0 0 rgba(158,240,26,0); } }

.title { font-family: var(--pix); font-size: clamp(30px, 7.2vw, 78px); line-height: 1.1; margin: 0 0 24px; letter-spacing: 2px; position: relative; }
.title .shine { position: relative; display: inline-block; background: linear-gradient(90deg, #fff 0%, #fff 35%, var(--accent) 50%, #fff 65%, #fff 100%); background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shine 5s linear infinite; }
.title .shine::before, .title .shine::after { content: attr(data-text); position: absolute; left: 0; top: 0; width: 100%; height: 100%; -webkit-background-clip: text; background-clip: text; color: transparent; opacity: 0; pointer-events: none; }
.title .shine::before { background: var(--pink); animation: glitchA 6s infinite; }
.title .shine::after { background: var(--cyan); animation: glitchB 6s infinite; }
@keyframes shine { to { background-position: -250% 0; } }
@keyframes glitchA { 0%, 91%, 100% { opacity: 0; transform: none; } 92% { opacity: .8; transform: translate(-4px, 2px); } 94% { opacity: .8; transform: translate(4px, -1px); } 96% { opacity: 0; } }
@keyframes glitchB { 0%, 91%, 100% { opacity: 0; transform: none; } 93% { opacity: .8; transform: translate(4px, -2px); } 95% { opacity: .8; transform: translate(-3px, 2px); } 97% { opacity: 0; } }
.title .tld2 { color: var(--muted); font-size: 0.42em; vertical-align: super; margin-left: 6px; }
.tag { font-size: clamp(16px, 2vw, 20px); color: #c9cce6; line-height: 1.55; margin: 0 auto 32px; max-width: 640px; }
.cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 44px; }
.stats { list-style: none; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 0; padding: 0; }
.stats li { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 22px; min-width: 120px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); backdrop-filter: blur(8px); }
.stats b { font-family: var(--pix); font-size: 20px; color: #fff; }
.stats span { font-size: 12px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); }

.orbit { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.orbit img { position: absolute; image-rendering: pixelated; image-rendering: crisp-edges; filter: drop-shadow(0 8px 18px rgba(0,0,0,0.6)); animation: float var(--dur, 9s) ease-in-out infinite alternate; opacity: 0.9; }
@keyframes float { from { transform: translate(0, 0) rotate(var(--r0, -4deg)); } to { transform: translate(var(--dx, 20px), var(--dy, -30px)) rotate(var(--r1, 6deg)); } }

.scroll-hint { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); width: 26px; height: 42px; border: 2px solid var(--line2); border-radius: 14px; z-index: 2; }
.scroll-hint span { position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; margin-left: -2px; border-radius: 2px; background: var(--accent); animation: wheel 1.6s infinite; }
@keyframes wheel { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(16px); opacity: 0; } }

/* ---------------------------------------------------------------- marquee */
.marquee { overflow: hidden; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: rgba(0,0,0,0.35); padding: 12px 0; -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); }
.marquee .track { display: inline-flex; gap: 40px; white-space: nowrap; font-family: var(--pix); font-size: 11px; color: var(--muted); animation: marquee 48s linear infinite; will-change: transform; }
.marquee:hover .track { animation-play-state: paused; }
.marquee .track span b { color: #fff; }
.marquee .track span i { color: var(--accent); font-style: normal; margin: 0 10px; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------------------------------------------------------------- games grid */
.games { padding: 70px 28px 40px; max-width: 1400px; margin: 0 auto; }
.toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.search { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line2); background: rgba(0,0,0,0.3); color: var(--muted); }
.search input { background: none; border: 0; outline: 0; color: #fff; font: 500 14px var(--sans); width: 180px; }
.search input::placeholder { color: var(--muted); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 22px; grid-auto-flow: dense; }
.card { --accent: #f9c74f; --rx: 0deg; --ry: 0deg; position: relative; display: flex; flex-direction: column; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); overflow: hidden; transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry)); transition: transform .18s ease-out, box-shadow .25s, border-color .25s; backdrop-filter: blur(8px); will-change: transform; }
.card::before { content: ""; position: absolute; inset: -1px; border-radius: 19px; padding: 1px; background: linear-gradient(135deg, var(--accent), transparent 40%, transparent 60%, var(--accent)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; opacity: 0; transition: opacity .25s; pointer-events: none; }
.card:hover { box-shadow: 0 30px 60px -20px rgba(0,0,0,0.9), 0 0 0 1px var(--accent), 0 0 50px -12px var(--accent); border-color: transparent; z-index: 2; }
.card:hover::before { opacity: 1; }
.card.big { grid-column: span 2; grid-row: span 2; }
.card.big .preview { aspect-ratio: 16 / 10; }
.card.big h3 { font-size: 16px; }

.preview { position: relative; aspect-ratio: 16 / 10; background: #000; overflow: hidden; }
.preview canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; image-rendering: crisp-edges; pointer-events: none; transition: transform .5s ease, filter .3s; filter: saturate(0.92) brightness(0.92); }
.card:hover .preview canvas { transform: scale(1.04); filter: saturate(1.1) brightness(1); }
.preview.contain canvas { object-fit: contain; }
.preview .scan { position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(to bottom, rgba(0,0,0,0.13) 0 1px, transparent 1px 3px); mix-blend-mode: multiply; opacity: .45; }
.preview::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(7,7,15,0.7), transparent 45%); pointer-events: none; }
.badge { position: absolute; top: 10px; font-family: var(--pix); font-size: 9px; padding: 6px 8px; border-radius: 6px; z-index: 2; letter-spacing: 1px; }
.badge.new { left: 10px; background: var(--lime); color: #0b1500; box-shadow: 0 0 18px rgba(158,240,26,0.6); animation: bump 1.4s ease-in-out infinite; }
@keyframes bump { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.badge.lv { right: 10px; background: rgba(0,0,0,0.6); color: #fff; border: 1px solid var(--line2); }
.play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(0.8); font-family: var(--pix); font-size: 12px; color: #000; background: #fff; padding: 12px 18px; border-radius: 999px; opacity: 0; transition: all .2s; z-index: 2; box-shadow: 0 10px 30px rgba(0,0,0,0.6); }
.card:hover .play { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.meta { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; }
.meta .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.meta .chip { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; font-weight: 700; color: var(--accent); }
.meta .sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta h3 { margin: 2px 0 0; font-family: var(--pix); font-size: 12px; line-height: 1.5; color: #fff; }
.meta p { margin: 0; font-size: 13.5px; line-height: 1.45; color: #b7bbd6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.empty { text-align: center; color: var(--muted); padding: 60px 0; }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
.card.reveal.in { transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry)); }

/* ---------------------------------------------------------------- make */
.make { padding: 60px 28px 90px; max-width: 1100px; margin: 0 auto; }
.make-inner { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; padding: 40px; border-radius: 24px; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(10px); }
.make h2 { font-size: clamp(24px, 3.4vw, 38px); line-height: 1.15; margin: 0 0 14px; }
.make h2 em { font-style: normal; background: linear-gradient(90deg, var(--accent), var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.make p { color: #c9cce6; line-height: 1.6; margin: 0 0 22px; }
.make-code { margin: 0; padding: 22px; border-radius: 16px; background: #05060c; border: 1px solid var(--line); font: 13px/1.6 ui-monospace, Menlo, Consolas, monospace; color: #d6e2ff; overflow: auto; box-shadow: inset 0 0 40px rgba(76,201,240,0.06); }
.make-code .k { color: var(--cyan); }
.make-code .s { color: var(--lime); }

footer { display: flex; justify-content: center; gap: 12px; padding: 30px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); background: rgba(0,0,0,0.3); }
footer a:hover { color: #fff; }

@media (max-width: 600px) {
  header nav a { display: none; }
  .btn.ghost { padding: 7px 12px; font-size: 13px; }
  .kicker .long { display: none; }
  .kicker { font-size: 9px; padding: 7px 12px; margin-bottom: 18px; }
  .hero { padding: 40px 18px 70px; min-height: auto; }
  .tag { font-size: 16px; }
  .stats li { min-width: 42%; padding: 12px 10px; }
  .stats b { font-size: 16px; }
  .orbit img { opacity: 0.35; }
  .orbit img:nth-child(n+7) { display: none; }
  .scroll-hint { display: none; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search input { width: 100%; }
  .search { width: 100%; }
  .grid { grid-template-columns: 1fr; }
  .make-inner { padding: 22px; }
  .make-code { font-size: 12px; padding: 16px; }
}
@media (max-width: 900px) {
  .make-inner { grid-template-columns: 1fr; }
  .card.big { grid-column: span 1; grid-row: span 1; }
  header.top { padding: 12px 16px; }
  header nav a:first-child { display: none; }
  .games { padding: 50px 16px 30px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
  .search input { width: 120px; }
  .orbit img { opacity: 0.5; }
}
@media (prefers-reduced-motion: reduce) {
  .blobs i, .title .shine, .marquee .track, .orbit img, .live, .badge.new { animation: none !important; }
  .reveal { opacity: 1; transform: none; }
}
