/* ----- GLOBAL & BALLOON BACKGROUND (preserved, enhanced) ----- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Nunito', sans-serif;
}

body {
    min-height: 100vh;
    background: linear-gradient(145deg, #fbc2eb 0%, #a6c1ee 100%);
    position: relative;
    overflow-x: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
}

/* floating balloons background (kept) */
.balloon-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.balloon {
    position: absolute;
    bottom: -150px;
    width: 60px;
    height: 80px;
    background: rgba(255, 140, 140, 0.75);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    box-shadow: inset -10px -10px 0 rgba(0, 0, 0, 0.07);
    animation: floatUp 18s linear infinite;
    transform-origin: center;
    z-index: 0;
}

.balloon::before {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 25px;
    width: 2px;
    height: 45px;
    background: rgba(100, 70, 40, 0.6);
    transform: rotate(5deg);
}

.balloon::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 18px;
    width: 12px;
    height: 12px;
    background: #ffb347;
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

@keyframes floatUp {
    0% {
        transform: translateY(0) rotate(4deg);
        opacity: 0.8;
    }

    100% {
        transform: translateY(-120vh) rotate(-6deg);
        opacity: 0.2;
    }
}

/* balloon colors varied */
.balloon:nth-child(1) {
    left: 5%;
    background: #ff9ff3;
    width: 70px;
    height: 95px;
    animation-duration: 22s;
}

.balloon:nth-child(2) {
    left: 25%;
    background: #feca57;
    width: 55px;
    height: 75px;
    animation-duration: 17s;
}

.balloon:nth-child(3) {
    left: 45%;
    background: #ff6b6b;
    width: 80px;
    height: 100px;
    animation-duration: 24s;
}

.balloon:nth-child(4) {
    left: 70%;
    background: #48dbfb;
    width: 65px;
    height: 85px;
    animation-duration: 19s;
}

.balloon:nth-child(5) {
    left: 90%;
    background: #f368e0;
    width: 50px;
    height: 68px;
    animation-duration: 15s;
}

.balloon:nth-child(6) {
    left: 15%;
    background: #ff9f43;
    width: 60px;
    height: 80px;
    animation-duration: 28s;
}

.balloon:nth-child(7) {
    left: 60%;
    background: #10ac84;
    width: 73px;
    height: 95px;
    animation-duration: 21s;
}

.balloon:nth-child(8) {
    left: 80%;
    background: #ffcccc;
    width: 55px;
    height: 72px;
    animation-duration: 26s;
}

.game-container {
    background: #ffffffdd;
    backdrop-filter: blur(4px);
    width: 100%;
    max-width: 680px;
    padding: 25px 20px;
    border-radius: 60px 60px 40px 40px;
    text-align: center;
    box-shadow: 0 20px 0 rgba(120, 70, 150, 0.25), 0 30px 30px rgba(0, 0, 0, 0.2);
    border: 4px solid white;
    position: relative;
    z-index: 10;
    margin: 10px;
}

/* colorful buttons – no white backgrounds */
button {
    border: none;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.15);
    color: white;
    font-family: 'Fredoka One', cursive;
    letter-spacing: 0.5px;
}

button:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}

h1,
h2,
h3 {
    font-family: 'Fredoka One', cursive;
    color: #2d1b4e;
    text-shadow: 3px 3px 0 #ffb8b8;
}

.hidden {
    display: none !important;
}

/* start screen */
.start-mascot {
    font-size: 4rem;
    filter: drop-shadow(5px 8px 0 #e0b0ff);
}

.subject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin: 25px 0;
}

.sub-btn {
    background: #f97316;
    padding: 18px 5px;
    border-radius: 40px;
    font-size: 1.3rem;
    box-shadow: 0 8px 0 #b84a00;
}

.sub-btn:nth-child(1) {
    background: #d946ef;
    box-shadow: 0 8px 0 #962dbf;
}

.sub-btn:nth-child(2) {
    background: #0d9488;
    box-shadow: 0 8px 0 #0a5c54;
}

.sub-btn:nth-child(3) {
    background: #eab308;
    box-shadow: 0 8px 0 #a3860a;
    color: #2d1b4e;
}

.sub-btn:nth-child(4) {
    background: #ef4444;
    box-shadow: 0 8px 0 #b63232;
}

.sub-btn:nth-child(5) {
    background: #3b82f6;
    box-shadow: 0 8px 0 #1e4c9c;
}

/* profile */
.profile-input {
    width: 90%;
    padding: 15px;
    border-radius: 40px;
    border: 3px solid #ffa7a7;
    background: #fff5e6;
    font-size: 1.2rem;
    text-align: center;
    margin: 10px 0;
    color: #2c1810;
}

