/* ==========================================================================
   Manan Ambani — "The Formula"
   ========================================================================== */

:root {
  --purple-950: #17133f;
  --purple-900: #1e1a4d;
  --purple: #26215C;
  --purple-700: #362f80;
  --coral: #D85A30;
  --teal: #1D9E75;
  --pink: #D4537E;
  --amber: #EF9F27;
  --cream: #F7F3EC;
  --ink: #191530;

  --font-display: "Fraunces", serif;
  --font-mono-ish: "Space Grotesk", sans-serif;
  --font-body: "Inter", sans-serif;

  --gap: clamp(1rem, 2.5vw, 2.5rem);
  --radius: 18px;
  --ease: cubic-bezier(.16,.84,.44,1);

  color-scheme: dark;
}

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

[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--purple-950);
  color: var(--cream);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden;
  cursor: none;
}
@media (hover: none) {
  body { cursor: auto; }
}

h1, h2, h3, .font-display { font-family: var(--font-display); font-weight: 600; }
.section-intro, .eyebrow, .btn, .stat-label, .level-badge, .shelf-label, .tile, .pill {
  font-family: var(--font-mono-ish);
}

a { color: inherit; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

.skip-link {
  position: fixed;
  top: -100%;
  left: 1rem;
  z-index: 999;
  background: var(--amber);
  color: var(--ink);
  padding: .75rem 1.25rem;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  transition: top .2s var(--ease);
}
.skip-link:focus { top: 1rem; }

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

/* ============ layout helpers ============ */
.zone {
  position: relative;
  padding: clamp(4rem, 10vw, 8rem) 0;
  overflow: hidden;
}
.zone-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--gap);
  position: relative;
  z-index: 2;
}

.section-intro {
  font-size: clamp(1.75rem, 4vw, 3rem);
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0 0 2.5rem;
  max-width: 20ch;
}
.section-intro--small { font-size: clamp(1.4rem, 3vw, 2rem); margin-bottom: .75rem; }
.section-sub {
  max-width: 60ch;
  opacity: .85;
  font-size: 1.05rem;
  margin: -1.5rem 0 2.5rem;
}

/* zone color backgrounds (grayscale by default via overlay, not filter) */
.zone-hero  { background: radial-gradient(circle at 30% 20%, var(--purple-700), var(--purple-950) 65%); }
.zone-lab   { background: linear-gradient(180deg, var(--purple-950), var(--purple)); }
.zone-climb { background: linear-gradient(180deg, var(--purple), var(--purple-900)); }
.zone-gallery { background: linear-gradient(180deg, var(--purple-900), var(--purple-950)); }
.zone-trophy { background: radial-gradient(circle at 70% 30%, var(--purple-700), var(--purple-950) 70%); }
.zone-payoff { background: var(--ink); text-align: center; }

/* becomes permanently full color when restored: raise above grayscale overlay */
.zone.is-restored { position: relative; z-index: 6; isolation: isolate; }

/* ============ buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .85rem 1.5rem;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  font-size: .95rem;
  transition: transform .25s var(--ease), background .25s, box-shadow .25s;
}
.btn--primary {
  background: var(--coral);
  color: #fff;
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(216,90,48,.4); }
.btn--ghost {
  border: 1.5px solid rgba(247,243,236,.35);
  color: var(--cream);
}
.btn--ghost:hover { border-color: var(--amber); transform: translateY(-2px); }

/* ============ HUD ============ */
.hud {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .5rem;
  font-family: var(--font-mono-ish);
}
.hud-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: rgba(23,19,63,.75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(247,243,236,.2);
  color: var(--cream);
  padding: .45rem .8rem;
  border-radius: 999px;
  font-size: .78rem;
  white-space: nowrap;
}
.hud-btn-dot { width: 8px; height: 8px; border-radius: 50%; background: conic-gradient(var(--coral), var(--amber), var(--teal), var(--pink)); }
.hud-btn[aria-pressed="true"] { border-color: var(--amber); }

