  :root{
    --cream:#F1EFE8; --soft:#EDEBE3; --card:#FFFFFF; --ink:#1C1B18; --ink2:#3A3833;
    --taupe:#6F6A5E; --line:#E7E3D8; --black:#1F1E1B; --green:#5E8C3E; --track:#EAE7DC; --chtrack:#D6D1C2;
  }

  /* ── Тёмная тема: тёплый графит, инверсные плашки становятся светлыми ──
     --cream и --black меняются ролями, поэтому кнопки и акценты инвертируются сами. */
  :root[data-theme="dark"]{
    --cream:#1A1A18; --soft:#232320; --card:#222220; --ink:#ECEAE3; --ink2:#C7C4BB;
    --taupe:#A6A199; --line:#302F2B; --black:#EAE7DF; --green:#7CB662; --track:#2B2A26; --chtrack:#454239;
  }
  @media (prefers-color-scheme:dark){
    :root:not([data-theme="light"]){
      --cream:#1A1A18; --soft:#232320; --card:#222220; --ink:#ECEAE3; --ink2:#C7C4BB;
      --taupe:#A6A199; --line:#302F2B; --black:#EAE7DF; --green:#7CB662; --track:#2B2A26; --chtrack:#454239;
    }
  }
  /* тёмная тема: акцентные карточки остаются тёмными, светлеет только их подложка */
  :root[data-theme="dark"] .mnext,
  :root[data-theme="dark"] .next{background:#2B2A26;color:#ECEAE3}
  :root[data-theme="dark"] .mnext .mbtn.light,
  :root[data-theme="dark"] .next a{background:#EAE7DF;color:#1A1A18}
  :root[data-theme="dark"] .rec{background:#000}
  @media (prefers-color-scheme:dark){
    :root:not([data-theme="light"]) .mnext,
    :root:not([data-theme="light"]) .next{background:#2B2A26;color:#ECEAE3}
    :root:not([data-theme="light"]) .mnext .mbtn.light,
    :root:not([data-theme="light"]) .next a{background:#EAE7DF;color:#1A1A18}
  }
  /* на узких экранах шапке хватает значка: текст логотипа уступает место теме и профилю */
  @media (max-width:430px){
    .logo span:not(.mark){font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:44vw}
  }
  .theme{display:none;align-items:center;justify-content:center;width:34px;height:34px;flex:0 0 34px;border-radius:50%;
   background:var(--card);border:1px solid var(--line);color:var(--ink);cursor:pointer;padding:0}
  .theme.on{display:inline-flex}
  .theme svg{display:block}
  /* каркас скрыт, пока не знаем, есть ли сессия (см. booting в скрипте) */
  :root.booting .wrap,:root.booting .toast{visibility:hidden}
  *{box-sizing:border-box;-webkit-tap-highlight-color:transparent;}
  html,body{margin:0;padding:0;background:var(--cream);color:var(--ink);
    font-family:-apple-system,BlinkMacSystemFont,'SF Pro Display','Segoe UI',system-ui,Roboto,sans-serif;
    -webkit-font-smoothing:antialiased;}
  .wrap{max-width:460px;margin:0 auto;padding:16px 15px calc(24px + env(safe-area-inset-bottom,0px));}

  /* ── ВЕБ-ВЕРСИЯ: во всю ширину экрана, занятия и шаги в колонки ── */
  @media (min-width:900px){
    .wrap{max-width:1320px;padding:34px 40px 60px;}
    h1{font-size:28px;}
    #list{display:grid;grid-template-columns:1fr 1fr;gap:12px;align-items:start;}
    .step{margin-bottom:0;padding:15px 16px;}
    .step:hover{border-color:#C6BFAE;box-shadow:0 3px 14px rgba(31,30,27,.06);}
    /* Занятия — плиткой: одно занятие с записью занимает колонку, а не всю строку,
       иначе на широком экране видео разъезжается на полтора метра. */
    .course{display:grid;grid-template-columns:repeat(auto-fill,minmax(430px,1fr));gap:12px;align-items:start;}
    .course-h,.course-sub,.next,.course-note,.closed{grid-column:1/-1;}
    .course-sub{margin-bottom:0;}
    .next{margin-bottom:0;}
    .les{margin-bottom:0;}
  }
  @media (min-width:1250px){
    #list{grid-template-columns:1fr 1fr 1fr;}
  }
  /* профиль в шапке — только для веба, в Mini App шапку рисует Telegram */
  .logo{position:relative}
  .me{margin-left:auto;display:none;align-items:center;gap:9px;background:var(--card);border:1px solid var(--line);
   border-radius:999px;padding:4px 12px 4px 4px;cursor:pointer;font:inherit;color:var(--ink)}
  .me.on{display:inline-flex}
  .me:hover{background:var(--soft)}
  .me .ava{width:28px;height:28px;border-radius:50%;background:var(--soft);display:grid;place-items:center;
   overflow:hidden;font-size:11.5px;font-weight:700;color:var(--ink2);letter-spacing:0;flex:0 0 28px}
  .me .ava img{width:100%;height:100%;object-fit:cover}
  .me .nm{font-size:13px;font-weight:600;letter-spacing:0}
  .memenu{position:absolute;right:0;top:38px;z-index:40;min-width:230px;background:var(--card);border:1px solid var(--line);
   border-radius:16px;box-shadow:0 18px 40px rgba(31,30,27,.13);padding:6px;display:none}
  .memenu.on{display:block}
  .memenu .hd{padding:11px 12px 9px;border-bottom:1px solid var(--line);margin-bottom:5px}
  .memenu .hd b{display:block;font-size:14px;color:var(--ink);letter-spacing:0}
  .memenu .hd i{display:block;font-style:normal;font-size:12px;color:var(--taupe);margin-top:3px;letter-spacing:0}
  .memenu a,.memenu button{display:block;width:100%;text-align:left;background:none;border:0;font:inherit;letter-spacing:0;
   font-size:13.5px;color:var(--ink);padding:10px 12px;border-radius:11px;cursor:pointer;text-decoration:none}
  .memenu a:hover,.memenu button:hover{background:var(--soft)}
  .memenu .out{color:#B15C3A}
  .logo{display:flex;align-items:center;gap:8px;margin-bottom:16px;}
  .logo .mark{width:26px;height:26px;border-radius:8px;display:block;object-fit:cover;flex:0 0 26px;}
  
  .logo span{font-size:12px;font-weight:600;letter-spacing:.14em;color:var(--ink2);}
  h1{font-size:24px;font-weight:700;letter-spacing:-.02em;line-height:1.1;margin:0;}
  .sub{display:flex;align-items:center;gap:9px;margin-top:8px;flex-wrap:wrap;}
  .sub .t{font-size:12.5px;color:var(--taupe);}
  .pill{font-size:11px;font-weight:500;color:var(--cream);background:var(--black);border-radius:20px;padding:4px 11px;white-space:nowrap;}
  .prog{background:var(--card);border:1px solid var(--line);border-radius:16px;padding:14px 16px;margin:15px 0 14px;}
  .prog-top{display:flex;justify-content:space-between;align-items:baseline;margin-bottom:9px;}
  .prog-top .l{font-size:13px;font-weight:500;color:var(--taupe);}
  .prog-top .n{font-size:16px;font-weight:700;} .prog-top .n small{color:#B7B1A2;font-weight:500;}
  .bar{height:8px;background:var(--track);border-radius:6px;overflow:hidden;}
  .bar i{display:block;height:100%;background:var(--black);border-radius:6px;transition:width .35s ease;}
  .list{display:flex;flex-direction:column;gap:8px;}
  .step{display:flex;gap:12px;align-items:center;background:var(--card);border:1px solid var(--line);
    border-radius:14px;padding:11px 12px;transition:border-color .15s;}
  .step.cur{border:1.5px solid var(--black);}
  .cbx{flex:none;width:27px;height:27px;border-radius:50%;border:2px solid #C9C4B6;background:transparent;cursor:pointer;
    display:flex;align-items:center;justify-content:center;transition:background .15s,border-color .15s;}
  .cbx:active{transform:scale(.92);}
  .cbx.done{background:var(--green);border-color:var(--green);}
  .cbx svg{width:15px;height:15px;fill:none;stroke:#fff;stroke-width:2.6;stroke-linecap:round;stroke-linejoin:round;opacity:0;}
  .cbx.done svg{opacity:1;}
  .mid{flex:1;min-width:0;cursor:pointer;padding:2px 0;}
  .mid b{font-size:14.5px;font-weight:600;display:block;}
  .step.done .mid b{color:var(--taupe);text-decoration:line-through;text-decoration-color:#CFC9BB;}
  .step.pending .mid b{color:var(--ink2);}
  .mid i{display:block;font-size:12px;color:var(--taupe);font-style:normal;margin-top:1px;line-height:1.4;}
  .go{flex:none;color:#C3BDAF;}
  .now{flex:none;font-size:10.5px;color:var(--cream);background:var(--black);border-radius:7px;padding:3px 8px;font-weight:500;}
  /* заблокированные шаги (до проверки Mac / до VPN) */
  .step.locked{opacity:.5;}
  .step.locked .cbx{border-color:#D8D3C6;background:transparent;}
  .step.locked .cbx svg{opacity:1;stroke:#B7B1A2;stroke-width:2;width:12px;height:13px;}
  .step.locked .mid b{color:var(--taupe);font-weight:600;text-decoration:none;}
  .step.locked .go{color:#DAD5C8;}
  /* всплывающая подсказка */
  .toast{position:fixed;left:50%;bottom:calc(26px + env(safe-area-inset-bottom,0px));transform:translateX(-50%) translateY(10px);background:var(--black);color:var(--cream);font-size:13px;font-weight:500;line-height:1.35;padding:11px 16px;border-radius:12px;opacity:0;pointer-events:none;transition:opacity .2s,transform .2s;z-index:80;max-width:86%;text-align:center;box-shadow:0 6px 20px rgba(28,27,24,.25);}
  .toast.on{opacity:1;transform:translateX(-50%) translateY(0);}
  /* Mac — первый шаг (карточка сверху) */
  #macrow{margin-bottom:8px;}
  .macrow.done{border-color:#CFE0BF;} .macrow.weak{border:1.5px solid #E7CDBF;}
  .macbx{border-color:#C9C4B6;color:var(--ink2);cursor:pointer;}
  .macbx svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;opacity:1;}
  .macbx.done{background:var(--green);border-color:var(--green);color:#fff;}
  .macbx.bad{background:#B15C3A;border-color:#B15C3A;color:#fff;}
  .macrow .mid i .tag{font-weight:600;color:var(--ink2);}
  .foot{text-align:center;font-size:12px;color:var(--taupe);margin-top:14px;}
  /* чип-иконка вместо номера в шторке Mac */
  .sh-num.chip{background:var(--soft);color:var(--ink2);border:1px solid var(--line);}
  .sh-num.chip svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;}
  /* переключатель языка Mac */
  .lang-h{font-size:13px;font-weight:600;color:var(--ink2);margin:2px 0 7px;}
  .langtog{display:flex;gap:5px;background:var(--soft);border:1px solid var(--line);border-radius:11px;padding:4px;margin:0 0 12px;}
  .lt{flex:1;border:0;background:transparent;border-radius:8px;padding:9px 6px;font-size:13.5px;font-weight:600;color:var(--taupe);cursor:pointer;font-family:inherit;transition:background .15s,color .15s;}
  .lt.on{background:var(--card);color:var(--ink);box-shadow:0 1px 2px rgba(28,27,24,.06);}
  /* загрузка фото Mac + вердикт ИИ */
  .macup{margin-top:6px;}
  .macup-h{font-size:14px;font-weight:600;}
  .macup-s{font-size:13px;color:var(--taupe);margin:3px 0 11px;line-height:1.45;}
  .dropzone{display:flex;flex-direction:column;align-items:center;gap:5px;width:100%;border:2px dashed #C6BFAE;border-radius:15px;background:var(--soft);padding:22px 14px;cursor:pointer;text-align:center;transition:border-color .15s,background .15s;}
  .dropzone.drag{border-color:var(--black);background:#E7E2D5;}
  .dropzone.busy{opacity:.6;pointer-events:none;}
  .dz-ic{color:var(--ink2);line-height:0;margin-bottom:2px;}
  .dz-ic svg{width:32px;height:32px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;}
  .dz-t{font-size:14.5px;font-weight:600;color:var(--ink);}
  .dz-s{font-size:12.5px;color:var(--taupe);line-height:1.4;}
  .upbtn2{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;margin-top:9px;background:var(--black);color:var(--cream);border:0;border-radius:13px;padding:14px;font-size:14.5px;font-weight:600;cursor:pointer;font-family:inherit;}
  .upbtn2:active{opacity:.9;}
  .upbtn2 svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}
  .verdict{display:none;margin-top:11px;border-radius:12px;padding:12px 13px;font-size:13.5px;line-height:1.5;}
  .verdict.on{display:block;} .verdict b{font-weight:700;}
  .verdict.ok{background:#E4EFDA;color:#38601A;}
  .verdict.bad{background:#F6E4DC;color:#9A4A2B;}
  .verdict.wait{background:var(--soft);color:var(--ink2);}
  .spin{display:inline-block;width:13px;height:13px;border:2px solid #CFC9BB;border-top-color:var(--ink2);border-radius:50%;animation:sp .7s linear infinite;vertical-align:-2px;margin-right:6px;}
  @keyframes sp{to{transform:rotate(360deg);}}
  .err{text-align:center;color:#B15C3A;font-size:13px;padding:30px 10px;}
  /* шторка деталей */
  .ov{position:fixed;inset:0;z-index:60;background:rgba(28,27,24,.42);display:flex;align-items:flex-end;justify-content:center;opacity:0;pointer-events:none;transition:opacity .2s;}
  .ov.on{opacity:1;pointer-events:auto;}
  .sheet{width:100%;max-width:460px;background:var(--cream);border-radius:22px 22px 0 0;padding:8px 16px calc(18px + env(safe-area-inset-bottom,0px));max-height:90dvh;overflow-y:auto;transform:translateY(20px);transition:transform .24s;}
  .ov.on .sheet{transform:translateY(0);}
  .grip{width:38px;height:4px;border-radius:3px;background:#D8D3C6;margin:6px auto 12px;}
  /* Веб-переопределения шторки ОБЯЗАНЫ стоять ПОСЛЕ базовых правил: специфичность
     одинаковая, побеждает позднее в файле. Раньше они лежали в начале — и мобильный
     лист показывался на десктопе всегда. */
  @media (min-width:900px){
    .ov{align-items:center;padding:32px 24px;}
    .sheet{max-width:640px;border-radius:22px;max-height:82vh;padding:22px 28px 26px;
     transform:translateY(8px) scale(.98);box-shadow:0 24px 70px rgba(20,19,17,.35);}
    .ov.on .sheet{transform:none;}
    .grip{display:none;}
  }
  /* ── Шаг как отдельная страница (веб) ────────────────────────────────────
     Рельса этапов на ней скрыта: это именно другой экран, а не вкладка. Сверху
     панель: слева выход, справа отметка о выполнении — обе всегда на виду. */
  .steptop{position:sticky;top:0;z-index:30;display:flex;align-items:center;justify-content:space-between;
   gap:16px;background:var(--cream);padding:6px 0 14px;margin-bottom:6px;border-bottom:1px solid var(--line);}
  .backbtn{display:inline-flex;align-items:center;gap:8px;background:transparent;border:1px solid var(--line);
   border-radius:11px;padding:10px 15px;font:inherit;font-size:14px;font-weight:500;color:var(--ink2);
   cursor:pointer;min-height:42px;}
  .backbtn:hover{background:var(--soft);color:var(--ink);}
  .steptop-act .sh-btn{margin:0;width:auto;min-width:220px;}
  .steppage{max-width:1180px;margin:0 auto;padding-top:20px;}
  /* Текст держим читаемой длиной строки и центрируем — иначе на широком мониторе
     он либо тянется через весь экран, либо липнет к левому краю с дырой справа. */
  #p-step .sh-body{max-width:74ch;}
  /* У проверки Mac есть чем занять правую колонку: инструкция слева, зона для
     скриншота справа. У обычных шагов подвал пуст (кнопка ушла наверх) — колонка
     не появляется, и страница остаётся статьёй по центру. */
  @media (min-width:1200px){
    #p-step #detailCard.has-side{display:grid;grid-template-columns:minmax(0,1fr) 400px;
     gap:36px;align-items:start;}
    #p-step #detailCard.has-side .sh-head{grid-column:1/-1;}
    #p-step #detailCard.has-side .sh-body{max-width:none;}
    #p-step #detailCard.has-side #shFoot{position:sticky;top:96px;}
    #p-step #detailCard.has-side .macup{margin-top:0;}
  }
  #p-step .sh-x{display:none;}
  #p-step .sh-head{gap:13px;margin-bottom:16px;}
  #p-step .sh-num{width:34px;height:34px;font-size:15px;}
  #p-step .sh-title{font-size:26px;line-height:1.15;padding-top:3px;}
  #p-step .sh-body{font-size:15px;line-height:1.65;}
  #p-step .sh-body p{margin:0 0 14px;}
  #p-step .sh-body li{margin-bottom:8px;}
  .sh-head{display:flex;align-items:flex-start;gap:10px;margin-bottom:10px;}
  .sh-num{flex:none;width:28px;height:28px;border-radius:50%;background:var(--black);color:#fff;display:flex;align-items:center;justify-content:center;font-size:13px;font-weight:600;}
  .sh-title{flex:1;font-size:18px;font-weight:700;letter-spacing:-.01em;line-height:1.2;padding-top:2px;}
  .sh-x{flex:none;width:30px;height:30px;border:0;background:#E7E3D8;border-radius:9px;color:var(--ink2);font-size:15px;cursor:pointer;}
  .sh-body{font-size:14px;line-height:1.55;color:var(--ink);}
  .sh-body p{margin:0 0 10px;} .sh-body ul{margin:0 0 10px;padding-left:20px;} .sh-body li{margin-bottom:5px;}
  .sh-body b{font-weight:600;}
  .sh-body a{color:var(--ink);font-weight:600;text-decoration:none;border-bottom:1.5px solid #C4BFB1;}
  .sh-body a:active{background:#E7E3D8;}
  .sh-body .branch{border:1px solid var(--line);border-radius:12px;overflow:hidden;margin:0 0 8px;background:var(--card);}
  .sh-body .branch .bh{padding:9px 12px;font-size:13px;font-weight:600;line-height:1.3;}
  .sh-body .branch.ok .bh{background:#E4EFDA;color:#43701F;}
  .sh-body .branch.warn .bh{background:#F0E7D6;color:#7A5E2C;}
  .sh-body .branch .bb{padding:9px 12px;font-size:13.5px;line-height:1.5;}
  .sh-body .branch .bb ol{margin:0;padding-left:18px;} .sh-body .branch .bb li{margin-bottom:4px;}
  .sh-body .branch .bb ol li::marker{color:var(--taupe);font-weight:600;}
  .sh-body code{background:#E7E3D8;border-radius:5px;padding:1px 5px;font-size:12.5px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;}
  .sh-body pre{background:var(--black);color:#EDE9DE;border-radius:10px;padding:11px 12px;font-size:12px;overflow-x:auto;white-space:pre-wrap;word-break:break-all;margin:0 0 10px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;}
  .codewrap{margin:0 0 10px;}
  .codewrap pre{margin:0;}
  .copybtn{display:inline-flex;align-items:center;gap:6px;margin-top:7px;background:#E7E3D8;border:0;border-radius:9px;padding:8px 13px;font-size:12.5px;font-weight:600;color:var(--ink);cursor:pointer;font-family:inherit;transition:background .15s;}
  .copybtn:active{background:#DED9CB;}
  .copybtn.ok{background:#E1EDD7;color:var(--green);}
  .copybtn svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}
  .sh-btn{width:100%;margin-top:8px;border:0;border-radius:13px;padding:14px;font-size:14.5px;font-weight:600;cursor:pointer;}
  .sh-btn.mark{background:var(--black);color:var(--cream);}
  /* ── Мой курс: занятия потока, записи и материалы ── */
  .course{margin:20px 0 26px}
  .prep-h{display:flex;align-items:center;gap:8px;width:100%;background:none;border:0;padding:0 2px;cursor:pointer;text-align:left}
  .prep-h .prep-n{color:var(--ink2);font-weight:700;letter-spacing:0}
  .prep-h .chev{margin-left:auto;color:var(--taupe);transition:transform .2s ease}
  .prep-h.off .chev{transform:rotate(-90deg)}
  #prep{overflow:hidden}
  #prep.off{display:none}
  .sec-h{font-size:12px;letter-spacing:.6px;text-transform:uppercase;color:var(--taupe);font-weight:600;margin:0 2px 10px}
  .course-h{display:flex;align-items:baseline;gap:9px;margin-bottom:3px}
  .course-h b{font-size:17px;font-weight:700;color:var(--ink)}
  .course-h span{font-size:12.5px;color:var(--taupe)}
  .course-sub{font-size:12.5px;color:var(--taupe);margin-bottom:12px}
  .next{background:var(--black);color:var(--cream);border-radius:16px;padding:15px 17px;margin-bottom:10px}
  .next .when{font-size:11px;letter-spacing:.5px;opacity:.72;font-weight:600}
  .next .tt{font-size:16.5px;font-weight:700;margin:5px 0 2px}
  .next a{display:inline-flex;align-items:center;gap:8px;background:var(--cream);color:var(--ink);text-decoration:none;
   border-radius:12px;padding:11px 17px;font-size:14px;font-weight:700;margin-top:12px}
  .les{background:var(--card);border:1px solid var(--line);border-radius:16px;padding:13px 15px;margin-bottom:9px}
  .les .lh{display:flex;align-items:center;gap:11px}
  .les .ic{flex:0 0 32px;height:32px;border-radius:10px;background:var(--soft);display:grid;place-items:center;color:var(--ink)}
  .les .lt{flex:1;min-width:0}
  .les .lt b{display:block;font-size:15px;font-weight:600;color:var(--ink)}
  .les .lt i{display:block;font-style:normal;font-size:12px;color:var(--taupe);margin-top:2px}
  .rec{position:relative;margin-top:11px;border:1px solid var(--line);border-radius:13px;overflow:hidden;background:#000;max-width:760px;
   user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
  .rec video{display:block;width:100%;aspect-ratio:16/9;height:auto;background:#000;-webkit-user-drag:none}
  /* Водяной знак: маленькая приглушённая подпись поверх кадра, переезжает по площади. */
  .rec .wm{position:absolute;left:6%;top:8%;z-index:2;pointer-events:none;
   font-size:10.5px;font-weight:600;letter-spacing:.02em;white-space:nowrap;
   color:rgba(255,255,255,.3);text-shadow:0 1px 2px rgba(0,0,0,.6);
   transition:left 1.4s ease,top 1.4s ease}
  .rec .wait{position:absolute;inset:0;z-index:3;display:grid;place-items:center;pointer-events:none;
   font-size:12.5px;color:rgba(255,255,255,.6)}
  .rec.on .wait,.rec.dead .wait{display:none}
  .rec-err{padding:12px 14px;font-size:12.5px;color:var(--ink2);background:var(--cream)}
  /* Разворот на весь экран отдаём контейнеру: иначе подпись остаётся за кадром. */
  .rec:fullscreen{max-width:none;border:0;border-radius:0;display:grid;place-items:center;background:#000}
  .rec:fullscreen video{width:auto;max-width:100vw;max-height:100vh;aspect-ratio:auto}
  .rec:fullscreen .chapters,.rec:fullscreen .chlabel,.rec:fullscreen .rec-c{display:none}
  .rec-c{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:9px 12px;background:var(--cream)}
  .rec-c span{display:inline-flex;align-items:center;gap:7px;font-size:13px;font-weight:600;color:var(--ink)}
  .rec-c i{font-style:normal;font-size:11.5px;color:var(--taupe)}
  .les .mats{margin-top:11px;display:flex;flex-direction:column;gap:7px}
  .mat{display:flex;align-items:center;gap:10px;border:1px solid var(--line);border-radius:12px;padding:10px 12px;
   text-decoration:none;color:var(--ink);background:var(--cream)}
  .mat:active{background:var(--soft)}
  .mat .mi{flex:0 0 18px;color:var(--ink2)}
  .mat .mt{flex:1;min-width:0;font-size:13.5px}
  .mat .ms{font-size:11.5px;color:var(--taupe)}
  .course-note{font-size:12px;color:var(--taupe);margin-top:4px}
  .closed{background:var(--card);border:1px solid var(--line);border-radius:16px;padding:18px;text-align:center}
  .closed b{display:block;font-size:15.5px;color:var(--ink);margin-bottom:5px}
  .closed span{font-size:13px;color:var(--taupe);line-height:1.5}
  .sh-btn.unmark{background:transparent;border:1.5px solid #D3CDBE;color:var(--ink2);}

  /* ══ путь из этапов: рельса сверху, панель этапа снизу ══════════════════ */
  .rail{margin:20px 0 22px;position:relative}
  .rail-scroll{display:flex;gap:4px;overflow-x:auto;scrollbar-width:none;scroll-snap-type:x proximity;
   margin-inline:-15px;padding-inline:15px}
  .rail-scroll::-webkit-scrollbar{display:none}
  /* Рамка у каждого этапа: без неё приглушённые читались как подписи, а не как
     кнопки — было непонятно, что по ним можно тыкать. */
  .stage{position:relative;min-width:150px;scroll-snap-align:start;flex:0 0 auto;
   display:flex;flex-direction:column;align-items:flex-start;gap:7px;
   background:transparent;border:1px solid var(--line);border-radius:12px;
   padding:10px 14px 12px;font:inherit;text-align:left;cursor:pointer;color:var(--ink);
   opacity:.55;transition:opacity .15s,background .15s,border-color .15s}
  .stage:hover{opacity:.85;border-color:var(--ink2);background:var(--soft)}
  .stage .srow{display:flex;align-items:center;height:20px}
  .stage .snm{font-size:14px;font-weight:500;color:inherit;white-space:nowrap;line-height:1.2}
  .stage .sdt{font-size:11.5px;color:var(--ink2);line-height:1.2}
  /* Текущий этап — единственный в полную силу: подложка + яркий текст.
     Остальные приглушены целиком, поэтому подчёркивание не нужно — оно читалось
     как случайная линия под ячейкой. */
  /* Подложка — карточным цветом, а не --soft: в светлой теме --soft отличается от фона
     на четыре единицы и форма ячейки не читается. Рамку активного усиливаем цветом
     текста: теперь она есть у всех этапов, и тонкой границы уже не хватает. */
  .stage[aria-selected="true"]{opacity:1;background:var(--card);border-color:var(--ink2);
   box-shadow:inset 0 0 0 1px var(--ink2)}
  .stage[aria-selected="true"] .snm{font-weight:700}
  .stage[aria-selected="true"] .sdt{color:var(--ink)}
  .dot{flex:0 0 20px;width:20px;height:20px;border-radius:50%;display:flex;align-items:center;justify-content:center;
   border:2px solid var(--line);background:transparent;position:relative;z-index:1}
  .dot svg{width:11px;height:11px;stroke:var(--cream);stroke-width:2.8;fill:none;stroke-linecap:round;stroke-linejoin:round;opacity:0}
  .stage.done .dot{background:var(--black);border-color:var(--black)}
  .stage.done .dot svg{opacity:1}
  .ring{flex:0 0 20px;width:20px;height:20px;position:relative;z-index:1}
  .ring svg{width:20px;height:20px;display:block;transform:rotate(-90deg)}
  .ring circle{fill:none;stroke-width:3}
  .ring .rbg{stroke:var(--track)} .ring .rfg{stroke:var(--black);stroke-linecap:round}

  .panel{display:none} .panel.on{display:block}
  .lesson-h{margin-bottom:16px}
  .lesson-h h2{font-size:18px;font-weight:700;letter-spacing:-.01em;margin:0 0 4px}
  .lesson-h .lmeta{font-size:12.5px;color:var(--ink2)}
  .grid{display:grid;gap:16px}

  .tcs{margin-top:14px}
  /* Дорожка глав под видео: блок на раздел, ширина пропорциональна длительности,
     заполнение — сколько этого раздела уже просмотрено. */
  .chapters{display:flex;gap:3px;padding:11px 12px 5px;background:var(--card)}
  .chapters button{flex:1 1 0;height:8px;min-width:6px;padding:0;border:0;border-radius:4px;
   background:var(--chtrack);cursor:pointer;overflow:hidden;position:relative;transition:height .12s}
  .chapters button:hover,.chapters button:focus-visible{height:12px;margin-top:-2px}
  .chapters button i{display:block;height:100%;width:0;background:var(--black);border-radius:4px}
  /* Текущий раздел выделяем рамкой, а не цветом: цвет уже занят заполнением. */
  .chapters button[aria-current="true"]{box-shadow:0 0 0 1.5px var(--ink2)}
  .chlabel{padding:3px 12px 9px;font-size:12px;color:var(--ink2);min-height:18px;background:var(--card)}

  /* Без внутреннего скролла: список растёт, страница скроллится сама. Вложенная
     прокрутка на телефоне отбирает жест у страницы и путает. */
  .tclist{display:flex;flex-direction:column;gap:2px}
  /* hidden обязан быть СИЛЬНЕЕ display:flex ниже, иначе «скрытые» метки видны,
     а кнопка «Ещё N» щёлкает без всякого эффекта. */
  .tc[hidden]{display:none}
  .tc{display:flex;align-items:center;gap:11px;padding:8px 10px;border-radius:10px;border:0;background:transparent;
   font:inherit;text-align:left;color:var(--ink);cursor:pointer;min-height:44px;
   border-left:2px solid transparent;transition:background .15s}
  .tc:hover{background:var(--soft)}
  .tc .tt{flex:0 0 58px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12.5px;
   background:var(--soft);color:var(--ink2);border-radius:7px;padding:3px 6px;text-align:center}
  .tc .tl{font-size:13.5px;min-width:0}
  .tc[aria-current="true"]{background:var(--soft);border-left-color:var(--black)}
  .tc[aria-current="true"] .tt{background:var(--black);color:var(--cream)}
  .more{margin-top:6px;background:transparent;border:1px solid var(--line);border-radius:10px;
   padding:10px 12px;font:inherit;font-size:12.5px;color:var(--ink2);cursor:pointer;width:100%;min-height:44px}

  .sum{margin-top:20px;max-width:75ch}
  .sum p{font-size:14px;line-height:1.6;margin:0 0 14px}
  .chips{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:16px}
  .chip{background:var(--soft);border:1px solid var(--line);border-radius:999px;padding:5px 11px;font-size:12.5px}
  .sum ul{margin:0 0 16px;padding:0;list-style:none;display:flex;flex-direction:column;gap:9px}
  .sum li{display:flex;gap:10px;font-size:14px;line-height:1.5}
  .sum li::before{content:"";flex:0 0 5px;width:5px;height:5px;border-radius:50%;background:var(--taupe);margin-top:8px}
  .pit{display:flex;gap:10px;align-items:flex-start;font-size:14px;line-height:1.5;margin-bottom:9px}
  .pit .pt{flex:0 0 58px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12.5px;
   background:var(--soft);color:var(--ink2);border:0;border-radius:7px;padding:3px 6px;cursor:pointer;font-weight:500}
  .pit i{font-style:normal;color:var(--ink2)}
  .gl{font-size:14px;line-height:1.5;margin-bottom:8px}
  .gl b{font-weight:600}
  .skel{display:flex;flex-direction:column;gap:9px}
  .skel i{display:block;height:11px;border-radius:6px;background:var(--track);animation:skelp 1.6s infinite}
  .skel i:nth-child(2){width:88%;animation-delay:.15s} .skel i:nth-child(3){width:64%;animation-delay:.3s}
  @keyframes skelp{0%,100%{opacity:.55}50%{opacity:1}}
  .skel-note{font-size:12.5px;color:var(--ink2);margin-top:12px;display:flex;align-items:center;gap:7px}

  .chat{display:flex;flex-direction:column;background:var(--card);border:1px solid var(--line);border-radius:16px;overflow:hidden}
  .chat-h{padding:13px 15px;border-bottom:1px solid var(--line)}
  .chat-h b{display:block;font-size:14px;font-weight:600}
  .chat-h i{display:block;font-style:normal;font-size:11.5px;color:var(--ink2);margin-top:2px}
  .feed{flex:1;overflow-y:auto;padding:14px 15px;display:flex;flex-direction:column;gap:11px;min-height:200px}
  .msg{max-width:85%;font-size:13.5px;line-height:1.5;white-space:pre-wrap}
  .msg.me{align-self:flex-end;background:var(--soft);border-radius:14px 14px 4px 14px;padding:9px 12px}
  .msg.ai{align-self:flex-start;border-radius:14px 14px 14px 4px}
  .cut{display:flex;align-items:center;gap:9px;font-size:11px;color:var(--ink2);margin:2px 0}
  .cut::before,.cut::after{content:"";flex:1;height:1px;background:var(--line)}
  .cempty{color:var(--ink2);font-size:13.5px;line-height:1.5}
  .cempty b{display:block;color:var(--ink);font-size:14px;margin-bottom:10px}
  .sug{display:flex;flex-wrap:wrap;gap:6px;margin-top:12px}
  .sug button{font:inherit;font-size:12.5px;background:var(--soft);border:1px solid var(--line);border-radius:999px;
   padding:8px 12px;color:var(--ink);cursor:pointer;text-align:left;min-height:36px}
  .think{display:flex;gap:4px;align-items:center;padding:2px 0}
  .think i{width:5px;height:5px;border-radius:50%;background:var(--taupe);animation:think 1.2s infinite}
  .think i:nth-child(2){animation-delay:.2s} .think i:nth-child(3){animation-delay:.4s}
  @keyframes think{0%,100%{opacity:.3}50%{opacity:1}}
  .compose{border-top:1px solid var(--line);padding:11px 12px}
  .compose .crow{display:flex;gap:8px;align-items:flex-end}
  .compose textarea{flex:1;min-height:44px;max-height:120px;resize:none;font:inherit;font-size:13.5px;
   background:var(--cream);border:1px solid var(--line);border-radius:12px;padding:12px;color:var(--ink);outline:none}
  .compose textarea:focus{border-color:var(--ink2)}
  .send{flex:0 0 44px;width:44px;height:44px;border-radius:12px;background:var(--black);color:var(--cream);
   border:0;display:flex;align-items:center;justify-content:center;cursor:pointer}
  .send:disabled{opacity:.5;cursor:default}
  .memo{font-size:11.5px;color:var(--ink2);margin-top:8px}

  .about{margin-top:18px;max-width:75ch}
  .about p{font-size:14px;line-height:1.6;margin:0 0 12px}
  .ask{margin-top:16px;display:flex;align-items:center;gap:10px;flex-wrap:wrap}
  .ask a{display:inline-flex;align-items:center;min-height:44px;font-size:14px;font-weight:500;background:transparent;
   border:1px solid var(--line);border-radius:12px;padding:11px 16px;color:var(--ink);text-decoration:none}
  .ask span{font-size:12px;color:var(--ink2)}
  /* Круглая кнопка «спросить по записи»: висит поверх страницы, чтобы вопрос можно
     было задать в любой момент просмотра, не докручивая занятие до конца.
     От 1120px не нужна — там чат стоит колонкой справа и всегда на виду. */
  .fab{position:fixed;right:16px;bottom:calc(18px + env(safe-area-inset-bottom,0px));z-index:55;
   width:54px;height:54px;border-radius:50%;border:0;background:var(--black);color:var(--cream);
   display:flex;align-items:center;justify-content:center;cursor:pointer;
   box-shadow:0 10px 26px rgba(20,19,17,.4);transition:transform .15s}
  .fab[hidden]{display:none}
  .fab:active{transform:scale(.94)}
  /* Пока открыта шторка (чат или детали шага) — кнопка не должна светиться сквозь
     затемнение: она ниже оверлея, но полупрозрачный фон её не скрывает. */
  body:has(.ov.on) .fab{display:none}

  @media (min-width:1120px){
    .grid{grid-template-columns:minmax(560px,1fr) 400px;gap:24px;align-items:start}
    .chat{position:sticky;top:24px;height:min(620px,calc(100dvh - 140px))}
    .fab{display:none}
  }
  @media (max-width:1119px){ .side-chat{display:none} }
  @media (min-width:900px){ .rail-scroll{margin-inline:0;padding-inline:0;overflow:visible} .stage{flex:1} }
  @media (prefers-reduced-motion:reduce){
    *,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;
     transition-duration:.01ms!important;scroll-behavior:auto!important}
  }
