/* ==========================================================================
   Tildes — стили приложения поверх набора Bilem (kit/tokens.css, ui.css, dock.css, toast.css).
   Классы с префиксом tl-. Цвета — только токены: белая, бежевая и тёмная темы работают сами.
   ========================================================================== */

/* ---------- база (первые правила base.css набора + [hidden]) ---------- */
* { box-sizing: border-box; }
html, body { height: auto; min-height: 100%; margin: 0; }
body { background: var(--bg); overflow-x: hidden; overscroll-behavior-y: none; -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--link); }
[hidden] { display: none !important; }
.icon { flex: none; }
h1, h2, h3, p { margin: 0; }
@media (max-width: 768px) { body { font-size: 14px; } }

.tl-boot { display: grid; place-items: center; min-height: 100dvh; }
.tl-boot .ui-sk { width: 44px; height: 44px; border-radius: 12px; }

/* ---------- оболочка ---------- */
.ui-topbar-brand .brand-word { font-weight: 700; letter-spacing: -.025em; }
.tl-top-title { display: none; font-size: 15px; font-weight: 600; letter-spacing: -.015em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-streak { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 9px 0 7px; border-radius: 8px; background: var(--hover); color: var(--muted); font-family: var(--mono); font-size: 12.5px; font-weight: 600; text-decoration: none; }
.tl-streak.is-on { background: var(--warn-soft); color: var(--warn); }
.tl-offline { gap: 5px; }
.tl-dock { display: none; }
.tl-user { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 7px; color: var(--ink-2); text-decoration: none; min-width: 0; }
.tl-user:hover { background: var(--hover); color: var(--ink); }
.tl-avatar { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 8px; background: var(--ai-soft); color: var(--ai); font-size: 11px; font-weight: 600; text-transform: uppercase; }
.tl-user-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.tl-user-text b { font-size: 12.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-user-text small { font-size: 11px; color: var(--muted); }
.ui-shell.is-collapsed .tl-user { padding: 5px; margin-left: 4px; }
.ui-shell.is-collapsed .tl-user-text { display: none; }

.tl-page { max-width: 1080px; margin: 0 auto; }
.tl-narrow { max-width: 680px; margin: 0 auto; }

/* режим занятия: только упражнение, без меню и панелей */
.ui-shell.is-focus { grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr; }
.ui-shell.is-focus > .ui-topbar, .ui-shell.is-focus > .ui-sb, .ui-shell.is-focus > .tl-dock { display: none !important; }
.ui-shell.is-focus .ui-page { padding-top: 0; }

@media (max-width: 1100px) { .tl-top-title { display: block; } }
@media (max-width: 768px) {
  .ui-shell > .ui-sb { display: none; }
  .tl-dock { display: block; }
  .ui-page { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
  .ui-shell.is-focus .ui-page { padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
  .ui-topbar { padding-top: env(safe-area-inset-top, 0px); height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); }
}

/* ---------- вход ---------- */
.tl-auth { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--panel); }
.tl-auth-side { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; padding: 40px 48px; background: var(--bg); border-right: 1px solid var(--rule); }
.tl-auth-side::before { content: ''; position: absolute; inset: 0; pointer-events: none; background-image: radial-gradient(var(--rule) 1px, transparent 1.2px); background-size: 22px 22px; mask-image: radial-gradient(70% 80% at 70% 30%, #000 0%, transparent 75%); -webkit-mask-image: radial-gradient(70% 80% at 70% 30%, #000 0%, transparent 75%); }
.tl-auth-side::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(40% 50% at 78% 30%, var(--ai-soft), transparent 70%); }
.tl-auth-side > * { position: relative; z-index: 1; }
.tl-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 17px; font-weight: 700; letter-spacing: -.025em; }
.tl-brand svg { border-radius: 8px; }
.tl-kicker { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px 0 10px; border-radius: 99px; border: 1px solid var(--rule); background: var(--panel); box-shadow: var(--shadow-1); font-size: 12px; font-weight: 500; color: var(--ink-2); }
.tl-kicker i { width: 7px; height: 7px; border-radius: 50%; background: var(--ai); }
.tl-auth-h1 { margin-top: 20px; font-size: clamp(30px, 3.4vw, 44px); font-weight: 600; line-height: 1.06; letter-spacing: -.038em; text-wrap: balance; }
.tl-auth-h1 span { color: var(--ai); }
.tl-auth-lead { margin-top: 16px; max-width: 32em; font-size: 15px; line-height: 1.6; color: var(--ink-2); text-wrap: pretty; }
.tl-facts { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; font-size: 13px; color: var(--ink-2); }
.tl-facts li { display: flex; align-items: flex-start; gap: 10px; }
.tl-facts .icon { color: var(--ai); margin-top: 2px; }
.tl-facts b { font-weight: 600; color: var(--ink); }
.tl-auth-main { display: grid; place-items: center; padding: 32px 24px; }
.tl-auth-form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 14px; }
.tl-auth-form h2 { font-size: 20px; font-weight: 600; letter-spacing: -.02em; color: var(--ink); text-transform: none; }
.tl-auth-form > p { margin-top: -8px; color: var(--muted); }
.tl-auth-form .ui-btn { height: 40px; font-size: 14px; }
.tl-auth-form .ui-input { height: 40px; font-size: 15px; }
.tl-auth-alt { text-align: center; color: var(--muted); font-size: 13px; }
.tl-auth-alt button { border: 0; background: none; padding: 0; color: var(--link); font-weight: 500; }
.tl-auth-alt button:hover { text-decoration: underline; text-underline-offset: 3px; }
.tl-auth-mobile-brand { display: none; }
@media (max-width: 860px) {
  .tl-auth { grid-template-columns: minmax(0, 1fr); background: var(--bg); }
  .tl-auth-side { display: none; }
  .tl-auth-main { padding: 24px 16px; align-content: center; }
  .tl-auth-form { padding: 22px 18px; border: 1px solid var(--rule); border-radius: 14px; background: var(--panel); }
  .tl-auth-mobile-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 4px; text-align: center; }
  .tl-auth-mobile-brand p { color: var(--muted); font-size: 13.5px; max-width: 26em; }
}

