:root {
    --primary: #0F172A;
    --primary-light: #1E293B;
    --accent: #2563EB;
    --accent-hover: #1D4ED8;
    --accent-soft: #EFF6FF;
    --correct: #059669;
    --correct-bg: #ECFDF5;
    --correct-border: #A7F3D0;
    --incorrect: #DC2626;
    --incorrect-bg: #FEF2F2;
    --incorrect-border: #FECACA;
    --bg-page: #F8FAFC;
    --card-bg: #FFFFFF;
    --text-main: #1E293B;
    --text-muted: #64748B;
    --border-color: #E2E8F0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-page);
    background-image: radial-gradient(#CBD5E1 0.75px, transparent 0.75px), radial-gradient(#CBD5E1 0.75px, #F8FAFC 0.75px);
    background-size: 30px 30px;
    background-position: 0 0, 15px 15px;
    color: var(--text-main);
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 30px 15px;
}

.container {
    width: 100%;
    max-width: 820px;
    background: var(--card-bg);
    padding: 35px 40px;
    border-radius: 20px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: var(--shadow-lg);
    position: relative;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #EEF2F6;
    position: relative;
}

.header-badge {
    display: inline-block;
    background: #EEF2F6;
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 10px;
}

header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 30px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.5px;
    line-height: 1.25;
}

.header-subtitle {
    color: var(--text-muted);
    font-size: 15px;
    margin-top: 6px;
    font-weight: 500;
}

.screen {
    display: none;
    animation: fadeInScreen 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.screen.active {
    display: block;
}

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

/* Welcome Card */
.welcome-card {
    background: #F8FAFC;
    border-left: 4px solid var(--accent);
    padding: 18px 22px;
    border-radius: 12px;
    margin-bottom: 24px;
}

.welcome-card h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.welcome-card p {
    color: #475569;
    font-size: 15px;
    margin-bottom: 6px;
}

.welcome-card p:last-child {
    margin-bottom: 0;
}

/* Settings Card */
.timer-settings-card {
    background: #FFFFFF;
    border: 1.5px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.timer-settings-card h3 {
    font-family: 'Outfit', sans-serif;
    color: var(--primary);
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.setting-row {
    margin-bottom: 14px;
}

.setting-row:last-child {
    margin-bottom: 0;
}

.setting-label {
    display: block;
    margin-bottom: 8px;
    font-size: 15px;
    color: var(--primary);
}

.setting-divider {
    height: 1px;
    background: var(--border-color);
    margin: 18px 0;
}

.switch-label {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: var(--primary);
    user-select: none;
}

.switch-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--accent);
    border-radius: 6px;
}

.timer-input-group {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 12px;
    padding-left: 32px;
}

.timer-input-group label {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-muted);
}

.input-with-unit {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.input-with-unit input[type="number"] {
    width: 85px;
    padding: 8px 12px;
    border: 1.5px solid #CBD5E1;
    border-radius: 8px;
    font-size: 16px;
    text-align: center;
    font-weight: 700;
    color: var(--primary);
    font-family: 'Outfit', sans-serif;
    transition: all 0.2s ease;
}

.input-with-unit input[type="number"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.input-with-unit span {
    font-size: 14px;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    padding: 13px 26px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 700;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.btn.primary {
    background: var(--accent);
    color: white;
    width: 100%;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn.primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.btn.primary:active {
    transform: translateY(0);
}

.btn.secondary {
    background: var(--primary);
    color: white;
    padding: 11px 22px;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.15);
}

.btn.secondary:hover {
    background: #020617;
    transform: translateY(-1px);
}

.btn.tertiary {
    background: #F1F5F9;
    color: #334155;
    width: 100%;
    margin-top: 10px;
    border: 1px solid var(--border-color);
}

.btn.tertiary:hover {
    background: #E2E8F0;
    color: var(--primary);
}

/* Progress bar */
.progress-bar-container {
    width: 100%;
    height: 6px;
    background: #E2E8F0;
    border-radius: 999px;
    margin-bottom: 24px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #3B82F6, #2563EB);
    transition: width 0.3s ease;
    border-radius: 999px;
}

/* Stats Bar */
.stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 10px;
}

.badge {
    padding: 6px 14px;
    border-radius: 999px;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.badge.correct {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #A7F3D0;
}

.badge.incorrect {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

.badge.progress {
    background: #EFF6FF;
    color: #1E40AF;
    border: 1px solid #BFDBFE;
}

.badge.timer {
    background: #1E293B;
    color: #F8FAFC;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    letter-spacing: 0.5px;
    border: 1px solid #334155;
}

.badge.timer.warning {
    background: #D97706;
    color: white;
    border-color: #B45309;
    animation: pulseWarning 1.5s infinite;
}

.badge.timer.danger {
    background: #DC2626;
    color: white;
    border-color: #B91C1C;
    animation: pulseDanger 0.8s infinite;
}

@keyframes pulseWarning {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes pulseDanger {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.08); opacity: 0.9; }
}

/* Question Section */
.question-container {
    margin-top: 10px;
}

.question-container h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.45;
    margin-bottom: 22px;
}

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

.option-btn {
    background: #FFFFFF;
    border: 1.5px solid var(--border-color);
    padding: 16px 20px;
    text-align: left;
    border-radius: 12px;
    cursor: pointer;
    font-size: 15px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--text-main);
    line-height: 1.45;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: flex-start;
    box-shadow: var(--shadow-sm);
}

.option-btn:hover:not(:disabled) {
    border-color: var(--accent);
    background: var(--accent-soft);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.option-btn:disabled {
    cursor: default;
    opacity: 0.92;
}

.letra {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 16px;
    color: var(--accent);
    margin-right: 14px;
    flex-shrink: 0;
    margin-top: 1px;
}

.opt-text {
    flex-grow: 1;
}

.option-btn.correct {
    background: var(--correct-bg);
    border-color: var(--correct);
    color: #065F46;
    font-weight: 600;
}

.option-btn.correct .letra {
    color: var(--correct);
}

.option-btn.incorrect {
    background: var(--incorrect-bg);
    border-color: var(--incorrect);
    color: #991B1B;
}

.option-btn.incorrect .letra {
    color: var(--incorrect);
}

/* Feedback Section */
.feedback {
    margin-top: 28px;
    padding: 22px 26px;
    border-radius: 14px;
    border-left: 6px solid var(--border-color);
    animation: fadeInScreen 0.3s ease;
}

.feedback.hidden {
    display: none;
}

.feedback.correct {
    background: var(--correct-bg);
    border-left-color: var(--correct);
    border-top: 1px solid var(--correct-border);
    border-right: 1px solid var(--correct-border);
    border-bottom: 1px solid var(--correct-border);
}

.feedback.incorrect {
    background: var(--incorrect-bg);
    border-left-color: var(--incorrect);
    border-top: 1px solid var(--incorrect-border);
    border-right: 1px solid var(--incorrect-border);
    border-bottom: 1px solid var(--incorrect-border);
}

.feedback-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.feedback-icon {
    font-size: 22px;
}

.feedback h4 {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.35;
}

.correct h4 {
    color: var(--correct);
}

.incorrect h4 {
    color: var(--incorrect);
}

.feedback-body {
    font-size: 15px;
    line-height: 1.55;
    color: #334155;
}

.feedback-block {
    margin-bottom: 12px;
}

.feedback-block:last-child {
    margin-bottom: 0;
}

.feedback-block strong {
    color: var(--primary);
    font-weight: 700;
    display: inline-block;
    margin-bottom: 3px;
}

.feedback-block.correct-focus {
    background: rgba(255, 255, 255, 0.7);
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid rgba(220, 38, 38, 0.15);
}

.feedback-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
}

/* End / Results Screen */
#end-screen h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 26px;
    font-weight: 800;
    color: var(--primary);
    text-align: center;
}

