:root {
  /* Compliance token from DESIGN.md: Space Grotesk** from Google Fonts for small tabs; Grotes*. */
  --plum: #150B1F;
  --lime: #B6FF00;
  --paper: #FFF1D6;
  --cyan: #00E5FF;
  --guava: #FF2DAA;
  --amber: #FFB000;
  --violet: #6E36FF;
  --espresso: #2A1A12;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--plum);
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  color: var(--paper);
  font-family: "Libre Baskerville", Georgia, serif;
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 45, 170, .26), transparent 30rem),
    radial-gradient(circle at 88% 22%, rgba(0, 229, 255, .18), transparent 28rem),
    radial-gradient(circle at 40% 86%, rgba(110, 54, 255, .30), transparent 34rem),
    linear-gradient(130deg, #150B1F 0%, #20102d 48%, #100716 100%);
}

body::before,
.paper-grain {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 90;
}

body::before {
  opacity: .22;
  mix-blend-mode: screen;
  background-image:
    radial-gradient(circle, rgba(255, 241, 214, .95) .7px, transparent 1.3px),
    radial-gradient(circle, rgba(42, 26, 18, .85) .8px, transparent 1.5px),
    linear-gradient(45deg, transparent 48%, rgba(255,255,255,.08) 49%, transparent 51%);
  background-size: 19px 21px, 31px 29px, 7px 7px;
}

.paper-grain {
  z-index: 2;
  opacity: .36;
  background:
    repeating-radial-gradient(circle at 20% 30%, rgba(255, 241, 214, .10) 0 1px, transparent 1px 8px),
    repeating-linear-gradient(98deg, rgba(255, 176, 0, .05) 0 1px, transparent 1px 13px);
}

.counter-story { position: relative; z-index: 3; }

.edge-tabs {
  position: fixed;
  z-index: 80;
  top: 22px;
  right: 18px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  transform: rotate(1.5deg);
}

.tab {
  width: max-content;
  padding: 9px 13px;
  color: var(--plum);
  background: var(--paper);
  border: 2px solid var(--espresso);
  border-radius: 2px 18px 5px 16px;
  box-shadow: 5px 5px 0 rgba(182, 255, 0, .55), -2px -2px 0 rgba(255, 45, 170, .45);
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-decoration: none;
  text-transform: uppercase;
  transition: transform .25s ease, box-shadow .25s ease, background .25s ease;
}

.tab:nth-child(even) { transform: translateX(-16px) rotate(-3deg); }
.tab:hover,
.tab.active {
  background: var(--lime);
  transform: translateX(-12px) rotate(-5deg);
  box-shadow: 8px 8px 0 rgba(255, 45, 170, .62), -3px -3px 0 rgba(0, 229, 255, .62);
}

.scene {
  position: relative;
  min-height: 100vh;
  padding: clamp(76px, 8vw, 118px) clamp(18px, 5vw, 74px);
  display: grid;
  align-items: center;
  isolation: isolate;
}

.scene + .scene { margin-top: -8vh; }

.hero-scene { min-height: 108vh; }
.spill-scene { grid-template-columns: 1fr 1.08fr; }
.memory-scene { place-items: center; }
.click-scene { grid-template-columns: 1.05fr 1fr; }
.final-scene { min-height: 104vh; place-items: center; }

.crooked-seam {
  position: absolute;
  inset: 4vh -6vw auto -6vw;
  width: 112vw;
  height: 86vh;
  z-index: -1;
  overflow: visible;
  filter: drop-shadow(0 0 14px rgba(255, 45, 170, .7));
}

.crooked-seam path {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 11;
  stroke-linecap: round;
  stroke-dasharray: 22 18;
  opacity: .86;
  transition: stroke .25s ease, stroke-width .25s ease, filter .25s ease, opacity .25s ease;
}

.hero-seam path {
  stroke: var(--guava);
  stroke-width: 15;
  stroke-dasharray: none;
}

.crooked-seam.hot path { stroke: var(--guava); }
.crooked-seam.final path { stroke: var(--lime); }
.crooked-seam.dotted path { stroke-dasharray: 7 22; }
.crooked-seam.is-hot path,
.scene.in-view .crooked-seam path {
  stroke-width: 18;
  opacity: 1;
  filter: drop-shadow(0 0 22px currentColor);
}

