:root {
  color-scheme: light;
  /* ── Palette: Dark Red #3D0A05 · Ruby Red #7F1F0E · Grey Beige #A58570 · Silk #DAC3B1 · Indian Red #AC746C ── */
  --bg-cream: #f3a3a7;
  --bg-soft: #f7bcc0;
  --surface-romantic: rgba(248, 218, 202, 0.96);
  --surface-support: rgba(247, 226, 211, 0.92);
  --surface-magic: linear-gradient(180deg, rgba(248, 218, 202, 0.98), rgba(236, 204, 188, 0.94));
  --surface-highlight: linear-gradient(180deg, rgba(249, 223, 208, 0.98), rgba(231, 199, 181, 0.94));
  --surface-accent: linear-gradient(145deg, rgba(222, 105, 109, 0.16), rgba(231, 199, 181, 0.22));
  --rose: #de696d;
  --rose-deep: #952e2b;
  --plum: #701d18;
  --champagne: #b19f91;
  --cocoa: #5f2b25;
  --ink: #51231e;
  --muted: #88504a;
  --muted-strong: #7a413c;
  --border-soft: rgba(149, 46, 43, 0.18);
  --border-strong: rgba(112, 29, 24, 0.28);
  --shadow-lg: 0 18px 42px rgba(112, 29, 24, 0.12);
  --shadow-md: 0 12px 28px rgba(112, 29, 24, 0.1);
  --shadow-sm: 0 8px 18px rgba(112, 29, 24, 0.08);
  --panel-bg: linear-gradient(180deg, rgba(248, 218, 202, 0.98), rgba(242, 208, 191, 0.94));
  --panel-bg-alt: linear-gradient(180deg, rgba(250, 226, 213, 0.98), rgba(235, 206, 191, 0.94));
  --text-primary: #5a221d;
  --text-secondary: #7b4540;
  --text-on-accent: #FFF8F5;
  --nav-surface: rgba(248, 218, 202, 0.95);
  --nav-border: rgba(149, 46, 43, 0.14);
  --nav-shadow: 0 18px 34px rgba(112, 29, 24, 0.14);
  --overlay-bg: rgba(89, 36, 31, 0.38);
  --field-bg: rgba(255, 252, 248, 0.96);
  --hero-glow: rgba(222, 105, 109, 0.22);
  --image-overlay: linear-gradient(to top, rgba(26, 5, 3, 0.80), rgba(26, 5, 3, 0.08));
  --image-surface: linear-gradient(135deg, #DAC3B1, #A58570 58%, #7A5048);
  --accent-soft: rgba(222, 105, 109, 0.12);
  --accent-strong: rgba(149, 46, 43, 0.24);
  --plan-upcoming: linear-gradient(160deg, rgba(253, 247, 241, 0.96), rgba(240, 224, 212, 0.90));
  --plan-dreaming: linear-gradient(160deg, rgba(251, 244, 238, 0.96), rgba(234, 214, 204, 0.88));
  --plan-completed: linear-gradient(160deg, rgba(249, 242, 234, 0.96), rgba(232, 216, 204, 0.88));
  --letter-shell-bg: linear-gradient(160deg, #7F1F0E 0%, #3D0A05 100%);
  --letter-flap-top: linear-gradient(180deg, #6E1A0C 0%, #4A0C05 100%);
  --letter-flap-bottom: linear-gradient(180deg, #5A1208 0%, #3D0A05 100%);
  --letter-lining: linear-gradient(145deg, #8C3028 0%, #6B1A12 100%);
  --paper-bg: linear-gradient(180deg, rgba(255, 252, 247, 0.99), rgba(249, 241, 232, 0.99));
  --paper-rule: rgba(172, 116, 108, 0.04);
  --font-display: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: 'DM Sans', sans-serif;
  --max-shell: 1100px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --radius-xl: 34px;
  --radius-lg: 28px;
  --radius-md: 22px;
  --radius-sm: 18px;
}

body[data-theme="dark"] {
  color-scheme: dark;
  /* ── Dark mode: deep dark-red ground, palette colours lightened for contrast ── */
  --bg-cream: #140602;
  --bg-soft: #1C0A05;
  --surface-romantic: rgba(28, 12, 7, 0.93);
  --surface-support: rgba(36, 17, 10, 0.86);
  --surface-magic: linear-gradient(160deg, rgba(44, 20, 12, 0.96), rgba(56, 26, 15, 0.92));
  --surface-highlight: linear-gradient(145deg, rgba(172, 116, 108, 0.20), rgba(127, 31, 14, 0.26)), linear-gradient(180deg, #2E1208 0%, #3C1A0E 100%);
  --surface-accent: linear-gradient(145deg, rgba(172, 116, 108, 0.18), rgba(127, 31, 14, 0.28));
  --rose: #D49888;
  --rose-deep: #EAB8A4;
  --plum: #C09880;
  --champagne: #C4A888;
  --cocoa: #F5E8DC;
  --ink: #F8EDE0;
  --muted: #D4B098;
  --muted-strong: #B89070;
  --border-soft: rgba(218, 195, 177, 0.10);
  --border-strong: rgba(218, 195, 177, 0.18);
  --shadow-lg: 0 28px 64px rgba(0, 0, 0, 0.42);
  --shadow-md: 0 16px 36px rgba(0, 0, 0, 0.30);
  --shadow-sm: 0 10px 24px rgba(0, 0, 0, 0.22);
  --panel-bg: linear-gradient(165deg, rgba(28, 12, 7, 0.97), rgba(38, 18, 10, 0.92));
  --panel-bg-alt: linear-gradient(165deg, rgba(32, 14, 8, 0.97), rgba(46, 22, 12, 0.92));
  --text-primary: #F5EAE0;
  --text-secondary: #D4B098;
  --text-on-accent: #1A0503;
  --nav-surface: rgba(20, 8, 3, 0.94);
  --nav-border: rgba(218, 195, 177, 0.08);
  --nav-shadow: 0 18px 40px rgba(0, 0, 0, 0.42);
  --overlay-bg: rgba(8, 2, 1, 0.62);
  --field-bg: rgba(22, 10, 5, 0.94);
  --hero-glow: rgba(210, 152, 136, 0.08);
  --image-overlay: linear-gradient(to top, rgba(10, 3, 2, 0.85), rgba(10, 3, 2, 0.18));
  --image-surface: linear-gradient(135deg, #3C1A0E, #5C2C18 58%, #7A3C22);
  --accent-soft: rgba(210, 152, 136, 0.12);
  --accent-strong: rgba(210, 152, 136, 0.24);
  --plan-upcoming: linear-gradient(160deg, rgba(32, 14, 8, 0.98), rgba(46, 22, 12, 0.92));
  --plan-dreaming: linear-gradient(160deg, rgba(34, 15, 9, 0.98), rgba(50, 24, 14, 0.92));
  --plan-completed: linear-gradient(160deg, rgba(32, 14, 8, 0.98), rgba(48, 22, 12, 0.92));
  --letter-shell-bg: linear-gradient(160deg, #7F1F0E 0%, #3D0A05 100%);
  --letter-flap-top: linear-gradient(180deg, #6E1A0C 0%, #4A0C05 100%);
  --letter-flap-bottom: linear-gradient(180deg, #5A1208 0%, #3D0A05 100%);
  --letter-lining: linear-gradient(145deg, #8C3028 0%, #6B1A12 100%);
  --paper-bg: linear-gradient(180deg, rgba(245, 236, 226, 0.98), rgba(232, 220, 208, 0.98));
  --paper-rule: rgba(127, 31, 14, 0.05);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(255, 235, 224, 0.5), transparent 22%),
    radial-gradient(circle at top right, rgba(255, 211, 214, 0.42), transparent 26%),
    linear-gradient(180deg, var(--bg-soft) 0%, var(--bg-cream) 100%);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background 0.24s ease, color 0.24s ease;
}

button,
input,
textarea {
  font: inherit;
}

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

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

.page-glow {
  position: fixed;
  border-radius: 999px;
  filter: blur(110px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

.page-glow-left {
  width: 260px;
  height: 260px;
  left: -80px;
  top: 16%;
  background: rgba(255, 226, 214, 0.36);
  animation: drift 16s ease-in-out infinite;
}

.page-glow-right {
  width: 280px;
  height: 280px;
  right: -90px;
  bottom: 12%;
  background: rgba(222, 105, 109, 0.26);
  animation: drift 20s ease-in-out infinite reverse;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(calc(100% - 24px), var(--max-shell));
  margin: 0 auto;
  padding: 18px 0 116px;
}

.main-stack {
  display: grid;
  gap: 18px;
}

.topbar,
.section-heading,
.letter-topbar,
.list-card header,
.list-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: auto;
  padding: calc(var(--safe-top) + 10px) 20px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: color-mix(in srgb, var(--bg-cream) 80%, transparent);
  backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .topbar {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark,
.icon-pill,
.close-circle,
.lightbox-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 18px;
  background: var(--surface-romantic);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
  color: var(--text-primary);
}

.brand-mark {
  background: linear-gradient(145deg, var(--surface-romantic), var(--surface-support));
  font-weight: 700;
}

.theme-toggle {
  min-height: 52px;
  padding: 0 14px 0 12px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-romantic);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
  color: var(--text-primary);
}

.theme-toggle-icon {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--rose);
  font-size: 0.95rem;
}

.theme-toggle-copy {
  display: grid;
  gap: 2px;
  text-align: left;
}

.theme-toggle-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-strong);
}

.theme-toggle-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.editorial-body p {
  margin-top: 18px;
  font-size: 1.15rem;
  line-height: 1.85;
  color: var(--text-primary);
  max-width: 68ch;
  margin-left: auto;
  margin-right: auto;
}

.brand-copy {
  display: grid;
  gap: 3px;
}

.brand-copy small,
.eyebrow,
.meta,
.subtle {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-strong);
  font-weight: 600;
}

.brand-copy strong,
h1,
h2,
h3,
h4,
.story-quote,
.sweet-line,
.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--rose-deep);
  color: var(--text-on-accent);
  font-size: 10px;
  font-weight: 700;
}

.tab-panel {
  display: none;
  animation: panelIn 0.45s ease;
}

.tab-panel.active {
  display: grid;
  gap: 18px;
}

.layer-hero,
.layer-highlight,
.layer-support,
.layer-magic,
.editorial-card {
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-lg);
}

.layer-hero {
  background: var(--panel-bg);
}

.layer-highlight {
  background: var(--surface-highlight);
  color: var(--text-primary);
}

.layer-support {
  background: var(--surface-support);
  backdrop-filter: blur(18px);
}

.layer-magic {
  background: var(--surface-magic);
}

.card,
.panel-head,
.hero-card,
.feature-letter,
.editorial-card {
  overflow: hidden;
}

.card {
  padding: 20px;
}

.hero-card {
  position: relative;
  padding: 0;
  border-color: var(--border-strong);
}

.hero-card::after {
  display: none;
}

.hero-title {
  margin: 12px 0 16px;
  max-width: 14ch;
  font-size: clamp(3rem, 11vw, 5.4rem);
  line-height: 0.88;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.hero-browser-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(255, 244, 237, 0.55);
}

.hero-browser-dots {
  display: inline-flex;
  gap: 7px;
}

.hero-browser-dots span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--rose);
  opacity: 0.75;
}

.hero-browser-title,
.hero-browser-pill,
.hero-announcement {
  font-size: 0.82rem;
  letter-spacing: 0.05em;
}

.hero-browser-title,
.hero-browser-pill {
  color: var(--muted-strong);
}

.hero-browser-pill {
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 250, 247, 0.6);
}

.hero-announcement {
  padding: 10px 18px;
  text-align: center;
  color: var(--plum);
  border-bottom: 1px solid var(--border-soft);
  background: rgba(255, 240, 232, 0.6);
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(240px, 0.95fr);
  gap: 18px;
  padding: 24px;
  align-items: center;
}

.hero-copy-stack {
  display: grid;
  gap: 0;
}

.hero-sticker-field {
  position: relative;
  min-height: 300px;
  border-radius: 30px;
  border: 1px solid var(--border-soft);
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,0.45), transparent 20%),
    radial-gradient(circle at 78% 26%, rgba(255,255,255,0.35), transparent 18%),
    linear-gradient(180deg, rgba(255, 242, 236, 0.82), rgba(245, 211, 196, 0.72));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45);
  overflow: hidden;
}

