:root {
  /* design tokens: IBM Plex Mono** for coordinates; Space Mono** for `bunnygirl.quest`; lantern tiles unfold under it. The typewriter-effect should be gentle and ceremonial. */
  --lantern-amber: #F6B44B;
  --honey-parchment: #FFE6B8;
  --cinnamon-clay: #B96A3C;
  --cocoa-night: #241A2E;
  --moon-cream: #FFF8E7;
  --star-violet: #8E6CFF;
  --rose-quartz: #F6A7C8;
  --mono-display: "Space Mono", "Courier New", monospace;
  --mono-quest: "IBM Plex Mono", "Courier New", monospace;
  --narrative: "Nunito Sans", system-ui, sans-serif;
  --hand: "Yomogi", cursive;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--cocoa-night);
  color: var(--moon-cream);
  font-family: var(--narrative);
  overflow-x: hidden;
}

.design-keywords { display: none; }

.quest-stage {
  position: relative;
  min-height: 500vh;
  background:
    radial-gradient(circle at 24% 8%, rgba(246, 167, 200, .20), transparent 28rem),
    radial-gradient(circle at 86% 48%, rgba(142, 108, 255, .18), transparent 32rem),
    linear-gradient(135deg, #241A2E 0%, #2d1d2a 42%, #3b241f 100%);
}

.grain,
.grain::after {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 4;
  opacity: .17;
  background-image:
    linear-gradient(30deg, rgba(255,248,231,.06) 12%, transparent 12.5%, transparent 87%, rgba(255,248,231,.06) 87.5%),
    linear-gradient(150deg, rgba(255,230,184,.05) 12%, transparent 12.5%, transparent 87%, rgba(255,230,184,.05) 87.5%);
  background-size: 18px 31px;
  mix-blend-mode: overlay;
  content: "";
}

.motes {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.mote {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--honey-parchment);
  box-shadow: 0 0 12px var(--lantern-amber);
  opacity: .45;
  animation: drift 12s linear infinite;
}

@keyframes drift {
  from { transform: translate3d(0, 12vh, 0); }
  to { transform: translate3d(8vw, -112vh, 0); }
}

.route-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

#routePath {
  fill: none;
  stroke: var(--lantern-amber);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 18 24;
  filter: drop-shadow(0 0 12px rgba(246,180,75,.65));
  animation: routePulse 3.8s ease-in-out infinite;
}

@keyframes routePulse {
  50% { stroke: var(--rose-quartz); filter: drop-shadow(0 0 18px rgba(246,167,200,.65)); }
}

.star-nav {
  position: fixed;
  right: 2rem;
  top: 50%;
  transform: translateY(-50%) rotate(-18deg);
  z-index: 10;
  display: grid;
  gap: 1rem;
}

.nav-star {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--cocoa-night);
  text-decoration: none;
  background: var(--honey-parchment);
  clip-path: polygon(50% 0, 62% 34%, 100% 35%, 69% 56%, 80% 96%, 50% 72%, 20% 96%, 31% 56%, 0 35%, 38% 34%);
  filter: drop-shadow(0 0 10px rgba(246,180,75,.35));
  transition: transform .5s ease, background .5s ease;
}

.nav-star span {
  font: 600 .52rem var(--mono-quest);
  transform: rotate(18deg);
}

.nav-star.active {
  background: var(--lantern-amber);
  transform: translateX(-12px) scale(1.18);
}

.quest-panel {
  min-height: 100vh;
  position: relative;
  display: grid;
  place-items: center;
  padding: 8vh 8vw;
  z-index: 2;
}

.diagonal-wrap {
  position: relative;
  width: min(1120px, 86vw);
  min-height: 68vh;
  transform: rotate(-3deg);
}

.offset-right { transform: translateX(7vw) rotate(-3deg); }
.offset-left { transform: translateX(-8vw) rotate(-3deg); }
.low { min-height: 72vh; }