.avatar-circle {
    width: 110px;
    height: 110px;
    background: linear-gradient(145deg, #ff6f61, #d4a5ff);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    border: 6px solid #ffd966;
    margin: 5px auto;
}

.avatar-options {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin: 15px 0;
}

.avatar-option {
    font-size: 2.2rem;
    background: #c084fc;
    width: 65px;
    height: 65px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 0 #8850c7;
    cursor: pointer;
    color: white;
}

.avatar-option.selected {
    background: #f2c94c;
    box-shadow: 0 5px 0 #c29b2b;
    border: 3px solid white;
}

/* header */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.restart-small-btn {
    background: #ff9248;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 1.2rem;
    box-shadow: 0 5px 0 #c95f1a;
}

.profile-badge {
    background: #b980f0;
    padding: 8px 18px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 5px 0 #7945b3;
}

.profile-icon {
    font-size: 1.8rem;
}

.profile-name {
    font-weight: bold;
    color: #ffeaa5;
    font-size: 1.1rem;
}

.profile-age {
    background: #f8d35f;
    padding: 4px 12px;
    border-radius: 40px;
    color: #1e2b3a;
    font-weight: bold;
}

/* question */
.question-image-container {
    background: #ffdab9;
    padding: 15px;
    border-radius: 50px;
    margin: 15px 0;
    border: 4px solid #f79f9f;
}

.question-image {
    max-height: 150px;
    object-fit: contain;
    border-radius: 30px;
}

.btn-grid-2x2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 20px 0;
}

.answer-btn {
    background: #00b4d8;
    padding: 18px 5px;
    border-radius: 30px;
    font-size: 1.3rem;
    box-shadow: 0 6px 0 #007994;
    color: white;
    border: 2px solid #ffeeaa;
}

.answer-btn.selected {
    background: #f4d03f !important;
    box-shadow: 0 6px 0 #b48c1f !important;
    color: #281a2e !important;
}

/* Answer feedback colors - NEW */
.answer-btn.correct-answer {
    background: #2ecc71 !important;
    box-shadow: 0 6px 0 #27ae60 !important;
    color: white !important;
    border: 2px solid #fff !important;
    animation: pop 0.3s ease;
}

.answer-btn.wrong-answer {
    background: #e74c3c !important;
    box-shadow: 0 6px 0 #c0392b !important;
    color: white !important;
    border: 2px solid #fff !important;
    animation: pop 0.3s ease;
}

@keyframes pop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

/* nav buttons */
.nav-btn-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
}

.nav-btn {
    background: #ff70a6;
    padding: 15px 35px;
    border-radius: 40px;
    font-size: 1.4rem;
    box-shadow: 0 6px 0 #b53c6b;
    min-width: 140px;
}

.nav-btn.prev {
    background: #fb8b9f;
}

.nav-btn.next {
    background: #70d6ff;
    box-shadow: 0 6px 0 #3082a8;
}

/* RESULTS screen with answer review */
#score-summary {
    font-size: 2rem;
    margin: 10px;
    background: #ffeaa5;
    border-radius: 60px;
    padding: 20px;
    display: inline-block;
}

#answers-review {
    background: #fff2dd;
    border-radius: 40px;
    padding: 20px;
    max-height: 270px;
    overflow-y: auto;
    text-align: left;
    border: 4px solid #ffb55a;
    margin: 15px 0;
}

.review-item {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 30px;
    padding: 12px 15px;
    margin-bottom: 10px;
    border-left: 10px solid;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.1);
}

.review-item.correct {
    border-left-color: #2ecc71;
}

.review-item.wrong {
    border-left-color: #e74c3c;
}

.review-question {
    font-weight: bold;
    font-size: 1.1rem;
}

.review-answer {
    display: inline-block;
    padding: 5px 15px;
    border-radius: 30px;
    margin-top: 5px;
    font-weight: bold;
}

.review-answer.correct-answer {
    background: #2ecc71;
    color: white;
}

.review-answer.wrong-answer {
    background: #e74c3c;
    color: white;
}

.review-answer.user-answer {
    background: #f39c12;
    margin-right: 8px;
}

.action-btn {
    background: #b660f0;
    padding: 18px 15px;
    border-radius: 40px;
    font-size: 1.4rem;
    width: 90%;
    margin: 8px auto;
    box-shadow: 0 7px 0 #783fad;
}

/* CERTIFICATE */
.certificate {
    background: #fef9e6;
    border: 14px solid #fcd34d;
    border-radius: 50px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    text-align: center !important;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
}

.balloon-cert {
    position: absolute;
    font-size: 2.5rem;
    opacity: 0.6;
    pointer-events: none;
    z-index: 1;
}

.b1 {
    top: 5px;
    left: 5px;
    transform: rotate(-10deg);
}

.b2 {
    bottom: 5px;
    right: 5px;
}

.b3 {
    top: 30px;
    right: 30px;
}

.b4 {
    bottom: 20px;
    left: 20px;
}

.cert-border {
    border: 5px dashed #fbbf24;
    padding: 30px 20px;
    border-radius: 40px;
    background: #fffcf0;
    position: relative;
    z-index: 2;
    text-align: center;
}

.cert-border h1,
.cert-border h2,
.cert-border h3,
.cert-border p,
.cert-border div {
    text-align: center !important;
    margin-left: auto;
    margin-right: auto;
}

