:root {
    --bg-color: #050202;
    --text-primary: #fff0f5;
    --text-secondary: #ffccd5;
    --accent-color: #ff3366;
    --glass-bg: rgba(25, 12, 12, 0.85);
    /* Slightly more transparent for cards */
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --gold: #FFD700;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    background: radial-gradient(ellipse at bottom, #1a0505 0%, #050202 100%);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow-x: hidden;
    /* Enable native scroll on body */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    height: 100%;
    min-height: 100vh;
}

#roseCanvas {
    position: fixed;
    /* Canvas stats fixed in background */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    /* Let touches pass through to scroll */
}

/* Scroll Container */
.content-scroll-container {
    position: relative;
    z-index: 10;
    width: 100%;
    min-height: 100vh;
    padding: 1.5rem;
    padding-top: 5rem;
    /* Space for counter */
    pointer-events: auto;
}

/* Bento Grid System */
.bento-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 600px;
    margin: 0 auto;
}

.bento-item {
    width: 100%;
    opacity: 0;
    /* Hidden initially for reveal effect */
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    padding: 2rem 1.5rem;
    border-radius: 24px;
    text-align: center;
    box-shadow: var(--glass-shadow);
}

/* Specific Card Styles */
.main-title {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
    text-shadow: 0 4px 15px rgba(255, 51, 102, 0.6);
    line-height: 1.1;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.verse {
    font-family: 'Crimson Text', serif;
    font-style: italic;
    font-size: 1.25rem;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.verse-author {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: right;
}

.message {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    line-height: 1.6;
    margin-bottom: 0;
}

.message.highlight {
    margin-top: 1rem;
    color: var(--gold);
    font-style: italic;
}

.signature {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    color: var(--text-primary);
}

/* Molecule */
.molecule-svg {
    width: 80%;
    max-width: 200px;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 8px rgba(255, 51, 102, 0.4));
}

.formula {
    font-family: monospace;
    font-weight: bold;
    color: #ff9a9e;
}

.chemical-name {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.8;
}

/* Reveal Class (Added by JS) */
.reveal-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Counter */
.rose-counter {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 100;
    text-align: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 0.8rem 1.2rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 51, 102, 0.3);
}

.counter-number {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-color), var(--gold));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
}

.counter-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.fade-in-counter {
    animation: fadeIn 1s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Desktop Grid */
@media (min-width: 768px) {
    .bento-grid {
        max-width: 900px;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
        align-items: start;
    }

    /* Header spans full width */
    .bento-item:first-child {
        grid-column: span 2;
    }

    /* Signature spans full width */
    .signature-card {
        grid-column: span 2;
    }

    .main-title {
        font-size: 4rem;
    }

    .subtitle {
        font-size: 1.5rem;
    }

    .verse {
        font-size: 1.4rem;
    }

    .message {
        font-size: 1.4rem;
    }
}

/* Surprise Button */
.surprise-btn {
    background: linear-gradient(45deg, var(--accent-color), #ff6b9d);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    border-radius: 50px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(255, 51, 102, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    -webkit-tap-highlight-color: transparent;
    /* Remove gray tap box on iPhone */
}

.surprise-btn:active {
    transform: scale(0.95);
}

.surprise-btn:hover {
    box-shadow: 0 6px 20px rgba(255, 51, 102, 0.6);
    transform: translateY(-2px);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    /* Dynamic viewport height for iOS Safari */
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    /* Ensure blur works on Safari */
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 400px;
    padding: 2rem;
    transform: scale(0.9);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Improve animation performance on mobile */
    will-change: transform, opacity;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 2.5rem;
    /* Larger touch target */
    cursor: pointer;
    line-height: 1;
    padding: 0.5rem;
    /* Touch area padding */
    -webkit-tap-highlight-color: transparent;
}

/* Drawing Animation */
.drawing-container {
    text-align: center;
}

#drawnRoseSvg {
    width: 100%;
    height: auto;
    max-width: 300px;
    filter: drop-shadow(0 0 10px rgba(255, 51, 102, 0.3));
}

.rose-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    fill-opacity: 0;
    transition: fill-opacity 1s ease 2s;
    /* Fill fades in after drawing */
}

/* Animation triggered via JS class */
.animate-draw .rose-path {
    animation: dash 2.5s ease-in-out forwards;
}

.animate-draw .rose-path.stem {
    animation-delay: 0s;
    stroke: #4caf50;
}

.animate-draw .rose-path.leaf {
    animation-delay: 0.5s;
    stroke: #4caf50;
}

.animate-draw .rose-path.petal {
    animation-delay: 1s;
}

/* Fill colors */
.animate-draw .rose-path.petal {
    fill: #DC143C;
}

.animate-draw .rose-path.stem {
    fill: none;
}

.animate-draw .rose-path.leaf {
    fill: #2d5016;
    fill-opacity: 0.6;
}

@keyframes dash {
    to {
        stroke-dashoffset: 0;
        fill-opacity: 0.6;
        /* Semi-transparent fill */
    }
}

.drawing-text {
    font-family: 'Playfair Display', serif;
    color: var(--gold);
    font-style: italic;
    font-size: 1.2rem;
    margin-top: 1rem;
}