/* ==========================================================================
   GỬI PHƯƠNG — THIỆP CHÀO NGÀY MỚI & THẾ GIỚI DỊU DÀNG
   Theme: Gentle Sage Green & Fresh Morning Dew (Xanh Lá Nhẹ Nhàng & Thư Thái)
   ========================================================================== */

:root {
    --font-heading: 'Playfair Display', Georgia, serif;
    --font-script: 'Dancing Script', cursive;
    --font-body: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;

    /* Palette: Soft Sage Green, Morning Dew & Gentle Matcha */
    --color-bg-start: #f6faf6;
    --color-bg-mid: #eaf4ed;
    --color-bg-end: #e3f0e6;
    
    --color-primary: #2d6a4f;           /* Deep Forest / Gentle Sage */
    --color-primary-hover: #1b4332;
    --color-primary-soft: rgba(45, 106, 79, 0.1);
    --color-secondary: #52b788;         /* Fresh Mint Leaf */
    --color-light-green: #74c69d;       /* Soft Dew Green */
    --color-accent: #e9c46a;            /* Soft Morning Sunlight */
    
    --color-text-main: #1f3326;
    --color-text-muted: #52796f;
    --color-text-light: #84a98c;
    
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(255, 255, 255, 0.95);
    --glass-shadow: 0 25px 60px -15px rgba(45, 106, 79, 0.12), 0 10px 30px -10px rgba(0, 0, 0, 0.03);

    --envelope-body: #ecf5ee;
    --envelope-flap: #dcedde;
    --envelope-inner: #cfe4d2;
    --wax-seal-bg: #40916c;

    --radius-sm: 10px;
    --radius-md: 18px;
    --radius-lg: 28px;
    --radius-full: 9999px;

    --transition-smooth: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    --transition-bounce: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    color: var(--color-text-main);
    background: linear-gradient(135deg, var(--color-bg-start) 0%, var(--color-bg-mid) 50%, var(--color-bg-end) 100%);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
    line-height: 1.6;
}

/* Background Ambient Canvas */
#ambient-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* Ambient Gentle Green Sun Glow & Bokehs */
.sun-glow {
    position: fixed;
    top: -140px;
    right: -90px;
    width: 560px;
    height: 560px;
    background: radial-gradient(circle, rgba(149, 213, 178, 0.45) 0%, rgba(233, 196, 106, 0.2) 50%, transparent 75%);
    filter: blur(55px);
    pointer-events: none;
    z-index: 0;
    animation: pulse-sun 7s ease-in-out infinite alternate;
}

.floating-bokeh {
    position: fixed;
    border-radius: 50%;
    filter: blur(45px);
    pointer-events: none;
    z-index: 0;
}

.bokeh-1 {
    width: 420px;
    height: 420px;
    bottom: -100px;
    left: -100px;
    background: radial-gradient(circle, rgba(183, 228, 199, 0.4) 0%, transparent 70%);
    animation: drift-bokeh 12s ease-in-out infinite alternate;
}

.bokeh-2 {
    width: 340px;
    height: 340px;
    top: 30%;
    left: 8%;
    background: radial-gradient(circle, rgba(216, 243, 220, 0.6) 0%, transparent 70%);
    animation: drift-bokeh 14s ease-in-out infinite alternate-reverse;
}

.bokeh-3 {
    width: 320px;
    height: 320px;
    bottom: 15%;
    right: 5%;
    background: radial-gradient(circle, rgba(183, 228, 199, 0.35) 0%, transparent 70%);
}

@keyframes pulse-sun {
    0% { transform: scale(1) translate(0, 0); opacity: 0.75; }
    100% { transform: scale(1.15) translate(-25px, 25px); opacity: 0.95; }
}

@keyframes drift-bokeh {
    0% { transform: translate(0, 0); }
    100% { transform: translate(35px, -35px); }
}

/* ==========================================================================
   TOP FLOATING NAVIGATION BAR (Safe Area & Mobile Compliant)
   ========================================================================== */
.top-nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: max(20px, env(safe-area-inset-top, 20px)) max(24px, env(safe-area-inset-right, 24px)) 12px max(24px, env(safe-area-inset-left, 24px));
    z-index: 1000;
    pointer-events: none;
}

.top-fold-container,
.audio-control-container {
    pointer-events: auto;
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.top-fold-container.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-12px);
}