.sticker-card {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 98px;
  min-height: 98px;
  padding: 14px;
  border-radius: 28px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 249, 245, 0.92);
  color: var(--plum);
  box-shadow: var(--shadow-sm);
  font-family: var(--font-display);
  font-size: 1.1rem;
  text-align: center;
}

.sticker-card::before {
  display: block;
  font-size: 1.4rem;
  margin-right: 0.35rem;
}

.sticker-heart { top: 18px; left: 18px; transform: rotate(-8deg); }
.sticker-heart::before { content: "♡"; }
.sticker-ticket { top: 26px; right: 22px; transform: rotate(6deg); }
.sticker-ticket::before { content: "✿"; }
.sticker-book { left: 46px; bottom: 26px; transform: rotate(5deg); }
.sticker-book::before { content: "✦"; }
.sticker-cherry { right: 40px; bottom: 84px; transform: rotate(-7deg); }
.sticker-cherry::before { content: "❦"; }
.sticker-star { left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-3deg); }
.sticker-star::before { content: "★"; }

.hero-copy {
  margin: 0;
  max-width: 34ch;
  color: var(--muted);
  line-height: 1.7;
  font-size: 1rem;
}

.hero-actions,
.inline-actions,
.filters,
.reaction-row,
.bottom-nav,
.pill-row,
.feature-letter-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.button,
.ghost-button,
.chip,
.plan-toggle,
.reaction,
.mode-button {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  transition: transform 0.22s ease, box-shadow 0.24s ease, background 0.24s ease, border-color 0.24s ease;
}

