:root {
  --lacquer: #050403;
  --umber: #17100B;
  --gold: #C8A24A;
  --saffron: #F2C15B;
  --ivory: #E9DFCC;
  --oxide: #5A321C;
  --slate: #2B3440;
  --scroll: 0;
  --scene: 0;
  --mouse-x: 50vw;
  --mouse-y: 50vh;
}

* { box-sizing: border-box; }

html {
  background: var(--lacquer);
  color: var(--ivory);
  font-family: "Cormorant Garamond", Georgia, serif;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--lacquer);
  overflow-x: hidden;
}

.fixed-sky {
  position: fixed;
  inset: 0;
  z-index: -5;
  background:
    radial-gradient(circle at calc(20% + (var(--scroll) * 24%)) 16%, rgba(200, 162, 74, 0.14), transparent 26%),
    radial-gradient(circle at 75% 36%, rgba(43, 52, 64, 0.36), transparent 34%),
    linear-gradient(180deg, #050403 0%, #090604 38%, #17100B 72%, #050403 100%);
}

.leather-veil {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: 0.42;
  mix-blend-mode: screen;
  background:
    radial-gradient(circle at 18% 22%, rgba(242, 193, 91, 0.05) 0 2px, transparent 3px 120px),
    radial-gradient(circle at 72% 66%, rgba(90, 50, 28, 0.18) 0 1px, transparent 2px 90px),
    linear-gradient(105deg, transparent 0 18%, rgba(90, 50, 28, 0.12) 19%, transparent 22% 64%, rgba(200, 162, 74, 0.07) 65%, transparent 68%),
    repeating-linear-gradient(12deg, rgba(233, 223, 204, 0.018) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(97deg, rgba(90, 50, 28, 0.045) 0 2px, transparent 2px 13px);
}

.black-wipe {
  position: fixed;
  inset: -20vh 0;
  z-index: 18;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(5, 4, 3, 0.96) 42%, rgba(5, 4, 3, 0.98) 55%, transparent);
  transform: translateY(calc(-90vh + var(--wipe, 0) * 160vh));
  opacity: 0.38;
}

.cursor-ripple {
  position: fixed;
  left: var(--mouse-x);
  top: var(--mouse-y);
  z-index: 30;
  width: 180px;
  height: 180px;
  margin: -90px 0 0 -90px;
  border: 1px solid rgba(200, 162, 74, 0.28);
  border-radius: 50%;
  pointer-events: none;
  opacity: var(--cursor-opacity, 0.16);
  transform: scale(var(--cursor-scale, 0.32));
  transition: opacity 320ms ease, transform 520ms ease;
  box-shadow: inset 0 0 40px rgba(242, 193, 91, 0.08), 0 0 55px rgba(200, 162, 74, 0.08);
}

.quest-scroll { position: relative; }

.scene {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  grid-template-rows: repeat(12, 1fr);
  padding: clamp(1.25rem, 3vw, 3rem);
}

.scene::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(130deg, rgba(5, 4, 3, 0.9), transparent 42%, rgba(23, 16, 11, 0.48)),
    radial-gradient(circle at 65% 58%, rgba(200, 162, 74, 0.08), transparent 32%);
}

.scene-number,
.jp-label,
.route-note,
.map-fragment,
.annotation-orbit,
.pass-panel span {
  font-family: "Noto Sans JP", sans-serif;
  font-size: clamp(0.62rem, 0.72vw, 0.78rem);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(233, 223, 204, 0.62);
}

.scene-number {
  position: absolute;
  top: clamp(1rem, 3vw, 2.6rem);
  left: clamp(1rem, 3vw, 2.6rem);
  z-index: 8;
  color: rgba(200, 162, 74, 0.76);
}

h1, h2 {
  font-family: "Libre Baskerville", Baskerville, Georgia, serif;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.055em;
  line-height: 0.88;
}

