/* Своя палитра: тёплая бумага и тушь, нефрит как основной цвет действия.
   Светлая тема — основная; тёмная включается, если так настроена система. */
:root {
  --bg: #f8f5ef;
  --panel: #ffffff;
  --panel2: #efeae0;
  --line: #e2dbcd;
  --ink: #23201c;
  --dim: #6b6358;
  --dim2: #968d7e;
  --accent: #c4553f;
  --accent2: #cf8b2e;
  --good: #2f8f6b;
  --blue: #3c7ea8;
  --r: 14px;
  --han: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", "Microsoft YaHei", serif;
  --tabh: calc(58px + env(safe-area-inset-bottom));
}
/* Тёмная тема — по выбору в настройках, а не по настройке телефона:
   приложение задумано светлым. «Как в системе» включается отдельно. */
:root[data-theme="dark"],
:root[data-theme="auto"] {
  --bg: #14120f; --panel: #1c1916; --panel2: #262119; --line: #342e25;
  --ink: #ece5d8; --dim: #a49a8c; --dim2: #7c7369;
  --accent: #e0705a; --accent2: #e0a33c; --good: #4fae86; --blue: #6ba3ce;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    --bg: #f8f5ef; --panel: #ffffff; --panel2: #efeae0; --line: #e2dbcd;
    --ink: #23201c; --dim: #6b6358; --dim2: #968d7e;
    --accent: #c4553f; --accent2: #cf8b2e; --good: #2f8f6b; --blue: #3c7ea8;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; overscroll-behavior-y: contain; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.55 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
button:active, .tile:active, .charBox:active, .pill:active { transform: scale(.97); }
.btn, .tile, .pill, .tab, .charBox { transition: transform .09s ease, background .12s, border-color .12s; }
/* ничего не выделяется случайным долгим тапом, кроме текста для чтения */
.tabbar, .top, .btn, .pill, .grades, .charBox { user-select: none; -webkit-user-select: none; }

/* --------------------------------------------------------------- шапка */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px; flex-wrap: nowrap;
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px;
  /* стекло: фон просвечивает и размывается, снизу мягкая тень — так шапка
     отделяется от содержимого, а не сливается с ним */
  background: color-mix(in srgb, var(--panel) 72%, transparent);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  box-shadow: 0 6px 18px -12px rgba(0, 0, 0, .45);
  min-height: 52px;
}
/* когда страница прокручена, тень заметнее — видно, что под шапкой контент */
.top.stuck { box-shadow: 0 10px 26px -14px rgba(0, 0, 0, .55); }
.brand { flex: none; display: flex; align-items: center; }
.logo {
  font-family: var(--han); font-size: 19px; line-height: 1;
  background: var(--accent); color: #fff; border-radius: 9px; padding: 5px 8px;
}
#nav { display: flex; gap: 2px; flex: 1; min-width: 0; overflow: hidden; }
#nav a {
  color: var(--dim); padding: 6px 10px; border-radius: 8px; font-size: 14px; white-space: nowrap;
}
#nav a.on { background: var(--panel2); color: var(--ink); font-weight: 600; }

.hstat { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: none; }
.hchip {
  font-size: 12px; padding: 5px 10px; border-radius: 99px; white-space: nowrap;
  background: var(--panel2); color: var(--dim); border: 1px solid var(--line);
}
.hchip.due { background: var(--accent); color: #fff; border-color: transparent; font-weight: 600; }
.hchip.due.zero { background: var(--panel2); color: var(--dim2); border-color: var(--line); font-weight: 400; }
.hgoal {
  width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--good) calc(var(--p) * 1%), var(--panel2) 0);
  color: inherit;
}
/* «0/10» пишем одной строкой: при display:grid число и «/10» становились
   отдельными строками сетки, и кружок выглядел поломанным */
.hgoal span {
  width: 30px; height: 30px; border-radius: 50%; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; line-height: 1;
  white-space: nowrap; letter-spacing: -.02em;
}
.hgoal i { font-style: normal; font-weight: 400; color: var(--dim2); font-size: 9px; }

/* --------------------------------------------------------------- каркас */
main { max-width: 1080px; margin: 0 auto; padding: 22px 18px 80px; }
h1 { font-size: 24px; margin: 0 0 4px; font-weight: 650; }
h2 { font-size: 17px; margin: 26px 0 10px; font-weight: 620; }
h3 { font-size: 13px; margin: 18px 0 6px; color: var(--dim); font-weight: 600;
     text-transform: uppercase; letter-spacing: .06em; }
p.sub { color: var(--dim); margin: 0 0 18px; }
.loading { color: var(--dim); padding: 40px 0; text-align: center; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.grid { display: grid; gap: 12px; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.muted { color: var(--dim); } .small { font-size: 13px; } .tiny { font-size: 12px; }

/* --------------------------------------------------------------- элементы */
.btn {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 16px; min-height: 42px;
}
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 12px; font-size: 13px; min-height: 34px; }
.btn.wide { width: 100%; justify-content: center; }
input, select, textarea {
  background: var(--panel2); border: 1px solid var(--line); color: var(--ink);
  border-radius: 10px; padding: 11px 13px; font: inherit; font-size: 16px; width: 100%;
  -webkit-appearance: none; appearance: none;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent2); outline-offset: -1px; }
textarea { min-height: 120px; resize: vertical; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 13px; color: var(--dim); margin-bottom: 5px; }

.han { font-family: var(--han); }
.pinyin { color: var(--accent2); }
.lvl { font-size: 11px; padding: 1px 6px; border-radius: 5px;
       background: var(--panel2); color: var(--dim); border: 1px solid var(--line); }
