/* Pocket Apps Mobile — shared landing page system.
   Each app page sets the theme tokens on :root and adds its own hero demo. */

:root {
  --bg: #0b0d14;
  --bg-2: #121624;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.1);
  --text: #f4f6fb;
  --muted: #a3abc2;
  --accent: #7c5cff;
  --accent-2: #22d3ee;
  --on-accent: #0b0d14;
  --glow: rgba(124, 92, 255, 0.35);
  --font-display: 'Inter Tight', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --radius: 22px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --max: 1160px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 24px; }
@media (max-width: 600px) { .container { padding: 0 16px; } }

/* ---------- Nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  transition: background .3s, border-color .3s, backdrop-filter .3s;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-color: var(--border);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 16px; }
.nav-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.nav-home {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--muted);
  padding: 6px 10px; border-radius: 999px; border: 1px solid var(--border);
  transition: color .2s, border-color .2s;
  white-space: nowrap;
}
.nav-home:hover { color: var(--text); border-color: var(--text); }
.nav-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 18px; white-space: nowrap; }
.nav-brand img { width: 34px; height: 34px; border-radius: 10px; }
.nav-links { display: flex; align-items: center; gap: 26px; font-size: 14px; font-weight: 500; color: var(--muted); }
.nav-links a:hover { color: var(--text); }
.nav-cta {
  background: var(--accent); color: var(--on-accent);
  padding: 9px 18px; border-radius: 999px; font-weight: 700; font-size: 14px;
  transition: transform .2s var(--ease), box-shadow .2s;
  white-space: nowrap;
}
.nav-cta:hover { transform: translateY(-1px); box-shadow: 0 8px 24px var(--glow); }
@media (max-width: 760px) {
  .nav-links a:not(.nav-cta) { display: none; }
  .nav-home span { display: none; }
  .nav-brand { font-size: 16px; }
}

/* ---------- Hero ---------- */
.hero { position: relative; padding: 132px 0 88px; overflow: hidden; }
.hero-grid { position: relative; z-index: 1; display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 56px; align-items: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; letter-spacing: .02em;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  padding: 6px 14px; border-radius: 999px; margin-bottom: 22px;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(42px, 6.4vw, 80px); line-height: 1.02; letter-spacing: -0.02em;
  margin-bottom: 22px;
}
.hero h1 .accent { color: var(--accent); }
.hero-sub { font-size: clamp(17px, 1.6vw, 20px); color: var(--muted); max-width: 540px; margin-bottom: 32px; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 36px; }
.stats { display: flex; flex-wrap: wrap; gap: 28px; }
.stat strong { display: block; font-family: var(--font-display); font-size: 28px; line-height: 1.1; }
.stat span { font-size: 13px; color: var(--muted); }
@media (max-width: 900px) {
  .hero { padding: 108px 0 64px; }
  .hero-grid { grid-template-columns: 1fr; gap: 44px; }
}

/* ---------- Play badge ---------- */
.play-badge {
  display: inline-flex; align-items: center; gap: 12px;
  background: #000; color: #fff; border: 1px solid rgba(255,255,255,.25);
  padding: 10px 20px 10px 16px; border-radius: 14px;
  transition: transform .2s var(--ease), box-shadow .2s, border-color .2s;
}
.play-badge:hover { transform: translateY(-2px); border-color: rgba(255,255,255,.6); box-shadow: 0 12px 32px rgba(0,0,0,.4); }
.play-badge svg { width: 26px; height: 28px; flex: none; }
.play-badge small { display: block; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; opacity: .8; line-height: 1.2; }
.play-badge b { display: block; font-size: 19px; font-weight: 600; line-height: 1.2; font-family: var(--font-body); }
.soon-chip {
  font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent-2); border: 1px dashed color-mix(in srgb, var(--accent-2) 60%, transparent);
  padding: 6px 12px; border-radius: 999px;
}
.btn-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 22px; border-radius: 14px; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface);
  transition: background .2s, border-color .2s;
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--muted); }

