:root {
    --primary: #ff4d6d;
    --primary-dark: #c9184a;
    --secondary: #ff8fa3;
    --bg-gradient-1: linear-gradient(135deg, #ff9a9e 0%, #fecfef 99%, #fecfef 100%);
    --bg-gradient-2: linear-gradient(120deg, #e0c3fc 0%, #8ec5fc 100%);
    --bg-gradient-3: linear-gradient(to top, #a18cd1 0%, #fbc2eb 100%);
    --bg-gradient-4: linear-gradient(to right, #ff8177 0%, #ff867a 0%, #ff8c7f 21%, #f99185 52%, #cf556c 78%, #b12a5b 100%);
    --glass-bg: rgba(255, 255, 255, 0.25);
    --glass-border: rgba(255, 255, 255, 0.5);
    --text-main: #4a4a4a;
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    --font-head: 'Dancing Script', cursive;
    --font-body: 'Poppins', sans-serif;

    /* Night Mode Variables */
    --night-bg-1: linear-gradient(to bottom, #2b1055, #7597de);
    --night-bg-2: linear-gradient(to top, #0f2027, #203a43, #2c5364);
    --night-text: #f0f0f0;
    --night-glass: rgba(0, 0, 0, 0.4);
}

body.night-mode {
    background: var(--night-bg-1) !important;
    color: var(--night-text);
}

body.night-mode .glass-card {
    background: var(--night-glass);
    border-color: rgba(255, 255, 255, 0.1);
}

body.night-mode .title {
    color: #ff8fa3;
    text-shadow: 0 0 10px rgba(255, 143, 163, 0.8);
}

body.night-mode label {
    color: #ffc2d1;
}

body.night-mode input,
body.night-mode select,
body.night-mode textarea {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
}

/* Theme Toggle Button */
.theme-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 100;
    backdrop-filter: blur(5px);
    transition: all 0.3s;
}

.theme-btn:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.5);
}

/* Cursor Hearts */
.cursor-heart {
    position: fixed;
    top: 0;
    left: 0;
    font-size: 20px;
    pointer-events: none;
    animation: fadeUpHeart 1s forwards;
    z-index: 9999;
}

@keyframes fadeUpHeart {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translateY(-40px) scale(0.5);
        opacity: 0;
    }
}

/* Floating Photo Frame */
@keyframes floatFrame {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    }

    50% {
        transform: translateY(-15px) rotate(2deg);
        box-shadow: 0 25px 40px rgba(0, 0, 0, 0.4);
    }
}

.floating-frame {
    animation: floatFrame 4s ease-in-out infinite;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-body);
    background: var(--bg-gradient-1);
    /* Default start */
    background-size: 200% 200%;
    animation: gradientMove 15s ease infinite;
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-image 1s ease;
}

/* Animations */
@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

@keyframes floatUp {
    0% {
        transform: translateY(100vh) scale(0.5);
        opacity: 0;
    }

    20% {
        opacity: 0.8;
    }

    80% {
        opacity: 0.8;
    }

    100% {
        transform: translateY(-10vh) scale(1.2);
        opacity: 0;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Floating Elements Container */
#floating-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.floating-item {
    position: absolute;
    bottom: -50px;
    font-size: 2rem;
    animation: floatUp linear infinite;
}

/* App Structure */
#app {
    width: 100%;
    max-width: 500px;
    /* Mobile focused max-width */
    z-index: 10;
    padding: 20px;
}

section {
    width: 100%;
    display: none;
    /* Hidden by default */
}

section.active-section {
    display: block;
}

/* Glassmorphism Cards */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
    padding: 30px;
    text-align: center;
    width: 100%;
}

.fade-in-up {
    animation: fadeInUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* Typography */
.font-dancing {
    font-family: var(--font-head);
}

.title {
    font-size: 2.5rem;
    color: var(--primary-dark);
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.5);
}

.subtitle {
    font-size: 1rem;
    margin-bottom: 25px;
    color: #666;
}

/* Inputs & Forms */
.input-group {
    margin-bottom: 20px;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--primary-dark);
    font-size: 0.9rem;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.6);
    font-family: var(--font-body);
    font-size: 1rem;
    color: #333;
    outline: none;
    transition: all 0.3s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 10px rgba(255, 77, 109, 0.2);
}

/* Photo Upload */
.upload-area {
    width: 100%;
    height: 200px;
    border: 2px dashed var(--primary);
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    overflow: hidden;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.3);
    transition: all 0.3s;
}

.upload-area:hover {
    background: rgba(255, 255, 255, 0.5);
}

.photo-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 14px 30px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 77, 109, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
    margin-top: 10px;
}

.btn-primary:active {
    transform: scale(0.96);
}

.btn-primary.disabled {
    background: #ccc;
    pointer-events: none;
    box-shadow: none;
}

.btn-whatsapp {
    background: #25D366;
    color: white;
    border: none;
    padding: 14px 30px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-top: 15px;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
}