/* ---------- общие блоки ---------- */
.tl-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.tl-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tl-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tl-split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.tl-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
@media (max-width: 1180px) { .tl-split { grid-template-columns: minmax(0, 1fr); } .tl-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 768px) { .tl-grid.two, .tl-grid.three { grid-template-columns: minmax(0, 1fr); gap: 10px; } }

.tl-tile { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 9px; background: var(--panel); border: 1px solid var(--rule); color: var(--ink-2); box-shadow: var(--shadow-1); }
.tl-tile.is-ai { background: var(--ai-soft); border-color: transparent; color: var(--ai); box-shadow: none; }
.tl-tile.is-ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); box-shadow: none; }
.tl-lvl { font-family: var(--mono); font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 5px; background: var(--hover); color: var(--ink-2); }
.tl-en { font-size: 15px; font-weight: 500; color: var(--ink); line-height: 1.45; }
.tl-ru { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.tl-hit { color: var(--ok); }
.tl-miss { color: var(--bad); text-decoration: underline; text-decoration-style: wavy; text-decoration-color: color-mix(in srgb, var(--bad) 50%, transparent); text-underline-offset: 4px; }
.tl-say { flex: none; }
.tl-say.is-playing { background: var(--ai-soft); color: var(--ai); }

/* строка-ссылка в списках */
.tl-rows { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; margin: 0; padding: 6px; list-style: none; }
.tl-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; border: 0; border-radius: 9px; background: none; text-align: left; color: var(--ink); text-decoration: none; transition: background-color var(--dur-1) var(--ease); -webkit-tap-highlight-color: transparent; }
.tl-row:hover { background: var(--hover); }
.tl-row:active { background: var(--active); }
.tl-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.tl-row-main b { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-row-main span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-row-side { display: flex; align-items: center; gap: 8px; flex: none; color: var(--faint); font-size: 12px; }
.tl-row.is-done .tl-tile { background: var(--ok-soft); border-color: transparent; color: var(--ok); box-shadow: none; }
.tl-row.is-locked { opacity: .5; }

/* полоса прогресса */
.tl-bar { display: block; height: 6px; border-radius: 99px; background: var(--hover); overflow: hidden; }
.tl-bar > i { display: block; height: 100%; width: 100%; border-radius: inherit; background: var(--ai); transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform var(--dur-4) var(--ease-out); }
.tl-bar.is-ok > i { background: var(--ok); }
.tl-bar.is-thin { height: 4px; }

/* ---------- «Сегодня» ---------- */
.tl-hero { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 24px; border: 1px solid var(--rule); border-radius: 14px; background: linear-gradient(120deg, color-mix(in srgb, var(--ai-soft) 85%, var(--panel)) 0%, var(--panel) 62%); }
.tl-hero::before { content: ''; position: absolute; inset: 0; pointer-events: none; background-image: radial-gradient(var(--rule) 1px, transparent 1.2px); background-size: 18px 18px; mask-image: linear-gradient(90deg, transparent 35%, #000 100%); -webkit-mask-image: linear-gradient(90deg, transparent 35%, #000 100%); }
.tl-hero > * { position: relative; }
.tl-hero-text { min-width: 0; }
.tl-hero h1 { margin-top: 4px; font-size: clamp(20px, 2.2vw, 26px); font-weight: 600; line-height: 1.2; letter-spacing: -.028em; text-wrap: balance; }
.tl-hero p { margin-top: 6px; max-width: 52ch; font-size: 13.5px; line-height: 1.55; color: var(--muted); }
.tl-hero .ui-btn { height: 40px; padding: 0 16px; font-size: 14px; border-radius: 9px; flex: none; }
.tl-ring { position: relative; flex: none; width: 76px; height: 76px; }
.tl-ring svg { display: block; transform: rotate(-90deg); }
.tl-ring circle { fill: none; stroke-width: 6; stroke-linecap: round; }
.tl-ring .bg { stroke: var(--hover); }
.tl-ring .fg { stroke: var(--ai); transition: stroke-dashoffset var(--dur-4) var(--ease-out); }
.tl-ring b { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--mono); font-size: 16px; font-weight: 600; letter-spacing: -.03em; }
.tl-hero-side { display: flex; align-items: center; gap: 16px; flex: none; }
@media (max-width: 768px) {
  .tl-hero { flex-direction: column; align-items: stretch; padding: 18px 16px; gap: 14px; }
  .tl-hero-side { justify-content: space-between; }
  .tl-hero .ui-btn { flex: 1; }
  .tl-ring { width: 56px; height: 56px; }
  .tl-ring svg { width: 56px; height: 56px; }
  .tl-ring b { font-size: 13px; }
}

.tl-plan { margin: 0; padding: 6px; list-style: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; }
.tl-plan .tl-row { padding: 12px 10px; }
.tl-step-n { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.tl-check { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--rule); color: transparent; flex: none; }
.tl-row.is-done .tl-check { background: var(--ok); border-color: var(--ok); color: var(--panel); }
.tl-row.is-done .tl-row-main b { color: var(--muted); }

.tl-tip { display: flex; gap: 12px; padding: 14px 16px; }
.tl-tip p { font-size: 13px; line-height: 1.55; color: var(--ink-2); }
.tl-tip b { display: block; margin-bottom: 2px; font-size: 13px; font-weight: 600; color: var(--ink); }

/* ---------- занятие: шапка, карточка упражнения ---------- */
.tl-session { max-width: 620px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); }
.tl-session-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 10px 0; background: var(--bg); }
.tl-session-top .tl-bar { flex: 1; }
.tl-session-count { font-family: var(--mono); font-size: 12px; color: var(--muted); min-width: 44px; text-align: right; }
.tl-session-body { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 8px 0 20px; }
.tl-session-foot { position: sticky; bottom: 0; display: flex; gap: 8px; padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(to top, var(--bg) 70%, transparent); }
.tl-session-foot .ui-btn { flex: 1; height: 44px; font-size: 14.5px; border-radius: 10px; }

