:root {
    --bg: #faf6f0;
    --bg-soft: #f5ede3;
    --bg-grad-1: #fffdfa;
    --bg-grad-2: #fbf2e9;
    --bg-grad-3: #f3e4d4;
    --primary: #e07267;
    --primary-hover: #cf6055;
    --primary-shadow: rgba(224, 114, 103, 0.35);
    --secondary: #be5c7e;
    --secondary-hover: #aa4a6c;
    --secondary-shadow: rgba(190, 92, 126, 0.35);
    --text: #2d2420;
    --text-muted: #6e625b;
    --card: #ffffff;
    --accent: #c68b59;
    --wax-seal: #b83a4b;
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-handwriting: 'Caveat', cursive;
    --font-script: 'Dancing Script', cursive;
}

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

/* Completely hide scrollbars across all browsers while preserving smooth scrolling */
* {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--text);
    background: var(--bg);
    transition: opacity 200ms ease;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* =========================================================
   AMBIENT FLOATING HEARTS
   ========================================================= */

.ambient-hearts {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.floating-heart {
    position: absolute;
    bottom: -30px;
    pointer-events: none;
    user-select: none;
    will-change: transform;
    animation: floatUp linear infinite;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) rotate(0deg) scale(0.8);
        opacity: 0;
    }
    15% {
        opacity: var(--heart-opacity, 0.4);
    }
    85% {
        opacity: var(--heart-opacity, 0.4);
    }
    100% {
        transform: translateY(-110vh) rotate(360deg) scale(1.1);
        opacity: 0;
    }
}

/* =========================================================
   LANDING PAGE
   ========================================================= */

