/* Marble Run: Build & Race. philwoolley.com/marblerun/
   Colours and radii follow the game's design system (Theme.swift):
   amber candy buttons, smoked glass panels, plum to near-black sheets. */

:root {
  --night: #120b22;
  --ink: #1d0e3a;
  --amber: #ffb43a;
  --amber-deep: #f08a1c;
  --amber-edge: #a85a0c;
  --on-amber: #3a1e00;
  --gold: #ffd54a;
  --mint: #6be29a;
  --sky: #6ec8ff;
  --pink: #ff4d8d;
  --violet: #b572ff;
  --text: #fff;
  --text-2: rgba(255, 255, 255, 0.78);
  --text-3: rgba(255, 255, 255, 0.55);
  --r-s: 10px;
  --r-m: 14px;
  --r-l: 20px;
  --r-xl: 28px;
  --display: "Titan One", "Nunito", ui-rounded, system-ui, sans-serif;
  --body: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --wrap: 1180px;
  --gutter: clamp(18px, 4vw, 40px);
  --nav-h: 60px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 12px);
  background: var(--night);
}

body {
  margin: 0;
  overflow-x: clip;
  background: var(--night);
  color: var(--text);
  font: 600 18px/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; -webkit-tap-highlight-color: transparent; }
a { color: inherit; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, p, figure, ul { margin: 0; }
ul { padding: 0; list-style: none; }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 8px; }

.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.skip {
  position: fixed; left: 12px; top: -80px; z-index: 100;
  padding: 10px 16px; border-radius: 12px;
  background: #fff; color: #120b22; font-weight: 900; text-decoration: none;
}
.skip:focus { top: 10px; }

.wrap { width: min(var(--wrap), 100% - 2 * var(--gutter)); margin-inline: auto; }

/* ---------- Nav ---------- */

.nav {
  position: fixed; z-index: 50; inset: 0 0 auto 0;
  height: var(--nav-h);
  display: flex; align-items: center; gap: 6px;
  padding: 0 max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
  background: rgba(19, 11, 38, 0.6);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  backdrop-filter: blur(18px) saturate(1.5);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.09);
}
.nav-home {
  margin-right: auto; padding: 10px 0;
  font-weight: 900; font-size: 17px; white-space: nowrap; text-decoration: none;
}
.nav-home span { display: inline-block; transition: transform 0.2s var(--ease); }
.nav-home:hover span { transform: translateX(-3px); }
.nav-links { display: flex; gap: 2px; }
.nav-links a {
  padding: 10px 12px; border-radius: 12px;
  font-weight: 800; font-size: 15px; color: var(--text-2); text-decoration: none;
  transition: color 0.15s, background-color 0.15s;
}
.nav-links a:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }

.sound {
  display: inline-flex; align-items: center; gap: 7px;
  height: 40px; padding: 0 14px 0 10px; border-radius: 20px;
  background: rgba(255, 255, 255, 0.1);
  font-weight: 800; font-size: 15px;
  transition: background-color 0.2s, color 0.2s, transform 0.16s var(--ease);
}
.sound:active { transform: scale(0.96); }
.sound[aria-pressed="true"] { background: var(--amber); color: var(--on-amber); }
.sound-on, .sound-off {
  transform-box: fill-box; transform-origin: center;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), filter 0.2s var(--ease);
}
.sound[aria-pressed="false"] .sound-on,
.sound[aria-pressed="true"] .sound-off { opacity: 0; transform: scale(0.25); filter: blur(4px); }