/* ---------- Phone frame ---------- */
.device-wrap { position: relative; display: flex; justify-content: center; }
.device-wrap::before {
  content: ''; position: absolute; inset: 10% 5%; border-radius: 50%;
  background: radial-gradient(closest-side, var(--glow), transparent);
  filter: blur(30px); z-index: 0;
}
.device {
  position: relative; z-index: 1;
  width: min(340px, 82vw); aspect-ratio: 9 / 18.5;
  border-radius: 46px; padding: 12px;
  background: linear-gradient(160deg, #2a2d38, #0d0f15);
  box-shadow: 0 40px 80px rgba(0,0,0,.5), inset 0 0 0 1.5px rgba(255,255,255,.12);
}
.device-screen { position: relative; width: 100%; height: 100%; border-radius: 36px; overflow: hidden; background: #000; touch-action: none; user-select: none; -webkit-user-select: none; }
.device-screen canvas, .device-screen img { width: 100%; height: 100%; object-fit: cover; }
.device-notch { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); width: 92px; height: 24px; border-radius: 20px; background: #000; z-index: 3; }
.device-hint {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 3;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: rgba(0,0,0,.55); color: #fff; padding: 6px 12px; border-radius: 999px;
  backdrop-filter: blur(6px); pointer-events: none; transition: opacity .4s;
}
.device-hud {
  position: absolute; top: 46px; left: 0; right: 0; z-index: 3;
  display: flex; justify-content: space-between; padding: 0 20px;
  font-weight: 700; font-size: 14px; pointer-events: none;
}

/* ---------- Sections ---------- */
section { position: relative; }
.section { padding: 104px 0; }
.section-alt { background: var(--bg-2); }
.section-head { text-align: center; max-width: 680px; margin: 0 auto 56px; }
.label { font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: 12px; }
.section-head h2 { font-family: var(--font-display); font-size: clamp(32px, 4.2vw, 50px); line-height: 1.08; letter-spacing: -0.015em; margin-bottom: 16px; }
.section-head p { color: var(--muted); font-size: 18px; }
@media (max-width: 600px) { .section { padding: 72px 0; } .section-head { margin-bottom: 40px; } }

/* Steps */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; counter-reset: step; }
.step {
  position: relative; padding: 32px 28px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
}
.step::before {
  counter-increment: step; content: '0' counter(step);
  font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--accent);
  display: block; margin-bottom: 18px;
}
.step .ico { font-size: 34px; margin-bottom: 14px; line-height: 1; }
.step h3 { font-family: var(--font-display); font-size: 22px; margin-bottom: 8px; }
.step p { color: var(--muted); font-size: 15.5px; }
@media (max-width: 860px) { .steps { grid-template-columns: 1fr; } }

/* Feature grid */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.feature {
  padding: 28px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  transition: transform .35s var(--ease), border-color .3s, background .3s;
}
.feature:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 50%, transparent); background: var(--surface-2); }
.feature .ico {
  width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 24px;
  background: color-mix(in srgb, var(--accent) 16%, transparent); margin-bottom: 18px;
}
.feature h3 { font-family: var(--font-display); font-size: 19px; margin-bottom: 8px; }
.feature p { color: var(--muted); font-size: 15px; }
@media (max-width: 960px) { .features { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .features { grid-template-columns: 1fr; } }

/* Split showcase */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: center; }
.split h2 { font-family: var(--font-display); font-size: clamp(30px, 3.8vw, 46px); line-height: 1.1; margin-bottom: 18px; }
.split p { color: var(--muted); font-size: 17px; margin-bottom: 16px; }
.check { list-style: none; display: grid; gap: 12px; margin-top: 22px; }
.check li { display: flex; gap: 12px; align-items: flex-start; font-size: 16px; }
.check li::before {
  content: '✓'; flex: none; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 800;
  background: var(--accent); color: var(--on-accent); margin-top: 1px;
}
@media (max-width: 900px) { .split { grid-template-columns: 1fr; gap: 40px; } .split.reverse > :first-child { order: 2; } }

/* Chips list */
.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.chip {
  padding: 9px 16px; border-radius: 999px; font-size: 14px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border);
}

/* Tiles (worlds, powers, etc.) */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.tile { padding: 22px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); }
.tile .t-ico { font-size: 28px; margin-bottom: 10px; line-height: 1; }
.tile h4 { font-family: var(--font-display); font-size: 17px; margin-bottom: 4px; }
.tile p { font-size: 14px; color: var(--muted); }

