:root {
  --ground: #e6e9de;
  --paper: #f5f6f0;
  --ink: #1a1f17;
  --muted: #5a6352;
  --rule: #cbd1bf;
  --accent: #14703f;
  --accent-soft: #d4e6d5;
  --warn: #9a4a1c;
  --warn-soft: #f1e2d6;
  --code-bg: #eceee5;
  --glass: #c3cbb2;
  --seg: #1b2017;
  --seg-off: rgba(27, 32, 23, .07);
  --hot: #a8551e;
  --hot-soft: #f3e3d3;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --cond: "IBM Plex Sans Condensed", "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ground: #0f1117;
    --paper: #161a24;
    --ink: #e4e7ec;
    --muted: #949cae;
    --rule: #2b3244;
    --accent: #46d983;
    --accent-soft: #173826;
    --warn: #f0a46a;
    --warn-soft: #3a2616;
    --code-bg: #1c2130;
    --glass: #b9c2a6;
    --hot: #f0a46a;
    --hot-soft: #3a2616;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #0f1117;
  --paper: #161a24;
  --ink: #e4e7ec;
  --muted: #949cae;
  --rule: #2b3244;
  --accent: #46d983;
  --accent-soft: #173826;
  --warn: #f0a46a;
  --warn-soft: #3a2616;
  --code-bg: #1c2130;
  --glass: #b9c2a6;
  --hot: #f0a46a;
  --hot-soft: #3a2616;
}

body { margin: 0; background: var(--ground); color: var(--ink); font: 18px/1.65 var(--sans); }
.page { max-width: 1360px; margin: 0 auto; padding-inline: 20px; padding-block: 12px 72px; }
html { scroll-padding-top: 76px; }

