:root {
  --ivory: #fffdf9;
  --ivory-muted: rgba(255, 250, 242, 0.88);
  --flag-red: #da251d;
  --flag-red-deep: #3a0507;
  --flag-red-dark: #1b0304;
  --flag-red-glow: rgba(218, 37, 29, 0.38);
  --star-gold: #ffd700;
  --star-gold-warm: #ffcf33;
  --star-gold-soft: rgba(255, 215, 0, 0.82);
  --in-oklab: ;
  --font-body: "Be Vietnam Pro", system-ui, -apple-system, sans-serif;
  --font-display: "Playfair Display", "Be Vietnam Pro", Georgia, serif;
  --era-glow: rgba(218, 37, 29, 0.34);
}

@supports (background: linear-gradient(in oklab, white, black)) {
  :root {
    --in-oklab: in oklab;
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--flag-red-dark);
  color: var(--ivory);
  font-family: var(--font-body);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

::selection {
  background: rgba(218, 37, 29, 0.65);
  color: var(--star-gold);
}

#webgl {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 1;
  display: block;
  touch-action: pan-y;
}

#ambient-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 72% 45%, var(--era-glow), transparent 62%),
    radial-gradient(circle at 18% 22%, rgba(255, 215, 0, 0.10), transparent 48%),
    radial-gradient(circle at 25% 82%, rgba(218, 37, 29, 0.24), transparent 60%);
  transition: background 0.8s ease;
}

#grain {
  position: fixed;
  inset: -100px;
  z-index: 55;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 260 260' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

#loader {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: radial-gradient(circle at center, #6b0908 0%, #240304 75%, #120102 100%);
  color: var(--ivory);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.85s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.85s;
}
#loader.done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.loader-inner {
  text-align: center;
  padding: 2.5rem 3.5rem;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.10) 0%, rgba(218, 37, 29, 0.14) 100%);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.55),
    inset 0 1px 1px rgba(255, 255, 255, 0.28),
    inset 0 0 32px rgba(255, 215, 0, 0.08);
}
.loader-eyebrow {
  font-size: 0.68rem;
  letter-spacing: 0.42em;
  color: var(--star-gold-soft);
  margin-bottom: 0.75rem;
}
.loader-mark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3.2rem, 8vw, 5.4rem);
  color: var(--star-gold);
  letter-spacing: 0.12em;
  text-shadow: 0 8px 36px rgba(255, 215, 0, 0.4);
}
.loader-title {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  letter-spacing: 0.48em;
  font-weight: 600;
  color: var(--ivory);
}
.loader-bar {
  width: min(320px, 65vw);
  height: 3px;
  background: rgba(255, 255, 255, 0.14);
  margin: 1.8rem auto 0.75rem;
  overflow: hidden;
  border-radius: 999px;
}
#loader-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--flag-red), var(--star-gold));
  box-shadow: 0 0 14px var(--star-gold);
  transition: width 0.25s ease;
}
.loader-pct {
  font-size: 0.74rem;
  letter-spacing: 0.32em;
  color: var(--star-gold);
}

#progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 90;
  background: rgba(255, 255, 255, 0.06);
}
#progress-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg var(--in-oklab), var(--flag-red), #ff6b00, var(--star-gold));
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.85);
}

#top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem clamp(18px, 4.5vw, 64px);
  background: linear-gradient(180deg, rgba(28, 3, 4, 0.78) 0%, rgba(28, 3, 4, 0) 100%);
  pointer-events: none;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  pointer-events: auto;
  padding: 0.42rem 1rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(218, 37, 29, 0.38) 0%, rgba(255, 255, 255, 0.08) 100%);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  box-shadow:
    0 8px 28px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.brand-date {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--star-gold);
  letter-spacing: 0.14em;
}
.brand-sep {
  width: 18px;
  height: 1px;
  background: rgba(255, 215, 0, 0.45);
}
.brand-name {
  font-size: 0.68rem;
  letter-spacing: 0.3em;
  font-weight: 700;
  color: var(--ivory);
}
.stage-status {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.7rem;
  color: var(--star-gold-soft);
}
.stage-era {
  padding: 0.4rem 1rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(218, 37, 29, 0.52) 0%, rgba(60, 6, 8, 0.55) 100%);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
  color: var(--star-gold);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
}
.stage-hint {
  opacity: 0.78;
  letter-spacing: 0.05em;
  color: rgba(255, 250, 240, 0.8);
}
.mobile-header-title {
  display: none;
}