.tl-q { display: flex; flex-direction: column; gap: 14px; padding: 22px 20px; background: var(--panel); border: 1px solid var(--rule); border-radius: 14px; animation: ui-fade-up var(--dur-3) var(--ease-out) backwards; }
.tl-q-kind { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tl-q-word { display: flex; align-items: center; gap: 10px; }
.tl-q-word h2 { font-size: clamp(24px, 6vw, 30px); font-weight: 600; letter-spacing: -.03em; line-height: 1.15; color: var(--ink); text-transform: none; overflow-wrap: anywhere; }
.tl-q-word.is-ru h2 { font-size: clamp(20px, 5vw, 24px); }
.tl-ipa { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.tl-q-ru { font-size: 17px; font-weight: 500; color: var(--ink); }
.tl-q-ex { padding: 12px 14px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--rule-soft); }
.tl-q-ex .tl-en { display: flex; align-items: flex-start; gap: 8px; }
.tl-q-ex .tl-en span { flex: 1; }
.tl-q-ex mark { background: none; color: var(--ai); font-weight: 600; }
.tl-gap { display: inline-block; min-width: 64px; border-bottom: 2px solid var(--faint); margin: 0 2px; }
.tl-uk { font-size: 12px; color: var(--muted); }
.tl-uk b { font-weight: 600; color: var(--ink-2); }

.tl-opts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.tl-opt { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 10px 14px; border: 1px solid var(--rule); border-radius: 10px; background: var(--panel); text-align: left; font-size: 15px; font-weight: 500; color: var(--ink); transition: border-color var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease), transform var(--dur-2) var(--spring); -webkit-tap-highlight-color: transparent; }
.tl-opt:hover:not(:disabled) { border-color: var(--faint); background: var(--panel-2); }
.tl-opt:active:not(:disabled) { transform: scale(.985); }
.tl-opt kbd { display: grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 6px; background: var(--hover); font-family: var(--mono); font-size: 11px; color: var(--muted); }
.tl-opt.is-right { border-color: var(--ok); background: var(--ok-soft); }
.tl-opt.is-right kbd { background: var(--ok); color: var(--panel); }
.tl-opt.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.tl-opt.is-wrong kbd { background: var(--bad); color: var(--panel); }
.tl-opt:disabled { cursor: default; }
.tl-opt:disabled:not(.is-right):not(.is-wrong) { opacity: .55; }
@media (hover: none) { .tl-opt kbd { display: none; } }

