/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Quicksand', sans-serif;
    background: linear-gradient(135deg, #fce4ec 0%, #f8bbd0 30%, #f48fb1 60%, #fce4ec 100%);
    background-attachment: fixed;
    min-height: 100vh;
    overflow-x: hidden;
    color: #5d2a42;
}

/* ===== Floating Hearts Background ===== */
.hearts-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.floating-heart {
    position: absolute;
    bottom: -50px;
    animation: floatUp linear forwards;
    pointer-events: none;
    user-select: none;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 0;
    }
    10% {
        opacity: 0.7;
    }
    90% {
        opacity: 0.4;
    }
    100% {
        transform: translateY(-110vh) rotate(360deg) scale(0.5);
        opacity: 0;
    }
}

/* ===== Container ===== */
.container {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 30px 20px 60px;
}

/* ===== Header ===== */
.header {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeInDown 0.8s ease-out;
}

.title {
    font-family: 'Pacifico', cursive;
    font-size: 2.8rem;
    color: #c2185b;
    text-shadow: 2px 2px 4px rgba(194, 24, 91, 0.15);
    margin-bottom: 10px;
    line-height: 1.3;
}

.subtitle {
    font-size: 1.15rem;
    color: #8e4466;
    font-weight: 500;
    margin-bottom: 25px;
}

/* ===== Progress Bar ===== */
.progress-bar-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    max-width: 450px;
    margin: 0 auto;
}

.progress-bar {
    flex: 1;
    height: 14px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #f06292, #ec407a, #e91e63);
    border-radius: 20px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.4), transparent);
    border-radius: 20px 20px 0 0;
}

.progress-text {
    font-weight: 700;
    font-size: 1rem;
    color: #c2185b;
    white-space: nowrap;
    min-width: 55px;
    text-align: center;
}

/* ===== Riddles Grid ===== */
.riddles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 18px;
    margin-bottom: 40px;
}

/* ===== Riddle Card ===== */
.riddle-card {
    aspect-ratio: 1;
    border-radius: 20px;
    cursor: pointer;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: fadeInUp 0.5s ease-out both;
}

.riddle-card:nth-child(1)  { animation-delay: 0.05s; }
.riddle-card:nth-child(2)  { animation-delay: 0.1s; }
.riddle-card:nth-child(3)  { animation-delay: 0.15s; }
.riddle-card:nth-child(4)  { animation-delay: 0.2s; }
.riddle-card:nth-child(5)  { animation-delay: 0.25s; }
.riddle-card:nth-child(6)  { animation-delay: 0.3s; }
.riddle-card:nth-child(7)  { animation-delay: 0.35s; }
.riddle-card:nth-child(8)  { animation-delay: 0.4s; }
.riddle-card:nth-child(9)  { animation-delay: 0.45s; }
.riddle-card:nth-child(10) { animation-delay: 0.5s; }

.riddle-card:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 12px 30px rgba(233, 30, 99, 0.25);
}