#chapters {
  position: fixed;
  right: clamp(12px, 2.4vw, 34px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 85;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem 0.7rem;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.11) 0%, rgba(218, 37, 29, 0.16) 100%);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
#chapters button {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.7rem;
  color: var(--ivory);
  font-family: var(--font-body);
  position: relative;
}
#chapters .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.32);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), background 0.35s ease, box-shadow 0.35s ease;
  order: 2;
}
#chapters .label {
  position: absolute;
  right: 24px;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0.35rem 0.78rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(218, 37, 29, 0.78) 0%, rgba(45, 5, 7, 0.85) 100%);
  backdrop-filter: blur(14px);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  color: var(--star-gold);
  opacity: 0;
  pointer-events: none;
  transform: translateX(8px);
  transition: opacity 0.28s ease, transform 0.28s ease;
  white-space: nowrap;
}
#chapters button:hover .label,
#chapters button:focus-visible .label {
  opacity: 1;
  transform: translateX(0);
}
#chapters button.active .dot {
  background: var(--star-gold);
  transform: scale(1.55);
  box-shadow: 0 0 14px var(--star-gold), 0 0 28px rgba(218, 37, 29, 0.9);
}

#sound-btn {
  position: fixed;
  left: clamp(16px, 3vw, 44px);
  bottom: clamp(16px, 3.2vh, 34px);
  z-index: 85;
  height: 44px;
  padding: 0 1.15rem;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, rgba(218, 37, 29, 0.24) 100%);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  color: var(--ivory);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  transition: all 0.3s ease;
}
#sound-btn:hover {
  color: var(--star-gold);
  transform: translateY(-2px);
  box-shadow:
    0 16px 36px rgba(218, 37, 29, 0.35),
    inset 0 1px 0 rgba(255, 215, 0, 0.45);
}
.sound-icon {
  width: 17px;
  height: 17px;
  color: var(--star-gold);
  flex-shrink: 0;
  transition: transform 0.25s ease;
}
#sound-btn:not(.on) .sound-icon .wave-1,
#sound-btn:not(.on) .sound-icon .wave-2 {
  opacity: 0.35;
}
#sound-btn.on .sound-icon {
  transform: scale(1.08);
}
.sound-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 13px;
}
.sound-bars i {
  display: block;
  width: 2px;
  height: 4px;
  background: var(--star-gold);
  border-radius: 2px;
  transition: height 0.2s ease;
}
#sound-btn.on {
  background: linear-gradient(135deg, rgba(218, 37, 29, 0.72) 0%, rgba(120, 12, 10, 0.68) 100%);
  color: var(--star-gold);
  box-shadow:
    0 0 28px rgba(218, 37, 29, 0.55),
    inset 0 1px 0 rgba(255, 215, 0, 0.45);
}
#sound-btn.on .sound-bars i:nth-child(1) { animation: eq 0.8s ease-in-out infinite; }
#sound-btn.on .sound-bars i:nth-child(2) { animation: eq 0.6s ease-in-out 0.15s infinite; }
#sound-btn.on .sound-bars i:nth-child(3) { animation: eq 0.75s ease-in-out 0.3s infinite; }
#sound-btn.on .sound-bars i:nth-child(4) { animation: eq 0.65s ease-in-out 0.1s infinite; }
@keyframes eq {
  0%, 100% { height: 4px; }
  50% { height: 13px; }
}

#mobile-scroll-cue {
  display: none;
}

#stage-plaque {
  position: fixed;
  right: clamp(52px, 5vw, 88px);
  bottom: clamp(14px, 2.6vh, 30px);
  z-index: 80;
  max-width: clamp(290px, 26vw, 370px);
  padding: 0.68rem 1.05rem;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, rgba(218, 37, 29, 0.22) 55%, rgba(24, 3, 5, 0.65) 100%);
  backdrop-filter: blur(22px) saturate(170%);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 0 rgba(255, 215, 0, 0.12);
  cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease, left 0.45s ease, right 0.45s ease;
}
#stage-plaque:hover {
  transform: translateY(-3px);
  box-shadow:
    0 22px 54px rgba(218, 37, 29, 0.32),
    inset 0 1px 0 rgba(255, 215, 0, 0.48);
}
#stage-plaque.plaque-left {
  right: auto;
  left: clamp(150px, 13vw, 210px);
}
.plaque-tag {
  font-size: 0.56rem;
  letter-spacing: 0.22em;
  color: var(--star-gold);
  font-weight: 700;
  text-transform: uppercase;
}
.plaque-title {
  margin-top: 0.18rem;
  font-family: var(--font-display);
  font-size: clamp(0.84rem, 0.98vw, 0.96rem);
  font-weight: 700;
  color: var(--ivory);
}
.plaque-sub {
  margin-top: 0.14rem;
  font-size: clamp(0.66rem, 0.78vw, 0.74rem);
  color: rgba(255, 240, 200, 0.85);
}