/* ---------- Buttons and the store badge ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 56px; padding: 0 22px; margin-bottom: 5px; border-radius: 18px;
  font-weight: 900; font-size: 18px; white-space: nowrap; color: var(--on-amber);
  background: linear-gradient(180deg, #ffd27a 0%, #ffb43a 46%, #f59a22 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.55),
    inset 0 -2px 0 rgba(168, 90, 12, 0.3),
    0 5px 0 var(--amber-edge),
    0 14px 24px rgba(20, 0, 40, 0.4);
  transition: transform 0.16s var(--ease), box-shadow 0.16s var(--ease), filter 0.16s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active {
  transform: translateY(3px) scale(0.96);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.55),
    inset 0 -2px 0 rgba(168, 90, 12, 0.3),
    0 2px 0 var(--amber-edge),
    0 6px 12px rgba(20, 0, 40, 0.4);
}
.btn svg { margin-left: -3px; }
.btn-glass {
  color: #fff;
  background: rgba(24, 14, 48, 0.5);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.32), 0 5px 0 rgba(12, 4, 32, 0.6), 0 14px 24px rgba(20, 0, 40, 0.3);
}
.btn-glass:active { box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.32), 0 2px 0 rgba(12, 4, 32, 0.6), 0 6px 12px rgba(20, 0, 40, 0.3); }

.store {
  display: inline-flex; align-items: stretch; height: 60px; margin-bottom: 5px;
  border-radius: 18px; overflow: hidden; cursor: default; user-select: none;
  background: #0d0a14; color: #fff; text-decoration: none;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.3), 0 14px 24px rgba(20, 0, 40, 0.35);
}
.store-main { display: flex; flex-direction: column; justify-content: center; padding: 0 16px 0 18px; line-height: 1.08; text-align: left; }
.store-main small { font-size: 11.5px; font-weight: 800; letter-spacing: 0.02em; color: rgba(255, 255, 255, 0.76); }
.store-main b { font-size: 24px; font-weight: 900; letter-spacing: -0.01em; }
.store-side {
  display: flex; align-items: center; gap: 7px; padding: 0 16px;
  font-weight: 900; font-size: 15px; white-space: nowrap;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.16);
}
.store-side i { font-style: normal; color: var(--amber); }

.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }

/* ---------- Hero ---------- */

.hero {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; flex-direction: column;
  min-height: max(100svh, 700px);
  padding-top: var(--nav-h);
  cursor: pointer;
  background:
    radial-gradient(90% 70% at 10% 0%, rgba(70, 104, 255, 0.9), transparent 62%),
    radial-gradient(80% 80% at 100% 18%, rgba(232, 48, 116, 0.85), transparent 62%),
    radial-gradient(70% 60% at 50% 100%, rgba(128, 44, 228, 0.6), transparent 72%),
    linear-gradient(160deg, #2a2fbd 0%, #5a2bc8 45%, #9b1f6e 100%);
}
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(2px 2px at 12% 22%, rgba(255, 255, 255, 0.9), transparent 60%),
    radial-gradient(2px 2px at 31% 64%, rgba(255, 255, 255, 0.6), transparent 60%),
    radial-gradient(3px 3px at 47% 12%, rgba(255, 255, 255, 0.8), transparent 60%),
    radial-gradient(2px 2px at 58% 44%, rgba(255, 255, 255, 0.5), transparent 60%),
    radial-gradient(3px 3px at 72% 30%, rgba(255, 255, 255, 0.8), transparent 60%),
    radial-gradient(2px 2px at 88% 58%, rgba(255, 255, 255, 0.6), transparent 60%),
    radial-gradient(2px 2px at 94% 12%, rgba(255, 255, 255, 0.8), transparent 60%),
    linear-gradient(180deg, transparent calc(100% - 150px), var(--night) 100%);
}
.hero-canvas { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; }
.hero-inner {
  position: relative; z-index: 2;
  width: min(var(--wrap), 100% - 2 * var(--gutter)); margin-inline: auto;
  padding-top: clamp(18px, 5vh, 56px);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start;
  gap: clamp(24px, 4vw, 64px);
}
.hero-band { flex: 1 0 clamp(270px, 38vh, 400px); }

