:root {
  --bg: #0a0b12;
  --ink: #e8ecff;
  --muted: #aab2d9;
  --rose: #ff7aa2;
  --gold: #ffd27d;
  --violet: #7d7aff;
  --card: #11131d;
  --bubble: #151827;
  --border: rgba(255, 255, 255, 0.1);
  --glow: 0 0 30px rgba(255, 190, 120, 0.25), 0 0 80px rgba(255, 122, 162, 0.15);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font: 400 1rem/1.6 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, "Helvetica Neue", Arial;
  color: var(--ink);
  background: radial-gradient(1200px 800px at 70% -10%, #202548 0%, transparent 60%), var(--bg);
  overflow-x: hidden;
}

body.story-scroll-lock {
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: none;
}

#starfield {
  position: fixed;
  inset: 0;
  z-index: -2;
  display: block;
}

header,
section,
footer {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: clamp(2.5rem, 8vh, 5.5rem) clamp(1.25rem, 4vw, 2.75rem);
}

.wrap {
  max-width: 960px;
  text-align: center;
}

.chapter-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  text-align: center;
  padding: clamp(2rem, 6vw, 3.5rem);
}

.chapter-label {
  text-transform: uppercase;
  letter-spacing: 0.38em;
  font-size: 0.78rem;
  color: var(--muted);
  opacity: 0.85;
}

.chapter-card h2 {
  font-size: clamp(2.2rem, 7vw, 3.6rem);
  letter-spacing: 0.02em;
  margin: 0;
}

.chapter-tagline {
  margin: 0;
  font-size: clamp(1rem, 2.6vw, 1.2rem);
  color: var(--muted);
  max-width: 28ch;
}

.chapter-card,
.panel {
  --reveal-progress: 0;
  --reveal-opacity: clamp(var(--reveal-progress, 0), 0, 1);
  --reveal-translate: calc((1 - var(--reveal-opacity)) * 48px);
  opacity: var(--reveal-opacity);
  transform: translateY(var(--reveal-translate));
  transition: opacity 0.3s linear, transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}


.panel--slide-change .narration {
  animation: panel-slide-fade 0.64s ease forwards;
}

.panel--slide-image-change .panel-image,
.panel--slide-image-change .panel-image img {
  animation: panel-slide-fade 0.64s ease forwards;
}

.actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
  flex-direction: column;
  align-items: center;
}

h1,
h2 {
  margin: 0 0 0.6rem;
  line-height: 1.1;
}

h1 {
  font-size: clamp(2.2rem, 6vw, 4rem);
  letter-spacing: 0.02em;
}

h2 {
  font-size: clamp(1.4rem, 4.6vw, 2.3rem);
}

p {
  margin: 0.5rem auto 0;
  font-size: clamp(1rem, 2.2vw, 1.15rem);
  color: var(--muted);
}

