/* Шрифты общего стиля (services/_design): Onest — текст, Unbounded — заголовки. */
@font-face{font-family:"Onest";font-weight:400 800;font-display:swap;src:url(ui/fonts/onest-cyrillic.woff2) format("woff2");
  unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}
@font-face{font-family:"Onest";font-weight:400 800;font-display:swap;src:url(ui/fonts/onest-latin.woff2) format("woff2");
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"Unbounded";font-weight:500 800;font-display:swap;src:url(ui/fonts/unbounded-cyrillic.woff2) format("woff2");
  unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}
@font-face{font-family:"Unbounded";font-weight:500 800;font-display:swap;src:url(ui/fonts/unbounded-latin.woff2) format("woff2");
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}

/* ---------- themes ----------
   Telegram's light palette is the default; [data-theme] swaps the token set.
   Everything below this block must read colours from these variables only. */
:root, [data-theme="telegram"] {
  --bg: #ffffff;
  --panel: #ffffff;
  --panel-2: #f4f4f5;
  --line: #d9dbde;
  --line-strong: #b9bdc2;
  --accent: #3390ec;
  --accent-2: #2aabee;
  --accent-soft: rgba(51, 144, 236, .1);
  --accent-edge: rgba(51, 144, 236, .3);
  --on-accent: #ffffff;
  --text: #000000;
  --muted: #707579;
  --ok: #31b545;
  --on-ok: #ffffff;
  --top-bg: rgba(255, 255, 255, .92);
  --scrim: rgba(20, 35, 50, .32);
  --avatar: linear-gradient(135deg, #e7f3ff, #c6e3ff);
  --shadow: 0 20px 54px rgba(31, 72, 112, .16);
  --frame-bg: #ffffff;
  color-scheme: light;
}

[data-theme="tseh"] {
  --bg: #08080a;
  --panel: #121115;
  --panel-2: #191820;
  --line: #262430;
  --line-strong: #443e56;
  --accent: #ff6b35;
  --accent-2: #ff9a6b;
  --accent-soft: rgba(255, 107, 53, .14);
  --accent-edge: rgba(255, 107, 53, .35);
  --on-accent: #17100c;
  --text: #f4f1e9;
  --muted: #9b95a6;
  --ok: #4ade80;
  --on-ok: #05210f;
  --top-bg: rgba(8, 8, 10, .86);
  --scrim: rgba(4, 4, 6, .72);
  --avatar: linear-gradient(135deg, #4b4358, #2a2733);
  --shadow: 0 30px 80px rgba(0, 0, 0, .6);
  --frame-bg: #0b0b0f;
  color-scheme: dark;
}

[data-theme="dark"] {
  --bg: #0e1014;
  --panel: #171a21;
  --panel-2: #1e222b;
  --line: #2a2f3a;
  --line-strong: #3d4453;
  --accent: #58a6ff;
  --accent-2: #8ac2ff;
  --accent-soft: rgba(88, 166, 255, .14);
  --accent-edge: rgba(88, 166, 255, .38);
  --on-accent: #06182c;
  --text: #e6e9ef;
  --muted: #98a0ae;
  --ok: #4ade80;
  --on-ok: #05210f;
  --top-bg: rgba(14, 16, 20, .86);
  --scrim: rgba(5, 7, 10, .72);
  --avatar: linear-gradient(135deg, #39424f, #232830);
  --shadow: 0 30px 80px rgba(0, 0, 0, .55);
  --frame-bg: #121419;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f6f5f2;
  --panel: #ffffff;
  --panel-2: #f0eeea;
  --line: #e0ddd5;
  --line-strong: #c6c1b6;
  --accent: #c8501c;
  --accent-2: #e2703c;
  --accent-soft: rgba(200, 80, 28, .1);
  --accent-edge: rgba(200, 80, 28, .3);
  --on-accent: #ffffff;
  --text: #1b1b1d;
  --muted: #6b6a72;
  --ok: #1a8f4a;
  --on-ok: #ffffff;
  --top-bg: rgba(246, 245, 242, .9);
  --scrim: rgba(30, 28, 26, .4);
  --avatar: linear-gradient(135deg, #d8d3c8, #bdb7a9);
  --shadow: 0 24px 64px rgba(40, 35, 30, .18);
  --frame-bg: #ffffff;
  color-scheme: light;
}

/* «Шалфей» — общий стиль приложений (как «План»), тема по умолчанию. */
html[data-theme="sage"] {
  --bg: #16182b;
  --panel: #1d2034;
  --panel-2: #25283d;
  --line: #2c2f45;
  --line-strong: #3d4160;
  --accent: #5c9274;
  --accent-2: #b5d3c2;
  --accent-soft: rgba(92, 146, 116, .18);
  --accent-edge: rgba(92, 146, 116, .42);
  --on-accent: #ffffff;
  --text: #f3f4fa;
  --muted: #8f92a8;
  --ok: #5fb88f;
  --on-ok: #0b1f15;
  --top-bg: rgba(22, 24, 43, .86);
  --scrim: rgba(8, 9, 20, .7);
  --avatar: linear-gradient(135deg, #3a5a4a, #25283d);
  --shadow: 0 30px 80px rgba(0, 0, 0, .5);
  --frame-bg: #1a1c30;
  --radius: 16px;
  --font: "Onest", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --hfont: "Unbounded", "Onest", -apple-system, sans-serif;
  color-scheme: dark;
}
html[data-theme="sage"] h1, html[data-theme="sage"] .logo { font-family: var(--hfont); letter-spacing: -.03em; }

:root {
  --radius: 14px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sidebar: 340px;
  --search-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
}

.library-views { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 12px; }
.enroll-btn { margin: 10px 0; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; color: inherit; cursor: pointer; }
mark { background: var(--accent-soft); color: var(--accent); border-radius: 3px; padding: 0 2px; }
code, kbd { font-family: var(--mono); font-size: .92em; }

.shell { max-width: 1320px; margin: 0 auto; padding: 0 24px 80px; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 40;
  background: var(--top-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.top-inner {
  max-width: 1320px; margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; gap: 18px;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.02em; }
.logo-dot { width: 26px; height: 26px; border-radius: 8px; flex: none; display: block; }
.logo small { display: block; font-weight: 500; font-size: 11px; color: var(--muted); letter-spacing: .04em; }

.search-trigger {
  flex: 1; max-width: 520px; display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 11px;
  padding: 9px 12px; color: var(--muted); font-size: 14px; text-align: left;
  transition: border-color .15s, background .15s;
}
.search-trigger:hover { border-color: var(--line-strong); background: var(--panel-2); }
.search-trigger kbd {
  margin-left: auto; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 6px; padding: 2px 6px; font-size: 11px; color: var(--muted);
}
.top-spacer { flex: 1; }

/* ---------- catalog ---------- */
.hero { padding: 54px 0 30px; }
.hero h1 { font-size: clamp(30px, 5vw, 46px); margin: 0 0 12px; letter-spacing: -.03em; }
.hero p { margin: 0; color: var(--muted); font-size: 17px; max-width: 640px; line-height: 1.55; }

.stats { display: flex; flex-wrap: wrap; gap: 14px; margin: 30px 0 12px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 20px; min-width: 132px;
}
.stat b { display: block; font-size: 26px; letter-spacing: -.02em; }
.stat span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.stat-action { text-align: left; transition: border-color .16s, background .16s; }
.stat-action:hover, .stat-action:focus-visible { border-color: var(--accent-edge); }
.stat-action.on { border-color: var(--accent-edge); background: var(--accent-soft); }
.stat-action.on span { color: var(--accent); }

.section-title { margin: 42px 0 18px; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.section-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 42px 0 18px; }
.section-heading .section-title { margin: 0; scroll-margin-top: 90px; }
.section-heading [hidden] { display: none; }

.cards { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); }
.author-card {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 92px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 18px 20px; text-align: left; transition: border-color .16s, transform .16s;
}
.author-card:hover, .author-card:focus-visible { border-color: var(--accent-edge); transform: translateY(-2px); }
.author-card .avatar { width: 44px; height: 44px; font-size: 16px; }
.author-image { position: relative; width: 64px; height: 64px; flex: none; overflow: hidden; border-radius: 16px; background: var(--panel-2); }
.author-image img { width: 100%; height: 100%; display: block; object-fit: cover; }
.author-card-info { display: grid; gap: 4px; min-width: 0; }
.author-card-info b { font-size: 17px; line-height: 1.3; overflow-wrap: anywhere; }
.author-card-info small { color: var(--muted); font-size: 13px; }
.author-card-arrow { margin-left: auto; color: var(--accent); font-size: 22px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 22px; display: flex; flex-direction: column; gap: 14px;
  transition: border-color .16s, transform .16s;
}
.card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.badge {
  display: inline-block; align-self: flex-start; font-size: 11px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--accent); background: var(--accent-soft);
  border-radius: 999px; padding: 4px 11px;
}
.card h3 { margin: 0; font-size: 20px; line-height: 1.3; letter-spacing: -.02em; }
.card .author { color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  background: var(--avatar);
  display: grid; place-items: center; font-size: 12px; color: var(--text);
}
.metrics { color: var(--muted); font-size: 13px; }
.bar { height: 6px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.card .cta {
  margin-top: auto; background: var(--accent); color: var(--on-accent); border: none;
  border-radius: 10px; padding: 11px 16px; font-weight: 600; font-size: 14px;
}
.card .cta:hover { filter: brightness(1.08); }

/* ---------- lesson layout ---------- */
.lesson-wrap { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); gap: 26px; align-items: start; }
body.focus .lesson-wrap { grid-template-columns: minmax(0, 1fr); }
body.focus .sidebar { display: none; }

.sidebar {
  position: sticky; top: 74px; max-height: calc(100vh - 96px); overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px; scrollbar-width: thin;
}
.module-head {
  width: 100%; display: flex; align-items: center; gap: 9px; background: none; border: none;
  padding: 11px 10px; font-size: 13px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em; text-align: left;
}
.module-head .caret { margin-left: auto; transition: transform .16s; font-size: 11px; }
.module.collapsed .caret { transform: rotate(-90deg); }
.module.collapsed .module-body { display: none; }
.lesson-link {
  width: 100%; display: flex; gap: 10px; align-items: flex-start; background: none;
  border: none; border-radius: 10px; padding: 9px 10px; text-align: left; font-size: 14px;
  line-height: 1.35; color: var(--text);
}
.lesson-link:hover { background: var(--panel-2); }
.lesson-link.active { background: var(--accent-soft); color: var(--accent); }
.lesson-link .ico { flex: none; width: 18px; text-align: center; opacity: .85; }
.lesson-link .txt { flex: 1; min-width: 0; }
.lesson-link .dur { display: block; margin-top: 3px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lesson-link .dur:empty { display: none; }
.lesson-link.done .txt { color: var(--muted); }
.tick {
  flex: none; width: 17px; height: 17px; border-radius: 5px; margin-top: 1px;
  border: 1px solid var(--line); display: grid; place-items: center; font-size: 11px;
  background: var(--bg); color: transparent;
}
.lesson-link.done .tick { background: var(--ok); border-color: var(--ok); color: var(--on-ok); }

/* ---------- player + tabs ---------- */
.stage { min-width: 0; }
.crumbs { color: var(--muted); font-size: 13px; margin-bottom: 10px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.stage h1 { margin: 0 0 16px; font-size: clamp(21px, 2.6vw, 30px); letter-spacing: -.025em; line-height: 1.22; }

.player {
  position: relative; background: #000; border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9;
}
.player video, .player iframe { width: 100%; height: 100%; display: block; border: 0; }
.player .none { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 14px; padding: 20px; text-align: center; }
.media-notice { position: absolute; left: 12px; right: 12px; bottom: 12px; padding: 10px 14px; border-radius: 9px; background: rgba(20,20,20,.9); color: #fff; font-size: 13px; }
.media-notice[hidden] { display: none; }
.media-notice a { color: #fff; text-decoration: underline; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0 18px; }
.chip {
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px;
  padding: 7px 12px; font-size: 13px; color: var(--muted);
}
.chip:hover { border-color: var(--line-strong); color: var(--text); }
.chip.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.controls .spacer { flex: 1; }
.clip-range { color: var(--muted); font-size: 12px; white-space: nowrap; }
.return-to-client { color: var(--accent); font-size: 12px; }
.return-slot { position: sticky; top: 68px; z-index: 24; width: max-content; max-width: 100%; margin: 0 0 12px; }
.return-slot:empty { display: none; }
.return-to-prep { display: inline-flex; align-items: center; min-height: 42px; padding: 9px 14px; border: 1px solid var(--accent-edge); border-radius: 11px; background: color-mix(in srgb, var(--panel) 94%, transparent); color: var(--accent); box-shadow: 0 7px 22px rgba(31,72,112,.1); backdrop-filter: blur(12px); font-size: 13px; font-weight: 700; }
.return-to-prep:hover, .return-to-prep:focus-visible { background: var(--accent-soft); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tab {
  background: none; border: none; border-bottom: 2px solid transparent; white-space: nowrap;
  padding: 11px 14px; font-size: 14px; color: var(--muted); font-weight: 500;
}
.tab:hover { color: var(--text); }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); }
.tab .count { font-size: 11px; opacity: .7; }
.panel { padding: 18px 0 40px; min-height: 260px; }
.empty { color: var(--muted); font-size: 14px; padding: 36px 0; text-align: center; }

.prose { line-height: 1.7; font-size: 16px; max-width: 800px; }
.prose h1, .prose h2, .prose h3 { letter-spacing: -.02em; line-height: 1.3; margin: 1.6em 0 .6em; }
.prose p { margin: 0 0 1em; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 1em; }
.prose li { margin: .35em 0; }
.prose code { background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
.prose blockquote { margin: 1em 0; padding: 10px 16px; border-left: 3px solid var(--accent); background: var(--panel); border-radius: 0 10px 10px 0; color: var(--muted); }

.conspect-frame { width: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: var(--frame-bg); display: block; }

/* ---------- transcript ---------- */
.tx-tools { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tx-tools input {
  flex: 1; min-width: 200px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 12px; color: var(--text); font-size: 14px; font-family: inherit;
}
.tx-tools input:focus { outline: none; border-color: var(--accent); }
/* No inner scroll: with the player pinned, the transcript should scroll
   with the page so the active line settles under the video. */
.tx-list { padding-right: 6px; }
.seg {
  display: flex; gap: 12px; padding: 9px 12px; border-radius: 10px; cursor: pointer;
  border: 1px solid transparent; transition: background .12s, border-color .12s;
}
.seg.seekable:hover { background: var(--panel); }
.seg:not(.seekable) { cursor: default; opacity: .72; }
.seg time { flex: none; color: var(--muted); font-family: var(--mono); font-size: 12px; padding-top: 3px; min-width: 50px; }
.seg p { margin: 0; line-height: 1.6; font-size: 15px; }
.seg.active { background: var(--accent-soft); border-color: var(--accent-edge); }
.seg.active time { color: var(--accent); }
.seg.hit { border-color: var(--accent-edge); }

/* ---------- materials ---------- */
.files { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.file {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px;
  display: flex; gap: 12px; align-items: center;
}
.file .ico { font-size: 22px; }
.file b { display: block; font-size: 14px; font-weight: 600; }
.file span { font-size: 12px; color: var(--muted); }
.pdf-frame { width: 100%; height: 78vh; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }

.pager { display: flex; gap: 10px; justify-content: space-between; margin-top: 26px; }
.pager button { flex: 1; background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 13px; font-size: 14px; text-align: left; }
.pager button:hover:not(:disabled) { border-color: var(--line-strong); }
.pager button:disabled { opacity: .35; cursor: default; }
.pager small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; }

/* ---------- search modal ---------- */
.modal { position: fixed; inset: 0; z-index: 90; display: none; }
.modal.open { display: block; }
.modal-bg { position: absolute; inset: 0; background: var(--scrim); backdrop-filter: blur(3px); }
.modal-box {
  position: relative; max-width: 720px; margin: 9vh auto 0; background: var(--panel);
  border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  box-shadow: var(--shadow);
}
.modal-box input {
  width: 100%; background: none; border: none; border-bottom: 1px solid var(--line);
  padding: 18px 20px; font-size: 17px; color: var(--text); font-family: inherit;
}
.modal-box input:focus { outline: none; }
.results { max-height: 62vh; overflow-y: auto; }
.result { display: block; width: 100%; text-align: left; background: none; border: none; padding: 13px 20px; border-bottom: 1px solid var(--line); }
.result:hover, .result.sel, .result-wrap.sel .result { background: var(--panel-2); }
.result-wrap { border-bottom: 1px solid var(--line); }
.result-wrap .result { border-bottom: 0; }
.result-match, .search-more { border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); color: var(--muted); padding: 7px 10px; margin: 0 0 9px 20px; font-size: 12px; }
.result-match:hover, .search-more:hover { border-color: var(--accent-edge); color: var(--text); }
.search-more { display: block; margin: 13px auto; color: var(--text); }
.result .where { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; display: flex; gap: 8px; }
.result .where .at { color: var(--accent); font-family: var(--mono); text-transform: none; }
.result b { display: block; font-size: 14px; margin-bottom: 3px; }
.result p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.modal-foot { padding: 10px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; display: flex; gap: 14px; }

.burger { display: none; }

@media (max-width: 960px) {
  .shell { padding: 0 16px 90px; }
  .top-inner { padding: 12px 16px; gap: 12px; }
  .logo small { display: none; }
  .lesson-wrap { grid-template-columns: minmax(0, 1fr); }
  .burger { display: inline-flex; }
  .sidebar {
    position: fixed; inset: auto 0 0 0; top: auto; max-height: 76vh; z-index: 60;
    border-radius: 18px 18px 0 0; transform: translateY(101%); transition: transform .22s ease;
    box-shadow: 0 -20px 60px rgba(0, 0, 0, .6);
  }
  .sidebar.open { transform: translateY(0); }
  .pdf-frame { height: 62vh; }
  .modal-box { margin: 0; border-radius: 0; max-width: none; height: 100%; }
  .results { max-height: calc(100vh - 118px); }
}

/* inline icons */
svg.i { flex: none; vertical-align: -3px; }
.tab, .chip, .file, .lesson-link .ico { display: inline-flex; align-items: center; gap: 7px; }
.tab { display: inline-flex; }
.file { display: flex; }
.lesson-link .ico { color: var(--muted); }
.lesson-link.active .ico { color: var(--accent); }

@media (max-width: 620px) {
  /* Narrow header: the search box collapses to its icon rather than an empty pill. */
  .search-trigger { flex: none; width: 40px; justify-content: center; padding: 9px 0; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .search-trigger::after { content: ""; width: 16px; height: 16px; flex: none;
    background: currentColor; -webkit-mask: var(--search-icon) center/contain no-repeat;
    mask: var(--search-icon) center/contain no-repeat; }
  .top-inner { gap: 8px; }
  .stage h1 { font-size: 20px; }
  /* One scrollable row keeps the pinned block short on phones. */
  .controls { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .controls::-webkit-scrollbar { display: none; }
  .controls .spacer { display: none; }
  .chip { flex: none; }
}

/* ---------- pinned player ----------
   The video stays put at the top of the column; conspect, summary and
   transcript scroll underneath it. Height is capped so that on short screens
   the player never crowds out the text. */
.player-slot {
  position: sticky; top: 64px; z-index: 30;
  background: var(--bg); padding: 6px 0 10px;
}
.player-slot .player {
  width: min(100%, calc((100vh - 320px) * 16 / 9));
  margin-inline: auto;
}
.player-slot .controls { margin: 10px 0 0; }
body.focus .player-slot .player { width: min(100%, calc((100vh - 260px) * 16 / 9)); }
.player-slot .tabs { margin-top: 10px; }

@media (max-width: 960px) {
  .player-slot { top: 58px; }
  .player-slot .player { width: min(100%, calc((100vh - 290px) * 16 / 9)); }
}

/* ---------- settings menu ---------- */
.menu-wrap { position: relative; }
.menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 70; min-width: 220px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 13px;
  padding: 8px; box-shadow: var(--shadow); display: none;
}
.menu.open { display: block; }
.menu h4 {
  margin: 4px 8px 8px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.theme-option {
  width: 100%; display: flex; align-items: center; gap: 10px; background: none;
  border: 1px solid transparent; border-radius: 9px; padding: 8px 9px;
  font-size: 14px; text-align: left; color: var(--text);
}
.theme-option:hover { background: var(--panel-2); }
.theme-option.on { border-color: var(--accent); color: var(--accent); }
.swatch {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  border: 1px solid var(--line); overflow: hidden; display: flex;
}
.swatch i { flex: 1; height: 100%; display: block; }
.theme-option .mark { margin-left: auto; opacity: 0; }
.theme-option.on .mark { opacity: 1; }

/* ---------- tabs: fixed strip, never scrolls ----------
   Four equal cells that always fit; labels shorten before anything overflows. */
.tabs .tab {
  flex: 1 1 0; min-width: 0; justify-content: center;
  padding: 11px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.tabs .tab svg.i { flex: none; }
.tabs .tab.off { opacity: .45; }
.tabs .tab.off.on { opacity: 1; }
@media (max-width: 760px) {
  .tabs .tab { font-size: 13px; gap: 5px; padding: 11px 2px; }
  .tabs .tab .long, .tabs .tab .count { display: none; }
}
/* Five tabs do not fit with icons on a phone; the labels matter more. */
@media (max-width: 560px) {
  .tabs .tab svg.i { display: none; }
  .tabs .tab { font-size: 12.5px; }
}
/* No stray horizontal scroll anywhere; `clip` keeps sticky positioning intact. */
html, body { overflow-x: clip; }

.player-slot.no-video .player, .player-slot.no-video .controls { display: none; }
.player-slot.no-video { padding-top: 0; }
#courseProgress { white-space: nowrap; flex: none; }
.top-inner > * { min-width: 0; }
@media (max-width: 620px) {
  #courseProgress .long { display: none; }
  /* Кнопок в шапке стало шесть — словесный логотип уступает им место. */
  .logo > span:last-child { display: none; }
  /* A long name would push the lesson counter off the screen; the menu still shows it. */
  #userbox .long { display: none; }
  /* The icon carries the brand on phones; the wordmark only crowds the controls. */
  body:has(.lesson-wrap) .logo > span:last-child { display: none; }
}
@media (max-width: 380px) {
  .logo > span:last-child { display: none; }
}

/* ---------- clickable timecodes in summary / conspect ---------- */
.tc {
  display: inline-block; font-family: var(--mono); font-size: .82em; line-height: 1.3;
  padding: 1px 6px; margin: 0 2px; border-radius: 6px; vertical-align: 1px;
  border: 1px solid var(--accent-edge); background: var(--accent-soft); color: var(--accent);
}
.tc:hover { background: var(--accent); color: var(--on-accent); }
.prose h2 .tc, .prose h3 .tc { font-size: .6em; vertical-align: 3px; }
.gen-note {
  display: flex; align-items: center; gap: 6px; margin: 0 0 16px;
  font-size: 12px; color: var(--muted);
}

/* ---------- login ---------- */
body.auth { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.auth-box {
  width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 28px 24px; box-shadow: var(--shadow);
}
.auth-logo { width: 40px; height: 40px; display: block; margin-bottom: 14px; }
.auth-box h1 { margin: 0 0 6px; font-size: 22px; letter-spacing: -.02em; }
.auth-hint { margin: 0 0 20px; color: var(--muted); font-size: 14px; }
.auth-box label { display: block; margin: 12px 0 6px; font-size: 13px; color: var(--muted); }
.auth-box input {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; color: var(--text); font: inherit; font-size: 15px;
}
.auth-box input:focus { outline: none; border-color: var(--accent); }
.auth-box .primary {
  width: 100%; margin-top: 20px; background: var(--accent); color: var(--on-accent);
  border: none; border-radius: 10px; padding: 12px; font-weight: 600; font-size: 15px;
}
.auth-box .primary:disabled { opacity: .6; }
.auth-error { margin: 14px 0 0; color: #ff6b6b; font-size: 13px; min-height: 18px; }

/* ---------- accounts screen ---------- */
.user-form { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 6px; }
.user-form input, .user-form select {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; color: var(--text); font: inherit; font-size: 14px; min-width: 150px;
}
.user-form input:focus, .user-form select:focus { outline: none; border-color: var(--accent); }
.secret {
  margin: 12px 0; padding: 12px 14px; border: 1px solid var(--accent-edge);
  background: var(--accent-soft); border-radius: 12px; font-size: 14px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.secret[hidden] { display: none; }
.secret code { background: var(--panel); padding: 3px 8px; border-radius: 6px; font-size: 14px; }
.secret .hint { color: var(--muted); font-size: 12px; }
.users { display: grid; gap: 10px; margin-top: 18px; }
.user {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px;
  display: grid; gap: 6px; grid-template-columns: 1fr auto; align-items: center;
}
.user.off { opacity: .55; }
.user-main { grid-column: 1; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.user-login { color: var(--muted); font-size: 13px; }
.user-meta { grid-column: 1; color: var(--muted); font-size: 12px; }
.user-actions { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 8px; }
@media (max-width: 620px) {
  .user { grid-template-columns: 1fr; }
  .user-actions { grid-column: 1; grid-row: auto; }
}

/* ---------- directions ---------- */
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.track-chip .dot { margin-right: 2px; }
#trackMenu .theme-option { display: flex; align-items: center; gap: 10px; }
#trackMenu .theme-option small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.track-tag {
  display: inline-flex; align-items: center; gap: 7px; align-self: flex-start;
  font-size: 12px; color: var(--muted); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; margin-top: -6px;
}
.results .where .dot { margin-right: 6px; vertical-align: baseline; background: var(--accent); }
.modal-foot .spacer { flex: 1; }
.modal-foot .scope {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 11px; font-size: 12px; color: var(--muted);
}
.modal-foot .scope.on { border-color: var(--accent-edge); color: var(--accent); background: var(--accent-soft); }
@media (max-width: 620px) {
  .track-chip .long { display: none; }
}

/* ---------- the lesson's tutor ---------- */
.ask { display: flex; gap: 10px; margin: 4px 0 8px; }
.ask input {
  flex: 1; background: var(--panel); border: 1px solid var(--line); border-radius: 11px;
  padding: 11px 14px; color: var(--text); font: inherit; font-size: 15px;
}
.ask input:focus { outline: none; border-color: var(--accent-edge); }
.ask-hint { color: var(--muted); font-size: 12.5px; line-height: 1.5; margin: 0 0 18px; }
.answers { display: grid; gap: 16px; }
.answer {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px;
}
.answer h4 { margin: 0 0 4px; font-size: 15px; }
.answer .thinking { color: var(--muted); font-size: 14px; margin: 8px 0 0; }
.scope-tag {
  display: inline-block; font-size: 11px; color: var(--muted); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; margin-bottom: 8px;
}
.cites { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.cite {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 11px; font-size: 12px; color: var(--muted); text-align: left;
}
.cite b { color: var(--accent); margin-right: 4px; }
.cite:hover { border-color: var(--accent-edge); color: var(--text); }

/* ---------- the author's own lesson text ---------- */
.author-text {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 4px 18px 2px; margin-bottom: 16px;
}
.author-text > summary {
  display: flex; align-items: center; gap: 9px; cursor: pointer;
  padding: 12px 0; font-weight: 600; font-size: 15px; list-style: none;
}
.author-text > summary::-webkit-details-marker { display: none; }
.author-text > summary span { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.author-text[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.author-text .prose { padding-bottom: 14px; }

/* main lecture vs supplementary material */
.lesson-link .extra {
  font-style: normal; font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 1px 6px; margin-left: 7px; vertical-align: 1px;
}

/* ---------- tasks and notes ---------- */
.tasks { display: grid; gap: 10px; }
.task {
  display: flex; gap: 11px; align-items: flex-start; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 15px; line-height: 1.5; font-size: 15px;
}
.task input { margin: 3px 0 0; width: 17px; height: 17px; accent-color: var(--accent); flex: none; }
.task.done { opacity: .55; }
.task.done span { text-decoration: line-through; }
.note-box {
  width: 100%; min-height: 320px; resize: vertical;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px 18px; color: var(--text); font: inherit; font-size: 15.5px; line-height: 1.6;
}
.note-box:focus { outline: none; border-color: var(--accent-edge); }
.note-state { color: var(--muted); font-size: 12px; margin: 8px 2px 0; min-height: 16px; }

/* Семь вкладок в один ряд на телефон не помещаются: 4 + 3, два этажа. */
@media (max-width: 700px) {
  .tabs { flex-wrap: wrap; row-gap: 0; }
  .tabs .tab { flex: 1 1 22%; padding: 9px 4px; font-size: 12.5px; }
  /* «Фокус» прячет боковой список, которого на телефоне и так нет. */
  #controls #focusMode { display: none; }
  .controls:empty, .controls:has(#focusMode:only-child) { display: none; }
}

/* ---------- notebook page ---------- */
.notes-list { display: grid; gap: 14px; margin-top: 10px; }
.note-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px;
}
.note-where { display: block; font-weight: 600; font-size: 14px; color: var(--accent); }
.note-where:hover { text-decoration: underline; }
.note-when { display: block; color: var(--muted); font-size: 12px; margin: 2px 0 8px; }
.note-card .prose { font-size: 15px; }
@media (max-width: 620px) {
  .top .chip[href="/notes"], .top .chip[href="/ask"] { font-size: 0; padding: 9px 11px; }
  .top .chip[href="/notes"]::before { content: "✎"; font-size: 14px; }
  .top .chip[href="/ask"]::before { content: "?"; font-size: 14px; }
}

/* ---------- lesson list: readable structure ---------- */
.sidebar-head { display: none; }
.module-head {
  gap: 10px; text-transform: none; letter-spacing: 0; font-size: 14px;
  color: var(--text); padding: 12px 10px; border-radius: 10px;
}
.module-head:hover { background: var(--panel-2); }
.module-head .caret { margin: 0; order: -1; color: var(--muted); font-size: 12px; }
.module-title { display: block; text-align: left; line-height: 1.35; }
.module-title small {
  display: block; color: var(--muted); font-weight: 400; font-size: 12px;
  text-transform: none; letter-spacing: 0; margin-top: 2px;
}
.module.collapsed .module-head .caret { transform: rotate(-90deg); }
.lesson-link .num { color: var(--muted); font-size: 12px; min-width: 26px; flex: none; padding-top: 1px; }
.lesson-link:hover { background: var(--panel-2); }

@media (max-width: 960px) {
  .sidebar { padding: 0 8px 10px; }
  .sidebar-head {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 2;
    background: var(--panel); padding: 14px 8px 12px; border-bottom: 1px solid var(--line);
    margin: 0 -8px 6px;
  }
  .sidebar-head b { font-size: 15px; }
  .sidebar-head span { color: var(--muted); font-size: 12.5px; }
  .sidebar-close {
    margin-left: auto; background: var(--panel-2); border: 1px solid var(--line);
    border-radius: 9px; width: 30px; height: 30px; color: var(--muted); font-size: 14px;
  }
  .module-head { font-size: 15px; padding: 14px 10px; }
  .lesson-link { padding: 12px 10px; }
}

/* ---------- course cover ---------- */
.card.with-cover { padding-top: 0; overflow: hidden; }
.card .cover { display: block; margin: 0 -22px 4px; aspect-ratio: 16 / 9; background: var(--panel-2); }
.card .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.course-card-cover { position: relative; overflow: hidden; }
.card .badge { margin-top: 4px; }
.card-text { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }

.group-label {
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  padding: 12px 10px 6px; border-top: 1px solid var(--line); margin: 6px 4px 2px;
}

/* сколько урока уже просмотрено */
.lesson-link .resume { color: var(--accent); font-weight: 600; }
.lesson-link .seen {
  display: block; height: 3px; border-radius: 2px; background: var(--panel-2);
  margin-top: 6px; overflow: hidden;
}
.lesson-link .seen i { display: block; height: 100%; background: var(--accent); }

/* предложение перейти к следующему уроку */
.next-up {
  position: absolute; inset: auto 0 0 0; z-index: 5;
  background: linear-gradient(180deg, transparent, var(--scrim) 40%);
  padding: 28px 18px 16px; display: grid; gap: 4px; color: #fff;
}
.next-up b { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; opacity: .75; }
.next-up span { font-size: 15px; font-weight: 600; line-height: 1.3; }
.next-actions { display: flex; gap: 8px; margin-top: 8px; }
.next-actions .chip { background: rgba(255, 255, 255, .14); border-color: transparent; color: #fff; }
.next-actions .chip.on { background: var(--accent); color: var(--on-accent); }
.next-up i { font-style: normal; opacity: .8; margin-left: 4px; }
.player { position: relative; }
/* Переключатель настройки, а не темы: перекраска тем его не трогает. */
.menu-toggle {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: none; border: none; border-radius: 10px; padding: 9px 10px;
  color: var(--text); font: inherit; font-size: 14px;
}
.menu-toggle:hover { background: var(--panel-2); }
.menu-toggle small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.menu-toggle .mark { margin-left: auto; opacity: 0; color: var(--accent); }
.menu-toggle.on .mark { opacity: 1; }

/* ---------- Study library and course overview ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
.catalog-page { padding-top: 30px; }
.ask-page .hero, .notes-page .hero { padding: 30px 0 20px; }
.catalog-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.catalog-head h1 { margin: 0; font-size: clamp(28px, 4vw, 40px); line-height: 1.2; }
.eyebrow { color: var(--muted); font-size: 13px; margin: 0 0 7px; }
.catalog-page .library-views { margin: 0 0 16px; }
.section-subnav { display: flex; gap: 8px; margin: 0 0 16px; }
.catalog-filter { display: block; margin-bottom: 20px; max-width: 440px; }
.catalog-filter input { width: 100%; padding: 12px 14px; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 11px; font: inherit; font-size: 15px; }
.catalog-filter input:focus { outline: 2px solid var(--accent-edge); }
.card { position: relative; }
.cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 430px), 1fr)); gap: 12px; }
.card.compact-card { padding: 16px 18px; gap: 9px; border-radius: 14px; }
.card.compact-card.with-cover { padding-top: 0; }
.compact-card .cover { margin: 0 -18px 4px; }
.compact-card .track-tag { margin: 0; }
.compact-card .bar { width: min(260px, 100%); height: 4px; }
.compact-card .metrics { margin-top: -5px; }
.card h2 { margin: 0; font-size: 20px; line-height: 1.3; letter-spacing: -.02em; }
.card h2 a::after { content: ""; position: absolute; inset: 0; }
.card .cover, .card-actions, .card .enroll-link { position: relative; z-index: 1; }
.card .author { overflow-wrap: anywhere; }
.card .bar { margin-top: auto; }
.card-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: auto; }
.card-actions .cta, .favorite-actions .cta, .course-actions .cta { display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: var(--on-accent); border-radius: 10px; padding: 10px 16px; font-size: 14px; font-weight: 700; }
.card-actions .chip, .favorite-actions .chip { padding: 10px 14px; }
.enroll-link { align-self: flex-start; background: none; border: 0; color: var(--muted); padding: 2px 0; font-size: 12px; text-decoration: underline; }
.enroll-link:hover { color: var(--text); }
.favorite-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.favorite-card h2 { margin: 14px 0 7px; font-size: 19px; }
.favorite-card p { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.favorite-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.load-error { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 34px 10px; }
.skeleton { pointer-events: none; overflow: hidden; }
.skeleton i { display: block; height: 14px; width: 72%; border-radius: 6px; background: var(--panel-2); animation: skeleton-pulse 1.1s ease-in-out infinite alternate; }
.skeleton i:nth-child(2) { width: 92%; height: 22px; }.skeleton i:nth-child(3) { width: 45%; }
@keyframes skeleton-pulse { to { opacity: .4; } }
.action-status { margin: -8px 0 12px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); font-size: 13px; }
.action-status.error { border-color: #d45555; color: var(--text); }
.action-status .chip { margin-left: 8px; }
.course-page { padding-top: 28px; }
.course-intro { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 32px; align-items: start; margin: 25px 0 42px; }
.course-cover { position: relative; width: 100%; aspect-ratio: 16/9; object-fit: cover; overflow: hidden; border-radius: 15px; background: var(--panel); }
.course-cover-placeholder > img { width: 100%; height: 100%; display: block; object-fit: cover; }
.course-intro h1 { font-size: clamp(28px, 4vw, 42px); margin: 12px 0 9px; line-height: 1.15; }
.course-author { color: var(--accent); text-decoration: underline; }
.course-description { color: var(--muted); line-height: 1.6; max-width: 760px; white-space: pre-line; }
.course-progress { max-width: 400px; margin-top: 20px; color: var(--muted); font-size: 13px; }
.course-progress .bar { margin-bottom: 8px; }
.course-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.course-actions .chip { padding: 10px 14px; }
.entity-settings-button { width: 42px; padding: 10px; }
.catalog-head > div:first-child { min-width: 0; }
.catalog-head-actions { display: flex; align-items: center; gap: 8px; }
.entity-settings { width: min(560px, calc(100% - 24px)); padding: 0; border: 0; border-radius: 18px; color: var(--text); background: var(--panel); box-shadow: var(--shadow); }
.entity-settings::backdrop { background: rgba(20, 33, 45, .38); backdrop-filter: blur(3px); }
.entity-settings-card { display: grid; gap: 18px; padding: 22px; }
.entity-settings-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.entity-settings-head small { color: var(--accent); font-size: 11px; font-weight: 750; letter-spacing: .1em; }
.entity-settings-head h2 { margin: 4px 0 0; font-size: 25px; }
.entity-settings-head .chip { width: 36px; height: 36px; padding: 0; font-size: 23px; }
.entity-settings-card > label { display: grid; gap: 7px; font-size: 13px; font-weight: 700; }
.entity-settings-card input { width: 100%; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-2); color: var(--text); padding: 12px 13px; font: inherit; }
.entity-settings-card input[type=file] { color: var(--muted); }
.entity-location { display: grid; gap: 5px; padding: 12px 13px; border-radius: 11px; background: var(--panel-2); font-size: 13px; overflow-wrap: anywhere; }
.entity-location + .entity-location { margin-top: 7px; }
.entity-location span { color: var(--muted); }
.entity-location a { color: var(--accent); }
.entity-settings-status { min-height: 18px; margin: -6px 0; color: var(--muted); font-size: 13px; }
.entity-settings-actions { display: flex; justify-content: flex-end; gap: 9px; }
.entity-settings-actions .cta { border: 0; padding: 10px 18px; }
.course-outline { max-width: 900px; }
.course-outline h2 { font-size: 22px; margin: 0 0 16px; }
.course-module { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; overflow: hidden; }
.course-module summary { display: flex; justify-content: space-between; gap: 12px; align-items: center; cursor: pointer; padding: 17px 20px; list-style-position: inside; }
.course-module summary span { color: var(--muted); font-size: 12px; flex: none; }
.course-lessons { border-top: 1px solid var(--line); }
.course-lesson { display: flex; align-items: center; gap: 12px; padding: 13px 20px; border-bottom: 1px solid var(--line); }
.course-lesson:last-child { border-bottom: 0; }
.course-lesson:hover { background: var(--panel-2); }
.course-lesson-num { color: var(--muted); width: 24px; flex: none; font-family: var(--mono); font-size: 12px; }
.course-lesson-name { flex: 1; min-width: 0; }
.course-lesson-name b { display: block; font-size: 14px; line-height: 1.35; }
.course-lesson-name small { display: block; color: var(--muted); margin-top: 3px; font-size: 12px; }
.course-lesson-arrow { color: var(--accent); flex: none; }
.course-lesson.done .course-lesson-arrow { color: var(--ok); }
.course-materials { max-width: 900px; margin-top: 38px; }
.course-materials h2 { font-size: 22px; margin: 0 0 14px; }
.course-material-list { display: grid; gap: 8px; }
.course-material-list a { display: flex; justify-content: space-between; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 15px; font-size: 14px; }
.course-material-list a:hover { border-color: var(--accent-edge); }
.course-material-list span { color: var(--accent); flex: none; }

/* ---------- lesson actions and mobile navigation ---------- */
.lesson-heading { display: flex; align-items: flex-start; gap: 12px; }
.lesson-heading h1 { flex: 1; min-width: 0; }
.favorite-btn { width: 40px; height: 40px; padding: 0; margin-top: 2px; flex: none; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; font-size: 23px; line-height: 1; }
.lesson-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 0 4px; }
.lesson-actions .tab { border: 1px solid var(--line); background: var(--panel); border-radius: 9px; padding: 9px 12px; font-size: 13px; }
.lesson-actions .tab.on { border-color: var(--accent); background: var(--accent-soft); }
.mobile-nav { display: none; }
.top .burger { display: none; }
.search-row { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.search-row input { flex: 1; min-width: 0; border-bottom: none; }
.search-row button { margin-right: 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.search-open { overflow: hidden; }
@media (max-width: 960px) {
  .top .burger { display: inline-flex; }
  .course-intro { grid-template-columns: 1fr; gap: 20px; }
  .course-cover { max-width: 500px; }
  .mobile-nav {
    display: flex; position: fixed; inset: auto 0 0 0; z-index: 50;
    padding-bottom: env(safe-area-inset-bottom); background: var(--top-bg);
    border-top: 1px solid var(--line); backdrop-filter: blur(14px); isolation: isolate;
  }
  .mobile-nav a {
    flex: 1; min-width: 0; min-height: 48px; display: flex; align-items: center;
    justify-content: center; text-align: center; padding: 8px 2px; font-size: 11px;
    color: var(--muted); white-space: nowrap; touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-nav a.on { color: var(--accent); font-weight: 700; }
  .shell { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
}
@media (max-width: 620px) {
  .catalog-page { padding-top: 22px; }
  .catalog-head { align-items: center; }
  .catalog-page .library-views { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding: 0 16px 5px; }
  .catalog-page .library-views::-webkit-scrollbar { display: none; }
  .catalog-page .library-views .chip { flex: none; }
  .catalog-filter { max-width: none; }
  .top-optional { display: none; }
  .top-inner { padding: 9px 12px; gap: 7px; }
  .top-inner .logo { flex: none; }
  #trackbox, #settings, #userbox, #burger { flex: none; }
  #settingsBtn, #userBtn { display: inline-flex; justify-content: center; width: 38px; height: 38px; padding: 0; }
  #trackBtn { width: 38px; height: 38px; padding: 0; justify-content: center; }
  .search-trigger { width: 38px; height: 38px; }
  #burger { width: 62px; height: 38px; justify-content: center; padding: 0; }
  .lesson-heading { align-items: flex-start; }
  .favorite-btn { width: 38px; height: 38px; padding: 0; justify-content: center; }
  .lesson-actions .tab { font-size: 12px; }
  .mobile-nav {
    display: flex; position: fixed; inset: auto 0 0 0; z-index: 50;
    padding-bottom: env(safe-area-inset-bottom); background: var(--top-bg);
    border-top: 1px solid var(--line); backdrop-filter: blur(14px);
    /* Keep the navigation in its own top layer when a page has sticky content. */
    isolation: isolate;
  }
  .mobile-nav a {
    flex: 1; min-width: 0; min-height: 48px; display: flex; align-items: center;
    justify-content: center; text-align: center; padding: 8px 2px; font-size: 11px;
    color: var(--muted); white-space: nowrap; touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-nav a.on { color: var(--accent); font-weight: 700; }
  .shell { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
  .course-module summary { padding: 14px; }
  .course-module summary span { display: none; }
  .course-lesson { padding: 12px 14px; }
  .course-material-list a { display: block; }
  .course-material-list span { display: block; margin-top: 5px; font-size: 12px; }
  .ask { flex-wrap: wrap; }
  .ask input { min-width: 0; flex-basis: 100%; }
  .ask button { width: 100%; justify-content: center; }
  .modal-box { display: flex; flex-direction: column; height: 100dvh; }
  .results { flex: 1; max-height: none; }
  .modal-foot span:not(.spacer) { display: none; }
}
@media (max-width: 350px) {
  .top-inner { gap: 5px; padding-inline: 9px; }
  #settingsBtn, #userBtn, #trackBtn, .search-trigger { width: 36px; }
  #burger { width: 58px; }
  .mobile-nav a { font-size: 10px; padding-inline: 1px; }
}
.learning-banner { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:25px; padding:20px 24px; border:1px solid var(--accent-edge); border-radius:18px; background:linear-gradient(110deg,var(--accent-soft),var(--panel)); color:var(--text); }
.learning-banner small { display:block; color:var(--accent); letter-spacing:.08em; font-size:10px; font-weight:750; }
.learning-banner b { display:block; margin:6px 0; font-size:20px; }
.learning-banner span > span { color:var(--muted); font-size:13px; }
.learning-banner > span:last-child { color:var(--accent); font-size:25px; }
.massage-topics { margin:0 0 22px; display:grid; gap:7px; max-width:560px; }
.massage-topics label { font-size:13px; font-weight:650; }
.massage-topics select { min-height:44px; width:100%; padding:10px 12px; border:1px solid var(--line); border-radius:10px; color:var(--text); background:var(--panel); font:inherit; font-size:14px; }
.massage-topics small { color:var(--muted); font-size:11px; line-height:1.5; }
.course-topics { display:flex; flex-wrap:wrap; gap:5px; margin:0 0 10px; }
.course-topics span { font-size:10px; padding:4px 7px; border-radius:6px; background:var(--accent-soft); color:var(--accent); }
