/* ============================================================
   IELTS 7.0 Grammar Trainer — Stylesheet
   ============================================================ */

:root {
    --primary: #4f46e5;
    --primary-light: #818cf8;
    --primary-dark: #3730a3;
    --success: #10b981;
    --success-light: #d1fae5;
    --error: #ef4444;
    --error-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --radius: 12px;
    --radius-sm: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: white;
    padding: 32px 0;
    text-align: center;
}
.header h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: 4px; }
.header .subtitle { font-size: 0.95rem; opacity: 0.85; }

/* Stats Bar */
.stats-bar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}
.stats-bar .container {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 12px;
}
.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
}
.stat-icon { font-size: 1.2rem; }
.stat-label { color: var(--text-secondary); }
.stat-value { font-weight: 700; color: var(--primary); font-size: 1rem; min-width: 30px; }

/* Tab Nav */
.tab-nav {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}
.tab-nav .container {
    display: flex;
    gap: 0;
}
.tab-btn {
    flex: 1;
    padding: 16px 12px;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: center;
    border-bottom: 3px solid transparent;
    transition: all .2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--text-secondary);
}
.tab-btn:hover { background: #f1f5f9; color: var(--text); }
.tab-btn.active {
    border-bottom-color: var(--primary);
    color: var(--primary);
    background: #eef2ff;
}
.tab-icon { font-size: 1.25rem; }
.tab-title { font-weight: 600; font-size: 0.9rem; }
.tab-desc { font-size: 0.75rem; opacity: 0.7; }

/* Main Content */
.main-content { padding: 24px 20px 48px; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Section Header */
.section-header {
    margin-bottom: 20px;
}
.section-header h2 {
    font-size: 1.5rem;
    margin-bottom: 4px;
}
.section-header > p {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.filter-bar select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    background: var(--bg-card);
    color: var(--text);
    cursor: pointer;
    min-width: 180px;
}

/* Question Card */
.question-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}
.question-number {
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 12px;
}

/* Section 1: Sentence & Choices */
.question-sentence {
    font-size: 1.15rem;
    line-height: 1.7;
    padding: 16px 20px;
    background: #f8fafc;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    border-left: 4px solid var(--primary);
    color: var(--text);
}
.question-sentence .blank {
    display: inline-block;
    border-bottom: 3px solid var(--primary);
    min-width: 80px;
    text-align: center;
    font-weight: 700;
    color: var(--primary);
    padding: 0 4px;
    margin: 0 2px;
}

.choices-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}
.choice-btn {
    padding: 14px 18px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    cursor: pointer;
    font-size: 0.95rem;
    transition: all .15s;
    text-align: center;
    font-weight: 500;
}
.choice-btn:hover {
    border-color: var(--primary-light);
    background: #eef2ff;
}
.choice-btn.selected {
    border-color: var(--primary);
    background: #eef2ff;
    color: var(--primary-dark);
}
.choice-btn.correct {
    border-color: var(--success);
    background: var(--success-light);
    color: #065f46;
}
.choice-btn.incorrect {
    border-color: var(--error);
    background: var(--error-light);
    color: #991b1b;
}
.choice-btn:disabled { pointer-events: none; }

/* Section 1: Vertical choices (for longer options) */
.choices-vertical {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}
.choices-vertical .choice-btn {
    text-align: left;
    padding: 16px 18px;
}

/* Section 2: Incorrect sentence */
.incorrect-sentence-box {
    background: var(--error-light);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    margin-bottom: 20px;
    border-left: 4px solid var(--error);
}
.label-incorrect {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--error);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.incorrect-sentence {
    font-size: 1.1rem;
    color: #991b1b;
    text-decoration: line-through;
    text-decoration-color: var(--error);
    text-decoration-thickness: 2px;
}

