:root { --brand: #4f46e5; --bg: #f6f7fb; --panel: #fff; --ink: #1d2433; --muted: #6b7280; --line: #e5e7eb; --bad: #dc2626; --warn: #d97706; --ok: #16a34a; --radius: 14px; color-scheme: light; }
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1218; --panel: #171b23; --ink: #e8eaf0; --muted: #9aa3b2; --line: #2a303c; color-scheme: dark; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); font-size: 17px; }
.brand img { height: 36px; max-width: 160px; object-fit: contain; }
.spacer { flex: 1; }
.who { color: var(--muted); font-size: 14px; }
main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 60px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 0 16px 30px; }
h1 { font-size: 26px; margin: 0 0 6px; }
h2 { font-size: 19px; margin: 26px 0 12px; }
.muted { color: var(--muted); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.center { display: grid; place-items: center; min-height: 40vh; }
.login { max-width: 400px; margin: 6vh auto; }
.login h1 { text-align: center; }
.login .logo-big { display: block; max-height: 80px; max-width: 220px; margin: 0 auto 14px; }
label { display: block; font-weight: 600; font-size: 14px; margin: 12px 0 4px; }
input { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); }
input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
button, .btn { font: inherit; font-weight: 600; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; display: inline-flex; gap: 8px; align-items: center; }
button.primary, .btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.ghost { background: transparent; border-color: transparent; }
button:disabled { opacity: .6; cursor: default; }
.full { width: 100%; justify-content: center; margin-top: 16px; }
.err { color: var(--bad); font-size: 14px; min-height: 20px; margin-top: 8px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.course { display: flex; flex-direction: column; padding: 0; overflow: hidden; cursor: pointer; transition: transform .12s, box-shadow .12s; color: var(--ink); }
.course:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.08); text-decoration: none; }
.course .cover { height: 96px; display: flex; align-items: flex-end; padding: 12px 14px; color: #fff; font-weight: 700; font-size: 18px; line-height: 1.25; }
.course .body { padding: 12px 14px 14px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; flex: 1; }
.course .body .meta { align-self: stretch; }
.course .meta { color: var(--muted); font-size: 13px; margin-top: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: color-mix(in srgb, var(--muted) 15%, transparent); }
.pill.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.pill.bad { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.pill.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.pill.brand { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); }
.alert { border-left: 4px solid var(--bad); }
.alert.warn { border-left-color: var(--warn); }
.layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; align-items: start; }
.outline { position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow: auto; padding: 8px; }
.outline .sec { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding: 12px 10px 4px; }
.outline a { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 9px; color: var(--ink); font-size: 14px; }
.outline a:hover { background: color-mix(in srgb, var(--brand) 8%, transparent); text-decoration: none; }
.outline a.active { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); font-weight: 600; }
.outline a.locked { color: var(--muted); cursor: not-allowed; }
.outline small { margin-left: auto; color: var(--muted); }
.player { position: relative; padding-top: 56.25%; border-radius: var(--radius); overflow: hidden; background: #000; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.text { white-space: pre-wrap; overflow-wrap: anywhere; }
.navrow { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.back { display: inline-block; margin-bottom: 12px; font-size: 14px; }
@media (max-width: 820px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .outline { position: static; max-height: none; order: 2; }
  .top { padding: 10px 16px; }
  .who { display: none; }
}
.progress { height: 8px; border-radius: 99px; background: color-mix(in srgb, var(--muted) 20%, transparent); overflow: hidden; flex: 1; min-width: 80px; }
.progress-in { height: 100%; background: var(--brand); border-radius: 99px; transition: width .3s; }
.progress-line { display: flex; align-items: center; gap: 10px; width: 100%; margin: 4px 0; }
.progress-line small { color: var(--muted); white-space: nowrap; }
.outline a.done { color: var(--muted); }
.outline a.done svg { color: var(--ok); }
.file { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-top: 1px solid var(--line); color: var(--ink); }
.file:first-of-type { margin-top: 8px; }
.file small { margin-left: auto; color: var(--muted); }
.outline.static { position: static; max-height: none; }
.who-link { font-weight: 600; font-size: 14px; }
.quiz-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.quiz-facts > div { display: flex; flex-direction: column; gap: 2px; }
.quiz-facts small { color: var(--muted); }
.quiz-facts b { font-size: 18px; }
b.ok, .big-grade.ok { color: var(--ok); }
b.bad, .big-grade.bad { color: var(--bad); }
.big-grade { font-size: 44px; font-weight: 800; line-height: 1.1; margin: 8px 0; }
.big-grade.sm { font-size: 24px; margin: 0; }
.exam-bar { position: sticky; top: 61px; z-index: 4; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; }
.timer { font-variant-numeric: tabular-nums; }
.timer.bad { color: var(--bad); }
.stack > * + * { margin-top: 12px; }
.q-head { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 10px; }
.q-head .text { flex: 1; }
.q-head small { color: var(--muted); white-space: nowrap; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt { display: flex; gap: 10px; align-items: center; font-weight: 400; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.opt input { width: auto; }
.opt:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, transparent); }
textarea { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); resize: vertical; }
.q.res-ok { border-left: 4px solid var(--ok); }
.q.res-bad { border-left: 4px solid var(--bad); }
.q.res-part { border-left: 4px solid var(--warn); }
.q.res-pending { border-left: 4px solid var(--muted); }