.badge {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: linear-gradient(120deg, #1b1e2f, #151827);
  color: #ccd2ff;
  font-size: 0.9rem;
  opacity: 0.9;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.shine {
  background: linear-gradient(90deg, var(--rose), var(--gold), var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 8px rgba(255, 214, 140, 0.25));
}

.card {
  width: min(900px, 94vw);
  max-height: min(720px, 100%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.005));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  border-radius: 24px;
  padding: clamp(1.25rem, 3vw, 2rem);
  backdrop-filter: blur(6px);
}

.frame {
  display: grid;
  gap: clamp(0.75rem, 2vh, 1.25rem);
  max-height: 100%;
  grid-template-rows: minmax(0, 1fr) auto auto;
}

.panel-title {
  margin: 0;
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.illustration {
  min-height: clamp(140px, 32vh, 280px);
  max-height: clamp(200px, 60vh, 420px);
  height: auto;
  width: min(520px, 100%);
  margin-inline: auto;
  display: grid;
  place-items: center;
  position: relative;
}

.illustration > * {
  grid-area: 1 / 1;
  max-width: 100%;
  max-height: 100%;
}

.panel-image {
  position: relative;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  animation: breathe-glow 10s ease-in-out infinite;
  border-radius: 15px;
}

.panel-image img {
  position: relative;
  z-index: 1;
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;

}

@keyframes breathe-glow {
  0%, 100% {
    box-shadow: 0 0 40px rgba(255, 255, 255, 0.3); /* soft base glow */
  }
  50% {
    box-shadow: 0 0 50px rgba(255, 255, 255, 0.3); /* stronger, bigger glow */
  }
}


.narration {
  font-size: clamp(1.05rem, 2.2vw, 1.2rem);
  color: var(--ink);
}

.panel-pagination {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 0.35rem;
}

.panel-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: none;
  padding: 0;
  background: rgba(255, 255, 255, 0.28);
  opacity: 0.6;
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.3s ease;
  cursor: pointer;
}

.panel-dot:focus-visible,
.panel-dot:hover {
  opacity: 1;
  transform: scale(1.12);
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.panel-dot.is-active {
  background: linear-gradient(120deg, var(--rose), var(--gold));
  opacity: 1;
  transform: scale(1.2);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.22);
}

.orbiting {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.snippet {
  position: absolute;
  max-width: min(280px, 50vw);
  background: var(--bubble);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.65rem 0.75rem;
  color: var(--ink);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(6px) scale(0.98);
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: auto;
}

.snippet.show {
  opacity: 0.98;
  transform: translateY(0) scale(1);
}

.snippet small {
  display: block;
  margin-top: 0.25rem;
  color: #a7add6;
  opacity: 0.9;
}

.whisper {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff, transparent 65%);
  box-shadow: 0 0 12px rgba(255, 210, 125, 0.6), 0 0 26px rgba(255, 122, 162, 0.35);
  cursor: pointer;
  border: none;
  top: var(--top, auto);
  left: var(--left, auto);
  right: var(--right, auto);
  bottom: var(--bottom, auto);
  z-index: 3;
}

.whisper:focus {
  outline: 2px solid rgba(255, 255, 255, 0.35);
}

.star,
.split-star,
.orbit,
.reunion,
.field {
  position: relative;
}

.star svg {
  width: clamp(120px, 24vw, 200px);
}

.pulse {
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.06);
  }
}

@keyframes panel-slide-fade {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.timeline {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  align-items: center;
  background: #0f1220aa;
  border: 1px solid var(--border);
  backdrop-filter: blur(6px);
  padding: 6px 10px;
  border-radius: 999px;
  z-index: 5;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #9aa2c8;
  border: 1px solid #cfd6ff22;
  cursor: pointer;
}

.dot.active {
  background: #fff;
}

.finale {
  position: relative;
  overflow: hidden;
  padding: clamp(2.2rem, 5vw, 3.4rem);
  display: grid;
  gap: 1rem;
  text-align: center;
}

.finale__halo {
  position: absolute;
  inset: -60% -20% auto;
  height: 65%;
  background: radial-gradient(circle at 50% 20%, rgba(255, 214, 140, 0.22), rgba(255, 122, 162, 0.12), transparent 65%);
  filter: blur(40px);
  pointer-events: none;
  opacity: 0.8;
}

.finale h2 {
  font-size: clamp(2rem, 6vw, 3.2rem);
}

.finale__signature {
  margin: clamp(1.8rem, 4vw, 2.4rem) auto 0;
  color: var(--muted);
  font-size: clamp(0.95rem, 2.4vw, 1.05rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: center;
}

.finale__actions {
  margin-top: clamp(1.6rem, 4vw, 2.4rem);
  display: flex;
  justify-content: center;
  gap: clamp(0.75rem, 2vw, 1.25rem);
  flex-wrap: wrap;
}

.btn-return {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  background: linear-gradient(120deg, rgba(255, 122, 162, 0.28), rgba(125, 122, 255, 0.24));
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.4), 0 0 24px rgba(255, 214, 140, 0.2);
}

.btn-return:hover {
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 122, 162, 0.28);
}