.correct-input-area { margin-bottom: 16px; }
.label-correct {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--success);
    margin-bottom: 6px;
    display: block;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.correction-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1.05rem;
    font-family: inherit;
    transition: border-color .15s;
    background: #fafffe;
}
.correction-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Feedback */
.feedback-area {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    font-weight: 500;
    line-height: 1.5;
}
.feedback-area.correct {
    background: var(--success-light);
    color: #065f46;
    border: 1px solid #a7f3d0;
}
.feedback-area.incorrect {
    background: var(--error-light);
    color: #991b1b;
    border: 1px solid #fecaca;
}
.feedback-area .explanation {
    font-size: 0.85rem;
    margin-top: 6px;
    opacity: 0.85;
    font-weight: 400;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    font-family: inherit;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-next { background: var(--primary); color: white; }
.btn-next:hover { background: var(--primary-dark); }
.btn-start { background: var(--success); color: white; }
.btn-start:hover { background: #059669; }
.btn-secondary { background: #f1f5f9; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e2e8f0; }

/* Progress bar */
.progress-bar-container {
    background: var(--border);
    border-radius: 10px;
    height: 6px;
    margin-bottom: 12px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--success));
    border-radius: 10px;
    transition: width .3s ease;
    width: 0%;
}

/* Question bank info */
.question-bank-info {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 8px 0;
}

/* Essay section */
.essay-progress {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    padding: 12px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.context-card {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}
.context-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #92400e;
    margin-bottom: 10px;
}
.context-text {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text);
}
.context-text .essay-sentence {
    margin-bottom: 8px;
    padding: 6px 10px;
    background: white;
    border-radius: 6px;
    border-left: 3px solid var(--primary);
}

.complete-card {
    text-align: center;
    padding: 40px 20px;
    background: var(--bg-card);
    border: 2px solid var(--success);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}
