/**
 * Net Ninja - Claude Code Quiz System Styles
 * PKA-STYLE rewrite (dual-theme, default dark).
 *
 * Consumes the SAME pka tokens defined in ../../assets/css/styles.css
 * (loaded BEFORE this file on both quiz pages), so the quiz UI re-skins for
 * free across [data-theme="dark"] / [data-theme="light"] and inherits the
 * shared atmosphere (no background override here — the body texture shows
 * through the glassy quiz panels).
 *
 * Token map used here (all defined in styles.css):
 *   --heading / --text-color / --secondary-text-color / --dim
 *   --background-color / --code-bg / --panel / --panel-solid
 *   --border-color / --edge / --edge-soft / --edge-strong
 *   --gold / --gold-rgb / --gold-soft / --gold-text / --gold-label
 *   --gold-fill / --on-gold / --focus
 *   --lamp (status GREEN)  --crimson (status RED)
 *   --serif / --mono / --sans
 *
 * Status colours (correct = green, incorrect = red) are ALWAYS paired with an
 * icon and/or a glyph label (✓ / ✗) so colour is never the only signal.
 */

/* ============================================ */
/* Layout tokens (quiz-local; not colour)       */
/* ============================================ */
:root {
    --container-max-width: 820px;
    --spacing-xs: 8px;
    --spacing-sm: 12px;
    --spacing-md: 20px;
    --spacing-lg: 32px;
    --spacing-xl: 48px;
}

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

body {
    font-family: var(--sans);
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* NOTE: no background here — let the shared pka atmosphere (styles.css) show. */
}

.icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    vertical-align: middle;
    stroke: currentColor;
    stroke-width: 1.5;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-sm { width: 16px; height: 16px; }
.icon-md { width: 20px; height: 20px; }
.icon-lg { width: 24px; height: 24px; }

/* Dashboard wrapper. Override styles.css `.container { display:flex }`
   (that flex layout is for the tutorial's sidebar+content, not the dashboard). */
.container {
    display: block;
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-lg) var(--spacing-md);
}

/* ============================================ */
/* Quiz Dashboard Header                        */
/* ============================================ */
.quiz-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    padding-top: var(--spacing-lg);
}

.quiz-header h1 {
    font-family: var(--serif);
    font-size: 2.75rem;
    font-weight: 400;
    letter-spacing: .2px;
    color: var(--heading);
    margin-bottom: var(--spacing-sm);
}

.subtitle {
    font-family: var(--serif);
    font-size: 1.2rem;
    color: var(--secondary-text-color);
    margin-bottom: var(--spacing-md);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    color: var(--gold-text);
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.2s ease, color 0.2s ease;
}

.back-link .icon { color: currentColor; }

.back-link:hover {
    transform: translateX(-4px);
    color: var(--gold-soft);
}

/* dashboard header controls (theme + atmosphere toggles) */
.quiz-header-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: var(--spacing-md);
}

/* ============================================ */
/* Progress Overview Stats                      */
/* ============================================ */
.progress-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.stat {
    text-align: center;
    padding: var(--spacing-lg);
    background: var(--panel);
    border-radius: 14px;
    border: 1px solid var(--panel-edge);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.stat-value {
    font-family: var(--mono);
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--gold-text);
    margin-bottom: var(--spacing-xs);
}

.stat-label {
    font-family: var(--mono);
    font-size: 0.75rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--secondary-text-color);
    font-weight: 500;
}

/* ============================================ */
/* Section Headers                              */
/* ============================================ */
.section-header {
    grid-column: 1 / -1;
    margin: var(--spacing-xl) 0 var(--spacing-md) 0;
}

.section-header:first-child {
    margin-top: 0;
}

.section-header h2 {
    font-family: var(--serif);
    font-size: 1.9rem;
    font-weight: 400;
    color: var(--heading);
    margin-bottom: var(--spacing-xs);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding-bottom: 8px;
    border-bottom: 1px solid transparent;
    border-image: linear-gradient(90deg, var(--gold-deep), rgba(var(--gold-rgb), .05) 70%, transparent) 1;
}