#story {
  position: relative;
  z-index: 10;
  pointer-events: none;
}

.chapter {
  min-height: 112vh;
  display: flex;
  align-items: center;
  padding: clamp(72px, 9.5vh, 108px) clamp(28px, 4.2vw, 76px) clamp(76px, 10vh, 112px);
  perspective: 1200px;
}

.chapter-inner {
  pointer-events: auto;
  position: relative;
  overflow: hidden;
  width: clamp(380px, 36.5vw, 520px);
  padding: clamp(1.15rem, min(2vw, 2.2vh), 1.9rem) clamp(1.25rem, 2.1vw, 2.05rem);
  border-radius: clamp(20px, 1.8vw, 26px);
  background: linear-gradient(
    140deg,
    rgba(255, 255, 255, 0.11) 0%,
    rgba(218, 37, 29, 0.14) 38%,
    rgba(26, 3, 5, 0.56) 100%
  );
  backdrop-filter: blur(26px) saturate(175%);
  -webkit-backdrop-filter: blur(26px) saturate(175%);
  box-shadow:
    0 30px 75px rgba(0, 0, 0, 0.62),
    0 8px 32px rgba(218, 37, 29, 0.16),
    inset 0 1px 1px rgba(255, 255, 255, 0.32),
    inset 1px 0 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 1px rgba(255, 215, 0, 0.12);
  transform-style: preserve-3d;
  transition: box-shadow 0.5s ease, transform 0.5s ease;
}

.chapter-inner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    115deg,
    rgba(255, 255, 255, 0.12) 0%,
    rgba(255, 255, 255, 0.02) 32%,
    transparent 55%
  );
  pointer-events: none;
}

.chapter-inner.left {
  margin-right: auto;
}
.chapter-inner.right {
  margin-left: auto;
}

.era-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: clamp(0.55rem, 1vh, 0.85rem);
}
.era-pill {
  padding: 0.28rem 0.78rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--flag-red) 0%, #9e110b 100%);
  box-shadow:
    0 4px 16px rgba(218, 37, 29, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  color: var(--star-gold);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.2em;
}
.era-line {
  width: 22px;
  height: 1px;
  background: linear-gradient(90deg, var(--star-gold), transparent);
}
.era-period {
  font-size: 0.64rem;
  letter-spacing: 0.2em;
  color: var(--star-gold-soft);
  font-weight: 600;
}

.giant {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.85rem, min(3.3vw, 4.8vh), 3.4rem);
  line-height: 1.06;
  letter-spacing: 0.01em;
  color: var(--ivory);
  text-shadow: 0 8px 34px rgba(0, 0, 0, 0.55);
}
.chapter.hero .giant {
  font-size: clamp(2.05rem, min(3.7vw, 5.4vh), 3.9rem);
}
.chapter.outro .giant {
  font-size: clamp(1.72rem, min(3.0vw, 4.4vh), 3.1rem);
  line-height: 1.12;
}
.giant em {
  font-style: italic;
  color: var(--star-gold);
  font-weight: 700;
  text-shadow: 0 0 28px rgba(255, 215, 0, 0.28);
}

.lede,
.body {
  margin-top: clamp(0.55rem, 1.1vh, 0.9rem);
  font-weight: 300;
  font-size: clamp(0.83rem, min(0.95vw, 1.6vh), 0.96rem);
  line-height: 1.62;
  color: var(--ivory-muted);
}
.body.body-wish {
  margin-top: 0.55rem;
  font-weight: 500;
  color: var(--star-gold-soft);
}
.body strong {
  color: var(--star-gold);
  font-weight: 600;
}

.era-showcase {
  margin-top: clamp(0.75rem, 1.5vh, 1.15rem);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(0.6rem, 0.9vw, 0.85rem);
}