/* Quiz Styling */
.quiz-option {
    background: rgba(255, 255, 255, 0.6);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s;
    font-weight: 500;
}

.quiz-option:hover {
    background: rgba(255, 255, 255, 0.9);
}

.quiz-option.selected {
    border-color: var(--primary);
    background: rgba(255, 77, 109, 0.1);
}

.badge {
    background: var(--primary);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    margin-bottom: 10px;
    display: inline-block;
}

.feedback-text {
    margin-top: 15px;
    font-weight: 600;
}

.feedback-success {
    color: #2ecc71;
}

.feedback-error {
    color: #e74c3c;
}

/* Keys */
.keys-container {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    margin: 30px 0;
}

.key-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.4);
    padding: 10px;
    border-radius: 12px;
    width: 45%;
    margin-bottom: 10px;
    opacity: 0.6;
    transition: all 0.5s;
}

.key-item.unlocked {
    opacity: 1;
    background: rgba(255, 255, 255, 0.9);
    transform: scale(1.05);
    border: 2px solid #FFD700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.key-icon {
    font-size: 2rem;
    margin-bottom: 5px;
}

/* Summary Page */
.summary-details {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.summary-img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    margin-bottom: 15px;
    border: 4px solid white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    background-size: cover;
    background-position: center;
    background-color: #eee;
}

.progress-bar-container {
    background: rgba(255, 255, 255, 0.5);
    height: 20px;
    border-radius: 10px;
    overflow: hidden;
    margin: 20px 0;
}

.progress-fill {
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    height: 100%;
    text-align: center;
    line-height: 20px;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    transition: width 1s ease;
}

/* Flying Key Animation */
#flying-key-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2000;
}

.flying-key {
    position: absolute;
    font-size: 5rem;
    z-index: 2000;
    filter: drop-shadow(0 0 10px gold);
    animation: keyPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transition: all 1s ease-in-out;
}

@keyframes keyPop {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }

    60% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Emotional Feedback */
.emotional-popup {
    position: absolute;
    color: #ff4d6d;
    font-family: var(--font-head);
    font-size: 1.5rem;
    font-weight: bold;
    pointer-events: none;
    animation: popupFade 1s forwards;
    z-index: 100;
}

@keyframes popupFade {
    0% {
        transform: translateY(0) scale(0.8);
        opacity: 0;
    }

    20% {
        opacity: 1;
        transform: translateY(-20px) scale(1.1);
    }

    100% {
        transform: translateY(-50px) scale(1);
        opacity: 0;
    }
}

/* Quiz Progress Bar */
.quiz-progress-track {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    margin: 10px 0;
    overflow: hidden;
}

.quiz-progress-fill {
    height: 100%;
    background: #ff4d6d;
    width: 0%;
    transition: width 0.3s ease;
}

/* Bonus Question Modal */
.bonus-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 3000;
    text-align: center;
    border: 3px solid #ff4d6d;
    animation: zoomIn 0.5s;
}

@keyframes zoomIn {
    from {
        transform: translate(-50%, -50%) scale(0);
    }

    to {
        transform: translate(-50%, -50%) scale(1);
    }
}


/* --- Catch the Hearts Game --- */
.game-card {
    max-width: 600px;
    /* Wider for game */
}

.game-hud {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--primary-dark);
}

.game-area {
    width: 100%;
    height: 400px;
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid white;
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    cursor: crosshair;
}

.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    padding: 20px;
}

.hidden-overlay {
    display: none !important;
}

.falling-heart {
    position: absolute;
    font-size: 2rem;
    /* Fallback for emojis */
    cursor: pointer;
    user-select: none;
    top: -70px;
    /* Start slightly higher for bigger images */
    animation-name: fallDown;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
    background-repeat: no-repeat;
}

.falling-heart:active {
    transform: scale(1.5);
    transition: transform 0.1s;
}

@keyframes fallDown {
    to {
        transform: translateY(450px);
    }
}

/* --- Love Puzzle Game --- */
.puzzle-board {
    width: 300px;
    /* 4 columns * 75px */
    height: 375px;
    /* 5 rows * 75px */
    margin: 20px auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 2px;
    background: rgba(255, 255, 255, 0.2);
    border: 4px solid white;
    box-shadow: 0 0 20px rgba(255, 77, 109, 0.4);
    border-radius: 8px;
}

.puzzle-piece {
    width: 100%;
    height: 100%;
    background-size: 300px 375px;
    /* Matches board size */
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border-radius: 2px;
}

.puzzle-piece.selected {
    transform: scale(0.9);
    box-shadow: 0 0 10px 2px #FFD700;
    /* Gold highlight */
    z-index: 10;
    border: 2px solid #FFD700;
}

.puzzle-piece.correct {
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.heart-burst {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10rem;
    color: #ff4d6d;
    animation: burstAnim 1s ease-out forwards;
    pointer-events: none;
    z-index: 5000;
}

@keyframes burstAnim {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) scale(3);
        opacity: 0;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 2rem;
    }

    .glass-card {
        padding: 20px;
    }
}