/* ==========================================================================
   FAMILY MOMENTS (moments.azin.io) — Editorial Archive & Story Design System
   ========================================================================== */

:root {
  --bg-paper: #FAF7F4;
  --bg-card: #FFFFFF;
  --bg-stage: #FFFFFF;
  --ink: #1C1917;
  --ink-muted: #57534E;
  --ink-soft: #8A817C;
  --rose: #E84C6E;
  --rose-deep: #C93556;
  --rose-soft: #FFF0F3;
  --rose-line: rgba(232, 76, 110, 0.22);
  --line-subtle: rgba(28, 25, 23, 0.08);
  --shadow-soft: 0 12px 32px rgba(28, 25, 23, 0.06), 0 2px 8px rgba(232, 76, 110, 0.06);
  --shadow-elevated: 0 24px 60px rgba(28, 25, 23, 0.10), 0 6px 20px rgba(232, 76, 110, 0.10);

  --font-serif: 'Song Myung', 'Noto Serif KR', 'Nanum Myeongjo', Georgia, serif;
  --font-hand: 'Yeon Sung', 'Gaegu', cursive;
  --font-sans: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  --target-size: 24px;
  --radius-card: 24px;
  --radius-pill: 999px;
}

@media (pointer: coarse) {
  :root {
    --target-size: 44px;
  }
}

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

html {
  background-color: var(--bg-paper);
  color: var(--ink);
  font-family: var(--font-sans);
  scroll-padding-top: calc(4.5rem + env(safe-area-inset-top, 0px));
  scroll-padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
  -webkit-font-smoothing: antialiased;
}

body {
  min-block-size: 100dvh;
  background-color: var(--bg-paper);
  color: var(--ink);
  overflow-wrap: break-word;
  line-height: 1.6;
}

body.mode-story {
  background-color: var(--bg-stage);
}

img, video {
  max-inline-size: 100%;
  block-size: auto;
}

h1, h2, h3 {
  text-wrap: balance;
  word-break: keep-all;
}

p, li {
  text-wrap: pretty;
}

:where(a, code) {
  overflow-wrap: anywhere;
}

:where(button, a, [role="button"]) {
  min-block-size: var(--target-size);
  min-inline-size: var(--target-size);
}

:where(button, a, [tabindex="-1"]):focus-visible {
  outline: 2px solid var(--rose);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   VIEW TRANSITIONS (same-document-transitions)
   ========================================================================== */
.moment-card-media.vt-selected,
#story-stage.vt-active {
  view-transition-name: moment-hero;
}

::view-transition-old(moment-hero),
::view-transition-new(moment-hero) {
  height: 100%;
  object-fit: cover;
  border-radius: 20px;
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

/* ==========================================================================
   SCROLL PROGRESS INDICATOR (scroll-progress-indicator)
   ========================================================================== */
#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  inline-size: 100%;
  block-size: 3px;
  background: linear-gradient(90deg, #FF758C, #E84C6E, #FFB199);
  transform-origin: 0 50%;
  transform: scaleX(0);
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

body.mode-story #progress-bar {
  opacity: 1;
}

@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: scroll()) {
    @keyframes grow-story-progress {
      from { transform: scaleX(0); }
      to { transform: scaleX(1); }
    }
    body.mode-story #progress-bar {
      animation: grow-story-progress auto linear;
      animation-timeline: scroll(root block);
    }
  }
}

/* ==========================================================================
   VIEW 1: ANNUAL ARCHIVE HUB (moments.azin.io)
   ========================================================================== */
#archive-view {
  min-block-size: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 190, 204, 0.34), transparent 38%),
    radial-gradient(circle at 88% 14%, rgba(255, 224, 182, 0.32), transparent 36%),
    var(--bg-paper);
}

body.mode-story #archive-view {
  display: none;
}

.archive-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: max(14px, env(safe-area-inset-top, 14px));
  padding-bottom: 14px;
  padding-inline: max(20px, env(safe-area-inset-left, 20px)) max(20px, env(safe-area-inset-right, 20px));
  background: rgba(250, 247, 244, 0.84);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-subtle);
}

.brand-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-subtle);
  background: rgba(255, 255, 255, 0.85);
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.brand-back:hover {
  background: #FFFFFF;
  border-color: var(--rose-line);
  transform: translateX(-2px);
}

.brand-domain {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--line-subtle);
}

.archive-shell {
  width: min(1080px, 100%);
  margin-inline: auto;
  padding: clamp(28px, 5vw, 56px) clamp(18px, 4vw, 32px) calc(48px + env(safe-area-inset-bottom, 0px));
  flex: 1;
}

.archive-hero {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: clamp(24px, 4vw, 40px);
}

.archive-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rose);
  background: var(--rose-soft);
  border: 1px solid var(--rose-line);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
}

