/* ===== RESET & BASE ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Quicksand', sans-serif;
    background: #1a0a2e;
    color: #fff;
}

/* ===== PAGES ===== */
.page {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease, visibility 0.8s ease;
    z-index: 1;
    overflow-y: auto;
}

.page.active {
    opacity: 1;
    visibility: visible;
    z-index: 10;
}

.page-inner {
    text-align: center;
    padding: 2rem;
    max-width: 700px;
    width: 100%;
    position: relative;
    z-index: 2;
}

/* ===== TYPOGRAPHY ===== */
.page-title {
    font-family: 'Dancing Script', cursive;
    font-size: clamp(1.8rem, 5vw, 3rem);
    margin-bottom: 0.5rem;
    text-shadow: 0 0 30px rgba(255, 105, 180, 0.6);
}

.page-subtitle {
    font-size: 1rem;
    opacity: 0.7;
    margin-bottom: 1.5rem;
}

.hint-text {
    margin-top: 1rem;
    font-size: 0.9rem;
    opacity: 0.6;
    animation: pulse 2s infinite;
}

/* ===== BUTTONS ===== */
.btn {
    border: none;
    border-radius: 50px;
    padding: 14px 36px;
    font-family: 'Quicksand', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    display: inline-block;
}

.btn:hover {
    transform: scale(1.05);
}

.btn:active {
    transform: scale(0.97);
}

.btn-continue {
    background: linear-gradient(135deg, #ff6b9d, #c44dff);
    color: #fff;
    margin-top: 2rem;
    box-shadow: 0 4px 25px rgba(255, 107, 157, 0.4);
}

.btn-small {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    padding: 10px 24px;
    font-size: 0.9rem;
    margin-top: 1rem;
}

/* ===== PAGE INTRO ===== */
#page-intro {
    background: linear-gradient(135deg, #0f0c29, #1a0a2e, #302b63);
}

.intro-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.intro-title {
    font-family: 'Dancing Script', cursive;
    font-size: clamp(2.2rem, 7vw, 4rem);
    background: linear-gradient(90deg, #ff6b9d, #ffd700, #c44dff, #00e5ff, #ff6b9d);
    background-size: 300% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: rainbowShimmer 4s linear infinite;
    margin-bottom: 1.5rem;
    line-height: 1.3;
}

.intro-subtitle {
    font-family: 'Quicksand', sans-serif;
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 2.5rem;
    animation: pulse 2s infinite;
}

.btn-ready {
    background: linear-gradient(135deg, #ff6b9d, #c44dff);
    color: #fff;
    padding: 16px 48px;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 50px;
    box-shadow: 0 4px 30px rgba(255, 107, 157, 0.4), 0 0 60px rgba(196, 77, 255, 0.2);
    animation: readyPulse 2s ease-in-out infinite;
    transition: transform 0.3s, box-shadow 0.3s;
}

.btn-ready:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 40px rgba(255, 107, 157, 0.6), 0 0 80px rgba(196, 77, 255, 0.3);
}

@keyframes readyPulse {
    0%, 100% { box-shadow: 0 4px 30px rgba(255, 107, 157, 0.4), 0 0 60px rgba(196, 77, 255, 0.2); }
    50% { box-shadow: 0 4px 40px rgba(255, 107, 157, 0.6), 0 0 80px rgba(196, 77, 255, 0.4); }
}

/* ===== PAGE 0: CAPTCHA ===== */
#page-captcha {
    background: linear-gradient(135deg, #1a0a2e, #2d1050, #0f0c29);
}

.captcha-title {
    font-size: clamp(2rem, 6vw, 3.2rem);
    animation: float 3s ease-in-out infinite;
}

#captcha-area {
    position: relative;
    display: inline-block;
    margin: 1rem auto;
}

#captcha-canvas {
    border-radius: 12px;
    box-shadow: 0 0 40px rgba(200, 100, 255, 0.25);
    display: block;
}

#captcha-piece-wrap {
    position: absolute;
    cursor: grab;
    z-index: 15;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
    transition: transform 0.15s;
}

#captcha-piece-wrap:active {
    cursor: grabbing;
}

#captcha-piece {
    display: block;
}

/* ===== PAGE 0.5: MAZE ===== */
#page-maze {
    background: linear-gradient(135deg, #0f0c29, #1a1040, #1e0a3a);
}