.dose-meter {
  background: rgba(23,19,63,.75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(247,243,236,.2);
  border-radius: 999px;
  padding: .5rem .9rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .72rem;
}
.dose-meter-track {
  width: 90px;
  height: 8px;
  background: rgba(247,243,236,.15);
  border-radius: 999px;
  overflow: hidden;
}
.dose-meter-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--coral), var(--amber), var(--pink), var(--teal));
  transition: width .2s linear;
}
.dose-meter.is-complete .dose-meter-fill { animation: dosePulse 1s var(--ease); }
@keyframes dosePulse { 0%,100% { filter: brightness(1);} 50% { filter: brightness(1.6);} }

.hud-counter {
  background: rgba(23,19,63,.75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(247,243,236,.2);
  border-radius: 999px;
  padding: .45rem .8rem;
  font-size: .72rem;
}
.hud-counter--secret { border-color: var(--pink); color: var(--pink); }

.hints-panel {
  position: fixed;
  top: 5.5rem;
  right: 1rem;
  z-index: 79;
  max-width: 280px;
  background: rgba(23,19,63,.92);
  border: 1px solid var(--amber);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  font-size: .78rem;
  line-height: 1.5;
}
.hints-panel ol { margin: 0; padding-left: 1.1rem; }
.hints-panel li { margin-bottom: .4rem; }

/* ============ custom cursor ============ */
.capsule-cursor {
  position: fixed;
  top: 0; left: 0;
  width: 26px; height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--coral) 50%, var(--cream) 50%);
  border: 1.5px solid rgba(255,255,255,.6);
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%,-50%);
  transition: width .2s var(--ease), height .2s var(--ease), background .2s;
  will-change: transform;
}
.capsule-cursor.is-active {
  width: 64px; height: 64px;
  background: rgba(239,159,39,.15);
  border: 1.5px solid var(--amber);
  display: flex; align-items: center; justify-content: center;
}
.capsule-cursor.is-active::after {
  content: attr(data-label);
  font-family: var(--font-mono-ish);
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--amber);
}
@media (hover: none) { .capsule-cursor { display: none; } }

/* ============ grayscale reveal overlay ============ */
.grayscale-overlay {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  backdrop-filter: grayscale(1) saturate(0);
  -webkit-backdrop-filter: grayscale(1) saturate(0);
  -webkit-mask-image: radial-gradient(circle 130px at var(--cx,50%) var(--cy,50%), transparent 0, transparent 96px, black 132px);
  mask-image: radial-gradient(circle 130px at var(--cx,50%) var(--cy,50%), transparent 0, transparent 96px, black 132px);
  transition: opacity .8s var(--ease);
}
body.is-fullcolor .grayscale-overlay,
body.reduced-motion .grayscale-overlay,
.no-js .grayscale-overlay {
  opacity: 0;
  pointer-events: none;
}
body.is-flooded .grayscale-overlay { opacity: 0; }
.no-js body { cursor: auto; }

/* ============ hero ============ */
.zone-hero { min-height: 100vh; display: flex; align-items: center; }
.hero-inner { text-align: left; max-width: 900px; }
.hero-parallax { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .5; z-index: 0; }
.hero-parallax--1 { width: 420px; height: 420px; background: var(--coral); top: -120px; right: -100px; }
.hero-parallax--2 { width: 320px; height: 320px; background: var(--teal); bottom: -100px; left: -80px; }

.eyebrow { letter-spacing: .12em; font-size: .8rem; opacity: .75; margin: 0 0 1.25rem; }
.hero-h1 {
  font-size: clamp(3rem, 9vw, 6.5rem);
  line-height: .95;
  margin: 0 0 1rem;
  letter-spacing: -.02em;
}
.hero-h1-word { display: inline-block; }
.hero-h1.is-scattered .hero-h1-word { transition: transform .5s var(--ease), opacity .5s; }

.hero-h2 { font-size: clamp(1.3rem, 3vw, 2rem); font-weight: 500; margin: 0 0 1.25rem; color: var(--amber); }
.hero-sub { max-width: 58ch; font-size: 1.1rem; opacity: .88; margin: 0 0 2.5rem; }