.button {
  background: linear-gradient(180deg, #d95d61, #a73a35);
  color: var(--text-on-accent);
  border-color: transparent;
  box-shadow: 0 10px 18px rgba(149, 46, 43, 0.18);
  font-weight: 700;
}

.ghost-button,
.chip,
.plan-toggle,
.reaction {
  background: rgba(255, 248, 244, 0.72);
  color: var(--text-primary);
  font-weight: 600;
}

.button:hover,
.ghost-button:hover,
.chip:hover,
.plan-toggle:hover,
.reaction:hover,
.mode-button:hover {
  transform: translateY(-1px);
}

.nav-item:hover {
  transform: translateY(-1px);
}

.gallery-item:hover {
  transform: translateY(-2px);
  z-index: 2;
}

.button:active,
.ghost-button:active,
.chip:active,
.plan-toggle:active,
.reaction:active {
  transform: scale(0.98);
  transition-duration: 0.1s;
}

.chip.active,
.plan-toggle.active,
.nav-item.active {
  background: linear-gradient(180deg, #d95d61, #a73a35);
  color: var(--text-on-accent);
  border-color: transparent;
  box-shadow: 0 10px 18px rgba(149, 46, 43, 0.18);
}

.centered {
  justify-content: center;
}

.signal-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 22px;
}

.signal,
.list-card,
.plan-card,
.voice-card,
.memory-quote,
.plan-detail,
.notif-item,
.sweet-card,
.mini-note,
.reaction-block {
  padding: 15px;
  border-radius: var(--radius-md);
  background: rgba(255, 247, 241, 0.82);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
}

.signal strong {
  display: block;
  margin-top: 6px;
  color: var(--text-primary);
  font-size: 1.18rem;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

.section-title-stack,
.memory-stage,
.composer,
.list,
.plan-grid,
.editorial-body,
.home-sequence,
.reading-stack,
.memory-flow {
  display: grid;
  gap: 14px;
}

.section-title-stack {
  gap: 4px;
}

.section-heading {
  align-items: end;
  margin-bottom: 12px;
}

.section-heading h2,
.card h3,
.list-card h3,
.panel-head h1,
.feature-letter h2,
.letter-modal h2,
.lightbox-card h2 {
  margin: 0;
}

.section-heading h2 {
  font-size: clamp(1.3rem, 3.5vw, 1.7rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
}

.list-card h3 {
  font-size: clamp(1.1rem, 3vw, 1.35rem);
  line-height: 1;
  letter-spacing: -0.015em;
}

.section-heading p,
.card p,
.list-card p,
.editorial-body p,
.panel-head p,
.feature-letter p,
.lightbox-caption {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.65;
}

.feature-letter {
  display: grid;
  gap: 0;
  padding: 0;
  color: var(--text-primary);
  background: linear-gradient(180deg, rgba(248, 218, 202, 0.98), rgba(239, 206, 189, 0.96));
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg);
}

.feature-letter-window {
  position: relative;
  display: grid;
  gap: 0;
  padding: 14px;
}

.feature-window-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(255, 245, 239, 0.55);
}

.feature-window-dots {
  display: inline-flex;
  gap: 7px;
}

.feature-window-dots span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--rose);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.28);
}

.feature-window-title,
.feature-window-status {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-strong);
}

.feature-letter .eyebrow,
.feature-letter .meta {
  color: var(--muted-strong);
}

.feature-window-title {
  font-weight: 700;
}

.feature-window-status {
  justify-self: end;
}

.feature-window-pane {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
  gap: 18px;
  padding: 22px;
  align-items: center;
}

.feature-window-pane::before {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 28px;
  border: 1px solid rgba(149, 46, 43, 0.08);
  pointer-events: none;
}

.featured-envelope-stage {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 14px;
  min-height: 100%;
  padding: 24px 14px;
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 18%, rgba(255,255,255,0.48), transparent 24%),
    radial-gradient(circle at 50% 70%, rgba(149, 46, 43, 0.12), transparent 56%),
    linear-gradient(180deg, rgba(255, 245, 239, 0.95), rgba(244, 219, 205, 0.92));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.26s ease, box-shadow 0.26s ease;
}

.featured-envelope-stage:hover,
.featured-envelope-stage:focus-visible {
  transform: translateY(-2px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 18px 34px rgba(8, 2, 5, 0.26);
}

.feature-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.feature-stage-caption {
  display: grid;
  gap: 3px;
  text-align: center;
  color: var(--text-primary);
}

.feature-stage-caption strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.feature-note-card {
  margin-top: 4px;
  padding: 15px 16px;
  border-radius: 18px;
  background: rgba(255, 247, 242, 0.68);
  border: 1px solid var(--border-soft);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.36);
}

.feature-note-card p {
  color: var(--text-secondary);
}

.feature-letter-actions {
  padding: 0 22px 22px;
}

.feature-letter-copy h2,
.feature-letter-copy p {
  color: inherit;
}

.feature-letter-copy h2 {
  font-size: clamp(2.2rem, 6.5vw, 3.4rem);
  line-height: 0.9;
  margin: 10px 0 12px;
  max-width: 13ch;
  letter-spacing: -0.025em;
}

.feature-letter .chip {
  background: rgba(255, 250, 247, 0.84);
  color: var(--plum);
  border-color: var(--border-soft);
}

.mini-envelope {
  position: relative;
  width: min(290px, 70vw);
  aspect-ratio: 1.2 / 0.82;
  border-radius: 20px;
  background: linear-gradient(160deg, #8B1525 0%, #641020 100%);
  border: 1px solid rgba(255, 200, 200, 0.1);
  box-shadow: 0 16px 40px rgba(74, 8, 18, 0.5), 0 0 0 1px rgba(180, 40, 56, 0.2);
  overflow: hidden;
  animation: envelopeFloat 4.8s ease-in-out infinite;
}

.mini-envelope.read {
  filter: saturate(0.94) brightness(0.98);
}

.mini-envelope.unread {
  box-shadow: 0 0 0 1px rgba(196, 48, 64, 0.3), 0 0 28px rgba(139, 21, 37, 0.35), 0 18px 40px rgba(74, 8, 18, 0.55);
}

.mini-envelope::before,
.mini-envelope::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
}