.tl-answer { height: 48px !important; font-size: 17px !important; text-align: center; font-weight: 500; }
.tl-answer.is-right { border-color: var(--ok); background: var(--ok-soft); }
.tl-answer.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.tl-verdict { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-radius: 10px; font-size: 13.5px; line-height: 1.5; animation: ui-fade-up var(--dur-2) var(--ease-out) backwards; }
.tl-verdict.is-right { background: var(--ok-soft); }
.tl-verdict.is-right > .icon { color: var(--ok); }
.tl-verdict.is-wrong { background: var(--bad-soft); }
.tl-verdict.is-wrong > .icon { color: var(--bad); }
.tl-verdict b { font-weight: 600; }
.tl-verdict > .icon { margin-top: 2px; }
.tl-verdict div { min-width: 0; flex: 1; }
.tl-rate { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.tl-rate .ui-btn { flex-direction: column; gap: 2px; height: 52px; padding: 0 4px; border-radius: 10px; }
.tl-rate small { font-family: var(--mono); font-size: 10.5px; font-weight: 400; color: var(--muted); }
.tl-rate .ui-btn--primary small { color: color-mix(in srgb, var(--primary-fg) 70%, transparent); }

/* слова для сборки предложения */
.tl-build { display: flex; flex-wrap: wrap; gap: 6px; min-height: 50px; padding: 10px; border: 1px dashed var(--rule); border-radius: 10px; background: var(--panel-2); align-content: flex-start; }
.tl-build.is-right { border-style: solid; border-color: var(--ok); background: var(--ok-soft); }
.tl-build.is-wrong { border-style: solid; border-color: var(--bad); background: var(--bad-soft); }
.tl-bank { display: flex; flex-wrap: wrap; gap: 6px; }
.tl-word { height: 36px; padding: 0 12px; border: 1px solid var(--rule); border-radius: 9px; background: var(--panel); font-size: 15px; font-weight: 500; box-shadow: var(--shadow-1); transition: transform var(--dur-2) var(--spring), opacity var(--dur-1); }
.tl-word:active { transform: scale(.95); }
.tl-word.is-used { opacity: .25; pointer-events: none; box-shadow: none; }

/* итог занятия */
.tl-done { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 36px 20px; text-align: center; }
.tl-done-ic { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 16px; background: var(--ok-soft); color: var(--ok); animation: ui-scale-in var(--dur-3) var(--spring) backwards; }
.tl-done h2 { font-size: 22px; font-weight: 600; letter-spacing: -.025em; color: var(--ink); text-transform: none; }
.tl-done p { max-width: 40ch; color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.tl-done .ui-kpis { width: 100%; margin-top: 6px; text-align: left; }

/* ---------- разговор ---------- */
.tl-mic { position: relative; display: grid; place-items: center; flex: none; width: 60px; height: 60px; border: 0; border-radius: 50%; background: var(--primary); color: var(--primary-fg); box-shadow: var(--shadow-2); transition: transform var(--dur-2) var(--spring), background-color var(--dur-1); -webkit-tap-highlight-color: transparent; }
.tl-mic:active { transform: scale(.94); }
.tl-mic.is-live { background: var(--bad); color: #fff; }
.tl-mic.is-live::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--bad); opacity: .5; animation: tl-pulse 1.2s var(--ease-out) infinite; }
.tl-mic.is-sm { width: 44px; height: 44px; box-shadow: var(--shadow-1); }
.tl-mic:disabled { opacity: .5; }
@keyframes tl-pulse { from { transform: scale(.9); opacity: .6; } to { transform: scale(1.25); opacity: 0; } }
.tl-mic-row { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 6px 0; }
.tl-mic-hint { font-size: 12.5px; color: var(--muted); text-align: center; min-height: 1.5em; }

.tl-phrase { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--rule-soft); }
.tl-phrase:last-child { border-bottom: 0; }
.tl-phrase-main { flex: 1; min-width: 0; }
.tl-score { font-family: var(--mono); font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 6px; }
.tl-score.is-ok { background: var(--ok-soft); color: var(--ok); }
.tl-score.is-mid { background: var(--warn-soft); color: var(--warn); }
.tl-score.is-bad { background: var(--bad-soft); color: var(--bad); }

