:root {
  --bg: #f4f1ea;
  --card: #ffffff;
  --text: #1f2328;
  --muted: #626870;
  --line: #ddd8cc;
  --metal: linear-gradient(180deg, #e9ecef 0%, #c4c9cf 45%, #aab0b7 100%);
  --wood: #3b3f46;
  --blow: #e8742a;
  --blow-soft: #fbe3d2;
  --draw: #1f8f86;
  --draw-soft: #d3efec;
  --heard: #6a5acd;
  --scale: #e6e0ff;
  --ok: #237a3e; /* светлая тема: ≥ 4,5:1 на --bg и --card (UX-11) */
  --bad: #b83232;
  --radius: 14px;
}
/* Native controls (the open list of a select, scrollbars) follow the page theme, not the browser one: a light page in a dark browser must not get a dark dropdown. */
:root { color-scheme: light; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark; } }
:root[data-theme="dark"] { color-scheme: dark; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171a;
    --card: #1f2226;
    --text: #e8e6e1;
    --muted: #9aa0a8;
    --line: #33373d;
    --metal: linear-gradient(180deg, #5d636b 0%, #454a51 45%, #383c42 100%);
    --wood: #0d0e10;
    --blow-soft: #4a2e1c;
    --draw-soft: #173c39;
    --heard: #9d8fff;
    --scale: #3a3360;
    --ok: #2e9d4f;
    --bad: #d64545;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.top, .controls, main {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 18px;
  padding-bottom: 8px;
}
.top h1 { font-size: 1.4rem; margin: 0; }
.back { color: var(--muted); text-decoration: none; padding: 0 6px 0 0; }
.back:hover { color: var(--text); }
.pulse { animation: pulse 1.2s ease 3; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 var(--blow); } 50% { box-shadow: 0 0 0 6px transparent; } }

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  padding-bottom: 12px;
}
.controls label { display: flex; flex-direction: column; font-size: .85rem; color: var(--muted); gap: 4px; }
.controls .grow { flex: 1; min-width: 200px; }

select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
}
textarea { width: 100%; resize: vertical; font-family: ui-monospace, Consolas, monospace; }