.mini-envelope::before {
  top: 0;
  bottom: auto;
  height: 54%;
  background: linear-gradient(180deg, #7A1220 0%, #5A0C18 100%);
  clip-path: polygon(0 0, 100% 0, 50% 86%);
  z-index: 2;
}

.mini-envelope::after {
  height: 56%;
  background: linear-gradient(180deg, #641020 0%, #4A0812 100%);
  clip-path: polygon(0 100%, 0 0, 50% 54%, 100% 0, 100% 100%);
  z-index: 1;
}

.mini-envelope-lining,
.mini-envelope-shimmer {
  position: absolute;
  inset: 0;
}

.mini-envelope-lining {
  clip-path: polygon(0 0, 50% 44%, 100% 0, 100% 34%, 50% 68%, 0 34%);
  background:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.12), transparent 34%),
    linear-gradient(135deg, #9B2030 0%, #7A1220 100%);
  z-index: 0;
}

.mini-envelope-shimmer {
  transform: translateX(-140%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.28), transparent);
  animation: shimmerSweep 6s ease-in-out infinite;
}

.WaxSeal,
.wax-tender,
.wax-reassuring,
.wax-playful {
  position: absolute;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.WaxSeal::before {
  content: "✿";
  font-size: 0.92rem;
  color: rgba(255, 247, 244, 0.86);
}

.wax-tender {
  background:
    radial-gradient(circle at 32% 26%, rgba(255,255,255,0.22), transparent 38%),
    radial-gradient(circle at 70% 74%, rgba(0,0,0,0.52), transparent 42%),
    radial-gradient(circle at 50% 50%, transparent 58%, rgba(0,0,0,0.40) 68%, rgba(0,0,0,0.24) 100%),
    radial-gradient(circle at 42% 34%, #B83020, #7F1F0E 62%, #3D0A05 100%);
}

.wax-reassuring {
  background:
    radial-gradient(circle at 32% 26%, rgba(255,255,255,0.20), transparent 38%),
    radial-gradient(circle at 70% 74%, rgba(0,0,0,0.50), transparent 42%),
    radial-gradient(circle at 50% 50%, transparent 58%, rgba(0,0,0,0.38) 68%, rgba(0,0,0,0.22) 100%),
    radial-gradient(circle at 42% 34%, #AC746C, #7F1F0E 55%, #3D0A05 100%);
}

.wax-playful {
  background:
    radial-gradient(circle at 32% 26%, rgba(255,255,255,0.24), transparent 38%),
    radial-gradient(circle at 70% 74%, rgba(0,0,0,0.48), transparent 42%),
    radial-gradient(circle at 50% 50%, transparent 58%, rgba(0,0,0,0.36) 68%, rgba(0,0,0,0.20) 100%),
    radial-gradient(circle at 42% 34%, #C44830, #9B2810 62%, #4A0C03 100%);
}

.mini-envelope .WaxSeal {
  width: 50px;
  height: 50px;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  box-shadow:
    inset 2px 3px 5px rgba(255,255,255,0.16),
    inset -2px -3px 5px rgba(0,0,0,0.5),
    0 4px 10px rgba(0,0,0,0.5),
    0 10px 24px rgba(74, 8, 18, 0.7),
    0 0 0 1px rgba(196, 48, 64, 0.25);
}

.home-duo,
.home-secondary,
.split-grid {
  display: grid;
  gap: 18px;
}

.panel-head {
  padding: 22px 22px 18px;
  background: var(--panel-bg);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-md);
}

.panel-head h1 {
  font-size: clamp(2.6rem, 9.5vw, 4.4rem);
  line-height: 0.88;
  margin-top: 8px;
  letter-spacing: -0.03em;
}

.panel-head p {
  max-width: 42ch;
}

.panel-head-story {
  background: var(--panel-bg-alt);
}

.panel-head-letters {
  background: var(--panel-bg);
}

.panel-head-memories {
  background: var(--panel-bg-alt);
}

.panel-head-plans {
  background: var(--panel-bg);
}

.editorial-photo-section {
  background: rgba(248, 238, 229, 0.94);
}

.editorial-kicker-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 0 0 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--muted-strong);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gallery-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr;
  gap: 12px;
  align-items: start;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--surface-secondary);
  aspect-ratio: 1 / 1;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gallery-item.wide {
  aspect-ratio: 16 / 10;
}

.gallery-item.tall {
  aspect-ratio: 4 / 5;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-item:hover img {
  transform: scale(1.015);
  filter: saturate(1.03);
}

.gallery-caption {
  position: static;
  padding: 0;
  color: var(--text-primary);
  background: transparent;
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.gallery-item::before {
  content: "Photo essay";
  order: -1;
  color: var(--muted-strong);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gallery-item.lead::before {
  content: "Lead image";
}

.gallery-item.lead .gallery-caption {
  font-size: clamp(1.45rem, 3vw, 1.95rem);
  max-width: 16ch;
}

.memory-feature .memory-photo,
.memory-photo {
  min-height: 260px;
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  align-items: end;
  color: #fffdf8;
  background:
    var(--image-overlay),
    var(--image-surface);
}

.memory-photo-copy h3 {
  color: #fffdf8;
  font-size: 1.5rem;
  line-height: 1.05;
  max-width: 12ch;
}

.memory-quote strong,
.reaction-block .meta,
.composer .meta {
  display: block;
  margin-bottom: 8px;
}

.memory-flow {
  grid-template-columns: 1fr;
}

.prompt-card {
  background: var(--surface-support);
}

.response-card {
  background: var(--surface-romantic);
}

.editorial-card {
  padding: 0;
  background: var(--surface-support);
}

.editorial-cover {
  min-height: 230px;
  padding: 22px;
  display: flex;
  align-items: end;
  color: #fffefb;
  background:
    var(--image-overlay),
    linear-gradient(130deg, color-mix(in srgb, var(--rose) 52%, var(--champagne) 48%) 0%, color-mix(in srgb, var(--bg-soft) 78%, var(--champagne) 22%) 45%, color-mix(in srgb, var(--rose-deep) 58%, var(--plum) 42%) 100%);
}

.editorial-cover-copy h2 {
  color: #fffefb;
  font-size: clamp(2.6rem, 8vw, 4rem);
  line-height: 0.88;
  letter-spacing: -0.03em;
}

.editorial-body {
  padding: 20px;
}

.story-quote {
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: var(--surface-support);
  border: 1px solid var(--border-soft);
  font-size: 1.2rem;
  line-height: 1.45;
}

.mode-card .story-quote {
  background: var(--accent-soft);
}

.mode-grid,
.reasons-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.mode-button {
  padding: 16px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-romantic);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.mode-button strong {
  display: block;
  margin-top: 8px;
  font-size: 0.92rem;
}

.mode-button.active {
  background: var(--surface-accent);
  border-color: var(--accent-strong);
  box-shadow: 0 16px 28px rgba(40, 28, 31, 0.12);
}

.mode-copy,
.sweet-line {
  min-height: 88px;
  display: grid;
  align-content: center;
}

.mini-note {
  min-height: 94px;
  display: grid;
  align-content: center;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--muted-strong);
}

.envelope-list .list-card,
.plan-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
}

.letter-list-envelope {
  position: relative;
  height: 126px;
  border-radius: 20px;
  margin: 4px 0 10px;
  background:
    radial-gradient(ellipse 90% 50% at 50% -5%, rgba(210, 70, 80, 0.2), transparent 65%),
    linear-gradient(180deg, transparent 50%, rgba(0,0,0,0.28) 100%),
    repeating-linear-gradient(0deg,  rgba(255,255,255,0.022) 0px, rgba(255,255,255,0.022) 1px, transparent 1px, transparent 4px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.015) 0px, rgba(255,255,255,0.015) 1px, transparent 1px, transparent 4px),
    var(--letter-shell-bg);
  border: 1px solid rgba(160, 30, 50, 0.4);
  overflow: hidden;
  box-shadow:
    inset 1px 1px 0 rgba(255,255,255,0.06),
    0 12px 32px rgba(74, 8, 18, 0.5);
}

.letter-list-envelope::before,
.letter-list-envelope::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
}

