:root {
  --bg: #05050a;
  --bg-2: #0d0c18;
  --card: #13121f;
  --line: rgba(255, 255, 255, .1);
  --text: #f5f5f7;
  --muted: #a1a1b3;
  --pink: #ff2d78;
  --cyan: #22d3ee;
  --gold: #facc15;
  --green: #4ade80;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, Consolas, "Courier New", monospace;
  --radius: 24px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* Nav */
.nav { position: fixed; inset: 0 0 auto; z-index: 50; background: rgba(5, 5, 10, .72); backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px); border-bottom: 1px solid var(--line); }
.nav-in { max-width: 1120px; margin: auto; height: 52px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { font-weight: 700; letter-spacing: -.02em; text-decoration: none; font-size: 17px; white-space: nowrap; }
.brand span { background: linear-gradient(90deg, var(--pink), var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav-links { display: flex; gap: 22px; align-items: center; font-size: 13px; }
.nav-links a { text-decoration: none; color: #d5d5de; }
.nav-links a:hover { color: #fff; }
.btn { display: inline-block; border: 0; border-radius: 999px; padding: 12px 24px; font-weight: 600; font-size: 16px; text-decoration: none; background: #fff; color: #000; transition: transform .15s, background .15s; }
.btn:hover { transform: scale(1.03); }
.btn.sm { padding: 6px 14px; font-size: 13px; color: #000 !important; }
.btn.ghost { background: rgba(255, 255, 255, .1); color: #fff; }
.btn.ghost:hover { background: rgba(255, 255, 255, .18); }

/* Pinned 3D story */
.story { height: 460vh; position: relative; }
.story-sticky { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; background: radial-gradient(ellipse at 50% 60%, #1c1240, var(--bg) 70%); }
#hero3d { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.no-webgl #hero3d { display: none; }
.beat { position: absolute; left: 0; right: 0; padding: 0 16px; text-align: center; pointer-events: none; opacity: 0; will-change: opacity, transform; text-shadow: 0 2px 30px rgba(0, 0, 0, .7); }
.beat.intro { opacity: 1; }
.beat.top { top: 84px; }
.beat.bottom { bottom: 5vh; }
.beat.top .display { font-size: clamp(38px, 6.4vw, 76px); }
.beat.left { text-align: left; left: max(16px, 8vw); right: auto; max-width: 480px; top: 34vh; padding: 0; }
.beat.right { text-align: left; right: max(16px, 8vw); left: auto; max-width: 480px; top: 34vh; padding: 0; }
.beat a { pointer-events: auto; }
.eyebrow { font-family: var(--mono); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--cyan); margin: 0 0 12px; }
.display { font-size: clamp(42px, 8vw, 92px); line-height: 1.04; letter-spacing: -.035em; font-weight: 700; margin: 0; }
.h2 { font-size: clamp(32px, 5.2vw, 60px); line-height: 1.07; letter-spacing: -.03em; font-weight: 700; margin: 0; }
.lede { font-size: clamp(18px, 2.2vw, 24px); color: #c9c9d6; margin: 16px auto 0; max-width: 620px; letter-spacing: -.01em; }
.beat.left .lede, .beat.right .lede { margin-left: 0; }
.grad { background: linear-gradient(95deg, var(--pink), #b26bff 50%, var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.story-fade { position: absolute; inset: 0; background: var(--bg); opacity: 0; pointer-events: none; }
.cta-row { display: flex; gap: 12px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }

/* Sections */
.section { padding: 96px 16px; }
.wrap { max-width: 1120px; margin: auto; }
.center { text-align: center; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 48px; perspective: 1400px; }
.card { position: relative; display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden; background: var(--card); border: 1px solid var(--line); text-decoration: none; transform-style: preserve-3d; transition: transform .25s ease-out, box-shadow .25s, border-color .25s; will-change: transform; }
.card:hover { box-shadow: 0 30px 60px -20px rgba(178, 107, 255, .35); border-color: rgba(255, 255, 255, .24); }
.card-art { aspect-ratio: 40 / 26; overflow: hidden; }
.card-art svg { width: 100%; height: 100%; }
.card-body { padding: 18px 20px 20px; }
.card-body h3 { margin: 0; font-size: 21px; letter-spacing: -.02em; }
.card-body p { margin: 6px 0 12px; color: var(--muted); font-size: 15px; }
.tag { font-family: var(--mono); font-size: 12px; color: var(--cyan); letter-spacing: .06em; }
.bento { display: grid; grid-template-columns: repeat(6, 1fr); gap: 20px; margin-top: 48px; }
.tile { grid-column: span 2; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; min-height: 200px; }
.tile.wide { grid-column: span 3; }
.tile b { display: block; font-size: 40px; letter-spacing: -.03em; line-height: 1.1; margin-bottom: 8px; }
.tile h3 { font-size: 22px; letter-spacing: -.02em; margin: 0 0 8px; }
.tile p { margin: 0; color: var(--muted); }
.faq { max-width: 760px; margin: 40px auto 0; }
.faq details { border-bottom: 1px solid var(--line); padding: 18px 0; }
.faq summary { font-weight: 600; font-size: 18px; cursor: pointer; }
.faq p { color: var(--muted); margin: 10px 0 0; }

/* Ads: hidden until an AdSense client is configured and consent given */
.ad-slot { display: none; max-width: 970px; margin: 32px auto; text-align: center; }
.ad-slot.on { display: block; }
.ad-slot small { display: block; color: var(--muted); font-size: 11px; margin-bottom: 4px; }

/* Footer */
.footer { border-top: 1px solid var(--line); padding: 36px 16px 44px; color: var(--muted); font-size: 13px; }
.footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.footer nav { display: flex; gap: 18px; flex-wrap: wrap; }
.footer a { text-decoration: none; }
.footer a:hover { color: #fff; }

/* Consent */
.consent { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 60; max-width: 560px; margin: auto; padding: 16px 18px; background: #1a1830; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 20px 50px rgba(0, 0, 0, .6); font-size: 14px; }
.consent p { margin: 0 0 12px; color: #d5d5de; }
.consent div { display: flex; gap: 8px; flex-wrap: wrap; }
.consent .btn { font-size: 14px; padding: 8px 16px; }

/* Text pages */
.prose { max-width: 720px; margin: auto; padding: 110px 16px 72px; }
.prose h1 { font-size: clamp(34px, 6vw, 52px); letter-spacing: -.03em; line-height: 1.1; margin: 0 0 16px; }
.prose h2 { font-size: 22px; letter-spacing: -.02em; margin: 32px 0 8px; }
.prose p, .prose li { color: #c9c9d6; }
.prose a { color: var(--cyan); }

/* Game pages */
.game-main { padding: 68px 16px 24px; max-width: 1000px; margin: auto; }
.game-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.game-head h1 { font-size: 22px; letter-spacing: -.02em; margin: 0; }
.hud { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 3px 10px; font-size: 12px; color: var(--muted); font-family: var(--mono); min-width: 58px; text-align: center; }
.stat b { display: block; color: #fff; font-size: 15px; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: #fff; font-size: 16px; }
.icon-btn:hover { background: #211f36; }
.stage { --ratio: 1; position: relative; margin: 0 auto; width: min(100%, calc((100vh - 150px) * var(--ratio))); width: min(100%, calc((100svh - 150px) * var(--ratio))); min-width: min(100%, 300px); aspect-ratio: var(--ratio); border-radius: 18px; overflow: hidden; background: #0a0914; border: 1px solid var(--line); touch-action: none; user-select: none; -webkit-user-select: none; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage:fullscreen { width: 100vw; height: 100vh; aspect-ratio: auto; border-radius: 0; border: 0; display: flex; align-items: center; justify-content: center; }
.stage:fullscreen canvas { position: static; height: 100%; width: auto; aspect-ratio: var(--ratio); }
.overlay { position: absolute; inset: 0; z-index: 5; display: none; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 20px; background: rgba(6, 5, 16, .82); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
.overlay.on { display: flex; }
.overlay h2 { margin: 0; font-size: clamp(26px, 6vw, 40px); letter-spacing: -.03em; }
.overlay p { margin: 0; color: #c9c9d6; max-width: 400px; }
.opt-label { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 6px; }
.opts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.opt { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, .06); color: #fff; font-size: 14px; }
.opt.sel { background: #fff; color: #000; }
.overlay .btn { margin-top: 8px; }
.dpad { display: none; grid-template-columns: repeat(3, 64px); grid-template-rows: repeat(2, 56px); gap: 6px; justify-content: center; margin: 12px auto 0; touch-action: none; }
.dpad button { border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: #fff; font-size: 20px; }
.dpad button:nth-child(1) { grid-column: 2; }
.dpad button:nth-child(2) { grid-column: 1; grid-row: 2; }
.dpad button:nth-child(3) { grid-column: 2; grid-row: 2; }
.dpad button:nth-child(4) { grid-column: 3; grid-row: 2; }
@media (pointer: coarse) { .dpad.want { display: grid; } }
.game-info { max-width: 720px; margin: 40px auto 0; }
.game-info h2 { font-size: 24px; letter-spacing: -.02em; margin: 28px 0 8px; }
.game-info p, .game-info li { color: #c9c9d6; }
.more { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.more a { padding: 12px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); text-decoration: none; font-size: 14px; }
.more a:hover { border-color: rgba(255, 255, 255, .3); }

/* Comments and suggestions */
#comments { margin-top: 12px; }
.msg-form { display: grid; gap: 12px; margin: 16px 0 24px; max-width: 620px; justify-items: start; }
.msg-form label { display: grid; gap: 4px; width: 100%; font-size: 14px; color: var(--muted); }
.msg-form input, .msg-form textarea { width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; resize: vertical; }
.msg-form .hp { position: absolute; left: -9999px; }
.msg-form button:disabled { opacity: .5; cursor: default; }
.form-hint { color: var(--muted); font-size: 12px; }
.form-note { margin: 0; min-height: 1.4em; font-size: 14px; color: var(--muted); }
.form-note.good { color: var(--green); }
.form-note.bad { color: #ff7a9c; }
.comment { padding: 14px 0; border-top: 1px solid var(--line); }
.comment small { color: var(--muted); margin-left: 8px; }
.comment p { margin: 4px 0 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.comment-empty { color: var(--muted); }

/* Memory cards */
.mem-grid { position: absolute; inset: 12px; display: grid; gap: 8px; perspective: 900px; }
.mem { border: 0; padding: 0; background: none; transform-style: preserve-3d; transition: transform .35s; position: relative; }
.mem.up { transform: rotateY(180deg); }
.mem i { position: absolute; inset: 0; border-radius: 10px; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; align-items: center; justify-content: center; font-style: normal; }
.mem .back { background: linear-gradient(135deg, #3a1a6e, #122a55); border: 1px solid var(--line); color: rgba(255, 255, 255, .35); font-family: var(--mono); font-size: 13px; }
.mem .front { background: #f5f5fb; transform: rotateY(180deg); font-size: clamp(22px, 6vmin, 44px); }
.mem.done .front { background: #bbf7d0; }

@media (max-width: 860px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .tile, .tile.wide { grid-column: span 6; min-height: 0; }
  .beat.left, .beat.right { left: 16px; right: 16px; top: auto; bottom: 8vh; max-width: none; }
}
@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
  .nav-links a:not(.btn) { display: none; }
  .section { padding: 72px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card, .btn, .mem { transition: none; }
}