.tl-chat { display: flex; flex-direction: column; gap: 10px; }
.tl-msg { max-width: 86%; display: flex; flex-direction: column; gap: 4px; animation: ui-fade-up var(--dur-2) var(--ease-out) backwards; }
.tl-msg-b { padding: 10px 13px; border-radius: 14px; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.tl-msg.is-p { align-self: flex-start; }
.tl-msg.is-p .tl-msg-b { background: var(--panel); border: 1px solid var(--rule); border-bottom-left-radius: 5px; }
.tl-msg.is-u { align-self: flex-end; align-items: flex-end; }
.tl-msg.is-u .tl-msg-b { background: var(--primary); color: var(--primary-fg); border-bottom-right-radius: 5px; }
.tl-msg-ru { font-size: 12px; color: var(--muted); padding: 0 4px; }
.tl-msg-tools { display: flex; align-items: center; gap: 2px; }
.tl-fix { align-self: flex-end; max-width: 86%; padding: 9px 12px; border-radius: 10px; background: var(--warn-soft); font-size: 13px; line-height: 1.5; color: var(--ink-2); animation: ui-fade-up var(--dur-2) var(--ease-out) backwards; }
.tl-fix b { display: block; font-size: 14px; font-weight: 600; color: var(--ink); }
.tl-fix.is-ok { background: var(--ok-soft); }
.tl-typing { display: inline-flex; gap: 4px; padding: 14px 14px; }
.tl-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); animation: tl-blink 1.2s infinite; }
.tl-typing i:nth-child(2) { animation-delay: .2s; }
.tl-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes tl-blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
.tl-composer { display: flex; align-items: center; gap: 8px; }
.tl-composer .ui-input { height: 44px; font-size: 15px; border-radius: 12px; }
.tl-tasks { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin: 0; padding: 0; list-style: none; font-size: 13px; color: var(--ink-2); }
.tl-tasks li { display: flex; align-items: flex-start; gap: 8px; }
.tl-tasks .tl-check { width: 18px; height: 18px; margin-top: 1px; }
.tl-tasks li.is-done .tl-check { background: var(--ok); border-color: var(--ok); color: var(--panel); }
.tl-tasks li.is-done { color: var(--muted); }

