/* ── Reset & base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f7fa;
    color: #1a1a1a;
    line-height: 1.6;
}
a { color: #185FA5; }
code {
    background: #e8eef4;
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
}

/* ── Navbar ────────────────────────────────────────────────── */
.navbar {
    background: #185FA5;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-brand { font-weight: 700; font-size: 1.15rem; color: #fff; text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.nav-links a { color: #d0e4f7; text-decoration: none; font-size: 0.95rem; }
.nav-links a:hover { color: #fff; }
.nav-user { color: #a0c4e8; font-size: 0.85rem; font-weight: 600; }
.nav-logout { opacity: 0.8; }
.nav-admin { background: rgba(255,255,255,0.15); border-radius: 4px; padding: 0.15rem 0.5rem; font-weight: 700; }

/* ── Container ─────────────────────────────────────────────── */
.container { max-width: 960px; margin: 2rem auto; padding: 0 1rem; }

/* ── Flash messages ────────────────────────────────────────── */
.flash { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.95rem; }
.flash-success { background: #d4edda; color: #155724; }
.flash-error   { background: #f8d7da; color: #721c24; }

/* ── Auth card ─────────────────────────────────────────────── */
.auth-card {
    max-width: 420px; margin: 4rem auto; background: #fff;
    padding: 2rem; border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.auth-card h1 { margin-bottom: 1.25rem; color: #185FA5; }
.auth-card label { display: block; margin-top: 1rem; font-weight: 600; font-size: 0.9rem; }
.auth-card input[type="email"],
.auth-card input[type="password"] {
    width: 100%; padding: 0.6rem 0.75rem; margin-top: 0.25rem;
    border: 1px solid #ccc; border-radius: 6px; font-size: 1rem;
}
.auth-card button[type="submit"] {
    margin-top: 1.5rem; width: 100%; padding: 0.7rem;
    background: #185FA5; color: #fff; border: none; border-radius: 6px;
    font-size: 1rem; font-weight: 600; cursor: pointer;
}
.auth-card button[type="submit"]:hover { background: #134d87; }
.auth-switch { margin-top: 1rem; text-align: center; font-size: 0.9rem; }
.auth-switch a { color: #185FA5; }

/* ── Name generator (register) ─────────────────────────────── */
.name-gen-row {
    display: flex; align-items: center; gap: 0.75rem;
    margin-top: 0.5rem; padding: 0.6rem 0.75rem;
    background: #eef3f9; border-radius: 6px; border: 1px solid #c5d5e8;
}
.name-preview {
    font-weight: 700; font-size: 1.1rem; color: #185FA5; flex: 1;
    font-family: "Consolas", "Courier New", monospace;
}
.reroll-btn {
    padding: 0.4rem 0.9rem; background: #185FA5; color: #fff;
    border: none; border-radius: 6px; cursor: pointer; font-size: 0.85rem;
    font-weight: 600;
}
.reroll-btn:hover { background: #134d87; }

/* ── Lesson tabs (dashboard) ───────────────────────────────── */
.lesson-tabs {
    display: flex; gap: 0.25rem; margin: 1.5rem 0 0; flex-wrap: wrap;
}
.tab-btn {
    padding: 0.5rem 1.2rem; border: 2px solid #185FA5; background: #fff;
    color: #185FA5; border-radius: 6px 6px 0 0; cursor: pointer;
    font-weight: 600; font-size: 0.95rem; transition: all 0.15s;
}
.tab-btn.active, .tab-btn:hover {
    background: #185FA5; color: #fff;
}
.lesson-panel {
    display: none; background: #fff; padding: 1.5rem;
    border: 2px solid #185FA5; border-top: none; border-radius: 0 0 8px 8px;
    margin-bottom: 2rem;
}
.lesson-panel.active { display: block; }
.lesson-panel h2 { color: #185FA5; margin-bottom: 1rem; }
.lesson-panel h3 { color: #134d87; margin: 1.25rem 0 0.5rem; font-size: 1.05rem; }
.lesson-panel ul { margin-left: 1.5rem; margin-bottom: 0.75rem; }
.lesson-panel li { margin-bottom: 0.3rem; }

/* ── Notes table (dashboard lessons) ───────────────────────── */
.notes-table {
    width: 100%; border-collapse: collapse; margin: 0.75rem 0 1rem; font-size: 0.93rem;
}
.notes-table th, .notes-table td {
    padding: 0.5rem 0.75rem; text-align: left; border: 1px solid #d0dce8;
}
.notes-table th { background: #e3ecf5; color: #185FA5; font-weight: 600; }
.notes-table tr:nth-child(even) td { background: #f8fafb; }

.source-cite {
    margin-top: 1rem; font-size: 0.8rem; color: #888; font-style: italic;
}

/* ── Quiz controls ─────────────────────────────────────────── */
.quiz-controls {
    display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
    margin-bottom: 1rem;
}
.quiz-controls label { font-weight: 600; }
.quiz-controls select {
    padding: 0.4rem 0.6rem; border: 1px solid #bbb; border-radius: 6px;
    font-size: 0.95rem;
}
.ctrl-btn {
    padding: 0.4rem 1rem; background: #185FA5; color: #fff;
    border: none; border-radius: 6px; cursor: pointer; font-weight: 600;
    font-size: 0.9rem;
}
.ctrl-btn:hover { background: #134d87; }

.scoreboard {
    font-size: 1.1rem; font-weight: 700; color: #185FA5;
    margin-bottom: 1.25rem; padding: 0.5rem 0;
}

/* ── Quiz card ─────────────────────────────────────────────── */
.quiz-card {
    background: #fff; border: 1px solid #d8e2ec; border-radius: 8px;
    padding: 1.25rem; margin-bottom: 1rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    transition: box-shadow 0.3s;
}
.quiz-card.answered { border-left: 4px solid #185FA5; }
.q-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.q-number { font-weight: 700; color: #185FA5; }
.q-lesson-tag {
    font-size: 0.78rem; background: #e3ecf5; color: #185FA5;
    padding: 0.15rem 0.6rem; border-radius: 10px; font-weight: 600;
}
.q-text { font-size: 1rem; margin-bottom: 0.75rem; line-height: 1.5; }

/* ── Answer options ────────────────────────────────────────── */
.q-options { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.75rem; }
.q-option {
    text-align: left; padding: 0.6rem 1rem; border: 2px solid #d0dce8;
    border-radius: 6px; background: #fff; cursor: pointer;
    font-size: 0.95rem; transition: all 0.15s;
}
.q-option:hover:not(:disabled) { border-color: #185FA5; background: #f0f5fb; }
.q-option:disabled { cursor: default; opacity: 0.85; }
.q-option.correct { border-color: #28a745; background: #d4edda; color: #155724; font-weight: 600; }
.q-option.wrong { border-color: #dc3545; background: #f8d7da; color: #721c24; }
.q-option.grayed-out {
    opacity: 0.35; border-color: #ccc; background: #f0f0f0;
    text-decoration: line-through; color: #999;
}

/* ── Feedback ──────────────────────────────────────────────── */
.q-feedback {
    padding: 0.5rem 0.75rem; border-radius: 6px; font-weight: 600;
    font-size: 0.95rem; margin-bottom: 0.5rem;
}
.fb-correct { background: #d4edda; color: #155724; }
.fb-wrong   { background: #f8d7da; color: #721c24; }

/* ── Spoilers ──────────────────────────────────────────────── */
.q-spoilers { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.spoiler-btn {
    padding: 0.45rem 0.85rem; border: 1px solid #185FA5; color: #185FA5;
    background: #fff; border-radius: 5px; cursor: pointer;
    font-size: 0.82rem; font-weight: 600; transition: all 0.15s;
}
.spoiler-btn:hover { background: #185FA5; color: #fff; }
.spoiler-content {
    padding: 0.6rem 0.75rem; background: #f8fafb; border-left: 3px solid #185FA5;
    border-radius: 0 6px 6px 0; margin-bottom: 0.4rem; font-size: 0.92rem;
}

/* ── Class-chose bars ──────────────────────────────────────── */
.class-bar-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.3rem; }
.bar-label { font-weight: 700; width: 1.2rem; text-align: center; color: #185FA5; }
.bar-track {
    flex: 1; height: 18px; background: #e8eef4; border-radius: 9px; overflow: hidden;
}
.bar-fill {
    height: 100%; background: #185FA5; border-radius: 9px;
    transition: width 0.5s ease;
}
.bar-pct { font-size: 0.82rem; color: #555; min-width: 3rem; }
.bar-row-correct .bar-label { color: #155724; font-weight: 700; }
.bar-row-correct .bar-pct { color: #155724; font-weight: 700; }
.bar-fill-correct { background: #28a745; }
.bar-opt-text { font-size: 0.8rem; color: #555; margin-left: 0.25rem; flex: 1; }
.insufficient { color: #888; font-size: 0.88rem; }
.source-excerpt {
    margin: 0.5rem 0 0; padding: 0.5rem 0.75rem;
    background: #f0f4f8; border-left: 3px solid #a0c4e8;
    font-style: italic; font-size: 0.88rem; color: #444;
    border-radius: 0 4px 4px 0;
}

/* ── Lifeline ──────────────────────────────────────────────── */
.lifeline-area { margin-top: 0.5rem; }
.lifeline-btn {
    padding: 0.5rem 1.25rem; background: linear-gradient(135deg, #0d4a8a, #2980d9);
    color: #fff; border: none; border-radius: 8px; cursor: pointer;
    font-weight: 700; font-size: 0.95rem;
    box-shadow: 0 2px 8px rgba(24,95,165,0.3);
    transition: all 0.2s;
}
.lifeline-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(24,95,165,0.4); }

/* Lifeline glow animation (WWTBAM style) */
@keyframes lifelineGlow {
    0%   { box-shadow: 0 0 5px rgba(24,95,165,0.3); }
    50%  { box-shadow: 0 0 25px rgba(24,95,165,0.7), 0 0 50px rgba(41,128,217,0.4); }
    100% { box-shadow: 0 0 5px rgba(24,95,165,0.3); }
}
.lifeline-glow {
    animation: lifelineGlow 0.75s ease-in-out 2;
    border-color: #2980d9;
}

/* ── History table ─────────────────────────────────────────── */
.history-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.history-table th, .history-table td {
    padding: 0.6rem 1rem; text-align: left; border-bottom: 1px solid #e0e0e0;
}
.history-table th { background: #185FA5; color: #fff; }
.history-table tr:nth-child(even) td { background: #f8fafb; }
.empty-state { color: #888; font-style: italic; margin-top: 1rem; }

/* ── Analytics ─────────────────────────────────────────────── */
.analytics-subtitle { color: #666; margin-bottom: 1.5rem; }
.analytics-card {
    background: #fff; border: 1px solid #d8e2ec; border-radius: 8px;
    padding: 1.25rem; margin-bottom: 1rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.ac-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.ac-rate {
    font-weight: 700; font-size: 0.9rem; padding: 0.2rem 0.6rem;
    border-radius: 5px;
}
.rate-low  { background: #f8d7da; color: #721c24; }
.rate-mid  { background: #fff3cd; color: #856404; }
.rate-high { background: #d4edda; color: #155724; }
.ac-lesson { font-size: 0.82rem; color: #185FA5; font-weight: 600; }
.ac-responses { font-size: 0.8rem; color: #888; }
.ac-question { margin-bottom: 0.75rem; font-size: 0.95rem; }
.ac-bars { margin-top: 0.25rem; }

/* ── Formula sheet ─────────────────────────────────────────── */
.formula-subtitle { color: #666; margin-bottom: 1rem; }
.formula-section { margin-bottom: 2rem; }
.formula-section h2 { color: #185FA5; margin-bottom: 0.75rem; border-bottom: 2px solid #185FA5; padding-bottom: 0.3rem; }
.formula-table {
    width: 100%; border-collapse: collapse; font-size: 0.9rem; margin-top: 0.5rem;
}
.formula-table th, .formula-table td {
    padding: 0.5rem 0.75rem; text-align: left; border: 1px solid #d0dce8;
}
.formula-table th { background: #e3ecf5; color: #185FA5; font-weight: 600; }
.formula-table tr:nth-child(even) td { background: #f8fafb; }
.formula-table code { font-size: 0.85rem; }

/* ── Help page ─────────────────────────────────────────────── */
.help-page { max-width: 700px; margin: 0 auto; }
.help-page h1 { color: #185FA5; margin-bottom: 0.25rem; }
.help-subtitle { color: #666; margin-bottom: 2rem; font-size: 1.05rem; }
.help-section {
    background: #fff; padding: 1.25rem 1.5rem; border-radius: 8px;
    margin-bottom: 1rem; box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.help-section h2 { color: #185FA5; font-size: 1.1rem; margin-bottom: 0.5rem; }
.help-features { margin-left: 1.25rem; }
.help-features > li { margin-bottom: 0.75rem; }
.help-features ul { margin: 0.3rem 0 0 1.25rem; }
.help-features ul li { margin-bottom: 0.2rem; font-size: 0.93rem; }
.help-cta { display: flex; gap: 1rem; justify-content: center; margin: 2rem 0; }
.help-btn {
    padding: 0.7rem 2rem; background: #185FA5; color: #fff;
    text-decoration: none; border-radius: 6px; font-weight: 600; font-size: 1rem;
}
.help-btn:hover { background: #134d87; }
.help-btn-secondary { background: #fff; color: #185FA5; border: 2px solid #185FA5; }
.help-btn-secondary:hover { background: #f0f5fb; }

/* ── Difficulty badge ──────────────────────────────────────── */
.badge { padding: 2px 8px; border-radius: 4px; font-weight: bold; }
.badge.easy { background: #d4edda; color: #155724; }
.badge.medium { background: #fff3cd; color: #856404; }
.badge.hard { background: #f8d7da; color: #721c24; }
.difficulty-badge { margin-bottom: 0.75rem; }
.difficulty-badge summary { cursor: pointer; font-size: 0.85em; color: #666; }

/* ── Open-Ended Practice ───────────────────────────────────── */
.oe-intro { color: #555; margin-bottom: 1.5rem; }
.oe-section { margin-bottom: 2.5rem; }
.oe-section h2 { color: #185FA5; border-bottom: 2px solid #d0e4f5; padding-bottom: 0.4rem; margin-bottom: 1rem; }
.oe-question { background: #f9fbfd; border: 1px solid #d8e8f5; border-radius: 6px; padding: 1rem 1.25rem; margin-bottom: 1rem; }
.oe-num { font-weight: 700; color: #185FA5; margin: 0 0 0.3rem; display: inline-block; }
.oe-question > p:not(.oe-num) { margin: 0 0 0.6rem; }
.oe-question ul, .oe-question ol { margin: 0.25rem 0 0.6rem 1.5rem; }
.oe-question li { margin-bottom: 0.2rem; }
.oe-reveal { margin-top: 0.75rem; }
.oe-reveal summary { cursor: pointer; color: #185FA5; font-weight: 600; font-size: 0.9rem; user-select: none; }
.oe-reveal summary:hover { color: #134d87; }
.oe-answer { margin-top: 0.6rem; padding: 0.75rem 1rem; background: #eaf3fb; border-left: 3px solid #185FA5; border-radius: 0 4px 4px 0; }
.oe-answer p { margin: 0 0 0.5rem; }
.oe-answer p:last-child { margin-bottom: 0; }
.oe-answer ul, .oe-answer ol { margin: 0.25rem 0 0.5rem 1.5rem; }
.oe-answer li { margin-bottom: 0.2rem; }
.oe-source { display: block; margin-top: 0.5rem; font-size: 0.78em; color: #888; font-style: italic; }
.oe-chart-wrap { margin: 0.75rem 0; }
.oe-chart-title { font-size: 0.82em; font-weight: 600; color: #444; margin: 0 0 0.3rem; text-align: center; }
.oe-chart-note { font-size: 0.78em; color: #888; margin: 0.2rem 0 0; text-align: center; font-style: italic; }
.oe-chart-svg { width: 100%; max-width: 500px; display: block; margin: 0 auto; }
.oe-viz-desc { background: #f0f4f8; border: 1px solid #ccd8e8; border-radius: 4px; padding: 0.6rem 0.9rem; margin: 0.5rem 0 0.75rem; font-size: 0.88em; color: #444; }
.oe-source-key { background: #eaf3fb; border: 1px solid #c5dcf0; border-radius: 6px; padding: 0.6rem 1rem; margin-bottom: 1.5rem; font-size: 0.85em; display: flex; flex-direction: column; gap: 0.2rem; }
.oe-source-key span { color: #444; }

/* ── Progress bar ──────────────────────────────────────────── */
.progress-wrap {
    height: 6px; background: #e0e8f0; border-radius: 3px;
    margin-bottom: 1.25rem; overflow: hidden;
}
.progress-fill {
    height: 100%; background: #185FA5; border-radius: 3px;
    width: 0%; transition: width 0.4s ease;
}

/* ── Wrong answer review ───────────────────────────────────── */
.review-panel {
    background: #fff8f8; border: 1px solid #f5c6cb;
    border-radius: 8px; padding: 1.25rem; margin-bottom: 1.5rem;
}
.review-perfect {
    background: #f8fff9; border-color: #c3e6cb; color: #155724;
    text-align: center; font-size: 1.05rem;
}
.review-title { color: #721c24; font-size: 1rem; margin-bottom: 0.75rem; }
.review-item { border-bottom: 1px solid #f5e6e8; padding: 0.75rem 0; }
.review-item:last-child { border-bottom: none; }
.review-q { font-size: 0.92rem; margin-bottom: 0.4rem; }
.review-wrong { color: #721c24; font-size: 0.88rem; margin-bottom: 0.2rem; }
.review-correct { color: #155724; font-size: 0.88rem; margin-bottom: 0.2rem; }
.review-explanation { font-size: 0.83rem; color: #666; font-style: italic; }

/* ── Leaderboard ───────────────────────────────────────────── */
.leaderboard-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.leaderboard-table th, .leaderboard-table td {
    padding: 0.6rem 1rem; text-align: left; border-bottom: 1px solid #e0e0e0;
}
.leaderboard-table th { background: #185FA5; color: #fff; }
.leaderboard-table tr:nth-child(even) td { background: #f8fafb; }
.lb-rank { font-weight: 700; color: #185FA5; font-size: 1.05rem; }
.lb-rank-1 { color: #c8a800; }
.lb-rank-2 { color: #888; }
.lb-rank-3 { color: #a05c2a; }
.lb-name { font-weight: 600; }

/* ── Nav course labels & separators ───────────────────────── */
.nav-course-label {
    font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
    color: #7ab3d8; letter-spacing: 0.06em; padding: 0 0.1rem;
}
.nav-sep {
    width: 1px; height: 1rem; background: rgba(255,255,255,0.2);
    display: inline-block; margin: 0 0.15rem; vertical-align: middle;
}

/* ── Inline FITB inputs (inside question text) ─────────────── */
.fitb-inline {
    border: none; border-bottom: 2px solid #185FA5;
    background: #f0f5fb; padding: 0.1rem 0.4rem;
    font-family: inherit; font-size: 0.95rem;
    width: 9rem; border-radius: 3px 3px 0 0;
    transition: border-color 0.15s, background 0.15s;
    vertical-align: baseline;
}
.fitb-inline:focus { outline: none; border-bottom-color: #0d4a8a; background: #fff; }
.fitb-inline.fitb-correct { border-bottom-color: #28a745; background: #f0fff4; }
.fitb-inline.fitb-wrong   { border-bottom-color: #dc3545; background: #fff5f5; }
.fitb-check-row { margin: 0.75rem 0 0.5rem; }

/* ── Sales FITB / Short Answer Quiz ───────────────────────── */
.q-type-tag {
    font-size: 0.72rem; padding: 0.15rem 0.55rem; border-radius: 10px;
    font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
}
.q-type-fitb { background: #e3f2fd; color: #0d47a1; border: 1px solid #90caf9; }
.q-type-short { background: #f3e5f5; color: #4a148c; border: 1px solid #ce93d8; }

.fitb-input-row {
    display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.75rem;
}
.fitb-input {
    flex: 1; padding: 0.55rem 0.75rem;
    border: 1.5px solid #b8d0e8; border-radius: 6px;
    font-family: inherit; font-size: 0.95rem;
    transition: border-color 0.2s, background 0.2s;
}
.fitb-input:focus { outline: none; border-color: #185FA5; background: #fff; }
.fitb-input:disabled { cursor: default; }
.fitb-correct { border-color: #28a745 !important; background: #f0fff4 !important; }
.fitb-wrong   { border-color: #dc3545 !important; background: #fff5f5 !important; }

.fitb-textarea {
    width: 100%; min-height: 80px; margin-bottom: 0.6rem;
    padding: 0.6rem 0.75rem; border: 1.5px solid #b8d0e8; border-radius: 6px;
    font-family: inherit; font-size: 0.9rem; color: #1a1a1a;
    resize: vertical; line-height: 1.5;
    transition: border-color 0.2s, background 0.2s;
}
.fitb-textarea:focus { outline: none; border-color: #185FA5; background: #fff; }

.sa-btn-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.sa-correct-btn, .sa-wrong-btn {
    padding: 0.4rem 1rem; border: none; border-radius: 6px;
    font-weight: 600; font-size: 0.88rem; cursor: pointer;
    display: inline-flex; align-items: center;
}
.sa-correct-btn { background: #28a745; color: #fff; }
.sa-correct-btn:hover { background: #218838; }
.sa-wrong-btn { background: #dc3545; color: #fff; }
.sa-wrong-btn:hover { background: #c82333; }

/* ── Worksheet ─────────────────────────────────────────────── */
.ws-toolbar {
    display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
    margin-bottom: 1.25rem;
}
.ws-toolbar-note { font-size: 0.8rem; color: #888; font-style: italic; }

.worksheet {
    max-width: 820px; margin: 0 auto; background: #fff;
    padding: 2rem 2.5rem; border: 1px solid #ccd5df;
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
    font-size: 0.95rem; line-height: 1.6;
}

/* Header */
.ws-header { text-align: center; border-bottom: 2.5px solid #1a1a1a; padding-bottom: 1rem; margin-bottom: 1rem; }
.ws-title { font-size: 1.55rem; font-weight: 900; letter-spacing: 0.04em; text-transform: uppercase; }
.ws-subtitle { font-size: 1rem; color: #444; margin-top: 0.2rem; }
.ws-meta-row { display: flex; gap: 2.5rem; justify-content: center; margin-top: 0.75rem; font-size: 0.95rem; }
.ws-meta-input { border: none; border-bottom: 1px solid #555; width: 9rem; font-size: 0.95rem; outline: none; background: transparent; margin-left: 0.4rem; }
.ws-intro-text { color: #555; margin-bottom: 1.5rem; font-style: italic; font-size: 0.92rem; }

/* Topic blocks */
.ws-topic { border: 1.5px solid #c5d2de; border-radius: 6px; padding: 1.25rem 1.5rem; margin-bottom: 1.5rem; }
.ws-topic-hdr { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.85rem; flex-wrap: wrap; gap: 0.5rem; }
.ws-topic-title { font-size: 1.05rem; font-weight: 700; color: #185FA5; }
.ws-time { font-size: 0.8rem; color: #888; font-style: italic; }
.ws-memory-tip { background: #f5f8fb; border-left: 3px solid #185FA5; padding: 0.5rem 0.75rem; border-radius: 0 4px 4px 0; margin-top: 1rem; font-size: 0.9rem; color: #333; }
.ws-inline-q { margin: 0.75rem 0; }

/* Inputs */
.ws-input {
    border: none; border-bottom: 1.5px solid #5a87b5;
    background: #f4f7fb; padding: 0.2rem 0.5rem;
    font-family: inherit; font-size: 0.92rem;
    border-radius: 3px 3px 0 0; outline: none;
    transition: border-color 0.15s, background 0.15s;
    vertical-align: baseline;
}
.ws-input:focus { border-bottom-color: #185FA5; background: #fff; }
.ws-input.ws-correct { border-bottom-color: #28a745; background: #f0fff4; }
.ws-input.ws-wrong   { border-bottom-color: #dc3545; background: #fff5f5; }
.ws-input-xs  { width: 3rem; text-align: center; }
.ws-input-sm  { width: 7rem; }
.ws-input-md  { width: 11rem; }
.ws-input-full { width: 100%; box-sizing: border-box; }
.ws-input-num { width: 2.5rem; text-align: center; }

/* Textareas */
.ws-textarea {
    width: 100%; min-height: 60px; border: 1px solid #b8d0e8;
    border-radius: 4px; background: #f8fafc; font-family: inherit;
    font-size: 0.88rem; padding: 0.4rem 0.6rem; resize: vertical; outline: none;
    transition: border-color 0.15s, background 0.15s;
}
.ws-textarea:focus { border-color: #185FA5; background: #fff; }
.ws-textarea.ws-correct { border-color: #28a745; background: #f0fff4; }
.ws-textarea.ws-wrong   { border-color: #dc3545; background: #fff5f5; }
.ws-textarea-wide { min-height: 80px; margin-top: 0.4rem; }

/* Systems Thinking diagram */
.ws-diagram { margin: 1.25rem 0; }
.ws-diagram-flow { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.ws-diagram-box {
  border: 2px solid #185FA5;
  border-radius: 6px;
  padding: 0.5rem 0.9rem;
  background: #f4f8fd;
  min-width: 90px;
  text-align: center;
}
.ws-diagram-lbl {
  font-size: 0.72rem;
  font-weight: 700;
  color: #185FA5;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
}
.ws-diagram-arrow { font-size: 1.4rem; color: #185FA5; line-height: 1; }
.ws-diagram-feedback-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.6rem;
  padding-top: 0.4rem;
  border-top: 1.5px dashed #bbb;
}
.ws-diagram-feedback-line {
  font-size: 0.8rem;
  color: #888;
  font-style: italic;
  white-space: nowrap;
}

/* Steps grid */
.ws-steps-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem 1.5rem; margin: 0.75rem 0; }
.ws-step { display: flex; align-items: center; gap: 0.5rem; font-size: 0.93rem; }

/* Match / practice lists */
.ws-match-list { display: flex; flex-direction: column; gap: 0.5rem; margin: 0.75rem 0; }
.ws-match-row { display: flex; align-items: flex-start; gap: 0.75rem; }
.ws-match-row span { flex: 1; padding-top: 0.2rem; }
.ws-practice-list { display: flex; flex-direction: column; gap: 0.5rem; margin: 0.75rem 0; }
.ws-practice-row { display: flex; align-items: flex-start; gap: 0.75rem; flex-wrap: wrap; }
.ws-practice-row span { flex: 1; min-width: 200px; padding-top: 0.2rem; font-style: italic; }

/* Tables */
.ws-table { width: 100%; border-collapse: collapse; margin: 0.75rem 0; font-size: 0.9rem; }
.ws-table th, .ws-table td { border: 1px solid #c0cdd8; padding: 0.45rem 0.6rem; text-align: left; vertical-align: top; }
.ws-table th { background: #e3ecf5; color: #185FA5; font-weight: 700; }
.ws-table-trust td:first-child { white-space: nowrap; }
.ws-td-letter { font-weight: 700; font-size: 1.05rem; text-align: center; width: 2rem; }
.ws-td-label { white-space: nowrap; font-size: 0.88rem; width: 10rem; }
.ws-table-fb th { width: 50%; }

/* Buyer type cards */
.ws-buyer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin: 0.75rem 0; }
.ws-buyer-card { border: 1.5px solid #c5d2de; border-radius: 5px; padding: 0.75rem; background: #f9fbfd; font-size: 0.88rem; }
.ws-buyer-name { font-weight: 700; color: #185FA5; margin-bottom: 0.3rem; font-size: 0.92rem; }
.ws-buyer-eg { color: #888; font-size: 0.82rem; margin-top: 0.3rem; }

/* F vs B list */
.ws-fb-list { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.75rem; }
.ws-fb-row { display: flex; align-items: baseline; gap: 0.75rem; }
.ws-fb-row span { font-style: italic; }

/* Golden Circle diagram */
.ws-gc-wrap { display: flex; justify-content: center; margin: 1rem 0; }
.ws-gc-outer {
    width: 220px; height: 220px; border-radius: 50%;
    border: 2.5px solid #185FA5; background: #e8f0f8;
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    padding-top: 10px; position: relative;
}
.ws-gc-mid {
    width: 155px; height: 155px; border-radius: 50%;
    border: 2.5px solid #185FA5; background: #cddcee;
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    padding-top: 8px; margin-top: 5px; position: relative;
}
.ws-gc-inner {
    width: 90px; height: 90px; border-radius: 50%;
    border: 2.5px solid #185FA5; background: #185FA5;
    display: flex; align-items: center; justify-content: center;
    margin-top: 5px;
}
.ws-gc-input {
  width: 80px;
  background: transparent;
  border: none;
  border-bottom: 2px solid #185FA5;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #333;
  padding: 2px 4px;
  outline: none;
}
.ws-gc-input::placeholder { color: #aaa; font-weight: 400; font-size: 0.72rem; letter-spacing: 0; }
.ws-gc-input-inner {
  width: 60px;
  border-bottom-color: rgba(255,255,255,0.8);
  color: #fff;
}
.ws-gc-input-inner::placeholder { color: rgba(255,255,255,0.6); }
.ws-gc-input.ws-correct { border-bottom-color: #28a745; color: #155724; }
.ws-gc-input.ws-wrong  { border-bottom-color: #dc3545; color: #721c24; }

/* Self-check */
.ws-self-check { background: #f8fafb; }
.ws-check-title { color: #333 !important; }
.ws-checklist { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.75rem; }
.ws-check-item { display: flex; align-items: flex-start; gap: 0.6rem; font-size: 0.92rem; cursor: pointer; }
.ws-check-item input[type=checkbox] { margin-top: 0.2rem; flex-shrink: 0; width: 1rem; height: 1rem; accent-color: #185FA5; }

/* Footer */
.ws-footer { text-align: center; margin-top: 1.5rem; font-size: 0.85rem; color: #888; border-top: 1px solid #ddd; padding-top: 0.75rem; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 600px) {
    .navbar { flex-direction: column; align-items: flex-start; }
    .container { margin: 1rem auto; }
    .quiz-controls { flex-direction: column; align-items: stretch; }
    .quiz-controls select { width: 100%; }
    .lesson-tabs { gap: 0.15rem; }
    .tab-btn { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
    .formula-table { font-size: 0.8rem; }
    .formula-table th, .formula-table td { padding: 0.35rem 0.5rem; }
    .notes-table { font-size: 0.85rem; }
}

/* ── Practice Exam ──────────────────────────────────────────── */
.exam-header-bar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
}
.exam-intro { color: #555; font-size: 0.9rem; margin-top: 0.25rem; max-width: 600px; }
.exam-main-btn {
    flex-shrink: 0;
    padding: 0.6rem 1.25rem;
    background: #185FA5;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}
.exam-main-btn:hover { background: #134982; }
.exam-section-wrap {
    background: #fff;
    border: 1px solid #d6e4f0;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}
.exam-sec-hdr {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.exam-sec-title {
    font-size: 1.15rem;
    color: #185FA5;
    margin: 0 0 0.2rem;
}
.exam-sec-label {
    font-size: 0.95rem;
    color: #555;
    font-weight: 400;
}
.exam-sec-desc { font-size: 0.82rem; color: #666; margin: 0; }
.exam-reshuffle-btn {
    flex-shrink: 0;
    padding: 0.35rem 0.9rem;
    border: 1.5px solid #185FA5;
    border-radius: 20px;
    background: #fff;
    color: #185FA5;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.exam-reshuffle-btn:hover { background: #185FA5; color: #fff; }
.exam-loading { color: #888; font-style: italic; padding: 1rem 0; }
/* MC cards */
.exam-mc-card {
    border: 1px solid #e0e8f0;
    border-radius: 8px;
    padding: 1rem 1.1rem;
    margin-bottom: 1rem;
    background: #fafcff;
    transition: border-color 0.2s;
}
.exam-mc-card.answered { border-left: 4px solid #185FA5; }
.exam-q-num { font-weight: 700; color: #185FA5; margin-bottom: 0.3rem; font-size: 0.9rem; }
.exam-q-text { margin-bottom: 0.75rem; line-height: 1.55; }
.exam-opts { display: flex; flex-direction: column; gap: 0.4rem; }
.exam-opt-btn {
    text-align: left;
    padding: 0.45rem 0.8rem;
    border: 1.5px solid #c8d8e8;
    border-radius: 6px;
    background: #fff;
    font-family: inherit;
    font-size: 0.88rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    line-height: 1.45;
}
.exam-opt-btn:hover:not(:disabled) { background: #e8f0fa; border-color: #185FA5; }
.exam-opt-btn:disabled { cursor: default; }
.exam-opt-btn.exam-opt-correct { background: #d4edda; border-color: #28a745; color: #155724; font-weight: 600; }
.exam-opt-btn.exam-opt-wrong  { background: #f8d7da; border-color: #dc3545; color: #721c24; }
.exam-opt-letter { font-weight: 700; }
.exam-mc-explain {
    margin-top: 0.75rem;
    padding: 0.6rem 0.8rem;
    background: #f0f6fc;
    border-left: 3px solid #185FA5;
    border-radius: 0 4px 4px 0;
    font-size: 0.875rem;
    color: #333;
}
/* Written + Viz cards reuse oe-question styles; just need spacing */
#written-display .oe-question,
#viz-display .oe-question {
    margin-bottom: 1.25rem;
}

/* ── Open-ended filter bar ──────────────────────────────────── */
.oe-filter-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.oe-filter-btn {
    padding: 0.4rem 1rem;
    border: 1.5px solid #185FA5;
    border-radius: 20px;
    background: #fff;
    color: #185FA5;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.oe-filter-btn:hover { background: #e8f0fa; }
.oe-filter-btn.active { background: #185FA5; color: #fff; }

/* ── Open-ended question type badge ─────────────────────────── */
.oe-type-badge {
    float: right;
    font-size: 0.7rem;
    padding: 0.15rem 0.55rem;
    border-radius: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.oe-type-classify { background: #fff3cd; color: #856404; border: 1px solid #ffc107; }
.oe-type-written  { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ── Open-ended inline check inputs ────────────────────────── */
.oe-check-input {
    margin-left: 0.5rem;
    padding: 0.15rem 0.5rem;
    border: 1px solid #b8d0e8;
    border-radius: 4px;
    background: #f0f6fc;
    font-family: inherit;
    font-size: 0.88rem;
    width: 11rem;
    vertical-align: middle;
    transition: border-color 0.2s, background 0.2s;
}
.oe-check-input:focus { outline: none; border-color: #185FA5; background: #fff; }
.oe-check-input.oe-check-correct { border-color: #28a745; background: #f0fff4; }
.oe-check-input.oe-check-wrong   { border-color: #dc3545; background: #fff5f5; }
.oe-check-result { font-weight: 700; font-size: 1rem; }
.oe-check-result.oe-check-ok  { color: #155724; }
.oe-check-result.oe-check-bad { color: #721c24; }

/* ── Open-ended scratch pad ─────────────────────────────────── */
.oe-scratch {
    margin: 0.75rem 0 0.5rem;
}
.oe-scratch label {
    display: block;
    font-size: 0.78rem;
    color: #555;
    margin-bottom: 0.3rem;
    font-style: italic;
}
.oe-scratch textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.6rem 0.75rem;
    border: 1px solid #b8d0e8;
    border-radius: 6px;
    background: #f0f6fc;
    font-family: inherit;
    font-size: 0.9rem;
    color: #1a1a1a;
    resize: vertical;
    line-height: 1.5;
    transition: border-color 0.2s, background 0.2s;
}
.oe-scratch textarea:focus {
    outline: none;
    border-color: #185FA5;
    background: #fff;
}
