/* =========================================================
   《我们的1096天》— La La Land Twilight Cinema × Gallery Paper
   Mobile-first flagship design tuned for WeChat in-app browser
   ========================================================= */

:root {
  --twilight-deep: #121528;
  --twilight-mid: #1e203d;
  --twilight-plum: #2c264a;
  --amber: #e6b461;
  --amber-soft: rgba(230, 180, 97, 0.22);
  --lavender: #aba3c6;
  --star-white: #f7f4eb;

  --paper-bg: #f6f4ef;
  --paper-card: #ffffff;
  --ink: #1b1e32;
  --ink-soft: #5c5f77;
  --ink-faint: #9598ad;
  --hairline: rgba(27, 30, 50, 0.09);

  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif CN", "SimSun", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  background: var(--twilight-deep);
  color: var(--star-white);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.mode-timeline {
  background: var(--paper-bg);
  color: var(--ink);
}

html.scroll-locked,
body.scroll-locked {
  overflow: hidden !important;
  touch-action: none;
  overscroll-behavior: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

.hidden {
  display: none !important;
}

/* =========================================================
   Ambient Twilight Starfield Stage (Gate & Cover)
   ========================================================= */
.twilight-stage {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(28px + var(--safe-top)) 24px calc(44px + var(--safe-bottom));
  background:
    radial-gradient(ellipse 95% 55% at 50% 106%, rgba(110, 68, 142, 0.48) 0%, transparent 66%),
    radial-gradient(ellipse 60% 42% at 78% 16%, rgba(230, 180, 97, 0.14) 0%, transparent 70%),
    linear-gradient(180deg, #0b0e1e 0%, #151833 48%, #28224a 100%);
  transition: opacity 0.72s cubic-bezier(0.22, 1, 0.36, 1), transform 0.72s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
}

.twilight-stage.leaving {
  opacity: 0;
  transform: scale(1.035);
  pointer-events: none;
}

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

/* Delicate La La Land Griffith Park twilight hills & city lights silhouette */
.twilight-horizon {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.78;
}

/* Griffith Park inspired streetlamp glow */
.lamp-ornament {
  position: relative;
  width: 46px;
  height: 70px;
  margin: 0 auto 20px;
  opacity: 0.94;
}

.lamp-glow {
  position: absolute;
  top: 4px;
  left: 50%;
  width: 82px;
  height: 82px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(230, 180, 97, 0.48) 0%, rgba(230, 180, 97, 0.08) 46%, transparent 72%);
  animation: lampBreathe 4.2s ease-in-out infinite;
}

@keyframes lampBreathe {
  0%, 100% { opacity: 0.75; transform: translateX(-50%) scale(0.95); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.08); }
}

/* =========================================================
   Screen 1: Secret Passcode Gate
   ========================================================= */
.gate-card {
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.gate-title {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--star-white);
  text-shadow: 0 2px 24px rgba(230, 180, 97, 0.22);
}

.gate-subtitle {
  margin: 0 0 36px;
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--lavender);
}

.gate-question {
  margin: 0 0 22px;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: rgba(247, 244, 235, 0.95);
}

.code-input-wrap {
  position: relative;
  margin: 0 auto 14px;
  width: 100%;
  max-width: 324px;
  cursor: text;
}

.code-slots {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  pointer-events: none;
}

.code-slot {
  position: relative;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1.5px solid rgba(247, 244, 235, 0.24);
  font-family: var(--serif);
  font-size: 22px;
  color: var(--amber);
  transition: border-color 0.25s ease, transform 0.2s ease, background 0.25s ease;
  border-radius: 6px 6px 0 0;
  background: rgba(255, 255, 255, 0.035);
}

.code-slot.filled {
  border-bottom-color: var(--amber);
  background: rgba(230, 180, 97, 0.10);
}

.code-slot.active {
  border-bottom-color: var(--star-white);
  background: rgba(255, 255, 255, 0.09);
}