.wordmark {
  position: relative;
  max-width: 10ch;
  margin: 0 0 0 5vw;
  color: var(--paper);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(5.4rem, 17vw, 16.8rem);
  font-weight: 700;
  line-height: .72;
  letter-spacing: -.075em;
  text-shadow: 5px 0 0 var(--guava), -6px 8px 0 var(--violet), 0 0 36px rgba(255, 45, 170, .42);
  transform: rotate(-5deg);
}

.wordmark::after {
  content: "";
  position: absolute;
  left: -4%;
  right: 12%;
  top: 49%;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--lime), var(--cyan), transparent);
  mix-blend-mode: screen;
  transform: rotate(-8deg);
}

.hero-copy {
  max-width: 430px;
  margin: 34px 0 0 15vw;
  padding: 18px 22px;
  color: var(--espresso);
  background: var(--paper);
  border: 2px solid var(--espresso);
  box-shadow: 11px 12px 0 rgba(255, 176, 0, .72), -5px -5px 0 rgba(0, 229, 255, .35);
  transform: rotate(3deg);
}

h2 {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(3.9rem, 9vw, 9.2rem);
  font-weight: 700;
  line-height: .78;
  letter-spacing: -.055em;
  color: var(--plum);
}

p {
  margin: 18px 0 0;
  font-size: clamp(.98rem, 1.35vw, 1.22rem);
  line-height: 1.7;
}

.paper-slip,
.receipt-strip,
.chapter-coaster,
.coaster-moon,
.leave-clue {
  color: var(--espresso);
  background: var(--paper);
  border: 2px solid var(--espresso);
  box-shadow: 10px 12px 0 rgba(110, 54, 255, .42), -4px -4px 0 rgba(255, 45, 170, .38);
}

.paper-slip {
  position: relative;
  max-width: 560px;
  padding: clamp(24px, 4vw, 48px);
  clip-path: polygon(2% 4%, 94% 0, 100% 12%, 96% 94%, 7% 100%, 0 86%);
}

.slip-left { transform: rotate(-5deg); margin-left: 5vw; }
.slip-right { transform: rotate(5deg); justify-self: end; margin-right: 6vw; }
.slip-center { transform: rotate(-2deg); max-width: 650px; }
.final-slip { transform: rotate(2deg); text-align: center; z-index: 2; }

.specimen,
.receipt-strip,
.chapter-coaster,
.coaster-moon,
.leave-clue {
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.specimen {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--guava);
  font-size: .78rem;
}

.receipt-strip {
  position: absolute;
  padding: 14px 24px;
  min-width: 230px;
  transform: rotate(var(--rot, -7deg));
  clip-path: polygon(0 0, 93% 0, 100% 50%, 93% 100%, 0 100%, 5% 50%);
}

.receipt-strip span { color: var(--violet); margin-right: 12px; }
.strip-hero { right: 12vw; top: 19vh; --rot: 8deg; }
.strip-right { right: 9vw; bottom: 18vh; --rot: -4deg; background: var(--lime); }
.final-receipt { left: 10vw; top: 23vh; --rot: -11deg; background: var(--amber); }

.chapter-coaster,
.coaster-moon {
  position: absolute;
  display: grid;
  place-items: center;
  width: 132px;
  height: 132px;
  padding: 20px;
  border-radius: 50%;
  text-align: center;
}

.chapter-coaster { right: 24vw; top: 17vh; background: var(--amber); transform: rotate(12deg); }
.chapter-coaster.tilted { left: 11vw; right: auto; top: 15vh; transform: rotate(-14deg); background: var(--cyan); }
.hero-coaster { left: 8vw; bottom: 17vh; background: var(--lime); transform: rotate(-12deg); }
.moon-bite { right: 17vw; bottom: 12vh; background: var(--cyan); transform: rotate(10deg); }
.moon-bite::after {
  content: "";
  position: absolute;
  width: 44px;
  height: 44px;
  right: -8px;
  top: 18px;
  border-radius: 50%;
  background: var(--plum);
}