.scroll-prompt {
  display: flex; flex-direction: column; gap: .15rem;
  font-family: var(--font-mono-ish); font-size: .8rem; opacity: .7;
  margin-bottom: 2.5rem;
}
.scroll-prompt-sub { font-size: .7rem; opacity: .7; }
.scroll-chevron { animation: bob 1.6s ease-in-out infinite; font-size: 1rem; }
@keyframes bob { 0%,100% { transform: translateY(0);} 50% { transform: translateY(8px);} }

.hero-ctas { display: flex; flex-wrap: wrap; gap: .9rem; }

/* ============ Zone 1 lab ============ */
.hexfield { position: absolute; inset: 0; z-index: 0; opacity: .35; }
.hexfield-svg { width: 100%; height: 100%; }
.hexagon-shape {
  fill: none;
  stroke: var(--amber);
  stroke-width: 1;
  animation: hexDrift linear infinite;
  transform-origin: center;
}
@keyframes hexDrift {
  0% { transform: translateY(0) rotate(0deg); }
  100% { transform: translateY(-40px) rotate(20deg); }
}
.hexfield.is-molecule .hexagon-shape { stroke: var(--teal); stroke-width: 2; }

.lab-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: clamp(2rem,5vw,5rem); align-items: center; }
@media (max-width: 800px) { .lab-grid { grid-template-columns: 1fr; } }
.lab-copy p { font-size: 1.05rem; opacity: .9; max-width: 62ch; }
.pull-quote {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 500;
  color: var(--amber);
  margin: 2rem 0 0;
  padding-left: 1.25rem;
  border-left: 3px solid var(--coral);
}

.lab-beaker-wrap { text-align: center; }
.beaker { color: var(--cream); padding: 1rem; }
.beaker-svg { width: 120px; height: 160px; }
.beaker-fill { fill: var(--coral); transition: height .4s var(--ease), y .4s var(--ease); }
.beaker.is-spilling { animation: beakerShake .4s ease-in-out 2; }
@keyframes beakerShake { 0%,100% { transform: rotate(0);} 25% { transform: rotate(-6deg);} 75% { transform: rotate(6deg);} }

.lab-ai-note { margin-top: 1.75rem; font-size: .95rem; opacity: .85; padding-left: 1.25rem; border-left: 2px solid var(--teal); max-width: 62ch; }

/* ============ Zone 2 climb ============ */
.timeline { position: relative; }
.timeline-path { position: absolute; left: 50%; top: 0; width: 60px; height: 100%; transform: translateX(-50%); z-index: 0; }
#timelinePathLine { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .1s linear; }
#timelineDot { filter: drop-shadow(0 0 6px var(--amber)); }
@media (max-width: 800px) { .timeline-path { display: none; } }