/* Elegant Back / Fold Pill */
.btn-top-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 9px 18px;
    border-radius: var(--radius-full);
    box-shadow: 0 8px 24px rgba(45, 106, 79, 0.12);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--color-primary);
    transition: var(--transition-smooth);
}

.btn-top-pill:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(45, 106, 79, 0.2);
    background: #ffffff;
}

.music-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 9px 18px;
    border-radius: var(--radius-full);
    box-shadow: 0 8px 24px rgba(45, 106, 79, 0.12);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--color-primary);
    transition: var(--transition-smooth);
}

.music-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(45, 106, 79, 0.2);
    background: #ffffff;
}

.sound-waves {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 16px;
}

.sound-waves span {
    width: 3px;
    height: 4px;
    background-color: var(--color-primary);
    border-radius: 2px;
    transition: height 0.2s ease;
}

.music-playing .sound-waves span:nth-child(1) { animation: wave 1.1s ease-in-out infinite; }
.music-playing .sound-waves span:nth-child(2) { animation: wave 0.8s ease-in-out infinite 0.2s; }
.music-playing .sound-waves span:nth-child(3) { animation: wave 1.3s ease-in-out infinite 0.4s; }
.music-playing .sound-waves span:nth-child(4) { animation: wave 0.9s ease-in-out infinite 0.1s; }

@keyframes wave {
    0%, 100% { height: 4px; }
    50% { height: 16px; }
}

/* ==========================================================================
   STAGE 1: LUXURY BOTANICAL GREETING CARD FOLIO
   ========================================================================== */
.main-wrapper {
    position: relative;
    z-index: 10;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: max(100px, calc(env(safe-area-inset-top, 20px) + 72px)) 24px 60px;
}