/* ---------- письмо ---------- */
.tl-text { min-height: 150px; font-size: 15px !important; line-height: 1.6; }
.tl-fixes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin: 0; padding: 0; list-style: none; }
.tl-fixes li { padding: 10px 12px; border: 1px solid var(--rule-soft); border-radius: 10px; background: var(--panel-2); font-size: 13px; line-height: 1.5; }
.tl-fixes del { color: var(--bad); text-decoration-color: color-mix(in srgb, var(--bad) 50%, transparent); }
.tl-fixes ins { color: var(--ok); text-decoration: none; font-weight: 600; }
.tl-fixes small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.tl-quote { padding: 12px 14px; border-left: 3px solid var(--ai); background: var(--panel-2); border-radius: 0 10px 10px 0; font-size: 14.5px; line-height: 1.6; color: var(--ink); white-space: pre-wrap; }

/* ---------- грамматика ---------- */
.tl-pattern { padding: 12px 14px; border-radius: 10px; background: var(--ai-soft); font-family: var(--mono); font-size: 13px; line-height: 1.6; color: var(--ink); overflow-wrap: anywhere; }
.tl-examples { margin: 0; padding: 0; list-style: none; }
.tl-prose { font-size: 14px; line-height: 1.65; color: var(--ink-2); }
.tl-prose h3 { margin: 22px 0 6px; font-size: 15px; font-weight: 600; color: var(--ink); text-transform: none; }
.tl-prose p + p { margin-top: 10px; }
.tl-prose ul { margin: 8px 0 0; padding-left: 20px; }
.tl-prose li + li { margin-top: 5px; }
.tl-prose a { color: var(--link); text-underline-offset: 3px; }
.tl-prose b { color: var(--ink); font-weight: 600; }

/* ---------- прогресс ---------- */
.tl-heat { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 4px; }
.tl-heat i { aspect-ratio: 1; border-radius: 4px; background: var(--hover); }
.tl-heat i[data-v='1'] { background: color-mix(in srgb, var(--ai) 30%, var(--hover)); }
.tl-heat i[data-v='2'] { background: color-mix(in srgb, var(--ai) 60%, var(--hover)); }
.tl-heat i[data-v='3'] { background: var(--ai); }
.tl-heat i.is-today { box-shadow: 0 0 0 1.5px var(--panel), 0 0 0 3px var(--faint); }
.tl-levels { display: grid; gap: 12px; }
.tl-levels > div { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: 12.5px; }
.tl-levels em { font-style: normal; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.tl-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.tl-chart text { font-family: var(--mono); font-size: 10.5px; fill: var(--muted); }
.tl-chart .v { fill: var(--ink-2); font-weight: 600; }
.tl-chart rect { fill: var(--ai); }
.tl-chart rect.is-zero { fill: var(--hover); }
.tl-chart line { stroke: var(--rule); }

/* ---------- слова: список ---------- */
.tl-wordlist { margin: 0; padding: 0; list-style: none; }
.tl-wordlist li { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--rule-soft); }
.tl-wordlist li:last-child { border-bottom: 0; }
.tl-wordlist .tl-row-main b { font-size: 14px; }
.tl-mem { display: inline-flex; gap: 2px; }
.tl-mem i { width: 4px; height: 12px; border-radius: 2px; background: var(--hover); }
.tl-mem i.on { background: var(--ai); }