.chapter-label {
  margin: 0 0 1rem;
  color: var(--lantern-amber);
  font: 600 .78rem var(--mono-quest);
  letter-spacing: .18em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.02;
  font-family: var(--mono-display);
  font-weight: 700;
}

h1 {
  min-height: 1.25em;
  font-size: clamp(2.4rem, 8vw, 7.6rem);
  letter-spacing: .08em;
  color: var(--moon-cream);
  text-shadow: 0 0 28px rgba(246,180,75,.22);
}

h2 { font-size: clamp(2rem, 5vw, 4.8rem); }

p { font-size: clamp(1rem, 1.45vw, 1.22rem); line-height: 1.8; }

.hero-copy {
  position: absolute;
  left: 18%;
  top: 18%;
  width: min(760px, 72vw);
}

.field-note,
.final-note {
  max-width: 670px;
  color: rgba(255,248,231,.82);
  font-family: var(--mono-quest);
}

.caret {
  display: inline-block;
  width: .08em;
  height: .78em;
  margin-left: .08em;
  background: var(--rose-quartz);
  box-shadow: 0 0 18px var(--rose-quartz);
  animation: blink 1.2s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.tile-stack {
  position: absolute;
  width: 280px;
  height: 220px;
  transform-style: preserve-3d;
  transition: transform .9s cubic-bezier(.2,.8,.2,1);
  filter: drop-shadow(36px 46px 28px rgba(0,0,0,.34));
}

.tile-stack.rotated { transform: rotate(5deg) scale(1.03); }

.tile-top {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(255,248,231,.35), transparent 36%),
    repeating-linear-gradient(45deg, rgba(185,106,60,.12) 0 2px, transparent 2px 26px),
    var(--honey-parchment);
  border: 2px solid var(--lantern-amber);
  transform: rotate(45deg) skew(-10deg, -10deg);
  border-radius: 28px;
}

.tile-side {
  position: absolute;
  background: var(--cinnamon-clay);
  opacity: .88;
  filter: brightness(.82);
}

.tile-side.left {
  width: 226px;
  height: 44px;
  left: 0;
  bottom: 7px;
  transform: rotate(35deg) skewX(46deg);
  border-radius: 0 0 18px 18px;
}

.tile-side.right {
  width: 226px;
  height: 44px;
  right: 0;
  bottom: 7px;
  transform: rotate(-35deg) skewX(-46deg);
  border-radius: 0 0 18px 18px;
}

.moon-gate { left: 3%; top: 20%; animation: unfold 1.4s cubic-bezier(.2,.9,.2,1) both; }

@keyframes unfold {
  from { opacity: 0; transform: translateY(70px) scale(.7) rotate(-10deg); }
  to { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}

.rabbit-compass {
  position: relative;
  width: 94px;
  height: 94px;
  border: 4px solid var(--star-violet);
  border-radius: 50%;
  box-shadow: 0 0 24px rgba(142,108,255,.35);
}

.rabbit-compass i {
  position: absolute;
  width: 28px;
  height: 78px;
  bottom: 58px;
  border: 4px solid var(--rose-quartz);
  border-bottom: 0;
  border-radius: 50% 50% 0 0;
  transform-origin: bottom center;
}

.rabbit-compass i:first-child { left: 17px; transform: rotate(-16deg); }
.rabbit-compass i:last-child { right: 17px; transform: rotate(16deg); }

.route-spark {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--lantern-amber);
  box-shadow: 0 0 22px 9px rgba(246,180,75,.42);
  animation: twinkle 2.2s ease-in-out infinite;
}

@keyframes twinkle { 50% { transform: scale(1.45); opacity: .55; } }

.map-tab {
  position: absolute;
  right: 12%;
  bottom: 16%;
  border: 0;
  padding: 1rem 1.35rem;
  font: 600 .82rem var(--mono-quest);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--cocoa-night);
  background: var(--lantern-amber);
  border-radius: 999px 999px 999px 12px;
  box-shadow: 0 14px 38px rgba(246,180,75,.28);
  cursor: pointer;
}