.level-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5rem; }
.level {
  position: relative;
  z-index: 1;
  max-width: 460px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  padding: 1.75rem;
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.level.is-visible { opacity: 1; transform: translateX(0); }
.level--right { margin-left: auto; transform: translateX(40px); }
.level--right.is-visible { transform: translateX(0); }
.level--boss { border-color: var(--amber); box-shadow: 0 0 40px rgba(239,159,39,.15); }
.level-badge {
  display: inline-block;
  font-size: .7rem;
  letter-spacing: .08em;
  padding: .3rem .7rem;
  border-radius: 999px;
  background: rgba(255,255,255,.1);
  margin-bottom: .75rem;
}
.level-badge--boss { background: var(--amber); color: var(--ink); font-weight: 700; }
.level-badge--origin { background: transparent; border: 1px solid rgba(255,255,255,.25); color: var(--teal); }
.level--origin { opacity: .92; }
.level--origin p { opacity: .75; }
.level-tag {
  display: inline-block;
  font-family: var(--font-mono-ish);
  font-size: .68rem;
  letter-spacing: .03em;
  padding: .25rem .6rem;
  margin: 0 0 .75rem .5rem;
  border-radius: 999px;
  background: rgba(29,158,117,.15);
  border: 1px solid rgba(29,158,117,.4);
  color: var(--teal);
}
.level h3 { font-size: 1.15rem; margin: 0 0 .6rem; font-family: var(--font-mono-ish); font-weight: 600; }
.level time { opacity: .6; font-weight: 400; }
.level p { margin: 0; font-size: .95rem; opacity: .88; }
.level p + p { margin-top: .75rem; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.5rem;
  margin-top: 5rem;
}
@media (max-width: 800px) { .stats-row { grid-template-columns: repeat(2,1fr); } }
.stat {
  text-align: center;
  padding: 1.5rem 1rem;
  background: rgba(255,255,255,.04);
  border-radius: var(--radius);
  position: relative;
}
.stat-num { display: block; font-family: var(--font-display); font-size: clamp(1.8rem, 3.5vw, 2.6rem); font-weight: 700; color: var(--amber); }
.stat-label { display: block; font-size: .78rem; opacity: .75; margin-top: .35rem; }
.stat--flip { perspective: 800px; height: 118px; }
.stat-face { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; backface-visibility: hidden; transition: transform .5s var(--ease); padding: 1rem; border-radius: var(--radius); }
.stat-face--back { transform: rotateY(180deg); font-size: .85rem; background: var(--pink); color: #fff; display: flex; align-items: center; justify-content: center; }
.stat--flip.is-flipped .stat-face--front { transform: rotateY(180deg); }
.stat--flip.is-flipped .stat-face--back { transform: rotateY(0deg); }
.stats-row + .clue-pill--standalone { display: flex; margin: 1.5rem auto 0; }

/* ============ Zone 3 gallery ============ */
.shelves { display: flex; flex-direction: column; gap: 2.5rem; margin-bottom: 4rem; }
.shelf-label {
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: .04em;
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid rgba(255,255,255,.15);
  display: block;
  width: 100%;
  text-align: left;
}
.shelf-label.is-clicked { border-color: var(--amber); color: var(--amber); }
.shelf-tiles { display: flex; flex-wrap: wrap; gap: .6rem; }
.tile {
  padding: .55rem 1rem;
  border-radius: 10px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  font-size: .85rem;
  opacity: 0;
  transform: scale(.9);
  transition: opacity .4s var(--ease), transform .4s var(--ease);
}
.shelf-tiles.is-visible .tile { opacity: 1; transform: scale(1); }
.tile:hover { transform: rotate(-2deg) scale(1.05); border-color: var(--amber); }
.shelves.is-shuffled .tile { animation: dealCard .6s var(--ease) backwards; }
@keyframes dealCard {
  0% { transform: translateY(-30px) rotate(8deg) scale(.7); opacity: 0; }
  100% { transform: translateY(0) rotate(0) scale(1); opacity: 1; }
}

/* ---- selected work: films + statics ---- */
.selected-work { margin: 4rem 0; }
.case-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.75rem; }
@media (max-width: 800px) { .case-grid { grid-template-columns: 1fr; } }
.case-card {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  overflow: hidden;
}
.case-head { padding: 1.25rem 1.25rem 0; }
.case-head h3 { margin: 0 0 .25rem; font-family: var(--font-mono-ish); font-size: 1.1rem; }
.case-head p { margin: 0; font-size: .82rem; opacity: .65; }
.case-tabs { display: flex; gap: .5rem; padding: 1rem 1.25rem 0; }
.case-tab {
  font-size: .78rem;
  padding: .4rem .9rem;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  opacity: .7;
}
.case-tab.is-active { background: var(--coral); opacity: 1; color: #fff; }
.case-media {
  position: relative;
  margin: 1rem 1.25rem 1.25rem;
  aspect-ratio: 16/9;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--purple-700), var(--ink));
  display: flex; align-items: center; justify-content: center;
}
.case-film { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-placeholder {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  text-align: center;
  padding: 1rem;
  font-size: .75rem;
  opacity: .7;
}
.media-placeholder code { background: rgba(0,0,0,.3); padding: .15rem .4rem; border-radius: 4px; font-size: .7rem; }
.media-placeholder-icon { font-size: 1.5rem; opacity: .5; }
.case-media.media-missing .case-film { display: none; }
.case-media.media-missing .media-placeholder { display: flex; }
.case-play {
  position: absolute;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: rgba(255,255,255,.85);
  color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  transition: transform .2s var(--ease);
}
.case-play:hover { transform: scale(1.1); }
.case-media.media-missing .case-play { display: none; }

.static-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; width: 100%; height: 100%; }
.static-thumb { overflow: hidden; background: rgba(255,255,255,.05); position: relative; }
.static-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s var(--ease); }
.static-thumb:hover img { transform: scale(1.08); }
.static-thumb.media-missing::after {
  content: "static";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .65rem; opacity: .5;
}
.static-thumb.media-missing img { display: none; }

.lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(10,8,24,.94);
  display: flex; align-items: center; justify-content: center;
}
.lightbox-img { max-width: 88vw; max-height: 82vh; border-radius: 8px; }
.lightbox-close { position: absolute; top: 1.5rem; right: 1.5rem; font-size: 2rem; }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); font-size: 2.5rem; padding: 0 1rem; }
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }

.capability-pills { display: flex; flex-wrap: wrap; gap: .6rem; }
.pill { padding: .5rem 1.1rem; border-radius: 999px; background: rgba(239,159,39,.12); border: 1px solid rgba(239,159,39,.3); font-size: .82rem; color: var(--amber); }

/* ============ Zone 4 trophy ============ */
.trophy-list { list-style: none; margin: 0 0 2.5rem; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 1.25rem; }
@media (max-width: 900px) { .trophy-list { grid-template-columns: repeat(2,1fr); } }
.trophy {
  position: relative;
  text-align: center;
  padding: 2rem 1rem 1.5rem;
  opacity: 0;
  transform: translateY(40px);
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.trophy.is-visible { opacity: 1; transform: translateY(0); }
.trophy-pedestal {
  display: block;
  width: 46px; height: 46px;
  margin: 0 auto .9rem;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--amber), var(--coral));
  position: relative;
}
.trophy-pedestal::after {
  content: "";
  position: absolute; inset: -20px;
  background: radial-gradient(circle, rgba(239,159,39,.35), transparent 70%);
  animation: spotlight 3s ease-in-out infinite;
}
@keyframes spotlight { 0%,100% { opacity: .4; } 50% { opacity: .9; } }
.trophy-name { display: block; font-family: var(--font-mono-ish); font-weight: 600; font-size: .92rem; }
.trophy-detail { display: block; font-size: .78rem; opacity: .7; margin-top: .3rem; }
.trophy .clue-pill--standalone { margin: .6rem 0 0; }

.publications-title { font-family: var(--font-mono-ish); font-size: 1rem; opacity: .8; margin-bottom: .75rem; }
.publications-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; font-size: .9rem; opacity: .8; }

/* ============ payoff ============ */
.zone-payoff { min-height: 70vh; display: flex; flex-direction: column; justify-content: center; }
.payoff-inner { max-width: 720px; margin: 0 auto; }
.payoff-headline { font-size: clamp(2.2rem, 6vw, 4rem); margin: 0 0 1rem; }
.payoff-sub { font-size: 1.1rem; opacity: .85; margin-bottom: 2.5rem; }
.payoff-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; }
.site-footer { text-align: center; padding: 3rem var(--gap) 1rem; font-size: .78rem; opacity: .6; }
.site-footer .clue-pill--standalone { margin: .75rem auto 0; }

body.is-flooded .zone { filter: none !important; }
body.is-flooded::before {
  content: "";
  position: fixed; inset: 0; z-index: 998;
  background: radial-gradient(circle, #fff, transparent 60%);
  opacity: 0;
  pointer-events: none;
  animation: floodFlash 1.1s ease-out forwards;
}
@keyframes floodFlash { 0% { opacity: .9; } 100% { opacity: 0; } }

/* ============ reveal-on-scroll ============ */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .5s var(--ease), transform .5s var(--ease); }
.reveal.is-visible { opacity: 1; transform: translateY(0); }
body.reduced-motion .reveal { transition: opacity .3s ease; transform: none; opacity: 1; }