.section-header h2 .icon { color: var(--gold); }

.section-header p {
    font-size: 1rem;
    color: var(--secondary-text-color);
}

/* ============================================ */
/* Chapter Grid                                 */
/* ============================================ */
.chapter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--spacing-md);
}

/* ============================================ */
/* Chapter Cards - Base                         */
/* ============================================ */
.chapter-card {
    display: block;
    padding: var(--spacing-lg);
    background: var(--panel);
    border: 1px solid var(--panel-edge);
    border-radius: 14px;
    text-decoration: none;
    color: var(--text-color);
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
    cursor: pointer;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.chapter-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--hover-glow);
    border-color: var(--edge-strong);
}

.chapter-number {
    font-family: var(--mono);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--gold-label);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    margin-bottom: var(--spacing-xs);
}

.chapter-title {
    font-family: var(--serif);
    font-size: 1.4rem;
    font-weight: 400;
    color: var(--heading);
    margin-bottom: var(--spacing-xs);
}

.chapter-desc {
    font-size: 0.9rem;
    color: var(--secondary-text-color);
    margin-bottom: var(--spacing-md);
}

.chapter-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ============================================ */
/* Status Badges                                */
/* ============================================ */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-family: var(--mono);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: .04em;
}

.status-badge.not-started {
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    color: var(--secondary-text-color);
}

.status-badge.completed {
    background: var(--gold-fill);
    color: var(--on-gold);
    border: 1px solid var(--gold-fill);
}

/* ============================================ */
/* Completed Cards - gold-edged glow            */
/* ============================================ */
.chapter-card.completed {
    border-color: var(--edge-strong);
    box-shadow: 0 0 0 1px rgba(var(--gold-rgb), .25), 0 10px 30px -14px rgba(var(--gold-rgb), .45);
}

.chapter-card.completed:hover {
    transform: translateY(-6px);
    box-shadow: 0 0 0 1px rgba(var(--gold-rgb), .35), 0 16px 40px -14px rgba(var(--gold-rgb), .6);
}

/* ============================================ */
/* Perfect Score Cards                          */
/* ============================================ */
.chapter-card.perfect-score {
    border-color: var(--gold);
    box-shadow: 0 0 0 1px rgba(var(--gold-rgb), .4), 0 0 28px -8px rgba(var(--gold-rgb), .5);
    position: relative;
}

/* non-emoji "perfect" marker — gold mono badge, top-right */
.chapter-card.perfect-score::after {
    content: "PERFECT";
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    font-family: var(--mono);
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: .14em;
    color: var(--on-gold);
    background: var(--gold-fill);
    padding: 3px 8px;
    border-radius: 999px;
}

/* ============================================ */
/* Bonus Cards                                  */
/* ============================================ */
.chapter-card.bonus {
    border-color: var(--edge-strong);
    box-shadow: 0 0 0 1px rgba(var(--gold-rgb), .2), 0 10px 30px -14px rgba(var(--gold-rgb), .4);
    position: relative;
}

.chapter-card.bonus:hover {
    transform: translateY(-6px);
    box-shadow: 0 0 0 1px rgba(var(--gold-rgb), .32), 0 16px 40px -14px rgba(var(--gold-rgb), .55);
}

/* ============================================ */
/* Footer (dashboard)                           */
/* ============================================ */
.quiz-footer {
    text-align: center;
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
    color: var(--secondary-text-color);
    font-size: 0.875rem;
}

.quiz-footer p {
    margin: var(--spacing-xs) 0;
}

.btn-clear-progress {
    margin-top: var(--spacing-lg);
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--crimson);
    border-radius: 999px;
    color: var(--crimson);
    font-family: var(--sans);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-clear-progress:hover {
    background: var(--crimson);
    color: var(--background-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -8px var(--crimson);
}

.btn-clear-progress:active { transform: translateY(0); }

.btn-clear-progress:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

/* ============================================ */
/* Quiz Container (quiz.html)                    */
/* ============================================ */
.quiz-container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: var(--spacing-md);
    padding-top: calc(var(--header-height, 60px) + 32px); /* clear fixed header */
    min-height: calc(100vh - 200px);
}

