/* Reset & Body */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: #fdf2f2;
    /* Soft pink-white background */
    font-family: 'Lora', serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    color: #4a4a4a;
}

/* Start Overlay */
#start-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(253, 242, 242, 0.98);
    /* Opaque background */
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: opacity 0.8s ease-out;
}

#start-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay-content {
    text-align: center;
    animation: pulse 2s infinite;
}

.overlay-content h1 {
    font-family: 'Dancing Script', cursive;
    font-size: 4rem;
    color: #d6336c;
    margin-bottom: 1rem;
}

.overlay-content p {
    font-size: 1.5rem;
    color: #888;
}

/* Background Aesthetics */
.background-decor {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
}

.floating-heart {
    position: absolute;
    font-size: 2rem;
    opacity: 0.2;
    animation: floatUp 10s infinite linear;
}

.h1 {
    left: 10%;
    bottom: -10%;
    animation-delay: 0s;
}

.h2 {
    left: 50%;
    bottom: -15%;
    animation-delay: 3s;
}

.h3 {
    left: 80%;
    bottom: -20%;
    animation-delay: 6s;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 0;
    }

    20% {
        opacity: 0.2;
    }

    100% {
        transform: translateY(-110vh) rotate(360deg);
        opacity: 0;
    }
}

/* Book Container */
.book-container {
    width: 100%;
    max-width: 900px;
    /* Reduced max-width for better desktop proportions */
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1500px;
}

/* Page Styling */
.page {
    background-color: #fffaf0;
    /* Cream paper color */
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.05);
    /* Paper texture feel */
    border: 1px solid #e0d0d0;
    overflow: hidden;
}

.page-content {
    padding: 2rem;
    /* Reduced padding */
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    border: 5px double #f3d1d1;
    /* Inner border frame */
    margin: 10px;
    background: #fff;
    background-image: url("data:image/svg+xml,%3Csvg width='6' height='6' viewBox='0 0 6 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23f9eaea' fill-opacity='0.4' fill-rule='evenodd'%3E%3Cpath d='M5 0h1L0 6V5zM6 5v1H5z'/%3E%3C/g%3E%3C/svg%3E");
    position: relative;
    max-width: 100%;
    /* Ensure content fits */
}

/* Typography */
h1,
h2 {
    font-family: 'Playfair Display', serif;
    color: #8b0000;
    /* Dark Red */
    margin-bottom: 0.5rem;
}

h1 {
    font-size: 3rem;
}

h2 {
    font-size: 1.8rem;
}

p {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    font-family: 'Lora', serif;
}

.instruction {
    font-size: 0.8rem;
    color: #888;
    margin-top: 2rem;
    animation: pulse 2s infinite;
}

.title {
    color: #d6336c;
}

.subtitle {
    font-family: 'Dancing Script', cursive;
    font-size: 2rem;
    color: #555;
}

.names {
    font-weight: bold;
    margin-top: 1rem;
    color: #333;
}

.divider {
    font-size: 2rem;
    color: #d6336c;
    margin: 0.5rem 0;
}

@keyframes pulse {
    0% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
        transform: scale(1.05);
    }

    100% {
        opacity: 0.6;
    }
}