h1 {
  font-size: clamp(4rem, 12vw, 13rem);
  color: rgba(233, 223, 204, 0.88);
  text-shadow: 0 0 38px rgba(200, 162, 74, 0.18), 0 20px 70px rgba(5, 4, 3, 0.96);
}

h2 {
  font-size: clamp(2.7rem, 7.4vw, 8.8rem);
  color: var(--ivory);
}

p {
  font-size: clamp(1.18rem, 1.7vw, 1.85rem);
  line-height: 1.36;
  color: rgba(233, 223, 204, 0.78);
}

.mountain-stack {
  position: absolute;
  inset: auto -8vw 0 -8vw;
  height: 58vh;
  z-index: 1;
  transform: translate3d(var(--x, 0), calc(var(--local-progress, 0) * -5vh), 0);
}

.ridge {
  position: absolute;
  inset: auto 0 0;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 -30px 50px rgba(5, 4, 3, 0.62));
}

.ridge path { fill: currentColor; }
.ridge-far { color: rgba(43, 52, 64, 0.68); transform: translateY(-8vh); filter: blur(1.2px); }
.ridge-mid { color: rgba(23, 16, 11, 0.95); transform: translateY(2vh); }
.ridge-front { color: #050403; transform: translateY(10vh); }
.ridge-slate { color: rgba(43, 52, 64, 0.7); filter: blur(0.7px); }
.ridge-umber { color: rgba(23, 16, 11, 0.98); transform: translateY(8vh); }

.gate .title-wrap {
  grid-column: 3 / 23;
  grid-row: 5 / 9;
  z-index: 4;
  transform: translate3d(calc(var(--local-progress, 0) * 4vw), calc(var(--local-progress, 0) * -4vh), 0);
}

.gate .subtitle {
  max-width: 38rem;
  margin: 1rem 0 0 9vw;
}

.horizon-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 58%;
  height: 1px;
  z-index: 3;
  background: linear-gradient(90deg, transparent 0%, rgba(200, 162, 74, 0.12) 16%, var(--gold) 48%, var(--saffron) 52%, rgba(200, 162, 74, 0.14) 84%, transparent 100%);
  box-shadow: 0 0 28px rgba(242, 193, 91, 0.52);
  animation: horizon-breathe 5.5s ease-in-out infinite;
}

.moon-blade {
  position: absolute;
  right: 12vw;
  top: 12vh;
  width: 13rem;
  height: 13rem;
  border-radius: 50%;
  border: 1px solid rgba(200, 162, 74, 0.2);
  box-shadow: inset -34px 0 0 -20px rgba(242, 193, 91, 0.55);
  opacity: 0.55;
}

.route-note-a {
  position: absolute;
  left: 8vw;
  bottom: 13vh;
  z-index: 5;
  border-left: 1px solid rgba(200, 162, 74, 0.48);
  padding-left: 1rem;
}