.archive-title {
  font-family: var(--font-serif);
  font-size: clamp(1.9rem, 1.3rem + 2.6vw, 3.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--ink);
}

.archive-title em {
  font-style: normal;
  color: var(--rose);
}

.archive-lead {
  font-size: clamp(0.95rem, 0.9rem + 0.35vw, 1.08rem);
  color: var(--ink-muted);
  max-inline-size: 56ch;
}

/* Filter Bar */
.archive-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-subtle);
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink-muted);
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.filter-chip:hover {
  border-color: var(--rose-line);
  color: var(--ink);
}

.filter-chip[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: #FFFFFF;
}

.filter-count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  opacity: 0.72;
}

/* Container-Aware Archive Grid */
.archive-grid-wrap {
  container: archive / inline-size;
}

.archive-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@container archive (inline-size > 38rem) {
  .archive-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
  }
  .moment-card.is-featured {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1.08fr 1fr;
    align-items: stretch;
  }
}

.moment-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.28s ease, border-color 0.28s ease;
}

.moment-card.is-live:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-elevated);
  border-color: var(--rose-line);
}

.moment-card.is-soon {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(250, 247, 244, 0.92));
  border-style: dashed;
  border-color: rgba(28, 25, 23, 0.16);
}

.moment-card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #FFF6F8;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.moment-card.is-featured .moment-card-media {
  aspect-ratio: 4 / 3;
  height: 100%;
}

.moment-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}

.moment-card.is-live:hover .moment-card-media img {
  transform: scale(1.04);
}

.moment-soon-cover {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.92), rgba(250, 244, 240, 0.9));
}

.moment-soon-seal {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.75rem;
  background: #FFFFFF;
  border: 1px solid var(--line-subtle);
  box-shadow: 0 8px 20px rgba(28, 25, 23, 0.06);
}

.moment-dday {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  background: #FFFFFF;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-subtle);
}

.moment-media-badges {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.moment-pill {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  color: var(--ink);
  border: 1px solid rgba(28, 25, 23, 0.08);
}

.moment-pill.is-live-dot {
  color: var(--rose-deep);
  background: rgba(255, 240, 243, 0.94);
  border-color: var(--rose-line);
}

.moment-card-body {
  padding: clamp(20px, 3vw, 28px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  flex: 1;
}

.moment-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--ink-soft);
}

.moment-card-title {
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, 1.05rem + 0.8vw, 1.65rem);
  font-weight: 700;
  line-height: 1.32;
  color: var(--ink);
  margin-top: 6px;
}

.moment-card-sub {
  font-size: 0.94rem;
  color: var(--ink-muted);
  margin-top: 8px;
  line-height: 1.6;
}

.moment-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line-subtle);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-pill);
  border: none;
  background: linear-gradient(135deg, #FF6584, #E84C6E);
  color: #FFFFFF;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(232, 76, 110, 0.28);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(232, 76, 110, 0.36);
  filter: brightness(1.03);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-subtle);
  background: #FFFFFF;
  color: var(--ink-muted);
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn-secondary:hover {
  border-color: var(--rose-line);
  color: var(--ink);
  background: var(--rose-soft);
}

.btn-soon-label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.archive-footer {
  margin-top: 44px;
  padding-top: 20px;
  border-top: 1px solid var(--line-subtle);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

/* Toast Notification */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 16px);
  background: rgba(28, 25, 23, 0.92);
  color: #FFFFFF;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-size: 0.86rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  z-index: 1200;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ==========================================================================
   VIEW 2: INTERACTIVE STORY READER
   ========================================================================== */
#story-view {
  display: none;
  position: relative;
  min-block-size: 100dvh;
  background-color: var(--bg-stage);
}

body.mode-story #story-view {
  display: block;
}

/* Fixed Pure-White Stage */
#story-stage {
  position: fixed;
  inset: 0;
  inline-size: 100dvw;
  block-size: 100dvh;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #FFFFFF;
}

#stage-canvas {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  display: block;
  z-index: 2;
}

/* Baby Azin GIF Overlay */
#gif-overlay {
  position: absolute;
  max-inline-size: min(92dvw, 480px);
  max-block-size: 52dvh;
  object-fit: contain;
  z-index: 3;
  opacity: 0;
  border-radius: 22px;
  box-shadow: 0 18px 46px rgba(28, 25, 23, 0.12);
  pointer-events: none;
  transform: scale(0.98);
  will-change: opacity, transform;
}

/* Scroll Track */
#scroll-track {
  position: relative;
  inline-size: 100%;
  block-size: 5400dvh;
  z-index: 10;
  pointer-events: none;
}

/* Story Top Floating HUD */
.story-hud-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: max(14px, env(safe-area-inset-top, 14px));
  padding-inline: max(14px, env(safe-area-inset-left, 14px)) max(14px, env(safe-area-inset-right, 14px));
  pointer-events: none;
}

