:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --error-color: #e74c3c;
    --bg: #ecf0f1;
    --card-bg: #ffffff;
    --text: #2c3e50;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
}

.container {
    max-width: 820px;
    margin: 0 auto;
    padding: 16px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 20px;
    padding: 20px 16px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
header h1 { color: var(--primary-color); font-size: 1.5rem; }
header p  { color: var(--secondary-color); font-style: italic; }

/* Score bar — sticky */
.score-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--primary-color);
    color: #fff;
    padding: 10px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    text-align: center;
    font-size: 0.95rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.score-passing { background: #1e8449; }
.score-text { margin-right: 8px; }
.score-label { opacity: 0.75; font-size: 0.85rem; }

/* Question cards */
.question-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 24px;
    margin-bottom: 14px;
    transition: box-shadow 0.2s;
}
.question-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); }

/* Question header */
.q-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}
.q-num {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--secondary-color);
    background: #ebf5fb;
    padding: 2px 10px;
    border-radius: 20px;
}

/* Question text */
.q-text {
    font-size: 1.05rem;
    margin-bottom: 14px;
    line-height: 1.5;
}

/* Option buttons */
.q-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}
.opt-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: var(--radius);
    padding: 12px 14px;
    cursor: pointer;
    font-size: 0.95rem;
    text-align: left;
    transition: all 0.2s;
    color: var(--text);
}
.opt-btn:hover { background: #e9ecef; border-color: #adb5bd; }
.opt-btn.selected { background: #d4e6f1; border-color: var(--secondary-color); }
.opt-btn.correct { background: #d5f5e3; border-color: var(--success-color); color: #1e8449; }
.opt-btn.incorrect { background: #fadbd8; border-color: var(--error-color); color: #922b21; }
.opt-btn:disabled { cursor: default; opacity: 0.85; }

.opt-letter {
    font-weight: 700;
    color: var(--secondary-color);
    min-width: 22px;
    font-size: 0.85rem;
}
.opt-btn.correct .opt-letter { color: var(--success-color); }
.opt-btn.incorrect .opt-letter { color: var(--error-color); }

/* Check button */
.q-actions { margin-bottom: 4px; }
.check-btn {
    background: var(--secondary-color);
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}
.check-btn:hover { background: #2980b9; }

/* Feedback */
.q-feedback { display: none; margin-top: 12px; border-radius: var(--radius); overflow: hidden; }
.q-feedback.show { display: block; }
.fb-header {
    padding: 10px 16px;
    font-weight: 600;
    font-size: 0.95rem;
}
.fb-correct .fb-header { background: #d5f5e3; color: #1e8449; }
.fb-incorrect .fb-header { background: #fadbd8; color: #922b21; }

.fb-explanation {
    padding: 12px 16px;
    background: #fef9e7;
    color: #7d6608;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Scroll-to-top */
#scroll-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99;
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.9rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: opacity 0.3s;
    opacity: 0.8;
}
#scroll-top:hover { opacity: 1; }

/* Footer */
footer {
    text-align: center;
    padding: 24px;
    color: #7f8c8d;
    font-size: 0.85rem;
    margin-top: 10px;
}

/* Mobile */
@media (max-width: 600px) {
    .container { padding: 8px; }
    header { padding: 14px; }
    header h1 { font-size: 1.2rem; }
    .question-card { padding: 14px 12px; }
    .opt-btn { padding: 10px; font-size: 0.9rem; }
    .q-text { font-size: 0.95rem; }
}