body.lantern-on .quest-stage { background: radial-gradient(circle at 50% 18%, rgba(246,180,75,.30), transparent 32rem), linear-gradient(135deg, #241A2E 0%, #3d2627 100%); }

.bridge {
  position: absolute;
  width: 430px;
  height: 96px;
  left: 7%;
  top: 45%;
  background: repeating-linear-gradient(90deg, transparent 0 32px, rgba(255,248,231,.22) 32px 36px), var(--cinnamon-clay);
  transform: rotate(29deg) skewX(-30deg);
  border: 2px dashed rgba(255,230,184,.42);
  box-shadow: 28px 42px 32px rgba(0,0,0,.25);
}

.vellum-slip,
.scroll-ribbon,
.observatory-note {
  position: absolute;
  padding: clamp(1.4rem, 3vw, 2.6rem);
  background: rgba(255,230,184,.92);
  color: var(--cocoa-night);
  border: 2px solid rgba(185,106,60,.55);
  box-shadow: 26px 34px 0 rgba(185,106,60,.25), 0 22px 80px rgba(0,0,0,.26);
}

.vellum-slip { right: 8%; top: 12%; width: min(560px, 72vw); transform: rotate(4deg); }
.scroll-ribbon { left: 5%; bottom: 9%; width: min(560px, 72vw); transform: rotate(-2deg); }
.observatory-note { left: 8%; top: 8%; width: min(610px, 74vw); transform: rotate(3deg); }

.vellum-slip h2,
.scroll-ribbon h2,
.observatory-note h2 { color: var(--cocoa-night); }

.lantern-cube {
  position: absolute;
  left: 18%;
  top: 18%;
  width: 112px;
  height: 112px;
  transform: rotate(45deg) skew(-12deg, -12deg);
  background: radial-gradient(circle, var(--moon-cream), var(--lantern-amber) 55%, var(--cinnamon-clay));
  border: 2px solid var(--honey-parchment);
  box-shadow: 0 0 52px rgba(246,180,75,.55), 34px 48px 26px rgba(0,0,0,.24);
  cursor: pointer;
  transition: transform .8s ease;
  animation: lanternFlicker 2.8s ease-in-out infinite;
}

.lantern-cube.rotated { transform: rotate(95deg) skew(-12deg, -12deg) scale(1.08); }

@keyframes lanternFlicker { 45% { filter: brightness(1.12); } 55% { filter: brightness(.92); } }

.star-pin {
  position: absolute;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--lantern-amber);
  border: 4px solid var(--moon-cream);
  box-shadow: 0 0 0 7px rgba(246,180,75,.15), 0 0 22px var(--lantern-amber);
}

.pin-one { right: 43%; bottom: 18%; }
.pin-two { right: 24%; bottom: 34%; background: var(--star-violet); box-shadow: 0 0 0 7px rgba(142,108,255,.16), 0 0 22px var(--star-violet); }

.inventory-ledge { right: 6%; top: 10%; }
.tile-stack.large { width: 420px; height: 310px; }
.tile-stack.wide { width: 560px; height: 330px; left: 50%; top: 20%; transform: translateX(-50%); }

.inventory-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .8rem;
  transform: rotate(-45deg) skew(10deg, 10deg);
  font: 600 .75rem var(--mono-quest);
  color: var(--cocoa-night);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.inventory-grid span {
  padding: .75rem;
  border: 1px dashed var(--cinnamon-clay);
  background: rgba(255,248,231,.48);
  border-radius: 999px;
}

.constellation {
  position: absolute;
  right: 7%;
  bottom: 6%;
  width: min(420px, 48vw);
  overflow: visible;
}

.constellation-path {
  fill: none;
  stroke: var(--moon-cream);
  stroke-width: 2;
  stroke-dasharray: 520;
  stroke-dashoffset: 520;
  transition: stroke-dashoffset 1.8s ease;
}

.quest-panel.active .constellation-path { stroke-dashoffset: 0; }

.constellation circle {
  fill: var(--star-violet);
  stroke: var(--moon-cream);
  stroke-width: 3;
  cursor: pointer;
  filter: drop-shadow(0 0 10px rgba(142,108,255,.8));
}

.observatory { right: 11%; bottom: 10%; }
.moon-disc { width: 96px; height: 96px; border-radius: 50%; background: var(--moon-cream); box-shadow: 0 0 32px rgba(255,248,231,.55); }
.scope-line { position: absolute; width: 180px; height: 2px; background: var(--star-violet); transform: rotate(-18deg); }
.hand-note { position: absolute; right: 21%; top: 22%; color: var(--rose-quartz); font: 1.45rem var(--hand); transform: rotate(-12deg); }

.finale-wrap { text-align: center; }
.horizon-platform .tile-top { background: linear-gradient(135deg, var(--honey-parchment), var(--lantern-amber)); }
.horizon-platform h2 { transform: rotate(-45deg) skew(10deg, 10deg); color: var(--cocoa-night); font-size: clamp(1.7rem, 5vw, 4rem); letter-spacing: .08em; }
.solved-pin { position: absolute; width: 18px; height: 18px; border-radius: 50%; background: var(--lantern-amber); left: 24%; top: 31%; box-shadow: 0 0 18px var(--lantern-amber); }
.solved-pin.violet { background: var(--star-violet); left: 68%; top: 34%; box-shadow: 0 0 18px var(--star-violet); }
.solved-pin.rose { background: var(--rose-quartz); left: 53%; top: 70%; box-shadow: 0 0 18px var(--rose-quartz); }
.final-note { position: absolute; left: 50%; bottom: 12%; transform: translateX(-50%); width: min(640px, 76vw); }

.quest-panel .vellum-slip,
.quest-panel .scroll-ribbon,
.quest-panel .observatory-note,
.quest-panel .tile-stack,
.quest-panel .lantern-cube,
.quest-panel .bridge,
.quest-panel .constellation,
.quest-panel .hand-note {
  opacity: .25;
  transition: opacity .9s ease, transform .9s cubic-bezier(.2,.8,.2,1);
}

.quest-panel.active .vellum-slip,
.quest-panel.active .scroll-ribbon,
.quest-panel.active .observatory-note,
.quest-panel.active .tile-stack,
.quest-panel.active .lantern-cube,
.quest-panel.active .bridge,
.quest-panel.active .constellation,
.quest-panel.active .hand-note { opacity: 1; }

.clue-pop {
  position: fixed;
  z-index: 20;
  max-width: 270px;
  padding: .9rem 1rem;
  background: var(--cocoa-night);
  color: var(--honey-parchment);
  border: 1px solid var(--lantern-amber);
  border-radius: 18px 18px 18px 4px;
  font: .78rem/1.6 var(--mono-quest);
  box-shadow: 0 20px 50px rgba(0,0,0,.35);
  opacity: 0;
  transform: translate(-50%, -130%) scale(.94);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}

.clue-pop.show { opacity: 1; transform: translate(-50%, -150%) scale(1); }

@media (max-width: 760px) {
  .star-nav { right: .7rem; gap: .55rem; }
  .diagonal-wrap, .offset-right, .offset-left { width: 94vw; transform: rotate(-2deg); }
  .hero-copy { left: 3%; top: 10%; width: 88vw; }
  .moon-gate { left: -10%; top: 46%; }
  .tile-stack.large, .tile-stack.wide { width: 320px; height: 240px; }
  .vellum-slip, .scroll-ribbon, .observatory-note { left: 2%; right: auto; width: 84vw; }
  .constellation { right: 8%; bottom: 4%; width: 72vw; }
}