.complete-card h3 { font-size: 1.5rem; margin-bottom: 12px; }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius);
    max-width: 800px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-card);
}
.modal-header h3 { font-size: 1.1rem; }
.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 4px;
}
.modal-close:hover { background: #f1f5f9; }
.modal-body {
    padding: 20px;
    line-height: 1.8;
    white-space: pre-line;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    margin-top: 20px;
}

/* Responsive */
@media (max-width: 640px) {
    .header h1 { font-size: 1.3rem; }
    .tab-btn { padding: 12px 8px; }
    .tab-title { font-size: 0.8rem; }
    .tab-desc { font-size: 0.7rem; }
    .choices-grid { grid-template-columns: 1fr; }
    .stats-bar .container { gap: 8px; }
    .question-sentence { font-size: 1rem; }
    .filter-bar select { min-width: 140px; flex: 1; }
}

/* Section 4: Spelling Game */
.spelling-display {
    text-align: center;
    padding: 20px;
    margin-bottom: 20px;
}
.spelling-definition {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}
.spelling-example {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-style: italic;
    padding: 12px 18px;
    background: #f1f5f9;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary-light);
    text-align: left;
    margin-top: 12px;
}
.spelling-example .blank-word {
    display: inline-block;
    border-bottom: 2px dashed var(--primary);
    min-width: 100px;
    text-align: center;
}
.spelling-hint {
    margin-top: 10px;
    font-size: 0.9rem;
    color: var(--warning);
    font-weight: 500;
}
.spelling-input-area {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.spelling-input {
    flex: 1;
    min-width: 200px;
    padding: 14px 18px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1.2rem;
    font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
    letter-spacing: 0.05em;
    transition: border-color .15s;
}
.spelling-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.spelling-input.correct-input {
    border-color: var(--success);
    background: var(--success-light);
}
.spelling-input.incorrect-input {
    border-color: var(--error);
    background: var(--error-light);
}

.misspelled-card {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}
.misspelled-card h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: #9a3412;
}
.misspelled-word {
    display: inline-block;
    padding: 4px 12px;
    margin: 4px;
    background: white;
    border: 1px solid #fed7aa;
    border-radius: 20px;
    font-size: 0.9rem;
    font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
}
.misspelled-word .wrong {
    color: var(--error);
    text-decoration: line-through;
    margin-right: 6px;
}
.misspelled-word .correct-spelling {
    color: var(--success);
    font-weight: 600;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.question-card, .context-card { animation: fadeIn .25s ease; }
.feedback-area { animation: fadeIn .2s ease; }

/* ============================================================
   v2 additions: multi-page nav, auth, dashboard
   ============================================================ */

/* Header as flex with user menu */
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.brand {
    color: white;
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 700;
}
.user-menu { display: flex; align-items: center; gap: 12px; font-size: 0.9rem; }
.user-name { color: rgba(255,255,255,.9); }
.logout-link {
    color: white;
    text-decoration: none;
    background: rgba(255,255,255,.15);
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
}
.logout-link:hover { background: rgba(255,255,255,.28); }
.header { padding: 18px 0; }

/* Nav as links, horizontally scrollable */
.tab-nav-inner {
    display: flex;
    gap: 0;
    overflow-x: auto;
}
.tab-nav-inner::-webkit-scrollbar { height: 0; }
a.tab-btn {
    text-decoration: none;
    min-width: 96px;
    gap: 4px;
}
.tab-btn .tab-title { font-size: 0.82rem; }

/* Stats bar: flex container directly (no inner .container) */
.stats-bar {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 12px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    padding: 14px 18px;
    position: static;
}

/* ---------- Auth pages ---------- */
.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    padding: 20px;
}
.auth-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 36px 32px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.auth-title { font-size: 1.4rem; text-align: center; margin-bottom: 4px; }
.auth-subtitle { text-align: center; color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 24px; }
.auth-form { display: flex; flex-direction: column; gap: 6px; }
.auth-form label { font-size: 0.85rem; font-weight: 600; margin-top: 10px; }
.auth-form label small { font-weight: 400; color: var(--text-secondary); }
.auth-form input {
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
}
.auth-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.btn-block { width: 100%; margin-top: 18px; padding: 12px; font-size: 1rem; }
.auth-switch { text-align: center; margin-top: 18px; font-size: 0.9rem; color: var(--text-secondary); }
.auth-switch a { color: var(--primary); font-weight: 600; text-decoration: none; }
.auth-error {
    background: var(--error-light);
    color: #991b1b;
    border: 1px solid #fecaca;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 16px;
    text-align: center;
}

/* ---------- Dashboard ---------- */
.dash-overview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}
.dash-stat {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
}
.dash-stat-value { font-size: 2rem; font-weight: 800; color: var(--primary); }
.dash-stat-label { font-size: 0.85rem; color: var(--text-secondary); margin-top: 4px; }

.dash-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 18px;
    box-shadow: var(--shadow);
}
.dash-card h3 { font-size: 1rem; margin-bottom: 14px; }
.muted { color: var(--text-secondary); font-size: 0.9rem; }

/* Section tiles */
.section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}
.section-tile {
    display: block;
    text-decoration: none;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    transition: all .15s;
}
.section-tile:hover { border-color: var(--primary-light); background: #f8faff; transform: translateY(-2px); }
.section-tile-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.section-tile-icon { font-size: 1.3rem; }
.section-tile-title { font-weight: 600; font-size: 0.9rem; }
.section-tile-stats { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.tile-accuracy { font-size: 1.4rem; font-weight: 800; color: var(--text-secondary); }
.tile-accuracy.good { color: var(--success); }
.tile-accuracy.ok { color: var(--warning); }
.tile-accuracy.low { color: var(--error); }
.tile-count { font-size: 0.8rem; color: var(--text-secondary); }
.tile-bar { background: var(--border); border-radius: 8px; height: 6px; overflow: hidden; }
.tile-bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), var(--success)); border-radius: 8px; transition: width .4s; }