.wordmark { font-family: var(--display); font-weight: 400; line-height: 0.92; letter-spacing: 0.005em; }
.wm {
  position: relative; isolation: isolate; display: block; width: fit-content;
  padding: 0.06em 0.1em 0.14em 0.05em; margin-left: -0.05em;
  font-size: clamp(54px, 8.2vw, 122px); white-space: nowrap;
}
.wm::before {
  content: attr(data-t); position: absolute; left: 0.05em; top: 0.06em; z-index: -1;
  color: #2a0f55; -webkit-text-stroke: 0.17em #2a0f55;
  text-shadow: 0 0.08em 0 #1b0838, 0 0.17em 0.24em rgba(10, 0, 30, 0.45);
}
.wm > span {
  background: linear-gradient(180deg, #fffbe0 10%, #ffe066 40%, #ffb21f 70%, #ff8a1c 96%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.wm-sub {
  display: block; width: fit-content; margin-top: 0.04em;
  font-size: clamp(25px, 3.6vw, 54px); letter-spacing: 0.02em; color: #fff;
  -webkit-text-stroke: 0.2em #2a0f55; paint-order: stroke fill;
  text-shadow: 0 0.1em 0 #1b0838;
}

.lede {
  max-width: 31em; margin-top: 20px;
  font-size: clamp(17px, 1.5vw, 21px); font-weight: 700; text-wrap: pretty;
  text-shadow: 0 1px 14px rgba(24, 0, 70, 0.55);
}
.hero .cta-row { margin-top: 22px; }
.fine { margin-top: 10px; font-size: 14px; font-weight: 700; color: rgba(255, 255, 255, 0.76); }

.phone {
  position: relative; display: block;
  width: clamp(230px, 21vw, 286px); aspect-ratio: 480 / 1040;
  margin-bottom: -210px; padding: 9px; border-radius: 44px;
  background: linear-gradient(160deg, #3d2f62, #120c22);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.24), 0 30px 60px rgba(10, 0, 40, 0.55), 0 8px 18px rgba(10, 0, 40, 0.35);
  transform: rotate(3deg);
  transition: transform 0.3s var(--ease);
}
.phone:hover { transform: rotate(1.5deg) translateY(-4px); }
.phone:active { transform: rotate(1.5deg) scale(0.98); }
.phone-screen { display: block; height: 100%; border-radius: 35px; overflow: hidden; background: #000; }
.phone video { width: 100%; height: 100%; object-fit: cover; }
.phone-play {
  position: absolute; right: 22px; bottom: 22px;
  width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(180deg, #ffd27a, #f59a22); color: var(--on-amber);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5), 0 4px 0 var(--amber-edge), 0 10px 20px rgba(0, 0, 0, 0.4);
}
.phone-play svg { margin-left: 3px; }

/* ---------- Stats ---------- */

.stats {
  width: min(var(--wrap), 100% - 2 * var(--gutter)); margin-inline: auto;
  padding: clamp(28px, 5vw, 64px) 0 clamp(40px, 7vw, 88px);
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px 12px;
}
.stats li { display: flex; flex-direction: column; align-items: center; text-align: center; }
.stats b {
  font-family: var(--display); font-weight: 400; line-height: 1;
  font-size: clamp(46px, 7.4vw, 104px);
  -webkit-text-stroke: 0.1em var(--ink); paint-order: stroke fill;
  text-shadow: 0 0.07em 0 var(--ink);
}
.stats li:nth-child(1) b { color: var(--gold); }
.stats li:nth-child(2) b { color: var(--sky); }
.stats li:nth-child(3) b { color: var(--mint); }
.stats li:nth-child(4) b { color: #ff8fb8; }
.stats span { margin-top: 4px; font-weight: 800; font-size: clamp(14px, 1.3vw, 18px); color: var(--text-2); }

/* ---------- Chapters ---------- */

.chapter { position: relative; padding-bottom: clamp(56px, 9vw, 120px); }
#build { --accent: var(--gold); }
#chain { --accent: #ffa27f; }
#worlds { --accent: #9bdcff; }
#ride { --accent: #8fe3ff; }
#puzzles { --accent: #8ff0b4; }
#factory { --accent: #ff9fc6; }
#screenshots { --accent: #d3b2ff; }
#free { --accent: #8ff0b4; }

.banner { position: relative; overflow: hidden; width: 100%; aspect-ratio: 2000 / 833; max-height: 660px; background: #1a1030; }
.banner img { width: 100%; height: 100%; object-fit: cover; }
.banner::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(18, 11, 34, 0.5) 0%, rgba(18, 11, 34, 0) 16%, rgba(18, 11, 34, 0) 48%, rgba(18, 11, 34, 0.6) 80%, var(--night) 100%);
}

.display {
  position: relative;
  font-family: var(--display); font-weight: 400; line-height: 0.96; letter-spacing: 0.005em;
  font-size: clamp(42px, 8.4vw, 124px);
  color: var(--accent, #fff);
  -webkit-text-stroke: 0.12em var(--ink); paint-order: stroke fill;
  text-shadow: 0 0.07em 0 var(--ink), 0 0.14em 0.3em rgba(0, 0, 0, 0.35);
  text-wrap: balance;
}
.chapter .display { z-index: 1; margin-top: calc(-1 * clamp(34px, 8vw, 118px)); }

.split {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start;
  gap: clamp(28px, 5vw, 72px);
  margin-top: clamp(26px, 4vw, 52px);
}
.split + .split { margin-top: clamp(48px, 8vw, 104px); }
.split-flip { grid-template-columns: auto minmax(0, 1fr); }
.split-flip .prose { order: 2; }

.prose { max-width: 33em; font-size: clamp(18px, 1.65vw, 22px); }
.prose p { color: var(--text-2); text-wrap: pretty; }
.prose p + p { margin-top: 0.9em; }
.prose h3 {
  margin: 1.2em 0 0.35em;
  font-family: var(--display); font-weight: 400; line-height: 1.05;
  font-size: clamp(26px, 3vw, 40px);
}
.prose h3:first-child { margin-top: 0; }
.prose .display-sub {
  margin-bottom: 0.4em;
  font-size: clamp(34px, 5.2vw, 72px); color: var(--gold);
  -webkit-text-stroke: 0.12em var(--ink); paint-order: stroke fill;
  text-shadow: 0 0.07em 0 var(--ink);
  text-wrap: balance;
}

.screens { display: flex; align-items: center; justify-content: center; gap: clamp(12px, 2vw, 26px); }
.screen {
  padding: 8px; border-radius: 30px;
  background: linear-gradient(160deg, #3d2f62, #150e28);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.2), 0 24px 48px rgba(0, 0, 0, 0.45);
  transform: rotate(-2deg);
}
.screen + .screen { transform: translateY(28px) rotate(2.5deg); }
.screen:only-child { transform: rotate(2deg); }
.split-flip .screen:only-child { transform: rotate(-2deg); }
.screen img { width: clamp(148px, 22vw, 290px); border-radius: 22px; background: #000; }
.screen:only-child img { width: clamp(220px, 27vw, 330px); }

/* ---------- Track pieces ---------- */

.pieces {
  display: grid; gap: 12px; overflow: hidden;
  margin: clamp(56px, 8vw, 104px) calc(50% - 50vw) 0; padding: 4px 0;
}
.pieces-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; padding: 0 var(--gutter); }
.pieces-row li {
  padding: 10px 20px; border-radius: 999px; white-space: nowrap;
  font-weight: 900; font-size: clamp(16px, 1.6vw, 20px);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.12);
}
.pieces-row li:nth-child(4n + 1) { color: var(--gold); }
.pieces-row li:nth-child(4n + 2) { color: #9bdcff; }
.pieces-row li:nth-child(4n + 3) { color: #ff9fc6; }
.pieces-row li:nth-child(4n) { color: #8ff0b4; }
.pieces.run {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}
.pieces.run .pieces-row {
  flex-wrap: nowrap; justify-content: flex-start; width: max-content; padding: 0 12px 0 0;
  animation: pieces 44s linear infinite;
}
.pieces.run .pieces-row:nth-child(2) { animation-direction: reverse; animation-duration: 52s; }
.pieces.run:hover .pieces-row { animation-play-state: paused; }
@keyframes pieces { to { transform: translateX(-50%); } }

/* ---------- Materials ---------- */

.materials {
  margin-top: clamp(48px, 7vw, 88px); padding: clamp(18px, 3vw, 32px);
  border-radius: var(--r-xl);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.11);
}
.materials h3 { font-family: var(--display); font-weight: 400; line-height: 1.05; font-size: clamp(24px, 3vw, 40px); text-wrap: balance; }
.mat-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.mat {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 0 18px 0 8px; border-radius: 999px;
  font-weight: 900; font-size: 16px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.13);
  transition: background-color 0.2s, color 0.2s, box-shadow 0.2s, transform 0.16s var(--ease);
}
.mat i {
  width: 32px; height: 32px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--c1), var(--c2));
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.4);
}
.mat:hover { background: rgba(255, 255, 255, 0.14); }
.mat:active { transform: scale(0.96); }
.mat[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35); }
.mat-canvas {
  width: 100%; height: clamp(150px, 19vw, 220px); margin-top: 18px; border-radius: 12px;
  background:
    radial-gradient(80% 120% at 20% 0%, rgba(110, 200, 255, 0.28), transparent 70%),
    radial-gradient(80% 120% at 90% 100%, rgba(255, 77, 141, 0.24), transparent 70%),
    #1c1238;
}

/* ---------- Worlds ---------- */

.worlds {
  padding: clamp(24px, 4vw, 48px) 0 clamp(56px, 9vw, 120px);
  background:
    radial-gradient(55% 45% at 85% 30%, rgba(110, 200, 255, 0.14), transparent 70%),
    radial-gradient(50% 50% at 8% 70%, rgba(181, 114, 255, 0.16), transparent 70%);
}
.world-grid {
  display: grid; grid-template-columns: minmax(240px, 420px) minmax(0, 1fr); align-items: center;
  gap: clamp(28px, 5vw, 72px);
  margin-top: clamp(28px, 4vw, 52px);
}
.world-frame {
  position: relative; overflow: hidden; aspect-ratio: 3 / 4;
  border-radius: var(--r-xl); background: #1c1238;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
  transform: rotate(-2deg);
}
.world-frame::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.18); }
.world-frame img { width: 100%; height: 100%; object-fit: cover; transition: opacity 0.22s var(--ease), transform 0.5s var(--ease); }
.world-frame img.swap { opacity: 0; transform: scale(1.04); }
.world-note {
  position: absolute; left: 14px; bottom: 14px; z-index: 1;
  padding: 4px 11px; border-radius: 999px;
  font-size: 12.5px; font-weight: 800; color: var(--text-2);
  background: rgba(14, 8, 26, 0.72);
}
.world-name {
  font-family: var(--display); line-height: 1; font-size: clamp(36px, 5.6vw, 80px); color: var(--gold);
  -webkit-text-stroke: 0.12em var(--ink); paint-order: stroke fill;
  text-shadow: 0 0.07em 0 var(--ink);
  text-wrap: balance;
}
.world-desc { min-height: 3.1em; margin-top: 0.5em; font-size: clamp(18px, 1.65vw, 22px); color: var(--text-2); text-wrap: pretty; }
.world-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 22px; }
.world-tab {
  display: flex; flex-direction: column; gap: 6px; padding: 6px 6px 9px; border-radius: 18px;
  text-align: center; font-weight: 800; font-size: 13.5px; line-height: 1.15; color: var(--text-2);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.11);
  transition: background-color 0.2s, color 0.2s, box-shadow 0.2s, transform 0.16s var(--ease);
}
.world-tab img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; }
.world-tab span { display: grid; place-items: center; min-height: 2.3em; }
.world-tab:hover { background: rgba(255, 255, 255, 0.13); color: #fff; }
.world-tab:active { transform: scale(0.96); }
.world-tab[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 5px 0 rgba(0, 0, 0, 0.35); }

/* ---------- Events ---------- */

.events { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(14px, 2.4vw, 28px); margin-top: clamp(48px, 7vw, 88px); }
.event {
  overflow: hidden; border-radius: var(--r-xl); background: #1d1338;
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.11);
}
.event img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.event div { padding: 16px 22px 22px; }
.event h3 { font-family: var(--display); font-weight: 400; line-height: 1.05; font-size: clamp(24px, 2.8vw, 36px); }
.event p { margin-top: 4px; color: var(--text-2); }