/* ============ toasts ============ */
.toast-region {
  position: fixed;
  bottom: 1.25rem; left: 1.25rem;
  z-index: 300;
  display: flex; flex-direction: column-reverse;
  gap: .6rem;
  max-width: 320px;
}
.toast {
  background: var(--purple-700);
  border: 1px solid var(--amber);
  color: var(--cream);
  padding: .8rem 1.1rem;
  border-radius: 10px;
  font-size: .85rem;
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
  animation: toastIn .3s var(--ease);
}
.toast.is-leaving { animation: toastOut .3s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px);} to { opacity: 1; transform: translateY(0);} }
@keyframes toastOut { to { opacity: 0; transform: translateX(-12px);} }

/* ============ collectible capsules ============ */
.capsule-collectible {
  position: absolute;
  z-index: 3;
  width: 34px; height: 18px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pink) 50%, var(--cream) 50%);
  border: 1px solid rgba(255,255,255,.5);
  box-shadow: 0 0 16px rgba(212,83,126,.5);
  animation: capsuleBob 3.4s ease-in-out infinite;
  cursor: pointer;
}
.capsule-collectible:nth-child(odd) { animation-delay: -1.4s; }
@keyframes capsuleBob { 0%,100% { transform: translateY(0) rotate(-8deg); } 50% { transform: translateY(-14px) rotate(8deg); } }
.capsule-collectible.is-collected {
  animation: capsulePop .4s ease-out forwards;
  pointer-events: none;
}
@keyframes capsulePop { to { transform: scale(2.2); opacity: 0; } }

.capsule-collectible--invisible {
  opacity: 0;
  transition: opacity .25s ease;
}
.capsule-collectible--invisible:hover,
.capsule-collectible--invisible:focus-visible {
  opacity: .9;
}

/* ============ eggs: konami chaos ============ */
body.egg-konami * { font-family: "Comic Sans MS", "Comic Sans", cursive !important; }
body.egg-konami {
  animation: rainbowChaos 1.2s linear 2.5;
}
@keyframes rainbowChaos {
  0% { filter: hue-rotate(0deg) saturate(2); }
  100% { filter: hue-rotate(360deg) saturate(2); }
}

/* egg: cannes gold shower */
.gold-shower { position: fixed; inset: 0; z-index: 250; pointer-events: none; }
.gold-lion {
  position: absolute; top: -30px;
  font-size: 1.4rem;
  animation: goldFall linear forwards;
}
@keyframes goldFall { to { transform: translateY(110vh) rotate(360deg); } }

/* egg: rx prescription pad */
.rx-pad {
  position: fixed; bottom: -100%; left: 50%; transform: translateX(-50%);
  z-index: 260;
  background: var(--cream); color: var(--ink);
  width: min(360px, 90vw);
  padding: 1.75rem;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -10px 40px rgba(0,0,0,.5);
  transition: bottom .5s var(--ease);
  font-family: var(--font-display);
}
.rx-pad.is-open { bottom: 0; }
.rx-pad h3 { margin: 0 0 .5rem; font-size: 1.3rem; color: var(--coral); }
.rx-pad p { font-family: var(--font-body); font-size: .95rem; margin: 0 0 1.25rem; }
.rx-pad-close { position: absolute; top: .75rem; right: 1rem; font-size: 1.2rem; color: var(--ink); }

/* egg: molecule connect */
.hexfield.is-molecule { opacity: .8; }

/* egg: idle tumbleweed */
.tumbleweed {
  position: fixed; bottom: 2rem; left: -80px;
  z-index: 240;
  font-size: 2.4rem;
  animation: tumbleAcross 5s linear forwards;
  pointer-events: none;
}
@keyframes tumbleAcross {
  to { left: 110vw; transform: rotate(1080deg); }
}