.stage {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.envelope-active {
    display: flex;
    opacity: 1;
    transform: scale(1);
}

.card-hidden {
    display: none;
    opacity: 0;
    transform: translateY(40px) scale(0.94);
}

/* 3D Card Scene Perspective */
.card-scene-3d {
    perspective: 1400px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 20px 0;
}

/* The Luxury Stationery Card */
.luxury-stationery-card {
    position: relative;
    width: 400px;
    max-width: 92vw;
    min-height: 540px;
    background: linear-gradient(160deg, #ffffff 0%, #fbfdfb 50%, #edf5ef 100%);
    border-radius: 24px;
    padding: 16px;
    box-shadow: 
        0 35px 85px -15px rgba(27, 67, 50, 0.2),
        0 10px 30px -10px rgba(0, 0, 0, 0.04),
        inset 0 0 0 1px rgba(255, 255, 255, 0.95);
    transform-style: preserve-3d;
    transition: transform 0.85s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.8s ease, box-shadow 0.45s ease;
    cursor: default;
}

.luxury-stationery-card:hover {
    transform: translateY(-6px) rotateX(1.5deg);
    box-shadow: 
        0 42px 95px -15px rgba(27, 67, 50, 0.26),
        0 15px 35px -10px rgba(0, 0, 0, 0.06);
}

/* 3D Gatefold / Door Opening Transition */
.luxury-stationery-card.card-opening-3d {
    transform-origin: left center;
    transform: perspective(1400px) rotateY(-110deg) scale(0.92) translateZ(-40px);
    opacity: 0;
    pointer-events: none;
}

/* 4 Delicate Gold Filigree Corner Ornaments */
.corner-ornament {
    position: absolute;
    width: 26px;
    height: 26px;
    border: 1.5px solid rgba(233, 196, 106, 0.7);
    pointer-events: none;
    z-index: 6;
}

.corner-ornament.top-left {
    top: 22px;
    left: 22px;
    border-right: none;
    border-bottom: none;
    border-top-left-radius: 4px;
}

.corner-ornament.top-right {
    top: 22px;
    right: 22px;
    border-left: none;
    border-bottom: none;
    border-top-right-radius: 4px;
}

.corner-ornament.bottom-left {
    bottom: 22px;
    left: 22px;
    border-right: none;
    border-top: none;
    border-bottom-left-radius: 4px;
}

.corner-ornament.bottom-right {
    bottom: 22px;
    right: 22px;
    border-left: none;
    border-top: none;
    border-bottom-right-radius: 4px;
}

/* Inner Frame of the Card */
.card-inner-frame {
    position: relative;
    border: 1px solid rgba(183, 228, 199, 0.75);
    outline: 1px dashed rgba(233, 196, 106, 0.5);
    outline-offset: -5px;
    border-radius: 18px;
    padding: 26px 18px 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    height: 100%;
    background: rgba(255, 255, 255, 0.65);
    overflow: hidden;
}

/* Botanical Branch SVG */
.botanical-art {
    margin-bottom: 6px;
}

.branch-svg {
    width: 95px;
    height: 32px;
    filter: drop-shadow(0 2px 4px rgba(82, 183, 136, 0.15));
}

/* Cover Tagline */
.cover-tagline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.golden-dash {
    width: 20px;
    height: 1px;
    background: rgba(233, 196, 106, 0.85);
}

.tagline-text {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--color-text-muted);
    letter-spacing: 2.5px;
    text-transform: uppercase;
}

/* Recipient Section */
.cover-recipient {
    margin-bottom: 12px;
}

.greeting-prefix {
    display: block;
    font-size: 0.84rem;
    color: var(--color-text-light);
    font-style: italic;
    font-family: 'Cormorant Garamond', Georgia, serif;
    margin-bottom: 2px;
}

.recipient-name {
    font-family: 'Alex Brush', cursive;
    font-size: 3.3rem;
    line-height: 1.15;
    background: linear-gradient(135deg, #1b4332 0%, #2d6a4f 60%, #40916c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.05));
    margin: 2px 0 8px;
    font-weight: 400;
}

.recipient-quote {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    font-size: 1rem;
    color: #40916c;
    line-height: 1.45;
    max-width: 280px;
    margin: 0 auto;
    font-weight: 600;
}

/* Horizontal Silk Ribbon Band & Central 3D Wax Seal */
.ribbon-and-seal-container {
    position: relative;
    width: 100%;
    margin: 14px 0 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.silk-ribbon-band {
    position: absolute;
    left: -20px;
    right: -20px;
    height: 38px;
    background: linear-gradient(
        90deg, 
        transparent 0%, 
        rgba(64, 145, 108, 0.12) 10%, 
        rgba(82, 183, 136, 0.22) 50%, 
        rgba(64, 145, 108, 0.12) 90%, 
        transparent 100%
    );
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.6s ease;
    pointer-events: none;
}

.silk-ribbon-band.ribbon-untied {
    transform: scaleX(1.4);
    opacity: 0;
}

.ribbon-stitch-top, .ribbon-stitch-bottom {
    height: 1px;
    width: 100%;
    background: linear-gradient(90deg, transparent 5%, rgba(233, 196, 106, 0.75) 50%, transparent 95%);
}

/* Realistic 3D Emerald Wax Seal (Uncut, Centered, Symmetrical) */
.wax-seal-wrapper {
    position: relative;
    z-index: 5;
    display: flex;
    justify-content: center;
    align-items: center;
}

.wax-seal-ring {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 1.5px dashed rgba(233, 196, 106, 0.75);
    animation: rotate-ring 25s linear infinite;
    pointer-events: none;
}

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

.luxury-wax-seal {
    position: relative;
    width: 68px;
    height: 68px;
    background: radial-gradient(circle at 35% 35%, #52b788 0%, #2d6a4f 65%, #1b4332 100%);
    border-radius: 50%;
    box-shadow: 
        0 10px 26px rgba(27, 67, 50, 0.38),
        inset 0 2px 5px rgba(255, 255, 255, 0.5),
        inset 0 -3px 6px rgba(0, 0, 0, 0.35);
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid rgba(233, 196, 106, 0.7);
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.5s ease;
    animation: seal-pulse 3.5s ease-in-out infinite;
}

.luxury-wax-seal:hover {
    transform: scale(1.1);
}

.luxury-wax-seal.seal-melt {
    transform: scale(1.35) rotate(15deg);
    opacity: 0;
    filter: blur(4px);
    pointer-events: none;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.5s ease, filter 0.5s ease;
}

@keyframes seal-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.seal-inner-emboss {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.seal-glyph {
    font-size: 1.15rem;
    line-height: 1;
}

.seal-monogram {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #fef08a;
}

/* Golden Dawn Radiant Sunbeam (Bursts on Open) */
.golden-dawn-burst {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(254, 240, 138, 0.95) 0%, rgba(233, 196, 106, 0.75) 30%, rgba(82, 183, 136, 0.3) 60%, transparent 75%);
    box-shadow: 0 0 100px 40px rgba(233, 196, 106, 0.7);
    pointer-events: none;
    z-index: 10;
    opacity: 0;
    transition: transform 0.85s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.85s ease;
}

.golden-dawn-burst.burst-active {
    transform: translate(-50%, -50%) scale(3);
    opacity: 1;
}

/* Action Area */
.cover-action-wrap {
    width: 100%;
    margin-top: auto;
}

.action-subtext {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    margin-bottom: 12px;
}

.btn-luxury-open {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #2d6a4f 0%, #40916c 60%, #52b788 100%);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 12px 26px;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(45, 106, 79, 0.28);
    transition: var(--transition-smooth);
}

.btn-luxury-open:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(45, 106, 79, 0.38);
    background: linear-gradient(135deg, #1b4332 0%, #2d6a4f 60%, #40916c 100%);
}

.btn-leaf-icon {
    font-size: 1.05rem;
}

.btn-sparkle {
    font-size: 0.9rem;
    color: #fef08a;
}

.btn-sparkle {
    font-size: 0.9rem;
    color: #fef08a;
}

/* ==========================================================================
   STAGE 2: MAIN GREETING CARD (Revealed)
   ========================================================================== */
.card-container {
    width: 100%;
    max-width: 760px;
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    padding: 56px 44px 48px;
    position: relative;
    overflow: hidden;
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.8s ease;
}

#card-stage.card-revealed {
    opacity: 1;
    transform: translateY(0) scale(1);
}

#card-stage.card-revealed .card-container {
    animation: card-reveal-bloom 0.95s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes card-reveal-bloom {
    0% {
        opacity: 0;
        transform: translateY(35px) scale(0.93);
        box-shadow: 0 10px 30px rgba(45, 106, 79, 0.1);
    }
    55% {
        box-shadow: 0 35px 95px -10px rgba(45, 106, 79, 0.28), 0 0 60px rgba(233, 196, 106, 0.4);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        box-shadow: var(--glass-shadow);
    }
}

/* Staggered cascading reveal of card elements */
#card-stage.card-revealed .badge-tag { animation: stagger-slide-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both; }
#card-stage.card-revealed .time-greeting-box { animation: stagger-slide-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both; }
#card-stage.card-revealed .floral-divider { animation: stagger-slide-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both; }
#card-stage.card-revealed .letter-content-box { animation: stagger-slide-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.4s both; }
#card-stage.card-revealed .affirmations-section { animation: stagger-slide-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.5s both; }
#card-stage.card-revealed .comfort-counter-section { animation: stagger-slide-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.6s both; }
#card-stage.card-revealed .fortune-section { animation: stagger-slide-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.7s both; }

@keyframes stagger-slide-up {
    0% {
        opacity: 0;
        transform: translateY(24px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card Header */
.card-header {
    text-align: center;
    margin-bottom: 34px;
}

.badge-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--color-primary-soft);
    color: var(--color-primary);
    padding: 8px 22px;
    border-radius: var(--radius-full);
    font-size: 0.88rem;
    font-weight: 700;
    margin-bottom: 22px;
    border: 1px solid rgba(45, 106, 79, 0.2);
}

.badge-dot {
    width: 7px;
    height: 7px;
    background: var(--color-primary);
    border-radius: 50%;
    animation: blink 2s infinite ease-in-out;
}

@keyframes blink {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.date-string {
    font-size: 0.94rem;
    color: var(--color-text-muted);
    font-weight: 500;
    letter-spacing: 0.5px;
    margin-bottom: 20px;
    line-height: 1.6;
    text-transform: capitalize;
}

.main-title {
    font-family: var(--font-heading);
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--color-text-main);
    line-height: 1.4;
    margin-bottom: 20px;
}

.highlight-name {
    background: linear-gradient(120deg, #2d6a4f 0%, #52b788 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
}

.poetic-quote {
    font-family: var(--font-heading);
    font-style: italic;
    font-size: 1.15rem;
    color: #40916c;
    max-width: 580px;
    margin: 0 auto;
    line-height: 1.7;
    font-weight: 600;
}

/* Floral / Nature Divider */
.floral-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 36px 0 40px;
}

.floral-divider .line {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(45, 106, 79, 0.35), transparent);
    flex: 1;
    max-width: 160px;
}

.floral-icon {
    font-size: 1.15rem;
    letter-spacing: 6px;
}

/* Letter Content Box (Short & Gentle) */
.letter-content-box {
    background: rgba(255, 255, 255, 0.94);
    border-radius: var(--radius-md);
    padding: 28px 32px;
    border: 1px solid rgba(183, 228, 199, 0.6);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.01), 0 8px 24px rgba(45, 106, 79, 0.05);
    position: relative;
    margin-bottom: 30px;
}

@media (max-width: 600px) {
    .letter-content-box {
        padding: 22px 16px;
    }
}

.letter-salutation {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    color: var(--color-primary);
    margin-bottom: 12px;
    font-weight: 700;
}

.typewriter-container {
    font-size: 1.05rem;
    color: #2d3748;
    line-height: 1.8;
    white-space: pre-line;
    min-height: 90px;
}

.letter-signature {
    margin-top: 18px;
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.signature-note {
    font-size: 0.88rem;
    color: var(--color-text-muted);
    font-style: italic;
}

.signature-name {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--color-primary);
    font-weight: 700;
}

/* Affirmation Cards Grid */
.affirmations-section {
    margin-bottom: 30px;
}

.section-title-wrap {
    text-align: center;
    margin-bottom: 20px;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    color: var(--color-text-main);
    font-weight: 700;
}

.section-subtitle {
    font-size: 0.88rem;
    color: var(--color-text-muted);
    margin-top: 4px;
}

.affirmation-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

@media (max-width: 640px) {
    .affirmation-grid {
        grid-template-columns: 1fr;
    }
}

/* Flip Card 3D */
.flip-card {
    background-color: transparent;
    height: 160px;
    perspective: 1000px;
    cursor: pointer;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    border-radius: var(--radius-md);
}

.flip-card:hover .flip-card-inner,
.flip-card:focus .flip-card-inner,
.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-front, .flip-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: var(--radius-md);
    padding: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.03);
}