/* Cover & Back Cover */
.cover-page {
    background: linear-gradient(135deg, #fceebd 0%, #f7d9d9 100%);
    color: #fff;
}

.cover-page .page-content {
    background: transparent;
    border-color: #fff;
}

.back-cover .page-content {
    background: transparent;
    border-color: #fff;
}

/* Photo Grid */
.photo-grid {
    display: flex;
    gap: 10px;
    margin: 1rem 0;
    justify-content: center;
    flex-wrap: wrap;
}

.photo-frame {
    width: 140px;
    /* Smaller frames */
    height: 140px;
    border: 5px solid #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: rotate(-3deg);
    overflow: hidden;
    position: relative;
    background: #eee;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.7rem;
    /* Smaller text for placeholder */
    color: #888;
}

.photo-frame:nth-child(2) {
    transform: rotate(2deg);
}

/* Quiz Styles */
.quiz-container {
    text-align: left;
    width: 100%;
    margin-top: 1rem;
}

.question {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px dashed #e0d0d0;
}

.question p {
    font-weight: bold;
    color: #d6336c;
    margin-bottom: 0.5rem;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.option-btn {
    background: #fff;
    border: 1px solid #f3d1d1;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Lora', serif;
    transition: all 0.3s;
    text-align: left;
}

.option-btn:hover {
    background: #fff5f5;
    border-color: #d6336c;
}

.option-btn.correct {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.option-btn.wrong {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.quiz-feedback {
    margin-top: 10px;
    font-size: 0.9rem;
    font-style: italic;
    min-height: 1.2em;
}

.quiz-page-warning {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 42px;
    background: #fff3cd;
    color: #7a5200;
    border: 1px solid #ffe08a;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 0.82rem;
    line-height: 1.35;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.quiz-page-warning.visible {
    opacity: 1;
    transform: translateY(0);
}

.photo-frame.large {
    width: 220px;
    height: 220px;
    margin: 1rem auto;
    transform: rotate(-1deg);
}

.video-frame {
    width: 85%;
    max-width: 300px;
    border: 5px solid #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    background: #000;
    margin: 1rem auto;
}

.video-frame video {
    display: block;
    width: 100%;
    height: auto;
}

.photo-frame.small {
    width: 100px;
    height: 100px;
    margin: 0 auto;
}

.photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    /* Ensure image behaves as block */
}

.placeholder {
    display: none;
    /* Hidden by default if img load fails, controlled by JS/inline handler */
    padding: 5px;
}


/* Interactive Flower */
.flower-container {
    cursor: pointer;
    margin: 20px 0;
    user-select: none;
    font-size: 4rem;
    transition: transform 0.3s;
}

.flower-container:hover {
    transform: scale(1.1);
}

.bud {
    display: block;
}

.bloom {
    display: none;
    position: relative;
}

.bloom.show {
    display: block;
    animation: bloomAnim 1s ease-out;
}

.bud.hide {
    display: none;
}

.sparkles {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2rem;
    animation: sparkleAnim 1.5s infinite;
}

@keyframes bloomAnim {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    80% {
        transform: scale(1.2);
        opacity: 1;
    }

    100% {
        transform: scale(1);
    }
}

@keyframes sparkleAnim {

    0%,
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(0);
    }

    50% {
        opacity: 1;
        transform: translateX(-50%) translateY(-10px);
    }
}

.hidden {
    display: none;
    opacity: 0;
    transition: opacity 1s;
}

.visible {
    display: block;
    opacity: 1;
}

.big-question {
    font-size: 1.5rem;
    font-weight: bold;
    color: #d6336c;
}

.happy-vday {
    font-family: 'Dancing Script', cursive;
    font-size: 2.5rem;
    color: #e63946;
    margin-top: 2rem;
}

.page-footer {
    position: absolute;
    bottom: 15px;
    width: 100%;
    text-align: center;
    font-size: 0.8rem;
    color: #bbb;
}

/* Music Control */
.music-control {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
}

#music-btn {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #ddd;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: background 0.3s;
}

#music-btn:hover {
    background: #fff;
}

/* Teddy & Proposal Styles */
.teddy {
    font-size: 5rem;
    cursor: pointer;
    transition: transform 0.2s;
    animation: bounce 2s infinite;
}

.teddy:active {
    transform: scale(0.9);
}

@keyframes blast {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.5);
        opacity: 0.5;
    }

    100% {
        transform: scale(2);
        opacity: 0;
    }
}

.blast-anim {
    animation: blast 0.5s forwards;
}

.buttons-container {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 2rem;
    position: relative;
    height: 60px;
    /* Space for buttons */
}

.proposal-btn {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    padding: 10px 25px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.yes-btn {
    background: #d6336c;
    color: white;
}

.yes-btn:hover {
    transform: scale(1.1);
    background: #c2255c;
}

.no-btn {
    background: #ccc;
    color: #555;
    position: absolute;
    /* Allows moving */
}

/* Falling Roses */
#roses-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 10;
}

.falling-rose {
    position: absolute;
    font-size: 1.5rem;
    animation: fall linear forwards;
}

