:root {
  --curtain-night: #090716;
  --second-indigo: #4936E8;
  --understudy-violet: #8C4CFF;
  --pearl-retry: #E9F1FF;
  --encore-cyan: #43D6D1;
  --wax-red: #D84B6A;
  --manual-ochre: #B99A58;
  --ink: rgba(233, 241, 255, 0.86);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--pearl-retry);
  font-family: "Fraunces", serif;
  background:
    radial-gradient(circle at 14% 86%, rgba(73, 54, 232, 0.28), transparent 28rem),
    radial-gradient(circle at 78% 14%, rgba(140, 76, 255, 0.2), transparent 26rem),
    linear-gradient(115deg, #090716 0%, #100b2a 48%, #090716 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(233,241,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(233,241,255,0.025) 1px, transparent 1px);
  background-size: 46px 46px, 46px 46px;
  mix-blend-mode: screen;
  opacity: 0.28;
  z-index: 2;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  opacity: 0.18;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(233, 241, 255, 0.55) 0 1px, transparent 1px),
    radial-gradient(circle at 40% 70%, rgba(185, 154, 88, 0.45) 0 1px, transparent 1px),
    radial-gradient(circle at 80% 30%, rgba(67, 214, 209, 0.35) 0 1px, transparent 1px);
  background-size: 17px 19px, 23px 29px, 31px 37px;
}

.stage-light {
  position: fixed;
  width: 44vw;
  height: 44vw;
  border-radius: 50%;
  filter: blur(32px);
  pointer-events: none;
  opacity: 0.25;
  z-index: 0;
}