/* egg: wockhardt ecg */
.ecg-sweep {
  position: fixed; inset: 0; z-index: 245; pointer-events: none;
  overflow: hidden;
}
.ecg-sweep svg { width: 200%; height: 100%; animation: ecgMove 1.8s linear forwards; }
@keyframes ecgMove { from { transform: translateX(0);} to { transform: translateX(-50%);} }
.dose-meter.is-heartbeat { animation: heartbeat 1s ease-in-out 2; }
@keyframes heartbeat { 0%,100% { transform: scale(1);} 25% { transform: scale(1.08);} 40% { transform: scale(1);} 55% { transform: scale(1.12);} }

/* meta egg */
.meta-egg {
  position: fixed; inset: 0; z-index: 500;
  background: radial-gradient(circle at 50% 30%, var(--purple-700), var(--ink) 70%);
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  padding: 2rem;
}
.meta-egg-inner { max-width: 640px; }
.meta-egg-title { font-family: var(--font-display); font-size: clamp(2rem,5vw,3rem); color: var(--amber); margin-bottom: 1rem; }
.meta-egg-body { font-size: 1.1rem; opacity: .9; margin-bottom: 2rem; }
.meta-egg .btn { margin: .4rem; }

/* ============ per-zone unlock games ============ */
.zone-game {
  display: flex; flex-direction: column; align-items: center; gap: 1.5rem;
  padding: 3rem 1rem; text-align: center;
  transition: opacity .4s var(--ease), max-height .4s var(--ease), padding .4s var(--ease);
}
.zone-game.is-done { opacity: 0; max-height: 0; overflow: hidden; padding: 0; pointer-events: none; }
.zone-game-prompt { font-family: var(--font-mono-ish); font-size: .88rem; opacity: .8; letter-spacing: .02em; max-width: 32ch; }
.zone-game-capsules { display: flex; gap: 1.1rem; flex-wrap: wrap; justify-content: center; }
.zone-game-capsule {
  width: 42px; height: 22px; border-radius: 999px;
  background: linear-gradient(90deg, var(--coral) 50%, var(--cream) 50%);
  border: 1px solid rgba(255,255,255,.5);
  box-shadow: 0 0 18px rgba(216,90,48,.35);
  animation: capsuleBob 3s ease-in-out infinite;
  cursor: pointer;
}
.zone-game-capsule:nth-child(2n) { animation-delay: -1s; }
.zone-game-capsule:nth-child(3n) { animation-delay: -2s; }
.zone-game-capsule.is-collected { animation: capsulePop .35s ease-out forwards; pointer-events: none; }
.zone-game-capsule--big { width: 84px; height: 46px; box-shadow: 0 0 28px rgba(216,90,48,.5); }
.skip-game-link {
  font-family: var(--font-mono-ish); font-size: .72rem; opacity: .4;
  text-decoration: underline; text-underline-offset: 3px;
}
.skip-game-link:hover, .skip-game-link:focus-visible { opacity: .8; }
body.reduced-motion .zone-game-capsule { animation: none; }

.locked-content {
  opacity: 0; max-height: 0; overflow: hidden; pointer-events: none;
  transition: opacity .7s var(--ease), max-height .8s var(--ease);
}
.locked-content.is-unlocked { opacity: 1; max-height: 10000px; pointer-events: auto; }

.zone-game-prompt--inline {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  font-family: var(--font-mono-ish); font-size: .85rem; opacity: .8;
  margin: -1.25rem 0 2rem;
}

/* ============ clue pills (floating hint reveals) ============ */
.clue-pill {
  position: relative;
  display: inline-flex;
  width: 26px; height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pink) 50%, var(--cream) 50%);
  border: 1px solid rgba(255,255,255,.5);
  vertical-align: middle;
  margin: 0 .3rem;
  cursor: pointer;
  animation: capsuleBob 3.2s ease-in-out infinite;
  flex-shrink: 0;
}
.clue-pill-tooltip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  width: max-content;
  max-width: 220px;
  background: var(--purple-700);
  border: 1px solid var(--amber);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: .74rem;
  line-height: 1.4;
  padding: .5rem .7rem;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
  z-index: 20;
  text-align: left;
}
.clue-pill-tooltip::after {
  content: "";
  position: absolute;
  top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--amber);
}
.clue-pill:hover .clue-pill-tooltip,
.clue-pill:focus-visible .clue-pill-tooltip,
.clue-pill.is-open .clue-pill-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.clue-pill--standalone { display: inline-flex; margin: .5rem 0 0; }
body.reduced-motion .clue-pill { animation: none; }