/* FAQ */
.faq { max-width: 780px; margin: 0 auto; display: grid; gap: 12px; }
.faq details { border-radius: 16px; background: var(--surface); border: 1px solid var(--border); padding: 0 22px; }
.faq summary {
  list-style: none; cursor: pointer; padding: 20px 0; font-weight: 600; font-size: 17px;
  display: flex; justify-content: space-between; gap: 16px; align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font-size: 24px; font-weight: 400; color: var(--accent); transition: transform .3s var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { color: var(--muted); padding: 0 0 20px; }

/* CTA */
.cta {
  position: relative; overflow: hidden; text-align: center;
  border-radius: 32px; padding: 80px 32px;
  background:
    radial-gradient(600px 300px at 20% 0%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 70%),
    radial-gradient(500px 300px at 90% 100%, color-mix(in srgb, var(--accent-2) 30%, transparent), transparent 70%),
    var(--bg-2);
  border: 1px solid var(--border);
}
.cta img.cta-icon { width: 84px; height: 84px; border-radius: 22px; margin: 0 auto 24px; box-shadow: 0 16px 40px rgba(0,0,0,.4); }
.cta h2 { font-family: var(--font-display); font-size: clamp(32px, 4.6vw, 56px); line-height: 1.05; margin-bottom: 16px; }
.cta p { color: var(--muted); font-size: 18px; max-width: 560px; margin: 0 auto 32px; }
.cta .hero-actions { justify-content: center; margin-bottom: 0; }
@media (max-width: 600px) { .cta { padding: 56px 20px; border-radius: 24px; } }

/* Footer */
.footer { padding: 56px 0 40px; border-top: 1px solid var(--border); margin-top: 104px; }
.footer-grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 32px; }
.footer-brand { display: flex; align-items: center; gap: 12px; font-family: var(--font-display); font-weight: 700; font-size: 18px; margin-bottom: 10px; }
.footer-brand img { width: 36px; height: 36px; border-radius: 10px; }
.footer p { color: var(--muted); font-size: 14px; max-width: 360px; }
.footer-cols { display: flex; flex-wrap: wrap; gap: 56px; }
.footer-col h5 { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.footer-col a { display: block; font-size: 14px; margin-bottom: 10px; opacity: .85; }
.footer-col a:hover { opacity: 1; color: var(--accent); }
.footer-bottom { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.stagger > * { opacity: 0; transform: translateY(24px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.stagger.in > * { opacity: 1; transform: none; }
.stagger.in > *:nth-child(2) { transition-delay: .06s; }
.stagger.in > *:nth-child(3) { transition-delay: .12s; }
.stagger.in > *:nth-child(4) { transition-delay: .18s; }
.stagger.in > *:nth-child(5) { transition-delay: .24s; }
.stagger.in > *:nth-child(6) { transition-delay: .30s; }
.stagger.in > *:nth-child(n+7) { transition-delay: .36s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .stagger > * { opacity: 1; transform: none; transition: none; }
}

/* Keep grid children from forcing horizontal overflow on narrow screens */
.hero-grid > *, .split > *, .steps > *, .features > * { min-width: 0; }
h1, h2, h3 { overflow-wrap: break-word; }
@media (max-width: 600px) {
  .hero h1 { font-size: clamp(34px, 10vw, 48px); }
  .stats { gap: 20px; }
}

/* ---------- No text selection / tap flash on action items ---------- */
a, button, summary, [role="tab"], label,
.play-badge, .nav-cta, .nav-home, .nav-brand, .btn-ghost, .soon-chip, .eyebrow,
.game, .feature, .step, .tile, .principle, .chip, .pal, .bal, .world, .shape, .stat,
.device, .device-screen, canvas, .mini-player, .demo-overlay {
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}
img { -webkit-user-drag: none; user-select: none; }
:focus:not(:focus-visible) { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- Autoplay finger ---------- */
.demo-finger {
  position: absolute; z-index: 4; width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border-radius: 50%; pointer-events: none; opacity: 0;
  background: rgba(255,255,255,.35); border: 2px solid rgba(255,255,255,.85);
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
  transition: left .18s ease-out, top .18s ease-out;
}
.demo-finger.go { animation: tapfx .55s ease-out; }
.demo-finger.hold { opacity: .9; transition: none; }
@keyframes tapfx { 0% { opacity: 0; transform: scale(1.4); } 25% { opacity: 1; transform: scale(.85); } 100% { opacity: 0; transform: scale(1.6); } }

/* ---------- Mobile gameplay preview ---------- */
.mini-player {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 60;
  display: none; align-items: center; gap: 14px; text-align: left;
  padding: 10px 14px 10px 10px; border-radius: 22px;
  background: color-mix(in srgb, var(--bg-2) 88%, transparent);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--border); box-shadow: 0 18px 44px rgba(0,0,0,.5);
  transform: translateY(140%); transition: transform .45s var(--ease);
}
.mini-player.show { transform: none; }
@media (max-width: 900px) { .mini-player { display: flex; } }
.mini-screen { flex: none; width: 48px; height: 99px; border-radius: 11px; overflow: hidden; background: #000; box-shadow: 0 0 0 2px rgba(255,255,255,.12); }
.mini-screen canvas { width: 100%; height: 100%; display: block; }
.mini-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mini-copy small { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.mini-copy small i { width: 7px; height: 7px; border-radius: 50%; background: #ff4d5e; animation: live 1.4s ease-in-out infinite; }
@keyframes live { 50% { opacity: .3; } }
.mini-copy b { font-family: var(--font-display); font-size: 17px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-copy > span { font-size: 13px; color: var(--muted); }
.mini-play { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); box-shadow: 0 8px 22px var(--glow); }
.mini-play svg { width: 22px; height: 22px; margin-left: 2px; }
body.demo-open { overflow: hidden; }
body.demo-open .mini-player { transform: translateY(140%); }

/* ---------- Full-screen demo ---------- */
.demo-overlay {
  position: fixed; inset: 0; z-index: 80; display: none; flex-direction: column; align-items: center;
  padding: calc(12px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.demo-overlay.show { display: flex; animation: fadein .3s var(--ease); }
@keyframes fadein { from { opacity: 0; transform: scale(.98); } }
.demo-overlay-top { width: 100%; max-width: 480px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.demo-overlay-top b { font-family: var(--font-display); font-size: 18px; }
.demo-close { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); font-size: 16px; }
.demo-holder { flex: 1; min-height: 0; width: 100%; display: flex; justify-content: center; }
.demo-holder .device-screen { height: 100%; width: auto; max-width: 100%; aspect-ratio: 9 / 18.5; border-radius: 28px; box-shadow: 0 0 0 1px var(--border), 0 30px 60px rgba(0,0,0,.5); }
.demo-holder .device-notch { display: none; }
.demo-holder .device-hud { top: 18px; }
.demo-holder .loop-bar { top: 44px; }
.demo-dl { margin-top: 14px; font-weight: 700; font-size: 14px; color: var(--accent); }

/* ---------- Quick Play (phones): the hero demo is a preview, play happens full screen ---------- */
.quick-play { display: none; }
@media (max-width: 900px) {
  .device { cursor: pointer; }
  .device .device-screen { touch-action: auto; }
  .device .device-screen canvas { pointer-events: none; }
  .device .device-hint { display: none; }
  .quick-play {
    position: absolute; z-index: 5; left: 50%; bottom: 34px; transform: translateX(-50%);
    display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
    padding: 14px 26px 14px 20px; border-radius: 999px;
    font-weight: 800; font-size: 16px; letter-spacing: .01em;
    background: var(--accent); color: var(--on-accent);
    box-shadow: 0 12px 30px rgba(0,0,0,.45), 0 0 0 6px color-mix(in srgb, var(--accent) 25%, transparent);
    animation: qp 2.2s ease-in-out infinite;
  }
  .quick-play svg { width: 20px; height: 20px; }
  @keyframes qp { 50% { box-shadow: 0 12px 30px rgba(0,0,0,.45), 0 0 0 12px color-mix(in srgb, var(--accent) 0%, transparent); } }
}
.demo-holder .device-screen { touch-action: none; }
.demo-holder .device-screen canvas { pointer-events: auto; }
