/* ---------- Палитры. data-palette: flagyellow | flag | yellow. data-theme: light | dark (ставится скриптом) ---------- */
:root {
  --radius: 16px;
  --thai: "Noto Sans Thai", "Leelawadee UI", "Thonburi", "Tahoma", system-ui, sans-serif;
  --ui: "Noto Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --green: #2f8f5b; --red: #a51931; --orange: #d08a1f; --blue: #2f6fb3; --purple: #7b5fb8; --pink: #c0568f;
  /* цвета дней недели для колод */
  --day-mon: #f5c518; --day-tue: #e58ab4; --day-wed: #3fa56b; --day-thu: #f28c28; --day-fri: #5ba8d6; --day-sat: #8e6bc1; --day-sun: #d64550;
}
/* 3. Флаг + жёлтый (по умолчанию) */
:root, :root[data-palette="flagyellow"] {
  color-scheme: light;
  --bg: #f7f7f9; --card: #ffffff; --text: #1e1d33; --muted: #6b6a80; --line: #e3e3ec;
  --primary-bg: #2d2a4a; --primary-text: #ffffff;
  --accent: #8a6d00; --accent-surface: #f5c518; --accent-on: #1e1d33; --accent-soft: #fff3c4;
  --link: #2d2a4a;
  --shadow: 0 1px 2px rgba(20,20,60,.06), 0 8px 24px rgba(20,20,60,.06);
}
:root[data-theme="dark"], :root[data-theme="dark"][data-palette="flagyellow"] {
  color-scheme: dark;
  --bg: #16152a; --card: #222040; --text: #f2f1f7; --muted: #a3a1be; --line: #33314f;
  --primary-bg: #f5c518; --primary-text: #1e1d33;
  --accent: #f5c518; --accent-surface: #f5c518; --accent-on: #1e1d33; --accent-soft: #3a3520;
  --link: #f5c518;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.3);
}
/* 1. Флаг */
:root[data-palette="flag"] {
  --bg: #f8f7f5; --card: #ffffff; --text: #1f1e33; --muted: #6c6b7c; --line: #e5e3e0;
  --primary-bg: #2d2a4a; --primary-text: #ffffff;
  --accent: #a51931; --accent-surface: #a51931; --accent-on: #ffffff; --accent-soft: #f6dfe3;
  --link: #a51931;
}
:root[data-theme="dark"][data-palette="flag"] {
  --bg: #1b1a2e; --card: #26253f; --text: #f1f0f6; --muted: #a2a0b8; --line: #38364f;
  --primary-bg: #c8324a; --primary-text: #ffffff;
  --accent: #f07085; --accent-surface: #c8324a; --accent-on: #ffffff; --accent-soft: #452031;
  --link: #f07085;
}
/* 2. Королевский жёлтый */
:root[data-palette="yellow"] {
  --bg: #fffbef; --card: #ffffff; --text: #3a2e1f; --muted: #7a6b57; --line: #ede3cc;
  --primary-bg: #f2c230; --primary-text: #3a2e1f;
  --accent: #9c6b00; --accent-surface: #f2c230; --accent-on: #3a2e1f; --accent-soft: #fbebb5;
  --link: #9c6b00;
  --shadow: 0 1px 2px rgba(80,60,0,.06), 0 8px 24px rgba(80,60,0,.07);
}
:root[data-theme="dark"][data-palette="yellow"] {
  --bg: #1e1a14; --card: #2a2419; --text: #f5eedd; --muted: #b3a688; --line: #3e362a;
  --primary-bg: #f2c230; --primary-text: #2a2419;
  --accent: #f2c230; --accent-surface: #f2c230; --accent-on: #2a2419; --accent-soft: #3f3518;
  --link: #f2c230;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--ui); font-size: 16px; line-height: 1.45; -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; -webkit-text-size-adjust: 100%; }
button, .card, .item { touch-action: manipulation; }
a { color: var(--link); text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; border-radius: 12px; padding: 10px 16px; background: var(--card); color: var(--text); box-shadow: var(--shadow); }
button:active { transform: translateY(1px); }
button.primary { background: var(--primary-bg); color: var(--primary-text); }
button.ghost { background: transparent; box-shadow: none; color: var(--muted); }
button:disabled { opacity: .5; cursor: default; }
input, textarea, select { font: inherit; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); }
textarea { min-height: 90px; resize: vertical; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.thai { font-family: var(--thai); }
.hidden { display: none !important; }

header.top { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); }
header.top { padding-top: env(safe-area-inset-top); }
header.top .bar { max-width: 760px; margin: 0 auto; padding: 10px calc(16px + env(safe-area-inset-right)) 10px calc(16px + env(safe-area-inset-left)); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
header.top .brand { font-weight: 700; font-size: 18px; }
header.top .brand span { color: var(--accent); }
header.top nav { margin-left: auto; display: flex; gap: 4px; }
header.top nav a { padding: 6px 10px; border-radius: 10px; color: var(--muted); font-size: 14px; }
header.top nav a.active { background: var(--accent-soft); color: var(--accent); }
header.top .userbox { font-size: 13px; white-space: nowrap; }
header.top .netbox { font-size: 12px; white-space: nowrap; }
header.top .netbox .off { color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }
header.top .netbox .sync { padding: 3px 9px; font-size: 12px; background: var(--accent-surface); color: var(--accent-on); box-shadow: none; border-radius: 999px; }
.offline-note { background: var(--accent-soft); color: var(--text); border-radius: 12px; padding: 10px 14px; font-size: 14px; margin: 0 0 12px; }
header.top .userbox a { margin-left: 4px; }
.login { display: flex; justify-content: center; padding-top: 24px; }
.login .card { max-width: 440px; width: 100%; }
@media (max-width: 480px) { header.top .userbox span { display: none; } header.top .brand { font-size: 16px; } }
@media (max-width: 380px) { header.top nav a { padding: 6px 5px; font-size: 13px; } }
body { overflow-x: hidden; }

main { max-width: 760px; margin: 0 auto; padding: 16px calc(16px + env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left)); }
.install { background: var(--card); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); margin-bottom: 16px; display: flex; gap: 12px; align-items: center; }
.install img { width: 48px; height: 48px; border-radius: 12px; flex: none; }
.install .txt { flex: 1; font-size: 14px; }
.install .txt b { display: block; font-size: 15px; }
.ios-steps { font-size: 14px; line-height: 1.6; }
.ios-steps .ico { display: inline-block; width: 22px; height: 22px; vertical-align: middle; margin: 0 2px; }
.toast button { margin-left: 10px; padding: 4px 10px; font-size: 13px; background: var(--accent-surface); color: var(--accent-on); box-shadow: none; }
h1 { font-size: 22px; margin: 8px 0 16px; }
h2 { font-size: 17px; margin: 20px 0 10px; }
.muted { color: var(--muted); font-size: 14px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }

.decks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.deck { background: var(--card); border-radius: var(--radius); padding: 16px 16px 16px 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; border-left: 6px solid var(--deck-color, var(--line)); }
.deck[data-deck="consonants"] { --deck-color: var(--day-mon); } .deck[data-deck="vowels"] { --deck-color: var(--day-tue); } .deck[data-deck="tones"] { --deck-color: var(--day-wed); }
.deck[data-deck="numbers"] { --deck-color: var(--day-thu); } .deck[data-deck="days"] { --deck-color: var(--day-sun); } .deck[data-deck="months"] { --deck-color: #2aa198; }
.deck[data-deck="basic"] { --deck-color: var(--day-sat); } .deck[data-deck="vocab"] { --deck-color: var(--day-fri); } .deck[data-deck="user"] { --deck-color: var(--muted); }
.deck .title { font-weight: 700; font-size: 17px; }
.deck .stats { display: flex; gap: 10px; font-size: 13px; color: var(--muted); }
.deck .stats b { color: var(--text); }
.deck .stats .due b { color: var(--accent); }
.deck .actions { display: flex; gap: 6px; margin-top: auto; }
.deck .actions button { padding: 8px 12px; font-size: 14px; flex: 1; }
.banner { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.banner .big { font-size: 28px; font-weight: 700; color: var(--accent); }

.card-wrap { perspective: 1200px; margin: 12px 0; }
.card { background: var(--card); border-radius: 20px; box-shadow: var(--shadow); min-height: 300px; padding: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; cursor: pointer; user-select: none; position: relative; }
.thai-big { font-family: var(--thai); font-size: 96px; line-height: 1.15; }
.thai-mid { font-family: var(--thai); font-size: 44px; line-height: 1.2; }
.day-dot { width: 36px; height: 36px; border-radius: 50%; display: inline-block; margin: 8px auto 0; border: 2px solid var(--line); }
.day-dot.big { width: 90px; height: 90px; margin-bottom: 8px; }
.translit { font-size: 24px; color: var(--accent); margin-top: 4px; }
.meaning { font-size: 22px; margin-top: 6px; }
.meaning-en { color: var(--muted); font-size: 16px; }
.card .sub { color: var(--muted); font-size: 14px; margin-top: 8px; white-space: pre-line; }
.card .example { margin-top: 12px; font-size: 15px; white-space: pre-line; background: var(--bg); border-radius: 10px; padding: 8px 12px; }
.card img { max-height: 160px; max-width: 70%; border-radius: 12px; margin: 8px 0; mix-blend-mode: multiply; }
:root[data-theme="dark"] .card img { mix-blend-mode: normal; background: #f3f1ea; padding: 6px; }
.card .hint { position: absolute; bottom: 10px; left: 0; right: 0; font-size: 12px; color: var(--muted); }
.card .tags { margin-top: 8px; }
.chip { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); margin: 2px; }
.chip.cls-mid { background: #e0ecf9; color: var(--blue); }
.chip.cls-high { background: #ece5f7; color: var(--purple); }
.chip.cls-low { background: #f9e2ee; color: var(--pink); }
.chip.short { background: #f9e2ee; color: var(--pink); }
.chip.long { background: #ece5f7; color: var(--purple); }

.rate { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.rate button { padding: 14px 6px; font-weight: 600; color: #fff; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.rate button small { font-weight: 400; opacity: .85; font-size: 12px; }
.rate .r1 { background: var(--red); } .rate .r2 { background: var(--orange); } .rate .r3 { background: var(--green); } .rate .r4 { background: var(--blue); }
.progressbar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 8px 0; }
.progressbar div { height: 100%; background: var(--accent-surface); transition: width .2s; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.speak { background: var(--accent-soft); color: var(--accent); padding: 8px 12px; border-radius: 999px; box-shadow: none; }
.palette-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.palette-opt { border: 2px solid var(--line); border-radius: 12px; padding: 10px; cursor: pointer; background: var(--card); box-shadow: none; text-align: left; display: flex; flex-direction: column; gap: 6px; }
.palette-opt.active { border-color: var(--accent-surface); }
.palette-opt .sw { display: flex; gap: 4px; } .palette-opt .sw i { display: block; width: 22px; height: 22px; border-radius: 6px; }
.theme-row button.active { background: var(--accent-soft); color: var(--accent); }

.list { display: flex; flex-direction: column; gap: 6px; }
.item { background: var(--card); border-radius: 12px; padding: 10px 14px; display: flex; gap: 12px; align-items: center; box-shadow: var(--shadow); cursor: pointer; }
.item .thai { font-size: 26px; min-width: 90px; }
.item .info { flex: 1; min-width: 0; }
.item .info .tr { color: var(--accent); font-size: 14px; }
.item .info .m { font-size: 15px; }
.item .state { font-size: 12px; color: var(--muted); text-align: right; white-space: nowrap; }
.item .state.due { color: var(--accent); }
.item .state.learned { color: var(--green); }

.quiz .q { background: var(--card); border-radius: 20px; padding: 28px 24px; text-align: center; box-shadow: var(--shadow); margin: 12px 0; min-height: 200px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.quiz .q .thai-big { font-size: 120px; }
.quiz .q .meaning { font-size: 30px; }
.quiz .opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quiz .opts button { padding: 16px 10px; font-size: 18px; min-height: 64px; }
.quiz .opts button.thai { font-size: 40px; line-height: 1.3; }
.quiz .opts button.ok { background: var(--green); color: #fff; }
.quiz .opts button.bad { background: var(--red); color: #fff; }
.quiz img { max-height: 160px; }

.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.modal { background: var(--card); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 20px; }
@media (min-width: 640px) { .modal-bg { align-items: center; } .modal { border-radius: 20px; } }
.toast { position: fixed; bottom: calc(20px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; z-index: 30; font-size: 14px; max-width: 90vw; }
.toast.err { background: var(--red); color: #fff; }
.settings section { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.settings h2 { margin-top: 0; }
kbd { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; font-size: 12px; }
.done { text-align: center; padding: 40px 16px; }
.done .big { font-size: 48px; }
.stats-grid { display: flex; gap: 3px; align-items: flex-end; height: 60px; margin-top: 8px; }
.stats-grid div { flex: 1; background: var(--accent-surface); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .9; }
@media (max-width: 480px) { .thai-big { font-size: 80px; } .quiz .q .thai-big { font-size: 96px; } .quiz .opts button.thai { font-size: 34px; } h1 { font-size: 20px; } .rate button small { display: none; } header.top .bar { gap: 8px; padding: 10px 12px; } header.top nav a { padding: 6px 7px; } }

/* письмо */
.write-prompt { background: var(--card); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow); text-align: center; margin: 12px 0; }
.write-prompt img { max-height: 90px; border-radius: 10px; mix-blend-mode: multiply; }
:root[data-theme="dark"] .write-prompt img { mix-blend-mode: normal; background: #f3f1ea; padding: 4px; }
.write-prompt .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.pad-wrap { display: flex; justify-content: center; }
canvas.pad { touch-action: none; border-radius: 16px; box-shadow: var(--shadow); cursor: crosshair; max-width: 100%; display: block; }
.pad-tools { margin-top: 10px; }
.pad-tools button.active { background: var(--accent-soft); color: var(--accent); }
.write-result { background: var(--card); border-radius: 12px; padding: 12px 14px; margin: 12px 0 4px; box-shadow: var(--shadow); border-left: 6px solid var(--green); }
.write-result.bad { border-left-color: var(--orange); }
.write-answer { font-size: 34px; margin-top: 4px; }
.write-answer .translit { font-size: 18px; }
.deck .actions { flex-wrap: wrap; }
.deck .actions button { min-width: 70px; }
.dir-line { font-size: 14px; margin-top: 4px; } .dir-line .ok { color: var(--green); } .dir-line .bad { color: var(--orange); }
input[type="search"] { -webkit-appearance: none; appearance: none; }
input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; }
.view-card .view-rows { text-align: center; }
.view-card .view-img { max-height: 140px; border-radius: 12px; margin: 6px 0; mix-blend-mode: multiply; }
:root[data-theme="dark"] .view-card .view-img { mix-blend-mode: normal; background: #f3f1ea; padding: 4px; }
.view-card .view-block { text-align: left; background: var(--bg); border-radius: 10px; padding: 8px 12px; margin-top: 10px; }
.view-card .view-label { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.view-card .view-text { white-space: pre-line; font-size: 15px; }
.card.browse { cursor: default; border: 2px dashed var(--line); }
.card.answer { cursor: default; min-height: 0; margin-top: 12px; padding: 18px; }
.card.answer .thai-mid { font-size: 40px; }
.card.swipeable { touch-action: pan-y; will-change: transform; }

/* подсказки по буквам */
.hint-box { margin: 10px 0; }
.hint-box:empty { display: none; }
.letters-box { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 10px 12px; }
.letters { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.lt { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 46px; padding: 6px 8px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); box-shadow: none; }
.lt .g { font-size: 28px; line-height: 1.15; }
.lt .s { font-size: 14px; font-weight: 600; color: var(--accent); min-height: 18px; }
.lt .r { font-size: 11px; color: var(--muted); min-height: 14px; }
.lt.grp.on { background: var(--accent-soft); border-color: transparent; }
.lt-tone .g, .lt-sign .g { color: var(--orange); }
.lt-silent .g, .lt-silent .s { opacity: .55; }
.lt-ghost { border-style: dashed; }
.lt.blank .g { color: var(--muted); }
.lt-detail { display: flex; gap: 10px; align-items: center; margin-top: 8px; padding: 8px 10px; background: var(--bg); border-radius: 10px; font-size: 14px; text-align: left; }
.lt-detail b { font-size: 26px; line-height: 1; }
.lt-detail img { height: 46px; border-radius: 8px; margin-left: auto; mix-blend-mode: multiply; }
:root[data-theme="dark"] .lt-detail img { mix-blend-mode: normal; background: #f3f1ea; padding: 3px; }
.lt-act { display: block; margin: 8px auto 0; }
.lt-note { margin: 6px 0 0; text-align: center; }
.letters-box.compact { padding: 6px; margin-bottom: 6px; }
.letters-box.compact .lt { min-width: 34px; padding: 3px 5px; }
.letters-box.compact .lt .g { font-size: 20px; }
.letters-box.compact .lt .s { font-size: 12px; min-height: 16px; }
.letters-box.compact .lt .r { display: none; }
@media (max-width: 480px) { .lt { min-width: 40px; padding: 5px 6px; } .lt .g { font-size: 24px; } }

/* ---------- задания дня ---------- */
.today { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; }
.today-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.today-head h1 { margin: 0; font-size: 22px; }
.today-state { font-size: 14px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; white-space: nowrap; }
.today-state.ok { color: var(--green); border-color: var(--green); }
.task { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.task .ic { font-size: 22px; width: 30px; text-align: center; }
.task .t { font-weight: 600; }
.task .n { font-size: 15px; font-weight: 700; white-space: nowrap; }
.task .n .muted { font-weight: 400; }
.task button { padding: 8px 14px; font-size: 14px; }
.task.done .t, .task.done .ic { color: var(--green); }
.progressbar.small { height: 4px; margin: 6px 0 0; }

/* ---------- уровни знания ---------- */
.lvbar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--line); }
.lvbar i { display: block; height: 100%; }
.lv-mastered { background: var(--green); }
.lv-known { background: var(--accent-surface); }
.lv-learning { background: var(--blue); }
.lv-new { background: var(--line); }
.lvlegend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.lvlegend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.lvlegend b { color: var(--text); }
.mastery { background: var(--card); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); margin-bottom: 16px; cursor: pointer; }
.mastery .row { margin-bottom: 8px; }
.section-h { font-size: 16px; color: var(--muted); font-weight: 600; margin: 0 0 10px; }
.deck .lvbar { height: 8px; }

/* ---------- прогресс ---------- */
.progress-page section { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; }
.progress-page section h2 { margin: 0 0 10px; font-size: 17px; }
.progress-page p { font-size: 15px; }
.chart { display: flex; gap: 2px; align-items: flex-end; height: 90px; margin: 10px 0 4px; }
.chart.small { height: 34px; }
.chart .col { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.chart i { display: block; width: 100%; border-radius: 3px 3px 0 0; min-height: 2px; }
.chart i.known { background: var(--green); }
.chart i.rev { background: var(--accent-surface); }
.stages { display: flex; flex-direction: column; gap: 12px; }
.stage { border-left: 4px solid var(--line); padding-left: 12px; }
.stage.cur { border-color: var(--accent-surface); }
.stage.done { border-color: var(--green); }
.stage.done b { color: var(--green); }
.deck-levels { display: flex; flex-direction: column; gap: 12px; }
.cal { display: grid; grid-template-rows: repeat(7, 14px); grid-auto-flow: column; grid-auto-columns: 14px; gap: 4px; justify-content: start; }
.cal i { display: block; width: 14px; height: 14px; border-radius: 3px; background: var(--line); }
.cal i.some { background: var(--accent-soft); }
.cal i.done { background: var(--green); }

/* ---------- упражнения ---------- */
.quiz .opts button:disabled { opacity: 1; color: var(--muted); }
.quiz .opts button.ok:disabled, .quiz .opts button.bad:disabled { color: #fff; }
.card.answer.ok { border-left: 4px solid var(--green); }
.card.answer.bad { border-left: 4px solid var(--red); }
.card.answer .hint { margin-top: 8px; }
.task .done-mark { white-space: nowrap; color: var(--green); }
@media (max-width: 480px) {
  .today-head { flex-wrap: wrap; }
  .today-head h1 { font-size: 19px; }
  .task { gap: 8px; }
  .task .ic { width: 22px; font-size: 18px; }
  .task button { padding: 8px 10px; font-size: 13px; }
  .task .muted { font-size: 13px; }
  .progress-page .banner .big { font-size: 24px; }
}

/* ---------- диалоги ---------- */
.dlg-tile .muted { font-size: 14px; }
.dlg-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; }
.dlg-item .ic { width: 30px; height: 30px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 700;
  display: flex; align-items: center; justify-content: center; font-size: 14px; flex: none; }
.dlg-item.passed .ic { background: var(--green); color: #fff; }
.dlg-item .t { font-weight: 600; }
.dlg-item .n { font-size: 13px; white-space: nowrap; }
.dialogs-page, .dialog-page, .dlg-setup { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.dlg-setup h1, .dlg-head h1 { margin: 0 0 4px; font-size: 22px; }
.dlg-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.dlg-gender { margin-top: 12px; }
.dlg-gender .lbl { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.dlg-gender button { flex: 1; }
.dlg-gender button.active { background: var(--primary-bg); color: var(--primary-text); }
.dlg-lines { margin: 14px 0; display: flex; flex-direction: column; gap: 12px; }
.dlg-line { display: flex; align-items: flex-end; gap: 6px; }
.dlg-line.b { flex-direction: row-reverse; }
.dlg-line .who { display: none; }
.dlg-line .bubble { background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 10px 14px; max-width: 78%; }
.dlg-line.a .bubble { border-bottom-left-radius: 4px; }
.dlg-line.b .bubble { border-bottom-right-radius: 4px; background: var(--accent-soft); border-color: transparent; }
.dlg-line .tr { font-size: 19px; font-weight: 600; line-height: 1.45; }
.dlg-line .ru { color: var(--muted); font-size: 14px; margin-top: 4px; }
.dlg-line .thai { font-family: var(--thai); font-size: 22px; margin-top: 6px; line-height: 1.6; }
.dlg-line .note { font-size: 13px; margin-top: 6px; border-top: 1px dashed var(--line); padding-top: 6px; }
.dlg-line .show-thai { font-size: 13px; padding: 4px 10px; margin-top: 6px; }
.dlg-line .speak.sm { padding: 6px 9px; font-size: 14px; align-self: flex-end; flex: none; }
.dlg-line.fresh .bubble { animation: dlgIn .22s ease-out; }
@keyframes dlgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.dw { background: none; border: none; box-shadow: none; padding: 0; font: inherit; color: inherit; cursor: pointer;
  border-bottom: 1px dashed var(--accent); border-radius: 0; }
.dw:hover { color: var(--accent); }
.dlg-actions { margin-top: 4px; }
.modal.dlg-word .thai-big { font-family: var(--thai); }
@media (max-width: 480px) {
  .dlg-line .bubble { max-width: 86%; }
  .dlg-line .tr { font-size: 17px; }
  .dlg-head h1 { font-size: 19px; }
}