.code-slot.active::after {
  content: "";
  position: absolute;
  width: 1.5px;
  height: 20px;
  background: var(--amber);
  border-radius: 1px;
  animation: cursorBlink 1.1s ease-in-out infinite;
}

@keyframes cursorBlink {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 0.15; }
}

.code-slot:nth-child(4),
.code-slot:nth-child(6) {
  margin-right: 4px;
}

.code-real-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  font-size: 16px;
  caret-color: transparent;
}

.gate-hint {
  margin: 12px 0 0;
  min-height: 22px;
  font-size: 12.5px;
  color: var(--lavender);
  letter-spacing: 0.04em;
  transition: color 0.25s ease;
}

.gate-hint.error {
  color: #f4a49a;
}

.gate-hint.success {
  color: var(--amber);
}

.gate-submit {
  margin-top: 26px;
  padding: 12px 38px;
  border-radius: 999px;
  border: 1px solid rgba(230, 180, 97, 0.58);
  background: rgba(230, 180, 97, 0.15);
  color: var(--star-white);
  font-size: 14px;
  letter-spacing: 0.16em;
  transition: background 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;
  box-shadow: 0 6px 22px rgba(230, 180, 97, 0.12);
}

.gate-submit:active {
  transform: scale(0.96);
  background: rgba(230, 180, 97, 0.28);
}

@keyframes gentleShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.shake {
  animation: gentleShake 0.42s ease;
}

/* =========================================================
   Screen 2: Opening Cover
   ========================================================= */
.cover-backdrop {
  position: absolute;
  inset: -24px;
  z-index: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.28;
  filter: blur(20px) saturate(1.18);
  transform: scale(1.08);
  transition: opacity 1.2s ease;
}

.cover-vignette {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(circle at 50% 40%, rgba(22, 24, 52, 0.18) 0%, rgba(12, 14, 30, 0.88) 76%);
}

.cover-content {
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: 370px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cover-preview-frame {
  position: relative;
  width: 196px;
  height: 248px;
  padding: 9px 9px 28px;
  background: rgba(248, 245, 238, 0.96);
  border-radius: 3px;
  box-shadow: 0 26px 64px rgba(5, 7, 18, 0.68), 0 0 0 1px rgba(230, 180, 97, 0.24);
  transform: rotate(-1.8deg);
  margin-bottom: 28px;
  overflow: hidden;
  animation: coverFloat 7s ease-in-out infinite;
}

@keyframes coverFloat {
  0%, 100% { transform: rotate(-1.8deg) translateY(0px); }
  50% { transform: rotate(-0.7deg) translateY(-6px); }
}

.cover-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 1px;
  transition: opacity 0.65s ease;
}

.cover-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--star-white);
  text-shadow: 0 4px 26px rgba(0, 0, 0, 0.45);
}

.cover-dates {
  margin: 12px 0 0;
  font-family: var(--serif);
  font-size: 13.5px;
  letter-spacing: 0.22em;
  color: var(--amber);
}

.cover-line {
  margin: 16px 0 32px;
  font-size: 14px;
  line-height: 1.85;
  color: rgba(247, 244, 235, 0.82);
  max-width: 286px;
}

.cover-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 260px;
}

.btn-primary-amber {
  width: 100%;
  padding: 14px 24px;
  border-radius: 999px;
  background: linear-gradient(135deg, #efd08c 0%, #d9a04c 100%);
  color: #14172b;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.12em;
  box-shadow: 0 10px 28px rgba(230, 180, 97, 0.30);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.btn-primary-amber:active {
  transform: scale(0.97);
}

.btn-ghost-light {
  width: 100%;
  padding: 13px 24px;
  border-radius: 999px;
  border: 1px solid rgba(247, 244, 235, 0.28);
  background: rgba(255, 255, 255, 0.055);
  color: var(--star-white);
  font-size: 14.5px;
  letter-spacing: 0.12em;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.2s ease, background 0.2s ease;
}

.btn-ghost-light:active {
  transform: scale(0.97);
  background: rgba(255, 255, 255, 0.13);
}

.cover-music-pill {
  margin-top: 24px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.065);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--lavender);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.vinyl-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  opacity: 0.45;
}