.flip-front {
    background: #ffffff;
    border: 1px solid rgba(183, 228, 199, 0.6);
    color: var(--color-text-main);
    transition: var(--transition-smooth);
}

.flip-card:hover .flip-front {
    border-color: var(--color-primary);
    transform: translateY(-2px);
}

.card-art {
    font-size: 2.1rem;
    margin-bottom: 6px;
}

.flip-front h4 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--color-text-main);
    font-weight: 600;
}

.hint-tap {
    font-size: 0.75rem;
    color: var(--color-primary);
    margin-top: 6px;
    background: var(--color-primary-soft);
    padding: 3px 12px;
    border-radius: var(--radius-full);
    font-weight: 600;
}

.flip-back {
    background: linear-gradient(135deg, #f0fdf4 0%, #e8f5ec 100%);
    border: 1px solid rgba(82, 183, 136, 0.4);
    transform: rotateY(180deg);
    text-align: center;
    color: var(--color-text-main);
}

.back-icon {
    font-size: 1.3rem;
    margin-bottom: 4px;
}

.flip-back h4 {
    font-family: var(--font-heading);
    font-size: 0.98rem;
    color: var(--color-primary);
    margin-bottom: 5px;
    font-weight: 700;
}

.flip-back p {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    line-height: 1.45;
}

/* Motivation Generator Box */
.hug-meter-section {
    margin-bottom: 28px;
}

.hug-box {
    background: linear-gradient(135deg, rgba(232, 245, 233, 0.6) 0%, rgba(240, 253, 244, 0.6) 100%);
    border: 1px dashed rgba(82, 183, 136, 0.5);
    border-radius: var(--radius-md);
    padding: 24px 20px;
    text-align: center;
}

.hug-icon-floating {
    font-size: 1.7rem;
    display: inline-block;
    animation: gentle-bob 2.5s ease-in-out infinite;
}

@keyframes gentle-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.hug-header h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    color: var(--color-primary);
    margin: 6px 0 4px;
    font-weight: 700;
}