.letter-list-envelope::before {
  top: 0;
  bottom: auto;
  height: 54%;
  background: var(--letter-flap-top);
  clip-path: polygon(0 0, 100% 0, 50% 84%);
  z-index: 2;
}

.letter-list-envelope::after {
  height: 58%;
  background: var(--letter-flap-bottom);
  clip-path: polygon(0 100%, 0 0, 50% 52%, 100% 0, 100% 100%);
  z-index: 1;
}

.letter-list-lining,
.letter-list-shimmer {
  position: absolute;
  inset: 0;
}

.letter-list-lining {
  clip-path: polygon(0 0, 50% 42%, 100% 0, 100% 32%, 50% 68%, 0 32%);
  background: var(--letter-lining);
  z-index: 0;
}

.letter-list-shimmer {
  transform: translateX(-140%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.24), transparent);
  animation: shimmerSweep 7s ease-in-out infinite;
}

.letter-list-envelope .WaxSeal {
  width: 40px;
  height: 40px;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  box-shadow: inset 0 2px 8px rgba(255,255,255,0.18), 0 10px 16px rgba(78, 34, 44, 0.18);
  z-index: 3;
}

.list-letter-label {
  font-size: 0.84rem;
  color: var(--muted-strong);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.envelope-list .list-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, #8B1525, #C43040, #8B1525);
}

.plan-card.status-upcoming {
  background: var(--plan-upcoming);
}

.plan-card.status-dreaming {
  background: var(--plan-dreaming);
}

.plan-card.status-completed {
  background: var(--plan-completed);
}

.plan-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 94px;
  min-height: 34px;
  border-radius: 999px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  text-transform: capitalize;
}

.plan-chip.status-upcoming {
  background: rgba(159, 91, 108, 0.14);
  color: var(--rose-deep);
}

.plan-chip.status-dreaming {
  background: rgba(95, 59, 73, 0.1);
  color: var(--plum);
}

.plan-chip.status-completed {
  background: rgba(218, 193, 160, 0.22);
  color: #8b6842;
}

.plan-detail-home {
  background: rgba(255, 251, 247, 0.82);
}

.sweet-card {
  background: linear-gradient(160deg, rgba(255, 248, 244, 0.96), rgba(242, 227, 236, 0.92));
}

.sweet-line {
  text-align: center;
  font-size: 1.24rem;
  line-height: 1.42;
}

.letter-shell,
.notification-sheet,
.lightbox-shell {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  background: rgba(98, 53, 48, 0.26);
  backdrop-filter: blur(14px);
}

.reader-gate {
  position: fixed;
  inset: 0;
  z-index: 24;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  background: rgba(89, 36, 31, 0.34);
  backdrop-filter: blur(12px);
}

.reader-gate.open {
  display: flex;
}

.reader-gate-card,
.admin-auth-card {
  width: min(100%, 520px);
  padding: 24px;
  border-radius: 28px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, rgba(248, 227, 213, 0.98), rgba(240, 211, 194, 0.95));
  box-shadow: var(--shadow-lg);
}

.reader-gate-card h1,
.admin-auth-card h2 {
  margin: 8px 0 10px;
}

.reader-gate-form,
.admin-form {
  display: grid;
  gap: 12px;
}

.gate-input {
  min-height: 52px;
}

.reader-gate-note {
  margin: 12px 0 0;
  color: var(--text-secondary);
}

.admin-page .app-shell {
  padding-bottom: 48px;
}

.admin-dashboard {
  display: grid;
  gap: 18px;
}

.admin-form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.admin-checks {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--text-secondary);
  font-size: 0.94rem;
}

.file-input {
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: rgba(255, 251, 247, 0.9);
}

.admin-picker {
  width: 100%;
  text-align: left;
}

.letter-shell.open,
.notification-sheet.open,
.lightbox-shell.open {
  display: flex;
  animation: fadeIn 0.28s ease;
}

.letter-modal,
.sheet-card,
.lightbox-card {
  width: min(100%, 560px);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 18px 18px 20px;
  border-radius: 28px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, rgba(248, 227, 213, 0.98) 0%, rgba(241, 211, 193, 0.96) 100%);
  box-shadow: 0 24px 48px rgba(90, 35, 30, 0.18);
}

.lightbox-card {
  width: min(100%, 840px);
}

.lightbox-kicker-row {
  margin-bottom: 14px;
  padding-bottom: 10px;
}

.lightbox-topbar {
  align-items: start;
  margin-bottom: 12px;
}

.lightbox-stage {
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}

.lightbox-stage img {
  width: 100%;
  max-height: 64vh;
  object-fit: cover;
  border-radius: 0;
  border: 1px solid rgba(112, 29, 24, 0.12);
  background: rgba(245, 235, 229, 0.9);
}

.lightbox-meta {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin-top: 14px;
  align-items: end;
}

.lightbox-caption-stack {
  display: grid;
  gap: 4px;
}

.lightbox-caption {
  color: var(--cocoa);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.2rem, 3vw, 1.7rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  max-width: 18ch;
}

.lightbox-credit {
  display: grid;
  gap: 4px;
  justify-items: end;
  text-align: right;
}

.lightbox-credit strong {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--plum);
}

.lightbox-nav,
.close-circle {
  border-radius: 999px;
  background: rgba(255, 244, 237, 0.72);
  box-shadow: none;
}

.lightbox-nav {
  width: 56px;
  height: 56px;
  font-size: 1.15rem;
}