/* закреплённая полоса сверху: своя подложка — ничего не наезжает на текст */
.top { position: sticky; top: 0; z-index: 10; padding-top: env(safe-area-inset-top, 0px); background: color-mix(in srgb, var(--ground) 88%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule); }
.top-in { max-width: 1360px; margin: 0 auto; padding: 0 20px; height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.bar-home { font: 600 17px/1.2 var(--cond); color: var(--ink); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.bar-home:hover { color: var(--accent); }
.bar-r { display: flex; align-items: center; gap: 10px; flex: none; }
.theme { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--rule); border-radius: 999px; background: var(--paper); color: var(--ink); cursor: pointer; padding: 0; }
.theme svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme .ic-moon { fill: currentColor; stroke: none; }
.theme .ic-sun { display: none; }
:root[data-theme="dark"] .theme .ic-sun { display: block; }
:root[data-theme="dark"] .theme .ic-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme .ic-sun { display: block; }
  :root:not([data-theme="light"]) .theme .ic-moon { display: none; }
}
.theme:hover { color: var(--accent); }
.theme:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.langs { display: inline-flex; border: 1px solid var(--rule); border-radius: 999px; background: var(--paper); padding: 3px; gap: 2px; }
.langs button { font: 600 13px/1 var(--cond); letter-spacing: .06em; border: 0; background: transparent; color: var(--muted); padding: 7px 14px; border-radius: 999px; cursor: pointer; }
.langs button.on { background: var(--ink); color: var(--paper); }
.langs button:focus-visible, .copy:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* шапка */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 400px); gap: 32px; align-items: center; padding-block: 18px 34px; border-bottom: 1px solid var(--rule); margin-bottom: 28px; }
.eyebrow { font: 600 13px/1 var(--cond); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: 12px; }
.hero h1 { font: 700 clamp(36px, 6vw, 60px)/1.02 var(--cond); letter-spacing: -.01em; margin: 0 0 14px; text-wrap: balance; }
.lead { font-size: 20px; color: var(--muted); margin: 0; max-width: 56ch; }
.device { background: #2a3141; border-radius: 18px; padding: 18px; box-shadow: inset 0 0 0 2px #3a4258, 0 12px 30px rgba(0,0,0,.18); }
.lcd { display: block; width: 100%; height: auto; background: var(--glass); border-radius: 6px; padding: 10px 12px; box-sizing: border-box; box-shadow: inset 0 0 0 1px rgba(0,0,0,.25), inset 0 2px 6px rgba(0,0,0,.18); }
.lcd .on, .lcd .colon rect { fill: var(--seg); }
.lcd .off { fill: var(--seg-off); }
.lcd .colon { animation: blink 1s steps(1, end) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .lcd .colon { animation: none; } }

/* раскладка */
.layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 48px; align-items: start; }
.toc { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 80px); max-height: calc(100vh - 100px); overflow: auto; font-size: 16px; line-height: 1.35; padding-right: 6px; }
.toc-h { font: 600 13px/1 var(--cond); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc > ol > li { margin-bottom: 9px; }
.toc > ol > li > a { font-weight: 600; color: var(--ink); }
.toc ol ol { display: none; margin: 6px 0 4px 10px; border-left: 1px solid var(--rule); padding-left: 12px; }
.toc li.open > ol { display: block; }
.toc ol ol a { color: var(--muted); font-size: 15px; display: block; padding: 3px 0; }
.toc a { text-decoration: none; }
.toc a:hover, .toc a.here { color: var(--accent); }
main { min-width: 0; max-width: 980px; }

/* урок */
.lesson { background: var(--paper); border: 1px solid var(--rule); border-radius: 14px; padding: 36px 40px 40px; margin-bottom: 30px; }
.lesson-title { font: 700 clamp(30px, 3.8vw, 40px)/1.1 var(--cond); margin: 0 0 16px; text-wrap: balance; }
.lesson h3 { font: 600 26px/1.25 var(--cond); margin: 34px 0 10px; text-wrap: balance; scroll-margin-top: 80px; }
.lesson h4 { font: 600 19px/1.3 var(--sans); margin: 24px 0 8px; scroll-margin-top: 80px; }
.lesson p { margin: 0 0 16px; }
.lesson ul, .lesson ol { margin: 0 0 16px; padding-left: 22px; }
.lesson li { margin-bottom: 6px; }
.lesson hr { border: 0; border-top: 1px dashed var(--rule); margin: 26px 0; }
.lesson strong { font-weight: 600; }
.lesson a { color: var(--accent); }
.lesson code { font: 500 .88em/1 var(--mono); background: var(--code-bg); padding: .12em .36em; border-radius: 4px; white-space: nowrap; }
.lesson blockquote { margin: 16px 0; padding: 12px 16px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; }
.warn-mark { color: var(--warn); font-weight: 700; }

/* таблицы сборки */
.tbl { overflow-x: auto; margin: 6px 0 18px; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper); }
.tbl table { border-collapse: collapse; width: 100%; font: 15px/1.5 var(--mono); font-variant-numeric: tabular-nums; }
.tbl th { text-align: left; font: 600 13px/1.3 var(--cond); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); background: var(--code-bg); padding: 8px 12px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.tbl td { padding: 7px 14px; vertical-align: top; border-top: 1px solid transparent; }
.tbl tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--code-bg) 45%, transparent); }
.tbl tr.grp td { border-top-color: var(--rule); }
.tbl tbody tr.grp:first-child td { border-top-color: transparent; }
.tbl td:first-child { font-weight: 600; white-space: nowrap; }
.tbl td.note { color: var(--accent); font-family: var(--sans); font-size: 15px; white-space: nowrap; }
.tbl td.span { font-family: var(--cond); font-weight: 600; letter-spacing: .05em; color: var(--muted); text-transform: none; background: var(--code-bg) !important; }