body.landing {
    background: radial-gradient(
            120% 120% at 50% 0%,
            var(--bg-grad-1, #fffdfa) 0%,
            var(--bg-grad-2, #fbf2e9) 50%,
            var(--bg-grad-3, #f3e4d4) 100%
    );
}

.landing-wrap {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 32px 20px;
    padding-bottom: max(32px, calc(20px + env(safe-area-inset-bottom)));
    position: relative;
    z-index: 1;
    transition: opacity 260ms cubic-bezier(0.4, 0, 0.2, 1), transform 260ms cubic-bezier(0.4, 0, 0.2, 1);
}

.landing-wrap.page-exit {
    opacity: 0;
    transform: scale(0.96) translateY(-8px);
}

.landing-badge {
    font-size: 42px;
    margin-bottom: 12px;
    display: inline-block;
    animation: bounceSlow 3s ease-in-out infinite;
}

@keyframes bounceSlow {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.landing-note {
    width: 100%;
    max-width: 440px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 28px;
    padding: 44px 32px;
    text-align: center;
    position: relative;

    box-shadow:
        0 26px 60px rgba(220, 150, 180, 0.18),
        0 10px 24px rgba(0, 0, 0, 0.04),
        inset 0 0 0 1px rgba(255, 255, 255, 0.8);
    animation: cardScaleIn 450ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cardScaleIn {
    0% {
        opacity: 0;
        transform: scale(0.92) translateY(18px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.landing-note::after {
    content: "";
    position: absolute;
    inset: 10px;
    border-radius: 20px;
    box-shadow: inset 0 0 0 1px rgba(244, 139, 176, 0.15);
    pointer-events: none;
}

.landing-note h1 {
    margin: 0 0 10px;
    font-size: 34px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.landing-note p {
    margin: 0;
    font-size: 16px;
    color: var(--text-muted);
    line-height: 1.5;
}

.landing-whisper {
    margin-top: 14px !important;
    font-size: 13.5px !important;
    color: rgba(120, 109, 115, 0.75) !important;
}

/* CTA button */
.primary-btn {
    margin-top: 28px;
    padding: 15px 32px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: #fff;
    font-size: 16.5px;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;

    box-shadow: 0 10px 24px var(--primary-shadow);
    transition: transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 220ms ease,
                background 220ms ease;
}

@keyframes softGlow {
    0% {
        box-shadow: 0 10px 24px var(--primary-shadow);
    }
    50% {
        box-shadow: 0 16px 36px var(--primary-shadow);
    }
    100% {
        box-shadow: 0 10px 24px var(--primary-shadow);
    }
}

body.landing .primary-btn {
    animation: softGlow 3.6s ease-in-out infinite;
}

.primary-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 16px 36px var(--primary-shadow);
}

.primary-btn:active {
    transform: translateY(1px) scale(0.97);
}

/* =========================================================
   GIFT PAGE CANVAS
   ========================================================= */

body.gift {
    background: radial-gradient(
            120% 120% at 50% 0%,
            var(--bg-grad-1, #fffdfa) 0%,
            var(--bg-grad-2, #fbf2e9) 55%,
            var(--bg-grad-3, #f3e4d4) 100%
    );
}

body.gift #app {
    min-height: 100vh;
    min-height: 100dvh;
    padding: 32px 20px 48px;
    padding-bottom: max(48px, calc(32px + env(safe-area-inset-bottom)));
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-sizing: border-box;
}

/* =========================================================
   GIFT HEADER
   ========================================================= */

body.gift header {
    position: relative;
    z-index: 100;
    max-width: 720px;
    margin: auto auto 36px;
    text-align: center;
    animation: headerFadeIn 450ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes headerFadeIn {
    0% {
        opacity: 0;
        transform: translateY(-14px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.header-icon {
    font-size: 38px;
    margin-bottom: 8px;
    display: inline-block;
    animation: pulseHeart 2s ease-in-out infinite;
}

@keyframes pulseHeart {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.12); }
}

body.gift header h1 {
    margin: 0 0 6px;
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

/* =========================================================
   COMBINED EDITION PILL & CUSTOM THEME DROPDOWN
   ========================================================= */

.landing-container {
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.theme-selector-container {
    display: inline-flex;
    justify-content: center;
    position: relative;
    z-index: 100;
    margin-top: 4px;
}

/* On landing page: centered directly above the note card */
.landing-theme-selector {
    position: relative;
    top: auto;
    right: auto;
    margin: 0 auto 18px;
    display: flex;
    justify-content: center;
    z-index: 100;
}

.custom-theme-dropdown {
    position: relative;
    display: inline-block;
    z-index: 110;
}

/* The Edition Pill Button */
.theme-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 18px;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: color-mix(in srgb, var(--primary) 12%, #fff);
    border: 1px dashed color-mix(in srgb, var(--primary) 35%, transparent);
    border-radius: 999px;
    box-shadow: 0 4px 14px var(--primary-shadow);
    cursor: pointer;
    outline: none;
    user-select: none;
    transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1),
                background 200ms ease,
                border-color 200ms ease,
                box-shadow 200ms ease,
                color 200ms ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.theme-pill-btn:hover {
    transform: translateY(-2px);
    background: color-mix(in srgb, var(--primary) 18%, #fff);
    border-style: solid;
    border-color: var(--primary);
    box-shadow: 0 8px 24px var(--primary-shadow);
}

.custom-theme-dropdown.is-open .theme-pill-btn {
    background: var(--primary);
    color: #fff;
    border-style: solid;
    border-color: transparent;
    box-shadow: 0 8px 24px var(--primary-shadow);
    transform: translateY(-1px);
}

.theme-pill-badge {
    font-size: 14px;
    line-height: 1;
    display: inline-block;
    transition: transform 200ms ease;
}

.theme-pill-btn:hover .theme-pill-badge {
    transform: scale(1.15) rotate(-6deg);
}

.theme-pill-label {
    letter-spacing: 0.08em;
}

.theme-pill-chevron {
    font-size: 10px;
    transition: transform 220ms ease;
    opacity: 0.8;
}

.custom-theme-dropdown.is-open .theme-pill-chevron {
    transform: rotate(180deg);
}

/* Floating Dropdown Popover Menu */
.theme-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(-6px) scale(0.96);
    min-width: 230px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid color-mix(in srgb, var(--primary) 24%, rgba(255, 255, 255, 0.9));
    border-radius: 18px;
    padding: 8px;
    box-shadow:
        0 20px 45px rgba(0, 0, 0, 0.14),
        0 6px 16px var(--primary-shadow);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1),
                opacity 180ms ease,
                visibility 180ms ease;
    z-index: 1000;
    max-height: calc(100vh - 130px);
    overflow-y: auto;
}

.theme-dropdown-menu::-webkit-scrollbar {
    width: 4px;
}

.theme-dropdown-menu::-webkit-scrollbar-track {
    background: transparent;
}

.theme-dropdown-menu::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--primary) 28%, transparent);
    border-radius: 999px;
}

/* Center dropdown menu on landing page directly under the centered edition pill */
.custom-theme-dropdown.is-landing .theme-dropdown-menu {
    left: 50%;
    right: auto;
    transform: translateX(-50%) translateY(-6px) scale(0.96);
}

.custom-theme-dropdown.is-open .theme-dropdown-menu {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    transform: translateX(-50%) translateY(0) scale(1);
}

.custom-theme-dropdown.is-landing.is-open .theme-dropdown-menu {
    transform: translateX(-50%) translateY(0) scale(1);
}

.theme-dropdown-header {
    padding: 6px 12px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    border-bottom: 1px dashed rgba(0, 0, 0, 0.08);
    margin-bottom: 6px;
    text-align: left;
}

.theme-dropdown-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.theme-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 12px;
    background: transparent;
    font-family: var(--font-sans);
    cursor: pointer;
    text-align: left;
    transition: background 150ms ease, transform 150ms ease;
}

.theme-menu-item:hover {
    background: color-mix(in srgb, var(--primary) 10%, #fff);
    transform: translateX(2px);
}

.theme-menu-item.active {
    background: color-mix(in srgb, var(--primary) 15%, #fff);
}

.theme-menu-badge {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}

.theme-menu-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.theme-menu-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

.theme-menu-item.active .theme-menu-name {
    color: var(--primary);
    font-weight: 700;
}

.theme-menu-date {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.theme-menu-check {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    margin-left: auto;
}

/* Subtle Bottom Return Navigation */
.bottom-nav {
    max-width: 680px;
    margin: 20px auto 0;
    width: 100%;
    display: flex;
    justify-content: center;
}

.nav-return-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.03);
    transition: transform 180ms ease, background 180ms ease, color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.nav-return-btn:hover {
    transform: translateY(-2px);
    background: #ffffff;
    color: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 6px 18px var(--primary-shadow);
}

.nav-return-icon {
    font-size: 14px;
    line-height: 1;
}

/* =========================================================
   SITE FOOTER
   ========================================================= */

.site-footer {
    max-width: 680px;
    margin: auto auto 0;
    padding-top: 48px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 6px;
    user-select: none;
    animation: footerFadeIn 500ms cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: 150ms;
}

@keyframes footerFadeIn {
    0% {
        opacity: 0;
        transform: translateY(8px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.footer-dedication {
    margin: 0;
    font-family: ui-monospace, SFMono-Regular, "Cascadia Code", "Roboto Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    font-weight: 500;
}

.footer-meta {
    margin: 0;
    font-family: ui-monospace, SFMono-Regular, "Cascadia Code", "Roboto Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 10.5px;
    line-height: 1.4;
    color: color-mix(in srgb, var(--text-muted) 75%, transparent);
    letter-spacing: 0.04em;
    word-break: break-word;
}

/* =========================================================
   ENVELOPE GRID (CENTER STAGE)
   ========================================================= */

.envelope-grid {
    max-width: 680px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    padding: 12px 0 32px;
}

.envelope {
    position: relative;
    min-height: 140px;
    padding: 32px 20px 24px;

    background: color-mix(in srgb, var(--card, #ffffff) 97%, var(--bg-soft, #faf6f0));
    backdrop-filter: blur(8px);
    border-radius: 26px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    cursor: pointer;
    user-select: none;

    transform: rotate(var(--tilt, 0deg)) translateY(0);
    box-shadow:
        0 18px 40px var(--primary-shadow),
        0 6px 14px rgba(0, 0, 0, 0.03),
        inset 0 0 0 1px rgba(255, 255, 255, 0.8);

    animation: envelopePopUp 560ms cubic-bezier(0.18, 0.89, 0.32, 1.28) both;
    transition: transform 320ms cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 320ms cubic-bezier(0.34, 1.56, 0.64, 1),
                background 200ms ease;
}

.envelope:nth-child(1) { animation-delay: 60ms; }
.envelope:nth-child(2) { animation-delay: 150ms; }
.envelope:nth-child(3) { animation-delay: 240ms; }
.envelope:nth-child(4) { animation-delay: 330ms; }

@keyframes envelopePopUp {
    0% {
        opacity: 0;
        transform: translateY(32px) scale(0.82) rotate(calc(var(--tilt, 0deg) * 0.2));
    }
    65% {
        opacity: 1;
        transform: translateY(-5px) scale(1.03) rotate(var(--tilt, 0deg));
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(var(--tilt, 0deg));
    }
}

.envelope::after {
    content: "";
    position: absolute;
    inset: 8px;
    border-radius: 18px;
    border: 1px dashed color-mix(in srgb, var(--primary) 35%, transparent);
    pointer-events: none;
}

/* Envelope Flap Detail */
.envelope-flap {
    position: absolute;
    top: 0;
    left: 20px;
    right: 20px;
    height: 32px;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    pointer-events: none;
    transition: transform 300ms ease;
}

.envelope-seal {
    font-size: 26px;
    margin-bottom: 6px;
    transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.envelope-label {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    text-align: center;
}

.envelope-subtitle {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 4px;
}

.envelope:hover,
.envelope:focus-visible {
    transform: rotate(calc(var(--tilt, 0deg) * 0.4)) translateY(-8px) scale(1.03);
    box-shadow:
        0 28px 60px var(--primary-shadow),
        0 10px 20px rgba(0, 0, 0, 0.05);
}

.envelope:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 4px;
}

.envelope:hover .envelope-seal,
.envelope:focus-visible .envelope-seal {
    transform: scale(1.2) rotate(6deg);
}

.envelope:active {
    transform: scale(0.96) translateY(-2px);
}

/* Highlighted Envelope (Date Plans) */
.envelope.highlight {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-hover) 100%);
    color: #fff;

    box-shadow:
        0 22px 50px var(--secondary-shadow),
        inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.envelope.highlight .envelope-label {
    color: #fff;
}

.envelope.highlight .envelope-subtitle {
    color: rgba(255, 255, 255, 0.85);
}

.envelope.highlight::after {
    border-color: rgba(255, 255, 255, 0.4);
}

.envelope.highlight .envelope-flap {
    background: rgba(255, 255, 255, 0.15);
}

/* =========================================================
   PANELS OVERLAY SYSTEM
   ========================================================= */

.panel {
    position: fixed;
    inset: 0;
    background: color-mix(in srgb, var(--bg, #faf6f0) 95%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 100;
    padding: 32px 20px;
    overflow-y: auto;
    will-change: transform, opacity;

    animation: panelEnter 260ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.panel.panel-leaving {
    animation: panelLeave 220ms ease-in forwards;
}

@keyframes panelEnter {
    0% {
        opacity: 0;
        transform: scale(0.96) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes panelLeave {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.96) translateY(12px);
    }
}

.panel-content {
    max-width: 720px;
    margin: 0 auto;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 720px;
    margin: -10px auto 20px;
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 6px 0;
    pointer-events: none;
}

.panel-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    pointer-events: auto;
}

.close-btn {
    border: none;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;

    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transition: transform 180ms ease, background 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.close-btn:hover {
    transform: scale(1.1) rotate(90deg);
    background: #fff;
    color: var(--primary);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.close-btn:active {
    transform: scale(0.92);
}

/* Panel bottom return navigation button */
.panel-bottom-nav {
    display: flex;
    justify-content: center;
    margin: 36px auto calc(24px + env(safe-area-inset-bottom, 16px));
    width: 100%;
    clear: both;
    position: relative;
    z-index: 5;
}

.panel-return-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--primary);
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6px 22px var(--primary-shadow);
    transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1),
                background 180ms ease,
                color 180ms ease,
                box-shadow 180ms ease;
}

.panel-return-btn:hover {
    transform: translateY(-2px) scale(1.03);
    background: var(--primary);
    color: #fff;
    box-shadow: 0 10px 28px var(--primary-shadow);
}

.panel-return-btn:active {
    transform: scale(0.96) translateY(1px);
}

/* =========================================================
   LETTER PANEL (PARCHMENT AESTHETIC)
   ========================================================= */

.panel[data-panel="letter"] {
    background: rgba(45, 36, 32, 0.65);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 24px 16px 64px;
}

/* Hide the external floating header cross on the letter page */
.panel[data-panel="letter"] .panel-header {
    display: none;
}

.panel[data-panel="letter"] .panel-content {
    max-width: 580px;
    width: 100%;
    position: relative;
}

.letters-page {
    background: #fdfbf7;
    padding: 38px 26px 36px;
    border-radius: 24px;
    position: relative;
    border: 1px solid rgba(220, 200, 180, 0.55);
    box-shadow:
        0 35px 90px rgba(0, 0, 0, 0.45),
        0 10px 25px rgba(0, 0, 0, 0.15),
        inset 0 0 40px rgba(220, 195, 165, 0.22);
    animation: letterOpen 340ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.letters-archive-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px dashed rgba(180, 160, 140, 0.35);
}

.letters-archive-badge {
    font-size: 32px;
    display: inline-block;
    margin-bottom: 6px;
    animation: pulseHeart 2.5s ease-in-out infinite;
}

.letters-archive-subtitle {
    display: block;
    font-size: 11.5px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 4px;
}

.letters-archive-header h3 {
    font-family: var(--font-sans);
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin: 4px 0 8px;
}

.letters-archive-desc {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

.letters-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.letter-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #ffffff;
    border: 1px solid rgba(210, 190, 170, 0.45);
    border-radius: 18px;
    padding: 16px 18px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
    transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 200ms ease,
                border-color 200ms ease;
    text-align: left;
}

.letter-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: 0 10px 26px var(--primary-shadow);
}

.letter-card:active {
    transform: translateY(-1px) scale(0.99);
}

.letter-card-seal {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #ffffff 0%, color-mix(in srgb, var(--wax-seal) 35%, #fff) 25%, var(--wax-seal) 70%, color-mix(in srgb, var(--wax-seal) 65%, #000) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2), inset 0 2px 3px rgba(255, 255, 255, 0.7);
    flex-shrink: 0;
}

.letter-card-content {
    flex: 1;
    min-width: 0;
}

.letter-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.letter-card-date {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.letter-card-edition {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    background: color-mix(in srgb, var(--primary) 8%, #f5ede3);
    padding: 2px 8px;
    border-radius: 999px;
}

.letter-card-title {
    font-family: var(--font-sans);
    font-size: 16.5px;
    font-weight: 700;
    color: var(--text);
    margin: 2px 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.letter-card-preview {
    font-family: var(--font-handwriting);
    font-size: 17px;
    color: var(--text-muted);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.letter-card-arrow {
    flex-shrink: 0;
}

.letter-card-arrow span {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 10%, #fff);
    border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
    padding: 6px 13px;
    border-radius: 999px;
    display: inline-block;
    transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}

.letter-card:hover .letter-card-arrow span {
    background: var(--primary);
    color: #fff;
    transform: scale(1.04);
}

/* Single Letter Top Nav */
.letter-top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    position: relative;
    z-index: 6;
}

.letter-back-btn,
.letter-secondary-btn {
    padding: 6px 16px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
    background: color-mix(in srgb, var(--primary) 10%, #fff);
    color: var(--primary);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px var(--primary-shadow);
    transition: transform 180ms ease, background 180ms ease, color 180ms ease;
}

.letter-back-btn:hover,
.letter-secondary-btn:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-1px);
}

.letter-top-nav .letter-card-close {
    position: static;
}

.letter-single-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.letter {
    background: #fdfbf7;
    padding: 42px 32px 48px;
    border-radius: 24px;
    position: relative;
    border: 1px solid rgba(220, 200, 180, 0.55);
    box-shadow:
        0 35px 90px rgba(0, 0, 0, 0.45),
        0 10px 25px rgba(0, 0, 0, 0.15),
        inset 0 0 40px rgba(220, 195, 165, 0.22);
    animation: letterOpen 340ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.letter-card-close {
    position: absolute;
    top: 16px;
    right: 18px;
    border: none;
    background: rgba(0, 0, 0, 0.04);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 18px;
    color: #8c7b70;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 160ms ease;
    z-index: 5;
}

.letter-card-close:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--primary);
    transform: scale(1.1);
}

.letter-footer {
    display: flex;
    justify-content: center;
    margin-top: 36px;
    padding-top: 20px;
    border-top: 1px dashed rgba(180, 160, 140, 0.35);
}

.letter-close-btn {
    padding: 10px 26px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
    background: color-mix(in srgb, var(--primary) 10%, #fff);
    color: var(--primary);
    font-family: var(--font-sans);
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 14px var(--primary-shadow);
    transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.letter-close-btn:hover {
    transform: translateY(-2px);
    background: var(--primary);
    color: #fff;
    box-shadow: 0 8px 20px var(--primary-shadow);
}

.letter-pin {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #ffffff 0%, color-mix(in srgb, var(--primary) 40%, #fff) 25%, var(--primary) 70%, color-mix(in srgb, var(--primary) 65%, #000) 100%);
    border: 2px solid rgba(255, 255, 255, 0.75);
    box-shadow:
        0 5px 12px rgba(0, 0, 0, 0.28),
        0 2px 5px rgba(0, 0, 0, 0.16),
        inset 0 2px 3px rgba(255, 255, 255, 0.8),
        inset 0 -2px 4px rgba(0, 0, 0, 0.35);
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.letter-pin::after {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.5) 100%);
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.6),
        0 1px 1px rgba(255, 255, 255, 0.45);
}

.letter-header {
    text-align: center;
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px dashed rgba(180, 160, 140, 0.3);
}

.letter-date {
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8c7b70;
    font-weight: 500;
}

.letter h4 {
    font-family: var(--font-script);
    font-size: 32px;
    font-weight: 400;
    color: #2b221e;
    margin: 8px 0 0;
}

.letter-body {
    font-family: var(--font-handwriting);
    font-size: 24px;
    line-height: 1.8;
    color: #382c26;
}

.letter-body p {
    margin: 0 0 20px;
}

.letter-body p.letter-closing {
    margin-top: 36px;
    margin-bottom: 4px;
    font-size: 22px;
    color: #5a4840;
}

.letter-body p.letter-signature {
    font-family: 'Dancing Script', cursive;
    font-size: 38px;
    font-weight: 700;
    color: var(--primary);
    margin-top: 0;
    letter-spacing: 0.01em;
}

@keyframes letterOpen {
    0% {
        opacity: 0;
        transform: scale(0.92) translateY(24px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* =========================================================
   WHY I LOVE YOU PANEL
   ========================================================= */

.why {
    max-width: 580px;
    margin: 12px auto 40px;
}

.why-header {
    text-align: center;
    margin-bottom: 32px;
}

.why-subtitle {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--primary);
    font-weight: 600;
}

.why-header h4 {
    margin: 6px 0 0;
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
}

.why-toggle-wrap {
    display: inline-flex;
    align-items: center;
    background: color-mix(in srgb, var(--primary) 8%, #ffffff);
    padding: 4px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--primary) 18%, transparent);
    margin-top: 16px;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--primary) 8%, transparent);
    gap: 4px;
}

.why-toggle-btn {
    appearance: none;
    border: none;
    background: transparent;
    padding: 6px 14px;
    border-radius: 999px;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 180ms ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.why-toggle-btn:hover {
    color: var(--text);
}

.why-toggle-btn.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 10px var(--primary-shadow);
}

.why-toggle-icon {
    font-size: 13px;
    line-height: 1;
    display: inline-block;
    transition: transform 300ms ease;
}

.why-toggle-btn.spinning .why-toggle-icon {
    animation: iconSpin 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes iconSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.why-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.why-card {
    background: #fff;
    border-radius: 20px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 18px;

    /* ⚡ Bolt Performance Optimization: content-visibility */
    /* Prevents the browser from rendering off-screen cards in the long list */
    content-visibility: auto;
    contain-intrinsic-size: 0 100px;

    box-shadow:
        0 12px 30px rgba(220, 150, 180, 0.12),
        0 4px 10px rgba(0, 0, 0, 0.03),
        inset 0 0 0 1px rgba(255, 255, 255, 0.8);

    animation: slideUp 380ms cubic-bezier(0.16, 1, 0.3, 1) both;
    transition: transform 220ms ease, box-shadow 220ms ease;
}

.why-card:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow:
        0 18px 40px rgba(220, 150, 180, 0.22),
        0 6px 14px rgba(0, 0, 0, 0.04);
}

@keyframes slideUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.why-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--primary) 16%, #ffffff) 0%,
        color-mix(in srgb, var(--primary) 8%, #ffffff) 100%
    );
    border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent);
    border-radius: 16px;
    flex-shrink: 0;
    box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 12%, transparent);
    transition: transform 200ms ease, box-shadow 200ms ease;
}

.why-card:hover .why-badge {
    transform: scale(1.08) rotate(3deg);
    box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 20%, transparent);
}

.why-icon {
    font-size: 20px;
    line-height: 1;
}

.why-index {
    font-size: 10px;
    font-weight: 700;
    color: var(--primary);
    margin-top: 3px;
    letter-spacing: 0.04em;
}

.why-body p {
    margin: 0;
    font-size: 16.5px;
    font-weight: 500;
    color: var(--text);
    line-height: 1.5;
}

/* =========================================================
   MEMORIES PHOTO GALLERY & POLAROIDS
   ========================================================= */

.memories {
    max-width: 720px;
    margin: 12px auto 40px;
}

.memories-subtitle {
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.memory-grid {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    width: 100%;
    box-sizing: border-box;
}

.memory-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.memory-item.polaroid {
    background: #fff;
    padding: 8px 8px 14px;
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    box-sizing: border-box;
    width: 100%;

    transform: rotate(var(--rot, 0deg));
    box-shadow:
        0 10px 24px rgba(0, 0, 0, 0.08),
        0 3px 8px rgba(0, 0, 0, 0.04);

    animation: slideUp 380ms cubic-bezier(0.16, 1, 0.3, 1) both;
    transition: transform 260ms cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 260ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.polaroid-img-wrap {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    background: #f0ebed;
    position: relative;
}

.memory-item.polaroid img {
    width: 100%;
    height: auto;
    display: block;
    will-change: transform;
    transition: transform 300ms ease;
}

.polaroid-caption {
    text-align: center;
    margin-top: 10px;
    font-family: var(--font-handwriting);
    font-size: 19px;
    font-weight: 600;
    color: #52433c;
    line-height: 1.25;
    letter-spacing: 0.01em;
}

.memory-item.polaroid:hover,
.memory-item.polaroid:focus-visible {
    transform: rotate(0deg) scale(1.04) translateY(-6px);
    box-shadow:
        0 24px 50px rgba(0, 0, 0, 0.16),
        0 8px 18px rgba(0, 0, 0, 0.06);
    z-index: 5;
}

.memory-item.polaroid:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 4px;
}

.memory-item.polaroid:hover img,
.memory-item.polaroid:focus-visible img {
    transform: scale(1.03);
}

/* Press-and-hold gloss/sheen effect */
.memory-item.polaroid:active {
    transform: rotate(0deg) scale(1.06) translateY(-8px);
    z-index: 10;
}

.memory-item.polaroid:active .polaroid-img-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 8px;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.55) 0%,
        rgba(255, 255, 255, 0.0) 40%,
        rgba(255, 255, 255, 0.18) 60%,
        rgba(255, 255, 255, 0.0) 100%
    );
    pointer-events: none;
    animation: sheenSlide 400ms ease forwards;
}

@keyframes sheenSlide {
    0%   { opacity: 0; transform: translateX(-100%) skewX(-10deg); }
    40%  { opacity: 1; }
    100% { opacity: 0.6; transform: translateX(100%) skewX(-10deg); }
}

/* =========================================================
   LIGHTBOX (ATMOSPHERIC & ROMANTIC)
   ========================================================= */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    box-sizing: border-box;

    background: radial-gradient(
        circle at 50% 45%,
        color-mix(in srgb, var(--primary) 22%, rgba(26, 18, 22, 0.92)) 0%,
        rgba(14, 10, 13, 0.96) 100%
    );
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    animation: lightboxFadeIn 280ms ease-out both;
}

@keyframes lightboxFadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* Ambient glowing spotlight aura behind the polaroid */
.lightbox-aura {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(85vw, 480px);
    height: min(85vw, 480px);
    background: radial-gradient(
        circle,
        color-mix(in srgb, var(--primary) 35%, transparent) 0%,
        color-mix(in srgb, var(--secondary) 15%, transparent) 35%,
        transparent 70%
    );
    pointer-events: none;
    z-index: 1;
    will-change: transform, opacity;
    animation: auraGlow 5s ease-in-out infinite alternate;
}

@keyframes auraGlow {
    0% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.6; }
    100% { transform: translate(-50%, -50%) scale(1.15); opacity: 0.9; }
}

.lightbox-close {
    position: absolute;
    top: max(16px, env(safe-area-inset-top));
    right: 16px;
    border: none;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 22px;
    color: var(--text);
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;

    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    transition: transform 180ms ease, color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.lightbox-close:hover {
    transform: scale(1.1) rotate(90deg);
    color: var(--primary);
    background: #fff;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.lightbox-card {
    position: relative;
    z-index: 10;
    background: #fff;
    padding: 12px 12px 14px;
    border-radius: 18px;
    cursor: grab;
    touch-action: none;
    box-sizing: border-box;
    width: auto;
    max-width: min(82vw, 440px);
    margin: 0 auto;
    will-change: transform;
    contain: layout paint;

    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.45),
        0 10px 28px rgba(0, 0, 0, 0.2),
        inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.lightbox-card:active {
    cursor: grabbing;
}

.lightbox-image {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 58vh;
    border-radius: 10px;
    object-fit: contain;
}

.lightbox-caption {
    text-align: center;
    margin-top: 10px;
    margin-bottom: 2px;
    font-family: var(--font-handwriting);
    font-size: 22px;
    font-weight: 600;
    color: #52433c;
    line-height: 1.25;
    letter-spacing: 0.01em;
}

.lightbox-hint {
    position: absolute;
    bottom: max(20px, calc(12px + env(safe-area-inset-bottom)));
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    pointer-events: none;
    z-index: 10;
    transition: opacity 300ms ease, transform 300ms ease;
    user-select: none;
    white-space: nowrap;
}

body.lightbox-open {
    overflow: hidden;
}

body.panel-open .ambient-hearts,
body.lightbox-open .ambient-hearts {
    display: none;
}

body.lightbox-open #app {
    opacity: 0.08;
    pointer-events: none;
    transition: opacity 300ms ease;
}

/* =========================================================
   DATE PLANS FORM & RESULT TICKET
   ========================================================= */

.date-form {
    max-width: 540px;
    margin: 12px auto 60px;
    background: #fff;
    padding: 32px 24px 38px;
    border-radius: 28px;
    border: 1px solid color-mix(in srgb, var(--primary) 15%, transparent);

    box-shadow:
        0 26px 60px var(--primary-shadow),
        0 10px 24px rgba(0, 0, 0, 0.04);

    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
}

.form-header {
    text-align: center;
    margin-bottom: 6px;
}

.form-badge {
    font-size: 36px;
    display: inline-block;
    animation: pulseHeart 2s ease-in-out infinite;
}

.form-header h4 {
    margin: 6px 0 2px;
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
}

.form-sub {
    font-size: 13.5px;
    color: var(--text-muted);
    margin: 0;
}

.date-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    background: var(--bg-soft);
    padding: 16px 18px;
    border-radius: 20px;
    box-sizing: border-box;
    border: 1px solid color-mix(in srgb, var(--primary) 10%, transparent);
}

.section-label {
    margin: 0 0 10px;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text);
    text-align: left;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 6px;
}

.movie-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    background: var(--bg-soft);
    border-radius: 20px;
    font-weight: 600;
    border: 1px solid color-mix(in srgb, var(--primary) 10%, transparent);
}

.movie-row label {
    font-weight: 600;
    margin: 0;
    font-size: 14.5px;
    cursor: default;
}

.date-form select {
    padding: 12px 38px 12px 18px;
    border-radius: 14px;
    border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236e625b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px 14px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    font-size: 14px;
    font-family: var(--font-sans);
    color: var(--text);
    cursor: pointer;
    min-width: 195px;
    transition: border 150ms ease, box-shadow 150ms ease;
}

.date-form select:hover {
    border-color: var(--primary);
}

.date-form input[type="date"],
.date-form input#date-input {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding: 12px 42px 12px 16px;
    border-radius: 14px;
    border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23e07267' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 18px 18px;
    font-size: 16px; /* 16px prevents iOS Safari auto-zoom */
    font-family: var(--font-sans);
    color: var(--text);
    cursor: pointer;
    min-height: 48px;
    line-height: 1.4;
    transition: border 150ms ease, box-shadow 150ms ease;
}

.date-form input#date-input::placeholder {
    color: var(--text-muted);
    font-size: 14.5px;
    font-family: var(--font-sans);
    opacity: 0.85;
}

.date-form input[type="date"]::-webkit-date-and-time-value {
    text-align: left;
    min-height: 1.4em;
    margin: 0;
}

.date-form input[type="date"]::-webkit-calendar-picker-indicator {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.date-form input#date-input.input-error {
    border-color: #e65c7b;
    box-shadow: 0 0 0 3.5px rgba(230, 92, 123, 0.25);
    animation: dateShake 320ms ease;
}

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

.date-form select:focus,
.date-form input[type="date"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3.5px var(--primary-shadow);
}

/* Chips container */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    border: 1px solid color-mix(in srgb, var(--primary) 12%, transparent);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);

    transition: background 180ms ease,
                color 180ms ease,
                transform 150ms cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 180ms ease,
                border-color 180ms ease;
}