.hug-header p {
    font-size: 0.88rem;
    color: var(--color-text-muted);
}

.counter-display {
    margin: 14px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-size: 1.15rem;
    font-weight: 600;
}

.counter-number {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-primary);
    font-family: var(--font-heading);
}

.heart-pulse {
    display: inline-block;
    animation: heartbeat 1.2s infinite;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    15% { transform: scale(1.3); }
    30% { transform: scale(1); }
    45% { transform: scale(1.15); }
}

.btn-hug {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #ffffff;
    color: var(--color-primary);
    border: 1.5px solid var(--color-primary);
    padding: 11px 26px;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(45, 106, 79, 0.12);
    transition: var(--transition-bounce);
}

.btn-hug:hover {
    background: var(--color-primary);
    color: #ffffff;
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 10px 24px rgba(45, 106, 79, 0.25);
}

.btn-hug:active {
    transform: scale(0.96);
}

.hug-toast {
    margin-top: 10px;
    font-size: 0.9rem;
    color: var(--color-primary);
    font-weight: 600;
    min-height: 22px;
    transition: opacity 0.3s ease;
}

/* Fortune Wish Card */
.fortune-cookie-section {
    margin-bottom: 26px;
}

.cookie-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #ffffff;
    border: 1px solid rgba(183, 228, 199, 0.6);
    border-radius: var(--radius-md);
    padding: 16px 22px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.02);
}