/* иллюстрации-схемы */
.ill { margin: 10px 0 22px; }
.ill-box { background: var(--paper); border: 1px solid var(--rule); border-radius: 12px; padding: 14px 12px; color: var(--ink); overflow-x: auto; }
.ill svg { display: block; width: 100%; min-width: 520px; height: auto; }
.ill figcaption { font-size: 16px; line-height: 1.5; color: var(--muted); margin-top: 8px; }
.ill .w, .ill .wv { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.ill .w.hot, .ill .wv.hot { stroke: var(--hot); stroke-width: 2.4; }
.ill .dsh { stroke-dasharray: 5 4; }
.ill .jd { fill: currentColor; }
.ill .jd.hot, .ill .ahd.hot { fill: var(--hot); }
.ill .ahd { fill: currentColor; }
.ill .bx, .ill .gt { fill: var(--paper); stroke: currentColor; stroke-width: 1.6; }
.ill .bx.hot, .ill .gt.hot { fill: var(--hot-soft); stroke: var(--hot); stroke-width: 2; }
.ill .t { font: 500 13px var(--mono); fill: currentColor; dominant-baseline: auto; }
.ill .t.b { font-weight: 600; font-size: 14px; }
.ill .t.s { font-size: 11.5px; }
.ill .t.m { fill: var(--muted); }
.ill .t.h { fill: var(--hot); }
.ill .bus { fill: var(--paper); stroke: currentColor; stroke-width: 1.2; }
.ill .bus.hot { fill: var(--hot-soft); stroke: var(--hot); }
.ill .pulse { fill: var(--hot); opacity: .22; }
.ill .em { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 4; }
.ill .glass { fill: var(--glass); }
.ill .ch { stroke: currentColor; stroke-width: 3; stroke-linecap: round; }
.ill .ch.g { stroke-width: 2; }
.ill .ch.hot { stroke: var(--hot); }
.ill .ch.off { stroke: var(--muted); stroke-dasharray: 3 5; }
.ill .rl { stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.ill .sg { fill: rgba(27, 32, 23, .08); }
.ill .sg.on { fill: var(--seg); }

/* игра в «Перед началом» */
.game-embed { margin: 8px 0 20px; }

/* экран главы 2 (точки ЖК) */
.scr .bgd { fill: rgba(27, 32, 23, .26); }
.scr .on { fill: var(--seg); }
.scr .off { fill: rgba(27, 32, 23, .06); }
.lcd.scr { padding: 8px; }
.ill-box.scrbox { background: var(--glass); }
.scrbox svg.scr { display: block; width: 100%; height: auto; min-width: 0; }
details.reveal { margin: 10px 0 16px; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper); }
details.reveal > summary { cursor: pointer; padding: 9px 14px; font: 600 15px/1.3 var(--sans); color: var(--accent); list-style: none; }
details.reveal > summary::-webkit-details-marker { display: none; }
details.reveal > summary::before { content: '▸'; display: inline-block; width: 1.1em; transition: transform .15s; }
details.reveal[open] > summary::before { transform: rotate(90deg); }
details.reveal > :not(summary) { margin: 0 14px 12px; }
details.reveal.hint p { margin: 0 14px 10px; }
.scr-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 700px) { .scr-grid { grid-template-columns: 1fr; } }
.scr-cell .ill-box { padding: 8px; }
.scr-cap { font-size: 15px; line-height: 1.4; color: var(--muted); margin-top: 6px; text-align: center; }
.scrbox .pix { display: block; width: 100%; max-width: 576px; height: auto; margin: 0 auto; image-rendering: pixelated; }
.map .nm { font: 600 3.1px var(--mono); fill: #a8551e; }
.map .nm.dg { font-size: 3.4px; }
.ill .cell { fill: none; stroke: currentColor; stroke-width: 1.2; }
.ill .cell.on { fill: var(--hot); stroke: var(--hot); }

/* оглавление: заголовки глав */
.toc .toc-group { font: 600 13px/1.2 var(--cond); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin: 16px 0 8px; }

/* все детали (как в LEGO) */
.pack { margin: 22px 0 26px; }
.pk { display: flex; align-items: baseline; gap: 12px; }
.pknum { font: 700 12px/1 var(--cond); letter-spacing: .12em; text-transform: uppercase; color: var(--paper); background: var(--ink); padding: 5px 9px; border-radius: 6px; }
.pkh { font: 600 24px/1.2 var(--cond); margin: 0; }
.pknote { color: var(--muted); font-size: 16px; margin: 6px 0 12px; }
.pcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: 10px; }
.pcard { background: var(--paper); border: 1px solid var(--rule); border-radius: 12px; padding: 10px 10px 12px; text-align: center; }
.pcard .pic { display: block; width: 80px; height: 60px; margin: 0 auto 4px; color: var(--ink); }
.pcard .pn { font: 700 22px/1.1 var(--cond); font-variant-numeric: tabular-nums; }
.pcard .pname { font: 600 14.5px/1.25 var(--mono); margin-top: 3px; word-break: break-word; }
.pcard .psub { font-size: 14px; color: var(--muted); margin-top: 2px; }
.pic .w, .pic .wv { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.pic .w.hot { stroke: var(--hot); stroke-width: 2.2; }
.pic .bx, .pic .gt { fill: var(--paper); stroke: currentColor; stroke-width: 1.6; }
.pic .gt.hot { fill: var(--hot-soft); stroke: var(--hot); }
.pic .t { font: 600 11px var(--mono); fill: currentColor; }
.pic .t.h { fill: var(--hot); }
.pic .t.s { font-size: 10px; }
.pic .ch { stroke: currentColor; stroke-width: 3; stroke-linecap: round; }
.pic .ch.off { stroke: currentColor; stroke-dasharray: none; }
.pic .ch.g { stroke-width: 2; }
.pic .rl { stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.pic .jd { fill: currentColor; }
.pic .glass { fill: var(--glass); }
.pic .sg { fill: rgba(27, 32, 23, .1); }
.pic .sg.on { fill: var(--seg); }

/* блоки кода */
.code { position: relative; margin: 6px 0 18px; }
.code .ln { display: block; white-space: pre; min-height: 1.5em; }
.code.fig .ln { min-height: 1.25em; }
.segfig { margin: 8px 0 20px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.segbox { background: var(--glass); border-radius: 10px; padding: 14px 22px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.2), inset 0 2px 6px rgba(0,0,0,.15); }
.segbox svg { display: block; width: 150px; height: auto; }
.segfig .sg { fill: var(--seg); }
.segfig .sl { font: 600 15px var(--mono); fill: #1b2017; text-anchor: middle; dominant-baseline: middle; }
.segfig figcaption { font-size: 16px; color: var(--muted); }
.code pre { margin: 0; overflow-x: auto; background: var(--code-bg); border: 1px solid var(--rule); border-radius: 10px; padding: 16px 18px; font: 15px/1.5 var(--mono); }
.code.fig pre { line-height: 1.25; }
.code.net pre { max-height: 420px; }
.copy { position: absolute; top: 8px; right: 8px; font: 600 13px/1 var(--cond); letter-spacing: .05em; border: 1px solid var(--rule); background: var(--paper); color: var(--ink); padding: 6px 10px; border-radius: 6px; cursor: pointer; }
.copy.done { color: var(--accent); border-color: var(--accent); }

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .toc { display: none; }   /* на узком экране — полное содержание в начале курса */
  .hero { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .device { max-width: 420px; }
}
@media (max-width: 520px) {
  .page { padding-inline: 16px; }
  .top-in { padding: 0 16px; height: 52px; }
  .bar-home { font-size: 15px; }
  .lesson { padding: 22px 18px 24px; border-radius: 12px; }
  body { font-size: 17px; }
}

/* полное содержание в начале курса (как в книге) */
.contents .cgroup { font: 600 14px/1.2 var(--cond); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin: 30px 0 12px; }
.contents .cgroup:first-of-type { margin-top: 8px; }
.contents ol { list-style: none; margin: 0; padding: 0; }
.contents > ol > li { margin: 0 0 18px; }
.contents .cl { font: 600 21px/1.3 var(--cond); color: var(--ink); text-decoration: none; }
.contents .cl:hover { color: var(--accent); }
.contents ol ol { margin: 6px 0 0; padding-left: 16px; border-left: 2px solid var(--rule); }
.contents ol ol li { margin: 0; }
.contents ol ol a { color: var(--muted); text-decoration: none; display: block; padding: 2px 0; }
.contents ol ol a:hover { color: var(--accent); }
.toc-h a { color: inherit; text-decoration: none; }
.toc-h a:hover { color: var(--accent); }

/* две ширины: текст — узкой колонкой (~65–70 знаков), таблицы/схемы/нетлисты — на всю ширину блока (до 900px) */
.lesson > p, .lesson > ul, .lesson > ol, .lesson > h3, .lesson > h4, .lesson > blockquote, .lesson > .lesson-title,
.contents > ol, .contents > .cgroup, .lesson figcaption, .pknote { max-width: 680px; }

/* снимки экрана симулятора с номерами-выносками */
.ill.shot .shot-box { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--rule); background: #111; }
.ill.shot img { display: block; width: 100%; height: auto; }
.ill.shot .shot-ov { position: absolute; inset: 0; width: 100%; height: 100%; min-width: 0; }
.ill.shot .shot-ov circle { fill: #e8833a; stroke: #fff; stroke-width: 4; }
.ill.shot .shot-ov line { stroke: #e8833a; stroke-width: 4; }
.ill.shot .shot-ov circle.tip { fill: #e8833a; stroke: #fff; stroke-width: 2; }
.ill.shot .shot-ov text { fill: #fff; font: 700 26px var(--sans); text-anchor: middle; }
.shot-leg { list-style: none; margin: 10px 0 4px; padding: 0; columns: 2 300px; column-gap: 28px; font-size: 15.5px; line-height: 1.4; }
.shot-leg li { break-inside: avoid; margin: 0 0 6px; }
.shot-leg b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #e8833a; color: #fff; font-size: 13px; margin-right: 6px; }

.ill.shot.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.ill.shot.pair figcaption { grid-column: 1 / -1; }
.ill.shot.pair .shot-cell p { font-size: 15px; color: var(--muted); margin: 6px 2px 0; line-height: 1.4; }
@media (max-width: 600px) { .ill.shot.pair { grid-template-columns: 1fr; } }

.toc a .lock, .contents a .lock, .pager .lock { width: .8em; height: .8em; margin-left: .35em; vertical-align: -.05em; fill: none; stroke: currentColor; stroke-width: 2.2; opacity: .55; }
.pager { display: flex; justify-content: space-between; gap: 14px; margin: 8px 0 30px; }
.pager a { flex: 1 1 0; max-width: 48%; border: 1px solid var(--rule); background: var(--paper); border-radius: 12px; padding: 12px 16px; color: var(--ink); text-decoration: none; font: 600 17px/1.3 var(--cond); }
.pager a span { display: block; font: 500 13px/1.2 var(--sans); color: var(--muted); margin-bottom: 4px; }
.pager a.next { margin-left: auto; text-align: right; }
.pager a:hover { border-color: var(--accent); color: var(--accent); }
.crumbs a { color: var(--ink); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumbs i { font-style: normal; color: var(--muted); margin: 0 .45em; }
.crumbs a:last-child:not(:first-child) { font-weight: 500; }
.langs a { font: 600 13px/1 var(--cond); letter-spacing: .06em; color: var(--muted); padding: 7px 14px; border-radius: 999px; text-decoration: none; }
.langs a.on { background: var(--ink); color: var(--paper); }
.langs a:hover:not(.on) { color: var(--ink); }
.stuck { margin: 18px 0 6px; font-size: 16px; color: var(--muted); }
.stuck a { color: var(--accent); font-weight: 600; }
footer.legal { font-size: 14px; color: var(--muted); padding: 0 4px 20px; }
footer.legal a { color: var(--muted); }
.pics-link { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 16px; padding: 7px 14px 7px 10px; border: 1px solid var(--rule); border-radius: 999px; color: var(--ink); text-decoration: none; font: 600 15px/1 var(--cond); }
.pics-link svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.pics-link:hover { border-color: var(--accent); color: var(--accent); }
.pics-top { margin: 0 0 18px; font-size: 16px; }
.sheets .sheet { background: #fff; border-radius: 8px; overflow: hidden; margin: 0 0 18px; box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.08); }
.sheets .sheet svg { display: block; width: 100%; height: auto; }

/* сайт курсов: витрина и список курсов (поверх стилей уроков page.css) */
.page.site { max-width: 1100px; }
.page.site .hero { margin-top: 8px; }
.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 22px; }
.btn { display: inline-block; background: var(--accent); color: var(--paper); text-decoration: none; font: 600 18px/1 var(--cond); letter-spacing: .03em; padding: 14px 22px; border-radius: 10px; border: 0; cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.lesson a.btn { color: var(--paper); text-decoration: none; }   /* ссылки урока зелёные — кнопке нужен свой цвет */
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.price { font: 600 18px/1 var(--cond); color: var(--muted); }
.hero .note { color: var(--muted); font-size: 16px; margin: 14px 0 0; max-width: 56ch; }
.page.site .contents ol { list-style: decimal; padding-left: 24px; }
.page.site .contents li { margin: 0 0 8px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.ccard { display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--rule); border-radius: 14px; padding: 20px; background: var(--paper); color: var(--ink); text-decoration: none; }
.ccard:hover { border-color: var(--accent); }
.ccard .cbox { display: block; width: 100%; height: auto; margin: 0 0 6px; transition: transform .2s; }
.ccard:hover .cbox { transform: translateY(-4px) rotate(-1deg); }
.ccard .ct { font: 700 24px/1.15 var(--cond); }
.ccard .cl { color: var(--muted); font-size: 16px; line-height: 1.5; }
.ccard .chips { display: flex; gap: 6px; flex-wrap: wrap; }
.ccard .chip { font: 600 13px/1 var(--cond); padding: 6px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--ink); }
.ccard .need { font: 500 14px/1.3 var(--cond); color: var(--muted); }
.ccard .cfoot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; }
.ccard .go { color: var(--accent); font: 600 16px/1 var(--cond); margin-left: auto; }
.ccard .tag { font: 600 14px/1 var(--cond); letter-spacing: .02em; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--rule); color: var(--muted); }
.ccard .tag.free { background: #1f8a50; border-color: #1f8a50; color: #fff; }

/* страница ошибки */
.lesson.err { max-width: 680px; margin: 10vh auto 0; text-align: left; }
.err-code { font: 700 72px/1 var(--cond); color: var(--accent); letter-spacing: -.02em; margin-bottom: 10px; }
.err-id { color: var(--muted); font: 14px/1.4 var(--mono); margin-top: 18px; }
.err-debug { white-space: pre-wrap; font: 13px/1.45 var(--mono); background: var(--code-bg); border: 1px solid var(--rule); border-radius: 8px; padding: 12px; color: var(--warn); }

/* вход */
.lesson.login { max-width: 520px; margin: 6vh auto 0; }
.login form { display: grid; gap: 10px; margin: 8px 0 14px; }
.login label { font: 600 15px/1.2 var(--cond); letter-spacing: .04em; color: var(--muted); }
.login input { font: 18px/1.3 var(--sans); padding: 12px 14px; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper); color: var(--ink); }
.login input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.login input[name=code] { font: 600 26px/1 var(--mono); letter-spacing: .3em; max-width: 220px; }
.login .btn { justify-self: start; }
.login .hint { color: var(--muted); font-size: 15px; margin: 0; }
.form-err { color: var(--warn); background: var(--warn-soft); border-radius: 8px; padding: 10px 14px; }
.logout { margin: 0; }
.logout button { font: 600 13px/1 var(--cond); letter-spacing: .06em; border: 1px solid var(--rule); background: var(--paper); color: var(--muted); padding: 9px 14px; border-radius: 999px; cursor: pointer; }
.logout button:hover { color: var(--ink); }

/* покупка */
.cta .signin { flex-basis: 100%; font-size: 15px; color: var(--muted); }
.cta .signin:hover { color: var(--accent); }
.buy .buy-course { font: 600 20px/1.3 var(--cond); }
.buy ul { margin: 0 0 14px; padding-left: 20px; }
.buy li { margin-bottom: 6px; }

/* юридические страницы */
.lesson.legal { max-width: 820px; }
.lesson.legal h3 { font-size: 22px; margin-top: 26px; }

/* админка */
.lesson.admin { max-width: 900px; }
.admin form { max-width: 520px; }
.admin select { font: 17px/1.3 var(--sans); padding: 10px 12px; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper); color: var(--ink); }
.admin-btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.form-ok { color: var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 10px 14px; }
.admin tr.off td { color: var(--muted); text-decoration: line-through; }

/* «Из России» (Boosty) */
.boosty-box { margin-top: 22px; padding: 14px 18px; border: 1px dashed var(--rule); border-radius: 12px; }
.boosty-box h3 { margin: 0 0 8px; font-size: 19px; }
.boosty-box ol { margin: 0; padding-left: 20px; }

/* главная: шапка с иллюстрацией-набором (светлая/тёмная по теме) */
.cat-hero { padding: 18px 0 26px; }
.cat-hero h1 { font: 700 clamp(34px, 5.5vw, 56px)/1.04 var(--cond); margin: 0 0 12px; text-wrap: balance; }
.cat-hero .lead { font-size: 20px; color: var(--muted); max-width: 60ch; margin: 0 0 22px; }
.kit { border-radius: 16px; overflow: hidden; border: 1px solid var(--rule); background: var(--paper); }
.kit img { display: block; width: 100%; height: auto; aspect-ratio: 2 / 1; object-fit: cover; }
@media (max-width: 640px) { .kit img { aspect-ratio: 4 / 3; object-position: 64% 50%; } }   /* телефон: середина сцены — инструкция и плата */
.line .line-sub { color: var(--muted); font-size: 17px; margin: -6px 0 18px; max-width: 70ch; }
.kit .kit-dark { display: none; }
:root[data-theme="dark"] .kit .kit-light { display: none; }
:root[data-theme="dark"] .kit .kit-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .kit .kit-light { display: none; }
  :root:not([data-theme="light"]) .kit .kit-dark { display: block; }
}

/* главная: живая запись сборки */
.live-video { border-radius: 16px; overflow: hidden; border: 1px solid var(--rule); background: #111114; }
.live-video video { display: block; width: 100%; height: auto; aspect-ratio: 1280 / 778; }

.admin-nav { font-size: 15px; color: var(--muted); }
