@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap');

:root {
    --cream: #FDF6E3;
    --terracotta: #C45C3A;
    --terracotta-dark: #9E4A2E;
    --warm-brown: #7D5A3A;
    --light-brown: #BFA98C;
    --paper-shadow: 0 4px 12px rgba(0,0,0,0.1), 0 1px 3px rgba(0,0,0,0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    height: 100dvh;
    overflow: hidden;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

#lockScreen {
    height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background-image: url('images/background.png');
    background-size: cover;
    background-position: center;
    filter: brightness(0.75);
    transform: scale(1.02);
    overflow: hidden;
}

.lock-floating-heart {
    position: absolute;
    opacity: 0.3;
    animation: lockFloatHeart 12s infinite ease-in-out;
}

@keyframes lockFloatHeart {
    0%, 100% { transform: translateY(0) rotate(0deg) scale(1); }
    25% { transform: translateY(-40px) rotate(10deg) scale(1.1); }
    50% { transform: translateY(-20px) rotate(-8deg) scale(0.95); }
    75% { transform: translateY(-50px) rotate(5deg) scale(1.05); }
}

.card {
    position: relative;
    z-index: 1;
    background: transparent;
    border: none;
    border-radius: 28px;
    padding: clamp(16px, 4vh, 52px) clamp(16px, 5vw, 48px) clamp(14px, 3vh, 48px);
    width: min(480px, 96vw);
    text-align: center;
    animation: fadeUp 0.5s ease both;
    max-height: 100dvh;
    overflow: visible;
    box-sizing: border-box;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

.lock-icon {
    font-size: clamp(1.2rem, 3.5vw, 2.4rem);
    margin-bottom: clamp(3px, 0.8vh, 10px);
    display: block;
    color: #fff;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
}

h1 {
    color: #fff;
    font-size: clamp(0.75rem, 2.2vw, 1.25rem);
    font-weight: 400;
    letter-spacing: 0.08em;
    margin-bottom: clamp(12px, 2.5vh, 32px);
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
}

.dots {
    display: flex;
    justify-content: center;
    gap: clamp(6px, 2vw, 16px);
    margin-bottom: clamp(12px, 2.5vh, 34px);
}

.dot {
    width: clamp(9px, 2.5vw, 16px);
    height: clamp(9px, 2.5vw, 16px);
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.6);
    background: transparent;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.dot.filled {
    border-color: #fff;
    background: transparent;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.9), 0 0 2px #fff inset;
    transform: scale(1.2);
}

.passcode-box {
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(255, 255, 255, 0.30);
    border-radius: 24px;
    padding: clamp(12px, 2.5vh, 32px) clamp(12px, 3vw, 36px);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    box-sizing: border-box;
    display: inline-block;
    width: auto;
}

.keypad {
    display: grid;
    grid-template-columns: repeat(3, clamp(52px, 14vw, 90px));
    gap: clamp(8px, 2.2vw, 18px);
    box-sizing: border-box;
}

.key {
    background: transparent;
    border: 2.5px solid rgba(255, 255, 255, 1);
    border-radius: 50%;
    width: clamp(52px, 14vw, 90px);
    height: clamp(52px, 14vw, 90px);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    font-size: clamp(1rem, 3.5vw, 1.65rem);
    font-weight: 300;
    letter-spacing: 0.02em;
    user-select: none;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
    transition: background 0.12s, transform 0.1s, border-color 0.12s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    flex-shrink: 0;
}

.key sub {
    font-size: clamp(0.28rem, 0.9vw, 0.45rem);
    letter-spacing: 0.18em;
    opacity: 0.7;
    margin-top: 1px;
    text-transform: uppercase;
}

.key:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #fff;
}

.key:active,
.key.pressed {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(0.92);
}

.key.empty {
    background: transparent;
    border-color: transparent;
    cursor: default;
    pointer-events: none;
}

.key.del {
    font-size: clamp(0.8rem, 2.5vw, 1.4rem);
    border: 2.5px solid rgba(255, 255, 255, 1);
}

.msg {
    margin-top: clamp(8px, 1.5vh, 22px);
    font-size: clamp(0.62rem, 1.8vw, 0.88rem);
    letter-spacing: 0.08em;
    min-height: 18px;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}

.msg.error { color: #ff8080; animation: shake 0.4s ease; }
.msg.success { color: #7bffb0; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}

.dots.shake { animation: shake 0.4s ease; }

#successOverlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: radial-gradient(ellipse at center, rgba(139, 94, 60, 0.25) 0%, rgba(0, 0, 0, 0.55) 100%);
    backdrop-filter: blur(6px);
    color: #fff;
    font-size: clamp(1rem, 3vw, 1.3rem);
    gap: 18px;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#successOverlay.show { display: flex; animation: overlayFade 0.45s ease both; }

@keyframes overlayFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.unlock-stage {
    position: relative;
    width: clamp(140px, 32vw, 200px);
    height: clamp(170px, 38vw, 240px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.unlock-lock {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 10px 24px rgba(0,0,0,0.45));
    transform-origin: center 62%;
    animation: lockAppear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes lockAppear {
    0% { transform: scale(0.2) rotate(-20deg); opacity: 0; }
    70% { transform: scale(1.08) rotate(2deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.unlock-body {
    transform-origin: center;
    animation: lockWiggle 0.6s ease-in-out 0.55s both;
}

@keyframes lockWiggle {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-4px) rotate(-2deg); }
    30% { transform: translateX(4px) rotate(2deg); }
    45% { transform: translateX(-3px) rotate(-1.5deg); }
    60% { transform: translateX(3px) rotate(1.5deg); }
    75% { transform: translateX(-2px) rotate(-1deg); }
    90% { transform: translateX(2px) rotate(1deg); }
}

.unlock-shackle {
    transform-origin: 72px 50px;
    transform: rotate(0deg);
    animation: shackleOpen 0.7s cubic-bezier(0.4, 0, 0.2, 1) 1.15s both;
}

@keyframes shackleOpen {
    0% { transform: rotate(0deg) translateY(0); }
    40% { transform: rotate(-25deg) translateY(-3px); }
    100% { transform: rotate(-55deg) translateY(-6px); }
}

.unlock-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 215, 120, 0.85) 0%, rgba(255, 170, 180, 0.4) 40%, transparent 70%);
    animation: glowBurst 1.1s ease-out 0.95s both;
    pointer-events: none;
}

@keyframes glowBurst {
    0% { width: 0; height: 0; opacity: 0; }
    30% { opacity: 1; }
    100% { width: 420px; height: 420px; opacity: 0; }
}

.sparkles { position: absolute; inset: 0; pointer-events: none; }

.sparkle {
    position: absolute;
    top: 50%;
    left: 50%;
    font-size: clamp(1rem, 3vw, 1.6rem);
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.4);
    animation: sparkleBurst 1.3s ease-out 1.05s both;
}

@keyframes sparkleBurst {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.2); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
    100% { opacity: 0; transform: var(--sparkle-end) scale(0.6); }
}

.sparkle.s1 { --sparkle-end: translate(calc(-50% + -90px), calc(-50% + -110px)); animation-delay: 1.05s; }
.sparkle.s2 { --sparkle-end: translate(calc(-50% + 100px), calc(-50% + -80px));  animation-delay: 1.12s; }
.sparkle.s3 { --sparkle-end: translate(calc(-50% + -110px), calc(-50% + 30px));  animation-delay: 1.18s; }
.sparkle.s4 { --sparkle-end: translate(calc(-50% + 120px), calc(-50% + 50px));   animation-delay: 1.08s; }
.sparkle.s5 { --sparkle-end: translate(calc(-50% + 0px),   calc(-50% + -130px)); animation-delay: 1.20s; }
.sparkle.s6 { --sparkle-end: translate(calc(-50% + -50px), calc(-50% + 110px));  animation-delay: 1.15s; }
.sparkle.s7 { --sparkle-end: translate(calc(-50% + 80px),  calc(-50% + 120px));  animation-delay: 1.22s; }
.sparkle.s8 { --sparkle-end: translate(calc(-50% + -130px),calc(-50% + -30px));  animation-delay: 1.10s; }