@keyframes fall {
    to {
        transform: translateY(100vh) rotate(360deg);
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* =============================================
   PREMIUM PROPOSAL PAGE 
   ============================================= */

.premium-proposal {
    background: linear-gradient(135deg, #fff0f5 0%, #ffe4e8 50%, #ffd6e0 100%) !important;
    position: relative;
    overflow: hidden;
}

.premium-proposal .page-content {
    background: transparent !important;
    border: none !important;
    position: relative;
    z-index: 2;
}

/* Animated hearts BG inside proposal */
.premium-proposal::before,
.premium-proposal::after {
    content: '💕';
    position: absolute;
    font-size: 3rem;
    opacity: 0.1;
    animation: floatSoft 6s ease-in-out infinite;
}

.premium-proposal::before {
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.premium-proposal::after {
    content: '💗';
    bottom: 15%;
    right: 10%;
    animation-delay: 3s;
    font-size: 2rem;
}

@keyframes floatSoft {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-15px) rotate(10deg);
    }
}

/* Stage Container */
.stage {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Glow Container around Teddy */
.glow-container {
    position: relative;
    width: 200px;
    height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
}

.glow-container::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 105, 135, 0.35) 0%, rgba(255, 182, 193, 0.15) 50%, transparent 70%);
    animation: glowPulse 3s ease-in-out infinite;
    z-index: 0;
}

@keyframes glowPulse {

    0%,
    100% {
        transform: scale(0.9);
        opacity: 0.6;
    }

    50% {
        transform: scale(1.15);
        opacity: 1;
    }
}

/* Teddy Icon */
.teddy-icon {
    font-size: 7rem;
    z-index: 2;
    position: relative;
    filter: drop-shadow(0 15px 25px rgba(214, 51, 108, 0.3));
    animation: teddyBounce 2s ease-in-out infinite;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.teddy-icon:active {
    transform: scale(0.85);
}

/* Teddy Bear Image (when using real PNG) */
img.teddy-img {
    width: 280px;
    /* Increased size for high-quality asset */
    height: auto;
    max-height: 320px;
    object-fit: contain;
    border-radius: 15px;
    border: none;
    background: transparent;
    filter: drop-shadow(0 15px 35px rgba(214, 51, 108, 0.4));
    animation: teddyBounce 2.5s ease-in-out infinite;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

img.teddy-img:hover {
    transform: scale(1.05) translateY(-10px);
}

img.teddy-img:active {
    transform: scale(0.95);
}

.teddy-img-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    perspective: 1000px;
}

@keyframes teddyBounce {

    0%,
    100% {
        transform: translateY(0) rotate(-2deg);
    }

    50% {
        transform: translateY(-12px) rotate(2deg);
    }
}

/* Premium Instruction Text */
.premium-text {
    font-family: 'Poppins', sans-serif;
    letter-spacing: 3px;
    text-transform: uppercase;
    font-size: 0.85rem;
    color: #d6336c;
    margin-top: 20px;
    animation: fadePulse 2s infinite;
}

@keyframes fadePulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

/* Glassmorphism Panel */
.glass-panel {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 24px;
    padding: 35px 25px;
    box-shadow:
        0 8px 32px rgba(214, 51, 108, 0.12),
        inset 0 0 0 1px rgba(255, 255, 255, 0.6);
    text-align: center;
    max-width: 95%;
    margin: 0 auto;
    transform: translateY(30px);
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    /* Anchor for the elusive button */
    z-index: 5;
}

.glass-panel.visible {
    transform: translateY(0);
    opacity: 1;
}

/* Premium Title Typography */
.premium-title {
    font-family: 'Great Vibes', cursive !important;
    font-size: 3rem !important;
    color: #c2185b !important;
    margin-bottom: 5px !important;
    line-height: 1.3;
    text-shadow: 2px 2px 4px rgba(255, 182, 193, 0.5);
    pointer-events: none;
    /* Don't block button movement */
}

.sub-question {
    font-family: 'Poppins', sans-serif;
    font-weight: 300;
    font-size: 1rem;
    color: #999;
    margin-bottom: 25px;
    margin-top: 0;
    pointer-events: none;
}

/* Premium Buttons Container */
.premium-btns {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 1.5rem;
    position: relative;
    min-height: 60px;
}

/* YES Button - Gorgeous gradient */
.premium-yes {
    background: linear-gradient(135deg, #ff6b6b, #ee5253, #d6336c) !important;
    border: none !important;
    padding: 14px 35px !important;
    font-family: 'Poppins', sans-serif !important;
    font-weight: 600 !important;
    font-size: 1.1rem !important;
    color: white !important;
    border-radius: 50px !important;
    box-shadow: 0 6px 20px rgba(238, 82, 83, 0.45) !important;
    transition: all 0.3s ease !important;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.premium-yes::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) rotate(45deg);
    }

    100% {
        transform: translateX(100%) rotate(45deg);
    }
}