.btn {
  font: inherit;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn.on { background: var(--ok); border-color: var(--ok); color: #fff; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { font: inherit; border: 0; background: var(--card); color: var(--muted); padding: 8px 14px; cursor: pointer; }
.seg button.active { background: var(--text); color: var(--bg); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
/* Телефон: карточки на всю ширину экрана — внешний отступ страницы и боковые рамки убраны, хватит внутреннего. */
@media (max-width: 640px) {
  main { padding-left: 0; padding-right: 0; }
  main .card { border-left: 0; border-right: 0; border-radius: 0; }
  main details.card, main .ls-proof, main .rec-note { border-radius: 0; }
}
details.card summary { cursor: pointer; font-weight: 600; }
.muted { color: var(--muted); font-size: .9rem; }
code { background: var(--bg); padding: 1px 5px; border-radius: 5px; }

/* Инструкция */
.instr-main { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; font-size: 1.6rem; }
.instr-hole b { font-size: 2.6rem; }
.instr-note { color: var(--muted); font-size: 1.1rem; }
.dir-badge {
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--line);
  color: var(--text);
  font-size: 1.2rem;
}
.dir-badge.blow { background: var(--blow); color: #fff; }
.dir-badge.draw { background: var(--draw); color: #fff; }
.dir-badge.done { background: var(--ok); color: #fff; }
.hold { height: 8px; background: var(--bg); border-radius: 4px; margin: 12px 0 8px; overflow: hidden; }
.hold-fill { height: 100%; width: 0; background: var(--ok); transition: width .05s linear; }
.hint { min-height: 1.4em; color: var(--muted); }
.hint.bad { color: var(--bad); }
.hint.good { color: var(--ok); }
.instruction.flash { animation: flash .35s ease; }
@keyframes flash { 0% { box-shadow: 0 0 0 0 var(--ok); } 100% { box-shadow: 0 0 0 10px transparent; } }

/* Гармошка */
/* Гармошка всегда влезает в ширину экрана — без горизонтальной прокрутки. */
.harp-card { overflow: visible; }
.harp {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 4px;
  min-width: 0;
}
.hole { display: grid; grid-template-rows: 34px auto auto auto 34px; row-gap: 2px; text-align: center; }
.arrow { font-weight: 700; font-size: .8rem; display: flex; align-items: center; justify-content: center; border-radius: 8px; visibility: hidden; }
.arrow.up { align-self: end; }
.lbl { font-size: .8rem; color: var(--muted); padding: 3px 0; border-radius: 6px; }
.body {
  background: var(--metal);
  padding: 8px 0;
  border-radius: 6px;
  position: relative;
}
.slot {
  width: 60%;
  height: 26px;
  margin: 0 auto;
  background: var(--wood);
  border-radius: 4px;
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .1s, box-shadow .1s;
}
.hole.next .slot { box-shadow: 0 0 0 2px var(--muted); }
.hole.t-blow .arrow.blow, .hole.t-draw .arrow.draw { visibility: visible; }
.arrow.blow { background: var(--blow); color: #fff; }
.arrow.draw { background: var(--draw); color: #fff; }
.hole.t-blow .slot { background: var(--blow); box-shadow: 0 0 0 3px var(--blow-soft); }
.hole.t-draw .slot { background: var(--draw); box-shadow: 0 0 0 3px var(--draw-soft); }
.hole.t-blow .lbl.blow { background: var(--blow-soft); color: var(--text); font-weight: 700; }
.hole.t-draw .lbl.draw { background: var(--draw-soft); color: var(--text); font-weight: 700; }
.hole.h-blow .lbl.blow, .hole.h-draw .lbl.draw { outline: 2px solid var(--heard); color: var(--heard); font-weight: 700; }
.hole.h-blow .slot, .hole.h-draw .slot { outline: 3px solid var(--heard); outline-offset: 2px; }

.legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; font-size: .85rem; color: var(--muted); }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; }
.sw.blow { background: var(--blow); }
.sw.draw { background: var(--draw); }
.sw.heardsw { background: transparent; outline: 2px solid var(--heard); }

/* Индикатор звука */
.meter { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.heard { min-width: 140px; }
.heard-note { font-size: 2.2rem; font-weight: 700; color: var(--heard); line-height: 1.1; }
.heard-sub { color: var(--muted); font-size: .9rem; }
.meter-right { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 10px; }
.cents-scale { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); }
.cents-bar { position: relative; height: 18px; background: var(--bg); border-radius: 9px; }
.cents-zone { position: absolute; top: 0; bottom: 0; background: var(--draw-soft); border-radius: 9px; }
.cents-needle { position: absolute; top: -3px; bottom: -3px; width: 4px; margin-left: -2px; left: 50%; background: var(--heard); border-radius: 2px; transition: left .08s; visibility: hidden; }
.level-row { display: flex; align-items: center; gap: 10px; font-size: .8rem; color: var(--muted); }
.level { position: relative; flex: 1; height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.level-fill { height: 100%; width: 0; background: var(--muted); }
.level-gate { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bad); }

/* Табулатура */
.tab-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.progress-text { font-weight: 600; }
.stats { color: var(--muted); font-size: .9rem; }
.tab-strip { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip {
  min-width: 38px;
  padding: 6px 8px;
  text-align: center;
  border-radius: 8px;
  font-weight: 700;
  border: 2px solid transparent;
  cursor: pointer;
  font-family: ui-monospace, Consolas, monospace;
}
.chip.blow { background: var(--blow-soft); }
.chip.draw { background: var(--draw-soft); }
.chip.done { opacity: .45; }
.chip.missed { text-decoration: underline wavy var(--bad); }
.chip.current { border-color: var(--text); transform: scale(1.15); }
.bar { width: 2px; height: 26px; background: var(--line); margin: 0 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: center; }

.result h2 { margin-top: 0; }
.range { display: block; margin: 12px 0; }
.range input { width: 100%; }

/* Режим (кнопка) и вид (какие карточки и движок сейчас работают). В «Занятии» вид задаёт упражнение. */
body:not(.view-player) .player-only { display: none; }
body:not(.view-player) #instruction .hold, body.view-player:not(.drive-wait) #instruction .hold { display: none; }
body:not(.drive-wait) .wait-only, body:not(.drive-clock) .clock-only { display: none; }
body:not(.view-bend) .bend-only { display: none; }
body:not(.view-free) .free-only { display: none; }
body:not(.view-tech) .tech-only { display: none; }
body:not(.mode-session) .session-only { display: none; }
body.mode-session .no-session, body.mode-session #bendPick { display: none; }

.modes .ic, .modes .short { display: none; }

/* Телефон: нижняя панель режимов, гармошка во всю ширину без прокрутки, компактные блоки. */
@media (max-width: 600px) {
  body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .top { padding-top: calc(10px + env(safe-area-inset-top)); padding-bottom: 6px; }
  .top h1 { font-size: 1.05rem; }
  .top .btn { padding: 8px 12px; }
  .mic-label { display: none; }
  .controls { gap: 8px; padding-bottom: 8px; }
  .controls label { flex: 1; min-width: 0; }
  .controls .grow { min-width: 0; flex: 3; }
  .controls select { width: 100%; }

  .modes {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(var(--mx-cols, 5), 1fr);
    border-radius: 0;
    border: 0;
    border-top: 1px solid var(--line);
    background: var(--card);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .modes button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; font-size: .72rem; min-height: 56px; }
  .modes .ic { display: block; font-size: 1.3rem; line-height: 1; }
  .modes .long { display: none; }
  .modes .short { display: inline; }
  .modes button.active { background: var(--bg); color: var(--text); box-shadow: inset 0 3px 0 var(--text); }

  .card { padding: 12px; margin-bottom: 10px; }
  .instr-main { font-size: 1.15rem; gap: 8px; }
  .instr-hole b { font-size: 2rem; }
  .dir-badge { font-size: 1rem; padding: 5px 10px; }

  .harp-card { overflow: visible; }
  .harp { min-width: 0; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 2px; }
  .hole { grid-template-rows: 26px auto auto auto 26px; }
  .arrow { font-size: 0; border-radius: 6px; }
  .arrow::before { font-size: .95rem; }
  .arrow.blow::before { content: '⬇'; }
  .arrow.draw::before { content: '⬆'; }
  .lbl { font-size: .62rem; padding: 2px 0; }
  .slot { width: 80%; height: 24px; font-size: .85rem; }
  .body { padding: 6px 0; }
  .legend { gap: 10px; font-size: .75rem; }

  .meter { gap: 10px; }
  .heard { min-width: 0; display: flex; align-items: baseline; gap: 10px; }
  .heard-note { font-size: 1.6rem; }
  .heard-sub { font-size: .8rem; }
  .meter-right { min-width: 100%; }

  .btn { padding: 10px 14px; }
  .actions { gap: 6px; }
  .chip { min-width: 34px; padding: 6px 6px; }
  .bend-meter { width: 120px; }
  .bend-info { min-width: 0; }
  .rhythm-controls .tempo { min-width: 100%; }
  .jam-grid { gap: 4px; }
  .jam-cell { padding: 6px 2px; font-size: .9rem; }
}

/* Ритм */
.rhythm-controls { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; margin-bottom: 14px; }
.player-bar { margin: 6px 0 10px; }
.tempo { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 220px; }
.tempo input { flex: 1; }
.check { display: flex; align-items: center; gap: 6px; cursor: pointer; }
[hidden] { display: none !important; }
.lane {
  position: relative;
  height: 74px;
  background: var(--bg);
  border-radius: 10px;
  overflow: hidden;
}
.lane-inner { position: absolute; top: 0; bottom: 0; left: 0; will-change: transform; }
.playhead { position: absolute; top: 0; bottom: 0; left: 25%; width: 3px; margin-left: -1px; background: var(--text); opacity: .8; }
.lane-beat { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); opacity: .6; }
.lane-bar { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--muted); opacity: .6; }
.lane-note {
  position: absolute;
  top: 14px;
  height: 46px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding-left: 8px;
  font: 700 .95rem ui-monospace, Consolas, monospace;
  color: #fff;
  border: 3px solid transparent;
  overflow: hidden;
  white-space: nowrap;
}
.lane-note.blow { background: var(--blow); }
.lane-note.draw { background: var(--draw); }
.lane-note.g-perfect { border-color: var(--ok); box-shadow: 0 0 0 2px var(--ok); }
.lane-note.g-early, .lane-note.g-late { border-color: #e0b400; }
.lane-note.g-wrong, .lane-note.g-miss { opacity: .35; border-color: var(--bad); }
.lane-note.g-done { opacity: .5; }
.lane-note .g { font: 600 .7rem system-ui, sans-serif; margin-left: 6px; opacity: .95; }
.lane-note.current { outline: 3px solid var(--text); outline-offset: 1px; }
.lane-count { position: absolute; top: 14px; height: 46px; display: flex; align-items: center; justify-content: center; border: 2px dashed var(--line); border-radius: 8px; color: var(--muted); font: 700 1.2rem system-ui, sans-serif; box-sizing: border-box; }
#gxLane .lane-count { top: 86px; }
.drive-wait .lane-note { cursor: pointer; }
#driveSeg button { padding: 8px 10px; font-size: .9rem; }
.rhythm-stats { margin-top: 10px; font-size: .95rem; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.rhythm-stats b.ok { color: var(--ok); }
.rhythm-stats b.warn { color: #c99a00; }
.rhythm-stats b.bad { color: var(--bad); }
.countin { font-size: 2.6rem; font-weight: 800; }

/* Бенды */
.bend-pick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.bend-btn {
  font: 700 1rem ui-monospace, Consolas, monospace;
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 52px;
}
.bend-btn small { font: 600 .65rem system-ui, sans-serif; color: var(--ok); min-height: .9em; }
.bend-btn.draw { background: var(--draw-soft); }
.bend-btn.blow { background: var(--blow-soft); }
.bend-btn.active { border-color: var(--text); }
.bend-btn.mastered { box-shadow: inset 0 -3px 0 var(--ok); }
.bend-main { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.bend-meter {
  position: relative;
  width: 170px;
  flex: none;
  background: var(--bg);
  border-radius: 10px;
  overflow: hidden;
}
.bend-tick { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--muted); display: flex; justify-content: space-between; padding: 2px 8px 0; font-size: .8rem; }
.bend-tick span { font: 700 .9rem ui-monospace, Consolas, monospace; }
.bend-tick em { font-style: normal; color: var(--muted); }
.bend-tick.target { border-top: 2px solid var(--ok); }
.bend-zone { position: absolute; left: 0; right: 0; background: var(--ok); opacity: .18; }
.bend-marker {
  position: absolute;
  left: 8px;
  right: 8px;
  height: 6px;
  margin-top: -3px;
  border-radius: 3px;
  background: var(--heard);
  visibility: hidden;
  transition: top .06s linear;
}
.bend-marker.hit { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.bend-info { flex: 1; min-width: 240px; }
.bend-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 6px; }
.bend-phase { font-size: 1.05rem; }
.bend-phase.good { color: var(--ok); font-weight: 600; }
.bend-now { min-height: 1.4em; color: var(--muted); }
.bend-reps { font-weight: 600; margin-top: 4px; }
.bend-tip { color: var(--muted); font-size: .9rem; margin-bottom: 0; }

/* Блюз */
.jam-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.jam-cell {
  background: var(--bg);
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 8px 6px;
  text-align: center;
  font-weight: 700;
}
.jam-cell small { display: block; font-weight: 400; color: var(--muted); font-size: .75rem; }
.jam-cell.current { border-color: var(--text); background: var(--card); }
.lbl.in-scale { background: var(--scale); color: var(--text); font-weight: 700; }
.lane-chord { position: absolute; top: 0; padding-left: 4px; font: 700 .7rem system-ui, sans-serif; color: var(--muted); }

/* Занятие */
.ls-row { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 12px; }
.ls-step { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.ls-step input { width: 80px; font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); }
.ls-step-title { color: var(--muted); }
.ls-plan { margin: 10px 0; min-height: 6.5em; } /* the runner fills the plan after the page is shown: room for a typical plan (CLS 0.14-0.16 on math, robotics at 4x CPU) */
.ls-step-title { min-height: 1.5em; }
#lsMinutes { min-height: 41px; }
#lsLast, #lsEstimate { min-height: 1.5em; }
.ls-plan ol, .ls-segs { margin: 0; padding-left: 22px; }
.ls-plan li, .ls-segs li { margin: 2px 0; }
.ls-segs li.current { font-weight: 700; }
.ls-segs li.done { color: var(--muted); text-decoration: line-through; }
.ls-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.ls-timer { font: 800 2rem ui-monospace, Consolas, monospace; }
.ls-timer.over { color: var(--bad); }
.ls-timeout { background: var(--blow-soft); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.ls-theory { background: var(--bg); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.ls-theory p { margin: 0 0 6px; }
.ls-theory p:last-child { margin-bottom: 0; }
/* Термины словаря: двойное подчёркивание, определение — во всплывашке по наведению или тапу. */
dfn.gl { font-style: inherit; text-decoration: underline double; text-decoration-color: var(--draw); text-underline-offset: 3px; cursor: help; }
dfn.gl.open { background: var(--draw-soft, rgba(31, 143, 134, .18)); border-radius: 3px; }
.gl-tip { position: absolute; z-index: 50; background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: .9rem; line-height: 1.4; box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }
.gl-tip b { color: var(--draw); }
/* Рекомендованные курсы: плашка в начале занятия. */
.rec-note { background: var(--bg); border-left: 3px solid var(--draw); border-radius: 8px; padding: 8px 12px; margin: 0 0 10px; font-size: .92rem; }
.rec-note a, .rec a { color: var(--draw); text-decoration: underline dotted; text-underline-offset: 3px; }
.rec-note a:hover, .rec a:hover { color: var(--blow); }
.rec-done { color: var(--ok, #2e9d5b); font-weight: 600; white-space: nowrap; }
.rec-part { color: var(--muted); white-space: nowrap; }
.ls-ex { margin-top: 12px; }
.ls-ex-title { font-size: 1.2rem; font-weight: 700; white-space: pre-line; }
.ls-ex-text { white-space: pre-line; }
.ls-ex-mount:not(:empty) { margin: 8px 0; }
#lsTransfer { width: 100%; box-sizing: border-box; font-family: monospace; font-size: 12px; word-break: break-all; }
.ls-ex-status { min-height: 1.4em; font-weight: 600; }
.ls-ex-status.good { color: var(--ok); }
.ls-ex-status.bad { color: var(--bad); }
.ls-next { font-size: 1.6rem; font-weight: 800; margin: 12px 0; }
.ls-program h4 { margin: 12px 0 4px; }
.ls-program ol { margin: 0; padding-left: 28px; }
.ls-program li { margin: 1px 0; font-size: .92rem; }
/* Ссылки на шаги: спокойный акцентный цвет вместо дефолтного синего, видимое подчёркивание и стрелка — чтобы было понятно, что это переход к шагу. */
.ls-program a, .ls-program a:visited { color: var(--draw); text-decoration: underline dotted; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.ls-program a::after { content: ' ›'; color: var(--muted); }
.ls-program a:hover { color: var(--blow); text-decoration-style: solid; }
.ls-program a:hover::after { color: var(--blow); }
.tag { display: inline-block; font-size: .72rem; padding: 1px 6px; border-radius: 6px; background: var(--bg); color: var(--muted); margin-left: 4px; }
.tag.hard { background: var(--blow-soft); color: var(--text); }
.tag.ok { color: var(--ok); }
.ls-done { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--bg); border: 1px dashed var(--line); border-radius: 10px; padding: 8px 12px; margin: 10px 0; }
.hw-item { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px dashed var(--line); }
.hw-item .grow { flex: 1; min-width: 180px; }
.hw-quiz { padding-top: 6px; border-top: 1px dashed var(--line); }
.hw-quiz .ls-ex-title { margin: 6px 0 10px; }
.res-list { margin: 0; padding-left: 20px; }
.res-list .ok { color: var(--ok); }
.res-list .bad { color: var(--bad); }

/* Приёмы */
.tech-status { min-height: 1.4em; font-weight: 600; margin-top: 6px; }
.tech-status.good { color: var(--ok); }
.tech-status.bad { color: var(--bad); }
.tv-big { font: 700 1.6rem ui-monospace, Consolas, monospace; margin: 6px 0 10px; }
.tv-level { position: relative; height: 14px; background: var(--bg); border-radius: 7px; overflow: hidden; margin: 8px 0; }
.tv-fill { height: 100%; width: 0; background: var(--heard); }
.tv-mark { position: absolute; top: 0; bottom: 0; width: 3px; background: var(--ok); left: -10px; }
.tv-mark.loud { background: var(--bad); }
.tv-dots { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.tv-dots span { width: 18px; height: 18px; border-radius: 50%; background: var(--bg); border: 2px solid var(--line); }
.tv-dots span.on { background: var(--ok); border-color: var(--ok); }
.tv-notes { display: flex; flex-wrap: wrap; gap: 8px; }
.tv-notes span { padding: 6px 10px; border-radius: 8px; background: var(--bg); font-family: ui-monospace, Consolas, monospace; }
.tv-notes span:last-child { border: 2px solid var(--ok); }
.tv-notes span.on { background: var(--heard); color: #fff; }
@media (max-width: 600px) {
  .ls-timer { font-size: 1.5rem; }
}

/* Узкие окна (телефон, планшет, половина экрана): стрелки без слов, подписи мельче. */
@media (max-width: 760px) {
  .harp { gap: 2px; }
  .arrow { font-size: 0; border-radius: 6px; }
  .arrow::before { font-size: .95rem; }
  .arrow.blow::before { content: '⬇'; }
  .arrow.draw::before { content: '⬆'; }
  .lbl { font-size: .62rem; }
  .slot { width: 80%; }
}

/* Язык */
.top-right { display: flex; gap: 8px; align-items: center; }
.lang-sel { padding: 8px 6px; font-weight: 600; }

/* «О курсе» — программа курса в готовом HTML для поисковиков и людей (решение 0038). */
.seo-about h3 { font-size: 1rem; margin: 12px 0 4px; }
.seo-about ol { margin: 0 0 6px; padding-left: 1.8em; }
.seo-about li { margin: 2px 0; }

/* Синхронизация (решение 0039) и «забыть» урок/курс. */
.sync-how { margin: 8px 0 12px; padding-left: 1.4em; }
.sync-how li { margin: 4px 0; }
.sync-qr { display: flex; justify-content: center; margin: 10px 0; }
.sync-qr svg { width: min(280px, 80vw); height: auto; background: #fff; border-radius: 10px; padding: 6px; }
.sync-link { width: 100%; font: 13px ui-monospace, SFMono-Regular, Consolas, monospace; padding: 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.sync-list { display: grid; gap: 8px; margin: 10px 0; }
.sync-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.sync-item input { margin-top: 4px; }
.sync-all { display: inline-flex; gap: 8px; margin: 6px 0; }
.sync-join { margin-top: 14px; display: grid; gap: 6px; }
.sync-join-row { display: flex; gap: 8px; flex-wrap: wrap; }
.sync-code-in { flex: 1 1 140px; max-width: 200px; font: 600 18px ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .08em; text-transform: uppercase; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.sync-code-in.bad-input { border-color: var(--bad); }
.sync-code-line { text-align: center; }
.sync-code { font: 700 24px ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .1em; }
.sync-copy { padding: 4px 10px; vertical-align: middle; }
/* Индикатор переноса (2026-10-18): крутится, пока идёт соединение; полоса — сколько данных уже пришло. */
.sync-busy { display: flex; align-items: center; gap: 12px; margin: 4px 0 10px; }
.sync-busy[hidden] { display: none; }
.sync-spin { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--draw); animation: sync-spin .9s linear infinite; }
.sync-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.sync-bar i { display: block; height: 100%; width: 0; background: var(--draw); transition: width .3s; }
.sync-bar.wait i { width: 30%; animation: sync-slide 1.4s ease-in-out infinite; }
@keyframes sync-spin { to { transform: rotate(360deg); } }
@keyframes sync-slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(340%); } }
@media (prefers-reduced-motion: reduce) { .sync-spin, .sync-bar.wait i { animation: none; } }
.sync-site { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; margin: 6px 0; }
.sync-site .seg { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.sync-site button { padding: 4px 10px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.sync-site button.on { color: var(--text); border-color: var(--blow); }
.sync-top { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 40px; padding: 7px 10px; border: 1px solid var(--draw); border-radius: 10px; background: var(--card); color: var(--draw); font-weight: 600; line-height: 1.2; text-decoration: none; white-space: nowrap; }
.sync-top:hover { border-color: var(--blow); color: var(--blow); }
.sync-tips { margin: 6px 0 0; padding-left: 20px; font-size: 0.92em; }
.sync-tips li { margin: 2px 0; }
#lsProgram .forget { margin-left: 6px; padding: 0 6px; border-radius: 6px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; font-size: .8rem; line-height: 1.5; }
#lsProgram .forget:hover { color: var(--bad); border-color: var(--bad); }
.btn.danger { color: var(--bad); }

.resume-pace { display: block; margin-top: 4px; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Необязательный урок в программе (0053): без номера, чуть с отступом. */
li.extra { list-style: none; margin-left: -.2em; font-size: .92em; }
li.extra.skipped > a { opacity: .6; } /* skipped optional topic (0323) */
details.qz-theory.extra > summary { color: var(--heard); }

/* Подтверждение результатов (решение 0064): «Поделиться прогрессом» на экране курса и страница преподавателя */
.ls-proof { margin: 12px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.ls-proof h3 { margin: 0 0 6px; }
.ls-proof .actions input.proof-name { flex: 1 1 180px; min-width: 0; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
.ls-proof .proof-url { flex: 1 1 220px; min-width: 0; font: 13px ui-monospace, SFMono-Regular, Consolas, monospace; padding: 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.proof-qr { display: flex; justify-content: center; margin: 10px 0; }
.proof-qr svg { width: min(300px, 80vw); height: auto; background: #fff; border-radius: 10px; padding: 6px; }
.proof-page .ok { color: var(--ok); }
.proof-page .bad { color: var(--bad); }
.proof-facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 10px 0 0; }
.proof-facts dt { color: var(--muted); }
.proof-facts dd { margin: 0; }
.proof-scroll { overflow-x: auto; }
.proof-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.proof-table th, .proof-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.proof-table td:nth-child(2), .proof-table td:nth-child(3), .proof-table td:nth-child(4) { white-space: nowrap; }
.proof-table tr.proof-off td { color: var(--muted); }
/* Название шага слева, «Повторить» — всегда справа в той же строке (не переносится под название). */
/* Тренажёр: блоки тем — свёрнутые полосы (открыт текущий), вместо длинной простыни всех тем. */
.qz-block { margin: 8px 0 0; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.qz-block > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; font-weight: 600; }
.qz-block > summary::-webkit-details-marker { display: none; }
.qz-block > summary > span:first-child { flex: 1; min-width: 0; }
.qz-block > summary::after { content: "▾"; color: var(--muted); transition: transform .15s; }
.qz-block[open] > summary::after { transform: rotate(180deg); }
.qz-block .qz-count { font-weight: 400; font-size: 13px; color: var(--muted); white-space: nowrap; }
.qz-block > .qz-skills { padding: 0 12px 12px; margin: 0; }
.qz-all > .qz-all-list { padding: 0 12px 12px; }
.qz-all > summary > span:first-child { color: var(--accent); }
/* Страница «Тетради»: пояснения — полосой «Как это работает», курс в списке — строка: название, ниже мелко прогресс, кнопки справа. */
.w-help { margin: 10px 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.w-help > summary { list-style: none; display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; cursor: pointer; font-weight: 600; }
.w-help > summary::-webkit-details-marker { display: none; }
.w-help > summary::after { content: "▾"; color: var(--muted); transition: transform .15s; }
.w-help[open] > summary::after { transform: rotate(180deg); }
.w-help > p { padding: 0 12px; margin: 0 0 10px; }
.w-courses { list-style: none; padding: 0; margin: 8px 0 0; }
.w-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.w-row-t { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.w-row-name { font-weight: 600; }
.w-row-meta { font-size: 13px; }
.w-row-b { display: flex; flex-wrap: wrap; gap: 6px; }
.w-row-b .btn { padding: 6px 10px; font-size: 13px; }
.w-row-b .w-own-del { color: var(--bad); border-color: transparent; background: transparent; }
/* Свёрнутые разделы тетради («Впереди шагов», «Устройства») — аккуратная полоса на всю ширину, по клику раскрывается. */
.ls-proof details.proof-ahead, .ls-proof details.proof-devices { margin: 12px 0 0; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.ls-proof details.proof-ahead > summary, .ls-proof details.proof-devices > summary { list-style: none; display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; cursor: pointer; font-weight: 600; }
.ls-proof details.proof-ahead > summary::-webkit-details-marker, .ls-proof details.proof-devices > summary::-webkit-details-marker { display: none; }
.ls-proof details.proof-ahead > summary::after, .ls-proof details.proof-devices > summary::after { content: "▾"; color: var(--muted); transition: transform .15s; }
.ls-proof details[open].proof-ahead > summary::after, .ls-proof details[open].proof-devices > summary::after { transform: rotate(180deg); }
.ls-proof details.proof-ahead > :not(summary), .ls-proof details.proof-devices > :not(summary) { padding: 0 12px 10px; margin-top: 0; }
.ls-proof details.proof-ahead > ol { margin: 0; padding: 0 12px 10px 42px; }
.ls-proof details.proof-ahead li { overflow-wrap: anywhere; padding: 2px 0; }
.proof-acts { margin-top: 12px; }
/* Кнопки тетради (итог, поделиться, файл, QR) — плиткой по 2, на узком экране по одной. */
.proof-acts, .w-acts, .actions:has(> #lsStartBtn) { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.proof-acts > .btn, .w-acts > .btn, .actions:has(> #lsStartBtn) > .btn { width: 100%; justify-content: center; text-align: center; margin: 0; }
@media (max-width: 420px) { .proof-acts, .w-acts, .actions:has(> #lsStartBtn) { grid-template-columns: 1fr; } }
.proof-step { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.proof-step .proof-redo-btn { flex: none; white-space: nowrap; }
/* Тетрадь на телефоне: без горизонтальной прокрутки — шаг карточкой (название и «Повторить» в строку, ниже домашка,
   время, статус), сводка — «подпись — значение» в две колонки. */
@media (max-width: 560px) {
  .ls-proof { border: 0; border-radius: 0; padding-left: 0; padding-right: 0; background: transparent; } /* одна рамка — карточки занятия, без второй вложенной */
  .proof-facts { grid-template-columns: 1fr auto; gap: 2px 10px; font-size: 13px; }
  .proof-facts dd { text-align: right; }
  .proof-scroll { overflow: visible; }
  .proof-table, .proof-table tbody { display: block; }
  .proof-table thead { display: none; }
  .proof-table tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .proof-table td { display: block; border: 0; padding: 0; white-space: normal; }
  .proof-table td:nth-child(1) { grid-column: 1 / -1; }
  .proof-table td:nth-child(2) { grid-column: 1; font-size: 13px; }
  .proof-table td:nth-child(3) { grid-column: 2; font-size: 13px; color: var(--muted); }
  .proof-table td:nth-child(4) { display: none; }
  .proof-table td:nth-child(5) { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
  .proof-table td:empty { display: none; }
  .proof-table tr.proof-extra { display: block; }
  .proof-table .proof-redo-btn { font-size: 12px; padding: 2px 8px; }
  .proof-table.proof-exams td:nth-child(4) { display: block; grid-column: 1 / -1; font-size: 12px; color: var(--muted); } /* exam attempts (0313): the date matters */
}
.proof-exam-h { margin: 16px 0 4px; }

/* Профили учеников (решение 0065): кнопка в шапке, меню, окно имени; попытки по заданиям в отчёте */
header.top .top-right, header.home-top .top-right { position: relative; }
.pf-chip { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 50; display: flex; flex-direction: column; gap: 6px; min-width: 260px; max-width: min(340px, calc(100vw - 32px)); padding: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.35); }
.pf-menu .btn { justify-content: flex-start; text-align: left; text-decoration: none; }
.pf-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
.pf-wipe { color: var(--bad); }
.dlg .dlg-text { white-space: pre-line; margin: 0 0 12px; }
.dlg .dlg-copy { width: 100%; margin: 0 0 12px; }
.pf-who { padding: 2px 4px 6px; }
.pf-modal { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.55); display: flex; align-items: flex-start; justify-content: center; padding: clamp(16px, 14vh, 120px) 16px 16px; overflow-y: auto; overscroll-behavior: contain; }
.pf-box { width: min(480px, 100%); margin: 0; }
.pf-box h2 { margin-top: 0; }
.pf-box .pf-name { width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
.proof-tries { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: normal; }
/* Развёртка шага в «Прогрессе обучения» (0066) */
.proof-row { cursor: pointer; }
.proof-row:hover td { background: rgba(127,127,127,.08); }
.proof-more td { background: rgba(127,127,127,.05); white-space: normal !important; }
.proof-run { margin: 4px 0 10px; }
.proof-run ol { margin: 4px 0; padding-left: 22px; }
.proof-run li { margin: 4px 0; }
.proof-ans { font-size: 13px; color: var(--muted); }
@media (max-width: 560px) { .pf-chip { max-width: 120px; padding-left: 10px; padding-right: 10px; } }
/* Телефон: шапка в одну строку — заголовок сжимается, «Перенос» только значком ⇄, иначе кнопки уезжали за край экрана. */
@media (max-width: 560px) { header.top h1 { flex: 1; min-width: 0; font-size: 1.15rem; } header.top .top-right { flex-shrink: 0; gap: 6px; } header.top .sync-word { display: none; } .pf-chip { max-width: 96px; } }
/* «Мои подопечные» (0071) */
.w-head { display: flex; flex-wrap: wrap; gap: 8px; }
.w-head input, .w-new input { flex: 1 1 180px; min-width: 0; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
.w-head .w-label { font-weight: 700; font-size: 1.05rem; }
.w-notes { width: 100%; box-sizing: border-box; margin: 6px 0; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; resize: vertical; }
.w-courses { margin: 6px 0; padding-left: 20px; }
.w-courses li { margin: 4px 0; }
.w-courses a { color: var(--draw); }
/* «Итог курса» — обычная кнопка, как соседние */
.pf-pick { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 10px; }
.pf-pick .btn { justify-content: flex-start; text-align: left; }
.pf-row { display: flex; gap: 6px; }
.pf-row > .btn:first-child { flex: 1; }
.pf-pick .pf-x { justify-content: center; color: var(--bad); flex: 0 0 auto; }
.w-you { color: var(--ok); font-weight: 600; }

/* Приём тетрадей (0093): какие курсы ждём, уведомление о пришедшей тетради */
.w-expect { margin: 0 0 12px; }
.w-chips, .w-expect-found { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.w-expect-q { width: 100%; max-width: 420px; }
.w-toast { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 100; max-width: calc(100vw - 32px); padding: 12px 16px; border-radius: 12px; background: var(--card, #1f2227); border: 1px solid var(--ok); color: var(--ok); box-shadow: 0 8px 30px rgba(0,0,0,.35); transition: opacity .5s; }
.w-toast.bad { border-color: var(--bad); color: var(--bad); }
.w-toast.out { opacity: 0; }

/* «Тетради» — список имён по группам, действия в окне (0094) */
.w-rows { display: flex; flex-direction: column; gap: 6px; margin: 0 0 16px; }
.w-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card, #1f2227); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.w-row:hover { border-color: var(--accent, #2a9d8f); }
.w-modal .pf-box { max-height: calc(100vh - 32px); overflow: auto; }
.w-field { display: flex; flex-direction: column; gap: 4px; margin: 0 0 10px; }
.w-field input, .w-field textarea, .w-expect-q, .dlg .dlg-copy { width: 100%; box-sizing: border-box; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
.w-field textarea { resize: vertical; }
.w-field input:focus, .w-field textarea:focus, .w-expect-q:focus { outline: none; border-color: var(--accent, #2a9d8f); }
.w-notes-view { white-space: pre-line; border-left: 3px solid var(--line); padding-left: 10px; }
.w-search { width: 100%; box-sizing: border-box; margin: 4px 0 8px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
.w-item summary { list-style: none; }
.w-item summary::-webkit-details-marker { display: none; }
.w-item[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.w-body { padding: 10px 14px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 12px 12px; }
.w-courses { padding-left: 18px; }
.w-courses li { margin: 0 0 10px; }
.w-courses li .btn { display: inline-flex; margin: 6px 6px 0 0; text-decoration: none; vertical-align: middle; }
/* Ссылка в виде кнопки — без подчёркивания везде */
a.btn, a.btn:hover, a.btn:visited { text-decoration: none; }
/* «Проверено» и фильтры «Тетрадей» (0097) */
.w-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 0 0 12px; }
.w-filters select { flex: 1 1 220px; width: auto; margin: 0; }
.w-chk { color: var(--muted, #9aa0a6); }
.w-chk.w-ok { color: var(--ok); border-color: var(--ok); }
.w-new { color: var(--warn, #e0a030); font-weight: 600; }
#proofSaved > .actions:first-child { margin-top: 0; } /* отступ сверху как снизу */
ul.proof-rev { list-style: none; margin: 4px 0; padding: 0; font-size: .92em; }
ul.proof-rev li { margin: 2px 0; }
.proof-table .w-rev { margin-top: 6px; }
.w-qr-box .proof-url { width: 100%; box-sizing: border-box; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
/* Сканер QR во вкладке (0099) */
.qr-scan .pf-box { max-width: 420px; }
.qr-view { position: relative; width: 100%; aspect-ratio: 1; background: #000; border-radius: 12px; overflow: hidden; }
.qr-view video { width: 100%; height: 100%; object-fit: cover; }
.qr-frame { position: absolute; inset: 15%; border: 3px solid rgba(255,255,255,.9); border-radius: 16px; box-shadow: 0 0 0 9999px rgba(0,0,0,.35); }
.pf-scan { padding-left: 10px; padding-right: 10px; }
/* Выбор, чьи тетради (0100) */
.w-pick .pf-box { max-width: 480px; max-height: calc(100vh - 32px); overflow: auto; }
.w-pick-list { max-height: 50vh; overflow: auto; margin: 8px 0; }
.w-pick-g { margin: 0 0 10px; }
.w-pick-i { display: block; margin: 4px 0 4px 24px; }

/* Тёмная тема вручную (0101): те же значения, что у системной */
:root[data-theme="dark"] {
    --bg: #15171a;
    --card: #1f2226;
    --text: #e8e6e1;
    --muted: #9aa0a8;
    --line: #33373d;
    --metal: linear-gradient(180deg, #5d636b 0%, #454a51 45%, #383c42 100%);
    --wood: #0d0e10;
    --blow-soft: #4a2e1c;
    --draw-soft: #173c39;
    --heard: #9d8fff;
    --scale: #3a3360;
    --ok: #2e9d4f;
    --bad: #d64545;
}
/* Строка состояния (0101) */
.top-right .lang-sel { display: none; }
.status-bar { visibility: hidden; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 12px calc(6px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); transform: translateY(100%); transition: transform .2s, visibility 0s .2s; }
.status-bar.sb-on { transform: none; visibility: visible; transition-delay: 0s; } /* скрытая строка не в tab-order (UX-12) */
.modes .modes-extra { display: none; }
/* Установленное приложение: без выбора языка (js/i18n.js, is-pwa). */
body.is-pwa .sb-lang, body.is-pwa .modes .mx-lang, body.is-pwa [data-a="lang"] { display: none !important; }
@media (max-width: 600px) { .modes .modes-extra { display: flex; } body.has-modes .status-bar { display: none; } }
.modes .mx-more, .modes.mx-fold .mx-theme, .modes.mx-fold .mx-lang { display: none !important; }
@media (max-width: 600px) { .modes.mx-fold .mx-more { display: flex !important; } }
.mx-menu { position: fixed; right: 8px; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 21; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.mx-menu[hidden] { display: none; }
.mx-menu button { border: 0; background: none; color: var(--text); padding: 12px 18px; font: inherit; text-align: left; cursor: pointer; }
.sb-left { position: relative; display: flex; gap: 6px; align-items: center; }
.sb-btn { border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 13px; cursor: pointer; }
.sb-menu { position: absolute; bottom: calc(100% + 6px); left: 34px; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.sb-menu button { border: 0; background: none; color: var(--text); padding: 10px 18px; font: inherit; text-align: left; cursor: pointer; }
.sb-menu button:hover { background: var(--bg); }
.sb-ver { font-size: 13px; font-weight: 600; }
body { padding-bottom: 44px; }
/* Акцент вместо чёрной заливки (главные кнопки, выбранные вкладки) — мягче в светлой теме */
:root { --accent: #14706a; --accent-hover: #0f5c57; --on-accent: #ffffff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --accent: #2fb3a8; --accent-hover: #3cc4b8; --on-accent: #0d1513; } }
:root[data-theme="dark"] { --accent: #2fb3a8; --accent-hover: #3cc4b8; --on-accent: #0d1513; }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.seg button.active { background: var(--accent); color: var(--on-accent); }

/* Тетрадь (0103): шаг — ссылка на повтор, необязательные на своём месте, «Впереди» свёрнуто */
.proof-table a.proof-redo { color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; }
.proof-table a.proof-redo:hover { color: var(--accent); }
.proof-table a.proof-redo-btn { display: inline-block; margin-left: 8px; padding: 1px 8px; border: 1px solid var(--accent); border-radius: 6px; color: var(--accent); text-decoration: none; font-size: .85em; white-space: nowrap; }
.proof-table tr.proof-extra td { padding-left: 1.6em; font-size: .95em; }
.proof-ahead { margin: .8em 0; }
.proof-ahead summary { cursor: pointer; color: var(--muted, #888); }
.proof-ahead ol { margin: .5em 0; }
.proof-ahead li.extra { list-style: none; }
.proof-table tr.proof-extra a, .proof-ahead a { color: var(--accent); text-decoration: none; }
.proof-table tr.proof-extra a:hover, .proof-ahead a:hover { text-decoration: underline; }

/* Счётчик домашки (0105): две строки — тема и вся серия */
.hw-quiz .hw-count { white-space: pre-line; }
/* Шапка на узком экране (0124): ссылки и профиль — в выпадающем меню за кнопкой ☰ (js/profile.js, placeChip). */
.top-menu-btn { display: none; }
@media (max-width: 600px) {
  header.top, header.home-top { position: relative; }
  .top-menu-btn { display: inline-flex; align-items: center; justify-content: center; flex: none; min-width: 42px; height: 40px; padding: 0 12px; font: inherit; font-size: 1.25rem; line-height: 1; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); cursor: pointer; }
  header.top .top-right, header.home-top .top-right { display: none; }
  header.menu-open .top-right { display: flex; flex-direction: column; align-items: stretch; position: absolute; right: 8px; top: var(--menu-top, calc(100% - 4px)); z-index: 60; min-width: 230px; padding: 8px; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.5); }
  header.menu-open .top-right > * { box-sizing: border-box; width: 100%; justify-content: flex-start; max-width: none; }
  header.menu-open .top-right .sync-word { display: inline; }
  header.menu-open .top-right .pf-chip { max-width: none; }
}
/* Камера и кнопка пользователя на узком экране — в шапке рядом с ☰ (js/profile.js, placeChip; решение 0132). */
@media (max-width: 600px) {
  header > .pf-scan, header > .pf-chip, header > .top-menu-btn { flex: none; margin-left: 6px; }
}
/* Vue pages (app/shared/profile/HeaderTools.vue) append scanner, chip and ☰ to their places; the order is set here:
   scanner and chip first in .top-right, ☰ last in the header. On classic pages the DOM order is already the same. */
.top-right > .pf-scan, .top-right > .pf-chip { order: -1; }
header > .top-menu-btn { order: 1; }
/* Цифра уровня ученика у имени (решение 0142). */
.pf-lv { display: inline-block; min-width: 1.5em; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--accent, #2bb3a3); color: var(--on-accent, #0b1514); font-size: .75em; font-weight: 700; line-height: 1.5; text-align: center; vertical-align: 1px; }

/* «Мои тетради»: законченный курс (#27) */
.w-fin { color: var(--ok); font-weight: 600; font-size: .9em; white-space: nowrap; }
/* Курс только для русского интерфейса (решение 0190): пояснение видно лишь в английском. */
.en-only { display: none; }
html[lang="en"] .en-only { display: block; }

/* Серия и звёзды за домашку (решение 0211). Золото: светлая тема — тёмное, тёмная — светлое (контраст ≥ 4,5:1). */
:root { --star: #8a5a00; --star-off: #a8a39a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --star: #f2b84b; --star-off: #6a6f77; } }
:root[data-theme="dark"] { --star: #f2b84b; --star-off: #6a6f77; }
.hw-stars { color: var(--star); letter-spacing: .05em; white-space: nowrap; font-weight: 600; }
.hw-stars .off { color: var(--star-off); }
.hw-stars.tag { padding: 0 6px; }
.hw-streak { margin: 2px 0 6px; font-weight: 600; color: var(--text); min-height: 1.45em; }
.hw-streak b { color: var(--ok); }
.hw-streak.hot b { color: var(--star); }
.hw-sum { margin: 8px 0; padding: 0; list-style: none; }
.hw-sum li { padding: 4px 0; border-top: 1px dashed var(--line); overflow-wrap: anywhere; }
.proof-step .hw-stars { margin-left: 6px; font-size: .9em; }

/* Задача-босс блока (решение 0216) */
.boss-list { list-style: none; margin: 4px 0 12px; padding: 0; }
.boss-row { padding: 6px 0; overflow-wrap: anywhere; }
.boss-card { border: 1px solid var(--star); border-radius: var(--radius); padding: 10px 14px; margin: 12px 0; background: var(--card); }
.boss-card h3 { margin: 0 0 6px; }
.boss .boss-story { border-left: 4px solid var(--star); padding: 6px 12px; margin: 8px 0; overflow-wrap: anywhere; }
.boss .boss-story pre { max-width: 100%; overflow-x: auto; }
.boss-parts { list-style: none; margin: 8px 0; padding: 0; }
.boss-part { padding: 4px 0; border-top: 1px dashed var(--line); overflow-wrap: anywhere; }
.boss-part.lock { color: var(--muted); }
.boss-part.ok .boss-mark { color: var(--ok); }
.boss-part.bad .boss-mark { color: var(--bad); }
.boss-part.now { font-weight: 600; }
.boss-mark { display: inline-block; min-width: 1.4em; }
.boss-result { font-size: 1.1em; }
/* Цвет темпа на карточке «Продолжить» (home.js pace): светлота зависит от темы — на светлом фоне ярко-зелёный не читался. */
:root { --pace-l: 30%; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --pace-l: 55%; } }
:root[data-theme="dark"] { --pace-l: 55%; }
/* Vue pages (decision 0241): the mount point does not add a box, so header and main stay direct flex/grid items of body. */
#app, #app .kept { display: contents; }
/* Windows high contrast (forced-colors, checked 2026-11-24): backgrounds are dropped, so a selected state that only changed the
   background (mode tab, length button, primary button) looked like the others. Highlight / HighlightText are system colors: kept. */
@media (forced-colors: active) {
  .seg button.active, .modes button.active, .btn.primary, .seg button[aria-pressed="true"] { forced-color-adjust: none; background: Highlight; color: HighlightText; border-color: Highlight; }
  .btn.primary { border-width: 2px; }
  .w-field input:focus, .w-field textarea:focus, .w-expect-q:focus { outline: 2px solid Highlight; outline-offset: 1px; }
}
