:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #f0efea;
  --text: #1c1c1f;
  --muted: #6a6a72;
  --border: #e2e0d8;
  --accent: #2457c5;
  --accent-text: #ffffff;
  --accent-soft: #e7eefc;
  --ok: #1d7f46;
  --ok-bg: #e4f3e9;
  --warn: #9a5b00;
  --warn-bg: #fff1d6;
  --bad: #bf3129;
  --bad-bg: #fde7e5;
  --neutral: #55606f;
  --neutral-bg: #eceff3;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .05);
  --radius: 14px;
  /* knowledge colour (.k): lightness and chroma of the text/bar colour and of the tint */
  --k-l: .55; --k-c: .16; --k-bg-l: .95; --k-bg-c: .05;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121316;
    --surface: #1b1d22;
    --surface-2: #23262c;
    --text: #e9e9ec;
    --muted: #9b9ca4;
    --border: #2e3138;
    --accent: #6f9bff;
    --accent-text: #0d1424;
    --accent-soft: #1d2a47;
    --ok: #57c886;
    --ok-bg: #16301f;
    --warn: #f1b54f;
    --warn-bg: #352812;
    --bad: #ff7d72;
    --bad-bg: #3b1a18;
    --neutral: #aab3c0;
    --neutral-bg: #262a31;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    --k-l: .78; --k-c: .15; --k-bg-l: .31; --k-bg-c: .06;
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font: inherit; color: inherit; }

.topbar {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { font-weight: 650; color: var(--text); font-size: 17px; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px; margin-right: 6px;
  border-radius: 7px; background: var(--accent); color: var(--accent-text);
  font-size: 16px; vertical-align: -3px;
}
.topbar-user { margin-left: auto; display: flex; gap: 12px; align-items: baseline; font-size: 14px; }
.user-name { color: var(--muted); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- sign-in ---------- */
.login { max-width: 560px; margin: 40px auto 0; }
.login .lead { margin-bottom: 18px; }
.dev-login { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); }
.dev-login-label { font-size: 14px; color: var(--muted); }
.dev-login .actions { margin-top: 8px; }
.dev-name {
  font: inherit; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); color: var(--text); width: 180px;
}