@media (max-width: 640px) {
    .cookie-card {
        flex-direction: column;
        text-align: center;
    }
}

.cookie-icon-wrap {
    font-size: 1.7rem;
    color: var(--color-secondary);
}

.cookie-content {
    flex: 1;
}

.cookie-content h4 {
    font-family: var(--font-heading);
    font-size: 0.98rem;
    color: var(--color-text-main);
    margin-bottom: 3px;
    font-weight: 700;
}

.cookie-content p {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    font-style: italic;
}

.btn-subtle {
    background: var(--color-primary-soft);
    color: var(--color-primary);
    border: none;
    padding: 9px 16px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition-smooth);
}

.btn-subtle:hover {
    background: var(--color-primary);
    color: #ffffff;
}

/* Card Footer */
.card-footer {
    text-align: center;
    border-top: 1px solid rgba(45, 106, 79, 0.12);
    padding-top: 26px;
    margin-top: 10px;
}

.footer-note {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    color: var(--color-primary);
    font-weight: 700;
}

.footer-sub {
    font-size: 0.88rem;
    color: var(--color-text-muted);
    margin-top: 6px;
    line-height: 1.55;
}

/* Footer Repack Action Wrap */
.footer-action-wrap {
    margin-top: 24px;
    display: flex;
    justify-content: center;
}

.btn-footer-repack {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, rgba(45, 106, 79, 0.08) 0%, rgba(82, 183, 136, 0.15) 100%);
    border: 1.5px solid rgba(45, 106, 79, 0.28);
    padding: 13px 30px;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-primary);
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 6px 18px rgba(45, 106, 79, 0.08);
}

.btn-footer-repack:hover {
    background: var(--color-primary);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(45, 106, 79, 0.22);
}

/* Golden Light Aura Bloom & Micro-Sparkles */
.golden-light-aura {
    position: fixed;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(233, 196, 106, 0.75) 0%, rgba(82, 183, 136, 0.25) 50%, transparent 70%);
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 9998;
    animation: expand-aura 0.85s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes expand-aura {
    0% {
        width: 20px;
        height: 20px;
        opacity: 1;
    }
    100% {
        width: 320px;
        height: 320px;
        opacity: 0;
    }
}

.golden-micro-spark {
    position: fixed;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 0 8px #fef08a, 0 0 16px #e9c46a;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    animation: spark-fly 0.85s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes spark-fly {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    60% {
        opacity: 0.9;
    }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.2);
    }
}

