@font-face { font-family: "Golos"; src: url("../fonts/Golos-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Golos"; src: url("../fonts/Golos-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Golos"; src: url("../fonts/Golos-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Golos"; src: url("../fonts/Golos-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Literata"; src: url("../fonts/Literata-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Literata"; src: url("../fonts/Literata-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --bg: #F4F7F5;
  --surface: #FFFFFF;
  --sunken: #EBF0ED;
  --ink: #18211D;
  --ink-2: #4A5650;
  --ink-3: #7F8B85;
  --line: #DCE3DE;
  --line-2: #EBF0EC;
  --jade: #2B6B5A;
  --jade-ink: #1E4D40;
  --jade-soft: #DDEBE4;
  --jade-wash: #EEF5F1;
  --seal: #B23A2E;
  --seal-soft: #F6E1DD;
  --amber: #9A6B12;
  --amber-soft: #F5E9CC;
  --on-jade: #FFFFFF;
  --shadow: 0 1px 2px rgba(24, 33, 29, .06), 0 8px 24px -12px rgba(24, 33, 29, .18);
  --shadow-pop: 0 20px 60px -20px rgba(24, 33, 29, .45);
  --r-s: 6px; --r-m: 10px; --r-l: 16px;
  --sans: "Golos", system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --serif: "Literata", "Noto Serif CJK SC", "Songti SC", "Noto Serif SC", Georgia, serif;
  --han: "Noto Serif CJK SC", "Songti SC", "Noto Serif SC", "STSong", "SimSun", serif;
  --side: 232px;
  --tab-h: 58px;
}
html[data-theme="dark"] {
  --bg: #111614;
  --surface: #1A211E;
  --sunken: #151B18;
  --ink: #E9EEEB;
  --ink-2: #B4BFB9;
  --ink-3: #7F8B85;
  --line: #2C3632;
  --line-2: #232C28;
  --jade: #63B79C;
  --jade-ink: #A9DCCB;
  --jade-soft: #1F3A32;
  --jade-wash: #18261F;
  --seal: #E0685A;
  --seal-soft: #3A211D;
  --amber: #D9A840;
  --amber-soft: #3A2F16;
  --on-jade: #0E1512;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-pop: 0 20px 60px -10px rgba(0, 0, 0, .7);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 15px; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); line-height: 1.45; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--jade); text-decoration: none; }
h1, h2, h3, p { margin: 0; }
.han { font-family: var(--han); }
:focus-visible { outline: 2px solid var(--jade); outline-offset: 2px; border-radius: 4px; }
.boot { padding: 40vh 0; text-align: center; color: var(--ink-3); }

/* ---------- каркас ---------- */
.shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.side { width: var(--side); flex: none; padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--surface); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; }
.seal { width: 36px; height: 36px; flex: none; border-radius: 8px; background: var(--seal); color: #fff; display: grid; place-items: center; font-family: var(--han); font-weight: 700; font-size: 21px; line-height: 1; }
html[data-theme="dark"] .seal { background: #B23A2E; }
.brand b { display: block; font-family: var(--serif); font-weight: 600; font-size: 17px; line-height: 1.15; }
.brand span { font-size: 12px; color: var(--ink-3); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: var(--r-m); color: var(--ink-2); font-weight: 500; }
.nav a svg { width: 19px; height: 19px; flex: none; }
.nav a:hover { background: var(--sunken); color: var(--ink); }
.nav a.on { background: var(--jade-soft); color: var(--jade-ink); }
.nav .badge { margin-left: auto; }
.side-foot { margin-top: auto; padding: 8px; font-size: 12px; color: var(--ink-3); }
.main { flex: 1; min-width: 0; padding: 28px 32px 60px; }
.page { max-width: 1160px; margin: 0 auto; }
.tabbar { display: none; }

.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.head h1 { font-family: var(--serif); font-weight: 600; font-size: 30px; line-height: 1.12; letter-spacing: -.01em; }
.head .sub { color: var(--ink-2); margin-top: 5px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
h2 { font-family: var(--serif); font-weight: 600; font-size: 18px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 10px; }
.sec-head .hint { color: var(--ink-3); font-size: 13px; }
.stack > * + * { margin-top: 26px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.neg { color: var(--seal); }
.pos { color: var(--jade); }
.nowrap { white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }
.empty { padding: 26px 18px; text-align: center; color: var(--ink-3); border: 1px dashed var(--line); border-radius: var(--r-l); }
.empty b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 4px; }
.empty .btn { margin-top: 12px; }

/* ---------- кнопки и поля ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: var(--r-m); border: 1px solid var(--line); background: var(--surface); font-weight: 500; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--jade); border-color: var(--jade); color: var(--on-jade); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--sunken); }
.btn.danger { color: var(--seal); }
.btn.sm { height: 31px; padding: 0 10px; font-size: 13px; border-radius: var(--r-s); }
.btn.icon { width: 38px; padding: 0; }
.btn.sm.icon { width: 31px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.block { width: 100%; }

.field { display: block; margin-bottom: 14px; }
.field > span, .label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 5px; font-weight: 500; }
.field .help { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.input, select.input, textarea.input { width: 100%; height: 40px; padding: 0 11px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); outline: none; }
textarea.input { height: auto; min-height: 76px; padding: 9px 11px; resize: vertical; line-height: 1.45; }
.input:focus { border-color: var(--jade); box-shadow: 0 0 0 3px var(--jade-soft); }
.input::placeholder { color: var(--ink-3); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: flex-start; gap: 9px; margin: 10px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--jade); flex: none; }
.check small { display: block; color: var(--ink-3); }

.seg { display: flex; background: var(--sunken); border-radius: var(--r-m); padding: 3px; gap: 2px; }
.seg button { flex: 1; height: 34px; border: 0; background: transparent; border-radius: 8px; font-weight: 500; color: var(--ink-2); font-size: 14px; white-space: nowrap; padding: 0 8px; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.seg button.on[data-v="done"] { color: var(--jade-ink); }
.seg button.on[data-v="missed"], .seg button.on[data-v="cancelled"] { color: var(--seal); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 34px; min-width: 38px; padding: 0 12px; border-radius: 17px; border: 1px solid var(--line); background: var(--surface); font-weight: 500; font-size: 14px; }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip.grade { width: 42px; padding: 0; font-weight: 600; }
.chip.grade.on[data-v="5"], .chip.grade.on[data-v="4"] { background: var(--jade); border-color: var(--jade); color: var(--on-jade); }
.chip.grade.on[data-v="3"] { background: var(--amber); border-color: var(--amber); color: #fff; }
.chip.grade.on[data-v="2"], .chip.grade.on[data-v="1"] { background: var(--seal); border-color: var(--seal); color: #fff; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 0; padding: 0; position: relative; }
.swatch.on::after { content: ""; position: absolute; inset: -4px; border: 2px solid var(--ink); border-radius: 50%; }

.tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; font-weight: 500; background: var(--sunken); color: var(--ink-2); white-space: nowrap; }
.tag.ok { background: var(--jade-soft); color: var(--jade-ink); }
.tag.bad { background: var(--seal-soft); color: var(--seal); }
.tag.warn { background: var(--amber-soft); color: var(--amber); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--seal); color: #fff; font-size: 12px; font-weight: 600; display: inline-grid; place-items: center; }
.g { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; font-weight: 600; font-size: 14px; background: var(--sunken); }
.g5, .g4 { background: var(--jade-soft); color: var(--jade-ink); }
.g3 { background: var(--amber-soft); color: var(--amber); }
.g2, .g1 { background: var(--seal-soft); color: var(--seal); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.ava { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font-family: var(--serif); font-weight: 600; font-size: 17px; }
.ava.lg { width: 56px; height: 56px; font-size: 24px; }

/* ---------- панели, списки ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); }
.panel.pad { padding: 18px; }
.list > * + * { border-top: 1px solid var(--line-2); }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; width: 100%; text-align: left; background: none; border: 0; }
button.item:hover, a.item:hover { background: var(--jade-wash); }
.list > .item:first-child { border-radius: var(--r-l) var(--r-l) 0 0; }
.list > .item:last-child { border-radius: 0 0 var(--r-l) var(--r-l); }
.list > .item:only-child { border-radius: var(--r-l); }
.item .grow { flex: 1; min-width: 0; }
.item .t, .item .s { display: block; }
.item .t { font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .s { font-size: 13px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .time { width: 54px; flex: none; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.item .time small { display: block; font-weight: 400; color: var(--ink-3); font-size: 12px; }
.item .bar { width: 4px; align-self: stretch; border-radius: 2px; flex: none; }
.item.past { opacity: .62; }
.item .acts { display: flex; gap: 6px; flex: none; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); }
.tile { padding: 15px 16px; min-width: 0; }
.tile + .tile { border-left: 1px solid var(--line-2); }
.tile .v { font-size: 25px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tile .v small { font-size: 14px; font-weight: 500; color: var(--ink-3); }
.tile .l { font-size: 13px; color: var(--ink-2); margin-top: 3px; }
.tiles.c5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.tiles.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tiles.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.weekbars { display: flex; align-items: flex-end; gap: 8px; height: 92px; padding-top: 6px; }
.weekbars .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 5px; height: 100%; font-size: 12px; color: var(--ink-3); }
.weekbars .b { width: 100%; max-width: 30px; border-radius: 5px 5px 2px 2px; background: var(--jade-soft); min-height: 3px; }
.weekbars .col.today .b { background: var(--jade); }
.weekbars .col.today { color: var(--ink); font-weight: 600; }
.weekbars .n { font-size: 12px; color: var(--ink-2); font-weight: 500; }

/* ---------- календарь ---------- */
.cal-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-bar .title { font-family: var(--serif); font-weight: 600; font-size: 20px; margin: 0 8px; }
.cal-bar .sp { flex: 1; }
.cal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; }
.cal-days { display: grid; grid-template-columns: 52px repeat(var(--cols), minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.cal-day { padding: 9px 6px 8px; text-align: center; font-size: 13px; color: var(--ink-2); border-left: 1px solid var(--line-2); background: none; border-top: 0; border-right: 0; border-bottom: 0; }
.cal-day b { display: block; font-size: 19px; font-weight: 600; color: var(--ink); line-height: 1.25; font-variant-numeric: tabular-nums; }
.cal-day.today b { color: var(--on-jade); background: var(--jade); width: 32px; border-radius: 16px; margin: 0 auto; }
.cal-day .cnt { font-size: 11px; color: var(--ink-3); height: 14px; }
.cal-scroll { max-height: calc(100vh - 260px); min-height: 380px; overflow-y: auto; position: relative; }
.cal-grid { display: grid; grid-template-columns: 52px repeat(var(--cols), minmax(0, 1fr)); position: relative; }
.cal-hours div { height: 60px; font-size: 12px; color: var(--ink-3); text-align: right; padding-right: 8px; transform: translateY(-8px); font-variant-numeric: tabular-nums; }
.cal-hours div:first-child { visibility: hidden; }
.cal-col { position: relative; border-left: 1px solid var(--line-2); background-image: linear-gradient(to bottom, var(--line-2) 1px, transparent 1px); background-size: 100% 60px; cursor: copy; }
.cal-col.today { background-color: var(--jade-wash); }
.ev { position: absolute; left: 3px; right: 3px; border-radius: 7px; padding: 4px 7px 4px 9px; overflow: hidden; border: 0; text-align: left; cursor: pointer; background: color-mix(in srgb, var(--c) 15%, var(--surface)); color: var(--ink); box-shadow: inset 3px 0 0 var(--c); font-size: 13px; line-height: 1.25; }
.ev:hover { background: color-mix(in srgb, var(--c) 24%, var(--surface)); z-index: 3; }
.ev b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev span { display: block; font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.ev.done { background: var(--sunken); box-shadow: inset 3px 0 0 color-mix(in srgb, var(--c) 55%, var(--surface)); }
.ev.done b { color: var(--ink-2); }
.ev.cancelled { background: transparent; box-shadow: inset 3px 0 0 var(--line); border: 1px dashed var(--line); }
.ev.cancelled b { text-decoration: line-through; color: var(--ink-3); font-weight: 500; }
.ev.missed { box-shadow: inset 3px 0 0 var(--seal); background: var(--seal-soft); }
.ev .mark { position: absolute; right: 5px; top: 4px; font-size: 11px; color: var(--ink-2); }
.ev.overdue::after { content: ""; position: absolute; right: 6px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--seal); }
.nowline { position: absolute; left: 0; right: 0; height: 2px; background: var(--seal); z-index: 2; pointer-events: none; }
.nowline::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--seal); }

/* ---------- ученики ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .input { max-width: 280px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.scard { display: block; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); color: inherit; text-align: left; transition: border-color .12s, box-shadow .12s; }
.scard:hover { border-color: var(--ink-3); box-shadow: var(--shadow); }
.scard .top { display: flex; gap: 12px; align-items: center; }
.scard .name { font-family: var(--serif); font-weight: 600; font-size: 17px; line-height: 1.2; }
.scard .meta { font-size: 13px; color: var(--ink-2); margin-top: 1px; }
.scard dl { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line-2); }
.scard dt { font-size: 12px; color: var(--ink-3); }
.scard dd { margin: 2px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.scard .next { margin-top: 10px; font-size: 13px; color: var(--ink-2); display: flex; gap: 6px; align-items: center; }
.scard .next svg { width: 15px; height: 15px; color: var(--ink-3); }
.scard.off { opacity: .6; }

.shead { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.shead h1 { font-family: var(--serif); font-weight: 600; font-size: 28px; line-height: 1.12; }
.shead .meta { color: var(--ink-2); margin-top: 3px; }
.shead .grow { flex: 1; min-width: 200px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); font-size: 14px; margin-bottom: 14px; }
.back svg { width: 16px; height: 16px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 9px 13px 11px; color: var(--ink-2); font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--jade); }
.tabs a .n { color: var(--ink-3); font-weight: 400; margin-left: 3px; }

.skill { display: grid; grid-template-columns: 120px 1fr 38px 44px; align-items: center; gap: 10px; padding: 7px 0; }
.skill .track { height: 8px; border-radius: 4px; background: var(--sunken); position: relative; }
.skill .fill { height: 8px; border-radius: 4px; background: var(--jade); }
.skill .prev { position: absolute; top: -3px; width: 2px; height: 14px; background: var(--ink-3); border-radius: 1px; }
.skill .val { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.skill .delta { font-size: 13px; text-align: right; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.skill .delta.up { color: var(--jade); }
.skill .delta.down { color: var(--seal); }
.range { display: grid; grid-template-columns: 120px 1fr 40px; align-items: center; gap: 12px; padding: 6px 0; }
.range input { width: 100%; accent-color: var(--jade); }
.range output { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.chart svg { display: block; width: 100%; height: auto; }

.words { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.word { display: flex; gap: 8px; align-items: center; padding: 9px 8px 9px 12px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); }
.word .w { font-family: var(--han); font-size: 20px; line-height: 1.2; }
.word .r { font-size: 12px; color: var(--jade); }
.word .tr { font-size: 13px; color: var(--ink-2); }
.word .grow { flex: 1; min-width: 0; }
.word.learned { background: var(--jade-wash); border-color: var(--jade-soft); }
.invite { display: flex; gap: 8px; }
.invite .input { font-size: 13px; font-family: ui-monospace, monospace; }
.balance-big { font-size: 34px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-weight: 500; font-size: 13px; color: var(--ink-3); padding: 0 12px 8px 0; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl td:last-child, .tbl th:last-child { padding-right: 0; text-align: right; }
.tbl tr:last-child td { border-bottom: 0; }

/* ---------- слои ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 22, 19, .45); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 24px; animation: fade .15s ease-out; }
.sheet { background: var(--surface); border-radius: var(--r-l); width: 100%; max-width: 520px; max-height: calc(100dvh - 48px); display: flex; flex-direction: column; box-shadow: var(--shadow-pop); animation: pop .18s ease-out; }
.sheet.wide { max-width: 640px; }
.sheet.narrow { max-width: 400px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 12px 20px; }
.sheet-head h2 { font-size: 20px; }
.sheet-body { padding: 4px 20px 16px; overflow-y: auto; flex: 1; }
.sheet-foot { display: flex; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--line-2); align-items: center; }
.sheet-foot .sp { flex: 1; }
.note { padding: 10px 12px; border-radius: var(--r-m); background: var(--jade-wash); color: var(--ink-2); font-size: 13px; margin-bottom: 14px; }
.note.warn { background: var(--amber-soft); color: var(--ink); }
.subbox { padding: 12px 14px 2px; border: 1px solid var(--line); border-radius: var(--r-m); margin-bottom: 14px; }
.prevhw { white-space: pre-line; font-size: 14px; margin-bottom: 9px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.985); } }
@keyframes up { from { transform: translateY(100%); } }

#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 22px; font-size: 14px; box-shadow: var(--shadow-pop); animation: pop .18s ease-out; max-width: 100%; }
.toast.err { background: var(--seal); color: #fff; }

.login { max-width: 380px; margin: 12vh auto 0; padding: 0 20px; text-align: center; }
.login .seal { width: 60px; height: 60px; font-size: 36px; border-radius: 13px; margin: 0 auto 18px; }
.login h1 { font-family: var(--serif); font-size: 26px; font-weight: 600; }
.login p { color: var(--ink-2); margin: 10px 0 20px; }
.login ol { text-align: left; color: var(--ink-2); padding-left: 20px; margin: 0 0 20px; }
.login ol li { margin-bottom: 6px; }
.demo-bar { background: var(--ink); color: var(--bg); text-align: center; font-size: 13px; padding: 6px 12px; }

/* ---------- телефон ---------- */
@media (max-width: 860px) {
  html { font-size: 16px; }
  .side { display: none; }
  .main { padding: 18px 14px calc(var(--tab-h) + 30px + env(safe-area-inset-bottom)); }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { flex: 1; height: var(--tab-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: var(--ink-3); font-weight: 500; position: relative; }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a.on { color: var(--jade); }
  .tabbar .badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 17px; height: 17px; font-size: 11px; }
  .head { margin-bottom: 16px; }
  .head h1 { font-size: 25px; }
  .shead h1 { font-size: 23px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .item.wrap { flex-wrap: wrap; }
  .item.wrap .grow { flex-basis: 100%; }
  .tiles, .tiles.c5 { grid-template-columns: 1fr 1fr; }
  .tiles .tile { border-left: 0; border-top: 1px solid var(--line-2); }
  .tiles .tile:nth-child(-n+2) { border-top: 0; }
  .tiles .tile:nth-child(even) { border-left: 1px solid var(--line-2); }
  .tiles.c5 .tile:last-child { grid-column: span 2; }
  .tiles.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tiles.c3 .tile { border-top: 0; padding: 12px 10px; }
  .tiles.c3 .tile + .tile { border-left: 1px solid var(--line-2); }
  .tiles.c3 .tile .v { font-size: 19px; }
  .tile .v { font-size: 22px; }
  .overlay { padding: 0; align-items: flex-end; }
  .sheet, .sheet.wide, .sheet.narrow { max-width: none; border-radius: 18px 18px 0 0; max-height: 94dvh; animation: up .22s cubic-bezier(.2, .8, .2, 1); padding-bottom: env(safe-area-inset-bottom); }
  .sheet.center { border-radius: var(--r-l); margin: 0 16px; align-self: center; max-width: 420px; animation: pop .18s ease-out; padding-bottom: 0; }
  .overlay:has(.sheet.center) { align-items: center; }
  .cards { grid-template-columns: 1fr; }
  .cal-scroll { max-height: calc(100dvh - 300px); }
  .cal-day { padding: 7px 2px; font-size: 12px; }
  .cal-day b { font-size: 17px; }
  .cal-day.sel:not(.today) b { background: var(--ink); color: var(--bg); width: 32px; border-radius: 16px; margin: 0 auto; }
  .cal-days { grid-template-columns: repeat(7, 1fr); }
  .cal-days .gutter { display: none; }
  .cal-bar .title { font-size: 18px; margin: 0 4px; }
  .skill { grid-template-columns: 104px 1fr 34px 38px; }
  .range { grid-template-columns: 104px 1fr 36px; }
  .item { padding: 12px 14px; }
  .toolbar .input { max-width: none; flex: 1 1 100%; }
  #toasts { bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom)); }
  .hide-m { display: none !important; }
  .row-3 { grid-template-columns: 1fr 1fr; }
  .row-3 > :first-child { grid-column: span 2; }
  .words { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 861px) { .hide-d { display: none !important; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- v1.1: журнал, общий словарь, прогресс ---------- */
.item .s.wrap { white-space: normal; }
.item .t .tag { margin-left: 4px; vertical-align: 1px; }
.mat { color: var(--jade-ink); background: var(--jade-wash); border-radius: 4px; padding: 0 5px; white-space: nowrap; }
.pbar { width: 70px; height: 6px; border-radius: 3px; background: var(--sunken); flex: none; display: block; }
.pbar i { display: block; height: 6px; border-radius: 3px; background: var(--jade); }
.pbar.low i { background: var(--seal); }
.skcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.skcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 12px 14px; }
.skcard .l { font-size: 13px; color: var(--ink-2); }
.skcard .v { font-size: 24px; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.skcard .v small { font-size: 13px; font-weight: 500; color: var(--ink-3); }
.skcard .v span { font-size: 13px; font-weight: 500; margin-left: 8px; }
.skcard .s { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.word .lv { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.rname { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.rname input { width: 16px; height: 16px; accent-color: var(--jade); flex: none; margin: 0; }
.range input:disabled { opacity: .35; }
.toolbar select.input { max-width: 240px; }
@media (max-width: 860px) {
  .toolbar select.input { max-width: none; flex: 1 1 100%; }
  .skcards { grid-template-columns: 1fr 1fr; }
  .pbar { width: 48px; }
}
.range { grid-template-columns: 142px 1fr 40px; }
@media (max-width: 860px) { .range { grid-template-columns: 128px 1fr 36px; } }
a.item { color: var(--ink); }
.pbar.low + b { color: var(--seal); }
.word .w, .word .tr { overflow-wrap: anywhere; }
@media (max-width: 860px) { .words { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- v1.3: редактирование ---------- */
.wbtn { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.wbtn > span { display: block; }
.wbtn:hover .w { color: var(--jade-ink); }
.item .btn.icon + .btn.icon { margin-left: -4px; }
@media (max-width: 860px) { .item.wrap .ava + .grow { flex-basis: calc(100% - 56px); } }