/* ---------- how well something is known: red (0 %) → amber → green (100 %), grey when not started ---------- */
.k {
  --kh: 25;
  --k-fg: oklch(var(--k-l) var(--k-c) var(--kh));
  --k-bg: oklch(var(--k-bg-l) var(--k-bg-c) var(--kh));
}
.k-none { --k-fg: var(--muted); --k-bg: var(--surface-2); }
.kbadge {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 13px; font-weight: 700;
  color: var(--k-fg); background: var(--k-bg); border: 1px solid var(--k-fg); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.kbar { display: block; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.kbar > span { display: block; height: 100%; background: var(--k-fg); border-radius: 3px; }
.overall { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 0 0 6px; }
.overall .kbadge { font-size: 16px; padding: 2px 10px; }
.note { color: var(--muted); font-size: 13.5px; margin: 0 0 18px; max-width: 680px; }

.page { max-width: 920px; margin: 0 auto; padding: 28px 20px 80px; }

h1 { font-size: 28px; line-height: 1.2; margin: 0 0 8px; letter-spacing: -.01em; }
h2 { font-size: 21px; margin: 28px 0 10px; }
h3 { font-size: 17px; margin: 22px 0 8px; }
.lead { color: var(--muted); margin: 0 0 24px; max-width: 680px; }
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 14px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); background: var(--surface);
  padding: 9px 16px; border-radius: 10px; cursor: pointer;
  font-weight: 550; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-link { border: none; background: none; color: var(--accent); padding: 4px 0; cursor: pointer; font-weight: 500; }
.btn-link:hover { text-decoration: underline; }
.btn:disabled { opacity: .5; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 18px; }
.retry-note { color: var(--bad); font-size: 14px; font-weight: 550; }
kbd {
  font-family: var(--font); font-size: 12px; padding: 1px 6px; border-radius: 5px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
}

/* ---------- level list ---------- */
.levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.level-card {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; color: var(--text); box-shadow: var(--shadow);
  transition: transform .12s, border-color .12s;
}
.level-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.level-main { display: flex; flex-direction: column; gap: 6px; flex: 1; color: var(--text); }
.level-main:hover { text-decoration: none; }
.level-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.level-card > .kbar { margin-top: 4px; }
.vcells { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; margin-top: 6px; }
.vcell {
  display: flex; flex-direction: column; align-items: center; line-height: 1.15; padding: 4px 0 3px;
  border-radius: 8px; border: 1px solid var(--k-fg); background: var(--k-bg); color: var(--k-fg);
  font-variant-numeric: tabular-nums;
}
.vcell.k-none { border-color: var(--border); }
.vcell b { font-size: 11px; font-weight: 600; opacity: .8; }
.vcell span { font-size: 12.5px; font-weight: 700; }
.vcell:hover { text-decoration: none; filter: brightness(.96); }
.vcell.current { outline: 2px solid var(--accent); outline-offset: 1px; }
.level-num { font-size: 12.5px; font-weight: 650; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }
.level-title { font-weight: 650; font-size: 17px; line-height: 1.3; }
.level-sub { color: var(--muted); font-size: 13.5px; line-height: 1.4; flex: 1; }
.empty { padding: 24px; border: 1px dashed var(--border); border-radius: var(--radius); color: var(--muted); }

/* ---------- variant switcher ---------- */
.variants { margin: 0 0 16px; }
.variants-label { font-size: 13px; color: var(--muted); margin-bottom: 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.vtabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.vtab {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: var(--text);
  transition: border-color .12s;
}
.vtab:hover { text-decoration: none; border-color: var(--accent); }
.vtab.active { border: 2px solid var(--accent); padding: 9px 11px; background: var(--accent-soft); }
.vtab-name { font-weight: 650; font-size: 15px; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.vtab .kbar { margin-top: 4px; height: 5px; }
.vtab-theme { font-size: 13px; color: var(--muted); line-height: 1.35; flex: 1; }
.vtab-progress { font-size: 12.5px; color: var(--muted); }

/* ---------- cheatsheet ---------- */
.sheet {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 28px 24px; box-shadow: var(--shadow);
}
.sheet h1 { margin-top: 18px; }
.sheet h2 { border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.sheet ul, .sheet ol { padding-left: 22px; }
.sheet li { margin: 3px 0; }
.sheet code, .md code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: .92em; }
.sheet blockquote, .md blockquote {
  margin: 14px 0; padding: 4px 16px; border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 10px 10px 0;
}
.table-wrap { overflow-x: auto; margin: 12px 0; }
table { border-collapse: collapse; min-width: 50%; font-size: 15px; }
th, td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; vertical-align: top; }
th { background: var(--surface-2); font-weight: 600; }
hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

.words { margin-top: 26px; }
.tabs { display: inline-flex; gap: 4px; padding: 3px; border-radius: 10px; background: var(--surface-2); margin-bottom: 12px; }
.tab { border: none; background: none; padding: 6px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 550; }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.word-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 0 18px; }
.word-row { display: flex; gap: 10px; padding: 6px 2px; border-bottom: 1px solid var(--border); font-size: 15px; }
.word-row .gr { font-weight: 600; min-width: 45%; }
.word-row .ru { color: var(--muted); }

/* ---------- exercise ---------- */
.ex-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-bottom: 14px; }
.ex-head .count { color: var(--muted); font-size: 14px; margin-left: auto; display: flex; gap: 8px; align-items: center; }
.dots { display: flex; flex-wrap: wrap; gap: 5px; }
.dot {
  width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface); font-size: 11px; color: var(--muted); cursor: pointer;
  display: grid; place-items: center; padding: 0;
}
.dot.correct { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.dot.wrong { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.dot.current { outline: 2px solid var(--accent); outline-offset: 1px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: var(--shadow);
}
.prompt-label { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.prompt { font-size: 24px; font-weight: 600; line-height: 1.35; margin: 6px 0 4px; }
.hint { margin: 8px 0 0; padding: 8px 12px; background: var(--accent-soft); border-radius: 10px; font-size: 15px; }
.answer {
  width: 100%; margin-top: 16px; padding: 12px 14px; font-size: 22px; font-family: var(--font);
  border: 2px solid var(--border); border-radius: 12px; background: var(--bg); color: var(--text); outline: none;
}
.answer:focus { border-color: var(--accent); }
.answer[readonly] { background: var(--surface-2); }
.tools { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin-top: 10px; font-size: 14px; color: var(--muted); }
.tools label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.osk { margin-top: 10px; display: flex; flex-direction: column; gap: 5px; align-items: center; }
.osk-row { display: flex; gap: 5px; }
.osk-key {
  min-width: 38px; height: 40px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); cursor: pointer; font-size: 18px;
}
.osk-key:hover { border-color: var(--accent); }
.osk-special { color: var(--accent); font-weight: 600; }
.osk-space { width: 260px; font-size: 14px; color: var(--muted); }

/* ---------- result ---------- */
.result { margin-top: 18px; }
.verdict { font-size: 19px; font-weight: 650; padding: 12px 16px; border-radius: 12px; margin-bottom: 14px; }
.verdict.correct { background: var(--ok-bg); color: var(--ok); }
.verdict.accents, .verdict.order, .verdict.wrong { background: var(--bad-bg); color: var(--bad); }
.verdict.revealed { background: var(--neutral-bg); color: var(--neutral); }
.round-note { color: var(--bad); font-size: 14.5px; margin: -6px 0 12px; }
.warning { background: var(--warn-bg); color: var(--warn); padding: 8px 12px; border-radius: 10px; margin-bottom: 12px; font-size: 14.5px; }

.line { display: grid; grid-template-columns: 110px 1fr; gap: 10px; align-items: start; margin: 10px 0; }
.line-label { font-size: 13px; color: var(--muted); padding-top: 9px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  border: 2px solid transparent; border-radius: 10px; padding: 4px 11px; cursor: pointer;
  font-size: 20px; line-height: 1.35; background: var(--neutral-bg); color: var(--text);
  transition: transform .1s;
}
.chip:hover { transform: translateY(-1px); }
.chip.selected { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.accent, .chip.order { background: var(--warn-bg); color: var(--warn); }
.chip.form, .chip.wrong { background: var(--bad-bg); color: var(--bad); }
.chip.extra { background: var(--bad-bg); color: var(--bad); text-decoration: line-through; }
.chip.missing { background: transparent; color: var(--bad); border: 2px dashed var(--bad); }
.chip.optional, .chip.skipped { background: transparent; color: var(--muted); border: 2px dashed var(--border); }
.chip.shown { background: var(--accent-soft); color: var(--text); }

.explain {
  margin-top: 14px; padding: 16px 18px; border-radius: 12px; background: var(--surface-2);
  border-left: 4px solid var(--accent);
}
.explain.st-ok { border-left-color: var(--ok); }
.explain.st-accent, .explain.st-order { border-left-color: var(--warn); }
.explain.st-form, .explain.st-wrong, .explain.st-extra, .explain.st-missing { border-left-color: var(--bad); }
.explain-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.explain-word { font-size: 24px; font-weight: 650; }
.explain-status { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.explain-note { margin: 8px 0 0; font-weight: 550; }
.explain-text { margin: 8px 0 0; }
.explain-empty { color: var(--muted); margin: 0; }
.alts { margin-top: 12px; font-size: 15px; color: var(--muted); }
.alts .gr { color: var(--text); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.legend .chip { font-size: 12px; padding: 0 7px; cursor: default; }
.legend .chip:hover { transform: none; }

/* ---------- summary ---------- */
.stats { display: flex; flex-wrap: wrap; gap: 12px; margin: 18px 0; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 18px; min-width: 140px; }
.stat b { display: block; font-size: 26px; }
.stat span { color: var(--muted); font-size: 13.5px; }
.stat-know { border-color: var(--k-fg); background: var(--k-bg); }
.stat-know b { color: var(--k-fg); }
.review { list-style: none; padding: 0; margin: 0; }
.review li { display: grid; grid-template-columns: 26px 1fr; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.review .mark { font-weight: 700; }
.review .mark.correct { color: var(--ok); }
.review .mark.wrong { color: var(--bad); }
.review .mark.none { color: var(--muted); }
.review .gr { color: var(--muted); }

/* ---------- modes in the top bar ---------- */
.modes { display: flex; gap: 4px; padding: 3px; border-radius: 10px; background: var(--surface-2); align-self: center; }
.modes a { padding: 3px 12px; border-radius: 8px; color: var(--muted); font-weight: 550; font-size: 14px; }
.modes a:hover { text-decoration: none; color: var(--text); }
.modes a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- reading: books and contents ---------- */
.book-card .level-title { font-size: 19px; }
.book-at { font-size: 13.5px; color: var(--accent); font-weight: 550; }
.book-toc-link { font-size: 13px; color: var(--muted); margin-top: 6px; }
.toc { columns: 2 340px; column-gap: 32px; }
.toc-ch { break-inside: avoid; margin-bottom: 18px; }
.toc-ch h2 { font-size: 17px; margin: 0 0 6px; }
.toc-ch ol { list-style: none; padding: 0; margin: 0; }
.toc-ch li { padding: 2px 0 2px 18px; position: relative; font-size: 15px; }
.toc-ch li.read::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-size: 13px; }
.toc-ch li.current::before { content: "▸"; position: absolute; left: 2px; color: var(--accent); }
.toc-ch li.current a { font-weight: 650; }
.toc-num { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }

/* ---------- reading: the text ---------- */
.page:has(.reader) { max-width: 1240px; }
.rbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; margin-bottom: 8px; }
.rbar .crumbs { margin: 0; }
.rtools { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.audio-ctl { display: flex; gap: 8px; align-items: center; }
.size-ctl { display: flex; gap: 4px; align-items: center; }
.size-ctl .btn-small { padding: 5px 10px; min-width: 40px; }
.size-val { border: none; background: none; color: var(--muted); font: inherit; font-size: 13px; min-width: 44px; cursor: pointer; font-variant-numeric: tabular-nums; }
.size-val:hover { color: var(--accent); }
.audio-ctl select { font: inherit; font-size: 13.5px; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.btn-small { padding: 5px 12px; font-size: 14px; }
.btn.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.reader { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; align-items: start; }
.reader:has(.wpanel:not([hidden])) { grid-template-columns: minmax(0, 1fr) minmax(340px, 440px); }
/* --rs: the text size the reader picked (A− / A+), 1 = normal. */
.rtext { max-width: calc(720px * max(1, var(--rs, 1))); font-size: calc(19px * var(--rs, 1)); line-height: 1.75; }
.rchapter { color: var(--muted); font-size: 14px; text-transform: uppercase; letter-spacing: .05em; margin-top: 8px; }
.rtitle { font-size: calc(27px * var(--rs, 1)); margin: 4px 0 18px; line-height: 1.3; }
.rp { margin: 0 0 14px; }
.rp.dlg { margin-bottom: 6px; }
.rp.flash { animation: flash 2.5s ease-out; }
@keyframes flash { from { background: var(--accent-soft); } to { background: transparent; } }
.w { cursor: pointer; border-radius: 4px; transition: background .1s; }
.w:hover { background: var(--surface-2); }
.w.sel { background: var(--accent-soft); color: var(--accent); }
.rplay { display: none; border: none; background: none; color: var(--accent); cursor: pointer; font-size: 13px; padding: 0 4px; margin-left: 4px; vertical-align: 2px; opacity: .55; }
.rplay:hover { opacity: 1; }
.reader.audio .rplay { display: inline; }
.rnav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--border); font-size: 16px; line-height: 1.4; }
.rcount { color: var(--muted); font-size: 13px; text-align: center; margin-top: 10px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 30; max-width: min(560px, calc(100vw - 32px));
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow);
}

/* ---------- reading: the word panel ---------- */
.wpanel {
  position: sticky; top: 72px; max-height: calc(100vh - 92px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  font-size: calc(15px * var(--rs, 1)); line-height: 1.5;
}
.wp-head { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.wp-word { font-size: calc(20px * var(--rs, 1)); font-weight: 650; color: var(--accent); }
.wp-close { border: none; background: none; cursor: pointer; font-size: 17px; color: var(--muted); padding: 2px 6px; }
.wp-tools { display: flex; align-items: center; gap: 6px; }
.wp-tools .btn-small { padding: 3px 8px; min-width: 34px; font-size: 13px; }
.wp-tools .size-val { min-width: 38px; font-size: 12px; }
/* A large text size that does not fit next to the text: the description takes the whole screen. */
.wpanel.full {
  position: fixed; inset: 0; top: 0; z-index: 40; max-height: none; height: 100dvh;
  border: none; border-radius: 0; box-shadow: none;
}
.wpanel.full .wp-body { max-width: calc(760px * var(--rs, 1)); margin: 0 auto; }
body.panel-full { overflow: hidden; }
.wpanel.full .wp-head { padding: 12px 20px; }
.wpanel.full .wp-tools .btn-small { font-size: 16px; padding: 6px 14px; min-width: 48px; }
.wpanel.full .wp-tools .size-val { font-size: 15px; min-width: 52px; }
.wpanel.full .wp-close { font-size: 24px; padding: 4px 10px; }
/* The description grows with the reader's text size (A− / A+): every size below is multiplied by --rs. */
.wp-body { padding: 4px 16px 16px; font-size: calc(15px * var(--rs, 1)); }
.wp-body hr { border: none; border-top: 2px solid var(--border); margin: 16px 0; }
.muted { color: var(--muted); }
.we-lemma { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin: 10px 0 4px; }
.we-lemma .say { font-size: calc(24px * var(--rs, 1)); font-weight: 700; }
.we-pos { color: var(--muted); font-size: calc(14px * var(--rs, 1)); }
.we-means { margin: 4px 0 10px; padding-left: 22px; }
.we-means li { margin: 3px 0; }
.we-means .en { font-weight: 550; }
.we-means .ru { color: var(--muted); }
.we-means .ru::before { content: "— "; }
.we-ex { font-style: italic; color: var(--muted); font-size: calc(14px * var(--rs, 1)); }
.we-form { background: var(--accent-soft); border-radius: 10px; padding: 8px 12px; margin: 8px 0; }
.we-k { color: var(--muted); font-size: calc(13px * var(--rs, 1)); margin-right: 4px; }
.we-also { color: var(--muted); font-size: calc(13px * var(--rs, 1)); margin-top: 4px; }
.we-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.nchip { border: 1px solid var(--border); background: var(--surface-2); border-radius: 999px; padding: 2px 10px; font-size: calc(13px * var(--rs, 1)); cursor: pointer; }
.nchip:hover { border-color: var(--accent); }
.nchip .q, .chip-q { color: var(--accent); font-weight: 700; }
.chip-q { border: 1px solid var(--border); background: var(--surface); border-radius: 50%; width: calc(20px * var(--rs, 1)); height: calc(20px * var(--rs, 1)); font-size: calc(12px * var(--rs, 1)); line-height: 1; cursor: pointer; padding: 0; vertical-align: 1px; }
.we-note { border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 10px 10px 0; padding: 8px 12px; margin: 8px 0; font-size: calc(14px * var(--rs, 1)); }
.we-note-title { font-weight: 650; margin-bottom: 2px; }
.we-note .md p { margin: 4px 0; }
.we-note .md ul { margin: 4px 0; padding-left: 20px; }
.we-tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(190px * var(--rs, 1)), 1fr)); gap: 10px 12px; margin: 12px 0; }
.wt { border-collapse: collapse; font-size: calc(14px * var(--rs, 1)); width: 100%; }
.wt.wide { grid-column: 1 / -1; }
.wt caption { text-align: left; font-weight: 650; font-size: calc(13.5px * var(--rs, 1)); padding: 0 0 3px; }
.wt .cap-ru { display: block; font-weight: 400; color: var(--muted); font-size: calc(12.5px * var(--rs, 1)); }
.wt th { text-align: left; font-weight: 400; color: var(--muted); font-size: calc(12.5px * var(--rs, 1)); padding: 2px 8px 2px 0; white-space: nowrap; }
.wt td { padding: 2px 6px 2px 0; }
.wt.wide td, .wt.wide th { border-top: 1px solid var(--border); padding: 3px 8px 3px 0; }
.wt .pfx { color: var(--muted); }
.say { cursor: pointer; }
.say:hover { color: var(--accent); }
.say.hit { font-weight: 750; }
.say.best { background: var(--accent-soft); color: var(--accent); border-radius: 4px; padding: 0 3px; }
.we-explain { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 6px; font-size: calc(14.5px * var(--rs, 1)); }
.we-explain p { margin: 8px 0 2px; }
.we-explain ul { margin: 2px 0 6px; padding-left: 20px; }
.we-explain li { margin: 1px 0; }

@media (max-width: 900px) {
  .reader:has(.wpanel:not([hidden])) { grid-template-columns: minmax(0, 1fr); }
  .wpanel {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 20; max-height: 72vh;
    border-radius: var(--radius) var(--radius) 0 0; border-bottom: none;
  }
  body.sheet-open .rtext { padding-bottom: 60vh; }
}

@media (max-width: 640px) {
  .page { padding: 18px 14px 60px; }
  .topbar { padding: 10px 14px; gap: 10px; align-items: center; }
  .brand-text { display: none; }
  .user-name { max-width: 90px; }
  .rtext { font-size: calc(18px * var(--rs, 1)); }
  .prompt { font-size: 20px; }
  .answer { font-size: 19px; }
  .line { grid-template-columns: 1fr; gap: 4px; }
  .line-label { padding-top: 0; }
  .sheet { padding: 4px 16px 18px; }
  .osk-key { min-width: 29px; height: 38px; font-size: 16px; }
  .osk-row { gap: 3px; }
  .osk-space { width: 200px; }
  .vtabs { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; }
  .vtab { padding: 7px 9px; }
  .vtab.active { padding: 6px 8px; }
  .vtab-name { font-size: 14px; }
  .vtab-theme { font-size: 12px; }
}
