/* Mid-Sem Prep — styles. Light by default, dark via prefers-color-scheme or [data-theme]. */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f0f2f7;
  --surface-3: #e7eaf2;
  --border: #e1e5ee;
  --border-strong: #cdd3e0;
  --text: #101828;
  --text-2: #344054;
  --muted: #5d6679;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --bad: #c42b2b;
  --bad-bg: #fee2e2;
  --warn: #a15c07;
  --warn-bg: #fef3c7;
  --mark: #fde68a;
  --mark-text: #3b2f00;
  --code-bg: #eef1f7;
  --code-text: #1e293b;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
  --shadow-lg: 0 10px 40px rgba(16, 24, 40, .12);
  --radius: 14px;
  --radius-sm: 9px;
  --focus: #2563eb;

  --aml: #2dd4bf; --aml-ink: #0f766e;
  --cn: #38bdf8;  --cn-ink: #0369a1;
  --dl: #a78bfa;  --dl-ink: #6d28d9;
  --mca: #fbbf24; --mca-ink: #a15c07;
  --acc: #6366f1; --acc-ink: #4f46e5;
  --acc-soft: color-mix(in srgb, var(--acc) 16%, transparent);

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0f1c; --surface: #111827; --surface-2: #172033; --surface-3: #1f2a40;
    --border: #243049; --border-strong: #33415e;
    --text: #e8ecf5; --text-2: #c6cddc; --muted: #98a2b8;
    --ok: #4ade80; --ok-bg: rgba(74, 222, 128, .14);
    --bad: #f87171; --bad-bg: rgba(248, 113, 113, .14);
    --warn: #fbbf24; --warn-bg: rgba(251, 191, 36, .14);
    --mark: rgba(250, 204, 21, .3); --mark-text: #fff7d6;
    --code-bg: #1a2338; --code-text: #e2e8f0;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 18px rgba(0, 0, 0, .25);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, .45);
    --focus: #60a5fa;
    --aml-ink: #5eead4; --cn-ink: #7dd3fc; --dl-ink: #c4b5fd; --mca-ink: #fcd34d;
    --acc: #818cf8; --acc-ink: #a5b4fc;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0f1c; --surface: #111827; --surface-2: #172033; --surface-3: #1f2a40;
  --border: #243049; --border-strong: #33415e;
  --text: #e8ecf5; --text-2: #c6cddc; --muted: #98a2b8;
  --ok: #4ade80; --ok-bg: rgba(74, 222, 128, .14);
  --bad: #f87171; --bad-bg: rgba(248, 113, 113, .14);
  --warn: #fbbf24; --warn-bg: rgba(251, 191, 36, .14);
  --mark: rgba(250, 204, 21, .3); --mark-text: #fff7d6;
  --code-bg: #1a2338; --code-text: #e2e8f0;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 18px rgba(0, 0, 0, .25);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .45);
  --focus: #60a5fa;
  --aml-ink: #5eead4; --cn-ink: #7dd3fc; --dl-ink: #c4b5fd; --mca-ink: #fcd34d;
  --acc: #818cf8; --acc-ink: #a5b4fc;
  color-scheme: dark;
}
[data-subj="aml"] { --acc: var(--aml); --acc-ink: var(--aml-ink); }
[data-subj="cn"]  { --acc: var(--cn);  --acc-ink: var(--cn-ink); }
[data-subj="dl"]  { --acc: var(--dl);  --acc-ink: var(--dl-ink); }
[data-subj="mca"] { --acc: var(--mca); --acc-ink: var(--mca-ink); }
/* re-derive at the element so it follows the subject accent (custom props resolve where declared) */
[data-subj] { --acc-soft: color-mix(in srgb, var(--acc) 16%, transparent); }

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.6 var(--font); font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.55rem, 1.1rem + 2vw, 2.2rem); font-weight: 750; }
h2 { font-size: 1.3rem; font-weight: 700; }
h3 { font-size: 1.08rem; font-weight: 700; }
p { margin: 0 0 .8em; }
a { color: var(--acc-ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
code, kbd, pre { font-family: var(--mono); font-size: .88em; }
code { background: var(--code-bg); color: var(--code-text); padding: .1em .38em; border-radius: 6px; overflow-wrap: anywhere; }
kbd { border: 1px solid currentColor; border-radius: 5px; padding: 0 .35em; font-size: .72em; opacity: .75; margin-left: .4em; }
mark { background: var(--mark); color: var(--mark-text); padding: 0 .2em; border-radius: 4px; }
strong { font-weight: 700; }
img, svg, video { max-width: 100%; }
svg { width: 1em; height: 1em; vertical-align: -.125em; flex: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
main:focus, h1:focus { outline: none; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.center { text-align: center; margin: 1.5rem 0; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 768px) { .wrap { padding: 0 28px; } }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 14px; border-radius: 8px; }
.skip:focus { left: 8px; }
.katex { font-size: 1.06em; }
.katex-display { margin: .2em 0; overflow-x: auto; overflow-y: hidden; padding: .2em 0; }
.tex-fallback { white-space: pre-wrap; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(12px); -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: 0 16px; height: 60px; display: flex; align-items: center; gap: 14px; }
@media (min-width: 768px) { .topbar-inner { padding: 0 28px; } }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 750; white-space: nowrap; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  background: conic-gradient(from 200deg, var(--aml), var(--cn), var(--dl), var(--mca), var(--aml)); }
.brand-mark svg { width: 20px; height: 20px; color: #0b1020; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; font-size: .98rem; }
.brand-text small { font-weight: 500; color: var(--muted); font-size: .72rem; }
.nav { display: flex; gap: 2px; margin-left: auto; }
.nav a {
  color: var(--text-2); text-decoration: none; font-size: .9rem; font-weight: 550;
  padding: 7px 10px; border-radius: 8px; white-space: nowrap; position: relative;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.nav a[data-subj]::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--acc); margin-right: 6px; vertical-align: 1px; }
.top-actions { display: flex; gap: 6px; margin-left: 6px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); display: grid; place-items: center; cursor: pointer;
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:hover { border-color: var(--border-strong); }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}
.menu-btn { display: none; }
@media (max-width: 1099px) {
  .menu-btn { display: grid; }
  .top-actions { margin-left: auto; }
  .nav {
    display: none; position: absolute; left: 0; right: 0; top: 60px; margin: 0;
    background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lg);
    padding: 10px 16px 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px;
  }
  .menu-open .nav { display: grid; }
  .nav a { padding: 11px 12px; font-size: .98rem; }
}
@media (min-width: 600px) and (max-width: 1099px) { .nav { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

main#app { padding-top: 26px; padding-bottom: 40px; min-height: 70vh; }
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding-top: 18px; padding-bottom: 32px; border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem; }
.foot p { margin: 0; }

/* ---------- buttons, chips, badges ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: .93rem; font-weight: 600; line-height: 1.2;
  padding: 10px 16px; min-height: 42px; border-radius: 10px; cursor: pointer; text-decoration: none;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn.primary:hover { opacity: .9; }
.btn.ghost { background: transparent; border-color: var(--border); }
.btn.good { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.btn.bad { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.small-btn { padding: 6px 12px; min-height: 36px; font-size: .86rem; }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--acc-ink); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .74rem; font-weight: 700; color: var(--muted); margin-bottom: .35em; }
.eyebrow a { color: inherit; }
.h-small { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 0 0 10px; }
.section-title { margin: 34px 0 14px; }
.subj-tag {
  display: inline-flex; align-items: center; font-size: .72rem; font-weight: 800; letter-spacing: .04em;
  padding: 3px 8px; border-radius: 6px; color: var(--acc-ink); background: var(--acc-soft);
  white-space: nowrap; vertical-align: middle; line-height: 1.3;
}
.subj-tag.big { font-size: .9rem; padding: 4px 10px; vertical-align: 4px; }
.chips { list-style: none; padding: 0; margin: 8px 0 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { background: var(--surface-2); border: 1px solid var(--border); padding: 3px 10px; border-radius: 999px; font-size: .84rem; color: var(--text-2); }
.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 650;
  padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; border: 1px solid var(--border);
}
.badge svg { width: 13px; height: 13px; }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.ready { color: var(--acc-ink); }
.badge.pending { border-style: dashed; }
.now-pill { display: inline-block; background: var(--bad); color: #fff; font-size: .66rem; font-weight: 800; text-transform: uppercase; padding: 1px 7px; border-radius: 999px; letter-spacing: .06em; vertical-align: 1px; }
.dot { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; flex: none; }
.dot.ready { width: 9px; height: 9px; margin: 0 3.5px; background: var(--acc); }
.dot.pending { width: 9px; height: 9px; margin: 0 3.5px; border: 2px dashed var(--muted); }
.dot.ok { background: var(--ok); color: #fff; }
.dot.ok svg { width: 11px; height: 11px; }

/* meters */
.meter { margin: 8px 0; }
.meter-top { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); margin-bottom: 4px; gap: 8px; }
.meter-top span:last-child { font-variant-numeric: tabular-nums; color: var(--text-2); font-weight: 600; }
.meter-track { height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter-fill { height: 100%; border-radius: inherit; background: var(--acc); transition: width .4s; }
.meter-fill.bad-fill { background: var(--bad); }

/* ---------- home ---------- */
.hero {
  display: grid; gap: 22px; grid-template-columns: 1fr;
  background: radial-gradient(1200px 300px at 0% 0%, color-mix(in srgb, var(--aml) 14%, transparent), transparent 60%),
              radial-gradient(900px 300px at 100% 100%, color-mix(in srgb, var(--dl) 16%, transparent), transparent 60%), var(--surface);
  border: 1px solid var(--border); border-radius: 20px; padding: 24px 20px; box-shadow: var(--shadow);
}
@media (min-width: 860px) { .hero { grid-template-columns: 1.6fr 1fr; padding: 34px 36px; } }
.hero h1 { margin-bottom: 14px; }
.countdown { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.cd-unit { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; min-width: 70px; padding: 10px 10px 8px; text-align: center; flex: 1 1 0; max-width: 104px; }
.cd-num { display: block; font-size: clamp(1.6rem, 1rem + 3vw, 2.5rem); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.1; }
.cd-lbl { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.cd-done { font-size: 1.4rem; font-weight: 800; }
.hero-side { display: flex; flex-direction: column; gap: 12px; justify-content: center; }
.ring { display: flex; align-items: center; gap: 14px; }
.ring svg { width: 60px; height: 60px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; }
.ring-bg { stroke: var(--surface-3); }
.ring-fg { stroke: var(--acc); stroke-linecap: round; }
.ring-num { font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.ring-num .muted { font-size: .95rem; font-weight: 600; }
.today-card { margin-top: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); }
.today-card.exam-day { background: linear-gradient(135deg, color-mix(in srgb, var(--mca) 16%, var(--surface)), var(--surface)); }
.today-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.today-head h2 { margin: 0; }
.grid4 { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .grid4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.grid2 { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 820px) { .grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.subj-card {
  display: block; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 16px 10px; box-shadow: var(--shadow); position: relative; overflow: hidden;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.subj-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--acc); }
.subj-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--acc) 50%, var(--border)); text-decoration: none; }
.subj-card h3 { margin: 10px 0 8px; font-size: 1.05rem; }
.subj-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.subj-card-top .muted { text-align: right; }
.cta-row { display: grid; gap: 12px; grid-template-columns: 1fr; margin-top: 26px; }
@media (min-width: 700px) { .cta-row { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); } }
.cta { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); color: var(--text); text-decoration: none; }
.cta:hover { border-color: var(--border-strong); background: var(--surface); text-decoration: none; }
.cta strong::after { content: " →"; color: var(--acc-ink); }
.cta span { color: var(--muted); font-size: .88rem; }