.envelope-frame {
  margin: 6px 0 18px;
}

.letter-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sound-toggle {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: var(--surface-romantic);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.sound-toggle:not(.muted) {
  background: var(--surface-accent);
  border-color: var(--accent-strong);
}

.letter-stage-shell {
  position: relative;
  padding: 12px 0 2px;
  border-radius: 32px;
  background:
    radial-gradient(circle at 50% 30%, rgba(255,255,255,0.38), transparent 28%),
    radial-gradient(circle at 50% 68%, rgba(149, 46, 43, 0.12), transparent 58%),
    linear-gradient(180deg, rgba(250, 226, 213, 0.96), rgba(236, 201, 185, 0.92));
  transition: filter 0.28s ease, transform 0.28s ease;
}

.letter-shell.phase-touch .letter-stage-shell {
  transform: scale(1.015);
  filter: drop-shadow(0 16px 28px rgba(112, 29, 24, 0.14));
}

.letter-sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.letter-sparkles span {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.9), rgba(255, 219, 201, 0.25) 70%, transparent 72%);
  opacity: 0;
}

.letter-sparkles span:nth-child(1) { top: 18%; left: 20%; }
.letter-sparkles span:nth-child(2) { top: 12%; right: 22%; }
.letter-sparkles span:nth-child(3) { top: 38%; left: 18%; }
.letter-sparkles span:nth-child(4) { top: 44%; right: 14%; }
.letter-sparkles span:nth-child(5) { bottom: 26%; left: 28%; }
.letter-sparkles span:nth-child(6) { bottom: 18%; right: 30%; }

.letter-shell.phase-seal-break .letter-sparkles span {
  animation: sparkleBurst 0.9s ease forwards;
}

.envelope {
  position: relative;
  min-height: 240px;
  border-radius: var(--radius-lg);
  background:
    /* directional top-centre light hit */
    radial-gradient(ellipse 90% 55% at 50% -5%, rgba(210, 70, 80, 0.22), transparent 65%),
    /* left-edge shadow */
    linear-gradient(90deg, rgba(0,0,0,0.14) 0%, transparent 22%, transparent 78%, rgba(0,0,0,0.12) 100%),
    /* bottom-edge depth shadow */
    linear-gradient(180deg, transparent 52%, rgba(0,0,0,0.32) 100%),
    /* linen horizontal threads */
    repeating-linear-gradient(0deg,   rgba(255,255,255,0.028) 0px, rgba(255,255,255,0.028) 1px, transparent 1px, transparent 4px),
    /* linen vertical threads */
    repeating-linear-gradient(90deg,  rgba(255,255,255,0.018) 0px, rgba(255,255,255,0.018) 1px, transparent 1px, transparent 4px),
    /* base colour */
    var(--letter-shell-bg);
  overflow: hidden;
  border: 1px solid rgba(160, 30, 50, 0.45);
  box-shadow:
    inset 1px 1px 0 rgba(255,255,255,0.08),
    inset -1px -1px 0 rgba(0,0,0,0.25),
    0 28px 60px rgba(74, 8, 18, 0.62),
    0 0 0 1px rgba(140, 20, 38, 0.35);
  transform-style: preserve-3d;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.envelope.unread {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 0 0 1px rgba(196, 48, 64, 0.35), 0 0 36px rgba(139, 21, 37, 0.45), 0 20px 48px rgba(74, 8, 18, 0.5);
}

.envelope-frame::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 30px;
  background: radial-gradient(ellipse at 50% 55%, rgba(139, 21, 37, 0.55), rgba(74, 8, 18, 0.38) 45%, transparent 72%);
  filter: blur(28px);
  z-index: 0;
}

.envelope-back,
.envelope-lining,
.EnvelopeFlap,
.seal-glow {
  position: absolute;
}

.envelope-back {
  inset: auto 0 0 0;
  height: 52%;
  background:
    /* fold crease highlight along top V edge */
    linear-gradient(180deg, rgba(255,255,255,0.07) 0%, rgba(255,255,255,0.07) 3%, transparent 10%),
    var(--letter-flap-bottom);
  clip-path: polygon(0 100%, 0 0, 50% 52%, 100% 0, 100% 100%);
  z-index: 1;
}

.envelope-lining {
  inset: 0;
  clip-path: polygon(0 0, 50% 42%, 100% 0, 100% 30%, 50% 66%, 0 30%);
  background: var(--letter-lining);
  z-index: 1;
}

.lining-pattern {
  position: absolute;
  inset: 0;
  background:
    /* satin sheen highlight streaks */
    radial-gradient(ellipse 60% 40% at 22% 28%, rgba(255,255,255,0.18), transparent 55%),
    radial-gradient(ellipse 50% 35% at 78% 32%, rgba(255,255,255,0.13), transparent 50%),
    radial-gradient(ellipse 40% 30% at 50% 62%, rgba(255,255,255,0.09), transparent 50%),
    /* deep shadow in corners */
    radial-gradient(ellipse 80% 80% at 0% 0%, rgba(0,0,0,0.18), transparent 55%),
    radial-gradient(ellipse 80% 80% at 100% 0%, rgba(0,0,0,0.14), transparent 55%);
  opacity: 0.9;
}

.EnvelopeFlap {
  left: 0;
  right: 0;
  top: 0;
  height: 48%;
  background:
    /* fold crease shadow at tip/bottom of the flap */
    linear-gradient(180deg, transparent 78%, rgba(0,0,0,0.3) 100%),
    /* top-edge light catch */
    linear-gradient(180deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.04) 14%, transparent 30%),
    var(--letter-flap-top);
  clip-path: polygon(0 0, 100% 0, 50% 88%);
  transform-origin: top;
  transition: transform 0.3s ease;
  z-index: 3;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.35));
}

.WaxSeal#wax-seal {
  width: 62px;
  height: 62px;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%) scale(1);
  z-index: 5;
  box-shadow:
    /* inner top-left raised highlight */
    inset 2px 3px 5px rgba(255,255,255,0.18),
    /* inner bottom-right pressed shadow */
    inset -2px -3px 6px rgba(0,0,0,0.55),
    /* close drop shadow — raised off surface */
    0 4px 8px rgba(0,0,0,0.55),
    /* mid glow */
    0 10px 28px rgba(74, 8, 18, 0.75),
    /* wide ambient glow */
    0 18px 48px rgba(139, 21, 37, 0.45),
    /* rim ring */
    0 0 0 1.5px rgba(196, 48, 64, 0.28);
  transition: transform 0.2s ease, opacity 0.25s ease, filter 0.25s ease;
}

.seal-glow {
  width: 110px;
  height: 110px;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(196, 48, 64, 0.55), transparent 64%);
  opacity: 0;
  z-index: 4;
}