/* ---------- Marble Factory ---------- */

.factory {
  padding: clamp(24px, 4vw, 48px) 0 clamp(56px, 9vw, 120px);
  background: radial-gradient(55% 55% at 18% 45%, rgba(255, 77, 141, 0.16), transparent 70%);
}
.factory-grid {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); align-items: center;
  gap: clamp(28px, 5vw, 72px);
  margin-top: clamp(28px, 4vw, 52px);
}
.factory-stage {
  overflow: hidden; border-radius: var(--r-xl);
  background: radial-gradient(70% 80% at 50% 20%, #3a2a6e, #170e2e 80%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.13), 0 30px 60px rgba(0, 0, 0, 0.45);
}
#factoryCanvas { width: 100%; aspect-ratio: 5 / 4; cursor: pointer; }
.factory-controls > p { margin-bottom: 22px; font-size: clamp(18px, 1.65vw, 22px); color: var(--text-2); text-wrap: pretty; }
.opt { display: grid; gap: 8px; margin-bottom: 18px; }
.opt-label { font-weight: 900; font-size: 15px; color: var(--text-3); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 0 16px; border-radius: 999px;
  font-weight: 900; font-size: 15px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.13);
  transition: background-color 0.2s, color 0.2s, box-shadow 0.2s, transform 0.16s var(--ease);
}
.chip:hover { background: rgba(255, 255, 255, 0.14); }
.chip:active { transform: scale(0.96); }
.chip[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35); }
.dots { display: flex; flex-wrap: wrap; gap: 10px; }
.dot {
  width: 40px; height: 40px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, color-mix(in srgb, var(--c) 45%, #fff), var(--c) 58%, color-mix(in srgb, var(--c) 68%, #000));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.28);
  transition: box-shadow 0.2s, transform 0.16s var(--ease);
}
.dot:active { transform: scale(0.96); }
.dot[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--night), 0 0 0 6px #fff; }
.factory-controls .btn { margin-top: 6px; }

/* ---------- Screenshots ---------- */

.shots { padding-top: clamp(24px, 4vw, 48px); }
.shot-rail {
  display: flex; gap: clamp(12px, 2vw, 22px);
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; scrollbar-width: none;
  padding: clamp(28px, 4vw, 48px) max(var(--gutter), calc(50vw - var(--wrap) / 2)) 44px;
}
.shot-rail::-webkit-scrollbar { display: none; }
.shot {
  flex: 0 0 auto; width: clamp(196px, 21vw, 262px);
  overflow: hidden; border-radius: 26px; scroll-snap-align: center;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  outline: 1px solid rgba(255, 255, 255, 0.14); outline-offset: -1px;
  transition: transform 0.25s var(--ease);
}
.shot:hover { transform: translateY(-8px) rotate(-1deg); }
.shot:active { transform: scale(0.98); }
.shot:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.shot img { width: 100%; }

/* ---------- More ---------- */

.more { padding: clamp(32px, 5vw, 72px) 0 clamp(40px, 7vw, 96px); }
.more-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(12px, 2vw, 22px); }
.more-grid li {
  padding: 22px; border-radius: var(--r-l);
  background: rgba(255, 255, 255, 0.055);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.more-grid svg { color: var(--gold); }
.more-grid h3 { margin: 12px 0 4px; font-size: 20px; font-weight: 900; line-height: 1.2; }
.more-grid p { font-size: 16.5px; color: var(--text-2); text-wrap: pretty; }

/* ---------- Free ---------- */

.promise { padding: clamp(24px, 4vw, 48px) 0 clamp(64px, 9vw, 120px); text-align: center; }
.promise-lede { max-width: 28em; margin: 22px auto 0; font-size: clamp(19px, 2vw, 26px); font-weight: 700; text-wrap: balance; }
.promise-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 26px; }
.promise-list li {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px 10px 14px; border-radius: 999px;
  font-weight: 900; color: #c4f7d6;
  background: rgba(107, 226, 154, 0.12);
  box-shadow: inset 0 0 0 1.5px rgba(107, 226, 154, 0.32);
}
.promise-list li::before {
  content: ""; width: 18px; height: 18px; flex: none; background: var(--mint);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='%23000' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='%23000' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.text-link { display: inline-block; margin-top: 18px; padding: 10px; font-weight: 900; color: var(--gold); text-underline-offset: 4px; }

/* ---------- Closing ---------- */

.closing {
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; place-items: center;
  min-height: clamp(440px, 46vw, 640px);
  padding: 72px var(--gutter);
}
.closing-art { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; }
.closing::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, var(--night) 0%, rgba(18, 11, 34, 0) 26%, rgba(18, 11, 34, 0) 70%, rgba(11, 7, 22, 0.9) 100%);
}
.closing-inner { display: grid; justify-items: center; gap: 30px; }
.closing-icon {
  width: clamp(112px, 14vw, 168px); border-radius: 22.5%;
  box-shadow: 0 24px 50px rgba(10, 0, 40, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.22);
}
.closing .cta-row { justify-content: center; }