/* ---------- plan ---------- */
.page-head { margin-bottom: 20px; max-width: 760px; }
.principles { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 22px; }
.principles summary { cursor: pointer; font-weight: 700; }
.principles ul { margin: 10px 0 0; }
.day { margin: 0 0 26px; }
.day-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 24px; flex-wrap: wrap; margin-bottom: 10px; }
.day-head h2 { margin: 0; }
.day-prog { width: 220px; max-width: 100%; }
.day.is-today .day-head h2 { color: var(--acc-ink); }
.blocks { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 12px; }
.block {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--acc); border-radius: var(--radius-sm);
  padding: 12px 14px; min-width: 0;
}
.block[data-subj="all"] { border-left-color: var(--border-strong); }
.block.now { box-shadow: 0 0 0 2px color-mix(in srgb, var(--acc) 60%, transparent), var(--shadow); }
.block.done { opacity: .72; }
.block.done .block-task { text-decoration: line-through; text-decoration-color: var(--muted); }
.block-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.block-time { font-weight: 750; font-variant-numeric: tabular-nums; }
.block-done { margin-left: auto; }
.block-task { margin: 4px 0 6px; color: var(--text-2); }
.mini-h { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 10px 0 4px; }
.vid-list, .prac-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.vid-list a { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: .92rem; min-width: 0; }
.vid-list a:hover { background: var(--surface-2); }
.vid-id { font-family: var(--mono); font-size: .78rem; color: var(--acc-ink); font-weight: 700; flex: none; }
.check { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; font-size: .92rem; padding: 4px 6px; border-radius: 8px; }
.check:hover { background: var(--surface-2); }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--acc-ink); flex: none; }
.block-done { padding: 2px 6px; font-size: .84rem; color: var(--muted); align-items: center; }
.block-done input { margin: 0; }