/* ============================================ */
/* Quiz Start Screen                            */
/* ============================================ */
.quiz-intro {
    text-align: center;
    max-width: 680px;
    margin: 0 auto;
}

.quiz-intro h2 {
    font-family: var(--serif);
    font-size: 2.2rem;
    font-weight: 400;
    color: var(--heading);
    margin-bottom: var(--spacing-lg);
    line-height: 1.3;
}

.quiz-info {
    display: flex;
    justify-content: center;
    gap: var(--spacing-xl);
    margin: var(--spacing-xl) 0;
}

.quiz-info-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.quiz-info-item .icon {
    width: 24px;
    height: 24px;
    stroke: var(--gold);
}

.quiz-info-item div {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.quiz-info-item strong {
    font-family: var(--mono);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--gold-label);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.quiz-info-item span {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-color);
}

.quiz-description {
    text-align: left;
    margin: var(--spacing-xl) 0;
    padding: var(--spacing-lg);
    background: var(--panel-solid);
    border-radius: 14px;
    border: 1px solid var(--panel-edge);
}

.quiz-description h3 {
    font-family: var(--serif);
    font-size: 1.4rem;
    font-weight: 400;
    color: var(--heading);
    margin-bottom: var(--spacing-md);
}

.quiz-description h4 {
    font-family: var(--mono);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--gold-label);
    margin: var(--spacing-md) 0 var(--spacing-sm) 0;
}

.quiz-description p {
    font-size: 1rem;
    color: var(--secondary-text-color);
    line-height: 1.6;
    margin-bottom: var(--spacing-md);
}

.quiz-description ul {
    list-style: none;
    padding-left: 0;
}

.quiz-description li {
    position: relative;
    padding-left: 24px;
    margin-bottom: var(--spacing-sm);
    color: var(--secondary-text-color);
}

.quiz-description li::before {
    content: '▸';
    position: absolute;
    left: 6px;
    color: var(--gold);
    font-weight: 700;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.125rem;
    margin-top: var(--spacing-lg);
}

/* ============================================ */
/* Quiz Progress Bar                            */
/* ============================================ */
.quiz-progress {
    margin-bottom: var(--spacing-lg);
}

.quiz-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: var(--spacing-sm);
}

.quiz-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold-deep), var(--gold));
    transition: width 0.5s ease;
    border-radius: 999px;
}

.quiz-progress-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--secondary-text-color);
}

.difficulty-badge {
    padding: 4px 12px;
    border-radius: 999px;
    font-family: var(--mono);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border: 1px solid transparent;
}

.difficulty-easy {
    background: color-mix(in srgb, var(--lamp) 14%, transparent);
    color: var(--lamp);
    border-color: color-mix(in srgb, var(--lamp) 45%, transparent);
}

.difficulty-medium {
    background: color-mix(in srgb, var(--gold) 14%, transparent);
    color: var(--gold-label);
    border-color: color-mix(in srgb, var(--gold) 45%, transparent);
}

.difficulty-hard {
    background: color-mix(in srgb, var(--crimson) 14%, transparent);
    color: var(--crimson);
    border-color: color-mix(in srgb, var(--crimson) 45%, transparent);
}

/* ============================================ */
/* Question Card                                */
/* ============================================ */
.question-card {
    background: var(--panel-solid);
    border: 1px solid var(--panel-edge);
    border-radius: 14px;
    padding: var(--spacing-xl);
}

.question-text {
    font-family: var(--serif);
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--heading);
    margin-bottom: var(--spacing-lg);
    line-height: 1.4;
}

/* ============================================ */
/* Options                                      */
/* ============================================ */
.options-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.option-btn {
    background: var(--panel);
    border: 1px solid var(--edge);
    border-radius: 10px;
    padding: var(--spacing-md) var(--spacing-lg);
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
    font-family: var(--sans);
    font-size: 1rem;
    text-align: left;
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.option-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: var(--mono);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gold-label);
    flex-shrink: 0;
}

.option-text {
    flex: 1;
    color: var(--text-color);
}