.vinyl-dot.playing {
  opacity: 1;
  animation: pulseDot 1.6s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 0.95; }
  50% { transform: scale(1.48); opacity: 0.4; }
}

/* =========================================================
   Mode A: Cinema Screening Theater (Dual-Ambient + Bokeh)
   ========================================================= */
.cinema-screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: #0c0f1e;
  color: var(--star-white);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* Dual crossfading ambient cinema backdrop (smooth on iOS Safari & WeChat!) */
.cinema-ambient {
  position: absolute;
  inset: -34px;
  background-size: cover;
  background-position: center;
  filter: blur(44px) brightness(0.42) saturate(1.28);
  transform: scale(1.16);
  opacity: 0;
  transition: opacity 0.85s ease;
  will-change: opacity;
}

.cinema-ambient.active {
  opacity: 0.88;
}

.cinema-bokeh {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  opacity: 0.72;
}

.cinema-vignette {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: radial-gradient(ellipse 85% 75% at 50% 46%, transparent 45%, rgba(8, 10, 20, 0.62) 100%);
}

.cinema-stage {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cinema-layer {
  position: absolute;
  inset: calc(58px + var(--safe-top)) 14px calc(116px + var(--safe-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.55s cubic-bezier(0.25, 0.8, 0.25, 1);
  will-change: opacity;
}

.cinema-layer.active {
  opacity: 1;
}

.cinema-photo-wrap {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: 0 24px 68px rgba(0, 0, 0, 0.66), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.cinema-photo {
  display: block;
  max-width: calc(100vw - 28px);
  max-height: calc(100vh - 188px - var(--safe-top) - var(--safe-bottom));
  width: auto;
  height: auto;
  object-fit: contain;
  will-change: transform;
}

.cinema-layer.active .cinema-photo.kb-0 {
  animation: kenBurnsIn 4.2s ease-out forwards;
}
.cinema-layer.active .cinema-photo.kb-1 {
  animation: kenBurnsOut 4.2s ease-out forwards;
}
.cinema-layer.active .cinema-photo.kb-2 {
  animation: kenBurnsDriftL 4.2s ease-out forwards;
}
.cinema-layer.active .cinema-photo.kb-3 {
  animation: kenBurnsDriftR 4.2s ease-out forwards;
}

.cinema-screen.paused .cinema-photo {
  animation-play-state: paused !important;
}

@keyframes kenBurnsIn {
  from { transform: scale(1.0); }
  to { transform: scale(1.055); }
}
@keyframes kenBurnsOut {
  from { transform: scale(1.055); }
  to { transform: scale(1.0); }
}
@keyframes kenBurnsDriftL {
  from { transform: scale(1.045) translateX(1.1%); }
  to { transform: scale(1.045) translateX(-1.1%); }
}
@keyframes kenBurnsDriftR {
  from { transform: scale(1.045) translateX(-1.1%); }
  to { transform: scale(1.045) translateX(1.1%); }
}

/* Chapter transition title card inside Cinema (tappable to skip) */
.cinema-chapter-overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px;
  text-align: center;
  background: radial-gradient(circle at 50% 45%, rgba(28, 28, 58, 0.93), rgba(10, 12, 26, 0.98));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.38s ease;
}

.cinema-chapter-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.cinema-ch-numeral {
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: 0.35em;
  color: var(--amber);
  margin-bottom: 12px;
}

.cinema-ch-title {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--star-white);
  margin: 0 0 14px;
}

.cinema-ch-sub {
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--lavender);
  max-width: 280px;
  margin: 0;
}

/* Cinema Subtitle Area with soft readability scrim */
.cinema-caption-zone {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  padding: 46px 26px calc(30px + var(--safe-bottom));
  text-align: center;
  pointer-events: none;
  background: linear-gradient(0deg, rgba(10, 12, 24, 0.78) 0%, rgba(10, 12, 24, 0.32) 55%, transparent 100%);
  transition: transform 0.32s ease, opacity 0.32s ease;
}

.cinema-caption-zone.is-empty {
  opacity: 0;
  background: none;
}

.cinema-screen.hud-visible .cinema-caption-zone {
  transform: translateY(-74px);
  background: none;
}

.cinema-caption-text {
  display: inline-block;
  max-width: 344px;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.62;
  letter-spacing: 0.05em;
  color: rgba(248, 245, 238, 0.97);
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.9), 0 1px 4px rgba(0, 0, 0, 0.95);
  transition: opacity 0.32s ease;
}