.story-hud-group {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.hud-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 15px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(232, 76, 110, 0.22);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(28, 25, 23, 0.06);
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.hud-pill:hover {
  background: #FFFFFF;
  border-color: var(--rose);
}

.hud-pill.is-active {
  background: var(--rose-soft);
  border-color: var(--rose);
  color: var(--rose-deep);
}

/* Music EQ Bars */
.music-eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 13px;
}

.music-eq i {
  display: block;
  width: 2px;
  height: 45%;
  background: var(--rose);
  border-radius: 1px;
}

@media (prefers-reduced-motion: no-preference) {
  .music-eq.playing i:nth-child(1) { animation: eqHop 0.78s ease-in-out infinite alternate; }
  .music-eq.playing i:nth-child(2) { animation: eqHop 1.05s ease-in-out infinite alternate 0.18s; }
  .music-eq.playing i:nth-child(3) { animation: eqHop 0.88s ease-in-out infinite alternate 0.34s; }
}

@keyframes eqHop {
  from { height: 22%; }
  to { height: 100%; }
}

/* Side Chapter Scrubber (Desktop right / Mobile subtle top-sub strip) */
.chapter-rail {
  position: fixed;
  right: max(16px, env(safe-area-inset-right, 16px));
  top: 50%;
  transform: translateY(-50%);
  z-index: 95;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.chapter-dot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: transparent;
  padding: 4px 6px;
  cursor: pointer;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: var(--radius-pill);
  transition: color 0.2s ease;
}

.chapter-dot-label {
  opacity: 0;
  transform: translateX(4px);
  background: rgba(255, 255, 255, 0.92);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-subtle);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.chapter-dot:hover .chapter-dot-label,
.chapter-dot[aria-current="step"] .chapter-dot-label {
  opacity: 1;
  transform: translateX(0);
}

.chapter-dot-pip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(28, 25, 23, 0.18);
  transition: transform 0.22s ease, background-color 0.22s ease;
}

.chapter-dot[aria-current="step"] {
  color: var(--rose-deep);
}

.chapter-dot[aria-current="step"] .chapter-dot-pip {
  background: var(--rose);
  transform: scale(1.45);
}

@media (max-width: 768px) {
  .chapter-rail {
    top: calc(max(14px, env(safe-area-inset-top, 14px)) + 48px);
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    flex-direction: row;
    align-items: center;
    gap: 2px;
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(8px);
    border: 1px solid var(--line-subtle);
  }
  .chapter-dot {
    min-block-size: 32px;
    min-inline-size: 32px;
    padding: 4px;
    justify-content: center;
  }
  .chapter-dot-label {
    display: none;
  }
}

/* Story Entry Gate (with Preloader Progress & Envelope Preview) */
#story-gate {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 236, 241, 0.72), transparent 55%),
    rgba(255, 255, 255, 0.98);
  transition: opacity 0.65s ease, visibility 0.65s ease;
}

#story-gate.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.gate-card {
  width: min(460px, 100%);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.gate-preview-frame {
  width: min(200px, 46dvw);
  aspect-ratio: 1 / 1;
  border-radius: 28px;
  background: #FFFFFF;
  border: 1px solid var(--rose-line);
  box-shadow: var(--shadow-soft);
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 4px;
}

.gate-preview-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gate-sub {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--rose);
}

.gate-title {
  font-family: var(--font-serif);
  font-size: clamp(1.55rem, 1.2rem + 1.4vw, 2.25rem);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.32;
}

.gate-desc {
  font-size: 0.94rem;
  color: var(--ink-muted);
  max-inline-size: 36ch;
}

.gate-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
}

.gate-loader {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--ink-soft);
  margin-top: 4px;
}

.gate-loader-bar {
  width: 88px;
  height: 4px;
  border-radius: var(--radius-pill);
  background: rgba(232, 76, 110, 0.14);
  overflow: hidden;
}

.gate-loader-fill {
  height: 100%;
  width: 100%;
  background: var(--rose);
  transform-origin: 0 50%;
  transform: scaleX(0);
  transition: transform 0.2s ease;
}

/* Caption Overlay + Scroll Hint Above It */
#caption-layer {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: max(22px, env(safe-area-inset-bottom, 22px));
  padding-inline: 16px;
  pointer-events: none;
  z-index: 60;
  gap: 10px;
}

#scroll-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transition: opacity 0.35s ease;
}

#scroll-hint span {
  font-family: var(--font-serif);
  font-size: 0.88rem;
  color: var(--rose);
  background: rgba(255, 255, 255, 0.9);
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--rose-line);
}