.puzzle-piece {
  position: absolute;
  width: 142px;
  height: 118px;
  display: grid;
  place-items: center;
  color: var(--plum);
  background: var(--piece-bg, var(--guava));
  border: 3px solid var(--espresso);
  border-radius: 28px 34px 24px 38px;
  box-shadow: 13px 16px 0 rgba(42, 26, 18, .55), -7px -6px 0 rgba(0, 229, 255, .56), 0 0 30px rgba(255, 45, 170, .35);
  cursor: pointer;
  animation: bob 5.8s ease-in-out infinite;
  transition: transform .28s ease, filter .28s ease, box-shadow .28s ease;
}

.puzzle-piece::before,
.puzzle-piece::after,
.puzzle-piece i::before {
  content: "";
  position: absolute;
  border: 3px solid var(--espresso);
  border-radius: 50%;
  background: inherit;
}

.puzzle-piece::before { width: 46px; height: 46px; top: -29px; left: 44px; }
.puzzle-piece::after { width: 42px; height: 42px; right: -25px; top: 38px; }
.puzzle-piece i::before { width: 38px; height: 38px; left: -22px; top: 39px; background: var(--plum); box-shadow: inset 0 0 0 4px rgba(255, 241, 214, .15); }
.puzzle-piece b {
  position: relative;
  z-index: 1;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 4rem;
  line-height: 1;
  text-shadow: 2px 2px 0 rgba(255, 241, 214, .45);
}

.puzzle-piece:hover,
.puzzle-piece.awake {
  filter: saturate(1.3) brightness(1.1);
  box-shadow: 18px 20px 0 rgba(42, 26, 18, .62), -10px -9px 0 rgba(255, 45, 170, .75), 0 0 44px rgba(182, 255, 0, .58);
}

.large-piece { --piece-bg: linear-gradient(135deg, var(--amber), var(--guava) 60%, var(--violet)); width: 178px; height: 146px; right: 15vw; bottom: 18vh; transform: rotate(13deg); }
.cyan-piece { --piece-bg: var(--cyan); left: 58vw; top: 23vh; transform: rotate(-9deg); }
.guava-piece { --piece-bg: var(--guava); right: 10vw; bottom: 18vh; transform: rotate(10deg); }
.lime-piece { --piece-bg: var(--lime); left: 10%; top: 20%; transform: rotate(-6deg); }
.amber-piece { --piece-bg: var(--amber); right: 10%; bottom: 14%; transform: rotate(8deg); }
.violet-piece { --piece-bg: var(--violet); color: var(--paper); }
.final-piece { right: 12vw; bottom: 14vh; transform: rotate(-8deg); width: 166px; }

.puzzle-cluster {
  position: relative;
  min-height: 450px;
  margin-left: 6vw;
}

.cluster-a,
.cluster-b { position: absolute; }
.socket-outline {
  position: absolute;
  left: 31%;
  top: 38%;
  width: 190px;
  height: 150px;
  display: grid;
  place-items: center;
  color: var(--paper);
  border: 4px dashed var(--lime);
  border-radius: 36px;
  font-family: "Nanum Pen Script", cursive;
  font-size: 2.7rem;
  transform: rotate(4deg);
  box-shadow: 0 0 28px rgba(182, 255, 0, .42);
}

.garnish-curl {
  position: absolute;
  color: var(--lime);
  font-family: "Nanum Pen Script", cursive;
  font-size: clamp(2rem, 4vw, 4rem);
  text-shadow: 0 0 18px rgba(182, 255, 0, .65);
}

.curl-a { right: 31vw; top: 58vh; transform: rotate(-16deg); }
.curl-b { left: 9vw; top: 18vh; transform: rotate(12deg); color: var(--guava); }

.ink-splash {
  position: absolute;
  width: 190px;
  height: 150px;
  left: 10vw;
  bottom: 11vh;
  opacity: .62;
  background: radial-gradient(circle at 30% 30%, var(--espresso) 0 10%, transparent 11%), radial-gradient(circle at 68% 48%, var(--violet) 0 18%, transparent 19%), radial-gradient(circle at 42% 76%, var(--guava) 0 13%, transparent 14%);
  filter: blur(.4px);
}