.artifact-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0.38rem;
  border-radius: 17px;
  overflow: hidden;
  border: none;
  background: linear-gradient(
    155deg,
    rgba(255, 255, 255, 0.12) 0%,
    rgba(255, 255, 255, 0.04) 55%,
    rgba(20, 2, 4, 0.45) 100%
  );
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    inset 0 0 0 1px rgba(255, 255, 255, 0.07);
  cursor: pointer;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease, background 0.4s ease;
}

.artifact-card.symbol-highlight {
  background: linear-gradient(
    155deg,
    rgba(218, 37, 29, 0.28) 0%,
    rgba(255, 215, 0, 0.08) 50%,
    rgba(28, 3, 5, 0.55) 100%
  );
  box-shadow:
    0 16px 38px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 235, 160, 0.38),
    inset 0 0 0 1px rgba(255, 215, 0, 0.14);
}

.artifact-card:hover,
.artifact-card:focus-visible {
  transform: translateY(-5px) scale(1.015);
  box-shadow:
    0 20px 44px rgba(0, 0, 0, 0.6),
    0 0 28px rgba(218, 37, 29, 0.38),
    inset 0 1px 1px rgba(255, 215, 0, 0.55);
  outline: none;
}

.artifact-media {
  position: relative;
  width: 100%;
  height: clamp(98px, min(9.8vw, 14vh), 144px);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(10, 2, 3, 0.6);
}
.artifact-media img {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  object-fit: cover;
  object-position: center 22%;
  display: block;
  filter: contrast(1.06) saturate(1.08);
  transition: transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}
.artifact-card.symbol-highlight .artifact-media img {
  object-position: center center;
}
.artifact-card[data-inspect-ch="0"][data-inspect-type="portrait"] .artifact-media img {
  object-position: center 20%;
}
.artifact-card[data-inspect-ch="4"][data-inspect-type="portrait"] .artifact-media img {
  object-position: center 22%;
}
.artifact-card[data-inspect-ch="5"][data-inspect-type="symbol"] .artifact-media img {
  object-position: center 16%;
}
.artifact-card[data-inspect-ch="5"][data-inspect-type="portrait"] .artifact-media img {
  object-position: center 18%;
}
.artifact-card:hover .artifact-media img {
  transform: scale(1.08);
}

.zoom-badge {
  position: absolute;
  right: 7px;
  bottom: 7px;
  padding: 0.2rem 0.54rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(218, 37, 29, 0.82), rgba(40, 4, 6, 0.85));
  backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
  color: var(--star-gold);
  font-size: 0.56rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.artifact-info {
  padding: 0.55rem 0.6rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
}
.artifact-tag {
  font-size: 0.54rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--star-gold);
  text-transform: uppercase;
}
.artifact-title {
  font-family: var(--font-display);
  font-size: clamp(0.78rem, 0.88vw, 0.9rem);
  font-weight: 700;
  color: var(--ivory);
  line-height: 1.24;
}
.artifact-desc {
  font-size: clamp(0.66rem, 0.76vw, 0.72rem);
  line-height: 1.42;
  color: rgba(255, 250, 242, 0.78);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.scroll-hint {
  margin-top: clamp(0.65rem, 1.2vh, 1rem);
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.62rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--star-gold-soft);
}
.scroll-hint span {
  width: 2px;
  height: clamp(20px, 2.8vh, 30px);
  background: linear-gradient(var(--star-gold), var(--flag-red), transparent);
  display: inline-block;
  animation: hintPulse 1.8s ease-in-out infinite;
}
@keyframes hintPulse {
  0%, 100% { transform: scaleY(0.45); transform-origin: top; opacity: 0.45; }
  50% { transform: scaleY(1); transform-origin: top; opacity: 1; }
}