/* ---------- Footer ---------- */

.foot { padding: 34px var(--gutter) calc(40px + env(safe-area-inset-bottom)); text-align: center; background: #0b0716; }
.foot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 6px; }
.foot a { padding: 10px 12px; border-radius: 12px; font-weight: 800; font-size: 16px; color: var(--text-2); text-decoration: none; transition: color 0.15s, background-color 0.15s; }
.foot a:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.foot p { margin-top: 12px; font-size: 14px; color: var(--text-3); }

/* ---------- Dialogs ---------- */

.modal {
  position: fixed; inset: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; overflow: hidden;
  background: transparent; color: #fff;
}
.modal[open] { display: grid; place-items: center; animation: modal-in 0.22s var(--ease); }
.modal::backdrop { background: rgba(8, 4, 18, 0.88); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.modal video, .modal > img {
  width: auto; height: auto;
  max-width: min(92vw, 520px); max-height: min(88dvh, 1040px);
  border-radius: 28px; background: #000;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.modal-close, .modal-nav {
  position: absolute; z-index: 2; display: grid; place-items: center; border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  transition: background-color 0.15s, transform 0.16s var(--ease);
}
.modal-close:hover, .modal-nav:hover { background: rgba(255, 255, 255, 0.28); }
.modal-close:active, .modal-nav:active { transform: scale(0.96); }
.modal-close { top: max(16px, env(safe-area-inset-top)); right: 16px; width: 48px; height: 48px; }
.modal-nav { top: calc(50% - 26px); width: 52px; height: 52px; }
.modal-prev { left: max(10px, calc(50vw - 350px)); }
.modal-next { right: max(10px, calc(50vw - 350px)); }
@keyframes modal-in { from { opacity: 0; transform: scale(0.97); } }

/* ---------- Scroll reveal ---------- */

.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }
.js .reveal + .reveal { transition-delay: 0.1s; }
.js .more-grid .reveal:nth-child(3) { transition-delay: 0.2s; }
.js .more-grid .reveal:nth-child(4) { transition-delay: 0.3s; }