.maze-title {
    font-size: clamp(1.6rem, 5vw, 2.8rem);
    animation: float 3s ease-in-out infinite;
}

#maze-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 1rem auto;
}

#maze-canvas {
    border-radius: 10px;
    box-shadow: 0 0 40px rgba(140, 80, 255, 0.25);
    cursor: pointer;
    touch-action: none;
}

/* ===== PAGE 0.75: MEMORY ===== */
#page-memory {
    background: linear-gradient(135deg, #1a0a2e, #2d1050, #0f0c29);
}

.memory-title {
    font-size: clamp(1.6rem, 5vw, 2.8rem);
    animation: float 3s ease-in-out infinite;
}

#memory-grid {
    display: grid;
    gap: 12px;
    max-width: 520px;
    margin: 1rem auto;
    padding: 0 0.5rem;
}

.memory-card {
    aspect-ratio: 3 / 4;
    perspective: 600px;
    cursor: pointer;
}

.memory-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.5s ease;
    transform-style: preserve-3d;
}

.memory-card.flipped .memory-card-inner,
.memory-card.matched .memory-card-inner {
    transform: rotateY(180deg);
}

.memory-card-front,
.memory-card-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: 10px;
    overflow: hidden;
}

.memory-card-back {
    background: linear-gradient(135deg, #c44dff, #ff6b9d, #ffd700);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 15px rgba(196, 77, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.15);
}

.card-pattern {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 25% 25%, rgba(255,255,255,0.12) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(255,255,255,0.08) 0%, transparent 50%),
        repeating-linear-gradient(45deg, transparent, transparent 8px, rgba(255,255,255,0.04) 8px, rgba(255,255,255,0.04) 16px);
}

.card-heart {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));
    animation: pulse 2s infinite;
}

.memory-card-front {
    transform: rotateY(180deg);
    background: #1a1040;
}

.memory-card-front img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.memory-card.matched .memory-card-inner {
    animation: matchPop 0.4s ease;
}

@keyframes matchPop {
    0% { transform: rotateY(180deg) scale(1); }
    50% { transform: rotateY(180deg) scale(1.1); }
    100% { transform: rotateY(180deg) scale(1); }
}

/* ===== PAGE 1: PUZZLE ===== */
#page-puzzle {
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
}

#puzzle-container {
    display: flex;
    justify-content: center;
    margin: 1rem auto;
}

#puzzle-canvas {
    border-radius: 12px;
    box-shadow: 0 0 40px rgba(138, 43, 226, 0.3);
    max-width: 100%;
    touch-action: none;
}

/* ===== PAGE 2: LOVE QUESTION ===== */
#page-love-question {
    background: linear-gradient(135deg, #1a0a2e, #2d1b4e, #1a0a2e);
}

.love-title {
    font-size: clamp(2rem, 6vw, 3.5rem);
    margin-bottom: 2.5rem;
    animation: float 3s ease-in-out infinite;
}

.buttons-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    position: relative;
    min-height: 200px;
}

.btn-yes {
    background: linear-gradient(135deg, #00b09b, #96c93d);
    color: #fff;
    padding: 12px 28px;
    font-size: 0.95rem;
    box-shadow: 0 4px 20px rgba(0, 176, 155, 0.3);
    order: 1;
}

.btn-no {
    background: linear-gradient(135deg, #eb3349, #f45c43);
    color: #fff;
    padding: 18px 42px;
    font-size: 1.2rem;
    font-weight: 700;
    box-shadow: 0 6px 30px rgba(235, 51, 73, 0.4);
    order: 2;
    user-select: none;
    -webkit-user-select: none;
}

/* ===== PAGE 3: LOVE MESSAGE ===== */
#page-love-message {
    background: #050a12;
}

#flower-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.love-message-layout {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 2rem;
    pointer-events: none;
}

.love-message-text {
    font-family: 'Dancing Script', cursive;
    font-size: clamp(2rem, 7vw, 4rem);
    text-shadow: 0 0 40px rgba(150, 255, 220, 0.5), 0 0 80px rgba(100, 200, 180, 0.3);
    animation: fadeInUp 1.5s ease-out;
    line-height: 1.4;
    margin-top: 5vh;
}