.letter-shell.phase-touch .envelope {
  transform: scale(1.03);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 28px 42px rgba(32, 20, 24, 0.18);
}

.letter-shell.phase-seal-break #wax-seal {
  transform: translateX(-50%) scale(1.1);
  filter: brightness(1.1) saturate(1.08);
  animation: sealPulse 0.26s ease forwards;
}

.letter-shell.phase-seal-break .seal-glow {
  opacity: 1;
}

.letter-shell.phase-seal-break .WaxSeal#wax-seal::before {
  content: "✦";
}

.letter-shell.phase-seal-break #wax-seal.broken {
  opacity: 0;
  transform: translateX(-50%) scale(0.8);
}

.letter-shell.phase-flap-open .EnvelopeFlap,
.letter-shell.phase-unfold .EnvelopeFlap,
.letter-shell.phase-reveal .EnvelopeFlap,
.letter-shell.phase-opened .EnvelopeFlap,
.letter-shell.phase-reopen .EnvelopeFlap {
  transform: rotateX(180deg);
}

.letter-paper {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 16px;
  min-height: 210px;
  padding: 30px 28px 32px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(255,255,255,0.34), transparent 24%),
    var(--paper-bg),
    repeating-linear-gradient(180deg, rgba(255,255,255,0.02) 0, rgba(255,255,255,0.02) 2px, var(--paper-rule) 2px, var(--paper-rule) 4px);
  box-shadow: 0 22px 36px rgba(88, 52, 49, 0.12);
  transform: translateY(84px) scaleY(0.78);
  transform-origin: bottom center;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
  z-index: 1;
  overflow: hidden;
}

.letter-paper::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 16px;
  border: 1px solid rgba(127, 31, 14, 0.22);
  box-shadow: inset 0 0 0 1px rgba(172, 116, 108, 0.08);
  pointer-events: none;
}

.paper-fold {
  display: none;
}

.paper-accent {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 88px;
  height: 88px;
  background:
    radial-gradient(circle at 36% 32%, rgba(255,255,255,0.28), transparent 18%),
    radial-gradient(circle at 58% 54%, rgba(224, 182, 157, 0.18), transparent 20%);
  opacity: 0.55;
  pointer-events: none;
}

.letter-shell.phase-letter-slide .letter-paper {
  transform: translateY(22px) scaleY(0.82);
}

.letter-shell.phase-unfold .letter-paper,
.letter-shell.phase-reveal .letter-paper,
.letter-shell.phase-opened .letter-paper {
  transform: translateY(-6px) scaleY(1);
}

.letter-shell.phase-reopen .letter-paper {
  transform: translateY(-4px) scaleY(1);
  transition-duration: 0.22s;
}

/* ── Reading mode: dissolve the envelope chrome, let the letter breathe ── */
.letter-shell.phase-opened .envelope,
.letter-shell.phase-reopen .envelope {
  overflow: visible;
  min-height: 0;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  transition: background 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease, min-height 0.35s ease;
}

.letter-shell.phase-opened .envelope > :not(.letter-paper),
.letter-shell.phase-reopen .envelope > :not(.letter-paper) {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}

.letter-shell.phase-opened .letter-paper,
.letter-shell.phase-reopen .letter-paper {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  transform: none !important;
  min-height: unset;
  padding: 36px 30px 48px;
  margin: 0;
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 48px rgba(88, 52, 49, 0.1), inset 0 1px 0 rgba(255,255,255,0.5);
}

.letter-shell.phase-opened .letter-content,
.letter-shell.phase-reopen .letter-content {
  gap: 20px;
}

.letter-shell.phase-opened .letter-content p,
.letter-shell.phase-reopen .letter-content p {
  max-width: 54ch;
  font-size: 1.1rem;
  line-height: 2;
}

.letter-shell.phase-opened .letter-inner-title,
.letter-shell.phase-reopen .letter-inner-title {
  font-size: 1.12rem;
  opacity: 1;
  margin-bottom: 4px;
}

.letter-content {
  display: grid;
  gap: 14px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.letter-content > * {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.32s ease, transform 0.32s ease;
}

.letter-shell.phase-reveal .letter-content,
.letter-shell.phase-opened .letter-content,
.letter-shell.phase-reopen .letter-content {
  opacity: 1;
  transform: translateY(0);
}

.letter-shell.phase-reveal .letter-content > *,
.letter-shell.phase-opened .letter-content > *,
.letter-shell.phase-reopen .letter-content > * {
  opacity: 1;
  transform: translateY(0);
}

.letter-shell.phase-reveal .letter-content > :nth-child(1),
.letter-shell.phase-opened .letter-content > :nth-child(1),
.letter-shell.phase-reopen .letter-content > :nth-child(1) { transition-delay: 0.05s; }
.letter-shell.phase-reveal .letter-content > :nth-child(2),
.letter-shell.phase-opened .letter-content > :nth-child(2),
.letter-shell.phase-reopen .letter-content > :nth-child(2) { transition-delay: 0.12s; }
.letter-shell.phase-reveal .letter-content > :nth-child(3),
.letter-shell.phase-opened .letter-content > :nth-child(3),
.letter-shell.phase-reopen .letter-content > :nth-child(3) { transition-delay: 0.18s; }

.letter-inner-title {
  font-size: 1rem;
  line-height: 1.2;
  text-align: left;
  margin: 0 0 10px;
  color: var(--rose-deep);
  opacity: 0.9;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.letter-content p {
  margin: 0;
  white-space: pre-line;
  line-height: 1.85;
  color: color-mix(in srgb, var(--text-primary) 88%, var(--muted-strong) 12%);
  font-size: 1.1rem;
  max-width: 34ch;
}

.letter-content p::first-letter {
  float: left;
  font-family: var(--font-display);
  font-size: 1.9rem;
  line-height: 1;
  padding-right: 6px;
  color: var(--rose-deep);
}

.reading-stack {
  gap: 12px;
}

.reaction-block {
  display: grid;
  gap: 10px;
  background: linear-gradient(180deg, var(--surface-romantic), var(--surface-support));
}

.comment-box {
  width: 100%;
  min-height: 110px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--field-bg);
  resize: vertical;
  color: var(--text-primary);
}

.notif-item strong {
  color: var(--cocoa);
}

.bottom-nav-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 12;
  padding: 12px 14px calc(24px + var(--safe-bottom));
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), color-mix(in srgb, var(--bg-cream) 82%, transparent) 30%, var(--bg-cream) 100%);
  pointer-events: none; /* Only allow clicks on the pill itself */
}

.bottom-nav {
  pointer-events: auto;
  /* ... rest stays same ... */
}

.bottom-nav {
  width: min(calc(100% - 8px), 720px);
  margin: 0 auto;
  padding: 10px;
  justify-content: space-between;
  border-radius: 30px;
  background: var(--nav-surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--nav-shadow);
  backdrop-filter: blur(24px) saturate(180%);
}

