/* TeleNitro Academy design system. Brand red #EB2127 is the action colour; everything else is calm.
   Tokens use light-dark() via color-scheme, switched by [data-theme] (set before paint by theme-boot.js). */
@import url("player.css");
@import url("lab.css");
@import url("admin.css");

@font-face { font-family: "Schibsted Grotesk"; src: url("/static/fonts/SchibstedGrotesk-latin.woff2") format("woff2"); font-weight: 400 900; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("/static/fonts/Vazirmatn-arabic.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF; }

:root {
  color-scheme: light dark;
  --brand: #EB2127;
  --brand-ink: #fff;
  --bg: light-dark(#f6f5f3, #0f1115);
  --surface: light-dark(#ffffff, #171a21);
  --surface-2: light-dark(#f0eeea, #1e222b);
  --surface-3: light-dark(#e7e4de, #272c37);
  --ink: light-dark(#17181c, #eceef2);
  --ink-2: light-dark(#53565e, #aab0bc);
  --ink-3: light-dark(#80838c, #7b8290);
  --line: light-dark(#e2dfd9, #2b303b);
  --accent-soft: light-dark(#fdeaea, #3a1719);
  --ok: light-dark(#13805a, #3ccf9d);
  --ok-soft: light-dark(#e2f5ee, #123428);
  --warn: light-dark(#a8590a, #f1b052);
  --warn-soft: light-dark(#fdf1de, #3a2a12);
  --bad: light-dark(#c4252b, #ff7a7f);
  --bad-soft: light-dark(#fdeaea, #3a1719);
  --info: light-dark(#1d5fd1, #7fb0ff);
  --info-soft: light-dark(#e6effd, #14264a);
  --shadow: 0 1px 2px rgba(20, 20, 30, .06), 0 6px 20px rgba(20, 20, 30, .06);
  --shadow-lg: 0 10px 40px rgba(10, 10, 20, .22);
  --radius: 14px;
  --radius-sm: 9px;
  --header-h: 64px;
  --font: "Schibsted Grotesk", "Vazirmatn", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 12px); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; min-height: 100vh; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; font-weight: 700; }
h1 { font-size: clamp(1.7rem, 3vw, 2.4rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
img, svg, video { max-width: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--info) 80%, transparent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -60px; background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 8px; z-index: 1000; }
.skip-link:focus { top: 10px; }
.muted { color: var(--ink-2); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; }
.mono { font-family: var(--mono); }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 12px; }
:root[dir="rtl"] .flip { transform: scaleX(-1); }

/* ---------- layout ---------- */
.header { position: sticky; top: 0; z-index: 50; height: var(--header-h); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
.header-inner { max-width: 1440px; margin: 0 auto; padding: 0 20px; height: 100%; display: flex; align-items: center; gap: 18px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.logo img { height: 26px; width: auto; }
.logo .tag { font-weight: 600; font-size: .78rem; color: var(--ink-2); border-left: 1px solid var(--line); padding-left: 10px; }
:root[dir="rtl"] .logo .tag { border-left: 0; border-right: 1px solid var(--line); padding-left: 0; padding-right: 10px; }
:root[data-theme="dark"] .logo .light-logo, :root:not([data-theme]) .logo .light-logo { }
.logo .dark-logo { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo .light-logo { display: none; } :root:not([data-theme="light"]) .logo .dark-logo { display: block; } }
:root[data-theme="dark"] .logo .light-logo { display: none; }
:root[data-theme="dark"] .logo .dark-logo { display: block; }
.nav { display: flex; gap: 4px; }
.nav a { padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: .95rem; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--bg); }
.search { flex: 1; max-width: 560px; margin: 0 auto; position: relative; }
.search input { width: 100%; height: 42px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); padding: 0 16px 0 44px; }
:root[dir="rtl"] .search input { padding: 0 44px 0 16px; }
.search .icon { position: absolute; inset-inline-start: 15px; top: 11px; color: var(--ink-3); pointer-events: none; }
.search-pop { position: absolute; top: 48px; inset-inline: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 60; max-height: 70vh; overflow: auto; }
.search-pop a { display: block; padding: 10px 12px; border-radius: 10px; text-decoration: none; }
.search-pop a:hover, .search-pop a[aria-selected="true"] { background: var(--surface-2); }
.search-pop .kind { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 700; }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 50%; border: 0; background: transparent; }
.icon-btn:hover { background: var(--surface-2); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .9rem; }
.menu-wrap { position: relative; }
.menu { position: absolute; inset-inline-end: 0; top: 46px; min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 70; }
.menu a, .menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; border: 0; background: transparent; text-align: start; text-decoration: none; }
.menu a:hover, .menu button:hover { background: var(--surface-2); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.menu .who { padding: 8px 12px; }

main { max-width: 1440px; margin: 0 auto; padding: 24px 20px 96px; min-height: 70vh; }
main:focus { outline: none; }
.footer { border-top: 1px solid var(--line); padding: 28px 20px 110px; color: var(--ink-2); font-size: .875rem; }
.footer-inner { max-width: 1440px; margin: 0 auto; display: grid; gap: 8px; }
.tabbar { display: none; }
@media (max-width: 900px) {
  .nav { display: none; }
  .header-inner { padding: 0 12px; gap: 10px; }
  .logo .tag { display: none; }
  .search { margin: 0; }
  .search input { height: 40px; }
  main { padding: 16px 14px 100px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; inset-inline: 0; z-index: 55; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { display: grid; justify-items: center; gap: 2px; padding: 6px 2px; text-decoration: none; color: var(--ink-3); font-size: .7rem; font-weight: 600; border-radius: 10px; }
  .tabbar a[aria-current="page"] { color: var(--brand); }
}

/* ---------- components ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 650; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--brand) 88%, #000); }
.btn.dark { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn.sm { height: 34px; padding: 0 13px; font-size: .875rem; }
.btn.lg { height: 50px; padding: 0 26px; font-size: 1.05rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 999px; font-size: .8rem; font-weight: 650; background: var(--surface-2); color: var(--ink-2); border: 0; text-decoration: none; white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.brand { background: var(--accent-soft); color: var(--brand); }
button.chip { cursor: pointer; }
button.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card.flat { border: 0; background: var(--surface-2); }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.notice { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--info-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--info) 30%, transparent); }
.notice.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.notice.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.notice.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.notice > .icon { flex: none; margin-top: 2px; }
.notice p:last-child { margin-bottom: 0; }

.section-head { display: flex; align-items: baseline; gap: 12px; margin: 34px 0 14px; }
.section-head h2 { margin: 0; }
.section-head .spacer { flex: 1; }
.section-head a { font-weight: 650; font-size: .9rem; }

.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(270px, 100%), 1fr)); }
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); }
.scroller { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 300px); gap: 16px; overflow-x: auto; padding: 4px 2px 14px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.scroller > * { scroll-snap-align: start; }

.course-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; transition: transform .15s, box-shadow .15s; }
.course-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.course-card .art { aspect-ratio: 16 / 9; position: relative; overflow: hidden; background: var(--accent, var(--brand)); }
.course-card .art img { width: 100%; height: 100%; object-fit: cover; }
.art-svg { width: 100%; height: 100%; }
.course-card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.course-card h3 { margin: 0; font-size: 1.05rem; }
.course-card .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: auto; padding-top: 8px; }
.art-badge { position: absolute; inset-inline-start: 10px; top: 10px; }
.art-time { position: absolute; inset-inline-end: 8px; bottom: 8px; background: rgba(0, 0, 0, .75); color: #fff; font-size: .75rem; padding: 2px 7px; border-radius: 6px; font-weight: 600; }
.progress { height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .4s; }
.progress.ok > i { background: var(--ok); }
.lesson-row { display: grid; grid-template-columns: 148px 1fr; gap: 14px; text-decoration: none; padding: 8px; border-radius: 12px; }
.lesson-row:hover { background: var(--surface-2); }
.lesson-row .art { aspect-ratio: 16/9; border-radius: 10px; overflow: hidden; position: relative; background: var(--accent, var(--brand)); }
.lesson-row h4 { margin: 0 0 2px; font-size: .98rem; }
.lesson-card { display: block; text-decoration: none; }
.lesson-card .art { aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; position: relative; background: var(--accent, var(--brand)); margin-bottom: 10px; }
.lesson-card h4 { margin: 0 0 3px; font-size: 1rem; }
.lesson-card:hover h4 { text-decoration: underline; }
.resume-bar { position: absolute; inset-inline: 0; bottom: 0; height: 4px; background: rgba(255,255,255,.35); }
.resume-bar i { display: block; height: 100%; background: var(--brand); }

.hero { border-radius: 22px; padding: clamp(24px, 5vw, 56px); background: var(--hero-bg, linear-gradient(135deg, #1b1d24, #2b1214)); color: #fff; position: relative; overflow: hidden; }
.hero h1 { color: #fff; max-width: 18ch; }
.hero p { color: rgba(255, 255, 255, .8); max-width: 56ch; font-size: 1.1rem; }
.hero .btn { border-color: rgba(255, 255, 255, .3); background: rgba(255, 255, 255, .1); color: #fff; }
.hero .btn.primary { background: var(--brand); border-color: var(--brand); }
.hero-art { position: absolute; inset-inline-end: -40px; top: -40px; width: 380px; opacity: .9; pointer-events: none; }
@media (max-width: 800px) { .hero-art { width: 220px; opacity: .35; } }

.pill-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.pill-row::-webkit-scrollbar { display: none; }

.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s linear infinite; border-radius: 10px; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } * { scroll-behavior: auto !important; transition: none !important; } }
.empty { text-align: center; padding: 48px 20px; color: var(--ink-2); }
.empty h3 { color: var(--ink); }
.empty .icon { width: 44px; height: 44px; margin: 0 auto 12px; color: var(--ink-3); }

.toasts { position: fixed; inset-inline-end: 16px; bottom: 16px; z-index: 300; display: grid; gap: 10px; width: min(380px, calc(100vw - 32px)); }
@media (max-width: 900px) { .toasts { bottom: 82px; } }
.toast { background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: center; animation: pop .2s; }
.toast.ok { background: var(--ok); color: #fff; } .toast.bad { background: var(--bad); color: #fff; }
.toast button { margin-inline-start: auto; background: transparent; border: 0; color: inherit; font-weight: 700; text-decoration: underline; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

dialog { border: 0; border-radius: 18px; padding: 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); max-width: min(560px, calc(100vw - 24px)); width: 100%; }
dialog::backdrop { background: rgba(8, 10, 16, .55); backdrop-filter: blur(2px); }
dialog .dlg-head { display: flex; align-items: center; padding: 18px 20px 6px; gap: 12px; }
dialog .dlg-head h2 { margin: 0; flex: 1; font-size: 1.2rem; }
dialog .dlg-body { padding: 8px 20px 20px; max-height: 70vh; overflow: auto; }
dialog .dlg-foot { padding: 12px 20px 18px; display: flex; gap: 10px; justify-content: flex-end; }
dialog.wide { max-width: min(860px, calc(100vw - 24px)); }

/* forms */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > label, .field > .label { font-weight: 650; font-size: .9rem; }
.field .hint { color: var(--ink-3); font-size: .82rem; }
.field .err { color: var(--bad); font-size: .85rem; font-weight: 600; }
.input, .select, .textarea { width: 100%; min-height: 42px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.textarea { min-height: 110px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--info); outline: 3px solid color-mix(in srgb, var(--info) 25%, transparent); outline-offset: 0; }
.input[aria-invalid="true"] { border-color: var(--bad); }
.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--brand); }
.switch { display: inline-flex; gap: 10px; align-items: center; cursor: pointer; }
.switch input { appearance: none; width: 40px; height: 24px; border-radius: 99px; background: var(--surface-3); position: relative; transition: background .15s; cursor: pointer; }
.switch input::after { content: ""; position: absolute; width: 18px; height: 18px; top: 3px; inset-inline-start: 3px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { transform: translateX(16px); }
:root[dir="rtl"] .switch input:checked::after { transform: translateX(-16px); }
.form-narrow { max-width: 440px; margin: 40px auto; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs [role="tab"] { padding: 11px 16px; border: 0; background: transparent; font-weight: 650; color: var(--ink-2); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs [role="tab"][aria-selected="true"] { color: var(--ink); border-bottom-color: var(--brand); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: start; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 700; }
tr:hover td { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
.pager { display: flex; gap: 8px; justify-content: center; align-items: center; margin-top: 20px; }
.kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.kpi b { display: block; font-size: 1.9rem; letter-spacing: -.02em; }
.kpi span { color: var(--ink-2); font-size: .85rem; }
.ring { width: 64px; height: 64px; }

/* prose (server-sanitised markdown) */
.prose { max-width: 74ch; }
.prose h2 { margin-top: 1.6em; font-size: 1.3rem; } .prose h3 { margin-top: 1.3em; font-size: 1.1rem; }
.prose ul, .prose ol { padding-inline-start: 1.4em; margin: 0 0 1em; }
.prose li { margin: .25em 0; }
.prose blockquote { margin: 1em 0; padding: 10px 16px; border-inline-start: 4px solid var(--brand); background: var(--surface-2); border-radius: 0 10px 10px 0; }
.prose code { font-family: var(--mono); background: var(--surface-2); padding: .1em .35em; border-radius: 5px; font-size: .9em; }
.prose pre { background: var(--surface-2); padding: 14px; border-radius: 10px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose img { border-radius: 10px; margin: 1em 0; border: 1px solid var(--line); }
.prose table { margin: 1em 0; } .prose .table-wrap { margin: 1em 0; border: 1px solid var(--line); border-radius: 10px; }
mark { background: color-mix(in srgb, #ffd23f 55%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }
.crumbs { display: flex; gap: 8px; align-items: center; color: var(--ink-2); font-size: .875rem; margin-bottom: 14px; flex-wrap: wrap; }
.crumbs a { text-decoration: none; } .crumbs a:hover { text-decoration: underline; }

/* course page */
.course-hero { border-radius: 22px; padding: clamp(22px, 4vw, 44px); color: #fff; background: var(--accent, var(--brand)); position: relative; overflow: hidden; }
.course-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(120deg, rgba(0,0,0,.55), rgba(0,0,0,.1)); }
.course-hero > * { position: relative; z-index: 1; }
.course-hero h1 { color: #fff; max-width: 22ch; }
.course-hero p { color: rgba(255,255,255,.9); max-width: 60ch; }
.course-hero .chip { background: rgba(255,255,255,.2); color: #fff; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; margin-top: 24px; }
@media (max-width: 960px) { .two-col { grid-template-columns: minmax(0, 1fr); } }
.syllabus details { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); margin-bottom: 10px; }
.syllabus summary { padding: 14px 16px; font-weight: 700; cursor: pointer; display: flex; gap: 10px; align-items: center; list-style: none; }
.syllabus summary::-webkit-details-marker { display: none; }
.syllabus summary .chev { margin-inline-start: auto; transition: transform .2s; }
.syllabus details[open] summary .chev { transform: rotate(180deg); }
.syllabus .l { display: flex; gap: 12px; align-items: center; padding: 11px 16px; border-top: 1px solid var(--line); text-decoration: none; }
.syllabus .l:hover { background: var(--surface-2); }
.check-dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; flex: none; color: #fff; }
.check-dot.done { background: var(--ok); border-color: var(--ok); }
.check-dot.now { border-color: var(--brand); }

.badge-outline { display: inline-flex; gap: 6px; align-items: center; font-size: .78rem; font-weight: 700; color: var(--warn); }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 16px; height: 16px; }
.icon.lg { width: 28px; height: 28px; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.certificate { background: #fff; color: #17181c; border: 10px double #EB2127; padding: 54px 40px; text-align: center; max-width: 900px; margin: 0 auto; border-radius: 6px; }
.certificate h1 { font-size: 2.4rem; color: #17181c; } .certificate .name { font-size: 2.2rem; font-weight: 800; margin: 14px 0; }
@media print { .header, .tabbar, .footer, .no-print, .toasts { display: none !important; } body { background: #fff; } main { padding: 0; } .certificate { border-width: 8px; } }

.kb-kind { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 800; }
.source-list li { margin: 6px 0; }
.review-badge { display: inline-flex; gap: 6px; align-items: center; }
.badge-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.badge { text-align: center; padding: 18px 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.badge.locked { opacity: .45; filter: grayscale(1); }
.badge .icon { width: 34px; height: 34px; margin: 0 auto 8px; color: var(--brand); }

.btn.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
kbd { font-family: var(--mono); background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; font-size: .85em; }
.hide-sm { }
@media (max-width: 600px) { .hide-sm { display: none; } }

/* ---------- lesson figures (diagrams written inside the lesson text, see mdlite._figure) ---------- */
.fig { margin: 1.4em 0; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); max-width: 100%; }
.fig-title { font-weight: 800; margin-bottom: 14px; font-size: 1rem; }
.fig-caption { margin: 12px 0 0; font-size: .85rem; color: var(--ink-3); }
.fig-ic { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fig-ic.ok { color: var(--ok); }
.fig-n { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; font-size: .78rem; font-weight: 800; flex: none; }
.fig ol, .fig ul { list-style: none; padding: 0; margin: 0; }
.fig-flow { display: flex; flex-wrap: wrap; gap: 12px; }
.fig-flow li { position: relative; flex: 1 1 150px; min-width: 130px; display: grid; gap: 6px; justify-items: start; align-content: start; padding: 14px; background: var(--surface-2); border-radius: 12px; }
.fig-flow li > strong { font-size: .98rem; } .fig-flow li > span:not(.fig-n) { font-size: .85rem; color: var(--ink-2); }
.fig-flow li .fig-ic { color: var(--brand); }
.fig-flow li:not(:last-child)::after { content: "→"; position: absolute; inset-inline-end: -11px; top: 50%; transform: translateY(-50%); z-index: 2; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; font-size: .75rem; color: var(--ink-2); }
:root[dir="rtl"] .fig-flow li:not(:last-child)::after { content: "←"; }
.fig-flow.loop li:last-child::after { content: "↺"; position: absolute; inset-inline-end: -11px; top: 50%; transform: translateY(-50%); z-index: 2; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; font-size: .8rem; color: var(--brand); }
:root[dir="rtl"] .fig-flow.loop li:last-child::after { content: "↺"; }
@media (max-width: 600px) { .fig-flow { flex-direction: column; } .fig-flow li { flex-basis: auto; } .fig-flow li:not(:last-child)::after { inset-inline-end: auto; inset-inline-start: 18px; top: auto; bottom: -13px; transform: none; content: "↓"; } :root[dir="rtl"] .fig-flow li:not(:last-child)::after { content: "↓"; } .fig-flow.loop li:last-child::after { inset-inline-end: auto; inset-inline-start: 18px; top: auto; bottom: -13px; transform: none; } }
.fig-compare { font-size: .92rem; } .fig-compare th[scope="col"] { color: var(--brand); text-transform: none; letter-spacing: 0; font-size: .95rem; } .fig-compare th[scope="row"] { color: var(--ink); text-transform: none; letter-spacing: 0; font-size: .9rem; white-space: nowrap; }
.fig-funnel { display: grid; gap: 8px; }
.fig-fn { display: grid; gap: 4px; }
.fig-fn .fig-bar { display: flex; gap: 8px; align-items: center; padding: 10px 14px; border-radius: 10px; background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 60%, #ff9a3c)); color: #fff; font-size: .92rem; width: 100%; }
.fig-fn[data-w="100"] .fig-bar { width: 100%; } .fig-fn[data-w="95"] .fig-bar, .fig-fn[data-w="94"] .fig-bar { width: 94%; } .fig-fn[data-w="90"] .fig-bar, .fig-fn[data-w="89"] .fig-bar { width: 88%; } .fig-fn[data-w="85"] .fig-bar { width: 82%; }
.fig-fn[data-w="80"] .fig-bar, .fig-fn[data-w="78"] .fig-bar { width: 76%; } .fig-fn[data-w="70"] .fig-bar, .fig-fn[data-w="72"] .fig-bar, .fig-fn[data-w="67"] .fig-bar { width: 68%; } .fig-fn[data-w="60"] .fig-bar, .fig-fn[data-w="61"] .fig-bar, .fig-fn[data-w="56"] .fig-bar { width: 60%; } .fig-fn[data-w="50"] .fig-bar, .fig-fn[data-w="45"] .fig-bar { width: 52%; }
.fig-fn .fig-note { font-size: .85rem; color: var(--ink-2); padding-inline-start: 4px; }
.fig-layers { display: grid; gap: 6px; }
.fig-layers li { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 16px; border-radius: 10px; background: var(--surface-2); border-inline-start: 5px solid var(--brand); }
.fig-layers li:nth-child(2) { border-inline-start-color: #F2780C; } .fig-layers li:nth-child(3) { border-inline-start-color: #2D6BE4; } .fig-layers li:nth-child(4) { border-inline-start-color: #1A9E6E; } .fig-layers li:nth-child(5) { border-inline-start-color: #8A3FFC; }
.fig-layers li > span { color: var(--ink-2); font-size: .88rem; flex-basis: 100%; }
.fig-check li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px dashed var(--line); flex-wrap: wrap; } .fig-check li:last-child { border-bottom: 0; }
.fig-check li > span { color: var(--ink-2); font-size: .88rem; flex-basis: 100%; padding-inline-start: 32px; margin-top: -4px; }
.fig-mock { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 700px) { .fig-mock { grid-template-columns: 1fr; } }
.fig-window { border: 2px solid var(--ink-3); border-radius: 12px; overflow: hidden; background: var(--bg); }
.fig-bar-top { display: flex; gap: 6px; align-items: center; padding: 8px 12px; background: var(--surface-3); font-size: .8rem; color: var(--ink-2); } .fig-bar-top i { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); opacity: .6; } .fig-bar-top span { margin-inline-start: 8px; font-weight: 700; }
.fig-zones { display: grid; gap: 8px; padding: 12px; }
.fig-zone { display: flex; gap: 8px; align-items: center; padding: 12px; border: 1.5px dashed var(--ink-3); border-radius: 8px; background: var(--surface); font-size: .9rem; }
.fig-notes { display: grid; gap: 10px; } .fig-notes li { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; }
.fig-curve { width: 100%; max-width: 520px; height: auto; display: block; margin: 0 auto; }
.fig-curve line { stroke: var(--line); stroke-width: 1.5; } .fig-curve polyline { fill: none; stroke: var(--brand); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; } .fig-curve circle { fill: var(--brand); stroke: var(--surface); stroke-width: 2; } .fig-curve text { fill: var(--ink); font-size: 11px; font-weight: 800; text-anchor: middle; }
.fig-axis { direction: ltr; display: flex; justify-content: space-between; font-size: .8rem; color: var(--ink-3); max-width: 520px; margin: 2px auto 12px; }
.prose figure.fig p { margin: 0; }