.mouse-icon {
  width: 18px;
  height: 28px;
  border: 1.5px solid var(--rose);
  border-radius: 9px;
  position: relative;
  background: rgba(255, 255, 255, 0.92);
}

.mouse-wheel {
  width: 3px;
  height: 5px;
  background: var(--rose);
  border-radius: 2px;
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
}

@media (prefers-reduced-motion: no-preference) {
  .mouse-wheel {
    animation: scrollWheel 1.6s infinite ease-in-out;
  }
}

@keyframes scrollWheel {
  0% { transform: translate(-50%, 0); opacity: 1; }
  100% { transform: translate(-50%, 9px); opacity: 0; }
}

.caption-box {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(232, 76, 110, 0.2);
  border-radius: 20px;
  padding: 16px 28px;
  max-inline-size: min(92dvw, 580px);
  text-align: center;
  box-shadow: 0 12px 32px rgba(28, 25, 23, 0.05), 0 2px 10px rgba(232, 76, 110, 0.08);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.32s ease, transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

.caption-box.active {
  opacity: 1;
  transform: translateY(0);
}

.caption-year {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--rose);
  margin-bottom: 4px;
}

.caption-title {
  font-family: var(--font-serif);
  font-size: clamp(1.15rem, 1rem + 0.65vw, 1.45rem);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
  margin-bottom: 4px;
}

.caption-desc {
  font-family: var(--font-serif);
  font-size: clamp(0.92rem, 0.88rem + 0.25vw, 1.04rem);
  color: var(--ink-muted);
  line-height: 1.6;
  word-break: keep-all;
}

/* ==========================================================================
   FINAL LETTER STATIONERY OVERLAY (on top of original color photo)
   ========================================================================== */
#letter-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: calc(max(64px, env(safe-area-inset-top, 16px) + 52px)) 16px calc(max(20px, env(safe-area-inset-bottom, 20px)));
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.65s ease;
}

#letter-overlay.show {
  opacity: 1;
}

#letter-overlay.photo-peek .letter-stationery {
  opacity: 0;
  transform: scale(0.96);
  pointer-events: none;
}

.letter-stationery {
  position: relative;
  pointer-events: auto;
  background: rgba(255, 253, 251, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(232, 76, 110, 0.34);
  border-radius: 26px;
  padding: clamp(22px, 3.6vw, 36px) clamp(20px, 4vw, 42px);
  inline-size: min(92dvw, 560px);
  max-block-size: 76dvh;
  overflow-y: auto;
  box-shadow: var(--shadow-elevated);
  text-align: left;
  transform: translateY(18px);
  transition: transform 0.65s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
}

.letter-stationery::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 19px;
  border: 1px solid rgba(232, 76, 110, 0.14);
  pointer-events: none;
}

#letter-overlay.show .letter-stationery {
  transform: translateY(0);
}

.letter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(232, 76, 110, 0.22);
}

.letter-head-tag {
  font-family: var(--font-hand);
  font-size: clamp(1.15rem, 1.05rem + 0.45vw, 1.4rem);
  color: var(--rose-deep);
}

.letter-seal {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #FFFFFF;
  background: linear-gradient(135deg, #FF6584, #C93556);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

.letter-lines-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-family: var(--font-serif);
  font-size: clamp(0.92rem, 0.88rem + 0.28vw, 1.04rem);
  line-height: 1.7;
  color: #292524;
  word-break: keep-all;
}

.letter-line {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.letter-line.visible {
  opacity: 1;
  transform: translateY(0);
}

.letter-line.highlight {
  color: var(--rose-deep);
  font-weight: 700;
}

.letter-line.signature {
  font-family: var(--font-hand);
  font-size: clamp(1.1rem, 1rem + 0.4vw, 1.3rem);
  color: #57534E;
  text-align: right;
  margin-top: 8px;
}

.letter-footer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.letter-footer-actions.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Cherry Blossom Petals (Opt-in to motion) */
#petal-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 75;
  overflow: hidden;
}

#petal-layer.paused .petal {
  animation-play-state: paused !important;
  opacity: 0 !important;
}

.petal {
  position: absolute;
  top: -24px;
  background-color: #FFB8C6;
  border-radius: 150% 0 150% 0;
  opacity: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .petal {
    animation-name: petalFall;
    animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    animation-iteration-count: infinite;
  }
}

@keyframes petalFall {
  0% { transform: translate3d(0, 0, 0) rotate(0deg) scale(0.8); opacity: 0; }
  15% { opacity: 0.85; }
  100% { transform: translate3d(var(--drift, 80px), 108dvh, 0) rotate(720deg) scale(1.08); opacity: 0; }
}

@media (max-width: 768px) {
  .hud-pill {
    padding: 7px 12px;
    font-size: 0.78rem;
  }
  .caption-box {
    padding: 13px 18px;
    border-radius: 16px;
  }
}