.ripple-valley::before {
  background:
    radial-gradient(ellipse at 54% 68%, rgba(242, 193, 91, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(5, 4, 3, 0.98), rgba(23, 16, 11, 0.88) 54%, rgba(5, 4, 3, 0.96));
}

.lake-glow {
  position: absolute;
  left: 2vw;
  right: 2vw;
  bottom: 4vh;
  height: 40vh;
  z-index: 2;
  background:
    radial-gradient(ellipse at 50% 48%, rgba(242, 193, 91, 0.18), transparent 29%),
    repeating-radial-gradient(ellipse at 50% 42%, rgba(200, 162, 74, 0.18) 0 1px, transparent 1px 28px);
  transform: perspective(620px) rotateX(66deg) scaleX(1.12);
  filter: blur(0.3px);
  opacity: 0.78;
}

.reflection-word {
  position: absolute;
  left: 10vw;
  bottom: 15vh;
  z-index: 3;
  font-family: "Libre Baskerville", serif;
  font-size: clamp(5rem, 18vw, 18rem);
  color: rgba(200, 162, 74, 0.09);
  letter-spacing: -0.08em;
  transform: scaleY(-0.42) skewX(-12deg);
  filter: blur(2px);
}

.ripple-field {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.ripple-ring {
  position: absolute;
  width: 12rem;
  height: 12rem;
  border: 1px solid rgba(200, 162, 74, 0.24);
  border-radius: 50%;
  box-shadow: 0 0 28px rgba(242, 193, 91, 0.12);
  animation: ripple-expand 7s ease-out infinite;
}

.ring-a { left: 22vw; bottom: 22vh; }
.ring-b { left: 48vw; bottom: 13vh; animation-delay: 1.8s; border-color: rgba(242, 193, 91, 0.27); }
.ring-c { left: 68vw; bottom: 26vh; animation-delay: 3.6s; }

.dynamic-ripple {
  position: absolute;
  width: 2rem;
  height: 2rem;
  border: 1px solid rgba(242, 193, 91, 0.42);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: dynamic-ripple 1.8s ease-out forwards;
}

.waystation {
  z-index: 6;
  opacity: calc(0.42 + var(--visibility, 0) * 0.58);
  transform: translateY(calc((1 - var(--visibility, 0)) * 5vh));
  transition: opacity 900ms ease, transform 900ms ease;
}

.valley-text {
  grid-column: 4 / 15;
  grid-row: 3 / 8;
}

.map-fragment {
  position: absolute;
  right: 9vw;
  bottom: 18vh;
  z-index: 7;
  color: rgba(200, 162, 74, 0.66);
}

.mountain-oath::before {
  background:
    linear-gradient(135deg, rgba(5, 4, 3, 0.9), rgba(43, 52, 64, 0.24) 52%, rgba(23, 16, 11, 0.9)),
    radial-gradient(circle at 22% 72%, rgba(200, 162, 74, 0.13), transparent 27%);
}

.oath-text {
  grid-column: 9 / 23;
  grid-row: 4 / 9;
  text-align: right;
}

.oath-text p:last-child { max-width: 43rem; margin-left: auto; }

.mist-band {
  position: absolute;
  left: -10vw;
  right: -10vw;
  height: 18vh;
  z-index: 5;
  background: linear-gradient(90deg, transparent, rgba(233, 223, 204, 0.1), transparent);
  filter: blur(18px);
  opacity: calc(0.18 + var(--local-progress, 0) * 0.3);
}

.mist-one { top: 24vh; transform: translateX(calc(var(--local-progress, 0) * 18vw)); }
.mist-two { top: 55vh; transform: translateX(calc(var(--local-progress, 0) * -15vw)); opacity: 0.18; }

.annotation-orbit {
  position: absolute;
  left: 10vw;
  top: 24vh;
  z-index: 7;
  width: 13rem;
  height: 13rem;
  display: grid;
  place-items: center;
  border: 1px solid rgba(200, 162, 74, 0.26);
  border-left-color: transparent;
  border-radius: 50%;
  transform: rotate(calc(var(--local-progress, 0) * 42deg));
}

.seal-mark,
.final-seal {
  display: grid;
  place-items: center;
  font-family: "Noto Sans JP", sans-serif;
  color: var(--gold);
  border: 1px solid rgba(200, 162, 74, 0.58);
  border-radius: 50%;
}

.seal-mark {
  position: absolute;
  left: 18vw;
  bottom: 22vh;
  z-index: 7;
  width: 4.2rem;
  height: 4.2rem;
  opacity: 0.62;
}

.hidden-pass::before {
  background:
    linear-gradient(90deg, #050403, rgba(23, 16, 11, 0.92) 47%, #050403),
    radial-gradient(circle at 70% 34%, rgba(242, 193, 91, 0.12), transparent 22%);
}

.sliding-panels {
  position: absolute;
  inset: 8vh 4vw 8vh 4vw;
  z-index: 2;
}

.pass-panel {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 24vw;
  border: 1px solid rgba(200, 162, 74, 0.13);
  background:
    linear-gradient(180deg, rgba(233, 223, 204, 0.04), transparent),
    repeating-linear-gradient(90deg, rgba(90, 50, 28, 0.08) 0 1px, transparent 1px 9px),
    rgba(23, 16, 11, 0.72);
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.52);
  transform: translateX(calc(var(--local-progress, 0) * var(--shift)));
}

.pass-panel span {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  writing-mode: vertical-rl;
}

.panel-one { left: 3vw; --shift: -7vw; }
.panel-two { left: 24vw; --shift: 5vw; background-color: rgba(90, 50, 28, 0.34); }
.panel-three { left: 45vw; --shift: -4vw; border-color: rgba(242, 193, 91, 0.3); }
.panel-four { left: 66vw; --shift: 8vw; }

.pass-text {
  grid-column: 3 / 12;
  grid-row: 5 / 10;
}

.stitched-route {
  position: absolute;
  right: 2vw;
  bottom: 16vh;
  width: 62vw;
  height: 26vh;
  z-index: 7;
  fill: none;
  stroke: rgba(200, 162, 74, 0.45);
  stroke-width: 1.4;
  stroke-dasharray: 7 12;
  filter: drop-shadow(0 0 16px rgba(242, 193, 91, 0.18));
}

.dawn-ridge {
  background: linear-gradient(180deg, rgba(5, 4, 3, 0.6), rgba(43, 52, 64, 0.26) 44%, rgba(233, 223, 204, 0.12));
}

.dawn-ridge::before {
  background:
    radial-gradient(circle at 50% 59%, rgba(242, 193, 91, 0.34), transparent 27%),
    linear-gradient(180deg, rgba(5, 4, 3, 0.82), rgba(43, 52, 64, 0.35) 45%, rgba(233, 223, 204, 0.2));
}

.dawn-sun {
  position: absolute;
  left: 50%;
  bottom: 28vh;
  z-index: 1;
  width: 26rem;
  height: 26rem;
  margin-left: -13rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(242, 193, 91, 0.48), rgba(200, 162, 74, 0.12) 42%, transparent 68%);
  filter: blur(4px);
  transform: translateY(calc((1 - var(--local-progress, 0)) * 8vh));
}

.ridge-dawn-far { color: rgba(43, 52, 64, 0.78); transform: translateY(-4vh); }
.ridge-dawn-front { color: rgba(23, 16, 11, 0.98); transform: translateY(9vh); }

.final-inscription {
  grid-column: 8 / 18;
  grid-row: 4 / 9;
  z-index: 6;
  text-align: center;
  opacity: calc(0.35 + var(--visibility, 0) * 0.65);
}

.final-seal {
  width: 4.6rem;
  height: 4.6rem;
  margin: 0 auto 1.4rem;
  background: rgba(5, 4, 3, 0.48);
}

@keyframes horizon-breathe {
  0%, 100% { opacity: 0.34; transform: scaleX(0.74); }
  50% { opacity: 1; transform: scaleX(1); }
}

@keyframes ripple-expand {
  0% { opacity: 0; transform: scale(0.2); }
  15% { opacity: 0.9; }
  100% { opacity: 0; transform: scale(4.5); }
}

@keyframes dynamic-ripple {
  0% { opacity: 0.7; transform: translate(-50%, -50%) scale(0.2); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(7); }
}

@media (max-width: 760px) {
  .scene { grid-template-columns: repeat(8, 1fr); padding: 1.1rem; }
  .gate .title-wrap,
  .valley-text,
  .oath-text,
  .pass-text,
  .final-inscription { grid-column: 1 / -1; text-align: left; }
  .gate .subtitle { margin-left: 0; }
  .oath-text { grid-row: 4 / 9; }
  .pass-panel { width: 42vw; }
  .panel-two { left: 30vw; }
  .panel-three { left: 48vw; }
  .panel-four { left: 66vw; }
  .final-inscription { text-align: center; }
}