/* Delicate Golden Shockwave Ring */
.golden-wave-ring {
    position: fixed;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid rgba(233, 196, 106, 0.85);
    box-shadow: 0 0 15px rgba(254, 240, 138, 0.6);
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 9997;
    animation: wave-expand 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes wave-expand {
    0% {
        transform: translate(-50%, -50%) scale(0.6);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(5.8);
        opacity: 0;
    }
}

/* ==========================================================================
   MOBILE & TABLET RESPONSIVE PERFECTION
   ========================================================================== */

/* Tablet & Smaller Desktops (<= 768px) */
@media (max-width: 768px) {
    .main-wrapper {
        padding: max(96px, calc(env(safe-area-inset-top, 0px) + 74px)) 20px max(40px, env(safe-area-inset-bottom, 24px));
        min-height: 100dvh;
    }

    .card-container {
        padding: 48px 30px 40px;
    }

    .main-title {
        font-size: 1.95rem;
        line-height: 1.4;
        margin-bottom: 20px;
    }

    .date-string {
        margin-bottom: 18px;
    }

    .floral-divider {
        margin: 32px 0 36px;
    }
}

/* Standard Mobile Devices (<= 600px - iPhone 12/13/14/15/16, Samsung Galaxy) */
@media (max-width: 600px) {
    /* Top Floating Navigation Bar with Safe Area Inset */
    .top-nav-bar {
        padding: max(14px, env(safe-area-inset-top, 14px)) max(14px, env(safe-area-inset-right, 14px)) 10px max(14px, env(safe-area-inset-left, 14px));
    }

    .btn-top-pill {
        padding: 8px 14px;
        font-size: 0.82rem;
        gap: 6px;
    }

    .music-btn {
        padding: 8px 14px;
        gap: 6px;
        font-size: 0.82rem;
    }

    .music-label {
        display: none; /* Hide text on mobile for minimalist sleek pill */
    }

    .sound-waves {
        height: 13px;
    }

    .sound-waves span {
        width: 2.5px;
    }

    /* Generous top clearance so top navigation pills NEVER collide with card */
    .main-wrapper {
        padding: max(92px, calc(env(safe-area-inset-top, 0px) + 76px)) 16px max(42px, env(safe-area-inset-bottom, 24px));
    }

    /* Ambient Sun Glows scaled for mobile viewport */
    .sun-glow {
        width: 320px;
        height: 320px;
        top: -80px;
        right: -60px;
    }

    .bokeh-1 {
        width: 240px;
        height: 240px;
        bottom: -60px;
        left: -60px;
    }

    /* Stage 1: Card Folio Cover on Mobile */
    .card-scene-3d {
        padding: 10px 0;
    }

    .luxury-stationery-card {
        width: 100%;
        max-width: 360px;
        min-height: auto;
        padding: 14px;
        border-radius: 20px;
    }

    .card-inner-frame {
        padding: 24px 16px 20px;
        border-radius: 16px;
    }

    .corner-ornament {
        width: 20px;
        height: 20px;
    }

    .corner-ornament.top-left { top: 16px; left: 16px; }
    .corner-ornament.top-right { top: 16px; right: 16px; }
    .corner-ornament.bottom-left { bottom: 16px; left: 16px; }
    .corner-ornament.bottom-right { bottom: 16px; right: 16px; }

    .branch-svg {
        width: 80px;
        height: 26px;
    }

    .tagline-text {
        font-size: 0.7rem;
        letter-spacing: 2px;
    }

    .golden-dash {
        width: 14px;
    }

    .greeting-prefix {
        font-size: 0.8rem;
    }

    .recipient-name {
        font-size: 2.85rem;
        margin: 2px 0 8px;
    }

    .recipient-quote {
        font-size: 0.92rem;
        line-height: 1.48;
        max-width: 270px;
    }

    .ribbon-and-seal-container {
        margin: 14px 0 20px;
    }

    .silk-ribbon-band {
        height: 34px;
        left: -16px;
        right: -16px;
    }

    .luxury-wax-seal {
        width: 62px;
        height: 62px;
    }

    .wax-seal-ring {
        width: 74px;
        height: 74px;
    }

    .seal-glyph {
        font-size: 1.05rem;
    }

    .seal-monogram {
        font-size: 0.72rem;
    }

    .action-subtext {
        font-size: 0.78rem;
        margin-bottom: 10px;
    }

    .btn-luxury-open {
        padding: 12px 22px;
        font-size: 0.9rem;
        width: 100%;
        max-width: 270px;
        justify-content: center;
    }

    /* Stage 2: Reading Card Container with Generous Spacing */
    .card-container {
        padding: 44px 20px 34px;
        border-radius: 24px;
    }

    .card-header {
        margin-bottom: 28px;
    }

    .badge-tag {
        font-size: 0.82rem;
        padding: 7px 18px;
        margin-bottom: 20px;
    }

    .date-string {
        font-size: 0.86rem;
        line-height: 1.6;
        margin-bottom: 18px;
    }

    .main-title {
        font-size: 1.62rem;
        line-height: 1.42;
        margin-bottom: 18px;
    }

    .poetic-quote {
        font-size: 1.02rem;
        line-height: 1.68;
        max-width: 95%;
        margin-bottom: 12px;
    }

    .floral-divider {
        margin: 30px 0 34px;
        gap: 14px;
    }

    .floral-divider .line {
        max-width: 70px;
    }

    .floral-icon {
        font-size: 1rem;
        letter-spacing: 4px;
    }

    .letter-content-box {
        padding: 24px 18px;
        margin-bottom: 30px;
    }

    .letter-salutation {
        font-size: 1.2rem;
        margin-bottom: 14px;
    }

    .typewriter-container {
        font-size: 0.95rem;
        line-height: 1.85;
        min-height: 85px;
    }

    .letter-signature {
        margin-top: 22px;
        gap: 4px;
    }

    .section-title-wrap {
        margin-bottom: 24px;
    }

    .section-title {
        font-size: 1.25rem;
        margin-bottom: 6px;
    }

    .section-subtitle {
        font-size: 0.84rem;
        line-height: 1.5;
    }

    .affirmation-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .flip-card {
        height: 148px;
    }

    .flip-front, .flip-back {
        padding: 16px;
    }

    .card-art {
        font-size: 1.8rem;
        margin-bottom: 4px;
    }

    .flip-front h4 {
        font-size: 1rem;
    }

    .hint-tap {
        font-size: 0.72rem;
        padding: 3px 11px;
    }

    .flip-back h4 {
        font-size: 0.94rem;
        margin-bottom: 4px;
    }

    .flip-back p {
        font-size: 0.84rem;
        line-height: 1.45;
    }

    /* Comfort Counter Section */
    .hug-meter-section {
        margin-bottom: 30px;
    }

    .hug-box {
        padding: 22px 18px;
    }

    .hug-icon-floating {
        font-size: 1.6rem;
    }

    .hug-header h3 {
        font-size: 1.15rem;
    }

    .hug-header p {
        font-size: 0.82rem;
    }

    .counter-display {
        font-size: 1.05rem;
        margin: 16px 0;
    }

    .counter-number {
        font-size: 1.6rem;
    }

    .btn-hug {
        padding: 12px 24px;
        font-size: 0.92rem;
        margin-top: 6px;
        width: 100%;
        max-width: 270px;
        justify-content: center;
    }

    .hug-toast {
        font-size: 0.84rem;
    }

    /* Fortune Wish Card */
    .fortune-cookie-section {
        margin-bottom: 28px;
    }

    .cookie-card {
        padding: 20px 18px;
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }

    .cookie-icon-wrap {
        font-size: 1.6rem;
    }

    .cookie-content h4 {
        font-size: 0.96rem;
    }

    .cookie-content p {
        font-size: 0.88rem;
        line-height: 1.5;
    }

    .btn-subtle {
        padding: 9px 18px;
        font-size: 0.85rem;
        width: 100%;
        max-width: 210px;
    }

    /* Footer & Repack Button in Mobile */
    .card-footer {
        padding-top: 24px;
    }

    .footer-note {
        font-size: 1.05rem;
        line-height: 1.5;
        margin-bottom: 6px;
    }

    .footer-sub {
        font-size: 0.84rem;
        line-height: 1.5;
    }

    .footer-action-wrap {
        margin-top: 20px;
    }

    .btn-footer-repack {
        width: 100%;
        max-width: 250px;
        padding: 12px 22px;
        font-size: 0.9rem;
        justify-content: center;
    }
}

/* Small Handset Screens (<= 375px - iPhone SE, small Androids) */
@media (max-width: 375px) {
    .main-wrapper {
        padding: max(84px, calc(env(safe-area-inset-top, 0px) + 68px)) 12px 38px;
    }

    .luxury-stationery-card {
        max-width: 320px;
        padding: 10px;
    }

    .card-inner-frame {
        padding: 18px 12px 16px;
    }

    .recipient-name {
        font-size: 2.45rem;
    }

    .recipient-quote {
        font-size: 0.85rem;
    }

    .luxury-wax-seal {
        width: 54px;
        height: 54px;
    }

    .wax-seal-ring {
        width: 66px;
        height: 66px;
    }

    .btn-luxury-open {
        font-size: 0.85rem;
        padding: 10px 18px;
    }

    .card-container {
        padding: 36px 16px 28px;
    }

    .main-title {
        font-size: 1.44rem;
        line-height: 1.4;
        margin-bottom: 16px;
    }

    .poetic-quote {
        font-size: 0.96rem;
        line-height: 1.6;
    }
}