.premium-yes:hover {
    transform: translateY(-3px) scale(1.08) !important;
    box-shadow: 0 10px 30px rgba(238, 82, 83, 0.6) !important;
}

/* NO Button - Small, muted */
.premium-no {
    background: #f1f2f6 !important;
    color: #a4b0be !important;
    border: 1px solid #dfe4ea !important;
    padding: 8px 18px !important;
    font-family: 'Poppins', sans-serif !important;
    font-size: 0.85rem !important;
    border-radius: 20px !important;
    transition: all 0.05s !important;
    cursor: pointer;
}

/* Acceptance Story Card */
.glass-panel.accepted-state {
    padding: 24px 18px;
}

.accept-story {
    width: 100%;
    text-align: center;
    animation: storyReveal 0.9s ease;
}

.accept-badge {
    display: inline-block;
    font-family: 'Poppins', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: #b03060;
    background: #ffe7ef;
    border: 1px solid #ffc7d6;
    border-radius: 999px;
    padding: 6px 12px;
    margin-bottom: 10px;
}

.story-runner-wrap {
    width: min(210px, 80%);
    margin: 0 auto 10px;
    border-radius: 18px;
    background:
        radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.95), rgba(255, 228, 240, 0.65)),
        linear-gradient(135deg, rgba(255, 160, 181, 0.22), rgba(214, 51, 108, 0.12));
    border: 1px solid rgba(214, 51, 108, 0.2);
    box-shadow: 0 12px 28px rgba(194, 24, 91, 0.18);
    padding: 10px;
}

.story-runner {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.18));
    animation: runnerFloat 2.2s ease-in-out infinite;
}

.story-runner-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 140px;
    height: 90px;
    border-radius: 12px;
    background: #fff6f9;
    border: 1px dashed #f1b6ca;
    color: #b54f77;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    letter-spacing: 2px;
}

.accept-title {
    font-family: 'Great Vibes', cursive !important;
    font-size: 2.35rem !important;
    color: #c2185b !important;
    margin-bottom: 6px !important;
}

.accept-line {
    font-family: 'Poppins', sans-serif;
    color: #7a445d;
    font-size: 0.95rem;
    line-height: 1.45;
    margin-bottom: 6px;
}

.accept-line.strong {
    color: #c2185b;
    font-weight: 600;
}

@keyframes storyReveal {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.98);
    }

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

@keyframes runnerFloat {

    0%,
    100% {
        transform: translateY(0) rotate(-1deg);
    }

    50% {
        transform: translateY(-7px) rotate(1deg);
    }
}


/* =============================================
   MOBILE RESPONSIVENESS
   ============================================= */

@media (max-width: 768px) {
    .book-container {
        height: auto;
        padding-top: 5vh;
        padding-bottom: 5vh;
        perspective: none;
        align-items: center;
        overflow: hidden;
    }

    .page-content {
        padding: 1.5rem 1rem;
        border: 3px double #f3d1d1;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.3rem;
        margin-top: 0.5rem;
    }

    p {
        font-size: 0.95rem;
        line-height: 1.4;
    }

    .floating-heart {
        display: none;
    }

    .flower-container {
        font-size: 3rem;
    }

    .photo-grid {
        gap: 5px;
    }

    .photo-frame {
        width: 100px;
        height: 100px;
    }

    .instruction {
        font-size: 0.7rem;
    }

    #book {
        max-width: 95vw;
        max-height: 80vh;
    }

    .overlay-content h1 {
        font-size: 3rem;
    }

    .overlay-content p {
        font-size: 1.2rem;
    }

    .music-control {
        bottom: 10px;
        right: 10px;
    }

    #music-btn {
        font-size: 0.8rem;
        padding: 6px 12px;
    }

    /* Mobile Premium Proposal */
    .premium-title {
        font-size: 2.2rem !important;
    }

    .teddy-icon {
        font-size: 5rem;
    }

    .glow-container {
        width: 150px;
        height: 150px;
    }

    .glass-panel {
        padding: 20px 15px;
    }

    .premium-yes {
        padding: 10px 25px !important;
        font-size: 1rem !important;
    }

    .sub-question {
        font-size: 0.9rem;
    }

    .accept-title {
        font-size: 1.9rem !important;
    }

    .accept-line {
        font-size: 0.88rem;
    }

    .story-runner-wrap {
        width: min(180px, 90%);
    }
}