.welcome-text {
    opacity: 0;
    transform: translateY(14px);
    font-weight: 300;
    letter-spacing: 0.08em;
    font-size: clamp(1.05rem, 3.2vw, 1.45rem);
    text-shadow: 0 2px 12px rgba(0,0,0,0.45);
    animation: welcomeIn 0.6s ease-out 1.55s both;
}

@keyframes welcomeIn {
    to { opacity: 0.95; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .unlock-lock,
    .unlock-body,
    .unlock-shackle,
    .unlock-glow,
    .sparkle,
    .welcome-text,
    #successOverlay.show { animation: none; opacity: 1; transform: none; }
    .unlock-shackle { transform: rotate(-55deg) translateY(-6px); }
}

@media (max-width: 390px) {
    .keypad { grid-template-columns: repeat(3, clamp(48px, 20vw, 58px)); gap: clamp(6px, 2vw, 10px); }
    .key { width: clamp(48px, 20vw, 58px); height: clamp(48px, 20vw, 58px); }
}

@media (max-height: 620px) and (orientation: portrait) {
    .lock-icon { display: none; }
    h1 { margin-bottom: 8px; }
    .dots { margin-bottom: 8px; }
    .passcode-box { padding: 10px 12px; }
}

@media (max-height: 500px) and (orientation: landscape) {
    .card { padding: 10px clamp(16px, 5vw, 36px) 8px; width: min(480px, 94vw); }
    .lock-icon { display: none; }
    h1 { margin-bottom: 6px; }
    .dots { margin-bottom: 8px; }
    .keypad { grid-template-columns: repeat(5, 1fr); gap: 8px; }
    .key { width: clamp(40px, 8vw, 54px); height: clamp(40px, 8vw, 54px); }
}

@media (prefers-reduced-motion: reduce) {
    .card, #successOverlay { animation: none; }
    .dot { transition: none; }
    .key { transition: none; }
    .msg.error { animation: none; }
    .dots.shake { animation: none; }
}

/* App Styles */
#appScreen {
    height: 100dvh;
    overflow-y: auto;
    background: var(--cream);
    position: relative;
}

.app-bg, .section-bg {
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(circle at 10% 20%, rgba(196, 92, 58, 0.05) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(196, 92, 58, 0.05) 0%, transparent 20%),
        linear-gradient(to bottom, var(--cream), #F5EAD6);
    z-index: 0;
    overflow: hidden;
}

.floating-heart {
    position: absolute;
    font-size: 2rem;
    opacity: 0.3;
    color: var(--terracotta);
}

@keyframes floatHeart1 {
    0%, 100% { transform: translateY(0) rotate(0deg) scale(1); }
    33% { transform: translateY(-30px) rotate(10deg) scale(1.05); }
    66% { transform: translateY(-15px) rotate(-5deg) scale(0.95); }
}

@keyframes floatHeart2 {
    0%, 100% { transform: translateY(0) rotate(0deg) translateX(0); }
    25% { transform: translateY(-25px) rotate(15deg) translateX(10px); }
    50% { transform: translateY(-40px) rotate(-10deg) translateX(-5px); }
    75% { transform: translateY(-20px) rotate(5deg) translateX(5px); }
}

@keyframes floatHeart3 {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-50px) rotate(20deg); }
}

.floating-heart.type-1 { animation: floatHeart1 12s infinite ease-in-out; }
.floating-heart.type-2 { animation: floatHeart2 18s infinite ease-in-out; }
.floating-heart.type-3 { animation: floatHeart3 15s infinite ease-in-out; }

.floating-pic {
    position: absolute;
    z-index: 1;
    opacity: 0.88;
    box-shadow: 0 8px 28px rgba(139, 94, 60, 0.22), 0 2px 8px rgba(0,0,0,0.1);
    will-change: transform;
}

.floating-pic img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.floating-pic.type-1 { animation: floatPic1 13s infinite ease-in-out; }
.floating-pic.type-2 { animation: floatPic2 19s infinite ease-in-out; }
.floating-pic.type-3 { animation: floatPic3 16s infinite ease-in-out; }

@keyframes floatPic1 {
    0%, 100% { translate: 0 0; }
    33% { translate: 0 -28px; }
    66% { translate: 0 -12px; }
}

@keyframes floatPic2 {
    0%, 100% { translate: 0 0; }
    25% { translate: 8px -22px; }
    50% { translate: -4px -38px; }
    75% { translate: 4px -18px; }
}

@keyframes floatPic3 {
    0%, 100% { translate: 0 0; }
    50% { translate: 0 -48px; }
}

.shape-heart {
    aspect-ratio: 1 / 1;
    clip-path: polygon(
        50% 15%,
        65% 0%,
        85% 0%,
        100% 20%,
        100% 45%,
        50% 100%,
        0% 45%,
        0% 20%,
        15% 0%,
        35% 0%
    );
    -webkit-clip-path: polygon(
        50% 15%,
        65% 0%,
        85% 0%,
        100% 20%,
        100% 45%,
        50% 100%,
        0% 45%,
        0% 20%,
        15% 0%,
        35% 0%
    );
}

.shape-heart::before {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: inherit;
    -webkit-clip-path: inherit;
    box-shadow: inset 0 0 0 2.5px rgba(255,255,255,0.55);
    pointer-events: none;
    z-index: 2;
}

.shape-heart-small {
    aspect-ratio: 1 / 1;
    clip-path: polygon(
        50% 15%,
        65% 0%,
        85% 0%,
        100% 20%,
        100% 45%,
        50% 100%,
        0% 45%,
        0% 20%,
        15% 0%,
        35% 0%
    );
    -webkit-clip-path: polygon(
        50% 15%,
        65% 0%,
        85% 0%,
        100% 20%,
        100% 45%,
        50% 100%,
        0% 45%,
        0% 20%,
        15% 0%,
        35% 0%
    );
}

.shape-heart-small::before {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: inherit;
    -webkit-clip-path: inherit;
    box-shadow: inset 0 0 0 2px rgba(255, 230, 240, 0.6);
    pointer-events: none;
    z-index: 2;
}

.shape-circle {
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    overflow: hidden;
}

.shape-circle::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    box-shadow: inset 0 0 0 3px rgba(255,255,255,0.55);
    pointer-events: none;
    z-index: 2;
}

.shape-circle-big {
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 10px 34px rgba(196, 92, 58, 0.28), 0 2px 8px rgba(0,0,0,0.1), 0 0 0 4px rgba(255,255,255,0.7), 0 0 0 5px rgba(196, 92, 58, 0.18);
}

.shape-polaroid {
    background: #fff;
    padding: 6px 6px 26px 6px;
    border-radius: 2px;
    aspect-ratio: 3 / 3.4;
    position: relative;
}

.shape-polaroid img {
    border-radius: 1px;
    height: calc(100% - 20px);
}

.shape-polaroid::after {
    content: '❤️';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    opacity: 0.5;
    z-index: 3;
}

.shape-rounded {
    aspect-ratio: 4 / 5;
    border-radius: 22px;
    overflow: hidden;
}

.shape-rounded::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 22px;
    box-shadow: inset 0 0 0 3px rgba(255,255,255,0.5);
    pointer-events: none;
    z-index: 2;
}

.shape-soft-square {
    aspect-ratio: 1 / 1;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    overflow: hidden;
}

.shape-soft-square::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 2.5px rgba(255, 250, 240, 0.55);
    pointer-events: none;
    z-index: 2;
}

.floating-pic .polaroid-tape {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 55%;
    height: 16px;
    opacity: 0.88;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    z-index: 5;
    pointer-events: none;
}

.app-container {
    position: relative;
    z-index: 2;
    max-width: 1200px;
    margin: 0 auto;
    padding: clamp(120px, 22vh, 180px) 20px 40px;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.app-header { text-align: center; margin-bottom: 40px; position: relative; z-index: 3; }

.app-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    color: var(--warm-brown);
    margin-bottom: 8px;
}

.app-subtitle {
    font-family: 'Caveat', cursive;
    font-size: clamp(0.95rem, 2.6vw, 1.3rem);
    color: var(--terracotta);
}

.sync-status {
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--light-brown);
    letter-spacing: 0.04em;
}