.cinema-caption-text:empty {
  display: none;
}

/* First-time gesture whisper toast in Cinema */
.cinema-gesture-tip {
  position: absolute;
  top: calc(16px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 14;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(14, 16, 32, 0.72);
  border: 1px solid rgba(230, 180, 97, 0.25);
  color: rgba(247, 244, 235, 0.86);
  font-size: 12px;
  letter-spacing: 0.05em;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.cinema-gesture-tip.visible {
  opacity: 1;
}

/* Whisper-thin golden progress ribbon at bottom edge (no numbers) */
.cinema-progress-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.12);
  z-index: 15;
}

.cinema-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(230, 180, 97, 0.58), var(--amber));
  transition: width 0.3s linear;
}

/* Cinema HUD (tapped to show/hide) */
.cinema-hud-top,
.cinema-hud-bottom {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 16;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.cinema-hud-top {
  top: 0;
  padding: calc(14px + var(--safe-top)) 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(10, 12, 24, 0.86) 0%, transparent 100%);
  transform: translateY(-8px);
}

.cinema-hud-bottom {
  bottom: 0;
  padding: 22px 20px calc(18px + var(--safe-bottom));
  background: linear-gradient(0deg, rgba(10, 12, 24, 0.92) 0%, transparent 100%);
  transform: translateY(8px);
}

.cinema-screen.hud-visible .cinema-hud-top,
.cinema-screen.hud-visible .cinema-hud-bottom {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.hud-chapter-name {
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: 0.08em;
  color: rgba(247, 244, 235, 0.9);
}

.hud-actions-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 12.5px;
  color: var(--star-white);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.hud-pill:active {
  background: rgba(255, 255, 255, 0.24);
}

.hud-scrubber {
  width: 100%;
  margin: 0 0 12px;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.24);
  outline: none;
}

.hud-scrubber::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 12px rgba(230, 180, 97, 0.7);
}

.hud-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hud-play-group {
  display: flex;
  align-items: center;
  gap: 20px;
}

.hud-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--star-white);
  background: rgba(255, 255, 255, 0.09);
}

.hud-icon-btn.primary {
  width: 46px;
  height: 46px;
  background: var(--amber);
  color: #14172a;
}

/* =========================================================
   Mode B: Moonlit Paper Timeline Reading Mode
   ========================================================= */
.timeline-screen {
  position: relative;
  min-height: 100vh;
  background: var(--paper-bg);
  color: var(--ink);
}

/* Sticky minimal glass header */
.timeline-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(10px + var(--safe-top)) 16px 10px;
  background: rgba(246, 244, 239, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--hairline);
}

.header-chapter {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.header-title {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-sub {
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
  margin-top: 2px;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.music-disc-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
}

.music-disc-btn.playing svg {
  animation: slowSpin 7s linear infinite;
}

@keyframes slowSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.cinema-launch-btn {
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--twilight-mid);
  color: var(--star-white);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* Progress hairline at very top */
.timeline-scroll-line {
  position: fixed;
  top: 0;
  left: 0;
  height: 2.5px;
  width: 0%;
  background: var(--amber);
  z-index: 25;
  pointer-events: none;
}

/* Editorial Feed Container */
.timeline-feed {
  max-width: 540px;
  margin: 0 auto;
  padding: 12px 0 48px;
}

/* Hardcover Photo-Book Masthead at top of Timeline */
.timeline-masthead {
  padding: 34px 24px 12px;
  text-align: center;
}

.masthead-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--ink);
}

