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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.quiz-container {
    background: #ffffff;
    border-radius: 24px;
    padding: 40px;
    max-width: 700px;
    width: 100%;
    min-height: 450px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    transition: all 0.3s ease;
}

/* ===== BACK BUTTON ===== */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: #0f3b3e;
    color: #ffffff;
    padding: 0.5rem 1.2rem 0.5rem 1rem;
    border-radius: 50px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 16px rgba(15, 59, 62, 0.25);
    margin-bottom: 20px;
    display: inline-flex;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
}

.back-btn:hover {
    background: #1a5a5e;
    transform: translateX(-4px);
    box-shadow: 0 8px 30px rgba(15, 59, 62, 0.35);
    color: #ffffff;
}

.back-btn i {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

.back-btn:hover i {
    transform: translateX(-4px);
}

/* ===== SCREENS ===== */
.screen {
    display: none;
    animation: fadeIn 0.4s ease;
}

.screen.active {
    display: block;
}

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

/* ===== START SCREEN ===== */
#start-screen {
    text-align: center;
    padding: 20px 0;
}

#start-screen h1 {
    font-size: 2.4rem;
    color: #2d3748;
    margin-bottom: 12px;
}

#start-screen p {
    font-size: 1.1rem;
    color: #718096;
    margin-bottom: 8px;
}

#start-screen .timer-info {
    font-size: 1rem;
    color: #764ba2;
    margin-bottom: 30px;
    background: #f3edf7;
    padding: 8px 20px;
    border-radius: 50px;
    display: inline-block;
}

#start-screen .timer-info strong {
    color: #e53e3e;
}

/* ===== BUTTONS ===== */
.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border: none;
    padding: 14px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ===== QUESTION SCREEN ===== */
.progress-bar {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 16px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
    color: #718096;
    margin-bottom: 8px;
}

/* ===== TIMER ===== */
.timer-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    background: #f7fafc;
    padding: 6px 16px 6px 6px;
    border-radius: 50px;
    border: 1px solid #e2e8f0;
}

.timer-bar {
    flex: 1;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    transition: background 0.3s ease;
}

.timer-bar .timer-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #48bb78, #48bb78);
    border-radius: 4px;
    transition: width 0.3s linear, background 0.3s ease;
}

.timer-bar.warning .timer-fill {
    background: linear-gradient(90deg, #ed8936, #ed8936);
}

.timer-bar.danger .timer-fill {
    background: linear-gradient(90deg, #fc8181, #e53e3e);
    animation: pulse 0.5s ease-in-out infinite alternate;
}

@keyframes pulse {
    from { opacity: 1; }
    to { opacity: 0.5; }
}

#timer-text {
    font-size: 0.9rem;
    font-weight: 700;
    color: #2d3748;
    min-width: 50px;
    text-align: right;
}

#timer-text.warning {
    color: #ed8936;
}

#timer-text.danger {
    color: #e53e3e;
    animation: pulse 0.5s ease-in-out infinite alternate;
}

#question-text {
    font-size: 1.3rem;
    color: #2d3748;
    margin-bottom: 20px;
    line-height: 1.6;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.option-btn {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-weight: 500;
    color: #2d3748;
}

.option-btn:hover:not(.correct):not(.incorrect):not(:disabled) {
    border-color: #667eea;
    background: #edf2f7;
}

.option-btn.correct {
    border-color: #48bb78;
    background: #f0fff4;
    color: #22543d;
}

.option-btn.incorrect {
    border-color: #fc8181;
    background: #fff5f5;
    color: #9b2c2c;
}

.option-btn.timed-out {
    border-color: #a0aec0;
    background: #f7fafc;
    color: #a0aec0;
    opacity: 0.6;
}

.option-btn:disabled {
    cursor: not-allowed;
}

.option-btn .option-label {
    font-weight: 700;
    color: #a0aec0;
    margin-right: 8px;
}

#next-btn {
    display: block;
    margin-left: auto;
}

/* ===== RESULTS SCREEN ===== */
#results-screen {
    text-align: center;
    padding: 10px 0;
}

#results-screen h1 {
    font-size: 2rem;
    color: #2d3748;
    margin-bottom: 20px;
}

.results-card {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    margin-bottom: 20px;
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.4);
}

.score-circle span:first-child {
    font-size: 3.2rem;
    font-weight: 700;
    line-height: 1;
}

.score-circle .score-label {
    font-size: 1.1rem;
    font-weight: 400;
    opacity: 0.9;
}

.result-message {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 16px;
}

.results-details {
    display: flex;
    gap: 30px;
    font-size: 1rem;
    color: #4a5568;
    margin-bottom: 28px;
    flex-wrap: wrap;
    justify-content: center;
}

.results-details p {
    display: flex;
    align-items: center;
    gap: 4px;
}

.results-details span {
    font-weight: 700;
    font-size: 1.1rem;
}

#correct-count {
    color: #48bb78;
}

#incorrect-count {
    color: #fc8181;
}

#timed-out-count {
    color: #a0aec0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    .quiz-container {
        padding: 20px 14px;
        min-height: 350px;
    }

    #start-screen h1 {
        font-size: 1.8rem;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    #question-text {
        font-size: 1.1rem;
    }

    .score-circle {
        width: 110px;
        height: 110px;
    }

    .score-circle span:first-child {
        font-size: 2.4rem;
    }

    .results-details {
        gap: 14px;
        flex-direction: column;
        align-items: center;
    }

    .timer-container {
        padding: 4px 12px 4px 4px;
    }

    .back-btn {
        font-size: 0.75rem;
        padding: 0.4rem 1rem 0.4rem 0.8rem;
    }
}