:root {
    /* surfaces */
    --surface: rgba(255, 248, 239, 0.82);
    --surface-glass: rgba(255, 248, 239, 0.76);
    --surface-solid: rgba(255, 245, 235, 0.97);
    --surface-hover: rgba(255, 255, 255, 0.75);
    --surface-alt: rgba(255, 255, 255, 0.5);

    /* borders */
    --border-wine: rgba(103, 29, 44, 0.12);
    --border-accent: rgba(183, 63, 85, 0.22);
    --border-light: rgba(255, 255, 255, 0.6);

    /* overlays & backdrops */
    --overlay-dark: rgba(37, 21, 21, 0.8);
    --overlay-light: rgba(37, 21, 21, 0.52);
    --bg-overlay: transparent;
    --lightbox-bg: rgba(103, 29, 44, 0.72);
    --video-lightbox-bg: rgba(37, 10, 16, 0.92);

    /* inputs */
    --input-bg: rgba(255, 255, 255, 0.74);
    --input-border: rgba(103, 29, 44, 0.16);

    /* misc */
    --upload-zone-bg: rgba(255, 248, 239, 0.7);
    --upload-zone-hover: rgba(183, 63, 85, 0.05);
    --video-card-bg: rgba(255, 248, 239, 0.88);
    --chapter-bg: linear-gradient(135deg, rgba(255, 248, 239, 0.94), rgba(140, 199, 212, 0.22));
    --welcome-bg: linear-gradient(160deg, #fff8ef 0%, #fde8d4 55%, #f3b5a4 100%);
    --greeting-card-bg: linear-gradient(145deg, #fff8ef 0%, #fde8d4 55%, #f3b5a4 100%);
    --surprise-card-bg: linear-gradient(160deg, #fff8ef, #f6dfc9 58%, #f3b5a4);
    --inline-upload-bg: linear-gradient(145deg, #fff8ef, #f6dfc9 70%);
}

/* ── Dark theme overrides ────────────────── */
[data-theme="dark"] {
    --ink: #e8e0dc;
    --muted: #b09888;
    --paper: #121212;
    --paper-deep: #1a1a1a;
    --wine: #d4849a;
    --rose: #d4546e;
    --mint: #4ecdb5;
    --sky: #a8dbe6;
    --gold: #e8b362;
    --shadow-sm: 0 8px 32px rgba(0, 0, 0, 0.35);
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.55);

    /* surfaces */
    --surface: rgba(30, 30, 30, 0.88);
    --surface-glass: rgba(24, 24, 24, 0.82);
    --surface-solid: rgba(32, 32, 32, 0.97);
    --surface-hover: rgba(45, 45, 45, 0.8);
    --surface-alt: rgba(40, 40, 40, 0.55);

    /* borders */
    --border-wine: rgba(200, 150, 165, 0.14);
    --border-accent: rgba(212, 84, 110, 0.22);
    --border-light: rgba(255, 255, 255, 0.06);

    /* overlays */
    --overlay-dark: rgba(0, 0, 0, 0.85);
    --overlay-light: rgba(0, 0, 0, 0.6);
    --bg-overlay: rgba(10, 8, 8, 0.78);
    --lightbox-bg: rgba(26, 10, 14, 0.85);
    --video-lightbox-bg: rgba(18, 5, 8, 0.94);

    /* inputs */
    --input-bg: rgba(40, 40, 40, 0.74);
    --input-border: rgba(200, 150, 165, 0.18);

    /* misc */
    --upload-zone-bg: rgba(30, 30, 30, 0.7);
    --upload-zone-hover: rgba(212, 84, 110, 0.08);
    --video-card-bg: rgba(28, 28, 28, 0.9);
    --chapter-bg: linear-gradient(135deg, rgba(28, 28, 28, 0.94), rgba(25, 50, 45, 0.22));
    --welcome-bg: linear-gradient(160deg, #141010 0%, #1e1518 55%, #1a1214 100%);
    --greeting-card-bg: linear-gradient(145deg, #1e1518 0%, #261a20 55%, #1e1518 100%);
    --surprise-card-bg: linear-gradient(160deg, #1e1518, #261a20 58%, #1e1518);
    --inline-upload-bg: linear-gradient(145deg, #1e1518, #261a20 70%);
}

/* ── Body overlay for dark mode bg image ── */
[data-theme="dark"] body::before {
    background: radial-gradient(ellipse at 15% 15%, rgba(18, 18, 18, 0.7) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 10%, rgba(18, 18, 18, 0.6) 0%, transparent 45%),
    linear-gradient(160deg, rgba(18, 18, 18, 0.88) 0%, rgba(14, 12, 12, 0.82) 50%, rgba(18, 18, 18, 0.88) 100%);
}

/* ── Dark mode: buttons that need --rose bg instead of --wine ── */
[data-theme="dark"] .nav-links button.is-active,
[data-theme="dark"] .nav-mobile-menu button.is-active {
    background: var(--rose);
}

[data-theme="dark"] .primary-button {
    background: var(--rose);
    box-shadow: 0 16px 36px rgba(212, 84, 110, 0.28);
}

[data-theme="dark"] .primary-button:hover {
    box-shadow: 0 20px 48px rgba(212, 84, 110, 0.38);
}

/* ── Dark mode: page shell blobs ── */
[data-theme="dark"] .page-shell::before {
    background: radial-gradient(circle, rgba(216, 154, 66, 0.04), transparent 70%);
}

[data-theme="dark"] .page-shell::after {
    background: radial-gradient(circle, rgba(140, 199, 212, 0.05), transparent 70%);
}

/* ── Dark mode: hero grid lines ── */
[data-theme="dark"] .hero-stage::before {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
}

/* ── Dark mode: countdown heartbeat shadow ── */
[data-theme="dark"] .countdown .heartbeat {
    box-shadow: 0 14px 34px rgba(212, 84, 110, 0.35);
}

[data-theme="dark"] .countdown span {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-wine);
}

/* ── Dark mode: envelope adjustments ── */
[data-theme="dark"] .envelope {
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .envelope:hover {
    box-shadow: 0 32px 100px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .envelope-paper {
    background: linear-gradient(135deg, #2a2024, #1a1416);
}

/* ── Dark mode: hero copy glow ── */
[data-theme="dark"] .hero-copy::before {
    background: radial-gradient(circle, rgba(212, 84, 110, 0.1), transparent 68%);
}

/* ── Dark mode: photo frame ── */
[data-theme="dark"] .photo-frame {
    background: linear-gradient(160deg, #0e0a0a 0%, #141010 55%, #0e0a0a 100%);
}

/* ── Dark mode: carousel shadow ── */
[data-theme="dark"] .chapter-carousel {
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
}

/* ── Dark mode: roaming bubble ── */
[data-theme="dark"] .roaming-bubble {
    background: rgba(28, 24, 26, 0.96);
    border-color: rgba(212, 84, 110, 0.25);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    color: #e8a8ba;
}

[data-theme="dark"] .roaming-bubble::after {
    background: rgba(28, 24, 26, 0.96);
    border-right-color: rgba(212, 84, 110, 0.22);
    border-bottom-color: rgba(212, 84, 110, 0.22);
}

[data-theme="dark"] .section-heading h2 {
    color: #f6dfc9;
}

/* ── Dark mode: loading spinner ── */
[data-theme="dark"] .loading-mark {
    border-color: rgba(212, 84, 110, 0.15);
    border-top-color: var(--rose);
}

/* ── Dark mode: footer — minimal tweaks ── */
[data-theme="dark"] .site-footer {
    background: linear-gradient(165deg, #0e0a0a 0%, #141012 55%, #0e0a0a 100%);
    border-top-color: rgba(216, 154, 66, 0.18);
}

[data-theme="dark"] .footer-col {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .footer-col:hover {
    background: rgba(255, 255, 255, 0.07);
}

.theme-toggle {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 51;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--border-accent);
    border-radius: 50%;
    background: rgba(28, 24, 26, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    transition: background 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease,
    transform 0.2s ease;
}

[data-theme="dark"] .theme-toggle {
    background: rgba(255, 248, 239, 0.92);
}

.theme-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}

.theme-toggle:active {
    transform: scale(0.95);
}

@media (max-width: 1100px) {
    .theme-toggle {
        top: auto;
        bottom: 18px;
        right: 18px;
    }
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    position: absolute;
}

.theme-toggle .icon-moon {
    opacity: 1;
    color: #f6dfc9;
    transform: rotate(0deg) scale(1);
}

.theme-toggle .icon-sun {
    opacity: 0;
    color: #92500f;
    transform: rotate(-90deg) scale(0.5);
}

[data-theme="dark"] .theme-toggle .icon-moon {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

[data-theme="dark"] .theme-toggle .icon-sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.theme-transitioning,
.theme-transitioning *:not(img):not(video):not(svg):not(svg *):not(.roaming-lottie):not(.roaming-lottie *) {
    transition-property: background-color, background, color, border-color, box-shadow;
    transition-duration: 0.4s;
    transition-timing-function: ease;
}

.theme-transitioning *::before,
.theme-transitioning *::after {
    transition-property: background-color, background, color, border-color, box-shadow;
    transition-duration: 0.4s;
    transition-timing-function: ease;
}

.admin-toggle {
    position: fixed;
    top: 18px;
    right: 70px;
    z-index: 51;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--border-accent);
    border-radius: 50%;
    background: rgba(28, 24, 26, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    color: rgba(255, 248, 239, 0.92);
    transition: background 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease,
    transform 0.2s ease;
}

[data-theme="dark"] .admin-toggle {
    background: rgba(255, 248, 239, 0.92);
    color: rgba(28, 24, 26, 0.92);
}

.admin-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}

.admin-toggle:active {
    transform: scale(0.95);
}

.admin-toggle svg {
    width: 18px;
    height: 18px;
}

@media (max-width: 1100px) {
    .admin-toggle {
        top: auto;
        bottom: 18px;
        right: 70px;
    }
}