/* Тема учителя = тема ученика: урок у учителя выглядит так же, как у ученика. */
:root {
  --page: #F6F1EA; --card: #fff; --well: #F2EAE6; --t: #2C2C2A; --title: #6D1F42; --mut: #6B6A64;
  --line: #E7DDD6; --chip-line: #E3D2E3; --gap-bg: #F8F1F7;
  --acc: #7A3A66; --acc-bg: #F3EAF3; --acc-ink: #6D1F42;
  --ok: #2F9E44; --ok-bg: #E6F6E8; --ok-ink: #1B5E2A;
  --no: #E24B4A; --no-bg: #FCEBEB; --no-ink: #791F1F;
  --bw: 2.5px; --bb: 5px; --r: 20px; --r-sm: 14px;
  --course: #7A3A66; --soft-line: #ECE8E0;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif; font-weight: 500; color: var(--t); font-size: 14px; }
button { font-family: inherit; }

.tbar { display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tbar-title { font-weight: 600; font-size: 15px; }
.tbar-title small { display: block; font-weight: 400; color: var(--mut); font-size: 12px; }
.lsel { font: inherit; font-weight: 600; font-size: 14px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); max-width: 360px; }
.keybtn { border: 1px solid var(--line); background: var(--card); padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--t); }
.keybtn:hover { background: var(--well); }
.keybtn.on { background: #FBF1D6; border-color: #E5B84F; color: #5A4200; font-weight: 600; }
.seg { display: inline-flex; background: var(--well); border-radius: 8px; padding: 3px; }
.seg button { border: none; background: none; padding: 6px 12px; border-radius: 6px; cursor: pointer; color: var(--mut); font-size: 13px; }
.seg button.on { background: var(--card); color: var(--t); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.tab { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); padding: 5px 10px; border-radius: 20px; cursor: pointer; font-size: 13px; }
.tab.on { border-color: var(--acc); background: var(--acc-bg); color: var(--acc-ink); font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #C9C7BF; flex: none; }
.dot.on { background: var(--ok); }

/* Рабочая колонка не шире ~740 px, как у ProgressMe: широкие строки читать неудобно. */
.grid { display: grid; grid-template-columns: 220px minmax(0, 740px) 290px; justify-content: center; gap: 12px; padding: 12px; align-items: start; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.panel h4 { margin: 0 0 8px; font-size: 12px; font-weight: 600; color: var(--mut); text-transform: none; }
.sticky { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; }

.nav { display: flex; flex-direction: column; gap: 1px; }
.navi { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; border: none; background: none; text-align: left; font-size: 13px; color: var(--t); width: 100%; }
.navi:hover { background: var(--well); }
.navi.on { background: var(--acc-bg); color: var(--acc-ink); font-weight: 600; }
.navi .n { color: var(--mut); width: 18px; flex: none; font-variant-numeric: tabular-nums; }
.navi .tt { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 10px; flex: none; }
.st.full { background: var(--ok-bg); color: var(--ok-ink); }
.st.part { background: #FBF1D6; color: #5A4200; }
.st.typing { background: var(--well); color: var(--mut); }
.here { width: 20px; height: 20px; border-radius: 50%; background: var(--acc); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; flex: none; }

.navsec { border-radius: 8px; padding: 2px 0 4px; }
.navsec.on { background: var(--acc-bg); }
.navsec.on > .navi { color: var(--acc-ink); font-weight: 600; }
.navsec .navi:hover { background: transparent; text-decoration: underline; }
.navsub { padding: 0 8px 0 14px; }
.navsubi { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--mut); padding: 2px 0; }
.navsubi .n { width: 34px; flex: none; font-variant-numeric: tabular-nums; }
.navsubi .tt { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tblock { padding: 16px 0; border-top: 1px solid var(--line); }
.tblock:first-of-type { border-top: none; }
.tline { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.tline .who { margin-right: auto; font-size: 13px; color: var(--mut); }
.tline .who b { color: var(--t); }
.ctrl { display: flex; flex-direction: column; gap: 8px; }
.ctrl h4 { margin: 0; }
.ctrl-sec { font-weight: 600; font-size: 14px; }
.tbtn.wide { width: 100%; padding: 9px 12px; text-align: center; }
.eyewrap { display: inline-flex; vertical-align: -2px; margin-right: 4px; }
.eyeoff { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.navsubi .eyewrap { color: var(--no-ink); margin: 0; }
.hid, .tline .eyewrap { color: var(--no-ink); }
.tblock.hidden > .ex, .taside.hidden > .ex { opacity: .35; filter: grayscale(.6); }
.navsubi.hidden .tt { text-decoration: line-through; }
.hid { color: var(--no-ink) !important; }
.taside summary { display: flex; align-items: center; gap: 8px; }
.taside summary .tbtn { margin-left: auto; padding: 3px 10px; font-size: 12px; }
.taside { background: var(--well); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; }
.taside summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--mut); }
.taside[open] summary { margin-bottom: 10px; }
.chead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.chead .who { font-size: 13px; color: var(--mut); margin-right: auto; }
.chead .who b { color: var(--t); }
.tbtn { border: 1px solid var(--line); background: var(--card); padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--t); }
.tbtn:hover { background: var(--well); }
.tbtn.on { background: var(--ok-bg); border-color: var(--ok); color: var(--ok-ink); }
.tbtn.primary { background: var(--acc); border-color: var(--acc); color: #fff; }

.note { border-radius: 8px; padding: 8px 10px; font-size: 13px; line-height: 1.5; margin-top: 8px; position: relative; }
.note .nlabel { font-size: 11px; font-weight: 600; margin-bottom: 2px; }
.note.course { background: #FBF1D6; color: #5A4200; }
.note.student { background: #E6F1FB; color: #0C447C; }
.note.claude { background: #F3EAF3; color: #6D1F42; }
.note .del { position: absolute; top: 4px; right: 6px; border: none; background: none; cursor: pointer; color: inherit; opacity: .5; font-size: 14px; }
.note .del:hover { opacity: 1; }
.notes { margin-top: 16px; }

.scard .sname { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.scard .sline { color: var(--mut); font-size: 13px; margin-top: 4px; }
.scard .sline b { color: var(--t); font-weight: 600; }
textarea.qn { width: 100%; height: 70px; resize: vertical; font: inherit; font-size: 13px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
textarea.qn:focus { outline: none; border-color: var(--acc); }
.qtags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.qtag { border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: 3px 10px; font-size: 12px; cursor: pointer; }
.qtag:hover { background: var(--well); }
.qhint { font-size: 11px; color: var(--mut); margin-top: 6px; }
.summary { margin-top: 12px; }
.summary .grp { font-size: 12px; font-weight: 600; margin: 10px 0 4px; }
.summary .row { font-size: 13px; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.summary .row:hover { background: var(--well); }
.summary .row span { color: var(--mut); }
.empty { color: var(--mut); font-size: 13px; line-height: 1.6; }
.empty a { color: var(--acc); }
.spacer { height: 12px; }

/* Упражнение у учителя: чуть компактнее, чем у ученика, но не меньше 17 px */
.grid .ex-body { font-size: 17px; }

@media (max-width: 1000px) {
  .grid { grid-template-columns: 1fr; }
  .sticky { position: static; }
}

/* Заметки к курсу: строки с цветными ярлыками */
.tnote { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.tnote-row { display: flex; gap: 8px; align-items: baseline; }
.tnote-tag { flex: none; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 10px; background: #fff; color: #5A4200; border: 1px solid #EBC58F; min-width: 74px; text-align: center; }
.tnote-tag.t-lead { background: #E6F1FB; color: #0C447C; border-color: #B5D4F4; }
.tnote-tag.t-teach { background: #F3EAF3; color: #6D1F42; border-color: #CECBF6; }
.tnote-tag.t-key { background: #E1F5EE; color: #085041; border-color: #9FE1CB; }
.tnote-tag.t-extra { background: #FFF3E0; color: #6B4E00; border-color: #F5C27A; }
.tnote-tag.t-tip { background: #FCEBEB; color: #791F1F; border-color: #F4C2C2; }
.tnote-text { flex: 1; min-width: 0; }
.tnote-text ul { margin: 2px 0 0; padding-left: 18px; }
.tnote-text li { margin: 1px 0; }
.tnote b { font-weight: 700; }

.hwlist { display: flex; flex-direction: column; gap: 2px; }
.hwrow { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.hwrow:hover { background: var(--well); }
.hwrow.on { background: var(--acc-bg); color: var(--acc-ink); font-weight: 600; }
.hwrow input { margin-top: 2px; }

/* Главная учителя: классы и материалы */
.home { display: grid; grid-template-columns: minmax(0, 860px) 320px; justify-content: center; gap: 12px; padding: 12px; align-items: start; }
.home-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cls-head { display: flex; align-items: center; gap: 10px; }
.cls-head h3 { margin: 0; font-size: 17px; margin-right: auto; }
.cls-live { color: var(--ok); font-weight: 600; font-size: 13px; }
.cls-sub { color: var(--mut); font-size: 13px; margin: 6px 0 10px; }
.cls-sub b { color: var(--t); font-weight: 600; }
.cls-students { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.srow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 8px; border-radius: 8px; background: var(--well); }
.srow-name { font-weight: 600; margin-right: auto; }
.cls-foot { display: flex; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.qtag.danger { color: var(--no-ink); }
.hform { display: flex; gap: 6px; }
.hinput { flex: 1; min-width: 0; font: inherit; font-size: 13px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; }
.hinput:focus { outline: none; border-color: var(--acc); }
.lib-course { margin-bottom: 12px; }
.lib-title { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.lib-pick { width: 100%; margin-bottom: 8px; font-weight: 600; }
.lib-unit { margin-bottom: 10px; }
.lib-unit-title { font-size: 12px; font-weight: 800; color: var(--acc-ink); text-transform: uppercase; letter-spacing: .03em; margin: 10px 0 4px; padding-top: 8px; border-top: 1px solid var(--line); }
.lib-course > .lib-unit:nth-child(2) .lib-unit-title { border-top: none; padding-top: 0; margin-top: 2px; }
.lib-row { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 3px 0; }
.lib-icon { width: 20px; height: 20px; border-radius: 6px; color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; flex: none; }
.livebtn { border: 1px solid var(--ok); background: var(--ok); color: #fff; padding: 6px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; }
.livebtn.on { background: var(--card); color: var(--no-ink); border-color: var(--no); }
.hwprog { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 6px 4px 28px; }
.hwprog span { font-size: 11px; background: var(--well); color: var(--mut); border-radius: 8px; padding: 1px 6px; }
.hwprog span.ok { background: var(--ok-bg); color: var(--ok-ink); }
@media (max-width: 1000px) { .home { grid-template-columns: 1fr; } }

/* Просмотр урока из «Материалов» */
button.lib-row { width: 100%; border: none; background: none; font: inherit; font-size: 13px; text-align: left; cursor: pointer; border-radius: 6px; padding: 4px 6px; color: var(--t); }
button.lib-row:hover { background: var(--well); color: var(--acc-ink); }
.pv-grid { grid-template-columns: 240px minmax(0, 740px); }
.pv-sec { scroll-margin-top: 12px; padding-bottom: 8px; }
.pv-sec + .pv-sec { border-top: 2px solid var(--line); margin-top: 8px; padding-top: 12px; }
.pv-title { margin: 4px 0 8px; font-size: 17px; }
@media (max-width: 1000px) { .pv-grid { grid-template-columns: 1fr; } }

/* Домашка при уроке */
.lib-hw { padding-left: 34px !important; color: var(--mut) !important; }
.hwcur { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.hwcur-title { font-size: 12px; color: var(--mut); }
.hwall summary { cursor: pointer; font-size: 12px; color: var(--mut); margin: 6px 0; }
.hwrow.hwsub { padding-left: 26px; color: var(--mut); }

.grid .ex-title { font-size: 18px; }

/* Чат класса */
.tchat h4 { display: flex; align-items: center; gap: 6px; }
.tchat-badge { background: var(--no); color: #fff; border-radius: 10px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.tchat-list { max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.tmsg { background: var(--well); border-radius: 10px 10px 10px 3px; padding: 5px 8px; align-self: flex-start; max-width: 92%; }
.tmsg.mine { align-self: flex-end; background: var(--acc-bg); border-radius: 10px 10px 3px 10px; }
.tmsg.private { border: 1px dashed #B5A3E0; }
.tmsg-who { font-size: 11px; font-weight: 600; color: var(--mut); }
.tmsg-text { font-size: 13px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.tmsg-text a { color: var(--acc); }
.tchat-to { width: 100%; font: inherit; font-size: 12px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 6px; background: var(--card); }
.tchat-row { display: flex; gap: 6px; align-items: stretch; }
.tchat-input { height: 52px; }

/* Words to learn */
.wlist { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; max-height: 220px; overflow-y: auto; }
.wrow { position: relative; font-size: 13px; padding: 4px 22px 4px 8px; background: var(--well); border-radius: 6px; }
.wrow span { color: var(--mut); }
.wrow .del { position: absolute; top: 2px; right: 4px; border: none; background: none; cursor: pointer; color: var(--mut); font-size: 14px; }
.wform { display: flex; flex-direction: column; gap: 4px; }

/* Таймер */
.ttimer { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid var(--line); }
.ttimer-left { font-size: 18px; font-variant-numeric: tabular-nums; margin: 0 6px; }

.srow-other { width: 100%; font-size: 12px; color: var(--mut); padding-left: 16px; }
.cls .hform + .hform { margin-top: 6px; }

/* Подготовка урока класса */
.keybtn.on { background: #FBF1D6; border-color: #E5B84F; color: #5A4200; font-weight: 600; }
.prep-intro { background: #FDF6E3; border: 1px dashed #E5B84F; color: #5A4200; border-radius: 8px; padding: 8px 12px; font-size: 13px; margin-bottom: 8px; }
.add-here { width: 100%; border: 1.5px dashed #C9C2B4; background: none; color: var(--mut); border-radius: 8px; padding: 6px; font: inherit; font-size: 13px; cursor: pointer; margin: 2px 0 6px; }
.add-here:hover { border-color: #E5B84F; color: #5A4200; background: #FDF6E3; }
.tblock.added { background: #FFFBF2; border-radius: 8px; padding-left: 10px; padding-right: 10px; border-left: 3px solid #E5B84F; }
.added-tag { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: #6B4E00; margin-bottom: 6px; }
.pick-modal { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: grid; place-items: center; z-index: 50; padding: 16px; }
.pick-card { background: var(--card); border-radius: 12px; width: min(1100px, 100%); height: min(86vh, 900px); display: flex; flex-direction: column; overflow: hidden; }
.pick-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.pick-body { flex: 1; display: grid; grid-template-columns: 280px 1fr; min-height: 0; }
.pick-lessons { overflow-y: auto; padding: 10px; border-right: 1px solid var(--line); }
.pick-lessons .lib-row.on { background: var(--acc-bg); color: var(--acc-ink); }
.pick-items { overflow-y: auto; padding: 10px 16px; }
.pick-sec { font-size: 12px; font-weight: 600; color: var(--mut); margin: 12px 0 4px; }
.pick-item { border-bottom: 1px solid var(--line); padding: 4px 0; }
.pick-row { display: flex; align-items: center; gap: 8px; }
.pick-title { flex: 1; text-align: left; border: none; background: none; font: inherit; font-size: 13px; cursor: pointer; padding: 6px 4px; border-radius: 6px; color: var(--t); display: flex; gap: 8px; align-items: baseline; }
.pick-title:hover { background: var(--well); }
.pick-title .n { color: var(--mut); min-width: 30px; }
.pick-type { margin-left: auto; font-size: 11px; color: var(--mut); }
.pick-prev { padding: 8px 4px 12px; }
.pick-prev[hidden] { display: none; }

/* План урока */
.navpanel { display: flex; flex-direction: column; }
.navpanel > .panel { margin: 0; }
.lp-head { display: flex; align-items: center; justify-content: space-between; }
.lp-head h4 { margin: 0; }
.lp-status { font-size: 12px; color: var(--mut); margin: 6px 0; }
.lp-status.on { color: var(--ok-ink); font-weight: 600; }
.lp-list { display: flex; flex-direction: column; gap: 1px; }
.lp-row { display: flex; align-items: baseline; gap: 8px; width: 100%; text-align: left; border: none; background: none; font: inherit; font-size: 12.5px; padding: 4px 6px; border-radius: 6px; color: var(--t); cursor: default; }
.lp-row.link { cursor: pointer; }
.lp-row.link:hover { background: var(--well); }
.lp-row.cur { background: var(--ok-bg); color: var(--ok-ink); font-weight: 600; }
.lp-row.past { color: var(--mut); }
.lp-row.past .lp-text { text-decoration: line-through; text-decoration-color: #C9C7BF; }
.lp-time { flex: none; width: 38px; color: var(--mut); font-variant-numeric: tabular-nums; font-size: 11.5px; }
.lp-row.cur .lp-time { color: var(--ok-ink); }
.lp-text { flex: 1; min-width: 0; }
.lp-go { color: var(--mut); }
.pe-card { width: min(860px, 100%); height: auto; max-height: 86vh; }
.pe-body { padding: 12px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.pe-rows { display: flex; flex-direction: column; gap: 6px; }
.pe-row { display: flex; align-items: center; gap: 6px; }
.pe-min { width: 64px; flex: none; }
.pe-unit { font-size: 12px; color: var(--mut); }
.pe-ex { width: 240px; flex: none; }
.pe-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.lp-toggle { border: none; background: none; font: inherit; font-size: 12px; font-weight: 600; color: var(--mut); cursor: pointer; padding: 0; }
.lp-toggle:hover { color: var(--t); }
.lp-list { margin-top: 6px; }
.lp-why { display: block; font-size: 11.5px; color: var(--mut); font-weight: 400; margin-top: 1px; }
.pe-texts { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pe-row { align-items: flex-start; }

/* ---------- экран класса: как у ученика ---------- */
.tbar-fixed { position: sticky; top: 0; z-index: 30; flex-direction: column; align-items: stretch; gap: 6px; padding: 8px 16px; box-shadow: 0 1px 0 var(--line); }
.tbar-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tbar-students { gap: 8px; }
.tbar-students .tabs { margin: 0; padding: 0; border: none; }
.tbar-label { font-size: 12px; color: var(--mut); }
.keybtn.hwtop { margin-left: auto; font-weight: 600; }
/* Колонка урока 740 px по центру, справа план и разделы. */
.tgrid { display: grid; grid-template-columns: minmax(0, 740px) 290px; justify-content: center; gap: 14px; padding: 14px 14px 40px; align-items: start; }
.tright { top: 118px; max-height: calc(100vh - 130px); }
/* Панель кнопок слева от колонки урока. */
.ttools { position: fixed; z-index: 25; top: 50%; transform: translateY(-50%); left: max(8px, calc(50% - 522px - 82px)); display: flex; flex-direction: column; gap: 4px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 6px; box-shadow: 0 4px 16px rgba(0,0,0,.06); }
.ttool { position: relative; width: 60px; padding: 6px 2px 5px; border: none; border-radius: 10px; background: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; font: inherit; color: var(--mut); }
.ttool:hover:not(:disabled) { background: var(--well); color: var(--t); }
.ttool.on { background: var(--acc-bg); color: var(--acc-ink); }
.ttool:disabled { opacity: .4; cursor: default; }
.ttool:focus { outline: none; }
.ttool:focus-visible { outline: 2px solid var(--acc); }
.ttool-ico { font-size: 20px; line-height: 1; }
.ttool-lab { font-size: 11px; font-weight: 600; }
.ttool-badge { position: absolute; top: 0; right: 2px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--no); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.ttool-badge.soft { background: var(--acc); }
.ttool-badge[hidden] { display: none; }
/* Окна рядом с панелью. */
.tfly { display: none; position: fixed; z-index: 26; top: 118px; bottom: 16px; width: 330px; left: calc(max(8px, calc(50% - 522px - 82px)) + 82px);
  flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.14); overflow: hidden; }
.tfly.is-open { display: flex; }
.tfly-head { display: flex; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.tfly-head b { flex: 1; font-size: 14px; }
.tfly-close { border: none; background: none; font-size: 20px; color: var(--mut); cursor: pointer; }
.tfly-body { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.tfly .tchat-list { max-height: none; flex: 1; }
.tfly[data-fly="chat"] .tfly-body { overflow: hidden; }
.tfly[data-fly="chat"] .tchat-list { overflow-y: auto; }
.tfly .wlist { max-height: none; }
.ttimer { display: flex; flex-direction: column; gap: 10px; border: none; padding: 0; }
.ttimer-big { font-size: 40px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.ttimer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
@media (max-width: 1240px) {
  .tgrid { justify-content: start; padding-left: 96px; }
  .ttools { left: 8px; }
  .tfly { left: 90px; }
}
@media (max-width: 1000px) {
  .tgrid { grid-template-columns: 1fr; padding-left: 14px; padding-bottom: 90px; }
  .ttools { top: auto; bottom: 8px; transform: none; flex-direction: row; left: 8px; }
  .tfly { left: 8px; right: 8px; width: auto; top: auto; bottom: 86px; height: 60vh; }
}

/* Своя домашка */
.hwset-info { font-size: 13px; }
.hwpick { display: flex; align-items: baseline; gap: 8px; padding: 6px 4px; border-bottom: 1px solid var(--line); font-size: 13px; cursor: pointer; }
.hwpick:hover { background: var(--well); }
.hwpick.muted .hwpick-t { color: var(--mut); }
.hwpick .n { color: var(--mut); min-width: 30px; }
.hwpick-t { flex: 1; }

/* ---------- урок у учителя — как у ученика ---------- */
.panel { border: 2px solid var(--soft-line); border-radius: 20px; }
.tgrid > .panel.peek { background: none; border: none; padding: 0; }
.tsec-title { font-size: 24px; font-weight: 800; color: var(--title); margin: 4px 4px 4px; }
.chead { border-bottom: none; padding-bottom: 0; margin-bottom: 4px; flex-direction: column; align-items: flex-start; gap: 2px; }
.chead .who { font-size: 13px; margin-left: 4px; }
.tblock { border-top: none; padding: 10px 0 6px; }
.tline { margin: 0 4px 8px; flex-wrap: wrap; }
/* Карточка задания — как у ученика. */
.tcard { background: var(--card); border-radius: 24px; padding: 20px; border: 2px solid var(--soft-line); }
.tblock.added { background: none; border-left: none; padding-left: 0; padding-right: 0; }
.tblock.added .tcard { border: 2px dashed #E5B84F; }
.tblock.hidden > .tcard { opacity: .4; filter: grayscale(.6); }
.taside { background: var(--card); border: 2px solid var(--soft-line); border-radius: 24px; padding: 14px 18px; }
.notes { margin: 8px 4px 0; }
/* Верхняя полоса: строка урока — цветная, как шапка у ученика. */
.tbar-fixed { background: var(--page); box-shadow: none; padding: 10px 16px 6px; }
.tbar-row:first-child { background: var(--course); color: #fff; border-radius: 18px; padding: 8px 12px; }
.tbar-row:first-child .tbar-title { color: #fff; }
.tbar-row:first-child .tbar-title small { color: rgba(255,255,255,.8); }
.tbar-row:first-child .keybtn, .tbar-row:first-child .lsel { border-color: transparent; }
.tbar-students { padding: 0 6px; }
.tright { top: 124px; }
.ttools, .tfly { border: 2px solid var(--soft-line); border-radius: 20px; }
.tfly { top: 124px; }
.tab { border-width: 2px; }
.tbtn, .keybtn, .qtag { border-radius: 10px; }

/* Закреплённая полоса учителя — так же, как шапка ученика. */
.tbar-fixed { background: rgba(250, 248, 244, .86); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); transition: box-shadow .2s; }
body.scrolled .tbar-fixed { box-shadow: 0 6px 16px -10px rgba(60, 40, 10, .35); }

/* ---------- редактор заданий ---------- */
.tbtn.danger { color: var(--no-ink); }
.ed-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; padding: 6px 8px; background: #FDF6E3; border: 1px solid #F3D9A8; border-radius: 8px; }
.ed-bar-note { font-size: 12px; color: var(--mut); }
.ed-sec-tools { display: inline-flex; gap: 6px; margin-left: 10px; vertical-align: middle; }
.edited-tag { color: #185FA5; }
.hist-row { display: flex; align-items: baseline; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
.hist-at { color: var(--mut); min-width: 110px; font-variant-numeric: tabular-nums; }
.hist-note { flex: 1; }

.ed-modal { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: grid; place-items: center; z-index: 60; padding: 12px; }
.ed-card { background: var(--card); border-radius: 12px; width: min(1280px, 100%); height: min(92vh, 1000px); display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,.2); }
.ed-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.ed-head b { font-size: 15px; }
.ed-head .keybtn { margin-left: auto; }
.ed-scope { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: #FDF6E3; color: #6B4E00; }
.ed-body { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 0; }
.ed-form { overflow: auto; padding: 0 16px 16px; border-right: 1px solid var(--line); }
.ed-preview { overflow: auto; padding: 12px 16px 16px; background: var(--page); }
.ed-toolbar { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 10px 0; background: var(--card); border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.ed-tb { font: inherit; font-size: 14px; min-width: 34px; height: 32px; padding: 0 8px; border: 1px solid var(--line); background: var(--card); border-radius: 6px; cursor: pointer; color: var(--t); }
.ed-tb:hover { background: var(--well); }
.ed-a { font-weight: 800; border-bottom: 3px solid #A32D2D; line-height: 1; }
.ed-tb-hint { font-size: 12px; color: var(--mut); margin-left: 6px; }
.ed-popwrap { position: relative; display: inline-block; }
.ed-pop { position: absolute; top: calc(100% + 4px); left: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 4px; width: max-content; max-width: 220px; padding: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.ed-pop[hidden] { display: none; }
.ed-sw { width: 26px; height: 26px; border-radius: 6px; border: 2px solid #fff; outline: 1px solid var(--line); cursor: pointer; }
.sw-course { background: var(--course, #7A3A66); } .sw-gray { background: #5F5E5A; } .sw-red { background: #A32D2D; } .sw-orange { background: #C2541F; }
.sw-yellow { background: #E5B400; } .sw-green { background: #3B6D11; } .sw-teal { background: #0F6E56; } .sw-blue { background: #185FA5; } .sw-purple { background: #7A3A66; }
.ed-field { display: block; margin: 12px 0; }
.ed-label { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.ed-in { width: 100%; box-sizing: border-box; font: inherit; font-size: 15px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--t); }
.ed-in:focus { outline: 2px solid var(--acc-bg); border-color: var(--acc); }
.ed-in.short { max-width: 220px; }
.ed-area { resize: vertical; line-height: 1.55; }
.ed-area.mono { font-family: ui-monospace, Consolas, monospace; font-size: 14px; }
.ed-help { font-size: 12px; color: var(--mut); margin-top: 4px; line-height: 1.45; }
.ed-howto { background: var(--well); padding: 8px 10px; border-radius: 8px; }
.ed-check { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.ed-fold summary { cursor: pointer; font-size: 13px; font-weight: 700; padding: 4px 0; }
.ed-fold[open] summary { margin-bottom: 6px; }
.ed-insert { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 6px; }
.ed-insert .ed-howto { flex-basis: 100%; }
.ed-info { background: var(--well); border-radius: 8px; padding: 10px 12px; font-size: 13px; margin: 12px 0; }
.ed-pv-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.ed-pv-sub { font-size: 12px; color: var(--mut); margin-right: auto; }
.ed-pv-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.ed-foot { border-top: 1px solid var(--line); padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.ed-errs { flex: 1; font-size: 13px; color: var(--no-ink); max-height: 64px; overflow: auto; }
.ed-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.ed-types { height: auto; max-height: 92vh; width: min(760px, 100%); }
.ed-type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; padding: 16px; overflow: auto; }
.ed-type { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; font: inherit; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); cursor: pointer; }
.ed-shot { display: flex; align-items: center; gap: 12px; margin: 16px 16px 0; padding: 14px; border: 2px dashed var(--acc, #7A3A66); border-radius: 12px; background: var(--well); }
.ed-shot > div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.ed-shot small { color: var(--mut); }
.ed-shot-msg { margin: 6px 16px 0; font-size: 13px; color: var(--mut); }
.ed-shot-msg:empty { display: none; }
.ed-shot-msg.err { color: var(--bad, #B3261E); }
.ed-type:hover { border-color: var(--acc); background: var(--acc-bg); }
.ed-type-icon { font-size: 22px; }
.ed-type small { color: var(--mut); font-size: 12px; }
@media (max-width: 820px) {
  .ed-body { grid-template-columns: 1fr; overflow: auto; }
  .ed-form, .ed-preview { overflow: visible; border-right: none; }
  .ed-modal { padding: 0; }
  .ed-card { height: 100vh; border-radius: 0; }
}
/* Звук и картинки в редакторе */
.ed-media-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0; }
.ed-media-row audio { height: 36px; max-width: 100%; }
.ed-media-row video { max-width: 220px; max-height: 130px; border-radius: 6px; background: #000; }
.ed-media-row .ed-in { flex: 1; min-width: 160px; }
.ed-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.ed-thumb { position: relative; width: 110px; height: 80px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--well); }
.ed-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ed-thumb-x, .ed-thumb-b { position: absolute; top: 4px; width: 24px; height: 24px; border-radius: 50%; border: none; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 15px; line-height: 1; }
.ed-thumb-x { right: 4px; } .ed-thumb-b.l { left: 4px; }
.ed-foot-msg { flex: 1; min-width: 0; }
.ed-status { font-size: 13px; color: var(--mut); }
.ed-status.err { color: var(--no-ink); }
.ed-modal.drop .ed-card { outline: 3px dashed var(--acc); outline-offset: -6px; }
.ed-vthumb { width: 240px; aspect-ratio: 16 / 9; border: 0; border-radius: 6px; background: #000; }
.ed-warn { font-size: 12px; color: #6B4E00; background: #FDF6E3; border-radius: 6px; padding: 6px 8px; margin: 4px 0; }
/* «Пишу за ученика» */
.writebtn { margin-left: auto; }
.writebtn.on { background: #EAF3DE; border-color: #9CC27A; color: #2F5A0C; font-weight: 600; }
/* Шапка класса — всегда одной строкой: выбор урока сжимается, на узком экране у кнопок остаются значки */
.tbar-row:first-child { flex-wrap: nowrap; gap: 8px; }
.tbar-row:first-child > * { flex: none; white-space: nowrap; }
.tbar-row:first-child .tbar-title { flex: 0 1 auto; min-width: 60px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.tbar-row:first-child .lsel { flex: 1 1 160px; min-width: 110px; max-width: 360px; text-overflow: ellipsis; }
.tbar-row:first-child .keybtn, .tbar-row:first-child .livebtn { padding: 6px 10px; }
.tbar-row:first-child .seg button { padding: 6px 9px; }
@media (max-width: 1440px) { .tbar-row:first-child .keybtn .lbl { display: none; } }
@media (max-width: 1080px) { .tbar-row:first-child .livebtn .lbl, .tbar-row:first-child .tbar-title small { display: none; } }
@media (max-width: 760px) { .tbar-row:first-child { flex-wrap: wrap; } }
/* Своя домашка: источники и секции; ответы в домашке */
.hwsrc { margin-bottom: 14px; }
.hwsrc-title { font-weight: 700; font-size: 14px; padding: 8px 4px 2px; border-bottom: 2px solid var(--line); }
.hwpick-sec { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.rv-card { width: min(980px, 100%); }
.rv-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.rv-tabs { margin: 0; padding: 0; border: none; }
.rv-sum { font-size: 13px; color: var(--mut); margin-left: auto; }
.rv-body { background: var(--page); }
.rv-item { margin: 8px 0 14px; }
.notes.above { margin: 0 4px 8px; }
.notes.above .note:first-child { margin-top: 0; }
.note .nlabel .nflip { margin-left: 8px; border: 1px solid currentColor; background: none; color: inherit; border-radius: 999px; padding: 0 8px; font: inherit; font-size: 11px; cursor: pointer; opacity: .6; }
.note .nlabel .nflip:hover { opacity: 1; }
.qtag.on { background: var(--acc, #7A3A66); color: #fff; border-color: transparent; }