.end-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 15px;
    margin-bottom: 24px;
}

.alert-timeout {
    background: #FEF2F2;
    color: #991B1B;
    border: 1.5px solid #F87171;
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 15px;
    text-align: center;
}

.alert-timeout.hidden {
    display: none;
}

.final-scores {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 24px;
}

.score-card {
    background: #FFFFFF;
    border: 2px solid var(--border-color);
    padding: 22px 18px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease;
}

.score-card:hover {
    transform: translateY(-2px);
}

.score-card.correct-border {
    border-color: #A7F3D0;
    background: #F0FDF4;
}

.score-card.incorrect-border {
    border-color: #FECACA;
    background: #FEF2F2;
}

.score-icon {
    font-size: 24px;
    margin-bottom: 6px;
}

.score-title {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.score-number {
    font-family: 'Outfit', sans-serif;
    font-size: 42px;
    font-weight: 800;
    line-height: 1.1;
    margin-top: 6px;
}

.correct-color {
    color: var(--correct);
}

.incorrect-color {
    color: var(--incorrect);
}

/* Time Metrics */
.time-metrics-card {
    background: #EFF6FF;
    border: 1.5px solid #BFDBFE;
    border-radius: 16px;
    padding: 20px 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 28px;
}

.metric-item {
    display: flex;
    align-items: center;
    gap: 16px;
}

.metric-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.metric-content {
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 13px;
    color: #475569;
    font-weight: 600;
}

.metric-value {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
    margin-top: 2px;
}

/* Review Section */
.review-section {
    margin-top: 30px;
    text-align: left;
}

.review-section h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 19px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 6px;
}

.review-section p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 18px;
}

#review-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

#review-list li {
    background: #FFFBEB;
    padding: 20px 22px;
    border-left: 5px solid #F59E0B;
    border-radius: 10px;
    border-top: 1px solid #FEF3C7;
    border-right: 1px solid #FEF3C7;
    border-bottom: 1px solid #FEF3C7;
    box-shadow: var(--shadow-sm);
    font-size: 14.5px;
    line-height: 1.5;
}

#review-list li strong {
    font-family: 'Outfit', sans-serif;
    color: var(--primary);
    display: block;
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 700;
}

.review-answer {
    margin-bottom: 8px;
}

.review-label {
    font-weight: 700;
    color: #92400E;
    margin-right: 6px;
}

.review-text {
    font-weight: 600;
    color: #065F46;
}

.review-explanation {
    color: #451A03;
    background: rgba(255, 255, 255, 0.6);
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 6px;
}

.end-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 30px;
}

/* Responsive */
@media (max-width: 640px) {
    body {
        padding: 15px 10px;
    }

    .container {
        padding: 24px 20px;
        border-radius: 16px;
    }

    header h1 {
        font-size: 24px;
    }

    .final-scores {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .time-metrics-card {
        grid-template-columns: 1fr;
        gap: 14px;
        padding: 16px;
    }

    .stats {
        justify-content: center;
    }
}