/* ---------- subject ---------- */
.subj-head { margin-bottom: 18px; }
.subj-meta { display: grid; gap: 10px; grid-template-columns: 1fr; margin: 14px 0; }
@media (min-width: 760px) { .subj-meta { grid-template-columns: 1.3fr .6fr 1.3fr; } }
.info-pill { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.info-pill code { align-self: flex-start; margin-top: 3px; }
.subj-prog { display: grid; gap: 4px 18px; grid-template-columns: 1fr; max-width: 900px; }
@media (min-width: 700px) { .subj-prog { grid-template-columns: repeat(3, 1fr); } }
.lesson-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.lesson-row {
  display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; align-items: start;
  padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); text-decoration: none; transition: border-color .15s, background .15s;
}
.lesson-row:hover { border-color: color-mix(in srgb, var(--acc) 55%, var(--border)); text-decoration: none; }
.lesson-no { font-family: var(--mono); font-weight: 800; color: var(--acc-ink); font-size: 1rem; padding-top: 1px; grid-row: span 2; }
.lesson-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lesson-title { font-weight: 680; }
.lesson-sum { color: var(--muted); font-size: .88rem; }
.lesson-status { display: flex; gap: 6px; flex-wrap: wrap; grid-column: 2; }
@media (min-width: 820px) {
  .lesson-row { grid-template-columns: auto 1fr auto; }
  .lesson-no { grid-row: auto; }
  .lesson-status { grid-column: auto; justify-content: flex-end; max-width: 260px; }
}

