/* Cozy dark beige theme ("coffee house"). The app keeps its own colors in light and dark Telegram. */
:root {
  --bg: #211c17;          /* roasted coffee */
  --bg-deep: #1a1612;
  --card: #2d261f;
  --card-2: #382f27;
  --line: #463b31;
  --text: #f0e6d6;        /* cream */
  --text-2: #d9cbb6;
  --hint: #a39280;
  --accent: #d6a874;      /* caramel */
  --accent-2: #e8c79c;
  --accent-ink: #2a2017;
  --sage: #a3b48a;
  --terra: #d48a6e;
  --gold: #e2b866;
  --radius: 18px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; color: var(--text); font: 16px/1.45 var(--sans);
  background: radial-gradient(120% 60% at 50% -10%, #2c241c 0%, var(--bg) 55%, var(--bg-deep) 100%) fixed var(--bg); }
button, input, select { font: inherit; color: inherit; }
h1, h2 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 32px; margin: 10px 0 6px; }
h2 { font-size: 26px; margin: 0; }
h3 { font-size: 12px; margin: 24px 4px 10px; color: var(--hint); text-transform: uppercase; letter-spacing: .12em; font-weight: 600; }
.eyebrow { margin: 0 0 2px; font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--accent); font-weight: 600; }
.hidden { display: none !important; }
.muted { color: var(--hint); }
.small { font-size: 13px; }
.center { text-align: center; }
::selection { background: var(--accent); color: var(--accent-ink); }

.screen { padding: 18px 16px 104px; max-width: 560px; margin: 0 auto; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.center-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.top-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0;
  box-shadow: 0 8px 24px -16px rgba(0,0,0,.6); }
.soft-card { background: transparent; }

/* Buttons */
.btn { display: block; width: 100%; border: 0; border-radius: 14px; padding: 13px 16px; margin: 10px 0;
  font-weight: 600; cursor: pointer; transition: transform .08s, opacity .15s, background .15s; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; }