.score-badge {
    background: #fbbf24;
    padding: 15px 30px;
    border-radius: 60px;
    display: inline-block;
    font-size: 2.2rem;
    margin: 15px auto;
    color: #1e293b;
    font-weight: bold;
}

/* ---------- KIDS THEME POPUP (shared style) ---------- */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 215, 245, 0.4);
    /* light pink transparent overlay */
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: all 0.3s ease;
}

.popup-box {
    width: 90%;
    max-width: 400px;
    background: linear-gradient(145deg, #ffdde1, #ee9ca7);
    /* soft pink gradient */
    padding: 30px 20px 30px 20px;
    border-radius: 70px 70px 50px 50px;
    box-shadow: 0 20px 0 #b36b7a, 0 25px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
    border: 5px solid white;
    animation: popupScale 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: center;
}

@keyframes popupScale {
    0% {
        transform: scale(0.6);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* second gradient for validation popup (blue/purple) */
.popup-box.validation {
    background: linear-gradient(145deg, #a8ede0, #fed6e3);
    /* mint to pink */
}

.popup-box h3 {
    font-size: 2.8rem;
    margin-bottom: 5px;
    text-shadow: 3px 3px 0 #fced84;
}

.popup-box .popup-emoji {
    font-size: 5rem;
    display: block;
    line-height: 1.2;
    filter: drop-shadow(4px 6px 0 rgba(0, 0, 0, 0.1));
}

.popup-box p {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2d1b4e;
    background: rgba(255, 255, 240, 0.5);
    padding: 15px 10px;
    border-radius: 50px;
    margin: 15px 0;
    border: 3px dashed white;
}

.popup-box button {
    background: #ff9f4b;
    padding: 16px 30px;
    font-size: 1.8rem;
    border-radius: 60px;
    box-shadow: 0 8px 0 #b85e1e;
    border: 3px solid #ffe49e;
    margin-top: 10px;
    min-width: 220px;
    transition: 0.1s ease;
    color: white;
}

.popup-box button:active {
    transform: translateY(5px);
    box-shadow: 0 3px 0 #b85e1e;
}

/* extra balloon decoration inside popup */
.popup-balloon {
    font-size: 2.2rem;
    position: absolute;
    opacity: 0.4;
    pointer-events: none;
    z-index: 0;
}

.popup-balloon.left {
    top: 10px;
    left: 15px;
    transform: rotate(-15deg);
}

.popup-balloon.right {
    bottom: 10px;
    right: 15px;
    transform: rotate(20deg);
}

/* mobile adjustments */
@media (max-width: 480px) {
    .game-container {
        padding: 18px;
    }

    .btn-grid-2x2 {
        gap: 10px;
    }

    .answer-btn {
        font-size: 1rem;
        padding: 15px 0;
    }

    .nav-btn {
        padding: 12px 15px;
        min-width: 110px;
    }

    .certificate {
        border-width: 8px;
    }

    .popup-box p {
        font-size: 1.2rem;
    }

    .popup-box button {
        font-size: 1.5rem;
        padding: 12px 20px;
        min-width: 180px;
    }

    #answers-review {
        max-height: 200px;
    }
}

/* Certificate mobile improvements */
@media (max-width: 768px) {
    .certificate {
        border-width: 8px;
        padding: 10px;
        max-width: 100%;
    }

    .cert-border {
        padding: 15px 10px;
    }

    .cert-border h1 {
        font-size: 1.5rem;
    }

    .cert-border h2 {
        font-size: 1.3rem;
    }

    .cert-border h3 {
        font-size: 1.1rem;
    }

    .score-badge {
        font-size: 1.5rem;
        padding: 10px 20px;
    }

    .balloon-cert {
        font-size: 1.5rem;
    }
}

/* Ensure the download link is visible on mobile */
#certificate-screen .button-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

#certificate-screen .action-btn {
    width: 100%;
    max-width: 280px;
    font-size: 1.2rem;
    padding: 12px 15px;
}

/* Loading indicator for PDF generation */
.pdf-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    flex-direction: column;
}

.pdf-loading .spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #f97316;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Mobile PDF download popup improvements */
@media (max-width: 768px) {
    .popup-box.validation {
        max-width: 90%;
        padding: 20px 15px;
    }

    .popup-box.validation p {
        font-size: 1.1rem;
        line-height: 1.4;
    }

    .popup-box.validation div[style*="background: #f0f9ff"] {
        background: #f0f9ff !important;
        border-radius: 30px !important;
        padding: 12px !important;
    }

    .popup-box.validation div[style*="background: #f0f9ff"] p {
        font-size: 0.95rem !important;
        margin: 5px 0 !important;
    }
}

/* Alternative: Screenshot suggestion styling */
.screenshot-tip {
    background: #fef3c7;
    border-radius: 30px;
    padding: 15px;
    margin: 15px 0;
    border: 3px dashed #fbbf24;
}

.screenshot-tip p {
    font-size: 1rem !important;
    color: #92400e !important;
    margin: 5px 0 !important;
}