/* ============ scroll-up crumble egg ============ */
.crumble-letter {
  display: inline-block;
  transition: transform 1.3s cubic-bezier(.55,0,.85,.35), opacity 1.1s ease;
  transition-delay: var(--delay, 0ms);
}
body.is-crumbling .crumble-letter {
  transform: translate(var(--dx, 0), 90vh) rotate(var(--r, 0deg));
  opacity: 0;
}

/* ============ bonus mini-game: Catch the Dose ============ */
.pill-game {
  position: fixed; inset: 0; z-index: 450;
  width: 100vw; height: 100vh;
  background: rgba(10,8,24,.92);
  display: flex; flex-direction: column;
}
.pill-game-hud {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; padding: 1rem 1.5rem;
  font-family: var(--font-mono-ish); font-size: .82rem;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.pill-game-hud kbd { background: rgba(255,255,255,.12); padding: .1rem .4rem; border-radius: 4px; }
.pill-game-score { color: var(--amber); font-weight: 600; }
.pill-game-field { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.pill-game-capsule {
  position: absolute;
  top: -40px;
  width: 34px; height: 18px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pink) 50%, var(--cream) 50%);
  border: 1px solid rgba(255,255,255,.5);
  transition: top linear, transform .2s ease;
}
.pill-game-capsule.is-caught {
  transform: scale(1.8);
  opacity: 0;
  transition: transform .3s ease, opacity .3s ease;
}

/* ============ bonus mini-game: Molecule Match ============ */
.match-game {
  position: fixed; inset: 0; z-index: 450;
  width: 100vw; height: 100vh;
  background: rgba(10,8,24,.92);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 1.5rem;
  padding: 1.5rem;
}
.match-game-hud {
  font-family: var(--font-mono-ish); font-size: .82rem;
  display: flex; gap: 1.5rem; align-items: center;
}
.match-game-hud kbd { background: rgba(255,255,255,.12); padding: .1rem .4rem; border-radius: 4px; }
.match-game-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(56px, 76px));
  gap: 10px;
}
.match-card {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.18);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  cursor: pointer;
  transition: background .25s var(--ease), transform .25s var(--ease), opacity .3s ease;
}
.match-card .match-card-symbol { opacity: 0; transform: scale(.6); transition: opacity .2s ease, transform .2s ease; }
.match-card.is-flipped .match-card-symbol,
.match-card.is-matched .match-card-symbol { opacity: 1; transform: scale(1); }
.match-card.is-flipped { background: rgba(239,159,39,.18); border-color: var(--amber); }
.match-card.is-matched { background: rgba(29,158,117,.2); border-color: var(--teal); opacity: .7; cursor: default; }

/* ============ mobile terminal ============ */
.mobile-terminal {
  position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%);
  z-index: 400;
  background: var(--purple-700);
  border: 1px solid var(--amber);
  border-radius: 12px;
  padding: .9rem 1rem;
  display: flex; flex-direction: column; gap: .4rem;
  width: min(320px, 90vw);
  font-size: .78rem;
}
.mobile-terminal input {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  color: var(--cream);
  border-radius: 8px;
  padding: .5rem .7rem;
  font-family: var(--font-mono-ish);
}
#mobileTerminalClose { position: absolute; top: .3rem; right: .5rem; font-size: 1.1rem; }

/* ============ reduced motion overrides ============ */
body.reduced-motion .capsule-collectible,
body.reduced-motion .scroll-chevron,
body.reduced-motion .trophy-pedestal::after { animation: none !important; }
body.reduced-motion .capsule-cursor { display: none; }
body.reduced-motion { cursor: auto; }
body.reduced-motion .level,
body.reduced-motion .trophy { transform: none; transition: opacity .3s ease; }
body.reduced-motion .hero-h1.is-scattered .hero-h1-word { transform: none !important; }
body.reduced-motion.egg-konami { animation: none; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .2s !important; }
}