.option-btn:hover:not(:disabled) {
    background: rgba(var(--gold-rgb), .06);
    border-color: var(--gold);
    transform: translateX(2px);
}

.option-btn:hover:not(:disabled) .option-label {
    background: var(--gold-fill);
    color: var(--on-gold);
    border-color: var(--gold-fill);
}

.option-btn:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
    border-color: var(--gold);
}

/* CORRECT (green + ✓ glyph — colour is never the only signal) */
.option-btn.correct {
    background: color-mix(in srgb, var(--lamp) 12%, transparent);
    border-color: var(--lamp);
}

.option-btn.correct .option-text {
    color: var(--lamp);
    font-weight: 600;
}

.option-btn.correct .option-text::after {
    content: " ✓";
    font-weight: 700;
}

.option-btn.correct .option-label {
    background: var(--lamp);
    color: var(--background-color);
    border-color: var(--lamp);
}

/* INCORRECT (red + ✗ glyph) */
.option-btn.incorrect {
    background: color-mix(in srgb, var(--crimson) 12%, transparent);
    border-color: var(--crimson);
}

.option-btn.incorrect .option-text {
    color: var(--crimson);
    font-weight: 600;
}

.option-btn.incorrect .option-text::after {
    content: " ✗";
    font-weight: 700;
}

.option-btn.incorrect .option-label {
    background: var(--crimson);
    color: var(--background-color);
    border-color: var(--crimson);
}

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

/* ============================================ */
/* Feedback                                     */
/* ============================================ */
.feedback-container {
    margin-top: var(--spacing-lg);
}

.feedback {
    padding: var(--spacing-lg);
    border-radius: 14px;
    animation: fadeIn 0.3s ease;
}

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

.feedback-correct {
    background: color-mix(in srgb, var(--lamp) 10%, var(--panel-solid));
    border: 1px solid var(--lamp);
}

.feedback-incorrect {
    background: color-mix(in srgb, var(--crimson) 10%, var(--panel-solid));
    border: 1px solid var(--crimson);
}

.feedback-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
    font-family: var(--mono);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: .03em;
}

.feedback-header .icon {
    width: 24px;
    height: 24px;
}

.feedback-correct .feedback-header { color: var(--lamp); }
.feedback-correct .feedback-header .icon { stroke: var(--lamp); }

.feedback-incorrect .feedback-header { color: var(--crimson); }
.feedback-incorrect .feedback-header .icon { stroke: var(--crimson); }

.feedback-explanation {
    font-size: 0.9375rem;
    color: var(--text-color);
    line-height: 1.6;
}

.feedback-explanation p { margin-bottom: var(--spacing-sm); }
.feedback-explanation strong { font-weight: 600; color: var(--heading); }

/* ============================================ */
/* Quiz Actions                                 */
/* ============================================ */
.quiz-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: var(--spacing-lg);
}

/* ============================================ */
/* Results Screen                               */
/* ============================================ */
.results-container {
    text-align: center;
    max-width: 680px;
    margin: 0 auto;
}

.results-container h2 {
    font-family: var(--serif);
    font-size: 2.4rem;
    font-weight: 400;
    color: var(--heading);
    margin-bottom: var(--spacing-xl);
}

.results-score {
    margin: var(--spacing-xl) 0;
}

.score-circle {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 0 auto;
}

.score-svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.score-bg {
    fill: none;
    stroke: var(--code-bg);
    stroke-width: 8;
}

.score-progress {
    fill: none;
    stroke: var(--gold);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease;
}

.score-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-text #score-percentage {
    font-family: var(--mono);
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--gold-text);
    line-height: 1;
}

.score-text #score-fraction {
    font-family: var(--mono);
    font-size: 1rem;
    font-weight: 500;
    color: var(--secondary-text-color);
    margin-top: var(--spacing-xs);
}

.performance-message {
    margin: var(--spacing-xl) 0;
    padding: var(--spacing-lg);
    background: var(--panel-solid);
    border-radius: 14px;
    border: 1px solid var(--panel-edge);
}

.performance-message p {
    font-size: 1.125rem;
    line-height: 1.6;
    color: var(--text-color);
    margin: 0;
}