.btn.primary { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: var(--accent-ink); }
.btn.big { padding: 16px; font-size: 17px; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.soft { background: var(--card-2); color: var(--text); }
.btn.good { background: var(--sage); color: #1f2618; }
.btn.bad { background: var(--terra); color: #2b1810; }
.btn.danger-ghost { background: transparent; color: var(--terra); font-weight: 500; }
.btn.small-btn { width: auto; display: inline-block; padding: 8px 14px; margin: 0; font-size: 14px; }
.chip-btn { border: 1px solid var(--line); background: var(--card); color: var(--text-2); border-radius: 20px; padding: 6px 12px;
  font-size: 14px; cursor: pointer; white-space: nowrap; }

/* Onboarding */
.hero { text-align: center; padding: 22px 8px 4px; }
.logo { width: 72px; height: 72px; margin: 0 auto; border-radius: 22px; display: flex; align-items: center; justify-content: center;
  font-size: 36px; background: linear-gradient(160deg, var(--card-2), var(--card)); border: 1px solid var(--line); }
.lang-card { display: block; width: 100%; text-align: left; cursor: pointer; transition: border-color .15s, background .15s; }
.lang-card.on { border-color: var(--accent); background: linear-gradient(180deg, #3a2f24, var(--card)); }
.lang-head { display: flex; align-items: center; gap: 12px; }
.lang-head .flag { font-size: 30px; line-height: 1; }
.lang-head .grow { flex: 1; }
.lang-head b { font-family: var(--serif); font-size: 19px; display: block; }
.check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--accent-ink); }
.on .check { background: var(--accent); border-color: var(--accent); }
.levels { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.levels button { border: 1px solid var(--line); background: var(--card-2); border-radius: 12px; padding: 6px 10px; cursor: pointer; font-size: 13px; color: var(--text-2); }
.levels button b { color: var(--text); margin-right: 4px; }
.levels button.sel { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.levels button.sel b { color: var(--accent-ink); }
.how { display: flex; gap: 12px; padding: 7px 0; color: var(--text-2); }
.how span { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--card-2); color: var(--accent); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.how b { color: var(--text); }

/* Bars */
.bar { height: 7px; background: var(--card-2); border-radius: 4px; overflow: hidden; margin: 10px 0 6px; }
.bar > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--gold)); border-radius: 4px; transition: width .35s; }
.bar.thin { height: 4px; }

/* Placement */
.word-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.wchip { border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: 9px 13px; cursor: pointer;
  display: flex; flex-direction: column; align-items: flex-start; transition: background .12s, border-color .12s; text-align: left; }
.wchip b { font-weight: 600; font-family: var(--serif); font-size: 17px; }
.wchip small { color: var(--hint); font-size: 12px; }
.wchip.on { border-color: var(--sage); background: #2f3326; }
.wchip.on b::before { content: "✓ "; color: var(--sage); }
.sticky-actions { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 8px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, var(--bg-deep) 35%); max-width: 560px; margin: 0 auto; }
.sticky-actions .btn { margin: 0; }
.hint { background: #3a2f22; border: 1px solid #5a4630; border-radius: 14px; padding: 14px; margin: 8px 0; color: var(--text-2); }
.hint .row { display: flex; gap: 8px; margin-top: 12px; }
.hint .btn { margin: 0; padding: 11px; }

/* Today */
.streak { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 6px 12px; font-weight: 600; }
.lang-section { margin-top: 22px; }
.lang-title { display: flex; align-items: center; gap: 8px; margin: 0 4px 8px; color: var(--text-2); font-weight: 600; }
.lang-title .flag { font-size: 18px; }
.lang-title .grow { flex: 1; }
.word-card { position: relative; overflow: hidden; margin-top: 0; }
.word-label { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--accent); font-weight: 700; }
.word-main { display: flex; align-items: center; gap: 10px; margin: 6px 0 2px; }
.word-big { font-family: var(--serif); font-size: 36px; font-weight: 600; line-height: 1.1; }
.word-ru { font-size: 18px; color: var(--text-2); }
.word-forms { color: var(--hint); font-size: 14px; margin-top: 6px; font-style: italic; }
.pos { display: inline-block; font-size: 11px; background: var(--card-2); border-radius: 6px; padding: 1px 7px; color: var(--hint); vertical-align: 2px; }
.say { flex: none; border: 1px solid var(--line); width: 36px; height: 36px; border-radius: 50%; background: var(--card-2); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; color: var(--accent); }
.say svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.example { margin-top: 14px; padding: 12px; border-radius: 14px; background: var(--bg-deep); border: 1px solid var(--line); display: flex; gap: 10px; align-items: flex-start; text-align: left; }
.example .say { width: 30px; height: 30px; }
.example .say svg { width: 14px; height: 14px; }
.example .tx { font-family: var(--serif); font-size: 17px; }
.example .ru { color: var(--hint); font-size: 14px; }
.word-actions { display: flex; gap: 8px; margin-top: 14px; }
.word-actions .btn { margin: 0; padding: 11px 8px; font-size: 15px; }
.done-mark { text-align: center; color: var(--sage); font-weight: 600; margin-top: 14px; font-size: 14px; }
.row-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.row-card .big-num { font-family: var(--serif); font-size: 28px; font-weight: 600; color: var(--accent); min-width: 34px; text-align: center; }
.row-card .grow { flex: 1; }
.link-btn { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 4px 0; font-size: 14px; }

/* Language chips */
.lang-chips { display: flex; gap: 6px; overflow-x: auto; margin: 12px -16px; padding: 0 16px; scrollbar-width: none; }
.lang-chips::-webkit-scrollbar { display: none; }
.lang-chips button { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 20px; padding: 7px 13px; cursor: pointer; font-size: 14px; color: var(--text-2); }
.lang-chips button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.lang-chips button.off { opacity: .55; }

/* Dictionary */
.input { width: 100%; border: 1px solid var(--line); border-radius: 14px; background: var(--card); padding: 12px 14px; outline: none; }
.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--hint); }
.small-input { width: auto; padding: 6px 10px; background: var(--card-2); color-scheme: dark; }
.filters { display: flex; gap: 6px; overflow-x: auto; margin: 10px -16px; padding: 0 16px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters button { flex: none; border: 0; background: transparent; border-bottom: 2px solid transparent; padding: 6px 6px; font-size: 14px; cursor: pointer; color: var(--hint); }
.filters button.on { color: var(--text); border-bottom-color: var(--accent); }
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list:empty { display: none; }
.item { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.item:last-child { border-bottom: 0; }
.item .grow { flex: 1; min-width: 0; }
.item .w { font-family: var(--serif); font-size: 18px; }
.item .ru { color: var(--hint); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { flex: none; font-size: 11px; border-radius: 8px; padding: 2px 8px; font-weight: 600; }
.b-known { background: #2e3540; color: #a9bdd6; }
.b-learning { background: #44361f; color: var(--gold); }
.b-learned { background: #2f3726; color: var(--sage); }
.b-new { background: var(--card-2); color: var(--hint); }
.dots { display: inline-flex; gap: 3px; margin-left: 5px; vertical-align: middle; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: #5d4a2c; }
.dots i.on { background: var(--gold); }
.empty { text-align: center; color: var(--hint); padding: 28px 16px; }

/* Practice */
.mode { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; cursor: pointer; margin: 10px 0; }
.mode:disabled { opacity: .5; cursor: default; }
.mode .ic { flex: none; width: 46px; height: 46px; border-radius: 14px; background: var(--card-2); display: flex; align-items: center; justify-content: center; font-size: 22px; }
.mode .grow { flex: 1; }
.mode b { display: block; font-size: 16px; }
.mode .n { font-family: var(--serif); font-size: 24px; color: var(--accent); }
.phrases-head { margin: 26px 0 0; }
.phrases-head h3 { margin: 0 4px; }
.phrase { display: flex; gap: 10px; align-items: flex-start; padding: 13px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.phrase:last-child { border-bottom: 0; }
.phrase .grow { flex: 1; }
.phrase .first { font-family: var(--serif); font-size: 17px; }
.phrase .second { color: var(--hint); font-size: 14px; transition: filter .2s; }
.phrase .second.blur { filter: blur(6px); user-select: none; }
.phrase .tag { font-size: 12px; color: var(--accent); margin-top: 2px; }
.phrase .say { width: 30px; height: 30px; }
.phrase .say svg { width: 14px; height: 14px; }

/* Progress */
.streak-card { display: flex; align-items: center; gap: 14px; background: linear-gradient(135deg, #3d2f20, var(--card)); border: 1px solid #5a4630;
  border-radius: var(--radius); padding: 16px; margin: 14px 0; }
.streak-card .fire { font-size: 34px; }
.streak-card b { font-family: var(--serif); font-size: 30px; display: block; line-height: 1; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat b { display: block; font-family: var(--serif); font-size: 28px; line-height: 1.1; }
.stat span { color: var(--hint); font-size: 13px; }
.stage-bars { display: flex; gap: 6px; align-items: flex-end; height: 84px; margin-top: 16px; }
.stage-bars div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; font-size: 11px; color: var(--hint); gap: 3px; }
.stage-bars i { display: block; width: 100%; background: linear-gradient(180deg, var(--accent-2), var(--accent)); border-radius: 5px 5px 2px 2px; min-height: 3px; }
.settings label { padding: 8px 0; }
.lang-set .row-between { padding: 6px 0; }
.lang-set .lang-head { margin-bottom: 6px; }
.lang-set.paused .lang-head { opacity: .6; }
.lang-set .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.lang-set select { max-width: 60%; }
.toggle { appearance: none; width: 46px; height: 28px; border-radius: 14px; background: var(--card-2); border: 1px solid var(--line); position: relative; cursor: pointer; transition: background .2s; flex: none; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--hint); transition: transform .2s, background .2s; }
.toggle:checked { background: var(--accent); border-color: var(--accent); }
.toggle:checked::after { transform: translateX(18px); background: var(--accent-ink); }
.method p { color: var(--text-2); font-size: 14px; }
.method summary { cursor: pointer; }

/* Session */
.flash { min-height: 320px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 24px 18px; }
.flash .q-label { font-size: 12px; color: var(--accent); margin-bottom: 12px; text-transform: uppercase; letter-spacing: .12em; font-weight: 600; }
.flash .q { font-family: var(--serif); font-size: 34px; font-weight: 600; display: flex; align-items: center; gap: 10px; justify-content: center; flex-wrap: wrap; }
.flash .q.sentence { font-size: 22px; line-height: 1.35; }
.flash .a { margin-top: 18px; width: 100%; animation: fade .2s ease; border-top: 1px dashed var(--line); padding-top: 18px; }
.flash .a .ans { font-family: var(--serif); font-size: 24px; display: flex; align-items: center; gap: 10px; justify-content: center; flex-wrap: wrap; }
.flash .a .ans.sentence { font-size: 20px; }
.session-actions { display: flex; gap: 8px; }
.session-actions .btn { margin: 0; }
.finish { text-align: center; padding: 20px 10px; }
.finish .big { font-size: 56px; }

/* Bottom tabs */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: rgba(26, 22, 18, .92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
.tabs button { flex: 1; border: 0; background: none; padding: 9px 0 8px; font-size: 11px; color: var(--hint);
  display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; }
.tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs button.active { color: var(--accent); font-weight: 600; }

/* Sheet */
.sheet { position: fixed; inset: 0; z-index: 20; }
.sheet-bg { position: absolute; inset: 0; background: rgba(10, 8, 6, .6); animation: fade .15s; }
.sheet-body { position: absolute; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow-y: auto; background: var(--bg);
  border-top: 1px solid var(--line); border-radius: 22px 22px 0 0; padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); animation: up .22s ease; max-width: 560px; margin: 0 auto; }
.sheet-body::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 8px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-status { text-align: center; margin: 4px 0; }

.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--accent-2); color: var(--accent-ink);
  padding: 10px 16px; border-radius: 14px; font-size: 14px; font-weight: 500; z-index: 30; max-width: 85%; text-align: center; animation: fade .15s;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,.7); }

/* ---------- v3: modes, level test, rules, exercises, teacher ---------- */
code { font-family: ui-monospace, Menlo, monospace; font-size: .9em; background: var(--card-2); padding: 1px 5px; border-radius: 5px; }

/* Onboarding: main language */
.pick-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.pick-main { border: 1px solid var(--line); background: var(--card-2); border-radius: 12px; padding: 7px 12px; font-size: 13px; cursor: pointer; color: var(--text-2); }
.pick-main.sel { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.mode-badge { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; padding: 2px 7px; border-radius: 8px; margin-left: 6px; vertical-align: 2px; font-weight: 700; }
.mode-badge.main { background: var(--accent); color: var(--accent-ink); }
.mode-badge.light { background: var(--card-2); color: var(--hint); }

/* Quiz (level test, rule of the day, gap exercise) */
.quiz { padding: 22px 18px; }
.q-label { font-size: 12px; color: var(--accent); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .12em; font-weight: 600; }
.quiz-q { font-family: var(--serif); font-size: 24px; line-height: 1.35; margin-bottom: 18px; }
.options { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; width: 100%; }
.options.row { flex-direction: row; flex-wrap: wrap; }
.options.row .opt { flex: 1 1 auto; }
.opt { border: 1px solid var(--line); background: var(--card-2); color: var(--text); border-radius: 14px; padding: 13px 14px; font-size: 16px; cursor: pointer; text-align: left; transition: background .12s, border-color .12s; }
.options.row .opt { text-align: center; padding: 10px 12px; font-size: 15px; }
.opt:active { transform: scale(.98); }
.opt.right { background: #2f3726; border-color: var(--sage); color: var(--sage); font-weight: 600; }
.opt.wrong { background: #3d2520; border-color: var(--terra); color: var(--terra); }
.opt.dim { opacity: .45; }

/* Test result */
.result { text-align: center; padding: 24px 18px; }
.result-level { font-family: var(--serif); font-size: 56px; font-weight: 600; line-height: 1.05; color: var(--accent-2); margin: 4px 0; }
.blocks { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.block { font-size: 12px; border-radius: 10px; padding: 4px 10px; font-weight: 600; }
.block.ok { background: #2f3726; color: var(--sage); }
.block.no { background: #3d2520; color: var(--terra); }
.topics { display: flex; flex-wrap: wrap; gap: 6px; }
.topics span { background: #44361f; color: var(--gold); border-radius: 10px; padding: 5px 10px; font-size: 13px; }
.small-topics { margin: 10px 0 4px; }
.small-topics span { font-size: 12px; padding: 3px 8px; }
.mistake { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.mistake:last-child { border-bottom: 0; }
.mistake .tx { font-family: var(--serif); font-size: 17px; margin-bottom: 2px; }
.mistake .tx b { color: var(--sage); }
.mistake .small:last-child { color: var(--text-2); margin-top: 4px; }

/* Level card on the Progress tab */
.level-row { display: flex; align-items: center; gap: 16px; }
.small-level { font-size: 40px; margin: 0; }
.small-level.goal { color: var(--hint); }
.level-row .arrow { font-size: 26px; color: var(--hint); padding-top: 18px; }
#levelCard .btn { margin-top: 10px; }
.segment { display: flex; background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; margin: 12px 0; }
.segment button { flex: 1; border: 0; background: none; border-radius: 9px; padding: 7px 8px; font-size: 14px; color: var(--hint); cursor: pointer; }
.segment button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.small-seg { margin: 8px 0; }
.small-seg button { font-size: 13px; padding: 6px; }

/* Today: session and rule of the day */
.session-card { border-color: #5a4630; background: linear-gradient(135deg, #3a2e21, var(--card)); }
.row-card.done .big-num { color: var(--sage); }
.rule-card { border-color: #4a3f52; }
.rule-card .word-label { color: #c3a8d6; }
.rule-title { font-family: var(--serif); font-size: 24px; font-weight: 600; margin: 6px 0 6px; }
.rule-text { color: var(--text-2); font-size: 15px; }
.rule-q { font-family: var(--serif); font-size: 19px; margin-top: 14px; }
.rule-q b { color: var(--sage); }
.done-mark.bad { color: var(--terra); }

/* Exercises */
.verdict { margin-top: 14px; font-weight: 600; font-size: 15px; }
.verdict.ok { color: var(--sage); }
.verdict.no { color: var(--terra); }
.gap { display: inline-block; min-width: 64px; border-bottom: 2px solid var(--accent); margin: 0 4px; height: 1em; vertical-align: -2px; }
.answer-input { margin-top: 18px; text-align: center; font-family: var(--serif); font-size: 22px; padding: 14px; }
.build-line { min-height: 54px; width: 100%; border-bottom: 1px dashed var(--line); margin: 16px 0 12px; padding-bottom: 8px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; }
.build-pool { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.token { border: 1px solid var(--line); background: var(--card-2); border-radius: 10px; padding: 8px 12px; font-family: var(--serif); font-size: 17px; cursor: pointer; color: var(--text); }
.build-line .token { background: #3a2f24; border-color: var(--accent); }

/* Teacher chat */
#tab-teacher { padding-bottom: 190px; }
.chat { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.msg { max-width: 86%; padding: 10px 13px; border-radius: 18px; font-size: 15px; line-height: 1.45; word-wrap: break-word; animation: fade .2s ease; }
.msg.user { align-self: flex-end; background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: var(--accent-ink); border-bottom-right-radius: 6px; }
.msg.assistant { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg .fix { margin-top: 8px; padding: 8px 10px; background: #3a2f22; border-radius: 10px; color: var(--accent-2); font-size: 14px; }
.msg .tr { margin-top: 6px; color: var(--hint); font-size: 14px; }
.msg .gap-line { height: 6px; }
.msg.typing { display: flex; gap: 4px; padding: 14px; }
.msg.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--hint); animation: blink 1.2s infinite; }
.msg.typing i:nth-child(2) { animation-delay: .2s; }
.msg.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.composer { position: fixed; left: 0; right: 0; bottom: calc(58px + env(safe-area-inset-bottom)); padding: 8px 12px 10px; z-index: 9;
  background: linear-gradient(180deg, transparent, var(--bg-deep) 30%); max-width: 560px; margin: 0 auto; }
.quick { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.quick::-webkit-scrollbar { display: none; }
.quick button { flex: none; border: 1px solid var(--line); background: var(--card); color: var(--text-2); border-radius: 16px; padding: 6px 11px; font-size: 13px; cursor: pointer; }
.quick button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.composer-row { display: flex; gap: 8px; align-items: flex-end; background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 5px; }
.composer-row textarea { flex: 1; border: 0; background: none; resize: none; outline: none; padding: 8px 4px; max-height: 140px; line-height: 1.35; }
.composer-row textarea::placeholder { color: var(--hint); }
.mode-btn, .send-btn { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.mode-btn { background: var(--card-2); font-size: 14px; width: auto; min-width: 38px; padding: 0 8px; border-radius: 19px; }
.send-btn { background: var(--accent); color: var(--accent-ink); }
.send-btn:disabled { opacity: .5; }
.send-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.tabs button { font-size: 10px; }
