/* --- 1. GLOBAL & VARIABLES --- */
:root {
    --primary: #FFCB05;
    /* Vàng */
    --secondary: #00AEEF;
    /* Xanh */
    --accent: #F39C12;
    /* Cam */
    --danger: #FF5E5E;
    /* Đỏ */
    --success: #2ECC71;
    /* Xanh lá */
    --text: #333;
    --white: #fff;
    --bg: #f0f8ff;
    /* Light Blue BG */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Baloo 2', cursive;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* =========================
   2. PAGE LAYOUT + ADS
   ========================= */
.ek-layout {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 16px;
    padding: 18px;
    min-height: 100vh;
}

/* Main column contains quiz + scoreboard + bottom ad */
.ek-main {
    width: 100%;
    max-width: 900px;
}

/* Side ads (desktop) */
.ek-ad-side {
    flex: 0 0 160px;
    width: 160px;
    position: sticky;
    top: 18px;
}

.ek-ad-bottom {
    display: none;
    margin: 16px auto 0;
    max-width: 900px;
}

/* Tablet/Mobile: hide side ads, show bottom ad */
@media (max-width: 1024px) {
    .ek-ad-side {
        display: none;
    }

    .ek-ad-bottom {
        display: block;
    }

    .ek-layout {
        padding: 12px;
    }
}

/* --- 3. QUIZ GAME STYLES --- */
#quiz-container {
    width: 100%;
    max-width: 800px;
    margin: 24px auto 0;
    padding: 20px;
    background: var(--white);
    border-radius: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.quiz-header {
    text-align: center;
    margin-bottom: 20px;
}

.quiz-title {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--secondary);
    display: block;
    margin-bottom: 10px;
}

.question-counter {
    font-weight: bold;
    color: #666;
    margin-top: 5px;
    display: block;
}

/* --- Progress Bar --- */
.progress-bar-container {
    width: 100%;
    height: 15px;
    background-color: #eee;
    border-radius: 8px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: var(--primary);
    transition: width 0.5s ease;
    border-radius: 8px;
}

/* --- Question Card --- */
.question-card {
    background: #e1f5fe;
    padding: 30px 20px;
    border-radius: 20px;
    margin-bottom: 30px;
    text-align: center;
    min-height: 150px;
    border: 3px solid var(--secondary);
}

.question-text {
    font-size: 1.8rem;
    color: var(--text);
    margin-top: 15px;
}

/* --- Options Grid --- */
.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.option-btn {
    background: #f5f5f5;
    border: 3px solid #ccc;
    color: var(--text);
    padding: 15px 20px;
    border-radius: 15px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    text-align: left;
}

.option-btn:hover:not([disabled]) {
    transform: translateY(-2px);
    border-color: var(--accent);
    background: #fff8e1;
}

.option-btn.correct {
    background-color: var(--success);
    border-color: #27ae60;
    color: white;
}

.option-btn.wrong {
    background-color: var(--danger);
    border-color: #c0392b;
    color: white;
}

/* --- Feedback --- */
.feedback-area {
    margin-top: 20px;
    padding: 15px;
    text-align: center;
    border-radius: 15px;

    /* giữ feedback dính đáy cho mobile/tablet */
    position: sticky;
    bottom: 0;
    background: var(--white);
    box-shadow: 0 -5px 10px rgba(0, 0, 0, 0.05);
    z-index: 50;
}

.feedback-text {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 15px;
}

.btn-next {
    background: var(--secondary);
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
}

/* --- 4. SCOREBOARD STYLES --- */
#scoreboard-container {
    width: 100%;
    max-width: 600px;
    margin: 24px auto 0;
    padding: 30px;
    background: var(--white);
    border-radius: 25px;
    text-align: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    border: 5px solid var(--primary);
}

.scoreboard-box {
    padding: 20px;
}

.congratulations-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--danger);
    margin-bottom: 10px;
}

.congratulations-subtitle {
    font-size: 1.2rem;
    color: var(--text);
    margin-bottom: 30px;
}

.score-display {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e6ffe6;
    border-radius: 50px;
    padding: 15px 30px;
    margin-bottom: 20px;
    border: 2px dashed var(--success);
}

.score-icon {
    font-size: 3rem;
    margin-right: 15px;
    line-height: 1;
}

.score-text {
    font-size: 3rem;
    font-weight: 800;
    color: var(--success);
}

.rating-stars {
    font-size: 2.5rem;
    margin-bottom: 30px;
}

.score-details {
    margin-bottom: 30px;
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    border-top: 1px dashed #eee;
    border-bottom: 1px dashed #eee;
}

.detail-item {
    display: flex;
    flex-direction: column;
    font-size: 1rem;
    font-weight: bold;
}

.detail-item span:first-child {
    color: #999;
    font-weight: normal;
    font-size: 0.9rem;
}

.action-buttons button {
    padding: 12px 25px;
    border: none;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    margin: 0 10px;
    transition: background 0.2s;
}

.btn-primary {
    background: var(--secondary);
    color: var(--white);
    box-shadow: 0 4px 0 #0084b4;
}

.btn-secondary {
    background: #f0f0f0;
    color: var(--text);
    border: 2px solid #ccc;
}

.btn-primary:active {
    transform: translateY(4px);
    box-shadow: none;
}

/* --- 5. MODAL --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.open {
    display: flex;
}

.modal-box {
    background: #fff;
    border-radius: 16px;
    padding: 20px 22px 18px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    font-family: 'Baloo 2', cursive;
    position: relative;
    text-align: left;
}

.modal-title {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: #333;
}

.modal-text {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #555;
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
}

.btn-modal-ok {
    background: #00AEEF;
    color: #fff;
    border: none;
    padding: 8px 18px;
    border-radius: 999px;
    font-family: 'Baloo 2', cursive;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn-modal-ok:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.close-btn {
    position: absolute;
    right: 10px;
    top: 8px;
    border: none;
    background: transparent;
    font-size: 1.2rem;
    cursor: pointer;
    color: #999;
}

.close-btn:hover {
    color: #555;
}

/* --- 6. RESPONSIVE --- */
@media (max-width: 600px) {
    .ek-layout {
        padding: 10px;
    }

    #quiz-container,
    #scoreboard-container {
        margin: 18px auto 0;
        padding: 15px;
    }

    .quiz-title {
        font-size: 1.8rem;
    }

    .question-text {
        font-size: 1.5rem;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    .option-btn {
        padding: 18px 20px;
    }

    .congratulations-title {
        font-size: 2rem;
    }

    .score-text {
        font-size: 2.5rem;
    }

    .action-buttons {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .action-buttons button {
        margin: 0;
    }
}