/* ---------- lesson ---------- */
.crumbs { font-size: .86rem; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }
.lesson-head h1 { margin-bottom: 8px; }
.lesson-head h1 .subj-tag { font-size: .8rem; vertical-align: 5px; }
.lead { font-size: 1.04rem; color: var(--text-2); }
.player-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); margin: 12px 0 22px; }
@media (min-width: 1000px) { .player-grid { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr); } }
.video-box { background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; box-shadow: var(--shadow); }
.video-box video { width: 100%; height: 100%; display: block; background: #000; }
.video-box.pending {
  background: repeating-linear-gradient(135deg, var(--surface-2) 0 14px, var(--surface) 14px 28px);
  border: 1px dashed var(--border-strong); display: grid; place-items: center; text-align: center; padding: 16px;
}
.pending-inner svg { width: 40px; height: 40px; color: var(--acc-ink); animation: pulse 1.8s ease-in-out infinite; }
.pending-inner p { margin: 6px 0 0; }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .pending-inner svg { animation: none; } * { scroll-behavior: auto !important; } }
.player-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg button { font: inherit; font-size: .86rem; font-weight: 650; padding: 7px 11px; min-height: 36px; border: 0; background: transparent; color: var(--text-2); cursor: pointer; font-variant-numeric: tabular-nums; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.btn[aria-pressed="true"][data-act="cc"] { background: var(--surface-3); }
.watch-btn { margin-left: auto; }
.watch-btn.is-on { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.chap-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 10px 10px 14px; max-height: 420px; overflow: auto; min-width: 0; }
@media (max-width: 999px) { .chap-panel { max-height: 300px; } }
.chapters { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.chapters button, .chapters a {
  width: 100%; display: flex; gap: 10px; align-items: baseline; text-align: left; font: inherit; font-size: .9rem;
  background: none; border: 0; padding: 7px 8px; border-radius: 8px; color: var(--text); cursor: pointer; text-decoration: none;
}
.chapters button:hover, .chapters a:hover { background: var(--surface-2); }
.chapters .active { background: var(--acc-soft); }
.ch-t { font-family: var(--mono); font-size: .78rem; color: var(--acc-ink); font-weight: 700; min-width: 38px; flex: none; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; position: sticky; top: 60px; background: var(--bg); z-index: 5; }
.tabs button {
  font: inherit; font-weight: 650; font-size: .95rem; padding: 11px 12px; background: none; border: 0; cursor: pointer;
  color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--acc); }
.tabs .count { font-size: .72rem; background: var(--surface-3); padding: 1px 6px; border-radius: 999px; color: var(--text-2); margin-left: 2px; }
@media (max-width: 420px) { .tabs button { padding: 10px 7px; font-size: .88rem; } .tabs .count { display: none; } }
#panel:focus-visible { outline-offset: 6px; }

.notes { max-width: 860px; }
.note-sec { padding: 4px 0 18px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.note-sec:last-child { border-bottom: 0; }
.note-sec h3 { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ts {
  display: inline-flex; align-items: center; gap: 4px; font: 700 .76rem var(--mono); color: var(--acc-ink);
  background: var(--acc-soft); border: 0; padding: 4px 8px; border-radius: 999px; cursor: pointer; vertical-align: middle;
}
.ts svg { width: 11px; height: 11px; }
.ts:hover { filter: brightness(1.1); }
.bullets { padding-left: 1.25em; margin: 6px 0 10px; }
.bullets li { margin: 4px 0; }
.bullets li::marker { color: var(--acc-ink); }
.small-notes { font-size: .9rem; color: var(--text-2); }
.callout {
  border-left: 4px solid var(--acc); background: var(--acc-soft); padding: 10px 14px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 10px 0; font-weight: 550;
}
.table-wrap { overflow-x: auto; margin: 8px 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); max-width: 100%; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-2); font-weight: 700; font-size: .84rem; color: var(--text-2); }
tbody tr:last-child td { border-bottom: 0; }
.grid-t td { text-align: center; font-family: var(--mono); font-size: .82rem; }
.grid-t td:first-child { font-family: var(--font); font-weight: 600; text-align: left; }
.math-lines { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin: 8px 0 12px; }
.math-lines > *, .opts > *, .blocks > *, .lesson-list > *, .weak > *, .chapters > * { min-width: 0; }
.mline { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 18px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 14px; }
@media (min-width: 700px) { .mline { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); } }
.mline.boxed { border: 2px solid var(--acc); }
.mtex { min-width: 0; }
.mnote { color: var(--muted); font-size: .88rem; }
.compare { display: grid; gap: 10px; grid-template-columns: 1fr; margin: 8px 0 12px; }
@media (min-width: 640px) { .compare { grid-template-columns: 1fr 1fr; } }
.cmp { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; min-width: 0; }
.cmp h4 { margin: 0 0 4px; color: var(--acc-ink); }
.cmp + .cmp h4 { color: var(--text); }
pre.code { background: var(--code-bg); color: var(--code-text); border-radius: var(--radius-sm); padding: 12px 0; overflow-x: auto; margin: 8px 0 12px; line-height: 1.55; font-size: .84rem; }
pre.code code { background: none; padding: 0; display: block; font-size: 1em; }
pre.code .cl { display: inline-block; min-width: 100%; padding: 0 14px; }
pre.code .cl.hl { background: color-mix(in srgb, var(--acc) 18%, transparent); box-shadow: inset 3px 0 0 var(--acc); }
.qc { background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 12px 14px; }
.qc-q { margin-bottom: 6px; }
.qc-opts { margin: 0 0 8px; padding-left: 1.6em; }
.qc details summary { cursor: pointer; color: var(--acc-ink); font-weight: 650; }
.qc details p { margin: 6px 0 0; }
.flow { list-style: none; counter-reset: f; padding: 0; margin: 8px 0; display: flex; flex-wrap: wrap; gap: 8px; }
.flow li { counter-increment: f; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 7px 12px 7px 10px; display: flex; flex-direction: column; min-width: 0; max-width: 100%; }
.flow li span::before { content: counter(f) ". "; color: var(--acc-ink); font-weight: 800; }
.flow li span { font-weight: 650; font-size: .92rem; }
.flow li small { color: var(--muted); font-size: .8rem; }
.seq { padding-left: 1.4em; margin: 8px 0; }
.seq li { margin: 6px 0; }
.seq-ft { display: block; font-size: .82rem; color: var(--muted); }
.bits { display: grid; gap: 8px; margin: 8px 0; }
.bits-row { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.bits-label { font-weight: 650; min-width: 90px; }
.bits-val { letter-spacing: .08em; overflow-wrap: anywhere; }
.matrices { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; margin: 8px 0; }
.matrices figure { margin: 0; }
.matrices figcaption { font-size: .8rem; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.mat { width: auto; border: 1px solid var(--border); }
.mat td { text-align: center; font-family: var(--mono); padding: 4px 10px; border: 1px solid var(--border); }
.fig-note { display: flex; align-items: center; gap: 6px; font-size: .86rem; color: var(--muted); margin: 6px 0 0; }

.transcript { max-width: 820px; }
.tr-par h4 { display: flex; align-items: center; gap: 8px; font-size: .95rem; margin: 18px 0 6px; flex-wrap: wrap; }
.tr-par p { line-height: 1.75; color: var(--text-2); }
.beat { cursor: pointer; border-radius: 5px; padding: 1px 2px; transition: background .15s; }
.beat:hover { background: var(--surface-3); }
.beat.active { background: var(--acc-soft); color: var(--text); box-shadow: 0 0 0 2px var(--acc-soft); }

.quiz { max-width: 820px; }
.quiz-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.quiz-bar .btn { margin-left: auto; }
.quiz-done { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; }
.quiz-done.good { background: var(--ok-bg); color: var(--ok); }
.quiz-done.meh { background: var(--warn-bg); color: var(--warn); }
fieldset.q, li.q { border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 14px; min-width: 0; }
fieldset.q legend { float: left; width: 100%; padding: 0; margin-bottom: 10px; font-weight: 650; }
fieldset.q legend + * { clear: both; }
fieldset.q.right, li.q.right { border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); }
fieldset.q.wrong, li.q.wrong { border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); }
.q-no { display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 8px; background: var(--surface-3); font-size: .8rem; font-weight: 800; margin-right: 8px; vertical-align: 1px; padding: 0 6px; }
.opts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.opt {
  display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; font: inherit; font-size: .95rem;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: 10px; padding: 9px 12px; cursor: pointer;
  transition: border-color .12s, background .12s;
}
.opt:hover { border-color: var(--acc); }
.opt[aria-disabled="true"] { cursor: default; }
.opt[aria-disabled="true"]:hover { border-color: var(--border-strong); }
.opt-key { flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: var(--surface-3); font-size: .78rem; font-weight: 800; margin-top: 1px; }
.opt.correct { background: var(--ok-bg); border-color: var(--ok); }
.opt.correct .opt-key { background: var(--ok); color: #fff; }
.opt.chosen-wrong { background: var(--bad-bg); border-color: var(--bad); }
.opt.chosen-wrong .opt-key { background: var(--bad); color: #fff; }
.opts.radio input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.opts.radio .opt:has(input:checked) { border-color: var(--acc-ink); background: var(--acc-soft); }
.opts.radio .opt:has(input:checked) .opt-key { background: var(--acc-ink); color: var(--bg); }
.opts.radio .opt:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.why { margin-top: 10px; font-size: .92rem; color: var(--text-2); }
.why:empty { display: none; }
.ok-t { color: var(--ok); }
.bad-t { color: var(--bad); }
.ok-t svg { width: 14px; height: 14px; margin-right: 2px; }

.fc-wrap { max-width: 640px; margin: 0 auto; text-align: center; }
.flashcard { display: block; width: 100%; perspective: 1200px; background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: inherit; margin: 6px 0 14px; }
.fc-inner { display: grid; transition: transform .45s cubic-bezier(.2, .7, .2, 1); transform-style: preserve-3d; }
.flipped .fc-inner { transform: rotateY(180deg); }
.fc-face {
  grid-area: 1 / 1; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  min-height: 220px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px;
  padding: 26px 22px; border-radius: 18px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow);
}
.fc-front { border-top: 5px solid var(--acc); }
.fc-back { transform: rotateY(180deg); background: linear-gradient(160deg, var(--acc-soft), var(--surface) 70%); border-top: 5px solid var(--acc); }
.fc-lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 800; }
.fc-text { font-size: 1.2rem; font-weight: 600; line-height: 1.45; }
@media (prefers-reduced-motion: reduce) { .fc-inner { transition: none; } }
.fc-ctrl { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.fc-all { text-align: left; margin-top: 22px; }
.fc-all summary { cursor: pointer; font-weight: 650; color: var(--acc-ink); }
.fc-all dt { font-weight: 700; margin-top: 12px; }
.fc-all dd { margin: 2px 0 0; color: var(--text-2); }

.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 34px; }
.prevnext a { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); text-decoration: none; min-width: 0; }
.prevnext a span:last-child { font-weight: 650; font-size: .92rem; overflow-wrap: anywhere; }
.prevnext a:hover { border-color: var(--acc); }
.prevnext .nx { text-align: right; }