.performance-excellent { color: var(--lamp) !important; font-weight: 600; }
.performance-good { color: var(--gold-text) !important; font-weight: 600; }
.performance-fair { color: var(--gold-label) !important; font-weight: 600; }
.performance-needs-work { color: var(--crimson) !important; font-weight: 600; }

.results-breakdown {
    margin: var(--spacing-xl) 0;
    text-align: left;
}

.results-breakdown h3 {
    font-family: var(--serif);
    font-size: 1.6rem;
    font-weight: 400;
    color: var(--heading);
    margin-bottom: var(--spacing-md);
    text-align: center;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-lg);
    background: var(--panel);
    border-radius: 14px;
    border: 1px solid var(--panel-edge);
}

.stat-item .icon {
    width: 32px;
    height: 32px;
    stroke: var(--gold);
    margin-bottom: var(--spacing-sm);
}

.stat-item div {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-item strong {
    font-family: var(--mono);
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--heading);
}

.stat-item span {
    font-size: 0.875rem;
    color: var(--secondary-text-color);
    font-weight: 500;
}

.results-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    margin-top: var(--spacing-xl);
    flex-wrap: wrap;
}

/* ============================================ */
/* Dashboard Styles (index.html alt layout)     */
/* ============================================ */
.quiz-dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-lg) var(--spacing-md);
    padding-top: calc(var(--header-height, 60px) + 32px);
}

.dashboard-container h2 {
    font-family: var(--serif);
    font-size: 2.2rem;
    font-weight: 400;
    color: var(--heading);
    margin-bottom: var(--spacing-md);
    text-align: center;
}

.dashboard-intro {
    text-align: center;
    font-size: 1.125rem;
    color: var(--secondary-text-color);
    margin-bottom: var(--spacing-xl);
}

.quiz-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.quiz-card {
    background: var(--panel);
    border: 1px solid var(--panel-edge);
    border-radius: 14px;
    padding: var(--spacing-lg);
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.quiz-card:not(.coming-soon):hover {
    transform: translateY(-4px);
    box-shadow: var(--hover-glow);
    border-color: var(--edge-strong);
}

.quiz-card.coming-soon { opacity: 0.55; }

.quiz-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-sm);
}

.quiz-card-header h3 {
    font-family: var(--serif);
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--heading);
}

.quiz-badge {
    padding: 4px 12px;
    border-radius: 999px;
    font-family: var(--mono);
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    color: var(--secondary-text-color);
}

.quiz-card p {
    color: var(--secondary-text-color);
    margin-bottom: var(--spacing-md);
}

.quiz-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quiz-meta {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--secondary-text-color);
}

.progress-summary {
    background: var(--panel-solid);
    border-radius: 14px;
    border: 1px solid var(--panel-edge);
    padding: var(--spacing-xl);
}

.progress-summary h3 {
    font-family: var(--serif);
    font-size: 1.6rem;
    font-weight: 400;
    color: var(--heading);
    margin-bottom: var(--spacing-md);
    text-align: center;
}

.progress-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-lg);
    background: var(--panel);
    border-radius: 14px;
    border: 1px solid var(--panel-edge);
}

/* shared stat-value/-label already defined above for the overview;
   the dashboard variants keep the same pka treatment */
.progress-summary .stat-value,
.stat-card .stat-value {
    font-family: var(--mono);
    font-size: 2rem;
    font-weight: 600;
    color: var(--gold-text);
}

.progress-summary .stat-label,
.stat-card .stat-label {
    font-family: var(--mono);
    font-size: 0.75rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--secondary-text-color);
    font-weight: 500;
    text-align: center;
}

/* ============================================ */
/* Results Review List                          */
/* ============================================ */
.results-review {
    margin: var(--spacing-xl) 0;
    text-align: left;
}

.results-review h3 {
    font-family: var(--serif);
    font-size: 1.6rem;
    font-weight: 400;
    color: var(--heading);
    margin-bottom: var(--spacing-md);
    text-align: center;
}

.results-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.result-item {
    background: var(--panel);
    border: 1px solid var(--panel-edge);
    border-left-width: 3px;
    border-radius: 12px;
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
}