.stage-light-one { left: -20vw; top: 18vh; background: #4936E8; }
.stage-light-two { right: -18vw; bottom: 4vh; background: #8C4CFF; }

.quest-stage { position: relative; z-index: 1; }

.scene {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  padding: clamp(2rem, 5vw, 5rem);
  display: grid;
  align-items: center;
  isolation: isolate;
  border-bottom: 1px dashed rgba(233, 241, 255, 0.12);
}

.scene::before,
.scene::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: -1;
}

.scene::before {
  inset: 5vw;
  border: 1px solid rgba(185, 154, 88, 0.18);
  transform: translate(12px, -8px);
}

.scene::after {
  inset: 4vw 7vw;
  background: linear-gradient(90deg, transparent, rgba(233,241,255,0.04), transparent);
  clip-path: polygon(0 0, 92% 6%, 100% 90%, 9% 100%);
}

.eyebrow,
.slot-label,
.story-cta,
.caption-first,
.caption-second {
  font-family: "DM Sans", sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2 {
  font-family: "Bungee Shade", display;
  font-weight: 400;
  line-height: 0.95;
  margin: 0;
  color: var(--pearl-retry);
  position: relative;
  text-shadow: 0 0 18px rgba(67, 214, 209, 0.28);
}

h1::before,
h2::before {
  content: attr(data-shadow);
  position: absolute;
  inset: 0;
  color: var(--understudy-violet);
  transform: translate(0.08em, 0.09em);
  opacity: 0.42;
  z-index: -1;
}

h1 { font-size: clamp(3.1rem, 11vw, 10rem); max-width: 11ch; }
h2 { font-size: clamp(2.2rem, 6vw, 6.5rem); max-width: 11ch; }

p { font-size: clamp(1.04rem, 1.8vw, 1.55rem); line-height: 1.55; color: var(--ink); }

.eyebrow { color: var(--encore-cyan); font-size: 0.78rem; font-weight: 700; }

.second-path {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 8;
}

.path-segment {
  position: absolute;
  display: block;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, transparent, #43D6D1, #8C4CFF, transparent);
  box-shadow: 0 0 16px #43D6D1;
  border-radius: 99px;
  transition: width 900ms ease;
}

.segment-one { left: 4vw; bottom: 14vh; transform: rotate(-16deg); max-width: 31vw; }
.segment-two { left: 26vw; bottom: 31vh; transform: rotate(49deg); max-width: 24vw; transition-delay: 120ms; }
.segment-three { left: 41vw; top: 35vh; transform: rotate(-31deg); max-width: 37vw; transition-delay: 240ms; }
.segment-four { right: -2vw; top: 44vh; transform: rotate(8deg); max-width: 30vw; transition-delay: 360ms; }
.path-segment.drawn { width: min(34vw, var(--segment-width, 34vw)); }
.segment-one.drawn { --segment-width: 31vw; }
.segment-two.drawn { --segment-width: 24vw; }
.segment-three.drawn { --segment-width: 37vw; }
.segment-four.drawn { --segment-width: 30vw; }

.path-spark {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #43D6D1;
  box-shadow: 0 0 18px #43D6D1, 0 0 32px #4936E8;
  animation: blinkTwice 3s infinite;
}
.spark-one { left: 19vw; bottom: 20vh; }
.spark-two { left: 48vw; top: 39vh; animation-delay: 0.8s; }
.spark-three { right: 9vw; top: 45vh; animation-delay: 1.6s; }

.save-room { grid-template-columns: 1.2fr 0.8fr; gap: 2rem; background: radial-gradient(circle at 76% 60%, rgba(73,54,232,0.34), transparent 23rem); }
.title-stack { align-self: end; max-width: 58rem; }
.opening-copy { max-width: 47rem; }

.moon-pair {
  position: absolute;
  top: 8vh;
  right: 10vw;
  width: 10rem;
  height: 7rem;
}
.moon-pair span {
  position: absolute;
  width: 5.5rem;
  height: 5.5rem;
  border-radius: 50%;
  border: 2px solid #E9F1FF;
  box-shadow: inset -16px 0 0 rgba(67, 214, 209, 0.18), 0 0 22px rgba(233,241,255,0.2);
}
.moon-pair span:nth-child(2) { left: 3.1rem; top: 1.2rem; border-color: #8C4CFF; opacity: 0.66; }

.save-slots {
  display: grid;
  gap: 1.25rem;
  align-self: center;
  justify-self: end;
  width: min(26rem, 100%);
  perspective: 900px;
}

button { font: inherit; }

.save-slot {
  position: relative;
  min-height: 9rem;
  padding: 1.2rem;
  color: var(--pearl-retry);
  background: rgba(9, 7, 22, 0.72);
  border: 1px solid rgba(233, 241, 255, 0.22);
  box-shadow: inset 0 0 0 2px rgba(185,154,88,0.12), 0 18px 50px rgba(0,0,0,0.35);
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 360ms ease, box-shadow 360ms ease, border-color 360ms ease;
}
.save-slot:hover { transform: translateY(-8px) rotateX(4deg); }
.slot-one { opacity: 0.48; filter: grayscale(0.45); }
.slot-two { border-color: #43D6D1; box-shadow: 0 0 28px rgba(67,214,209,0.34), inset 0 0 32px rgba(73,54,232,0.42); animation: savePulse 2.8s infinite; }
.slot-label { display: block; font-size: 0.75rem; color: var(--manual-ochre); }
.slot-sigil { display: block; margin-top: 0.45rem; font-family: "Averia Serif Libre", serif; font-size: 4rem; }
.slot-glow { position: absolute; inset: 18%; border: 2px solid rgba(67,214,209,0.52); filter: blur(8px); }
.scratch { position: absolute; left: 12%; right: 10%; top: 50%; height: 4px; background: #D84B6A; transform: rotate(-12deg); }
.scratch-b { transform: rotate(10deg); top: 55%; }

.drawer-note {
  position: absolute;
  right: 8vw;
  bottom: 10vh;
  max-width: 25rem;
  padding: 1rem 1.2rem;
  color: #090716;
  background: #E9F1FF;
  border: 2px solid #B99A58;
  font-family: "Averia Serif Libre", serif;
  font-size: 1.15rem;
  transform: translateY(130%) rotate(-2deg);
  transition: transform 700ms cubic-bezier(.2,.9,.2,1.1);
  box-shadow: 10px 10px 0 rgba(216,75,106,0.55);
}
.drawer-note.open { transform: translateY(0) rotate(-2deg); }

.story-cta {
  width: max-content;
  border: 1px solid #43D6D1;
  background: rgba(67,214,209,0.08);
  color: #E9F1FF;
  padding: 0.9rem 1.15rem;
  cursor: pointer;
  box-shadow: 6px 6px 0 rgba(140,76,255,0.36);
  transition: transform 260ms ease, background 260ms ease;
}
.story-cta:hover { transform: translate(-3px, -3px); background: rgba(67,214,209,0.18); }

.understudy-lantern {
  position: fixed;
  left: 5vw;
  bottom: 8vh;
  z-index: 12;
  width: 3.8rem;
  height: 5.4rem;
  display: grid;
  place-items: center;
  color: #090716;
  font-family: "Averia Serif Libre", serif;
  font-weight: 700;
  background: #43D6D1;
  clip-path: polygon(50% 0, 88% 18%, 84% 82%, 50% 100%, 16% 82%, 12% 18%);
  box-shadow: 0 0 24px #43D6D1, 12px 10px 0 rgba(140,76,255,0.28);
  animation: lanternLean 5s ease-in-out infinite;
}

.gate-scene { grid-template-columns: 1fr; background: linear-gradient(90deg, rgba(73,54,232,0.13), transparent 28%, transparent 72%, rgba(140,76,255,0.12)); }
.curtain { position: absolute; top: 0; bottom: 0; width: 26vw; background: repeating-linear-gradient(90deg, rgba(216,75,106,0.24) 0 18px, rgba(9,7,22,0.28) 18px 36px); transition: transform 900ms ease; z-index: 0; }
.curtain-left { left: 0; transform: translateX(-4vw); }
.curtain-right { right: 0; transform: translateX(4vw); }
.is-visible .curtain-left { transform: translateX(-18vw); }
.is-visible .curtain-right { transform: translateX(18vw); }
.proscenium { display: grid; grid-template-columns: 0.7fr 1.2fr 0.35fr; gap: 2rem; align-items: center; }
.archway { padding: clamp(2rem, 4vw, 4rem); border: 3px double #B99A58; background: rgba(9,7,22,0.66); box-shadow: 18px 18px 0 rgba(73,54,232,0.24), -14px -12px 0 rgba(233,241,255,0.06); }
.torn-map, .manual-page { background: #E9F1FF; color: #090716; border: 2px solid #B99A58; box-shadow: 10px 12px 0 rgba(216,75,106,0.35); }
.torn-map { min-height: 18rem; padding: 1.5rem; clip-path: polygon(0 8%, 17% 0, 32% 8%, 53% 0, 100% 10%, 94% 100%, 8% 94%); transform: rotate(-5deg); cursor: pointer; }
.crossed-arrow { font-family: "Bungee Shade"; color: #D84B6A; font-size: 5rem; text-decoration: line-through; }
.inventory-strip { display: grid; gap: 1rem; }
.icon { display: grid; place-items: center; width: 4rem; height: 4rem; border: 1px solid #43D6D1; background: rgba(67,214,209,0.09); color: #E9F1FF; font-size: 1.5rem; box-shadow: 7px 7px 0 rgba(140,76,255,0.3); }
.secret-line, .tag-note { font-family: "Averia Serif Libre", serif; color: #B99A58; position: absolute; max-width: 26rem; transform: rotate(-3deg); }
.secret-line { right: 8vw; bottom: 10vh; }

.forest-scene { grid-template-columns: 1fr 1fr; gap: 3rem; background: radial-gradient(circle at 30% 50%, rgba(67,214,209,0.12), transparent 22rem); }
.forest-cel { position: absolute; inset: 12vh 8vw; border: 1px solid rgba(233,241,255,0.16); background: rgba(233,241,255,0.035); transform: rotate(-2deg); }
.cel-front { transform: translate(2rem, 1rem) rotate(2deg); border-color: rgba(67,214,209,0.24); }
.trees { position: absolute; inset: 0; pointer-events: none; }
.tree { position: absolute; width: 4rem; height: 18rem; bottom: 7vh; background: linear-gradient(#43D6D1 0 18%, transparent 18%), linear-gradient(90deg, transparent 43%, #B99A58 43% 57%, transparent 57%); opacity: 0.36; filter: drop-shadow(20px 12px 0 rgba(140,76,255,0.16)); clip-path: polygon(50% 0, 84% 28%, 65% 28%, 95% 58%, 67% 58%, 70% 100%, 30% 100%, 33% 58%, 5% 58%, 35% 28%, 16% 28%); }
.tree-a { left: 8vw; height: 22rem; }
.tree-b { left: 28vw; bottom: 18vh; transform: scale(0.8); }
.tree-c { right: 24vw; height: 20rem; }
.tree-d { right: 7vw; bottom: 15vh; transform: scale(0.7); }
.story-fragment { max-width: 44rem; justify-self: end; z-index: 2; }
.map-scraps { display: grid; gap: 1rem; z-index: 3; }
.map-scrap { padding: 1.2rem; min-height: 10rem; color: #090716; background: #E9F1FF; border: 2px solid #B99A58; cursor: pointer; transform: rotate(4deg); transition: transform 450ms ease; box-shadow: 9px 10px 0 rgba(73,54,232,0.35); }
.map-scrap:nth-child(2) { transform: rotate(-5deg); }
.map-scrap:hover { transform: rotateY(180deg); }
.map-scrap span, .map-scrap strong { display: block; font-family: "Averia Serif Libre", serif; }
.ghost-footprints { position: absolute; left: 14vw; bottom: 14vh; display: flex; gap: 2rem; transform: rotate(-24deg); }
.ghost-footprints span { width: 1.1rem; height: 2rem; border-radius: 50%; background: rgba(67,214,209,0.54); box-shadow: 0 0 18px #43D6D1; animation: footprint 2.5s infinite; }
.ghost-footprints span:nth-child(2) { animation-delay: .2s; } .ghost-footprints span:nth-child(3) { animation-delay: .4s; } .ghost-footprints span:nth-child(4) { animation-delay: .6s; } .ghost-footprints span:nth-child(5) { animation-delay: .8s; }

.armory-scene { grid-template-columns: 0.8fr 1.2fr; gap: 3rem; }
.manual-page { position: absolute; width: 22rem; height: 29rem; opacity: 0.14; }
.page-one { left: 6vw; top: 10vh; transform: rotate(-8deg); }
.page-two { right: 8vw; bottom: 8vh; transform: rotate(7deg); }
.armory-copy { max-width: 42rem; }
.prop-rail { display: flex; gap: 1.25rem; flex-wrap: wrap; justify-content: center; }
.prop { position: relative; width: 12rem; height: 18rem; padding: 1rem; border: 1px solid rgba(233,241,255,0.24); background: rgba(9,7,22,0.72); color: #E9F1FF; cursor: pointer; box-shadow: 12px 12px 0 rgba(185,154,88,0.16); transition: transform 320ms ease; }
.prop:hover { transform: translateY(-1rem) rotate(-2deg); }
.prop span { display: block; margin: 1rem auto; }
.sword span { width: 1.2rem; height: 10rem; background: linear-gradient(#E9F1FF, #B99A58); clip-path: polygon(50% 0, 70% 70%, 100% 70%, 100% 82%, 61% 82%, 61% 100%, 39% 100%, 39% 82%, 0 82%, 0 70%, 30% 70%); box-shadow: 15px 8px 0 rgba(216,75,106,0.42); }
.controller span { width: 8rem; height: 5rem; border-radius: 42% 42% 55% 55%; background: #4936E8; border: 2px solid #43D6D1; box-shadow: inset 2rem 1rem 0 rgba(9,7,22,0.25), 10px 8px 0 rgba(140,76,255,0.3); }
.key span { width: 8rem; height: 9rem; border: 8px solid #B99A58; border-left-width: 24px; border-radius: 50% 50% 6px 6px; box-shadow: 12px 0 0 #D84B6A; }
.prop em { font-family: "Averia Serif Libre", serif; color: #B99A58; font-style: normal; }
.tag-note { left: 12vw; bottom: 8vh; }

.rehearsal-scene { place-items: center; text-align: center; }
.chalk-circle { position: absolute; width: min(65vw, 42rem); height: min(65vw, 42rem); border: 3px dashed rgba(233,241,255,0.36); border-radius: 50%; box-shadow: 0 0 0 18px rgba(67,214,209,0.04); animation: slowSpin 28s linear infinite; }
.attack-cues span { position: absolute; width: 16rem; height: 3px; background: #D84B6A; left: 50%; top: 50%; transform-origin: left center; box-shadow: 0 0 16px rgba(216,75,106,0.5); }
.attack-cues span:nth-child(1) { transform: rotate(20deg); } .attack-cues span:nth-child(2) { transform: rotate(105deg); } .attack-cues span:nth-child(3) { transform: rotate(190deg); } .attack-cues span:nth-child(4) { transform: rotate(285deg); }
.boss-card { max-width: 54rem; z-index: 2; padding: 2rem; background: rgba(9,7,22,0.68); }
.boss-card h2 { margin-inline: auto; }
.cue-cards { position: absolute; bottom: 9vh; display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }
.cue { padding: 0.9rem 1rem; border: 1px solid #B99A58; color: #E9F1FF; background: rgba(185,154,88,0.12); font-family: "Averia Serif Libre", serif; cursor: pointer; }

.final-door-scene { grid-template-columns: 1fr 1fr; gap: 3rem; }
.portal-halo { position: absolute; right: 12vw; width: 32rem; height: 32rem; border-radius: 50%; background: radial-gradient(circle, rgba(67,214,209,0.22), rgba(73,54,232,0.12) 44%, transparent 70%); filter: blur(4px); }
.door-wrap { position: relative; width: min(26rem, 78vw); height: 34rem; justify-self: center; cursor: pointer; perspective: 1000px; }
.door { position: absolute; inset: 0; display: grid; place-items: end center; padding: 2rem; color: #090716; background: linear-gradient(135deg, #E9F1FF, #B99A58); border: 4px solid #4936E8; transform-origin: left center; transition: transform 800ms cubic-bezier(.2,.8,.2,1); z-index: 2; }
.door-wrap:hover .door, .door-wrap.open .door { transform: rotateY(-26deg); }
.door-shadow { position: absolute; inset: 1.3rem -1.4rem -1.4rem 1.3rem; background: #8C4CFF; opacity: 0.44; }
.handle { position: absolute; right: 3rem; width: 1rem; height: 1rem; border-radius: 50%; background: #4936E8; top: 48%; box-shadow: 0 0 0 6px rgba(73,54,232,0.18); }
.handle-two { right: 1.25rem; top: 53%; background: #43D6D1; box-shadow: 0 0 20px #43D6D1; }
.door p { font-family: "Averia Serif Libre", serif; font-size: 1.6rem; color: #090716; }
.final-copy { max-width: 40rem; }

.relic-caption {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  width: min(33rem, calc(100vw - 2.4rem));
  padding: 1rem;
  border: 1px solid rgba(67,214,209,0.6);
  background: rgba(9,7,22,0.88);
  box-shadow: 8px 8px 0 rgba(140,76,255,0.28);
  z-index: 40;
  transform: translateY(140%);
  transition: transform 300ms ease;
}
.relic-caption.show { transform: translateY(0); }
.relic-caption span { display: block; font-size: 0.76rem; line-height: 1.5; }
.caption-first { color: #D84B6A; text-decoration: line-through; }
.caption-second { color: #43D6D1; margin-top: 0.35rem; }

.scene h2, .scene p, .scene button, .prop, .map-scrap, .torn-map { opacity: 0; transform: translateY(28px) rotate(var(--rot, 0deg)); transition: opacity 700ms ease, transform 700ms ease; }
.scene.is-visible h2, .scene.is-visible p, .scene.is-visible button, .scene.is-visible .prop, .scene.is-visible .map-scrap, .scene.is-visible .torn-map { opacity: 1; transform: translateY(0) rotate(var(--rot, 0deg)); }
.torn-map { --rot: -5deg; }
.map-scrap:nth-child(1) { --rot: 4deg; }
.map-scrap:nth-child(2) { --rot: -5deg; transition-delay: 120ms; }
.prop:nth-child(2) { transition-delay: 140ms; }
.prop:nth-child(3) { transition-delay: 280ms; }

@keyframes savePulse { 0%, 100% { box-shadow: 0 0 22px rgba(67,214,209,0.25), inset 0 0 24px rgba(73,54,232,0.35); } 50% { box-shadow: 0 0 46px rgba(67,214,209,0.58), inset 0 0 46px rgba(73,54,232,0.55); } }
@keyframes blinkTwice { 0%, 9%, 18%, 100% { opacity: 0.25; transform: scale(0.8); } 5%, 14% { opacity: 1; transform: scale(1.25); } }
@keyframes lanternLean { 0%, 100% { transform: rotate(-3deg) translateY(0); } 50% { transform: rotate(5deg) translateY(-10px); } }
@keyframes footprint { 0%, 100% { opacity: 0.12; transform: translateY(0); } 45% { opacity: 1; transform: translateY(-8px); } }
@keyframes slowSpin { to { transform: rotate(360deg); } }

@media (max-width: 860px) {
  .save-room, .forest-scene, .armory-scene, .final-door-scene, .proscenium { grid-template-columns: 1fr; }
  .save-slots { justify-self: start; }
  .inventory-strip { grid-template-columns: repeat(4, 1fr); }
  .cue-cards { position: relative; bottom: auto; margin-top: 2rem; }
  .understudy-lantern { width: 3rem; height: 4.2rem; }
  .scene { padding: 5rem 1.25rem; }
  .drawer-note { position: relative; right: auto; bottom: auto; margin-top: 1rem; }
}