/* ---------- grill ---------- */
.grill-grid { display: grid; gap: 22px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) { .grill-grid { grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); } }
.g-settings { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-bottom: 14px; }
.tog-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tog { position: relative; cursor: pointer; }
.tog input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tog span { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); font-size: .88rem; font-weight: 650; color: var(--text-2); min-height: 36px; }
.tog[data-subj] span::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--acc); opacity: .35; }
.tog input:checked + span { background: var(--text); color: var(--bg); border-color: var(--text); }
.tog[data-subj] input:checked + span { background: var(--acc-soft); color: var(--text); border-color: var(--acc); }
.tog[data-subj] input:checked + span::before { opacity: 1; }
.tog input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.g-card { background: var(--surface); border: 1px solid var(--border); border-top: 5px solid var(--acc); border-radius: 18px; padding: 18px 20px 20px; box-shadow: var(--shadow); }
.g-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 12px; }
.g-meta .muted { margin-left: auto; }
.g-prompt { font-size: 1.22rem; font-weight: 650; line-height: 1.45; margin-bottom: 14px; }
.g-answer { margin-top: 14px; padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius-sm); }
.g-back { font-size: 1.08rem; margin: 0; }
.g-answer .fc-lbl { display: block; margin-bottom: 4px; }
.g-answer p:last-child { margin-bottom: 0; }
.g-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.g-actions .btn { flex: 1 1 140px; }
.g-session { margin-top: 10px; }
.g-side { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; align-self: start; }
.boxes { display: flex; align-items: flex-end; gap: 8px; height: 140px; margin-bottom: 20px; }
.box-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; font-variant-numeric: tabular-nums; font-weight: 700; font-size: .88rem; min-width: 0; }
.box-col small { font-size: .7rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.box-bar { width: 100%; border-radius: 6px 6px 2px 2px; background: var(--surface-3); }
.box-col.b1 .box-bar { background: var(--bad); }
.box-col.b2 .box-bar { background: color-mix(in srgb, var(--bad) 50%, var(--warn)); }
.box-col.b3 .box-bar { background: var(--warn); }
.box-col.b4 .box-bar { background: color-mix(in srgb, var(--warn) 40%, var(--ok)); }
.box-col.b5 .box-bar { background: var(--ok); }
.weak { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 12px; }
.weak a { display: flex; gap: 8px; align-items: baseline; color: var(--text); text-decoration: none; font-size: .9rem; font-weight: 600; margin-bottom: 4px; }
.weak a:hover span:last-child { text-decoration: underline; }

/* ---------- mock ---------- */
.mock-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; max-width: 640px; }
.mock-form fieldset { border: 0; padding: 0; margin: 0 0 14px; }
.mock-form legend { font-weight: 700; margin-bottom: 8px; }
.form-row { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 8px; }
.form-row label { display: flex; flex-direction: column; gap: 4px; font-weight: 650; font-size: .9rem; }
select { font: inherit; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); min-height: 40px; min-width: 150px; }
.mock-bar { position: sticky; top: 60px; z-index: 6; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); padding: 10px 0; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.mock-bar .btn { margin-left: auto; }
.mock-timer { font-variant-numeric: tabular-nums; font-weight: 750; }
.mock-timer.low { color: var(--bad); }
.mock-q-list fieldset.q legend .subj-tag { margin-right: 6px; }
.result-hero { display: grid; gap: 18px; grid-template-columns: auto 1fr; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 18px 20px; }
.per-subj { grid-column: 1 / -1; display: grid; gap: 0 18px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
@media (min-width: 760px) { .result-hero { grid-template-columns: auto auto 1fr; } .per-subj { grid-column: auto; } }
.big-score { font-size: 3rem; font-weight: 850; line-height: 1; font-variant-numeric: tabular-nums; }
.big-score span { font-size: 1.4rem; color: var(--muted); font-weight: 700; }
.result-pct { font-size: 1.5rem; font-weight: 800; margin: 0; }
.mock-review { list-style: none; padding: 0; margin: 18px 0; }
.rv-q { font-weight: 650; }
.rv-a { margin-bottom: 4px; }
.hist { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; max-width: 640px; }
.hist li { display: flex; flex-wrap: wrap; gap: 4px 14px; justify-content: space-between; padding: 9px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; font-size: .9rem; }

/* ---------- coverage ---------- */
.discrep { background: var(--warn-bg); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 24px; }
.discrep .h-small { color: var(--warn); }
.discrep .bullets { margin: 0; }
.cov { margin-bottom: 28px; }
.cov-head h2 { margin: 0 0 2px; }
.cov-t td:first-child { min-width: 200px; }
.cov-t td:nth-child(2) { white-space: nowrap; }
.vid-link { display: inline-flex; align-items: center; gap: 3px; font-family: var(--mono); font-size: .8rem; font-weight: 700; margin-right: 6px; }
.status { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .74rem; font-weight: 750; white-space: nowrap; text-transform: uppercase; letter-spacing: .04em; }
.status.covered { background: var(--ok-bg); color: var(--ok); }
.status.bonus { background: color-mix(in srgb, var(--dl) 20%, transparent); color: var(--dl-ink); }
.status.excluded { background: var(--surface-3); color: var(--muted); }

/* ---------- practice ---------- */
.how { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 18px 14px; }
.how .section-title { margin-top: 14px; }
.steps { padding-left: 1.3em; margin: 0 0 10px; }
.steps li { margin-bottom: 12px; }
.steps li::marker { font-weight: 800; color: var(--acc-ink); }
.steps p { margin-bottom: 6px; }
.cmd { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0 8px; min-width: 0; }
.cmd pre { flex: 1; min-width: 0; margin: 0; background: var(--code-bg); color: var(--code-text); padding: 10px 12px; border-radius: 9px; overflow-x: auto; font-size: .82rem; line-height: 1.55; }
.cmd pre code { background: none; padding: 0; }
.kit { background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--acc); border-radius: var(--radius); padding: 16px; min-width: 0; }
.kit h3 { margin-bottom: 4px; }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty.small { padding: 24px 16px; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); }

@media (max-width: 480px) {
  body { font-size: 15.5px; }
  .hero { padding: 20px 16px; border-radius: 16px; }
  .cd-unit { min-width: 0; padding: 8px 4px 6px; }
  .countdown { gap: 6px; flex-wrap: nowrap; }
  .today-card { padding: 16px 14px; }
  .g-card { padding: 16px 14px; }
  .g-prompt { font-size: 1.1rem; }
  .fc-text { font-size: 1.08rem; }
  .watch-btn { margin-left: 0; }
}
@media print {
  .topbar, .foot, .player-grid, .tabs, .prevnext { display: none !important; }
}