.app-main {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

@media (max-width: 900px) {
    .app-main {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .app-main {
        grid-template-columns: 1fr;
    }

    .floating-pic[style*="width: 175px"] { width: 110px !important; }
    .floating-pic[style*="width: 150px"] { width: 95px !important; }
    .floating-pic[style*="width: 160px"] { width: 100px !important; }
    .floating-pic[style*="width: 135px"] { width: 85px !important; }
    .floating-pic[style*="width: 165px"] { width: 105px !important; }
    .floating-pic[style*="width: 185px"] { width: 120px !important; }
    .floating-pic[style*="width: 145px"] { width: 90px !important; }
    .floating-pic[style*="width: 125px"] { width: 85px !important; }

    .section-bg .floating-pic[style*="width: 120px"] { width: 82px !important; }
    .section-bg .floating-pic[style*="width: 100px"] { width: 68px !important; }
    .section-bg .floating-pic[style*="width: 105px"] { width: 72px !important; }
    .section-bg .floating-pic[style*="width: 90px"] { width: 62px !important; }
    .section-bg .floating-pic[style*="width: 110px"] { width: 75px !important; }
    .section-bg .floating-pic[style*="width: 125px"] { width: 85px !important; }
    .section-bg .floating-pic[style*="width: 95px"] { width: 65px !important; }
    .section-bg .floating-pic[style*="width: 92px"],
    .section-bg .floating-pic[style*="width: 82px"] { width: 58px !important; }

    .app-container { padding: clamp(80px, 18vh, 120px) 16px 28px; }
    .app-header { margin-bottom: 28px; }
    .section-header { padding: 12px 14px; }
    .back-btn { font-size: 0.9rem; padding: 6px 10px; }
    .add-btn { width: 34px; height: 34px; font-size: 0.9rem; }
    .section-content { padding: 18px 14px; }
    .modal-content { max-height: 93dvh; border-radius: 14px; }
    form { padding: 18px; }
    .modal-header { padding: 16px 18px; }
    .form-group { margin-bottom: 16px; }

    .shape-polaroid {
        padding: 5px 5px 22px 5px;
    }

    .shape-polaroid img {
        height: calc(100% - 17px);
    }

    .floating-pic .polaroid-tape {
        height: 14px;
        top: -5px;
        width: 50%;
    }

    .shape-polaroid::after {
        font-size: 0.65rem;
        bottom: 3px;
    }

    .shape-heart::before,
    .shape-heart-small::before {
        box-shadow: inset 0 0 0 2px rgba(255,255,255,0.52);
    }

    .shape-circle::before {
        box-shadow: inset 0 0 0 2.5px rgba(255,255,255,0.52);
    }

    .shape-soft-square::before {
        box-shadow: inset 0 0 0 2px rgba(255, 250, 240, 0.52);
    }
}

.section-card {
    background: white;
    border-radius: 16px;
    padding: 32px 24px;
    box-shadow: var(--paper-shadow);
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.section-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--terracotta);
}

.section-card::after {
    content: '✨';
    position: absolute;
    top: 10px; left: 10px;
    font-size: 1rem;
    opacity: 0.6;
}

.section-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

#dateCard {
    opacity: 0.75;
    cursor: not-allowed;
    filter: saturate(0.85);
}
#dateCard::before { background: var(--terracotta); }
#dateCard:hover {
    transform: none;
    box-shadow: var(--paper-shadow);
}

.coming-soon-badge {
    position: absolute;
    top: 12px; right: 12px;
    background: rgba(191, 169, 140, 0.2);
    color: var(--warm-brown);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-family: 'Caveat', cursive;
}

.card-icon { font-size: 3rem; color: var(--terracotta); margin-bottom: 16px; }

.card-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    color: var(--warm-brown);
    margin-bottom: 8px;
}

.card-desc { color: #666; font-size: 0.95rem; }

.section-screen {
    height: 100dvh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 5;
}

.section-header {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    padding: 16px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 12px rgba(139, 94, 60, 0.08);
    border-bottom: 1px solid rgba(200, 170, 140, 0.18);
    position: relative;
    z-index: 10;
}

.back-btn {
    background: rgba(196, 92, 58, 0.08);
    border: 1px solid rgba(196, 92, 58, 0.18);
    color: var(--terracotta);
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border-radius: 20px;
    transition: all 0.25s ease;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
}

.back-btn:hover {
    background: var(--terracotta);
    color: white;
    transform: translateX(-2px);
}

.section-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1.15rem, 3.4vw, 1.65rem);
    color: var(--warm-brown);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.add-btn {
    background: var(--terracotta);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 3px 10px rgba(196, 92, 58, 0.35);
    transition: opacity 0.35s ease, transform 0.25s ease, background 0.2s ease, box-shadow 0.2s ease, visibility 0s linear 0s;
    visibility: visible;
    opacity: 1;
    transform: scale(1);
}

.add-btn:hover {
    background: var(--terracotta-dark);
    transform: scale(1.08) rotate(90deg);
    box-shadow: 0 5px 15px rgba(196, 92, 58, 0.4);
}

.section-content {
    flex: 1;
    padding: 24px 20px;
    overflow-y: auto;
    position: relative;
    z-index: 10;
}

/* Two-column grid on desktop for memories and messages */
@media (min-width: 800px) {
    #memoriesList {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
    #messagesList {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
    .memory-card {
        margin-bottom: 0;
    }
    .letter-card {
        margin-bottom: 0;
    }
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #888;
    font-family: 'Caveat', cursive;
    font-size: 1.3rem;
}

/* Make empty state span full width in the grid */
@media (min-width: 800px) {
    #memoriesList .empty-state,
    #messagesList .empty-state {
        grid-column: 1 / -1;
    }
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(92, 51, 36, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.25s ease both;
}

.modal[style*="display: flex"],
.modal.show {
    backdrop-filter: blur(6px);
}

body:has(.modal[style*="display: flex"]) .floating-heart,
body:has(.modal.show) .floating-heart {
    animation-play-state: paused !important;
    opacity: 0.1 !important;
    transition: opacity 0.3s ease;
}

body:has(.modal[style*="display: flex"]) .floating-pic,
body:has(.modal.show) .floating-pic {
    animation-play-state: paused !important;
    opacity: 0.15 !important;
    transition: opacity 0.3s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 16px 48px rgba(0,0,0,0.3);
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn { from { transform: scale(0.9); } to { transform: scale(1); } }

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.4rem;
    color: var(--warm-brown);
}

.close-modal { background: none; border: none; font-size: 1.3rem; color: #888; cursor: pointer; }

form { padding: 24px; }

.form-group { margin-bottom: 20px; }

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.1rem;
    color: var(--warm-brown);
}

.form-group input[type="date"],
.form-group textarea,
.form-group input[type="file"] {
    width: 100%;
    padding: 12px;
    border: 2px solid #eee;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
}

.form-group textarea { resize: vertical; }

