:root {
  --navy: #242b39;
  --navy-2: #373f51;
  --accent: #ff6b00;
  --accent-soft: #fff1e6;
  --bg: #f4f5f8;
  --card: #ffffff;
  --text: #1d2330;
  --muted: #6b7385;
  --line: #e3e7ef;
  --ok: #1f9d55;
  --ok-soft: #e7f6ee;
  --bad: #e0453a;
  --bad-soft: #fdecea;
  --shadow: 0 1px 2px rgba(20, 27, 45, .06), 0 4px 16px rgba(20, 27, 45, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141821; --card: #1d2330; --text: #e9ecf2; --muted: #9aa3b5; --line: #2d3443;
    --accent-soft: #3a2512; --ok-soft: #14301f; --bad-soft: #3a1a18;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141821; --card: #1d2330; --text: #e9ecf2; --muted: #9aa3b5; --line: #2d3443;
  --accent-soft: #3a2512; --ok-soft: #14301f; --bad-soft: #3a1a18;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 Gilroy, Manrope, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: inherit; }
b { font-weight: 700; }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }

/* шапка */
.top { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 10; }
.top-in { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { text-decoration: none; display: flex; gap: 8px; align-items: baseline; font-weight: 800; letter-spacing: .04em; }
.logo span { font-size: 22px; }
.logo em { font-style: normal; font-size: 13px; color: var(--accent); letter-spacing: .18em; }
.top-r { display: flex; align-items: center; gap: 12px; }
.who { font-size: 14px; opacity: .85; }
.theme { width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(255,255,255,.2); background: var(--navy-2);
  display: grid; place-items: center; cursor: pointer; }
.theme svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; }
.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]) .i-sun { display: none; }
  :root:not([data-theme]) .i-moon { display: block; }
}

main { padding-top: 24px; padding-bottom: 64px; }
.loading { padding: 48px 0; text-align: center; color: var(--muted); }
h1 { font-size: 28px; line-height: 1.2; margin: 0 0 8px; font-weight: 800; }
h2 { font-size: 20px; margin: 0 0 12px; font-weight: 800; }
h3 { font-size: 17px; margin: 0 0 10px; font-weight: 700; }
.lead { color: var(--muted); margin: 0 0 20px; }
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.crumbs a { text-decoration: none; color: var(--muted); }
.crumbs a:hover { color: var(--accent); }

.card { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; border: 1px solid var(--line); }