.masthead-dates {
  margin: 10px 0 0;
  font-family: var(--serif);
  font-size: 12.5px;
  letter-spacing: 0.22em;
  color: var(--ink-soft);
}

.masthead-rule {
  width: 36px;
  height: 1.5px;
  margin: 18px auto 0;
  background: var(--amber);
  opacity: 0.85;
}

/* Chapter Interlude Spread */
.chapter-spread {
  margin: 46px 18px 34px;
  padding: 36px 24px;
  border-radius: 12px;
  background:
    radial-gradient(ellipse 80% 70% at 85% 15%, rgba(230, 180, 97, 0.16), transparent 65%),
    linear-gradient(155deg, #161932 0%, #262348 100%);
  color: var(--star-white);
  text-align: center;
  box-shadow: 0 18px 40px rgba(20, 22, 46, 0.14);
  scroll-margin-top: 66px;
}

.chapter-numeral {
  display: inline-block;
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.3em;
  color: var(--amber);
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(230, 180, 97, 0.35);
  margin-bottom: 14px;
}

.chapter-title {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: 0.12em;
}

.chapter-subtitle {
  margin: 0 auto;
  max-width: 284px;
  font-size: 13px;
  line-height: 1.75;
  color: var(--lavender);
}

/* Individual Memory Moment (varied editorial rhythm) */
.memory-item {
  margin: 0 auto 42px;
  padding: 0 20px;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s ease, transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.memory-item.revealed {
  opacity: 1;
  transform: translateY(0);
}

.memory-item.layout-wide {
  padding: 0 12px;
}

.memory-item.layout-left {
  padding-left: 18px;
  padding-right: 40px;
}

.memory-item.layout-right {
  padding-left: 40px;
  padding-right: 18px;
}

/* Narrow tall phone screenshots stay graceful & well-proportioned */
.memory-item.layout-tall {
  max-width: 292px;
  padding: 0 16px;
}

.memory-item.layout-silent {
  padding: 0 26px;
  margin-bottom: 36px;
}

.photo-frame {
  position: relative;
  width: 100%;
  background: #ebe7de;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(24, 26, 48, 0.08);
  cursor: pointer;
  transition: transform 0.22s ease;
}

.photo-frame:active {
  transform: scale(0.988);
}

.memory-item.layout-polaroid .photo-frame {
  padding: 9px 9px 12px;
  background: var(--paper-card);
  border-radius: 4px;
  box-shadow: 0 12px 32px rgba(24, 26, 48, 0.09);
}

.memory-item.layout-polaroid .photo-frame img {
  border-radius: 2px;
}

.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.45s ease;
}

.photo-frame img.loaded {
  opacity: 1;
}

.memory-caption {
  margin: 13px 4px 0;
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 1.72;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.memory-item.layout-center .memory-caption,
.memory-item.layout-wide .memory-caption,
.memory-item.layout-tall .memory-caption {
  text-align: center;
  padding: 0 8px;
}

.memory-item.layout-right .memory-caption {
  text-align: right;
}

/* =========================================================
   Ending Letter & La La Land Starlight Finale
   ========================================================= */
.ending-section {
  position: relative;
  margin-top: 24px;
  padding: 74px 24px calc(92px + var(--safe-bottom));
  background:
    radial-gradient(ellipse 85% 55% at 50% 95%, rgba(112, 72, 144, 0.44), transparent 65%),
    linear-gradient(180deg, #1b1e39 0%, #111427 45%, #1d1a38 100%);
  color: var(--star-white);
  overflow: hidden;
}

.ending-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.ending-card {
  position: relative;
  z-index: 2;
  max-width: 420px;
  margin: 0 auto;
  padding: 36px 26px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(230, 180, 97, 0.24);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.ending-heading {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--amber);
  text-align: center;
}

.ending-dates {
  margin: 0 0 28px;
  font-family: var(--serif);
  font-size: 12.5px;
  letter-spacing: 0.22em;
  color: var(--lavender);
  text-align: center;
}

.ending-letter p {
  margin: 0 0 16px;
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 1.95;
  color: rgba(247, 244, 235, 0.9);
  letter-spacing: 0.04em;
}

.ending-sign {
  margin-top: 26px;
  text-align: right;
  font-family: var(--serif);
  font-size: 14.5px;
  color: var(--amber);
  letter-spacing: 0.08em;
}

.ending-actions {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.ending-toast {
  margin-top: 16px;
  min-height: 22px;
  text-align: center;
  font-family: var(--serif);
  font-size: 13.5px;
  color: var(--amber);
  letter-spacing: 0.06em;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.ending-toast.visible {
  opacity: 1;
}

/* =========================================================
   Floating Chapter Directory Button & Drawer
   ========================================================= */
.fab-chapters {
  position: fixed;
  right: 16px;
  bottom: calc(22px + var(--safe-bottom));
  z-index: 22;
  padding: 10px 15px;
  border-radius: 999px;
  background: rgba(23, 25, 48, 0.9);
  color: var(--star-white);
  font-size: 13px;
  letter-spacing: 0.08em;
  box-shadow: 0 8px 24px rgba(15, 17, 36, 0.28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(230, 180, 97, 0.28);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(11, 13, 26, 0.56);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.chapter-drawer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 51;
  max-width: 540px;
  margin: 0 auto;
  padding: 20px 20px calc(24px + var(--safe-bottom));
  background: #171a33;
  color: var(--star-white);
  border-radius: 18px 18px 0 0;
  border-top: 1px solid rgba(230, 180, 97, 0.25);
  transform: translateY(100%);
  transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

.chapter-drawer.open {
  transform: translateY(0);
}

.drawer-handle {
  width: 36px;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.22);
  margin: 0 auto 16px;
}

.drawer-title {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: 16px;
  letter-spacing: 0.14em;
  color: var(--amber);
  text-align: center;
}

.drawer-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.drawer-item {
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  border-radius: 10px;
  display: flex;
  align-items: baseline;
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  transition: background 0.2s ease;
}

.drawer-item.active {
  background: rgba(230, 180, 97, 0.16);
  border: 1px solid rgba(230, 180, 97, 0.34);
}

.drawer-numeral {
  font-family: var(--serif);
  font-size: 13px;
  color: var(--amber);
  flex-shrink: 0;
  width: 22px;
}

.drawer-name {
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.06em;
  color: var(--star-white);
}

/* =========================================================
   Full-screen Photo Lightbox
   ========================================================= */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(10, 12, 24, 0.96);
  color: var(--star-white);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(56px + var(--safe-top)) 16px calc(92px + var(--safe-bottom));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.lightbox.open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: calc(14px + var(--safe-top)) 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lightbox-img {
  max-width: 100%;
  max-height: 74vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.65);
  transition: opacity 0.2s ease;
}

.lightbox-caption {
  margin-top: 18px;
  max-width: 340px;
  text-align: center;
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.65;
  color: rgba(247, 244, 235, 0.94);
}

.lightbox-caption:empty {
  display: none;
}

.lightbox-nav {
  position: absolute;
  bottom: calc(20px + var(--safe-bottom));
  display: flex;
  align-items: center;
  gap: 24px;
}

/* Reduced motion accessibility */
@media (prefers-reduced-motion: reduce) {
  .cinema-photo,
  .cover-preview-frame,
  .lamp-glow,
  .music-disc-btn.playing svg {
    animation: none !important;
  }
  .memory-item {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