.submit-btn {
    width: 100%;
    padding: 14px;
    background: var(--terracotta);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.submit-btn:hover { background: var(--terracotta-dark); }
.submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.memory-card {
    background: white;
    border-radius: 16px;
    margin-bottom: 24px;
    overflow: visible; /* NEVER hide content - we clip photos separately instead */
    box-shadow: 0 4px 16px rgba(139, 94, 60, 0.12);
    border: 1px solid rgba(200, 170, 140, 0.25);
    position: relative;
    z-index: 1;
}

/* Photo Grid Styles */
.memory-photos-grid {
    display: grid;
    gap: 2px;
    background: rgba(200, 170, 140, 0.15);
    width: 100%;
    /* Clip only the photo grid for top rounded corners */
    overflow: hidden;
    border-top-left-radius: 15px; /* match card radius minus 1px border */
    border-top-right-radius: 15px;
}

.memory-photos-grid.cols-1 {
    grid-template-columns: 1fr;
}
.memory-photos-grid.cols-2 {
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: 260px;
}
/* FACEBOOK-STYLE 3-PHOTO LAYOUT (exact as requested!) */
.memory-photos-grid.cols-3 {
    grid-template-columns: 1.6fr 1fr;
    grid-template-rows: 1fr 1fr;
    grid-auto-rows: 260px;
}
.memory-photos-grid.cols-3 .memory-photo:first-child {
    grid-column: 1 / 2;
    grid-row: 1 / 3;
    height: 100%; /* force it to fill both rows completely! */
    min-height: 522px; /* 260*2 + 2px gap */
}
.memory-photos-grid.cols-4 {
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: 260px;
}
.memory-photos-grid.cols-5 {
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: 260px;
}

.memory-photo {
    position: relative;
    width: 100%;
    height: 260px;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    transition: filter 0.2s ease;
}

/* Only single-photo cards get a special taller height */
.memory-photos-grid.cols-1 .memory-photo {
    height: 500px !important;
}

.memory-photo:hover { filter: brightness(0.92); }

.memory-photo.more-overlay {
    background: rgba(92, 51, 36, 0.72);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cormorant Garamond', serif;
    font-size: 3.2rem;
    font-weight: 600;
    backdrop-filter: blur(2px);
}

.memory-photo.more-overlay::after {
    content: '';
    position: absolute;
    inset: 0;
    background: inherit;
    background-size: cover;
    background-position: center;
    opacity: 0.3;
    z-index: -1;
}

.memory-cover-empty {
    background: linear-gradient(135deg, #f5ead6, #e8d9bf);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--light-brown);
    font-size: 3.5rem;
    height: 320px;
}

.memory-info {
    padding: 18px 22px 26px !important;
    display: block !important;
    overflow: visible !important;
    background: #fffaf3; /* Very subtle warm cream to always stand out from photo */
    position: relative;
    z-index: 5;
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 15px;
    border-top: 2px solid rgba(214, 122, 82, 0.18); /* soft terracotta separator line */
}

.memory-date {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.15rem;
    color: var(--terracotta);
    margin-bottom: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.memory-date::before {
    content: '🗓';
    font-size: 0.9rem;
    opacity: 0.85;
}

.memory-preview {
    color: #5a4a3a;
    font-size: 0.97rem;
    line-height: 1.55;
    margin-bottom: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.view-btn {
    background: #c65d3c !important; /* slightly darker terracotta for more contrast */
    border: 2px solid #a34a2e !important;
    color: #ffffff !important;
    padding: 15px 34px !important;
    border-radius: 32px !important;
    cursor: pointer !important;
    transition: all 0.3s ease;
    font-size: 1.15rem !important;
    font-weight: 800 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 20px !important;
    position: relative !important;
    z-index: 999 !important;
    box-shadow: 0 5px 18px rgba(198, 93, 60, 0.4) !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 58px !important;
    line-height: 1.3 !important;
    pointer-events: all !important;
}

.view-btn::after { content: '→'; transition: transform 0.2s ease; font-weight: 800; font-size: 1.2rem; }
.view-btn:hover { 
    background: #a34a2e !important; 
    transform: translateY(-2px) scale(1.02); 
    box-shadow: 0 8px 22px rgba(198, 93, 60, 0.5) !important;
}
.view-btn:hover::after { transform: translateX(5px); }

.memory-modal { max-width: 700px; max-height: 90vh; overflow-y: auto; }

.memory-gallery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 0 24px;
}

.memory-gallery img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease;
    cursor: zoom-in;
}

.memory-gallery img:hover { transform: scale(1.02); }

.memory-gallery:has(img:only-child) { grid-template-columns: 1fr; }
.memory-gallery:has(img:only-child) img { height: 500px; }

.memory-description { padding: 20px 24px; color: #444; line-height: 1.6; }

.letter-card {
    position: relative;
    margin-bottom: 24px;
    height: 480px;
    cursor: pointer;
    border-radius: 18px;
    transition: transform 0.3s ease, filter 0.3s ease;
    transform: translateZ(0);
    filter: drop-shadow(0 4px 12px rgba(139, 94, 60, 0.12));
    will-change: transform, filter;
}

.letter-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 18px;
    pointer-events: none;
    z-index: 20;
    box-shadow: 0 0 0 0 rgba(196, 92, 58, 0);
    transition: box-shadow 0.3s ease;
}

.letter-card:hover {
    transform: translateY(-4px) scale(1.01);
    filter: drop-shadow(0 10px 24px rgba(139, 94, 60, 0.22));
}

.letter-card:hover::after {
    box-shadow: inset 0 0 0 1.5px rgba(196, 92, 58, 0.3);
}

.letter-card:hover .letter-flap-left {
    transform: translateX(-3px);
}

.letter-card:hover .letter-flap-right {
    transform: translateX(3px);
}

.letter-flap {
    position: absolute;
    top: 0;
    height: 100%;
    width: 50%;
    background-color: var(--l-paper, #fffdf8);
    box-shadow: 0 4px 14px var(--l-shadow, rgba(139, 94, 60, 0.1));
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    transform: translateZ(0);
    will-change: transform;
}

.letter-flap::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--l-pattern, none);
    background-size: var(--l-pattern-size, 140px 160px);
    opacity: var(--l-pattern-opacity, 0.75);
    pointer-events: none;
    filter: drop-shadow(0 1px 0 rgba(255,255,255,0.1));
}

.letter-flap-left {
    left: 0;
    border-top-left-radius: 18px;
    border-bottom-left-radius: 18px;
    border: 1px solid var(--l-border, rgba(200, 170, 140, 0.28));
    border-right: 1px dashed var(--l-seal, rgba(196, 92, 58, 0.4));
    transform-origin: left center;
    clip-path: polygon(0 0, 100% 2.5%, 100% 97.5%, 0 100%);
}

.letter-flap-right {
    right: 0;
    border-top-right-radius: 18px;
    border-bottom-right-radius: 18px;
    border: 1px solid var(--l-border, rgba(200, 170, 140, 0.28));
    border-left: none;
    transform-origin: right center;
    clip-path: polygon(0 2.5%, 100% 0, 100% 100%, 0 97.5%);
}

.letter-flap-right::after {
    content: '';
    position: absolute;
    left: -1px;
    top: 10%;
    bottom: 10%;
    width: 2px;
    background: linear-gradient(
        to bottom,
        transparent,
        var(--l-seal-alpha, rgba(196, 92, 58, 0.15)) 15%,
        var(--l-seal-beta, rgba(196, 92, 58, 0.2)) 50%,
        var(--l-seal-alpha, rgba(196, 92, 58, 0.15)) 85%,
        transparent
    );
}

.letter-center {
    position: absolute;
    top: 44%;
    left: 50%;
    transform: translate(-50%, 0);
    z-index: 10;
    text-align: center;
    width: 100%;
    padding: 0 24px;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.letter-seal {
    width: 84px;
    height: 84px;
    background: linear-gradient(145deg, var(--l-seal-light, #d96c48), var(--l-seal, #c65d3c));
    border-radius: 50%;
    margin: 0 auto 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    box-shadow:
        0 6px 18px var(--l-seal-shadow, rgba(196, 92, 58, 0.55)),
        inset 0 3px 4px rgba(255, 255, 255, 0.28),
        inset 0 -3px 5px var(--l-seal-inset, rgba(158, 74, 46, 0.32));
    position: relative;
    border: 2.5px solid var(--l-seal-ring, rgba(163, 74, 46, 0.45));
    z-index: 11;
}

.letter-seal::before {
    content: '';
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    border: 1.5px dashed rgba(255, 255, 255, 0.32);
}

.letter-ribbon {
    position: absolute;
    top: 39%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    z-index: 5;
    pointer-events: none;
    height: 20px;
    background: var(--l-ribbon-bg, repeating-linear-gradient(
        45deg,
        var(--l-ribbon-a, #c65d3c),
        var(--l-ribbon-a, #c65d3c) 8px,
        var(--l-ribbon-b, #faf5ea) 8px,
        var(--l-ribbon-b, #faf5ea) 15px,
        var(--l-ribbon-c, #e8d9bf) 15px,
        var(--l-ribbon-c, #e8d9bf) 22px,
        var(--l-ribbon-b, #faf5ea) 22px,
        var(--l-ribbon-b, #faf5ea) 29px
    ));
    opacity: 0.92;
    box-shadow:
        0 2px 5px var(--l-ribbon-shadow, rgba(158, 74, 46, 0.12)),
        0 -1px 3px var(--l-ribbon-shadow-2, rgba(158, 74, 46, 0.08));
}

.letter-ribbon-knot {
    position: absolute;
    top: 39%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9;
    width: 180px;
    height: 120px;
    pointer-events: none;
}

.letter-date {
    font-family: 'Cormorant Garamond', serif;
    color: var(--l-text-accent, #5a3e2a);
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 14px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.85);
    background: var(--l-paper-pill, rgba(255, 253, 248, 0.6));
    backdrop-filter: blur(2px);
    padding: 6px 18px;
    border-radius: 20px;
    border: 1px solid var(--l-border, rgba(200, 170, 140, 0.22));
}

.letter-date::before {
    content: '💌';
    font-size: 1.1rem;
}

.letter-preview {
    color: var(--l-text, #5c4a3a);
    font-family: 'Caveat', cursive;
    font-size: 1.6rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 400px;
    margin: 0 auto 0 auto;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.85);
    padding: 0 8px;
}

.letter-open-hint {
    margin-top: 16px;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.1rem;
    color: var(--l-seal, #c65d3c);
    font-style: italic;
    font-weight: 500;
    opacity: 0.92;
}

.letter-corner {
    position: absolute;
    width: 44px;
    height: 44px;
    opacity: 0.55;
    pointer-events: none;
    z-index: 4;
}

.letter-corner.tl { top: 10px; left: 10px; border-top: 2.5px solid var(--l-seal, #c65d3c); border-left: 2.5px solid var(--l-seal, #c65d3c); border-top-left-radius: 8px; }
.letter-corner.tr { top: 10px; right: 10px; border-top: 2.5px solid var(--l-seal, #c65d3c); border-right: 2.5px solid var(--l-seal, #c65d3c); border-top-right-radius: 8px; }
.letter-corner.bl { bottom: 10px; left: 10px; border-bottom: 2.5px solid var(--l-seal, #c65d3c); border-left: 2.5px solid var(--l-seal, #c65d3c); border-bottom-left-radius: 8px; }
.letter-corner.br { bottom: 10px; right: 10px; border-bottom: 2.5px solid var(--l-seal, #c65d3c); border-right: 2.5px solid var(--l-seal, #c65d3c); border-bottom-right-radius: 8px; }

.message-modal {
    background: transparent;
    max-width: 960px;
    width: 95%;
    position: relative;
    perspective: 2000px;
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    animation: none !important;
    --book-bg: linear-gradient(135deg, #fff 0%, #fff8ed 100%);
    --book-line: rgba(191, 169, 140, 0.1);
    --book-seal: #c65d3c;
    --book-seal-dark: #9d4a2f;
    --book-text-accent: #6b4a2e;
}

.message-modal::before {
    content: '';
    position: absolute;
    inset: -40px;
    background:
        radial-gradient(ellipse at center, var(--book-glow, rgba(255, 248, 237, 0.98)) 0%, var(--book-glow-2, rgba(255, 248, 237, 0.9)) 60%, var(--book-glow-3, rgba(255, 248, 237, 0.78)) 100%);
    border-radius: 28px;
    filter: blur(2px);
    z-index: -1;
    pointer-events: none;
}

.message-modal::after {
    content: '';
    position: absolute;
    inset: -8px;
    background: transparent;
    border-radius: 22px;
    box-shadow: 0 20px 60px var(--book-shadow, rgba(139, 94, 60, 0.18)), 0 4px 16px rgba(0,0,0,0.08);
    z-index: -2;
    pointer-events: none;
}

.message-photos-collage {
    position: absolute;
    inset: -20px;
    pointer-events: none;
    z-index: -1;
}

.message-photos-collage img {
    position: absolute;
    width: 100px;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

@media (max-width: 800px) {
    .book-wrapper {
        flex-direction: column;
        min-height: auto;
    }
    .book-page {
        width: 100%;
        min-height: auto;
        height: auto;
        max-height: none;
        overflow: visible;
    }
    .book-page-left {
        border-radius: 14px 14px 0 0;
        padding: 24px;
        min-height: 280px;
        animation: pageDropLeft 0.6s ease 0.1s both;
    }
    .book-page-right {
        border-radius: 0 0 14px 14px;
        padding: 24px;
        min-height: 360px;
        max-height: 56vh;
        animation: pageDropRight 0.6s ease 0.2s both;
    }
    .book-spine {
        display: none;
    }
    @keyframes pageDropLeft {
        from { opacity: 0; transform: translateY(-20px); }
        to { opacity: 1; transform: translateY(0); }
    }
    @keyframes pageDropRight {
        from { opacity: 0; transform: translateY(20px); }
        to { opacity: 1; transform: translateY(0); }
    }
    .letter-card { height: 400px; }
    .letter-center { top: 42%; }
    .letter-ribbon { top: 37%; height: 18px; }
    .letter-seal { width: 72px; height: 72px; font-size: 1.6rem; margin-bottom: 24px; }
    .letter-date { font-size: 1.05rem; padding: 5px 14px; margin-bottom: 10px; }
    .letter-preview { font-size: 1.4rem; max-width: 320px; }
    .letter-open-hint { margin-top: 12px; font-size: 1rem; }

    .polaroid.p1 { width: 90px; height: 98px; top: 5%; left: 3%; }
    .polaroid.p2 { width: 100px; height: 108px; bottom: 10%; left: 6%; }
    .polaroid.p3 { width: 92px; height: 100px; top: 8%; right: 3%; }
    .polaroid.p4 { width: 94px; height: 102px; bottom: 14%; right: 5%; }
    .polaroid.p5 { width: 82px; height: 90px; top: 48%; left: -1%; }
    .polaroid.p6 { width: 86px; height: 94px; top: 46%; right: 0%; }
}

@media (max-width: 500px) {
    .letter-card { height: 360px; }
    .letter-center { top: 40%; }
    .letter-ribbon { top: 35%; height: 16px; }
    .letter-seal { width: 64px; height: 64px; font-size: 1.5rem; margin-bottom: 18px; }
    .letter-date { font-size: 1rem; padding: 4px 12px; margin-bottom: 10px; }
    .letter-preview { font-size: 1.25rem; max-width: 280px; }
    .letter-corner { width: 36px; height: 36px; }
    .letter-ribbon { height: 15px; }
    .letter-open-hint { margin-top: 10px; font-size: 0.95rem; }
    .book-decoration { font-size: 2.4rem; }
    .book-salutation { font-size: 1.25rem; }
    .letter-text { font-size: 1.2rem; }

    .polaroid.p1 { width: 74px; height: 80px; }
    .polaroid.p2 { width: 82px; height: 88px; }
    .polaroid.p3 { width: 76px; height: 82px; }
    .polaroid.p4 { width: 78px; height: 84px; }
    .polaroid.p5 { width: 68px; height: 74px; }
    .polaroid.p6 { width: 72px; height: 78px; }
}

.book-wrapper {
    position: relative;
    display: flex;
    min-height: 620px;
    transform: translateZ(0);
    will-change: opacity, transform;
    animation: bookAppear 0.5s ease-out both;
}

@keyframes bookAppear {
    from { opacity: 0; }
    to { opacity: 1; }
}

.book-spine {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 14px;
    z-index: 20;
    background: linear-gradient(
        to right,
        rgba(158, 74, 46, 0.3) 0%,
        rgba(196, 92, 58, 0.5) 40%,
        rgba(125, 90, 58, 0.4) 50%,
        rgba(196, 92, 58, 0.5) 60%,
        rgba(158, 74, 46, 0.3) 100%
    );
    border-radius: 3px;
    box-shadow:
        inset 0 0 8px rgba(0,0,0,0.2),
        0 2px 6px rgba(0,0,0,0.1);
}

.book-spine::before,
.book-spine::after {
    content: '';
    position: absolute;
    left: 2px;
    right: 2px;
    height: 4px;
    background: rgba(125, 90, 58, 0.5);
    border-radius: 2px;
}

.book-spine::before { top: 8px; }
.book-spine::after { bottom: 8px; }

.book-page {
    width: 50%;
    height: 620px;
    max-height: 85vh;
    position: relative;
    background: linear-gradient(
        135deg,
        #fff 0%,
        #fff8ed 100%
    );
    box-shadow: 0 8px 28px rgba(0,0,0,0.16);
    backface-visibility: hidden;
    transform: translateZ(0);
    will-change: transform, opacity;
    overflow: hidden;
}

.book-page-left {
    border-top-left-radius: 14px;
    border-bottom-left-radius: 14px;
    transform-origin: right center;
    animation: pageOpenLeft 0.65s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
    padding: 32px 24px 32px 32px;
}

@keyframes pageOpenLeft {
    0% {
        transform: perspective(1400px) rotateY(82deg);
        opacity: 0.15;
    }
    70% {
        opacity: 1;
    }
    100% {
        transform: perspective(1400px) rotateY(0deg);
        opacity: 1;
    }
}

.book-page-right {
    border-top-right-radius: 14px;
    border-bottom-right-radius: 14px;
    transform-origin: left center;
    animation: pageOpenRight 0.65s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.05s both;
    padding: 32px 32px 32px 24px;
    display: flex;
    flex-direction: column;
}

@keyframes pageOpenRight {
    0% {
        transform: perspective(1400px) rotateY(-82deg);
        opacity: 0.15;
    }
    70% {
        opacity: 1;
    }
    100% {
        transform: perspective(1400px) rotateY(0deg);
        opacity: 1;
    }
}

.book-page::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
}

.book-left-content {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 10px 0;
}

.book-left-photo-tape {
    position: absolute;
    width: 60px;
    height: 18px;
    background: rgba(255, 240, 180, 0.72);
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    transform: rotate(-4deg);
    top: -8px;
    left: 50%;
    margin-left: -30px;
    z-index: 6;
    opacity: 0.9;
    border-radius: 2px;
}

.polaroid-tape {
    position: absolute;
    top: -7px;
    left: 50%;
    transform: translateX(-50%);
    width: 55%;
    height: 18px;
    opacity: 0.86;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    z-index: 4;
    pointer-events: none;
}

.book-photos-scatter {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3;
}

.polaroid {
    position: absolute;
    background: #fff;
    padding: 6px 6px 18px 6px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.18), 0 1px 3px rgba(0,0,0,0.1);
    border-radius: 2px;
    transform-origin: center center;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 3;
    pointer-events: auto;
    cursor: zoom-in;
}

.polaroid:hover {
    transform: rotate(0deg) scale(1.15) translateZ(0) !important;
    z-index: 50 !important;
    box-shadow: 0 12px 30px rgba(0,0,0,0.28);
}

.polaroid img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 1px;
    background: #eee;
}

.polaroid::after {
    content: '';
    display: none;
}

.polaroid.p1 {
    width: 110px;
    height: 120px;
    top: 6%;
    left: 4%;
    transform: rotate(-7deg);
    z-index: 4;
}

.polaroid.p2 {
    width: 130px;
    height: 140px;
    bottom: 8%;
    left: 8%;
    transform: rotate(6deg);
    z-index: 5;
}

.polaroid.p3 {
    width: 120px;
    height: 130px;
    top: 12%;
    right: 4%;
    transform: rotate(8deg);
    z-index: 4;
}

.polaroid.p4 {
    width: 115px;
    height: 125px;
    bottom: 12%;
    right: 6%;
    transform: rotate(-9deg);
    z-index: 5;
}

.polaroid.p5 {
    width: 100px;
    height: 110px;
    top: 48%;
    left: -2%;
    transform: rotate(-12deg);
    z-index: 6;
}

.polaroid.p6 {
    width: 108px;
    height: 118px;
    top: 45%;
    right: -1%;
    transform: rotate(11deg);
    z-index: 6;
}

.book-decoration {
    font-size: 3rem;
    color: var(--terracotta);
    opacity: 0.85;
    margin-bottom: 14px;
    animation: gentleFloat 3s ease-in-out infinite;
    position: relative;
    z-index: 10;
}

@keyframes gentleFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.book-salutation {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    color: var(--warm-brown);
    font-weight: 600;
    margin-bottom: 6px;
}

.book-divider {
    width: 60%;
    height: 1px;
    background: linear-gradient(
        to right,
        transparent,
        var(--terracotta),
        transparent
    );
    margin: 16px 0;
    opacity: 0.5;
}

.book-date {
    font-family: 'Caveat', cursive;
    font-size: 1.2rem;
    color: #8b6a4a;
    margin-top: 4px;
}

.book-page-corner {
    position: absolute;
    width: 36px;
    height: 36px;
    pointer-events: none;
    z-index: 3;
}

.book-page-left .book-page-corner.tl {
    top: 12px;
    left: 12px;
    border-top: 2px solid var(--terracotta);
    border-left: 2px solid var(--terracotta);
    border-top-left-radius: 6px;
    opacity: 0.5;
}

.book-page-left .book-page-corner.bl {
    bottom: 12px;
    left: 12px;
    border-bottom: 2px solid var(--terracotta);
    border-left: 2px solid var(--terracotta);
    border-bottom-left-radius: 6px;
    opacity: 0.5;
}

.book-page-right .book-page-corner.tr {
    top: 12px;
    right: 12px;
    border-top: 2px solid var(--terracotta);
    border-right: 2px solid var(--terracotta);
    border-top-right-radius: 6px;
    opacity: 0.5;
}

.book-page-right .book-page-corner.br {
    bottom: 12px;
    right: 12px;
    border-bottom: 2px solid var(--terracotta);
    border-right: 2px solid var(--terracotta);
    border-bottom-right-radius: 6px;
    opacity: 0.5;
}

.letter-paper {
    position: relative;
    z-index: 2;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: 0 0 18px 0;
    border-bottom: 1px solid rgba(200, 170, 140, 0.25);
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.modal-header h3 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.4rem;
    color: var(--warm-brown);
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: #888;
    cursor: pointer;
    transition: color 0.2s ease;
    padding: 6px;
}

.close-modal:hover { color: var(--terracotta); }

.letter-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 8px;
    scroll-behavior: smooth;
}

.letter-body::-webkit-scrollbar {
    width: 7px;
}

.letter-body::-webkit-scrollbar-track {
    background: transparent;
}

.letter-body::-webkit-scrollbar-thumb {
    background: rgba(196, 92, 58, 0.3);
    border-radius: 4px;
}

.letter-body::-webkit-scrollbar-thumb:hover {
    background: rgba(196, 92, 58, 0.5);
}

.letter-text {
    font-family: 'Caveat', cursive;
    font-size: 1.35rem;
    color: var(--warm-brown);
    line-height: 1.85;
    white-space: pre-wrap;
    margin: 0;
}

.letter-closing {
    margin-top: 20px;
    text-align: right;
    font-family: 'Caveat', cursive;
    font-size: 1.5rem;
    color: var(--terracotta);
    font-style: italic;
    padding-top: 10px;
    border-top: 1px dashed rgba(196, 92, 58, 0.2);
}

/* ===== LET'S DATE ===== */
.date-tabs {
    display: flex;
    gap: 8px;
    padding: 14px 24px 0;
    max-width: 1000px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.date-tab {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid rgba(196, 92, 58, 0.2);
    background: rgba(255, 253, 248, 0.6);
    color: var(--warm-brown);
    border-radius: 12px;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    backdrop-filter: blur(2px);
}

.date-tab:hover {
    background: rgba(255, 253, 248, 0.9);
    transform: translateY(-1px);
}

.date-tab.active {
    background: var(--cream);
    border-color: var(--terracotta);
    color: var(--terracotta);
    box-shadow: 0 4px 14px rgba(196, 92, 58, 0.15);
}

.date-subtabs {
    display: flex;
    gap: 6px;
    margin-bottom: 18px;
    justify-content: center;
    flex-wrap: wrap;
}

.date-subtab {
    padding: 7px 16px;
    background: transparent;
    border: none;
    color: var(--warm-brown);
    font-family: 'Caveat', cursive;
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 20px;
    transition: all 0.22s ease;
    opacity: 0.65;
}

.date-subtab:hover {
    opacity: 1;
    background: rgba(255, 253, 248, 0.6);
}

.date-subtab.active {
    opacity: 1;
    background: var(--cream);
    color: var(--terracotta);
    box-shadow: 0 2px 8px rgba(196, 92, 58, 0.12);
}

.wishlist-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 22px;
    flex-wrap: wrap;
    justify-content: center;
}

.action-chip {
    padding: 9px 16px;
    background: var(--cream);
    border: 1px solid rgba(196, 92, 58, 0.25);
    color: var(--warm-brown);
    border-radius: 22px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.22s ease;
    box-shadow: 0 2px 8px rgba(196, 92, 58, 0.08);
}

.action-chip i {
    margin-right: 6px;
    color: var(--terracotta);
}

.action-chip:hover {
    transform: translateY(-1px);
    background: #fff;
    box-shadow: 0 4px 14px rgba(196, 92, 58, 0.15);
}

.action-chip.special {
    background: linear-gradient(135deg, #ffe2e8, #fff3d6);
    border-color: rgba(232, 150, 160, 0.5);
    color: var(--warm-brown);
    font-weight: 600;
}

.wishlist-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.wishlist-col {
    background: rgba(255, 253, 248, 0.78);
    border-radius: 18px;
    padding: 16px;
    backdrop-filter: blur(3px);
    border: 1px solid rgba(196, 92, 58, 0.15);
    min-height: 200px;
}

.wishlist-col-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.2rem;
    color: var(--warm-brown);
    margin: 0 0 14px 0;
    padding-bottom: 10px;
    border-bottom: 1px dashed rgba(196, 92, 58, 0.2);
}

.wishlist-col-title i {
    color: var(--terracotta);
    margin-right: 6px;
}

.wishlist-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
    background: #fff;
    border-radius: 12px;
    border-left: 3px solid var(--terracotta);
    box-shadow: 0 2px 8px rgba(139, 94, 60, 0.08);
    transition: all 0.2s ease;
}

.wishlist-item:hover {
    transform: translateX(2px);
    box-shadow: 0 4px 14px rgba(139, 94, 60, 0.13);
}

.wishlist-item-main {
    flex: 1;
    min-width: 0;
}

.wishlist-item-text {
    font-family: 'Caveat', cursive;
    font-size: 1.3rem;
    color: var(--warm-brown);
    line-height: 1.2;
    word-break: break-word;
}

.wishlist-item-note {
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    color: #888;
    margin-top: 4px;
    font-style: italic;
    word-break: break-word;
}

.wishlist-item-del {
    background: transparent;
    border: none;
    color: #c44;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 4px 6px;
    border-radius: 6px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.wishlist-item-del:hover {
    background: rgba(204, 68, 68, 0.1);
}

.empty-state.mini p {
    font-size: 0.9rem;
    padding: 14px;
    text-align: center;
}

/* Chips */
.chips-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.chips-group.small .chip {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.chip {
    padding: 8px 14px;
    background: #fff;
    border: 1.5px solid rgba(196, 92, 58, 0.2);
    border-radius: 22px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: var(--warm-brown);
    cursor: pointer;
    transition: all 0.22s ease;
}

.chip:hover {
    background: var(--cream);
    border-color: rgba(196, 92, 58, 0.45);
    transform: translateY(-1px);
}

.chip.active {
    background: linear-gradient(135deg, rgba(255, 200, 150, 0.25), rgba(255, 180, 190, 0.28));
    border-color: var(--terracotta);
    color: var(--warm-brown);
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(196, 92, 58, 0.18);
}

.chip.place i {
    margin-right: 6px;
    color: var(--terracotta);
}

.chip.surprise {
    background: linear-gradient(135deg, #fff3c4, #ffd7e4);
    border-style: dashed;
    font-weight: 600;
}

.chip.surprise.active {
    border-style: solid;
    border-color: #d48a45;
}

.form-row {
    display: flex;
    gap: 14px;
}

.form-group.half {
    flex: 1;
}

.date-plan-modal {
    max-width: 640px !important;
}

.date-plan-modal input[type="date"],
.date-plan-modal input[type="time"] {
    font-family: 'Inter', sans-serif;
}

/* Planned date cards */
.date-card {
    position: relative;
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(196, 92, 58, 0.14);
    box-shadow: 0 4px 14px rgba(139, 94, 60, 0.1);
}

.date-card:hover {
    transform: translateY(-4px) rotate(-0.3deg);
    box-shadow: 0 12px 28px rgba(139, 94, 60, 0.18);
}

.date-card-hero {
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    background: linear-gradient(135deg, var(--blush-light), var(--honey-light));
    position: relative;
    overflow: hidden;
}

.date-card-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 20%, rgba(255,255,255,0.4) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(255,255,255,0.35) 0%, transparent 45%);
    pointer-events: none;
}

.date-card-hero.mood-romantic { background: linear-gradient(135deg, #ffd4de, #ffe1ec); }
.date-card-hero.mood-adventure { background: linear-gradient(135deg, #c8e6c9, #d7f0e8); }
.date-card-hero.mood-chill { background: linear-gradient(135deg, #cde7f0, #d9ecff); }
.date-card-hero.mood-celebratory { background: linear-gradient(135deg, #fff3c4, #ffd4de); }
.date-card-hero.mood-foodtrip { background: linear-gradient(135deg, #ffe8cc, #ffd6c4); }
.date-card-hero.mood-anniversary { background: linear-gradient(135deg, #f5d0ff, #ffd1dc); }
.date-card-hero.mood-default { background: linear-gradient(135deg, var(--blush-light), var(--honey-light)); }

.date-card-emoji {
    font-size: 2.6rem;
    z-index: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.date-card-mood {
    font-family: 'Caveat', cursive;
    font-size: 1.2rem;
    color: var(--warm-brown);
    z-index: 1;
    letter-spacing: 0.04em;
}

.date-card-body {
    padding: 16px;
}

.date-card-date {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.25rem;
    color: var(--warm-brown);
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.date-card-time {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: #888;
}

.date-card-location {
    font-family: 'Caveat', cursive;
    font-size: 1.2rem;
    color: var(--terracotta);
    margin-bottom: 6px;
}

.date-card-location i {
    margin-right: 4px;
}

.date-card-food {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: #666;
}

.date-card-food strong {
    color: var(--warm-brown);
}

.date-card-note {
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(255, 212, 222, 0.35);
    border-radius: 10px;
    font-family: 'Caveat', cursive;
    font-size: 1.05rem;
    color: var(--warm-brown);
    border-left: 2px solid var(--terracotta);
    font-style: italic;
}

.date-card-tape {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%) rotate(-2deg);
    width: 80px;
    height: 22px;
    background: rgba(255, 243, 196, 0.9);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    z-index: 2;
}

/* Date view modal */
.date-view-modal {
    max-width: 500px !important;
    padding: 0 !important;
    overflow: hidden;
}

.date-view-modal .date-card-hero {
    height: 140px;
}

.date-view-modal .modal-header {
    padding: 18px 24px 10px;
}

.date-view-grid {
    padding: 0 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dv-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px dashed rgba(196, 92, 58, 0.15);
}

.dv-row:last-of-type { border-bottom: none; }

.dv-label {
    min-width: 110px;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1rem;
    color: #888;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dv-label i {
    color: var(--terracotta);
    width: 16px;
    text-align: center;
}

.dv-value {
    flex: 1;
    font-family: 'Caveat', cursive;
    font-size: 1.25rem;
    color: var(--warm-brown);
    word-break: break-word;
}

.date-note-box {
    margin: 18px 24px 0;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(255, 212, 222, 0.4), rgba(255, 243, 196, 0.4));
    border-radius: 14px;
    border: 1px dashed rgba(232, 150, 160, 0.5);
}

.date-note-label {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 4px;
    letter-spacing: 0.05em;
}

.date-note-text {
    font-family: 'Caveat', cursive;
    font-size: 1.35rem;
    color: var(--warm-brown);
    line-height: 1.4;
    white-space: pre-wrap;
    font-style: italic;
}

.date-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px 24px;
    gap: 12px;
    flex-wrap: wrap;
}

.date-meta-created {
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    color: #aaa;
    font-style: italic;
}

.danger-btn {
    background: #fff;
    color: #c44;
    border: 1px solid rgba(204, 68, 68, 0.3);
    padding: 8px 14px;
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.danger-btn:hover {
    background: #fff4f4;
    border-color: #c44;
}

/* Surprise modal */
.surprise-modal {
    max-width: 440px !important;
    overflow: hidden;
    position: relative;
}

.modal-header.centered {
    justify-content: center;
    padding-bottom: 6px;
}

.modal-header.centered h3 {
    text-align: center;
}

.surprise-confetti {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.surprise-confetti span {
    position: absolute;
    top: -20px;
    font-size: 1.6rem;
    animation: confettiFall 2.4s ease-in infinite;
}

.surprise-confetti span:nth-child(1) { left: 8%;  animation-delay: 0s;   }
.surprise-confetti span:nth-child(2) { left: 22%; animation-delay: 0.3s; }
.surprise-confetti span:nth-child(3) { left: 36%; animation-delay: 0.6s; }
.surprise-confetti span:nth-child(4) { left: 50%; animation-delay: 0.15s;}
.surprise-confetti span:nth-child(5) { left: 62%; animation-delay: 0.45s;}
.surprise-confetti span:nth-child(6) { left: 74%; animation-delay: 0.75s;}
.surprise-confetti span:nth-child(7) { left: 86%; animation-delay: 0.25s;}
.surprise-confetti span:nth-child(8) { left: 94%; animation-delay: 0.55s;}

@keyframes confettiFall {
    0% { transform: translateY(-10px) rotate(0deg); opacity: 0; }
    10% { opacity: 1; }
    100% { transform: translateY(520px) rotate(720deg); opacity: 0; }
}

.surprise-body {
    padding: 10px 24px 8px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.surprise-line {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--cream), #fff);
    border-radius: 14px;
    border-left: 4px solid var(--terracotta);
    box-shadow: 0 2px 10px rgba(139, 94, 60, 0.1);
    animation: surprisePop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.surprise-line:nth-child(1) { animation-delay: 0.1s;  }
.surprise-line:nth-child(2) { animation-delay: 0.25s; }
.surprise-line:nth-child(3) { animation-delay: 0.4s;  }

@keyframes surprisePop {
    from { opacity: 0; transform: scale(0.6) translateX(-20px); }
    to   { opacity: 1; transform: scale(1) translateX(0); }
}

.surprise-ico {
    font-size: 2.2rem;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.surprise-txt {
    flex: 1;
    min-width: 0;
}

.surprise-lbl {
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    color: #888;
    letter-spacing: 0.05em;
}

.surprise-val {
    font-family: 'Caveat', cursive;
    font-size: 1.5rem;
    color: var(--warm-brown);
    line-height: 1.15;
    margin-top: 2px;
    word-break: break-word;
}

.surprise-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    padding: 18px 24px 26px;
    flex-wrap: wrap;
}

.ghost-btn {
    padding: 10px 18px;
    background: transparent;
    border: 1.5px solid rgba(196, 92, 58, 0.3);
    color: var(--warm-brown);
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.22s ease;
}

.ghost-btn:hover {
    background: rgba(196, 92, 58, 0.05);
    border-color: rgba(196, 92, 58, 0.55);
}

/* Responsive date stuff */
@media (max-width: 600px) {
    .date-tabs { padding: 12px 14px 0; }
    .date-tab { font-size: 0.92rem; padding: 9px 10px; }
    .form-row { flex-direction: column; gap: 0; }
    .dv-label { min-width: 90px; font-size: 0.9rem; }
    .dv-value { font-size: 1.12rem; }
    .wishlist-cols { grid-template-columns: 1fr; }
    .action-chip { font-size: 0.8rem; padding: 8px 12px; }
    .date-card-emoji { font-size: 2.1rem; }
    .date-card-hero { height: 95px; }
}

@media (max-width: 800px) {
    #appScreen,
    .section-screen {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }

    .modal {
        padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right))
            max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    }

    .modal-content.message-modal {
        width: 100%;
        max-width: 560px;
        max-height: calc(100dvh - 16px);
        overflow: visible;
    }

    .message-modal .book-wrapper {
        width: 100%;
        height: calc(100dvh - 24px);
        max-height: calc(100dvh - 24px);
        min-height: 0;
        flex-direction: column;
        overflow: hidden;
        border-radius: 14px;
    }

    .message-modal .book-page {
        width: 100%;
        min-height: 0;
        max-height: none;
    }

    .message-modal .book-page-left {
        flex: 0 0 clamp(132px, 22dvh, 176px);
        height: clamp(132px, 22dvh, 176px);
        padding: 12px;
        border-radius: 14px 14px 0 0;
    }

    .message-modal .book-page-right {
        flex: 1 1 auto;
        height: auto;
        padding: clamp(12px, 4vw, 24px);
        border-radius: 0 0 14px 14px;
    }

    .message-modal .letter-paper {
        min-height: 0;
    }

    .message-modal .modal-header {
        gap: 10px;
        padding-bottom: 10px;
        margin-bottom: 12px;
    }

    .message-modal .modal-header h3 {
        min-width: 0;
        font-size: clamp(1.15rem, 5vw, 1.4rem);
    }

    .message-modal .close-modal {
        flex: 0 0 40px;
        width: 40px;
        height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 1.25rem;
    }

    .message-modal .letter-body {
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .message-modal .book-left-content {
        height: calc(100% - 60px);
    }

    .message-modal .book-photos-scatter {
        position: absolute;
        inset: auto 6px 4px;
        height: 56px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        overflow: hidden;
    }

    .message-modal .polaroid {
        position: relative;
        inset: auto;
        flex: 0 0 clamp(44px, 12vw, 58px);
        width: clamp(44px, 12vw, 58px);
        height: clamp(46px, 11vw, 52px);
        padding: 3px 3px 8px;
        transform: rotate(-3deg);
    }

    .message-modal .polaroid-tape {
        top: -4px;
        height: 8px;
    }

    .message-modal .polaroid:nth-child(even) { transform: rotate(3deg); }
    .message-modal .polaroid:hover { transform: rotate(0deg) scale(1.05) !important; }

    .message-modal .polaroid.p1,
    .message-modal .polaroid.p2,
    .message-modal .polaroid.p3,
    .message-modal .polaroid.p4,
    .message-modal .polaroid.p5,
    .message-modal .polaroid.p6 {
        top: auto;
        right: auto;
        bottom: auto;
        left: auto;
    }
}

@media (max-width: 480px) {
    .letter-card { height: clamp(260px, 58dvh, 360px); }

    .message-modal .book-page-left {
        flex-basis: clamp(164px, 30dvh, 190px);
        height: clamp(164px, 30dvh, 190px);
    }

    .message-modal .book-decoration { font-size: 1.8rem; margin-bottom: 4px; }
    .message-modal .book-salutation { font-size: 1.1rem; margin-bottom: 2px; }
    .message-modal .book-divider { margin: 6px 0; }
    .message-modal .book-date { font-size: 1rem; }
    .message-modal .book-page-corner { width: 24px; height: 24px; }
    .message-modal .letter-text { font-size: 1.1rem; line-height: 1.55; }
    .message-modal::before { inset: -12px; }
    .message-modal::after { inset: -4px; }
}

@media (max-height: 420px) and (orientation: landscape) and (max-width: 800px) {
    .message-modal .book-page-left {
        flex-basis: 108px;
        height: 108px;
    }

    .message-modal .book-left-content {
        height: calc(100% - 52px);
        padding: 0;
    }
    .message-modal .book-photos-scatter { height: 48px; }
    .message-modal .polaroid {
        flex-basis: clamp(40px, 8vw, 50px);
        width: clamp(40px, 8vw, 50px);
        height: 42px;
    }
    .message-modal .book-decoration { display: none; }
    .message-modal .book-divider { margin: 4px 0; }
    .message-modal .book-salutation { font-size: 1rem; }
    .message-modal .book-page-right { padding: 8px 14px; }
    .message-modal .modal-header { padding-bottom: 6px; margin-bottom: 6px; }
    .message-modal .close-modal { width: 36px; height: 36px; flex-basis: 36px; }
}