/* correct/incorrect distinguished by left bar colour AND the result icon */
.result-item.correct {
    border-left-color: var(--lamp);
}
.result-item.correct .result-icon { color: var(--lamp); }
.result-item.correct .result-icon .icon { stroke: var(--lamp); }

.result-item.incorrect {
    border-left-color: var(--crimson);
}
.result-item.incorrect .result-icon { color: var(--crimson); }
.result-item.incorrect .result-icon .icon { stroke: var(--crimson); }

.result-header {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.result-icon { flex-shrink: 0; }

.result-icon .icon {
    width: 24px;
    height: 24px;
}

.result-question {
    font-weight: 600;
    color: var(--heading);
    flex: 1;
    font-size: 1rem;
    line-height: 1.5;
}

.result-answer {
    margin-left: calc(24px + var(--spacing-md));
    font-size: 0.9375rem;
    line-height: 1.6;
}

.result-answer.user-answer {
    color: var(--crimson);
    margin-bottom: var(--spacing-xs);
    font-weight: 500;
}

.result-answer.correct-answer {
    color: var(--lamp);
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
}

.result-explanation {
    margin-left: calc(24px + var(--spacing-md));
    margin-top: var(--spacing-sm);
    padding: var(--spacing-md);
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.875rem;
    color: var(--text-color);
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
}

.result-explanation .icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 2px;
    stroke: var(--gold);
}

/* ============================================ */
/* Site Footer                                  */
/* ============================================ */
.site-footer {
    text-align: center;
    padding: var(--spacing-lg);
    margin-top: var(--spacing-xl);
    border-top: 1px solid var(--border-color);
    color: var(--secondary-text-color);
    font-size: 0.875rem;
}

/* ============================================ */
/* Error Message                                */
/* ============================================ */
.error-message {
    text-align: center;
    padding: var(--spacing-xl);
}

.error-message h2 {
    font-family: var(--serif);
    font-size: 2rem;
    font-weight: 400;
    color: var(--heading);
    margin-bottom: var(--spacing-md);
}

.error-message p {
    font-size: 1.125rem;
    color: var(--secondary-text-color);
    margin-bottom: var(--spacing-lg);
}

/* ============================================ */
/* Responsive Design                            */
/* ============================================ */
@media (max-width: 768px) {
    .quiz-container { padding: var(--spacing-md); padding-top: calc(var(--header-height, 60px) + 24px); }

    .quiz-header h1 { font-size: 2rem; }

    .quiz-intro h2,
    .results-container h2 { font-size: 1.75rem; }

    .quiz-info {
        flex-direction: column;
        gap: var(--spacing-md);
        align-items: center;
    }

    .quiz-info-item {
        width: 100%;
        justify-content: center;
    }

    .question-card { padding: var(--spacing-md); }

    .question-text { font-size: 1.25rem; }

    .stats-grid,
    .progress-stats { grid-template-columns: 1fr; }

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

    .results-actions {
        flex-direction: column;
        width: 100%;
    }

    .results-actions .btn,
    .results-actions a {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

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

    .score-text #score-percentage { font-size: 2rem; }
}

@media (max-width: 480px) {
    .quiz-container,
    .quiz-dashboard { padding: var(--spacing-sm); }

    .quiz-intro h2,
    .results-container h2 { font-size: 1.5rem; }

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

    .quiz-description { padding: var(--spacing-md); }

    .stat-item strong,
    .progress-summary .stat-value,
    .stat-card .stat-value { font-size: 1.5rem; }
}

/* ============================================ */
/* Reduced Motion                               */
/* ============================================ */
@media (prefers-reduced-motion: reduce) {
    * ,
    .chapter-card,
    .quiz-card,
    .option-btn,
    .quiz-progress-fill,
    .score-progress,
    .back-link,
    .feedback {
        transition: none !important;
        animation: none !important;
    }
    .chapter-card:hover,
    .quiz-card:hover,
    .option-btn:hover:not(:disabled) {
        transform: none;
    }
}

/* ============================================ */
/* Hidden                                       */
/* ============================================ */
.hidden {
    display: none !important;
}