/* ---------- Smaller screens ---------- */

@media (max-width: 900px) {
  .more-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .world-grid { grid-template-columns: minmax(200px, 320px) minmax(0, 1fr); }
  .world-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .phone { display: none; }
  .hero-inner { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .split, .split-flip { grid-template-columns: minmax(0, 1fr); }
  .split-flip .prose { order: 0; }
  .banner { aspect-ratio: 5 / 4; }
  .world-grid { grid-template-columns: minmax(0, 1fr); }
  .world-frame { width: min(100%, 320px); margin-inline: auto; }
  .world-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .world-tab { font-size: 12px; padding: 5px 5px 7px; border-radius: 15px; }
  .world-tab img { border-radius: 10px; }
  .world-desc { min-height: 0; }
  .factory-grid { grid-template-columns: minmax(0, 1fr); }
  .events { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .nav { gap: 2px; }
  .nav-home { font-size: 15px; }
  .nav-links { gap: 0; }
  .nav-links a { padding: 12px 7px; font-size: 14px; }
  .sound { width: 40px; padding: 0; justify-content: center; margin-left: 2px; }
  .sound-label { display: none; }
  .hero .btn { min-height: 52px; padding: 0 14px; font-size: 16px; border-radius: 16px; }
  .hero .cta-row { gap: 8px 10px; margin-top: 18px; }
  .lede { margin-top: 16px; }
  .more-grid { grid-template-columns: minmax(0, 1fr); }
  .closing .cta-row { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .pieces.run .pieces-row { animation: none; }
  .modal[open] { animation: none; }
  .phone, .shot, .screen, .world-frame img { transition: none; }
}