.riddle-card-inner {
    width: 100%;
    height: 100%;
    border-radius: 20px;
    background: linear-gradient(145deg, #fff 0%, #ffeef3 100%);
    border: 3px solid rgba(236, 64, 122, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(233, 30, 99, 0.1);
    transition: all 0.3s ease;
}

.riddle-card:hover .riddle-card-inner {
    border-color: rgba(236, 64, 122, 0.4);
}

.card-emoji {
    font-size: 2.5rem;
    line-height: 1;
}

.card-number {
    font-weight: 700;
    font-size: 1.1rem;
    color: #c2185b;
}

.card-status {
    font-size: 0.8rem;
    color: #e91e63;
    font-weight: 600;
    padding: 3px 12px;
    border-radius: 12px;
    background: rgba(233, 30, 99, 0.08);
}

/* Solved card state */
.riddle-card.solved .riddle-card-inner {
    background: linear-gradient(145deg, #e8f5e9 0%, #c8e6c9 100%);
    border-color: rgba(76, 175, 80, 0.3);
}

.riddle-card.solved .card-number {
    color: #2e7d32;
}

.riddle-card.solved .card-status {
    color: #2e7d32;
    background: rgba(76, 175, 80, 0.12);
}

/* ===== Surprise Section ===== */
.surprise-section {
    text-align: center;
    margin-top: 30px;
    position: relative;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.surprise-section .surprise-glow {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.surprise-section:has(.surprise-btn:not(.locked)) .surprise-glow {
    opacity: 1;
}

.surprise-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(233, 30, 99, 0.2) 0%, transparent 70%);
    border-radius: 50%;
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
    50% { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
}

.surprise-btn {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 18px 40px;
    font-family: 'Quicksand', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, #ec407a, #e91e63, #c2185b);
    border: none;
    border-radius: 60px;
    cursor: pointer;
    box-shadow: 0 6px 25px rgba(233, 30, 99, 0.4);
    transition: all 0.3s ease;
    animation: bounceBtn 1.5s ease-in-out infinite;
}

.surprise-btn:not(.locked):hover {
    transform: scale(1.05);
    box-shadow: 0 8px 35px rgba(233, 30, 99, 0.5);
}

@keyframes bounceBtn {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.surprise-btn:not(.locked):hover {
    animation: none;
    transform: scale(1.08);
}

.surprise-btn.locked {
    background: linear-gradient(135deg, #b0b0b0, #9e9e9e);
    color: rgba(255, 255, 255, 0.9);
    cursor: not-allowed;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    animation: none;
}

.surprise-btn.locked:hover {
    transform: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.btn-icon {
    font-size: 1.6rem;
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(93, 42, 66, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: white;
    border-radius: 24px;
    padding: 35px 30px;
    max-width: 480px;
    width: 100%;
    position: relative;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 25px 60px rgba(93, 42, 66, 0.3);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 18px;
    background: none;
    border: none;
    font-size: 1.8rem;
    color: #bf6080;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #fce4ec;
    color: #c2185b;
}

.modal-number {
    font-family: 'Pacifico', cursive;
    font-size: 1.3rem;
    color: #f06292;
    margin-bottom: 12px;
    text-align: center;
}

.modal-riddle {
    font-size: 1.15rem;
    line-height: 1.7;
    color: #5d2a42;
    text-align: center;
    font-weight: 500;
    margin-bottom: 6px;
    min-height: 60px;
}

.modal-hint-wrap {
    margin-bottom: 14px;
    min-height: 0;
}

.modal-hint-wrap:empty {
    display: none;
}

.modal-hint {
    font-size: 0.85rem;
    color: #b06080;
    text-align: center;
    font-style: italic;
}

.show-hint-btn {
    background: none;
    border: none;
    font-family: 'Quicksand', sans-serif;
    font-size: 0.9rem;
    color: #ec407a;
    cursor: pointer;
    text-decoration: underline;
    padding: 2px 0;
    font-weight: 600;
}

.show-hint-btn:hover {
    color: #c2185b;
}

.modal-answer {
    color: #2e7d32;
    font-weight: 600;
    margin-top: 8px;
}

.modal-input-section {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.modal-input {
    flex: 1;
    padding: 14px 18px;
    font-family: 'Quicksand', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    border: 2.5px solid #f8bbd0;
    border-radius: 16px;
    outline: none;
    color: #5d2a42;
    background: #fef7f9;
    transition: border-color 0.3s;
}

.modal-input:focus {
    border-color: #ec407a;
}

.modal-input::placeholder {
    color: #d4a0b3;
    font-weight: 500;
}

.modal-submit {
    padding: 14px 22px;
    font-family: 'Quicksand', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, #f06292, #e91e63);
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.modal-submit:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(233, 30, 99, 0.3);
}

.modal-result {
    text-align: center;
    font-weight: 600;
    font-size: 1rem;
    min-height: 28px;
    transition: all 0.3s;
}

.modal-result.correct {
    color: #2e7d32;
}

.modal-result.wrong {
    color: #e53935;
    animation: shake 0.4s ease-in-out;
}

.modal-result.already-solved {
    color: #2e7d32;
    font-size: 1.1rem;
    padding: 10px 0;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}

/* ===== Special: Calendar Grid (Riddle #6) ===== */
.special-calendar {
    margin-bottom: 18px;
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 6px;
}

.calendar-day-name {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: #c2185b;
    padding: 4px 0;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #ffeef3, #fce4ec);
    border: 2px solid rgba(236, 64, 122, 0.15);
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #c2185b;
    cursor: pointer;
    transition: all 0.2s ease;
}

.calendar-cell:hover {
    background: linear-gradient(145deg, #f8bbd0, #f48fb1);
    color: white;
    transform: scale(1.1);
    border-color: #ec407a;
}

.calendar-note {
    text-align: center;
    font-size: 0.85rem;
    color: #b06080;
    font-style: italic;
    margin-top: 10px;
}

/* ===== Special: Two Yes Buttons (Riddle #8) ===== */
.special-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 20px 0;
}

.special-yes-btn {
    padding: 16px 40px;
    font-family: 'Quicksand', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, #f06292, #e91e63);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(233, 30, 99, 0.3);
    transition: all 0.3s ease;
}

.special-yes-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 25px rgba(233, 30, 99, 0.4);
}

/* ===== Animations ===== */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-25px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(25px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Valentine Page ===== */
.valentine-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #fce4ec 0%, #f8bbd0 25%, #f48fb1 50%, #f8bbd0 75%, #fce4ec 100%);
    background-size: 400% 400%;
    animation: gradientShift 8s ease-in-out infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

#confettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    display: none;
}

.valentine-container {
    position: relative;
    z-index: 5;
    text-align: center;
    padding: 20px;
}

.valentine-card {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 30px;
    padding: 50px 40px;
    max-width: 520px;
    margin: 0 auto;
    box-shadow: 0 20px 60px rgba(194, 24, 91, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.8);
    opacity: 0;
    transform: scale(0.9) translateY(30px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.valentine-card.visible {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.valentine-emoji {
    font-size: 3.5rem;
    margin-bottom: 20px;
    animation: heartBeat 1.2s ease-in-out infinite;
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    15% { transform: scale(1.15); }
    30% { transform: scale(1); }
    45% { transform: scale(1.1); }
    60% { transform: scale(1); }
}

.valentine-title {
    font-family: 'Pacifico', cursive;
    font-size: 2.5rem;
    color: #c2185b;
    margin-bottom: 15px;
    line-height: 1.3;
}

.valentine-subtitle {
    font-size: 1.1rem;
    color: #8e4466;
    line-height: 1.6;
    margin-bottom: 35px;
    font-weight: 500;
}

.valentine-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.btn-yes {
    padding: 16px 45px;
    font-family: 'Quicksand', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, #ec407a, #e91e63, #c2185b);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 6px 25px rgba(233, 30, 99, 0.35);
    transition: all 0.3s ease;
}

.btn-yes:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 35px rgba(233, 30, 99, 0.5);
}

.btn-no {
    padding: 14px 35px;
    font-family: 'Quicksand', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: #8e4466;
    background: rgba(255, 255, 255, 0.7);
    border: 2px solid #f8bbd0;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-no:hover {
    background: rgba(255, 255, 255, 0.9);
}

/* Yes screen */
.yes-screen {
    display: none;
    animation: fadeInUp 0.8s ease-out;
}

.yes-gif {
    display: block;
    max-width: 200px;
    width: 100%;
    height: auto;
    margin: -10px auto 16px;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.yes-emoji {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: heartBeat 1s ease-in-out infinite;
}

.yes-title {
    font-family: 'Pacifico', cursive;
    font-size: 4rem;
    color: #c2185b;
    margin-bottom: 15px;
    animation: bounceIn 0.6s ease-out;
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.1); }
    70% { transform: scale(0.95); }
    100% { transform: scale(1); opacity: 1; }
}

.yes-subtitle {
    font-size: 1.3rem;
    color: #8e4466;
    line-height: 1.6;
    margin-bottom: 25px;
    font-weight: 500;
    max-width: 450px;
    margin-left: auto;
    margin-right: auto;
}

.yes-hearts {
    font-size: 2.5rem;
    display: flex;
    gap: 15px;
    justify-content: center;
    animation: fadeInUp 1s ease-out 0.3s both;
}

.yes-hearts span {
    animation: floatHeart 2s ease-in-out infinite;
}

.yes-hearts span:nth-child(2) { animation-delay: 0.2s; }
.yes-hearts span:nth-child(3) { animation-delay: 0.4s; }
.yes-hearts span:nth-child(4) { animation-delay: 0.6s; }
.yes-hearts span:nth-child(5) { animation-delay: 0.8s; }

@keyframes floatHeart {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .title {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .riddles-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .modal {
        padding: 28px 22px;
        margin: 15px;
    }

    .modal-riddle {
        font-size: 1.05rem;
    }

    .modal-input-section {
        flex-direction: column;
    }

    .valentine-title {
        font-size: 1.8rem;
    }

    .valentine-card {
        padding: 35px 25px;
    }

    .yes-title {
        font-size: 3rem;
    }

    .surprise-btn {
        padding: 15px 30px;
        font-size: 1.1rem;
    }
}

@media (max-width: 380px) {
    .riddles-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .card-emoji {
        font-size: 2rem;
    }

    .title {
        font-size: 1.7rem;
    }
}
