/* DevsMax Learn. Phone first: students mostly study on a phone. */

:root {
    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-2: #f0f2f8;
    --border: #e1e4ee;
    --text: #1b1f2e;
    --muted: #5d6478;
    --primary: #3346d3;
    --primary-hover: #2837b3;
    --primary-ink: #ffffff;
    --primary-soft: #e8ebfd;
    --success: #127a47;
    --success-soft: #e3f5ec;
    --warn: #8a5a00;
    --warn-soft: #fff3d9;
    --danger: #b4232f;
    --danger-soft: #fde8ea;
    --focus: #6c7cf0;

    /* Mastery steps: Not started, Learning, Practising, Secure, Exam-ready */
    --s0-bg: #eceef3; --s0-fg: #4c5366;
    --s1-bg: #e1edfd; --s1-fg: #1f56a8;
    --s2-bg: #fff0d4; --s2-fg: #885300;
    --s3-bg: #dcf4e6; --s3-fg: #106c3f;
    --s4-bg: #ece3fd; --s4-fg: #5b2db8;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(20, 24, 40, .06), 0 2px 8px rgba(20, 24, 40, .05);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --tabbar-h: 64px;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #11131a;
        --surface: #191c26;
        --surface-2: #222634;
        --border: #2f3445;
        --text: #e8eaf2;
        --muted: #a0a6b8;
        --primary: #7f8cff;
        --primary-hover: #97a2ff;
        --primary-ink: #0d1030;
        --primary-soft: #262c52;
        --success: #5fd49a;
        --success-soft: #163626;
        --warn: #f3c05e;
        --warn-soft: #3a2e14;
        --danger: #ff8a93;
        --danger-soft: #3d1a1f;
        --focus: #9aa5ff;
        --s0-bg: #2a2e3b; --s0-fg: #b5bacb;
        --s1-bg: #1b3050; --s1-fg: #8fbaf5;
        --s2-bg: #3d2f12; --s2-fg: #f2c26a;
        --s3-bg: #153a28; --s3-fg: #7fdcac;
        --s4-bg: #2e2150; --s4-fg: #c3a8ff;
        --shadow: 0 1px 2px rgba(0, 0, 0, .4);
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #11131a;
    --surface: #191c26;
    --surface-2: #222634;
    --border: #2f3445;
    --text: #e8eaf2;
    --muted: #a0a6b8;
    --primary: #7f8cff;
    --primary-hover: #97a2ff;
    --primary-ink: #0d1030;
    --primary-soft: #262c52;
    --success: #5fd49a;
    --success-soft: #163626;
    --warn: #f3c05e;
    --warn-soft: #3a2e14;
    --danger: #ff8a93;
    --danger-soft: #3d1a1f;
    --focus: #9aa5ff;
    --s0-bg: #2a2e3b; --s0-fg: #b5bacb;
    --s1-bg: #1b3050; --s1-fg: #8fbaf5;
    --s2-bg: #3d2f12; --s2-fg: #f2c26a;
    --s3-bg: #153a28; --s3-fg: #7fdcac;
    --s4-bg: #2e2150; --s4-fg: #c3a8ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.55 var(--font);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
a { color: var(--primary); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
/* Blazor moves focus to the page heading after each navigation (for screen readers); no ring is needed there. */
h1:focus { outline: none; }

.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.center { text-align: center; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout ---------- */

.app-header {
    position: sticky; top: 0; z-index: 20;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.app-header .inner {
    max-width: 1100px; margin: 0 auto; padding: 0 16px;
    height: 56px; display: flex; align-items: center; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand-mark {
    width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
    background: var(--primary); color: var(--primary-ink); font-size: .85rem; font-weight: 800; letter-spacing: -.02em;
}
.brand small { font-weight: 500; color: var(--muted); }

.topnav { display: flex; gap: 4px; margin-left: 8px; overflow-x: auto; scrollbar-width: none; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a {
    padding: 8px 12px; border-radius: var(--radius-sm); color: var(--muted); text-decoration: none; font-weight: 500; white-space: nowrap;
    display: inline-flex; align-items: center; gap: 6px;
}
.topnav a:hover { background: var(--surface-2); color: var(--text); }
.topnav a.active { background: var(--primary-soft); color: var(--primary); }
.topnav .count { background: var(--danger); color: #fff; border-radius: 999px; font-size: .72rem; padding: 0 6px; line-height: 1.5; font-weight: 700; }

.account { margin-left: auto; position: relative; }
.account summary {
    list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px;
    padding: 6px 8px; border-radius: var(--radius-sm); color: var(--text);
}
.account summary::-webkit-details-marker { display: none; }
.account summary:hover { background: var(--surface-2); }
.avatar {
    width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
    background: var(--surface-2); color: var(--text); font-weight: 700; font-size: .85rem; border: 1px solid var(--border);
}
.account-menu {
    position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 6px; display: grid;
}
.account-menu a, .account-menu button {
    display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: var(--radius-sm);
    color: var(--text); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer;
}
.account-menu a:hover, .account-menu button:hover { background: var(--surface-2); }
.account-menu .who { padding: 8px 10px; color: var(--muted); font-size: .85rem; border-bottom: 1px solid var(--border); margin-bottom: 4px; }

.page { max-width: 1100px; margin: 0 auto; padding: 20px 16px 40px; }
.page.narrow { max-width: 720px; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin: 4px 0 0; }
.crumbs { font-size: .875rem; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }

/* Student tab bar: fixed at the bottom on phones, inline in the header on wider screens. */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--border);
    display: grid; grid-template-columns: repeat(3, 1fr);
}
.tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--muted); text-decoration: none; font-size: .75rem; font-weight: 600;
}
.tabbar a.active { color: var(--primary); }
.tabbar svg { width: 24px; height: 24px; }
.shell.student .page { padding-bottom: calc(var(--tabbar-h) + 32px); }

@media (min-width: 760px) {
    .tabbar {
        position: static; height: auto; padding: 0; border: 0; background: none;
        display: flex; gap: 4px; margin-left: 8px;
    }
    .tabbar a { flex-direction: row; gap: 6px; padding: 8px 12px; border-radius: var(--radius-sm); font-size: .95rem; font-weight: 500; }
    .tabbar a:hover { background: var(--surface-2); color: var(--text); }
    .tabbar a.active { background: var(--primary-soft); }
    .tabbar svg { width: 18px; height: 18px; }
    .shell.student .page { padding-bottom: 40px; }
}

/* Sign-in pages */
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 28px 24px; }
.auth-card .brand { margin-bottom: 20px; }

/* ---------- Building blocks ---------- */

.stack { display: grid; gap: 14px; align-content: start; }
.stack.tight { gap: 8px; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.spread { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.grid { display: grid; gap: 16px; align-items: start; }
.grid.two { grid-template-columns: 1fr; }
.grid.three { grid-template-columns: 1fr; }
@media (min-width: 760px) {
    .grid.two { grid-template-columns: 1fr 1fr; }
    .grid.three { grid-template-columns: repeat(3, 1fr); }
    .grid.side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
}

.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 16px;
}
.card > h2:first-child, .card > h3:first-child, .card > .card-head:first-child { margin-top: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.card.flat { box-shadow: none; }
.card.link { display: block; color: inherit; text-decoration: none; transition: border-color .15s; }
.card.link:hover { border-color: var(--primary); }
.section-title { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 24px 0 8px; }
.section-title:first-child { margin-top: 0; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 0; border-top: 1px solid var(--border); }
.list > li:first-child { border-top: 0; padding-top: 0; }
.list > li:last-child { padding-bottom: 0; }

.item { display: flex; align-items: center; gap: 12px; }
.item .grow { flex: 1; min-width: 0; }
.item .title { font-weight: 600; color: var(--text); text-decoration: none; }
.item a.title:hover { color: var(--primary); }
.item .meta { color: var(--muted); font-size: .85rem; }
.icon-tile {
    flex: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
    background: var(--primary-soft); color: var(--primary);
}
.icon-tile svg { width: 20px; height: 20px; }
.icon-tile.warn { background: var(--warn-soft); color: var(--warn); }
.icon-tile.success { background: var(--success-soft); color: var(--success); }

.empty { text-align: center; color: var(--muted); padding: 24px 12px; }
.empty strong { display: block; color: var(--text); margin-bottom: 4px; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 40px; padding: 8px 16px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
    transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { color: var(--danger); border-color: var(--danger-soft); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: .875rem; }
.btn.large { min-height: 52px; padding: 12px 22px; font-size: 1.05rem; }
.btn.block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn svg { width: 18px; height: 18px; }

/* Forms */
.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; font-size: .9rem; }
.field .hint { font-weight: 400; color: var(--muted); font-size: .82rem; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=url], input[type=search], input:not([type]), select, textarea {
    width: 100%; min-height: 44px; padding: 10px 12px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text); font: inherit;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
textarea.code { font-family: var(--mono); font-size: .9rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
input.invalid, select.invalid, textarea.invalid { border-color: var(--danger); }
.validation-message { color: var(--danger); font-size: .85rem; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); }
.form-row { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) {
    .form-row { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
}
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px 16px; margin: 0; }
legend { font-weight: 700; padding: 0 6px; }

/* Alerts */
.alert { padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid transparent; margin-bottom: 12px; }
.alert.success { background: var(--success-soft); color: var(--success); }
.alert.danger { background: var(--danger-soft); color: var(--danger); }
.alert.info { background: var(--primary-soft); color: var(--primary); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert p:last-child { margin: 0; }

/* Badges and mastery status */
.badge {
    display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px;
    font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--primary-soft); color: var(--primary); }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.s0 { background: var(--s0-bg); color: var(--s0-fg); }
.s1 { background: var(--s1-bg); color: var(--s1-fg); }
.s2 { background: var(--s2-bg); color: var(--s2-fg); }
.s3 { background: var(--s3-bg); color: var(--s3-fg); }
.s4 { background: var(--s4-bg); color: var(--s4-fg); }

/* Progress bar */
.bar { position: relative; height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar > span { position: absolute; inset: 0 auto 0 0; background: var(--primary); border-radius: 999px; transition: width .4s ease; }
.bar.done > span { background: var(--success); }
.bar .mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); opacity: .35; }
.bar.thin { height: 6px; }

/* Key numbers */
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 760px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.kpi .label { color: var(--muted); font-size: .8rem; font-weight: 600; }
.kpi .value { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .value small { font-size: .9rem; color: var(--muted); font-weight: 500; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th, table.data td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
table.data th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data a { font-weight: 600; }

/* Markdown content */
.prose { line-height: 1.7; }
.prose > *:last-child { margin-bottom: 0; }
.prose h2 { margin-top: 1.4em; }
.prose h3 { margin-top: 1.2em; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 .9em; }
.prose li { margin: .2em 0; }
.prose table { border-collapse: collapse; margin: 0 0 1em; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: 6px 10px; }
.prose blockquote { margin: 0 0 1em; padding: 4px 14px; border-left: 3px solid var(--border); color: var(--muted); }
.prose img { border-radius: var(--radius-sm); }

/* Lesson player */
.video-wrap { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; }
.video-wrap iframe, .video-wrap > div { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.gate { display: grid; gap: 10px; }
.gate .spread strong { font-variant-numeric: tabular-nums; }
.article-end { height: 1px; }

/* Test */
.dots { display: flex; flex-wrap: wrap; gap: 6px; }
.dots button {
    width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--border); background: var(--surface);
    color: var(--muted); font-size: .78rem; font-weight: 700; cursor: pointer; padding: 0;
}
.dots button.answered { background: var(--primary-soft); border-color: var(--primary-soft); color: var(--primary); }
.dots button.current { border-color: var(--primary); color: var(--primary); }
.question-stem { font-size: 1.1rem; }
.options { display: grid; gap: 10px; }
.option {
    display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
    padding: 14px 14px; border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface);
    color: var(--text); font: inherit; cursor: pointer; min-height: 56px;
}
.option:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.option.selected { border-color: var(--primary); background: var(--primary-soft); }
.option .letter {
    flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
    background: var(--surface-2); font-weight: 700; font-size: .85rem; color: var(--muted);
}
.option.selected .letter { background: var(--primary); color: var(--primary-ink); }
.numeric-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 10px; }
.test-nav { display: flex; gap: 10px; justify-content: space-between; }

/* Result */
.score-ring {
    --p: 0; width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; flex: none;
    background: conic-gradient(var(--ring, var(--primary)) calc(var(--p) * 1%), var(--surface-2) 0);
}
.score-ring > div { width: 94px; height: 94px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; text-align: center; }
.score-ring strong { font-size: 1.6rem; display: block; line-height: 1; }
.score-ring span { font-size: .8rem; color: var(--muted); }
.score-ring.pass { --ring: var(--success); }
.score-ring.fail { --ring: var(--danger); }
.answer-card { border-left: 4px solid var(--border); }
.answer-card.correct { border-left-color: var(--success); }
.answer-card.incorrect { border-left-color: var(--danger); }
.answer-card.partial { border-left-color: var(--warn); }
.answer-grid { display: grid; gap: 4px 12px; grid-template-columns: auto 1fr; font-size: .92rem; }
.answer-grid dt { color: var(--muted); }
.answer-grid dd { margin: 0; font-weight: 600; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 32px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.timeline li:first-child { border-top: 0; padding-top: 0; }
.timeline .dot { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.timeline .dot svg { width: 16px; height: 16px; }
.timeline .when { color: var(--muted); font-size: .8rem; }

/* Tracker grid */
.tracker td.cell { min-width: 150px; }
.tracker select { min-height: 34px; padding: 4px 8px; font-size: .85rem; border-radius: 999px; font-weight: 600; width: auto; border: 0; }
.tracker .subject-row td { background: var(--surface-2); font-weight: 700; }
.tracker .ref { color: var(--muted); font-family: var(--mono); font-size: .82rem; }
.gap-toggle { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; color: var(--muted); margin-left: 6px; cursor: pointer; }
.gap-toggle input { width: 15px; height: 15px; accent-color: var(--danger); }

/* Photos */
.photo-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.photo-grid a, .photo-grid .thumb { display: block; aspect-ratio: 3 / 4; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); position: relative; }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-grid .remove { position: absolute; top: 6px; right: 6px; }
.photo-large { display: grid; gap: 12px; }
.photo-large img { width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border); background: #fff; }
.file-drop {
    display: grid; place-items: center; gap: 6px; text-align: center; padding: 28px 16px;
    border: 2px dashed var(--border); border-radius: var(--radius); color: var(--muted); cursor: pointer; position: relative;
}
.file-drop:hover { border-color: var(--primary); color: var(--primary); }
.file-drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-drop svg { width: 32px; height: 32px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; overflow-y: hidden; }
.tabs a, .tabs button {
    padding: 10px 14px; border: 0; background: none; font: inherit; font-weight: 600; color: var(--muted);
    border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.tabs .active { color: var(--primary); border-bottom-color: var(--primary); }

/* Topic accordion (My progress, content editor) */
details.topic { border-top: 1px solid var(--border); }
details.topic:first-of-type { border-top: 0; }
details.topic > summary { list-style: none; cursor: pointer; padding: 12px 0; display: flex; align-items: center; gap: 10px; }
details.topic > summary::-webkit-details-marker { display: none; }
details.topic > summary .chev { transition: transform .15s; color: var(--muted); }
details.topic[open] > summary .chev { transform: rotate(90deg); }
details.topic .body { padding: 0 0 12px 26px; }

/* Blazor */
#blazor-error-ui {
    background: var(--warn-soft); color: var(--warn); bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, .2);
    display: none; left: 0; padding: .6rem 1.25rem .7rem 1.25rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
.blazor-error-boundary { background: var(--danger-soft); color: var(--danger); padding: 1rem; border-radius: var(--radius-sm); }
.blazor-error-boundary::after { content: "Something went wrong on this part of the page. Reload to try again."; }

@media print {
    .app-header, .tabbar, .no-print { display: none !important; }
    body { background: #fff; }
    .card { box-shadow: none; }
}