.love-message-spacer {
    flex: 1;
    min-height: 0;
}

.btn-next {
    pointer-events: auto;
    margin-bottom: 1.5vh;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    font-size: 2.2rem;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.3s, color 0.3s, text-shadow 0.3s;
    animation: nextPulse 2.5s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.btn-next:hover {
    transform: scale(1.3);
    color: #fff;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.6), 0 0 40px rgba(255, 255, 255, 0.3);
}

.btn-next:active {
    transform: scale(0.9);
}

@keyframes nextPulse {
    0%, 100% { text-shadow: 0 0 8px rgba(255,255,255,0.2); }
    50% { text-shadow: 0 0 18px rgba(255,255,255,0.5), 0 0 35px rgba(255,255,255,0.15); }
}

/* ===== PAGE 4: BIRTHDAY ===== */
#page-birthday {
    background: linear-gradient(135deg, #1a0a2e, #2d1b4e);
}

.birthday-title {
    font-family: 'Dancing Script', cursive;
    font-size: clamp(2rem, 6vw, 3.5rem);
    background: linear-gradient(90deg, #ff6b9d, #ffd700, #c44dff, #00e5ff, #ff6b9d, #ffd700);
    background-size: 300% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: rainbowShimmer 4s linear infinite;
    margin-bottom: 0.5rem;
}

.birthday-message {
    font-size: clamp(1rem, 3vw, 1.4rem);
    margin-bottom: 1.5rem;
    background: linear-gradient(90deg, #ffab40, #ff4081, #7c4dff, #00e5ff, #76ff03, #ffab40);
    background-size: 300% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: rainbowShimmer 5s linear infinite;
}

#cake-container {
    display: flex;
    justify-content: center;
    margin: 1rem auto;
}

#cake-canvas {
    max-width: 100%;
}

/* ===== PAGE 5: SLIDESHOW ===== */
#page-slideshow {
    background: #000;
}

.slideshow-inner {
    max-width: 100%;
    padding: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#slideshow-container {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.slide {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 1.5s ease;
}

.slide.active {
    opacity: 1;
}

.slide img {
    max-width: 90%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 0 60px rgba(255, 105, 180, 0.2);
}

.slide-caption {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Dancing Script', cursive;
    font-size: 1.4rem;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0,0,0,0.8);
    z-index: 20;
    opacity: 0;
    transition: opacity 0.8s;
}

.slide-caption.visible {
    opacity: 1;
}

#slide-progress {
    position: fixed;
    bottom: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, #ff6b9d, #c44dff);
    transition: width linear;
    z-index: 20;
}

.no-slides {
    font-size: 1.2rem;
    opacity: 0.5;
}

/* ===== PAGE 6: FINAL VIDEO ===== */
#page-video {
    background: #000;
}

.video-inner {
    max-width: 100%;
    padding: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#final-video {
    max-width: 90%;
    max-height: 85vh;
    border-radius: 12px;
    box-shadow: 0 0 60px rgba(255, 105, 180, 0.2);
}

/* ===== CONFETTI ===== */
#confetti-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

/* ===== HEARTS BACKGROUND ===== */
.hearts-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

/* ===== ANIMATIONS ===== */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shimmer {
    to { background-position: 200% center; }
}

@keyframes rainbowShimmer {
    0% { background-position: 0% center; }
    100% { background-position: 300% center; }
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

@keyframes squirrelFall {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 1;
    }
    70% {
        opacity: 1;
    }
    100% {
        transform: translateY(calc(100vh + 60px)) translateX(var(--swing, 0px)) rotate(360deg);
        opacity: 0;
    }
}

@keyframes puzzleHeartRise {
    0% {
        transform: translateY(0) scale(0);
        opacity: 0;
    }
    15% {
        opacity: 1;
        transform: translateY(-10vh) scale(1);
    }
    85% {
        opacity: 1;
    }
    100% {
        transform: translateY(-110vh) scale(0.8) rotate(20deg);
        opacity: 0;
    }
}

@keyframes heartFloat {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-10vh) scale(1);
        opacity: 0;
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    .page-inner {
        padding: 1rem;
    }

    .btn {
        padding: 12px 24px;
        font-size: 0.9rem;
    }

    .btn-no {
        padding: 14px 32px;
        font-size: 1.05rem;
    }
}