.nav-item {
  flex: 1;
  min-height: 62px;
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--muted-strong);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease, background 0.2s ease;
}

.nav-item:active {
  transform: scale(0.92);
}

.nav-item i {
  width: 22px;
  height: 22px;
  transition: transform 0.22s ease;
}

.nav-item.active i {
  transform: translateY(-1px) scale(1.1);
}

.floating-sweet {
  position: fixed;
  right: 22px;
  bottom: 104px;
  z-index: 11;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--rose), var(--rose-deep));
  color: var(--text-on-accent);
  box-shadow: 0 14px 28px rgba(80, 56, 63, 0.24);
  font-size: 1.1rem;
  animation: heartPulse 3s ease-in-out infinite;
}

.sweet-popup {
  position: fixed;
  right: 20px;
  bottom: 168px;
  z-index: 14;
  max-width: 230px;
  padding: 14px 16px;
  border-radius: 20px 20px 6px 20px;
  background: color-mix(in srgb, var(--rose-deep) 78%, #1d1718 22%);
  color: var(--text-on-accent);
  box-shadow: 0 20px 44px rgba(32, 17, 15, 0.28);
  opacity: 0;
  transform: translateY(10px) scale(0.94);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  font-size: 0.92rem;
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: -0.01em;
}

.install-hint {
  position: sticky;
  top: 14px;
  z-index: 35;
  padding: 0 18px;
  margin-top: 14px;
}

.install-hint-card {
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 16px 18px;
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  background: color-mix(in srgb, var(--surface-primary) 88%, var(--accent-soft) 12%);
  box-shadow: var(--shadow-soft);
  color: var(--text-strong);
}

.install-hint-card strong {
  display: block;
  margin-top: 4px;
  font-size: 1rem;
}

.install-hint-card p {
  margin: 8px 0 12px;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.sweet-popup.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* .sweet-popup.show is defined above */

.envelope.classic.special::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 22px;
  border: 1px solid rgba(218, 193, 160, 0.36);
  pointer-events: none;
}

.envelope.open-when.unread {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 0 1px rgba(196, 48, 64, 0.4), 0 0 40px rgba(139, 21, 37, 0.5), 0 20px 48px rgba(74, 8, 18, 0.55);
}

.sound-toggle:focus-visible,
.letter-list-envelope:focus-visible {
  outline: 3px solid rgba(159, 91, 108, 0.24);
  outline-offset: 2px;
}

.reveal-step {
  opacity: 0;
  transform: translateY(16px);
}

body.loaded .reveal-step {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

body.loaded .home-sequence > :nth-child(1) { transition-delay: 0.02s; }
body.loaded .home-sequence > :nth-child(2) { transition-delay: 0.09s; }
body.loaded .home-sequence > :nth-child(3) { transition-delay: 0.16s; }
body.loaded .home-sequence > :nth-child(4) { transition-delay: 0.23s; }

button:active {
  transform: scale(0.97);
}

button:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--rose) 36%, transparent);
  outline-offset: 2px;
}

@media (min-width: 860px) {
  .home-duo,
  .home-secondary,
  .split-grid {
    grid-template-columns: 1.18fr 0.82fr;
  }

  .feature-window-pane {
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  }

  .memory-flow {
    grid-template-columns: 0.92fr 1.08fr;
  }
}

@media (min-width: 761px) and (max-width: 1024px) {
  .gallery-grid {
    grid-template-columns: 1.15fr 1fr;
  }

  .gallery-item.wide {
    grid-column: span 2;
  }

  .gallery-item.tall {
    grid-row: span 1;
  }

  .gallery-item.wide img {
    min-height: 280px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(calc(100% - 16px), var(--max-shell));
  }

  .hero-browser-bar {
    grid-template-columns: auto 1fr;
  }

  .hero-browser-pill {
    display: none;
  }

  .hero-layout,
  .feature-window-pane {
    grid-template-columns: 1fr;
  }

  .hero-layout {
    padding: 18px;
  }

  .hero-sticker-field {
    min-height: 240px;
  }

  .mode-grid,
  .reasons-grid {
    grid-template-columns: 1fr;
  }

  .hero-title {
    max-width: 10ch;
  }

  .feature-window-bar {
    grid-template-columns: auto 1fr;
  }

  .feature-window-status {
    display: none;
  }

  .feature-window-pane {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .feature-window-pane::before {
    inset: 14px;
  }

  .feature-letter-actions {
    padding: 0 18px 18px;
  }

  .featured-envelope-stage {
    min-height: 320px;
  }

  .editorial-kicker-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .gallery-item.wide,
  .gallery-item.tall {
    grid-column: auto;
    grid-row: auto;
  }

  .gallery-item img,
  .gallery-item.wide img,
  .gallery-item.tall img {
    min-height: 220px;
    height: 220px;
  }

  .lightbox-card {
    padding: 14px;
  }

  .lightbox-kicker-row {
    grid-template-columns: 1fr 1fr;
  }

  .lightbox-kicker-row span:last-child {
    grid-column: 1 / -1;
  }

  .lightbox-stage {
    grid-template-columns: 42px 1fr 42px;
    gap: 10px;
  }

  .lightbox-nav {
    width: 42px;
    height: 42px;
  }

  .lightbox-meta {
    grid-template-columns: 1fr;
  }

  .lightbox-credit {
    justify-items: start;
    text-align: left;
  }

  .bottom-nav {
    width: min(calc(100% - 4px), 100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .reveal-step {
    opacity: 1;
    transform: none;
  }

  .mini-envelope,
  .mini-envelope-shimmer {
    animation: none !important;
  }
}

@keyframes drift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1) rotate(0deg); }
  33% { transform: translate3d(30px, -40px, 0) scale(1.1) rotate(2deg); }
  66% { transform: translate3d(-20px, 20px, 0) scale(0.95) rotate(-2deg); }
}

.page-glow {
  animation: drift 25s ease-in-out infinite;
  will-change: transform;
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes heartPulse {
  0%, 100% { box-shadow: 0 10px 22px rgba(159, 91, 108, 0.2); }
  50% { box-shadow: 0 14px 30px rgba(159, 91, 108, 0.28); }
}

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

@keyframes shimmerSweep {
  0%, 80%, 100% { transform: translateX(-140%); opacity: 0; }
  12%, 32% { opacity: 1; }
  40% { transform: translateX(140%); opacity: 0; }
}

@keyframes sealPulse {
  0% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.12); }
  100% { transform: translateX(-50%) scale(1.04); }
}

@keyframes sparkleBurst {
  0% { opacity: 0; transform: scale(0.4) translateY(0); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.5) translateY(-24px); }
}