.btn-return__icon {
  font-size: 1.1rem;
  line-height: 1;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(17, 19, 29, 0.72);
  color: inherit;
  text-decoration: none;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.btn-outline:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45), 0 0 26px rgba(125, 122, 255, 0.32);
}

.btn-outline__icon {
  font-size: 1rem;
  line-height: 1;
}

.story-nav {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  display: flex;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  background: rgba(17, 19, 29, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45), 0 0 40px rgba(255, 122, 162, 0.18);
  backdrop-filter: blur(10px);
  z-index: 9;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.story-nav--hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 46px);
}

.story-nav--mobile {
  width: min(420px, calc(100% - 2rem));
  padding: 0.75rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  border-radius: 24px;
}

.story-nav--mobile .nav-btn {
  font-size: 1.05rem;
  padding: 0.9rem 0.5rem;
  border-radius: 18px;
  letter-spacing: 0.01em;
}

.story-nav--mobile .nav-chapter {
  width: 100%;
}

.story-nav--mobile .nav-chapter::after {
  height: 10px;
}

.story-nav--mobile .nav-chapter .nav-btn {
  width: 100%;
}

.story-nav--mobile .chapter-menu {
  left: 0;
  right: 0;
  bottom: calc(100% + 10px);
  transform: translateY(8px);
  min-width: min(90vw, 320px);
  margin-inline: auto;
}

.nav-btn {
  background: linear-gradient(120deg, rgba(255, 122, 162, 0.22), rgba(125, 122, 255, 0.22));
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--ink);
  font-size: 0.95rem;
  padding-inline: 1.1rem;
  white-space: nowrap;
}

.nav-btn:hover {
  box-shadow: var(--glow);
}

.nav-btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
  box-shadow: none;
}

.nav-chapter {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-chapter::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 14px;
}

.chapter-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  margin: 0;
  padding: 0.55rem;
  list-style: none;
  background: rgba(21, 24, 39, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  min-width: 220px;
  z-index: 12;
}

.nav-chapter.open .chapter-menu,
.nav-chapter:hover .chapter-menu,
.nav-chapter:focus-within .chapter-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.chapter-menu li {
  list-style: none;
}

.chapter-menu li + li {
  margin-top: 0.25rem;
}

.chapter-menu__item {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--ink);
  text-align: left;
  padding: 0.45rem 0.75rem;
  border-radius: 10px;
  font-size: 0.95rem;
  cursor: pointer;
}

.chapter-menu__item:hover,
.chapter-menu__item:focus {
  background: rgba(255, 255, 255, 0.12);
  outline: none;
}

.btn {
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #151827;
  color: var(--ink);
  padding: 0.8rem 1rem;
  border-radius: 14px;
  font-weight: 600;
  letter-spacing: 0.2px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--glow);
  border-color: rgba(255, 255, 255, 0.22);
}

.btn-hero {
  font-size: clamp(1.05rem, 2.6vw, 1.4rem);
  padding: clamp(1rem, 3vw, 1.4rem) clamp(2rem, 6vw, 3.4rem);
  border-radius: 999px;
  background: linear-gradient(120deg, rgba(255, 122, 162, 0.35), rgba(125, 122, 255, 0.28));
  border: 1px solid rgba(255, 255, 255, 0.24);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42), 0 0 28px rgba(255, 214, 140, 0.24);
}

.btn-hero:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.5), 0 0 36px rgba(255, 122, 162, 0.32);
  border-color: rgba(255, 255, 255, 0.3);
}

.hero-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding-top: 0.6rem;
  font-size: 0.9rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.85;
  animation: indicatorFade 2.4s ease-in-out infinite;
}

.hero-indicator__arrow {
  font-size: 1.8rem;
  animation: arrowBounce 1.2s ease-in-out infinite;
}

.hero-indicator__text {
  font-size: 0.8rem;
}

@keyframes arrowBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes indicatorFade {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .pulse {
    animation: none;
  }

  .chapter-card,
  .panel {
    transition: none;
    opacity: 1 !important;
    transform: none !important;
  }

  .finale {
    padding: 2.2rem;
  }
}