.lvl[data-l="1"] { color: #7fb069; } .lvl[data-l="2"] { color: #9fbf5f; }
.lvl[data-l="3"] { color: var(--accent2); } .lvl[data-l="4"] { color: #dd8b3f; }
.lvl[data-l="5"] { color: var(--accent); } .lvl[data-l="6"], .lvl[data-l="7"] { color: #c15fa8; }
.bar { height: 7px; background: var(--panel2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--good); border-radius: 99px; transition: width .4s; }

/* --------------------------------------------------------------- главная */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.tile { display: block; background: var(--panel); border: 1px solid var(--line);
        border-radius: var(--r); padding: 16px; color: inherit; }
.tile .t-han { font-family: var(--han); font-size: 28px; color: var(--accent); line-height: 1; }
.tile h4 { margin: 9px 0 4px; font-size: 15px; }
.tile p { margin: 0; color: var(--dim); font-size: 12px; }
.stat { text-align: center; padding: 14px; }
.stat b { display: block; font-size: 25px; font-weight: 650; }
.stat span { color: var(--dim); font-size: 12px; }

/* --------------------------------------------------------------- карточки */
.flash { max-width: 560px; margin: 0 auto; text-align: center; }
.flash .q { font-family: var(--han); font-size: 74px; line-height: 1.25; margin: 20px 0 8px; }
.flash .a { min-height: 92px; }
.flash .a .py { font-size: 21px; color: var(--accent2); }
.flash .a .gl { color: var(--dim); margin-top: 8px; }
.cardface { touch-action: pan-y; }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 20px; }
.grades button { padding: 14px 4px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel2); font-size: 14px; }
.grades button i { display: block; font-style: normal; font-size: 11px; color: var(--dim2); margin-top: 3px; }
.grades button[data-g="1"] { border-color: #8a3b30; }
.grades button[data-g="3"] { border-color: #4a6b3a; }
.progressline { display: flex; gap: 10px; justify-content: center; color: var(--dim); font-size: 13px; }

/* --------------------------------------------------------------- чтение */
.reader { font-family: var(--han); font-size: 29px; line-height: 2.05; }
.reader .tok { cursor: pointer; border-radius: 4px; padding: 0 1px; }
.reader .tok.miss { color: var(--accent); border-bottom: 2px dotted var(--accent); }
.sent { border-bottom: 1px solid var(--line); padding: 12px 0; }
.sent .ru { font-family: inherit; font-size: 14px; color: var(--dim); line-height: 1.5; }
.sent .py { font-family: inherit; font-size: 14px; color: var(--accent2); line-height: 1.5; }
.sent .tools { display: flex; gap: 8px; margin-top: 6px; }

/* --------------------------------------------------------------- словарь */
.entry { padding: 12px 0; border-bottom: 1px solid var(--line); }
.entry .hw { font-family: var(--han); font-size: 26px; }
.entry .gl { color: var(--dim); font-size: 14px; }
.bkrs-body { font-size: 14px; line-height: 1.7; }
.bkrs-body .ex { color: var(--dim); font-size: 13px; padding-left: 12px;
                 border-left: 2px solid var(--line); margin: 4px 0; }
.bkrs-body i { color: var(--dim2); } .bkrs-body .p { color: var(--blue); font-style: italic; }
table.list { width: 100%; border-collapse: collapse; }
table.list td { padding: 9px 5px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list td.h { font-family: var(--han); font-size: 20px; white-space: nowrap; }

/* --------------------------------------------------------------- иероглифы */
.charGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 8px; }
.charBox { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; cursor: pointer; color: inherit; }
.charBox b { font-family: var(--han); font-size: 25px; font-weight: 400; }
.charBox small { font-size: 10px; color: var(--dim2); }
.charBox.known { background: color-mix(in srgb, var(--good) 14%, var(--panel)); }
.writer { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.gridpaper { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; touch-action: none; }

/* --------------------------------------------------------------- домашка */
.hwtask { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
          padding: 16px; margin-bottom: 12px; }
.hwtask.done { border-color: color-mix(in srgb, var(--good) 50%, var(--line)); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
/* Чтение стоит над иероглифом — и в наборе, и уже вставленным в ответ.
   Раньше колонка задавалась только внутри .chips, и в строке ответа пиньинь
   съезжал слева от слова. */
.chipw {
  display: inline-flex; flex-direction: column; align-items: center; gap: 1px;
  line-height: 1.2;
}
.chips .chipw {
  font-family: var(--han); font-size: 22px; padding: 8px 12px; border-radius: 12px;
  background: var(--panel2); border: 1px solid var(--line);
}
/* чтение и перевод на самом слове — включаются кнопками режимов */
.chipw .cp {
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 11px; color: var(--accent2); line-height: 1.1;
}
.chipw .cr {
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 10px; color: var(--dim); line-height: 1.1; max-width: 110px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chips .chipw.used { opacity: .28; }
.answerline {
  min-height: 62px; border: 1.5px dashed var(--line); border-radius: 14px;
  padding: 10px 12px; background: color-mix(in srgb, var(--panel2) 55%, transparent);
  font-family: var(--han); font-size: 24px;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.answerline .chipw {
  font-family: var(--han);
  background: var(--panel);
  border: 1.5px solid color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 1px 3px #0002;
  /* без скругления вставленные слова выглядели вырезанными прямоугольниками */
  border-radius: 12px;
  padding: 6px 12px; position: relative;
}
.answerline .chipw::after {
  content: '×'; position: absolute; top: -7px; right: -6px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-family: system-ui, sans-serif; font-size: 12px; line-height: 18px; text-align: center;
  opacity: 0; transition: opacity .12s;
}
.answerline .chipw:hover::after, .answerline .chipw:active::after { opacity: 1; }
.verdict { margin-top: 10px; font-size: 14px; }
.verdict .zh { font-family: var(--han); font-size: 22px; }

/* --------------------------------------------------------------- шторка снизу */
.sheet { position: fixed; inset: 0; z-index: 60; }
.sheet-bg { position: absolute; inset: 0; background: #0009; animation: fade .16s; }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 88dvh; overflow: auto;
  background: var(--panel); border-top: 1px solid var(--line);
  border-radius: 20px 20px 0 0; padding: 8px 20px calc(30px + env(safe-area-inset-bottom));
  animation: up .2s cubic-bezier(.2,.8,.3,1);
}
.sheet-grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 6px auto 12px; }
.sheet-x { position: absolute; right: 14px; top: 8px; background: none; border: 0; font-size: 26px; color: var(--dim); }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
@media (min-width: 861px) {
  .sheet-panel { left: auto; right: 0; top: 0; bottom: 0; width: min(460px, 100%);
    max-height: none; border-radius: 0; border-left: 1px solid var(--line);
    padding: 20px 22px 60px; animation: slide .2s ease; }
  @keyframes slide { from { transform: translateX(100%); } }
}

/* --------------------------------------------------------------- нижние вкладки */
.tabbar { display: none; }
@media (max-width: 860px) {
  #nav { display: none; }
  .hstat { gap: 6px; }
  .hchip { font-size: 11px; padding: 4px 9px; }
  main { padding: 16px 14px calc(24px + var(--tabh)); }
  h1 { font-size: 21px; }
  .flash .q { font-size: 62px; }
  .reader { font-size: 26px; line-height: 1.95; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: color-mix(in srgb, var(--panel) 74%, transparent);
    backdrop-filter: blur(18px) saturate(1.4);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
    box-shadow: 0 -8px 22px -14px rgba(0, 0, 0, .5);
    padding-bottom: env(safe-area-inset-bottom); height: var(--tabh);
  }
  .tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; color: var(--dim2); font-size: 10.5px; background: none; border: 0; position: relative;
  }
  .tab .ic { font-family: var(--han); font-size: 19px; line-height: 1; }
  .tab.on { color: var(--accent); }
  .tab .badge {
    position: absolute; top: 6px; right: 50%; margin-right: -22px;
    background: var(--accent); color: #fff; font-size: 10px; line-height: 1;
    padding: 3px 5px; border-radius: 99px; min-width: 16px;
  }
  .grid.c3 { grid-template-columns: repeat(2, 1fr); }
  table.list td { padding: 10px 4px; }
}

/* --------------------------------------------------------------- прочее */
.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { padding: 7px 13px; border-radius: 99px; border: 1px solid var(--line);
        background: var(--panel2); font-size: 13px; color: var(--dim); }
.pill.on { background: var(--accent); color: #fff; border-color: transparent; }
.ok { color: var(--good); } .bad { color: var(--accent); }
.empty { color: var(--dim); padding: 30px 16px; text-align: center;
         border: 1px dashed var(--line); border-radius: var(--r); }
.md h4 { margin: 14px 0 4px; }
.md code { background: var(--panel2); padding: 1px 5px; border-radius: 5px; font-family: var(--han); }
.hist { display: flex; gap: 2px; align-items: flex-end; height: 60px; }
.hist i { flex: 1; background: var(--blue); border-radius: 2px 2px 0 0; min-height: 2px; opacity: .8; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(16px + var(--tabh)); z-index: 80;
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 99px;
  font-size: 14px; animation: fade .15s;
}
.sheetmenu { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sheetmenu a { display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 16px 8px; background: var(--panel2); border-radius: 14px; color: inherit; font-size: 12px; }
.sheetmenu .ic { font-family: var(--han); font-size: 24px; color: var(--accent); }

/* --------------------------------------------------------------- карта курса */
.road-level { margin-bottom: 22px; }
.road-label { font-size: 12px; color: var(--dim); text-transform: uppercase;
  letter-spacing: .06em; margin: 0 0 10px 4px; }
.node {
  display: flex; align-items: center; gap: 14px; color: inherit;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px 14px; margin-bottom: 10px; position: relative;
}
.node::before {
  content: ''; position: absolute; left: 34px; top: -11px; width: 2px; height: 11px;
  background: var(--line);
}
.node:first-of-type::before { display: none; }
.node.done { border-color: color-mix(in srgb, var(--good) 55%, var(--line)); }
.node.locked { opacity: .5; }
.node .ring {
  width: 44px; height: 44px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 600;
  background: conic-gradient(var(--good) calc(var(--p) * 1%), var(--panel2) 0);
}
.node .ring b { background: var(--panel); width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 600; }
.node.done .ring b { color: var(--good); }
.node-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.node-body b { font-size: 15px; }

/* --------------------------------------------------------------- ввод пиньинем */
.ime {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  background: var(--panel); border-top: 1px solid var(--line);
  box-shadow: 0 -6px 20px #0004; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.ime-q { font-size: 12px; color: var(--accent2); padding: 2px 6px 4px; letter-spacing: .08em; }
.ime-list { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.ime-list::-webkit-scrollbar { display: none; }
.ime-item {
  flex: none; display: flex; flex-direction: column; align-items: center; gap: 1px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 10px;
  padding: 6px 10px; min-width: 62px;
}
.ime-item .n { font-size: 10px; color: var(--dim2); }
.ime-item .z { font-size: 24px; line-height: 1.1; }
.ime-item .p { font-size: 11px; color: var(--accent2); }
.ime-item .g { font-size: 10px; color: var(--dim2); max-width: 92px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imefield { margin-top: 6px; }

/* --------------------------------------------------------------- выполненные задания */
.hwtask.solved { padding: 12px 14px; background: color-mix(in srgb, var(--good) 8%, var(--panel)); }
.hwtask.solved > summary {
  display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none;
}
.hwtask.solved > summary::-webkit-details-marker { display: none; }
.hwtask.solved > summary::after { content: '⌄'; margin-left: auto; color: var(--dim2); }
.hwtask.solved[open] > summary::after { content: '⌃'; }
.hwtask.solved > summary b { font-weight: 600; }

/* --------------------------------------------------------------- таблица слогов */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
.pytable { border-collapse: separate; border-spacing: 0; font-size: 12px; }
.pytable th {
  position: sticky; background: var(--panel2); color: var(--dim);
  font-weight: 600; padding: 6px 8px; z-index: 1; white-space: nowrap;
}
.pytable thead th { top: 0; }
.pytable tbody th { left: 0; text-align: left; z-index: 2; }
.pytable thead th:first-child { left: 0; z-index: 3; }
.pytable td { padding: 0; border-top: 1px solid var(--line); }
.pytable .empty-cell { background: color-mix(in srgb, var(--line) 25%, transparent); }
.syl {
  display: block; width: 100%; min-width: 52px; padding: 8px 6px;
  background: none; border: 0; font-size: 12px; color: var(--ink); white-space: nowrap;
}
.syl:hover { background: var(--panel2); }
.syl:active { background: var(--accent); color: #fff; }

/* --------------------------------------------------------------- ключи */
.radgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 8px; }
.radbox {
  aspect-ratio: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; color: inherit;
}
.radbox b { font-size: 26px; font-weight: 400; line-height: 1; }
.radbox small { font-size: 10px; color: var(--dim2); }
.radbox:hover { border-color: var(--accent); }


/* --------------------------------------------------------------- потянуть для обновления */
.ptr {
  position: fixed; left: 0; right: 0; top: 0; z-index: 40; display: grid; place-items: center;
  height: 0; overflow: hidden; transition: height .12s;
  pointer-events: none;
}
.ptr span {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent);
  display: block;
}
.ptr.spin span { animation: ptrspin .7s linear infinite; }
@keyframes ptrspin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------- слова-подсказки в задании */
.hintchips { gap: 7px; }
.hintchips .chipw {
  font-size: 19px; padding: 7px 11px; border-radius: 10px;
  background: var(--panel2); border: 1px solid var(--line); cursor: pointer;
}
.hintchips .chipw:hover { border-color: var(--accent); }
.hintchips .chipw.used { opacity: .32; }
.imefield input.translate { font-size: 21px; padding: 12px 14px; }

/* --------------------------------------------------------------- произношение */
.sp { padding: 2px 4px; border-radius: 6px; }
.sp.good { background: color-mix(in srgb, var(--good) 22%, transparent); }
.sp.bad { background: color-mix(in srgb, var(--accent) 22%, transparent);
  text-decoration: underline wavy var(--accent); text-underline-offset: 4px; }
.btn.mic.listening { background: var(--accent); color: #fff; animation: micpulse 1.1s infinite; }
@keyframes micpulse { 50% { opacity: .65; } }

/* --------------------------------------------------------------- кабинет */
.avatar {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--panel2); color: var(--ink); font-weight: 700; font-size: 13px;
  display: grid; place-items: center; padding: 0;
}
.avatar:hover { border-color: var(--accent); }
.avatar.big { width: 44px; height: 44px; font-size: 18px; background: var(--accent); color: #fff;
  border-color: transparent; }

/* --------------------------------------------------------------- кольца целей */
.ringbox {
  width: 210px; height: 210px; margin: 16px auto; border-radius: 50%;
  background: conic-gradient(var(--good) calc(var(--p) * 1%), var(--panel2) 0);
  display: grid; place-items: center;
}
.ringbox.compact { width: 190px; height: 190px; }
.ringin {
  width: 78%; height: 78%; border-radius: 50%; background: var(--panel);
  display: grid; place-items: center; align-content: center; gap: 2px;
}
.ringin b { font-size: 40px; font-weight: 300; line-height: 1; }
.ringin span { font-size: 12px; color: var(--dim); }

.weekrow { display: flex; gap: 6px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.wday {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: var(--panel2); border: 1px solid var(--line); font-size: 12px; color: var(--dim);
}
.wday.done { background: color-mix(in srgb, var(--good) 30%, var(--panel2)); color: var(--ink); }
.wday.today { border-color: var(--accent); color: var(--ink); font-weight: 600; }
.wday.future { opacity: .5; }

.levelrow { display: flex; gap: 8px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.lvlring {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--good) calc(var(--p) * 1%), var(--panel2) 0);
}
.lvlring b {
  width: 36px; height: 36px; border-radius: 50%; background: var(--panel);
  display: grid; place-items: center; font-size: 12px; font-weight: 600;
}
.lvlring.on b { color: var(--accent); }

.bigstat { display: flex; flex-direction: column; gap: 6px; }
.bigstat span { font-size: 13px; color: var(--dim); }
.bigstat b { font-size: 38px; font-weight: 300; line-height: 1; }

/* --------------------------------------------------------------- библиотека */
.listgrid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.listcard {
  display: flex; align-items: center; gap: 12px; color: inherit;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px;
}
.listcard:hover { border-color: var(--accent); }
.lc-icon { font-size: 24px; }
.lc-body { display: flex; flex-direction: column; min-width: 0; }

/* пара кнопок озвучки: 🔊 и 🐢 не разъезжаются по строкам */
.speakpair {
  display: inline-flex; gap: 8px; align-items: center;
  vertical-align: middle; white-space: nowrap;
}
.speakpair > .btn { flex: 0 0 auto; white-space: nowrap; }

/* ------------------------------------------------------------------ урок
   Экран урока: тонкая полоса прогресса сверху, крупная карточка по центру
   и панель действий внизу — до неё дотягивается большой палец. */
.lsn { display: flex; flex-direction: column; min-height: calc(100dvh - 40px); }
.lsn-prog { height: 8px; border-radius: 99px; background: var(--panel2); overflow: hidden; }
.lsn-prog i {
  display: block; height: 100%; border-radius: 99px; background: var(--accent2);
  transition: width .45s cubic-bezier(.4, 1.3, .5, 1);
}
.lsn-head { display: flex; align-items: center; gap: 12px; margin: 12px 0 6px; }
.lsn-head .who { font-size: 12px; color: var(--dim); margin-left: auto; white-space: nowrap; }

/* сцена: меняется с лёгким наездом, чтобы шаг ощущался как шаг */
.lsn-body { flex: 1; animation: lsnIn .28s ease both; }
@keyframes lsnIn { from { opacity: 0; transform: translateY(10px); } }
.lsn-body.back { animation-name: lsnBack; }
@keyframes lsnBack { from { opacity: 0; transform: translateX(-14px); } }

/* картинка к слову; пока рисунка нет — место не занимает */
.lsn-art {
  width: 100%; aspect-ratio: 16 / 10; border-radius: var(--r); overflow: hidden;
  background: var(--panel2); display: grid; place-items: center; margin-bottom: 18px;
}
.lsn-art img, .lsn-art svg { width: 100%; height: 100%; object-fit: cover; display: block; }

/* слово крупно: пиньинь сверху, помета части речи, перевод снизу */
.wordcard { text-align: center; padding: 10px 0; }
.wordcard .py { color: var(--dim); font-size: 17px; letter-spacing: .04em; }
.wordcard .zh {
  font-family: var(--han); font-size: 56px; line-height: 1.25; margin: 2px 0 10px;
  word-break: break-word;
}
.pos {
  display: inline-block; padding: 4px 14px; border-radius: 99px;
  background: color-mix(in srgb, var(--accent2) 18%, transparent);
  color: var(--accent2); font-size: 13px; font-weight: 600;
}
.wordcard .ru { color: var(--dim); font-size: 17px; margin-top: 10px; }

/* варианты ответа: пиньинь мелко, иероглиф крупно */
.optgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.optcard {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 10px; text-align: center; min-width: 0;
  transition: transform .1s, border-color .15s, background .15s;
}
.optcard .py { color: var(--dim); font-size: 13px; display: block; }
.optcard .zh { font-family: var(--han); font-size: 26px; line-height: 1.3; word-break: break-word; }
/* перевод под вариантом — подсказка, а не сам вариант: тише и мельче */
.optcard .ru { display: block; color: var(--dim); font-size: 12px; margin-top: 3px; }
.optcard.wide { grid-column: 1 / -1; text-align: left; font-size: 15px; }
.optcard.ok   { border-color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent); }
.optcard.no   { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }

/* нижняя панель: круглая оранжевая кнопка «дальше» справа */
.lsn-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 22px; padding-bottom: env(safe-area-inset-bottom);
}
.rbtn {
  width: 52px; height: 52px; border-radius: 50%; flex: none;
  background: var(--panel2); border: none; display: grid; place-items: center; font-size: 19px;
}
.rbtn.go { width: 62px; height: 62px; background: var(--accent2); color: #221a06; font-size: 24px; }
.rbtn:disabled { opacity: .35; }

/* похвала после верного ответа */
.praise { text-align: center; margin-top: 14px; font-weight: 600; animation: pop .3s ease both; }
@keyframes pop { from { opacity: 0; transform: scale(.85); } }

/* ------------------------------------------------------------- ожидание
   Кисть дописывает черту, подпись сменяется. Блок появляется с задержкой:
   если раздел загрузился быстро, мигания не будет вовсе. */
.load {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 56px 0; color: var(--dim);
  opacity: 0; animation: loadIn .25s ease .18s forwards;
}
@keyframes loadIn { to { opacity: 1; } }

/* иероглиф пишется по чертам: каждая появляется по очереди */
.load-char { width: 96px; height: 96px; }
.load-char path {
  fill: var(--ink); opacity: 0;
  animation: strokeIn var(--dur) ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.28s);
}
@keyframes strokeIn {
  0%   { opacity: 0; transform: translateY(6px); }
  8%   { opacity: 1; transform: none; }
  72%  { opacity: 1; }
  86%, 100% { opacity: 0; }
}
.load-word { font-size: 14px; color: var(--dim); }
.load-word b { font-family: var(--han); font-size: 17px; color: var(--ink); }

/* три реплики по очереди: каждая живёт 2,2 с, круг — 6,6 с */
.load-lines { position: relative; height: 22px; width: 100%; text-align: center; }
.load-lines span {
  position: absolute; left: 0; right: 0; opacity: 0; font-size: 14px;
  animation: loadLine 6.6s ease-in-out infinite;
}
@keyframes loadLine {
  0%, 2%   { opacity: 0; transform: translateY(6px); }
  6%, 28%  { opacity: 1; transform: none; }
  33%, 100%{ opacity: 0; transform: translateY(-6px); }
}
@media (prefers-reduced-motion: reduce) {
  .load-brush path { animation: none; stroke-dashoffset: 0; }
  .load-lines span { animation: none; }
  .load-lines span:first-child { opacity: 1; }
}

/* Поле ввода иероглифов набирается крупно, но подсказка тем же кеглем
   не помещается в строку — её показываем мельче и приглушённо. */
.imefield input::placeholder {
  font-size: 14px; opacity: .75; color: var(--dim2);
}
.imefield input { width: 100%; min-width: 0; }

/* переключатели показа пиньиня и перевода в заданиях */
/* Переключатели показа — именно кнопки режимов: выключенные приглушены,
   включённые залиты цветом. Их видно как настройку, а не как вариант ответа. */
.showbar { display: flex; gap: 8px; justify-content: center; margin: 12px 0 4px; }
.showtog {
  width: 38px; height: 32px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 10px;
  background: transparent; color: var(--dim2); opacity: .7;
}
.showtog .sm-mark { font-family: var(--han); font-size: 15px; line-height: 1; }
.showtog.on {
  background: color-mix(in srgb, var(--accent2) 18%, transparent);
  border-color: var(--accent2); color: var(--accent2); opacity: 1;
}

/* разбор после ответа: иероглиф, чтение, перевод и озвучка */
.reveal {
  margin-top: 14px; padding: 14px; border-radius: var(--r);
  background: var(--panel); border: 1px solid var(--line); text-align: center;
  animation: pop .25s ease both;
}
.reveal .zh { font-family: var(--han); font-size: 34px; line-height: 1.2; }
.reveal .py { color: var(--accent2); font-size: 15px; margin-top: 2px; }
.reveal .ru { color: var(--dim); font-size: 15px; margin-top: 4px; }
.reveal .row { justify-content: center; margin-top: 10px; }

/* закрытая тема: видно, что она есть, но пройти пока нельзя */
.node.locked { opacity: .55; cursor: default; }
.node.locked .ring { background: var(--panel2); }

/* вопрос про напоминания: аккуратная карточка, а не системное окно врасплох */
.askpush { margin-bottom: 16px; border-color: var(--accent2); animation: lsnIn .3s ease both; }
.askpush .row { flex-wrap: wrap; }

/* слово в разборе фразы: чтение сверху, перевод снизу */
.tok {
  display: inline-flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel2); cursor: pointer; min-width: 0;
}
.tok .py { font-size: 11px; color: var(--accent2); }
.tok .zh { font-size: 22px; line-height: 1.2; }
.tok .ru { font-size: 11px; color: var(--dim); max-width: 120px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ значки */
.ic { flex: none; display: block; }
.btn .ic { margin-right: 0; }
.btn:has(.ic) { display: inline-flex; align-items: center; gap: 7px; }
.btn:has(.ic):not(:has(span)) { padding-left: 10px; padding-right: 10px; }
.ic path[fill="none"] { fill: none; }
/* залитые фигуры: динамик и треугольник воспроизведения */
.ic path:first-child { fill: currentColor; fill-opacity: .18; }

/* ---------------------------------------------------- кнопка записи голоса */
.recbtn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  gap: 9px; padding: 14px 22px; border: none; border-radius: 999px;
  background: var(--accent2); color: #221a06; font-size: 16px; font-weight: 600;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.recbtn .ic { width: 22px; height: 22px; }
.recbtn:disabled { opacity: .5; }
.recbtn.rec { background: var(--accent); color: #fff; }
/* пока идёт запись — расходящееся кольцо, как у голосового сообщения */
.recbtn.rec::after {
  content: ''; position: absolute; inset: -6px; border-radius: 999px;
  border: 2px solid var(--accent); animation: recPulse 1.1s ease-out infinite;
}
@keyframes recPulse {
  from { opacity: .7; transform: scale(1); }
  to   { opacity: 0;  transform: scale(1.25); }
}
.recbtn .wave {
  padding: 0; margin: 0; flex: none; width: 3px; min-width: 3px; border-radius: 2px; background: currentColor;
  height: 10px; align-self: center; animation: recLvl .6s ease-in-out infinite alternate;
}
.recbtn { gap: 4px; }
.recbtn > span:not(.wave) { margin-left: 5px; }
.recbtn .wave:nth-child(2) { animation-delay: .15s; }
.recbtn .wave:nth-child(3) { animation-delay: .3s; }
@keyframes recLvl { from { height: 7px; } to { height: 18px; } }

/* подпись под кнопкой записи — чтобы удержание не было секретом */
.rechint { font-size: 12px; color: var(--dim); text-align: center; margin-top: 6px; }

/* ------------------------------------------------------------------ бренд
   Одного квадрата с иероглифом мало: рядом должно стоять имя. На узком
   экране прячем только транскрипцию — сам знак 汉语 остаётся всегда. */
.brand { display: inline-flex; align-items: center; gap: 8px; color: inherit; }
.brandname { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.brandname b { font-family: var(--han); font-size: 17px; font-weight: 600; }
.brandname i {
  font-style: normal; font-size: 10px; color: var(--dim2);
  letter-spacing: .08em; text-transform: uppercase;
}
@media (max-width: 430px) { .brandname i { display: none; } }
@media (max-width: 360px) { .brandname { display: none; } }

.brandfull { margin-top: 12px; }
.brandfull b { font-family: var(--han); font-size: 26px; display: block; line-height: 1.1; }
.brandfull span { font-size: 12px; color: var(--dim); letter-spacing: .04em; }

/* --------------------------------------------------------------------- Мо
   Помощник нарисован тушью на бумаге — теми же цветами, что и всё остальное.
   Дышит, моргает и открывает рот, когда говорит. */
.mo { display: block; overflow: visible; }
.mo-drop { fill: var(--ink); }
.mo-tuft { fill: var(--accent); }
.mo-cheek { fill: var(--accent); opacity: .35; }
.mo-face { fill: var(--bg); stroke: var(--bg); stroke-width: 2.2;
           stroke-linecap: round; stroke-linejoin: round; }
.mo-face path[fill="none"] { fill: none; }

/* лёгкое покачивание: герой живой, но не мельтешит */
.mo-body { animation: moBob 3.4s ease-in-out infinite; transform-origin: 0 20px; }
@keyframes moBob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-3px) rotate(-1.5deg); }
}
/* моргание */
.mo-eyes { animation: moBlink 5.2s infinite; transform-origin: center; }
@keyframes moBlink {
  0%, 92%, 100% { transform: scaleY(1); }
  95%           { transform: scaleY(.12); }
}
/* пока говорит — рот шевелится */
.mo.talking .mo-mouth { animation: moTalk .22s ease-in-out 5 alternate; transform-origin: center; }
@keyframes moTalk { from { transform: scaleY(.7); } to { transform: scaleY(1.35); } }

@media (prefers-reduced-motion: reduce) {
  .mo-body, .mo-eyes, .mo.talking .mo-mouth { animation: none; }
}

/* реплика рядом с героем */
.mosay { display: flex; align-items: center; gap: 12px; }
.mobubble {
  position: relative; flex: 1; min-width: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 14px; font-size: 15px;
}
.mobubble::before {
  content: ''; position: absolute; left: -7px; top: 50%; margin-top: -6px;
  width: 12px; height: 12px; background: var(--panel);
  border-left: 1px solid var(--line); border-bottom: 1px solid var(--line);
  transform: rotate(45deg);
}
.mobubble.pop { animation: moPop .25s ease both; }
@keyframes moPop { from { opacity: 0; transform: translateX(-6px); } }

/* ------------------------------------------------- меню способов заниматься
   Второстепенное относительно пути: одной колонкой, компактно, без крупных
   плиток — чтобы не спорило с главным блоком. */
.menu { display: flex; flex-direction: column; gap: 2px; margin-bottom: 20px; }
.menu-item {
  display: flex; align-items: center; gap: 12px; color: inherit;
  padding: 11px 12px; border-radius: 12px; border: 1px solid transparent;
  transition: background .12s, border-color .12s;
}
.menu-item:active { background: var(--panel2); }
@media (hover: hover) { .menu-item:hover { background: var(--panel); border-color: var(--line); } }
.mi-han {
  font-family: var(--han); font-size: 20px; width: 38px; height: 38px; flex: none;
  display: grid; place-items: center; border-radius: 10px;
  background: var(--panel2); color: var(--dim);
}
.mi-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.mi-text b { font-size: 15px; font-weight: 600; }
.mi-text i {
  font-style: normal; font-size: 12px; color: var(--dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mi-badge {
  flex: none; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 600;
  display: grid; place-items: center;
}

/* ближайшая тема на главной — крупная карточка-цель */
.pathnext { display: block; color: inherit; margin-bottom: 14px; }
.pathnext b { display: block; font-size: 17px; margin: 2px 0 4px; }
.road-home { margin-bottom: 14px; }

/* ------------------------------------------------------------- награды */
.rankrow { padding: 7px 0; border-bottom: 1px solid var(--line); }
.rankrow:last-of-type { border-bottom: none; }
.rankrow.me { background: color-mix(in srgb, var(--accent2) 12%, transparent);
  margin: 0 -8px; padding: 7px 8px; border-radius: 8px; }
.rankplace {
  flex: none; width: 26px; height: 26px; border-radius: 999px; background: var(--panel2);
  display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--dim);
}
.rankrow:nth-of-type(1) .rankplace { background: var(--accent2); color: #221a06; }
.rankrow:nth-of-type(2) .rankplace { background: color-mix(in srgb, var(--accent2) 45%, var(--panel2)); }
.rankrow:nth-of-type(3) .rankplace { background: color-mix(in srgb, var(--accent2) 25%, var(--panel2)); }

.badges { display: flex; flex-direction: column; gap: 6px; }
.badge {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel); opacity: .55;
}
.badge.got { opacity: 1; border-color: var(--accent2); }
.bmark { font-size: 18px; color: var(--dim2); }
.badge.got .bmark { color: var(--accent2); }
.btext { display: flex; flex-direction: column; min-width: 0; }
.btext b { font-size: 14px; }
.btext i { font-style: normal; font-size: 12px; color: var(--dim); }


/* На случай, если браузер не умеет размытие: делаем фон плотным, чтобы текст
   под шапкой не просвечивал и не мешал читать. */
@supports not (backdrop-filter: blur(4px)) {
  .top { background: var(--panel); }
  .tabbar { background: var(--panel); }
}

/* варианты ответа: по умолчанию в две колонки, длинные тексты — в одну */
.optgrid.one { grid-template-columns: 1fr; }
.optcard.text { text-align: left; font-size: 14px; padding: 12px; line-height: 1.35; }

/* компактный разбор после ответа — помещается на экран без прокрутки */
.reveal.tight { padding: 10px 12px; margin-top: 10px; }
.reveal.tight .zh { font-family: var(--han); font-size: 26px; line-height: 1.1; }
.reveal.tight .py { color: var(--accent2); font-size: 14px; }
.reveal.tight .ru { color: var(--dim); font-size: 14px; }

/* всплывающая подсказка по иероглифу */
.tipbox {
  position: fixed; z-index: 60; max-width: 260px;
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 11px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line);
  box-shadow: 0 10px 26px -12px rgba(0, 0, 0, .5);
  pointer-events: none; animation: moPop .16s ease both;
}
.tipbox b { font-family: var(--han); font-size: 20px; line-height: 1.1; }
.tipbox .tp { color: var(--accent2); font-size: 12px; }
.tipbox .tg { color: var(--dim); font-size: 12px; }

/* блоки темы: закрытые видно, но нажать нельзя */
.menu-item.locked { opacity: .5; cursor: default; }
.blockpct {
  flex: none; font-size: 12px; font-weight: 600; color: var(--dim);
  min-width: 44px; text-align: right;
}
.blockpct.done { color: var(--good); }

/* диалог темы */
.dlg { display: flex; flex-direction: column; gap: 10px; }
.dlg-line { display: flex; }
.dlg-line.b { justify-content: flex-end; }
.dlg-bubble {
  max-width: 82%; padding: 10px 13px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line);
  transition: border-color .2s, transform .2s;
}
.dlg-line.b .dlg-bubble { background: color-mix(in srgb, var(--accent2) 12%, var(--panel)); }
.dlg-line.now .dlg-bubble { border-color: var(--accent2); transform: scale(1.02); }
.dlg-bubble .ru { margin-top: 4px; }

/* ------------------------------------------------------------- знакомство */
.hello { display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: calc(100dvh - 160px); text-align: center; }
.hello-stage { width: 100%; max-width: 420px; }
.hello .mosay { flex-direction: column; gap: 14px; align-items: center; }
.hello .mobubble { text-align: left; font-size: 16px; line-height: 1.5; }
.hello .mobubble::before {
  left: 50%; top: -7px; margin: 0 0 0 -6px;
  border-left: 1px solid var(--line); border-bottom: none;
  border-top: 1px solid var(--line); border-right: none;
}
.hello-dots { display: flex; gap: 6px; margin-top: 18px; }
.hello-dots i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--line);
  transition: background .2s, transform .2s;
}
.hello-dots i.on { background: var(--accent2); transform: scale(1.25); }

/* ------------------------------------------------------- колода слов темы */
.deck { display: flex; align-items: stretch; gap: 8px; }
.deck-nav {
  flex: none; width: 40px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel); color: var(--dim); display: grid; place-items: center;
}
.deck-nav:active { background: var(--panel2); }
.deck-card {
  flex: 1; min-width: 0; text-align: center; padding: 16px 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  touch-action: pan-y;
}
.deck-card.in-right { animation: deckRight .22s ease both; }
.deck-card.in-left { animation: deckLeft .22s ease both; }
@keyframes deckRight { from { opacity: 0; transform: translateX(26px); } }
@keyframes deckLeft { from { opacity: 0; transform: translateX(-26px); } }
.dc-count { font-size: 11px; color: var(--dim2); }
.dc-zh { font-size: 44px; line-height: 1.15; margin: 4px 0 2px; cursor: pointer; }
.dc-py { font-size: 15px; }
.dc-ru { color: var(--dim); font-size: 14px; margin-top: 4px; }
.deck-dots { display: flex; gap: 5px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.deck-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.deck-dots i.on { background: var(--accent2); }

/* кисть, которая ведёт черту: движение видно, направление тоже */
.w-live .w-start { animation: moPop .2s ease both; }

/* шапка занятия: прогресс точками и кнопки показа */
.cardtop {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 10px;
}
.cardtop .showbar { margin: 0; }
.ct-dots { display: flex; gap: 4px; flex-wrap: wrap; min-width: 0; }
.ct-dots i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--line); flex: none;
}
.ct-dots i.on { background: var(--accent2); }
.sm-mark.lat {
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 13px; font-weight: 600; letter-spacing: -.02em;
}

/* реакция Мо рядом с разбором ответа — маленькая и не мешает заданию */
.mo-react .mosay { gap: 8px; }
.mo-react .mobubble { padding: 6px 10px; font-size: 13px; }

/* переключатели показа в шапке занятия — прижаты вправо */
.lsn-head .showbar { margin: 0 0 0 auto; gap: 6px; }
.lsn-head .showtog { width: 32px; height: 28px; border-radius: 8px; }
.lsn-head .who { margin-left: 0; }

/* режим, недоступный в этом задании: видно, что он есть, но нажать нельзя */
.showtog.off {
  opacity: .3; border-style: dashed; cursor: not-allowed;
  position: relative;
}
.showtog.off::after {
  content: ''; position: absolute; left: 6px; right: 6px; top: 50%;
  height: 1px; background: currentColor; transform: rotate(-18deg);
}

/* подсветка вариантов в карточках — теми же цветами, что и в уроке */
.btn[data-opt].ok { border-color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent); }
.btn[data-opt].no { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }

/* ------------------------------------------------------------- флажки
   У полей ввода отключён системный вид, и флажки превращались в пустые
   прямоугольники: непонятно ни что это, ни включено ли оно. Рисуем сами. */
input[type="checkbox"], input[type="radio"] {
  width: 20px; height: 20px; min-width: 20px; padding: 0; flex: none;
  border: 1.5px solid var(--dim2); border-radius: 6px;
  background: var(--panel); display: inline-grid; place-content: center;
  cursor: pointer; transition: background .15s, border-color .15s;
}
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]::before {
  content: ''; width: 11px; height: 11px; transform: scale(0);
  transition: transform .12s ease-in-out;
  background: var(--panel);
  clip-path: polygon(14% 44%, 0 60%, 40% 100%, 100% 18%, 84% 4%, 38% 66%);
}
input[type="radio"]::before {
  content: ''; width: 9px; height: 9px; border-radius: 50%;
  transform: scale(0); transition: transform .12s; background: var(--panel);
}
input[type="checkbox"]:checked, input[type="radio"]:checked {
  background: var(--accent2); border-color: var(--accent2);
}
input[type="checkbox"]:checked::before, input[type="radio"]:checked::before { transform: scale(1); }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible {
  outline: 2px solid var(--accent2); outline-offset: 2px;
}