.chip input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.chip:has(input:focus-visible) {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.chip:has(input:checked) {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-hover) 100%);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 6px 18px var(--secondary-shadow);
    transform: translateY(-2px) scale(1.02);
}

.chip.chip-no {
    border: 1px dashed color-mix(in srgb, var(--primary) 35%, rgba(0, 0, 0, 0.15));
    background: rgba(255, 255, 255, 0.75);
}

.chip.chip-no:has(input:checked) {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: #fff;
    border-style: solid;
    border-color: transparent;
    box-shadow: 0 6px 18px var(--primary-shadow);
}

.chip:hover {
    transform: translateY(-2px);
    background: #fff;
    border-color: var(--primary);
}

.date-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 18px;
    background: var(--bg-soft);
    border-radius: 20px;
    border: 1px solid color-mix(in srgb, var(--primary) 10%, transparent);
    box-sizing: border-box;
    width: 100%;
}

.date-row label {
    font-weight: 600;
    margin: 0;
    font-size: 14.5px;
    white-space: nowrap;
}

.date-field {
    flex: 1;
    position: relative;
    min-width: 0;
    max-width: 100%;
    display: flex;
    align-items: center;
}

.date-form .primary-btn {
    align-self: center;
    margin-top: 10px;
    width: 100%;
    max-width: 280px;
}