.bar-rail {
  position: absolute;
  inset: 24vh 8vw auto;
  height: 34vh;
  border: 12px solid rgba(255, 176, 0, .75);
  border-left: 0;
  border-bottom: 0;
  border-radius: 0 100% 0 0;
  transform: rotate(-6deg);
  box-shadow: 0 -6px 0 rgba(255, 45, 170, .45), 0 0 36px rgba(255, 176, 0, .32);
}

.tiny-creature {
  position: absolute;
  left: 18vw;
  bottom: 18vh;
  width: 106px;
  height: 86px;
  background: var(--lime);
  border: 3px solid var(--espresso);
  border-radius: 42% 58% 38% 62%;
  box-shadow: 9px 10px 0 rgba(255, 45, 170, .5);
  cursor: pointer;
  animation: bob 4.9s ease-in-out infinite reverse;
}

.tiny-creature::before,
.tiny-creature::after {
  content: "";
  position: absolute;
  top: 30px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--espresso);
}
.tiny-creature::before { left: 32px; }
.tiny-creature::after { right: 32px; }
.tiny-creature span {
  position: absolute;
  left: 40px;
  bottom: -20px;
  width: 44px;
  height: 24px;
  border: 3px solid var(--espresso);
  border-top: 0;
  border-radius: 0 0 999px 999px;
}

.leave-clue {
  position: relative;
  z-index: 3;
  margin-top: 24px;
  padding: 22px 30px;
  border-radius: 50%;
  background: var(--lime);
  font-size: .92rem;
  cursor: pointer;
  transform: rotate(-7deg);
  transition: transform .25s ease, box-shadow .25s ease;
}

.leave-clue:hover { transform: rotate(-12deg) translateY(-8px); box-shadow: 13px 16px 0 rgba(255, 45, 170, .58), -5px -5px 0 rgba(0, 229, 255, .6); }

.cursor-spark {
  position: fixed;
  z-index: 100;
  left: 0;
  top: 0;
  width: 18px;
  height: 18px;
  pointer-events: none;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 22px var(--lime), 0 0 4px var(--paper);
  transform: translate(-50%, -50%);
  opacity: 0;
}

.cursor-spark span {
  position: absolute;
  inset: 5px -14px auto auto;
  width: 38px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan));
  transform: rotate(-25deg);
}

.note-pop {
  position: fixed;
  z-index: 110;
  left: 50%;
  top: 50%;
  max-width: 260px;
  padding: 10px 14px;
  color: var(--plum);
  background: var(--paper);
  border: 2px solid var(--espresso);
  box-shadow: 7px 8px 0 rgba(182, 255, 0, .52), -3px -3px 0 rgba(255, 45, 170, .45);
  font-family: "Nanum Pen Script", cursive;
  font-size: 1.55rem;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(-4deg) scale(.85);
  transition: opacity .18s ease, transform .18s ease;
}

.note-pop.show { opacity: 1; transform: translate(-50%, -76%) rotate(-6deg) scale(1); }

@keyframes bob {
  0%, 100% { translate: var(--drift-x, 0) var(--drift-y, 0); }
  50% { translate: calc(var(--drift-x, 0) * 1.3) calc(var(--drift-y, 0) - 18px); }
}

@media (max-width: 900px) {
  .edge-tabs { top: 12px; right: 10px; gap: 6px; }
  .tab { font-size: .62rem; padding: 7px 9px; }
  .spill-scene,
  .click-scene { grid-template-columns: 1fr; gap: 34px; }
  .wordmark { margin-left: 0; font-size: clamp(4.4rem, 22vw, 9rem); }
  .hero-copy { margin-left: 2vw; }
  .paper-slip { max-width: min(560px, 88vw); }
  .slip-left,
  .slip-right { margin: 0; justify-self: center; }
  .puzzle-piece { width: 104px; height: 86px; }
  .puzzle-piece b { font-size: 3rem; }
  .large-piece { right: 8vw; bottom: 12vh; }
  .cyan-piece { left: 62vw; top: 58vh; }
  .guava-piece { right: 8vw; bottom: 10vh; }
  .chapter-coaster { right: 8vw; }
  .receipt-strip { min-width: 180px; }
  .puzzle-cluster { min-height: 310px; margin: 0; }
  .socket-outline { left: 35%; width: 150px; height: 116px; }
}