/* ---------- знакомство ---------- */
.tl-welcome { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; gap: 18px; padding: 24px 0; }
.tl-welcome h1 { font-size: clamp(24px, 5vw, 32px); font-weight: 600; letter-spacing: -.03em; line-height: 1.15; text-wrap: balance; }
.tl-welcome > p { font-size: 15px; line-height: 1.6; color: var(--ink-2); }
.tl-pick { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.tl-pick .tl-opt { flex-direction: row; }
.tl-pick .tl-opt span { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tl-pick .tl-opt small { font-size: 12.5px; font-weight: 400; color: var(--muted); }
.tl-pick .tl-opt.is-on { border-color: var(--ink); box-shadow: 0 0 0 3px var(--primary-soft); }

@media (max-width: 768px) {
  .tl-q { padding: 18px 16px; }
  .tl-msg, .tl-fix { max-width: 92%; }
  .tl-heat { gap: 3px; }
}
@media (prefers-reduced-motion: reduce) {
  .tl-mic.is-live::after, .tl-typing i { animation: none; }
}

/* ---------- правки после проверки ---------- */
.tl-q #after:not(:empty), .tl-q #explain-out:not(:empty) { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.tl-ipa { font-family: var(--font); letter-spacing: .01em; }
/* четыре показателя в ряд помещаются и на планшете: значения короткие */
@media (min-width: 941px) and (max-width: 1200px) { .ui-kpis.tl-k4[data-cols='4'] { --cols: 4; } }
@media (min-width: 769px) and (max-width: 940px) { .ui-kpis.tl-k4[data-cols='4'] { --cols: 2; } }
.tl-q-ex .tl-en .tl-score { flex: none; align-self: flex-start; }
.tl-phrase .tl-mic { background: var(--hover); color: var(--ink); box-shadow: none; }
.tl-phrase .tl-mic.is-live { background: var(--bad); color: #fff; }
.tl-slow { font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: -.02em; }
.tl-mic .tl-slow { font-size: 12px; }

/* ---------- несколько курсов ---------- */
.tl-read { font-size: 12.5px; line-height: 1.45; color: var(--ai); }
.tl-course { gap: 5px; padding: 0 8px 0 10px; font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.tl-course .icon { color: var(--faint); }
.tl-course-tag { display: grid; place-items: center; flex: none; width: 30px; height: 24px; border-radius: 6px; background: var(--hover); font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--ink-2); }
.ui-menu-item.is-on .tl-course-tag { background: var(--ai-soft); color: var(--ai); }
.tl-reveal { border: 0; background: none; padding: 0 4px; font-size: 12px; color: var(--link); }
.tl-reveal:hover { text-decoration: underline; text-underline-offset: 3px; }
:lang(ja) .tl-q-word h2, .tl-ja .tl-q-word h2 { letter-spacing: 0; }

/* ---------- язык интерфейса: KZ | RU ---------- */
.tl-lang button { min-width: 30px; }
.tl-auth-main { position: relative; }
.tl-auth-lang { position: absolute; top: 16px; right: 16px; background: var(--panel); }
@media (max-width: 768px) {
  .ui-topbar .ui-lang.tl-lang { display: inline-flex; }
  .tl-lang button { padding: 6px 7px; }
  .ui-topbar-right { gap: 4px; }
}
@media (max-width: 400px) { .ui-topbar .tl-streak { display: none; } }