/* головна: блок */
.block-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.pct { font-weight: 800; color: var(--accent); font-size: 20px; white-space: nowrap; }
.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 12px 0 16px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.lessons { list-style: none; margin: 0; padding: 0; }
.lessons a { display: flex; align-items: center; gap: 14px; padding: 12px 10px; margin: 0 -10px; border-radius: 10px; text-decoration: none; }
.lessons a:hover { background: var(--bg); }
.num { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px;
  background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.done .num { background: var(--ok); color: #fff; border-color: var(--ok); }
.l-t { flex: 1; font-weight: 600; }
.l-m { font-size: 13px; color: var(--muted); white-space: nowrap; }
.test-row .num { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.ref-link { display: flex; justify-content: space-between; align-items: center; text-decoration: none; }
.ref-link:hover h3 { color: var(--accent); }

/* урок */
.summary { border-left: 4px solid var(--accent); }
.summary ul { margin: 0; padding-left: 20px; }
.summary li { margin: 6px 0; }
.tag { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th, .tbl td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { font-size: 13px; color: var(--muted); font-weight: 600; }
.tbl td:first-child { font-weight: 600; }
.scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.pc { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pc ul { margin: 0; padding-left: 0; list-style: none; }
.pc li { padding: 4px 0 4px 26px; position: relative; }
.pc li::before { position: absolute; left: 0; top: 4px; font-weight: 800; }
.pros li::before { content: "+"; color: var(--ok); }
.cons li::before { content: "−"; color: var(--bad); }
.say { background: var(--accent-soft); border-color: transparent; }
.say p { margin: 0; font-size: 17px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; cursor: zoom-in; display: block; }
.gallery figcaption { font-size: 13px; color: var(--muted); margin-top: 6px; }
.video { position: relative; aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; background: #000; margin-bottom: 12px; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.media-list { display: grid; gap: 10px; }
.media-item { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; }
.media-item:hover { border-color: var(--accent); }
.play { width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--accent); display: grid; place-items: center; }
.play svg { width: 16px; height: 16px; fill: #fff; margin-left: 2px; }
.media-item small { display: block; color: var(--muted); font-size: 13px; }
details.art { border-top: 1px solid var(--line); }
details.art:first-of-type { border-top: 0; }
details.art summary { cursor: pointer; padding: 14px 0; font-weight: 600; list-style: none; display: flex; gap: 10px; justify-content: space-between; }
details.art summary::-webkit-details-marker { display: none; }
details.art summary::after { content: "+"; color: var(--accent); font-weight: 800; font-size: 20px; line-height: 1; }
details.art[open] summary::after { content: "−"; }
.art-body { padding: 0 0 12px; font-size: 15px; }
.art-body h4 { margin: 14px 0 6px; font-size: 15px; }
.art-body p, .art-body ul, .art-body ol { margin: 6px 0; }
.art-body ul, .art-body ol { padding-left: 20px; }

/* питання */
.q { margin-bottom: 18px; }
.q:last-child { margin-bottom: 0; }
.q-t { font-weight: 700; margin-bottom: 10px; }
.opts { display: grid; gap: 8px; }
.opt { text-align: left; font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 11px 14px; cursor: pointer; }
.opt:hover:not(:disabled) { border-color: var(--accent); }
.opt:disabled { cursor: default; }
.opt.right { background: var(--ok-soft); border-color: var(--ok); }
.opt.wrong { background: var(--bad-soft); border-color: var(--bad); }
.explain { margin-top: 10px; font-size: 15px; padding: 10px 14px; border-radius: 10px; background: var(--bg); }

.btn { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-weight: 700; border: 0; border-radius: 10px; padding: 13px 22px;
  background: var(--accent); color: #fff; cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn:disabled { opacity: .45; cursor: default; }
.nav { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.hint { font-size: 14px; color: var(--muted); }

/* тест */
.steps { display: flex; gap: 4px; margin-bottom: 16px; }
.steps i { flex: 1; height: 6px; border-radius: 99px; background: var(--line); }
.steps i.cur { background: var(--accent); }
.steps i.ok { background: var(--ok); }
.steps i.no { background: var(--bad); }
.result { text-align: center; padding: 28px 20px; }
.big { font-size: 48px; font-weight: 800; line-height: 1; margin: 8px 0; }
.big.ok { color: var(--ok); }
.big.no { color: var(--bad); }

.zoom { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: grid; place-items: center; z-index: 50; padding: 16px; cursor: zoom-out; }
.zoom[hidden] { display: none; }
.zoom img { max-width: 100%; max-height: 100%; border-radius: 8px; }

@media (max-width: 600px) {
  h1 { font-size: 23px; }
  .card { padding: 16px; }
  .pc { grid-template-columns: 1fr; }
  .who { display: none; }
  .tbl { font-size: 14px; }
}

/* вхід */
.login { max-width: 520px; margin: 24px auto; text-align: center; }
.login #tg-btn { min-height: 48px; display: flex; justify-content: center; margin-top: 16px; }
.login .explain { text-align: left; }
.who a { color: var(--accent); text-decoration: none; }
.vt { font-weight: 600; margin: 4px 0 8px; }

/* прогрес */
.hero { display: flex; align-items: center; gap: 20px; }
.hero-t { flex: 1; display: grid; gap: 6px; justify-items: start; }
.hero-h { font-size: 20px; font-weight: 800; }
.hero .btn { margin-top: 6px; }
.ring { --p: 0; width: 96px; height: 96px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--line) 0); }
.ring span { width: 76px; height: 76px; border-radius: 50%; background: var(--card); display: grid; place-items: center; font-weight: 800; font-size: 20px; }
.bar-note { margin: -8px 0 8px; font-size: 13px; }
.lsteps { display: flex; gap: 4px; margin-bottom: 14px; }
.lsteps a { flex: 1; height: 6px; border-radius: 99px; background: var(--line); }
.lsteps a.ok { background: var(--ok); }
.lsteps a.cur { background: var(--accent); }
.goals { border-left: 4px solid var(--ok); }
.goals ul { margin: 0; padding-left: 20px; }
.dur { display: inline-block; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 99px; padding: 1px 8px; margin-left: 6px; vertical-align: 1px; }
@media (max-width: 600px) { .hero { flex-direction: column; text-align: center; } .hero-t { justify-items: center; } }