/* Form Error */
.form-error {
    min-height: 20px;
    font-size: 14px;
    color: #e65c7b;
    text-align: center;
    font-weight: 500;
}

/* Date Result Ticket Card */
.date-result {
    max-width: 500px;
    margin: 20px auto 40px;
    background: #fff;
    padding: 36px 28px;
    border-radius: 26px;
    text-align: center;
    position: relative;
    border: 1px dashed color-mix(in srgb, var(--primary) 35%, transparent);

    box-shadow:
        0 30px 70px var(--primary-shadow),
        0 10px 24px rgba(0, 0, 0, 0.05);

    animation: resultPop 450ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes resultPop {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.date-result-stamp {
    font-size: 42px;
    margin-bottom: 8px;
}

.date-result h4 {
    margin: 0 0 24px;
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}

.date-result-details {
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: left;
    background: var(--bg-soft);
    padding: 24px;
    border-radius: 20px;
    margin-bottom: 24px;
}

.result-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.result-icon {
    font-size: 22px;
    flex-shrink: 0;
    margin-top: 2px;
}

.result-item strong {
    font-size: 13.5px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.result-item p {
    margin: 2px 0 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.date-result-footer p {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
}

/* =========================================================
   CONFETTI PARTICLES
   ========================================================= */

.confetti-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2000;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 14px;
    border-radius: 3px;
    opacity: 0;
    animation: confettiPop 1.2s ease-out forwards;
}

.confetti-piece.emoji-piece {
    width: auto;
    height: auto;
    font-size: 24px;
    background: transparent !important;
}

@keyframes confettiPop {
    0% {
        transform: translateY(0) rotate(0deg) scale(0.6);
        opacity: 1;
    }
    100% {
        transform: translateY(120vh) rotate(540deg) scale(1.1);
        opacity: 0;
    }
}

/* =========================================================
   RESPONSIVE BREAKPOINTS
   ========================================================= */

@media (max-width: 640px) {
    .memory-grid {
        gap: 8px;
    }

    .memory-col {
        gap: 10px;
    }

    .memory-item.polaroid {
        padding: 5px 5px 10px;
        border-radius: 8px;
    }

    .polaroid-caption {
        font-size: 14px;
        margin-top: 6px;
    }
    
    .envelope-grid {
        gap: 16px;
    }

    .envelope {
        min-height: 125px;
        padding: 40px 16px 20px;
    }

    .envelope-label {
        font-size: 16px;
    }

    .letter {
        padding: 40px 24px 48px;
    }

    .letter-body {
        font-size: 21px;
    }
}

@media (max-width: 480px) {
    .date-row, .movie-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .date-form select, .date-form input[type="date"] {
        width: 100%;
    }
    
    .date-field {
        width: 100%;
    }
}