/* Daily chart */
.daily-chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 120px;
    padding-top: 10px;
}
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.chart-bar { width: 70%; min-height: 3px; background: var(--primary); border-radius: 4px 4px 0 0; transition: height .3s; }
.chart-day { font-size: 0.65rem; color: var(--text-secondary); margin-top: 4px; white-space: nowrap; }

/* Recent list */
.recent-list { display: flex; flex-direction: column; gap: 6px; }
.recent-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}
.recent-section { font-weight: 600; flex: 1; }
.recent-time { color: var(--text-secondary); font-size: 0.78rem; }

.s5-instruction { white-space: pre-line; font-weight: 600; margin-bottom: 14px; color: var(--text); }
.choice-btn.selected { border-color: var(--primary); background: #eef2ff; }

@media (max-width: 640px) {
    .dash-overview { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
    .dash-stat { padding: 14px 8px; }
    .dash-stat-value { font-size: 1.4rem; }
    a.tab-btn { min-width: 78px; }
}

/* ============================================================
   Daily Test
   ============================================================ */

.tab-daily.active, .tab-daily:hover { color: var(--warning); }
.tab-daily.active { border-bottom-color: var(--warning); background: #fffbeb; }

.daily-status {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}
.daily-status-row {
    display: flex;
    justify-content: space-around;
    font-size: 0.9rem;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
}
.daily-status-row strong { color: var(--primary); }

.dt-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.dt-num {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: .05em;
}
.dt-label {
    font-size: 0.75rem;
    background: #eef2ff;
    color: var(--primary-dark);
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 600;
}
.dt-input-area { display: flex; gap: 10px; flex-wrap: wrap; }
.dt-input-area .correction-input { flex: 1; min-width: 220px; }

/* Report hero */
.report-hero {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: white;
    border-radius: var(--radius);
    padding: 28px 20px;
    text-align: center;
    margin-bottom: 18px;
    box-shadow: var(--shadow-md);
}
.report-grade { font-size: 1.2rem; margin-bottom: 8px; }
.report-big { display: flex; flex-direction: column; align-items: center; }
.report-errrate { font-size: 3rem; font-weight: 800; line-height: 1; }
.report-errlabel { font-size: 0.85rem; opacity: .85; margin-top: 4px; }
.report-sub { margin-top: 12px; font-size: 0.9rem; opacity: .9; }

/* Per-section rows */
.report-section-row, .history-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}
.report-section-row:last-child, .history-row:last-child { border-bottom: none; }
.rs-label, .hist-date { flex: 0 0 130px; font-weight: 600; }
.rs-count, .hist-score { flex: 0 0 50px; color: var(--text-secondary); }
.rs-bar { flex: 1; background: var(--border); height: 8px; border-radius: 8px; overflow: hidden; min-width: 60px; }
.rs-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--success)); border-radius: 8px; }
.rs-err { flex: 0 0 90px; text-align: right; font-weight: 700; }
.rs-err.low { color: var(--success); }
.rs-err.mid { color: var(--warning); }
.rs-err.high { color: var(--error); }

/* Wrong answer review */
.wrong-item {
    padding: 12px 14px;
    background: #fef2f2;
    border-left: 3px solid var(--error);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
}
.wrong-tag {
    font-size: 0.7rem;
    background: white;
    color: var(--error);
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
    border: 1px solid #fecaca;
}
.wrong-prompt { margin: 8px 0; font-size: 0.9rem; line-height: 1.5; }
.wrong-answers { display: flex; flex-direction: column; gap: 3px; font-size: 0.82rem; font-family: 'SF Mono', Monaco, monospace; }
.wa-yours { color: var(--error); }
.wa-correct { color: var(--success); font-weight: 600; }
.wrong-expl { margin-top: 6px; font-size: 0.8rem; color: var(--text-secondary); font-style: italic; }

@media (max-width: 640px) {
    .rs-label, .hist-date { flex: 0 0 90px; font-size: 0.78rem; }
    .rs-err { flex: 0 0 70px; font-size: 0.78rem; }
    .report-errrate { font-size: 2.2rem; }
}