.outro-actions {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.replay-btn {
  border: none;
  background: linear-gradient(135deg, var(--flag-red) 0%, #9e100b 100%);
  color: var(--star-gold);
  border-radius: 999px;
  padding: 0.85rem 1.85rem;
  font-family: var(--font-body);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow:
    0 12px 32px rgba(218, 37, 29, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: all 0.3s ease;
}
.replay-btn:hover {
  background: linear-gradient(135deg, var(--star-gold) 0%, #ffae00 100%);
  color: #2b0304;
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(255, 215, 0, 0.55);
}
.credit {
  font-size: 0.64rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 245, 230, 0.6);
}

.chapter-inner > * {
  opacity: 0;
  transform: translate3d(0, 34px, -30px);
  transition:
    opacity 0.85s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.95s cubic-bezier(0.16, 1, 0.3, 1);
}
.chapter.visible .chapter-inner > * {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}
.chapter.visible .chapter-inner > *:nth-child(2) { transition-delay: 0.08s; }
.chapter.visible .chapter-inner > *:nth-child(3) { transition-delay: 0.16s; }
.chapter.visible .chapter-inner > *:nth-child(4) { transition-delay: 0.24s; }
.chapter.visible .chapter-inner > *:nth-child(5) { transition-delay: 0.32s; }

@supports ((animation-timeline: view()) and (animation-range: entry)) {
  @keyframes cardDepthParallax {
    entry 0% {
      transform: translateY(28px);
    }
    exit 100% {
      transform: translateY(-28px);
    }
  }
  .chapter-inner {
    view-timeline: --chapter-view;
    animation: cardDepthParallax linear both;
    animation-timeline: --chapter-view;
    animation-range: entry 10% exit 90%;
  }
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 4vw, 48px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}
.lightbox.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 2, 3, 0.84);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}
.lightbox-dialog {
  position: relative;
  z-index: 1;
  width: min(1040px, 94vw);
  max-height: 90vh;
  border-radius: 28px;
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.13) 0%,
    rgba(218, 37, 29, 0.18) 45%,
    rgba(24, 3, 5, 0.82) 100%
  );
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  box-shadow:
    0 36px 96px rgba(0, 0, 0, 0.8),
    inset 0 1px 1px rgba(255, 255, 255, 0.34),
    inset 0 -1px 1px rgba(255, 215, 0, 0.18);
  padding: clamp(1.3rem, 2.5vw, 2.2rem);
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  transform: scale(0.95) translateY(12px);
  transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1);
}
.lightbox.open .lightbox-dialog {
  transform: scale(1) translateY(0);
}
.lightbox-close {
  position: absolute;
  top: 1.2rem;
  right: 1.3rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
  color: var(--ivory);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.25s ease;
}
.lightbox-close:hover {
  background: var(--flag-red);
  color: var(--star-gold);
}
.lightbox-tabs {
  display: inline-flex;
  gap: 0.6rem;
  align-self: flex-start;
}
.lb-tab {
  padding: 0.5rem 1.15rem;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
  color: var(--ivory-muted);
  font-family: var(--font-body);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.25s ease;
}
.lb-tab.active {
  background: linear-gradient(135deg, var(--flag-red), #a3100a);
  color: var(--star-gold);
  box-shadow:
    0 6px 20px rgba(218, 37, 29, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.lightbox-body {
  display: grid;
  grid-template-columns: 1.25fr 0.95fr;
  gap: 1.5rem;
  align-items: center;
  overflow-y: auto;
}
.lightbox-img-wrap {
  background: rgba(12, 2, 3, 0.55);
  border-radius: 20px;
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 68vh;
}
.lightbox-img-wrap img {
  width: 100%;
  max-height: 68vh;
  object-fit: contain;
  display: block;
}
.lightbox-meta {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.lb-era {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--star-gold);
}
.lb-title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.4vw, 2rem);
  color: var(--ivory);
  line-height: 1.2;
}
.lb-desc {
  font-size: 0.94rem;
  line-height: 1.75;
  color: var(--ivory-muted);
}
.lb-credit {
  font-size: 0.74rem;
  color: var(--star-gold-soft);
  padding-top: 0.5rem;
}
.lb-nav {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.lb-nav-btn {
  flex: 1;
  padding: 0.7rem 1rem;
  border-radius: 14px;
  border: none;
  background: rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
  color: var(--ivory);
  font-family: var(--font-body);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
}
.lb-nav-btn:hover {
  background: linear-gradient(135deg, var(--flag-red), #9e100b);
  color: var(--star-gold);
}

@media (min-width: 1680px) {
  .chapter-inner {
    width: clamp(480px, 35vw, 560px);
    padding: 2.1rem 2.25rem;
  }
  .artifact-media {
    height: 156px;
  }
}

@media (max-width: 1440px) {
  .chapter-inner {
    width: clamp(370px, 36vw, 470px);
  }
}

@media (max-width: 1200px) {
  .chapter-inner {
    width: clamp(350px, 39vw, 440px);
  }
  #stage-plaque {
    max-width: 310px;
  }
}

@media (max-width: 1024px) {
  .chapter-inner {
    width: clamp(340px, 43vw, 420px);
    padding: 1.2rem 1.25rem;
  }
  .stage-hint {
    display: none;
  }
  .artifact-media {
    height: 106px;
  }
}

@media (max-width: 768px) {

  #ambient-backdrop {
    background:
      radial-gradient(circle at 50% 45%, var(--era-glow), transparent 62%),
      radial-gradient(circle at 82% 20%, rgba(255, 215, 0, 0.14), transparent 44%),
      radial-gradient(circle at 50% 85%, rgba(218, 37, 29, 0.25), transparent 62%);
  }

  #top-bar {
    padding: calc(0.9rem + env(safe-area-inset-top, 0px)) 16px 0.7rem;
    justify-content: center;
    text-align: center;
  }
  .brand,
  .brand-sep,
  .brand-name,
  #stage-indicator,
  .stage-status,
  #stage-plaque,
  #stage-plaque.plaque-left {
    display: none !important;
  }
  .mobile-header-title {
    display: block;
    width: 100%;
    text-align: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.02rem, 4.3vw, 1.28rem);
    line-height: 1.32;
    letter-spacing: 0.02em;
    color: var(--star-gold);
    text-shadow:
      0 4px 18px rgba(0, 0, 0, 0.82),
      0 0 22px rgba(255, 215, 0, 0.32);
  }

  #mobile-scroll-cue {
    position: fixed;
    left: 50%;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 75;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.38rem 0.9rem;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, rgba(218, 37, 29, 0.26) 60%, rgba(20, 2, 4, 0.78) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow:
      0 8px 24px rgba(0, 0, 0, 0.45),
      inset 0 1px 0 rgba(255, 255, 255, 0.26);
    color: var(--star-gold);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    white-space: nowrap;
    pointer-events: none;
    transition: opacity 0.45s ease, transform 0.45s ease;
  }
  #mobile-scroll-cue span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--star-gold);
    box-shadow: 0 0 8px var(--star-gold);
    animation: cuePulse 1.4s ease-in-out infinite;
  }
  #mobile-scroll-cue.hidden {
    opacity: 0;
    transform: translate(-50%, 10px);
  }
  @keyframes cuePulse {
    0%, 100% { transform: translateY(2px); opacity: 0.5; }
    50% { transform: translateY(-3px); opacity: 1; }
  }

  .chapter {
    min-height: 185svh;
    padding: 96svh 12px 16svh;
    align-items: flex-start;
  }
  .chapter-inner,
  .chapter-inner.left,
  .chapter-inner.right {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    padding: 1.25rem 1.15rem 1.3rem;
    border-radius: 24px;
    background: linear-gradient(
      150deg,
      rgba(255, 255, 255, 0.13) 0%,
      rgba(218, 37, 29, 0.22) 38%,
      rgba(20, 2, 4, 0.84) 100%
    );
    backdrop-filter: blur(24px) saturate(175%);
    -webkit-backdrop-filter: blur(24px) saturate(175%);
  }

  .era-meta {
    gap: 0.5rem;
    margin-bottom: 0.65rem;
    flex-wrap: wrap;
  }
  .era-pill {
    font-size: 0.58rem;
    padding: 0.26rem 0.68rem;
    letter-spacing: 0.16em;
  }
  .era-line {
    width: 16px;
  }
  .era-period {
    font-size: 0.6rem;
    letter-spacing: 0.16em;
  }

  .giant {
    font-size: clamp(1.85rem, 7.6vw, 2.55rem);
    line-height: 1.08;
  }
  .chapter.hero .giant {
    font-size: clamp(2.05rem, 8.4vw, 2.85rem);
  }
  .chapter.outro .giant {
    font-size: clamp(1.68rem, 6.8vw, 2.25rem);
  }
  .lede,
  .body {
    margin-top: 0.75rem;
    font-size: 0.87rem;
    line-height: 1.62;
  }

  .era-showcase {
    margin-top: 1.05rem;
    grid-template-columns: 1fr 1fr;
    gap: 0.62rem;
  }
  .artifact-card {
    padding: 0.36rem;
    border-radius: 16px;
  }
  .artifact-media {
    height: 112px;
    border-radius: 12px;
  }
  .artifact-media img {
    border-radius: 12px;
  }
  .zoom-badge {
    right: 6px;
    bottom: 6px;
    padding: 0.16rem 0.46rem;
    font-size: 0.52rem;
  }
  .artifact-info {
    padding: 0.55rem 0.45rem 0.5rem;
    gap: 0.18rem;
  }
  .artifact-tag {
    font-size: 0.5rem;
    letter-spacing: 0.12em;
  }
  .artifact-title {
    font-size: 0.8rem;
    line-height: 1.22;
  }
  .artifact-desc {
    font-size: 0.68rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  #chapters {
    top: auto;
    right: auto;
    left: 50%;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    flex-direction: row;
    align-items: center;
    gap: 0.22rem;
    padding: 0.4rem 0.65rem;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.14) 0%, rgba(218, 37, 29, 0.28) 55%, rgba(22, 2, 4, 0.86) 100%);
    box-shadow:
      0 14px 36px rgba(0, 0, 0, 0.65),
      inset 0 1px 0 rgba(255, 255, 255, 0.3);
  }
  #chapters button {
    width: 30px;
    height: 30px;
    justify-content: center;
    align-items: center;
  }
  #chapters .dot {
    width: 8px;
    height: 8px;
  }
  #chapters .label {
    display: none;
  }

  #sound-btn {
    left: 14px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    height: 40px;
    width: 40px;
    padding: 0;
    gap: 0;
    justify-content: center;
    align-items: center;
  }
  #sound-btn .txt,
  #sound-btn .sound-bars,
  .sound-label {
    display: none !important;
  }
  #sound-btn .sound-icon {
    width: 19px;
    height: 19px;
  }

  .scroll-hint {
    margin-top: 1rem;
    font-size: 0.6rem;
  }
  .scroll-hint span {
    height: 24px;
  }
  .outro-actions {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .replay-btn {
    width: 100%;
    padding: 0.8rem 1.2rem;
  }

  .lightbox {
    padding: 0;
    align-items: flex-end;
  }
  .lightbox-dialog {
    width: 100%;
    max-height: 92dvh;
    border-radius: 26px 26px 0 0;
    padding: 1.1rem 1.05rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
    gap: 0.85rem;
    transform: translateY(24px);
  }
  .lightbox.open .lightbox-dialog {
    transform: translateY(0);
  }
  .lightbox-close {
    top: 0.9rem;
    right: 0.95rem;
    width: 36px;
    height: 36px;
  }
  .lightbox-tabs {
    max-width: calc(100% - 48px);
    gap: 0.4rem;
  }
  .lb-tab {
    padding: 0.42rem 0.82rem;
    font-size: 0.66rem;
  }
  .lightbox-body {
    grid-template-columns: 1fr;
    gap: 0.9rem;
  }
  .lightbox-img-wrap {
    max-height: 38dvh;
    border-radius: 16px;
  }
  .lightbox-img-wrap img {
    max-height: 38dvh;
    border-radius: 16px;
  }
  .lb-title {
    font-size: 1.22rem;
  }
  .lb-desc {
    font-size: 0.84rem;
    line-height: 1.6;
  }
  .lb-nav-btn {
    padding: 0.65rem 0.75rem;
    font-size: 0.72rem;
    border-radius: 12px;
  }
}

@media (max-width: 400px) {
  .chapter {
    min-height: 185svh;
    padding: 94svh 10px 16svh;
  }
  .chapter-inner,
  .chapter-inner.left,
  .chapter-inner.right {
    padding: 1.05rem 0.95rem 1.1rem;
    border-radius: 22px;
  }
  .artifact-media {
    height: 98px;
  }
  #chapters button {
    width: 26px;
    height: 26px;
  }
}

@media (max-height: 540px) and (orientation: landscape) {
  .chapter {
    min-height: 110dvh;
    padding: 72px 18px 72px;
    align-items: center;
  }
  .chapter-inner,
  .chapter-inner.left,
  .chapter-inner.right {
    width: min(460px, 54vw);
    margin-left: 0;
    margin-right: auto;
    padding: 1rem 1.1rem;
  }
  .chapter-inner.right {
    margin-left: auto;
    margin-right: 0;
  }
  .artifact-media {
    height: 92px;
  }
  #stage-plaque {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-hint span {
    animation: none;
  }
  .chapter-inner {
    animation: none;
  }
  .chapter-inner > * {
    transition: opacity 0.35s ease;
    transform: none;
  }
}