/* ------------------------------------------------- переключатель-тумблер
   Для настроек «включено / выключено» тумблер понятнее флажка: видно
   состояние с одного взгляда. */
.switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; margin: 10px 0; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  flex: none; width: 46px; height: 27px; border-radius: 999px; margin-top: 1px;
  background: var(--panel2); border: 1px solid var(--line); position: relative;
  transition: background .18s, border-color .18s;
}
.switch .track::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 21px; height: 21px;
  border-radius: 50%; background: var(--dim2);
  transition: transform .18s cubic-bezier(.3,1.4,.5,1), background .18s;
}
.switch input:checked + .track { background: var(--accent2); border-color: var(--accent2); }
.switch input:checked + .track::after { transform: translateX(19px); background: #fff; }
.switch input:focus-visible + .track { outline: 2px solid var(--accent2); outline-offset: 2px; }
.switch .sw-text { display: flex; flex-direction: column; min-width: 0; }
.switch .sw-text b { font-size: 14px; font-weight: 600; }
.switch .sw-text i { font-style: normal; font-size: 12px; color: var(--dim); }

/* Мо подписан: имя видно всем, а не только на первом знакомстве */
.mofig { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: none; }
.moname {
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--dim); line-height: 1;
}

/* Правила уровня: те же строки-пункты, что и части урока, а не список ссылок.
   Раньше синие подчёркнутые заголовки прыгали в одну-две строки, и по ним
   нельзя было понять, что начато, а что нет. */
.rules { gap: 4px; }
.rule-item { border: 1px solid var(--line); background: var(--panel); align-items: flex-start; }
.rule-item .mi-text b {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rule-item .mi-han.going { background: color-mix(in srgb, var(--accent2) 22%, transparent); color: var(--accent2); }
.rule-item .mi-han.done  { background: color-mix(in srgb, var(--good) 20%, transparent); color: var(--good); }
.rule-bar { height: 4px; margin-top: 6px; width: 100%; }
.rule-pct {
  flex: none; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--dim);
  min-width: 42px; text-align: right; padding-top: 2px;
}
.rule-pct.ok { color: var(--good); }
