:root {
    --blue: #0055A4;
    --red: #EF4135;
    --bg: #f7f8fa;
    --card: #ffffff;
    --text: #1c1f26;
    --muted: #6b7280;
    --border: #e5e7eb;
    --good: #16a34a;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}
.topbar {
    background: var(--blue);
    color: white;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.brand { font-size: 1.2rem; font-weight: 700; }
.stats { display: flex; gap: 8px; }
.pill {
    background: rgba(255,255,255,0.18);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
}
.tabs {
    display: flex;
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    gap: 4px;
    overflow-x: auto;
}
.tabs a {
    padding: 12px 16px;
    text-decoration: none;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}
.tabs a.active { color: var(--blue); border-bottom-color: var(--blue); }
.sub-tabs { padding: 0; margin-bottom: 16px; border-bottom: 1px solid var(--border); background: transparent; }
.container { max-width: 960px; margin: 0 auto; padding: 24px; }
h1 { font-size: 1.6rem; margin-bottom: 16px; }
h3 { margin-top: 0; font-size: 1rem; }
.category-heading { margin: 16px 0 8px; color: var(--blue); font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.03em; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}
.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.bar-label { width: 90px; font-size: 0.85rem; color: var(--muted); }
.bar-track { flex: 1; height: 10px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--blue), var(--red)); border-radius: 999px; }
.bar-value { width: 50px; text-align: right; font-size: 0.8rem; color: var(--muted); }
.big-number { font-size: 2.4rem; font-weight: 800; margin: 4px 0; color: var(--blue); }
.muted { color: var(--muted); font-size: 0.9rem; }
.small { font-size: 0.78rem; }
.btn {
    display: inline-block;
    background: var(--blue);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9rem;
}
.btn-again { background: #b91c1c; }
.btn-hard { background: #d97706; }
.btn-good { background: #2563eb; }
.btn-easy { background: var(--good); }
.review-buttons { display: flex; gap: 8px; margin-top: 12px; }
.review-buttons button { flex: 1; }
.flashcard { text-align: center; padding: 20px 0; }
.fc-word { font-size: 2rem; font-weight: 700; margin-bottom: 12px; }
.fc-answer { margin-top: 12px; }
details summary { cursor: pointer; color: var(--blue); font-weight: 600; }
.checklist-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.checkbox {
    width: 22px; height: 22px; border-radius: 6px;
    border: 2px solid var(--border); background: white;
    cursor: pointer; color: white; font-size: 0.8rem;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.checkbox.checked { background: var(--good); border-color: var(--good); }
.strike { text-decoration: line-through; color: var(--muted); }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form input, .inline-form select {
    padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.9rem;
}
.inline-form.wrap input, .inline-form.wrap select { max-width: 140px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.data-table th, .data-table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); }
.data-table th { color: var(--muted); font-weight: 600; }
.heatmap { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; }
.heat-cell { width: 100%; padding-top: 100%; border-radius: 3px; background: var(--bg); position: relative; }
.heat-0 { background: #eef0f3; }
.heat-1 { background: #bcd7ec; }
.heat-2 { background: #6fa8d8; }
.heat-3 { background: #2c74b3; }
.heat-4 { background: #0055A4; }

/* Curriculum / units */
.unit-list { display: flex; flex-direction: column; gap: 6px; }
.unit-row {
    display: flex; align-items: center; gap: 12px;
    padding: 12px; border-radius: 10px; text-decoration: none; color: var(--text);
    border: 1px solid var(--border); background: var(--bg);
}
.unit-row:hover { border-color: var(--blue); }
.unit-locked { opacity: 0.55; }
.unit-done { background: #ecfdf5; border-color: #a7f3d0; }
.unit-num {
    width: 30px; height: 30px; border-radius: 50%; background: var(--blue); color: white;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem;
    flex-shrink: 0;
}
.unit-done .unit-num { background: var(--good); }
.unit-locked .unit-num { background: #9ca3af; }
.unit-info { display: flex; flex-direction: column; flex: 1; }
.unit-arrow { color: var(--blue); font-weight: 700; }

/* Lesson content */
.section-tag {
    display: inline-block; font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.04em; padding: 3px 8px; border-radius: 999px; margin-bottom: 8px;
    background: #eef2ff; color: var(--blue);
}
.section-reading { background: #fef3c7; color: #92400e; }
.section-culture { background: #fce7f3; color: #9d174d; }
.section-vocab { background: #dcfce7; color: #166534; }
.lesson-body { line-height: 1.6; }
.lesson-table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.lesson-table th, .lesson-table td { border: 1px solid var(--border); padding: 8px; text-align: left; }
.lesson-table th { background: var(--bg); }
.dialogue p { margin: 6px 0; }

/* Exercises */
.exercise { padding: 14px 0; border-bottom: 1px solid var(--border); }
.exercise:last-child { border-bottom: none; }
.ex-q { font-weight: 600; margin-bottom: 8px; }
.ex-options { display: flex; flex-wrap: wrap; gap: 8px; }
.ex-opt {
    padding: 8px 14px; border: 1px solid var(--border); border-radius: 8px; background: white;
    cursor: pointer; font-size: 0.9rem;
}
.ex-opt.selected { border-color: var(--blue); background: #eef2ff; }
.ex-fill { display: flex; gap: 8px; }
.ex-fill input { flex: 1; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; }
.ex-feedback { margin-top: 8px; font-size: 0.88rem; font-weight: 600; min-height: 1.2em; }
.ex-correct { color: var(--good); }
.ex-incorrect { color: #b91c1c; }
.success-banner { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; font-weight: 600; }
