/* ---------- Друзі → Чати (js/pages/chats.js): список, чат, голосові, виправлення, виклики ---------- */
.ch-ava{border-radius:12px}
.ch-list .ch-row{min-height:64px}
.ch-row .tx-body{min-width:0}
.ch-prev{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block}
.ch-row.unread .tx-l{font-weight:700}
.ch-row.unread .ch-prev{color:var(--ink)}
.ch-meta{display:flex;flex-direction:column;align-items:flex-end;gap:5px;flex:none;margin-left:6px}
.ch-time{font-size:var(--fs-xs);color:var(--ink-dim);font-variant-numeric:tabular-nums;white-space:nowrap}
.ch-badge{min-width:22px;height:22px;padding:0 7px;border-radius:11px;background:var(--accent-grad);color:#fff;font-family:var(--font-head);font-size:12px;display:grid;place-items:center;font-variant-numeric:tabular-nums}
.ch-muted{color:var(--ink-dim);opacity:.7;display:inline-flex}

/* вибір друзів (шторка) */
.ch-sheet{gap:12px}
.ch-pick-list{max-height:min(52vh,420px);overflow-y:auto;-webkit-overflow-scrolling:touch}
.ch-pick{width:100%;text-align:left;font:inherit;color:inherit;cursor:pointer}
.ch-check{width:24px;height:24px;flex:none;border-radius:8px;border:2px solid var(--field-edge,var(--line-strong,#8A94A8));display:grid;place-items:center;color:transparent;margin-left:auto}
.ch-pick.on .ch-check{background:var(--accent-grad);border-color:transparent;color:#fff}
.ch-danger .tx-l,.ch-danger .tx-sq{color:var(--bad)}

/* чат */
.ch-room{display:flex;flex-direction:column;gap:10px;min-height:calc(100dvh - 220px)}
.ch-title{gap:10px}
.ch-title .tx-body{min-width:0}
.ch-title .tx-s{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block}
.ch-title .icon-btn{flex:none;border-radius:12px}
.ch-strip:empty{display:none}
.ch-older{align-self:center}
.ch-older[hidden]{display:none}
.ch-msgs{display:flex;flex-direction:column;gap:6px;flex:1;padding-bottom:6px}
.ch-day{align-self:center;font-size:var(--fs-xs);color:var(--ink-dim);background:var(--tile-sq);border-radius:10px;padding:3px 10px;margin:8px 0 2px}
.ch-empty{display:flex;flex-direction:column;align-items:center;gap:6px;text-align:center;color:var(--ink-dim);padding:36px 12px;margin:auto 0}
.ch-wrap{display:flex;flex-direction:column;max-width:86%}
.ch-wrap.me{align-self:flex-end;align-items:flex-end}
.ch-wrap.ai{align-self:flex-start;align-items:flex-start}
.ch-wrap .msg{max-width:100%}
.ch-msg{border-radius:18px;padding:9px 12px 6px;cursor:pointer;-webkit-tap-highlight-color:transparent;position:relative}
.ch-msg.me{background:var(--accent-grad);color:#fff;border:0;border-bottom-right-radius:6px;box-shadow:0 6px 16px -10px rgba(30,58,138,.55)}
.ch-msg.ai{background:var(--tile);border:1px solid var(--tile-edge);border-bottom-left-radius:6px;box-shadow:var(--tile-shadow)}
.ch-msg:focus-visible{outline:2px solid var(--accent-ink);outline-offset:2px}
.ch-name{font-size:var(--fs-xs);font-weight:700;color:var(--accent-ink);margin-bottom:2px}
.ch-text{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.42}
.ch-tr{font-size:var(--fs-sm);margin-top:6px;opacity:.95}
.ch-ts{display:block;text-align:right;font-size:11px;opacity:.7;margin-top:2px;font-variant-numeric:tabular-nums}
.ch-del{font-style:italic;opacity:.7;padding:8px 12px;font-size:var(--fs-sm)}
.msg.me.ch-del{background:var(--tile-sq);color:var(--ink-dim);box-shadow:none}
.msg.sys{max-width:90%}
/* помилка в моєму повідомленні — підкреслення хвилькою, дотик → «Як краще» */
mark.ch-err{background:transparent;color:inherit;text-decoration:underline wavy #FFB4A6;text-decoration-thickness:1.5px;text-underline-offset:3px;cursor:pointer}
.ch-msg.ai mark.ch-err{text-decoration-color:var(--bad)}
.ch-fixes{display:inline-flex;align-items:center;gap:5px;margin-top:4px;border:0;background:var(--warn-soft);color:var(--warn);font:inherit;font-size:var(--fs-xs);font-weight:700;border-radius:10px;padding:5px 10px;min-height:32px;cursor:pointer}
.ch-checking{font-size:11px;color:var(--ink-dim);margin-top:3px}
.ch-fix{display:flex;flex-direction:column;gap:4px;background:var(--tile);border:1px solid var(--tile-edge);border-radius:14px;padding:10px 12px}
.ch-fix-w,.ch-fix-r{display:flex;align-items:center;gap:6px;overflow-wrap:anywhere}
.ch-fix-w{color:var(--bad)}
.ch-fix-r{color:var(--good)}
.ch-fix-w s{color:var(--ink-dim)}
.ch-fix-r b{color:var(--ink)}
.ch-fix .btn{align-self:flex-start}
.ch-uk{color:var(--ink-dim)}
/* голосове */
.ch-voice{display:flex;align-items:center;gap:10px;min-width:180px}
.ch-play{width:36px;height:36px;flex:none;border-radius:50%;border:0;display:grid;place-items:center;cursor:pointer;background:rgba(255,255,255,.2);color:inherit}
.ch-msg.ai .ch-play{background:var(--accent-grad);color:#fff}
.ch-wave{flex:1;height:4px;border-radius:2px;background:currentColor;opacity:.35;position:relative;overflow:hidden;min-width:60px}
.ch-wave i{position:absolute;inset:0 auto 0 0;width:0;background:currentColor;border-radius:2px}
.ch-dur{font-size:var(--fs-xs);font-variant-numeric:tabular-nums;opacity:.85}
.ch-sending{opacity:.7}
/* виклик у чаті */
.ch-card{align-self:stretch}
.ch-chal .tx-sq{background:var(--warn-soft);color:var(--warn)}
.ch-prog .tx-body{gap:6px}
.ch-val{font-family:var(--font-head);font-variant-numeric:tabular-nums;flex:none}
/* запис голосового */
.ch-rec{align-items:center}
.ch-rec-dot{width:10px;height:10px;border-radius:50%;background:var(--bad);flex:none;animation:ch-pulse 1s ease-in-out infinite}
.ch-rec-t{font-family:var(--font-head);font-variant-numeric:tabular-nums}
.ch-rec-hint{flex:1;color:var(--ink-dim);font-size:var(--fs-sm);overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
@keyframes ch-pulse{50%{opacity:.35}}
@media (prefers-reduced-motion:reduce){.ch-rec-dot{animation:none}}
.ch-dock{margin-top:auto}
/* шапка чату липне під шапкою застосунку: меню й виклик завжди під рукою */
.ch-head{position:sticky;top:calc(var(--header-h) + var(--safe-t));z-index:6;margin:-8px -6px 0;padding:8px 6px 4px;border-radius:20px;background:color-mix(in srgb,var(--bg) 82%,transparent);-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px)}
.fr-tap{cursor:pointer}
/* етап 2: «Тема дня» і дуелі */
.ch-duel .tx-sq{background:var(--accent-soft);color:var(--accent-ink)}
.ch-topic-in{align-items:flex-start;background:var(--tile);border:1px solid var(--tile-edge);box-shadow:var(--tile-shadow);border-radius:var(--r-tile,18px);padding:12px 14px;gap:12px}
.ch-topic-in .tx-sq{background:var(--accent-grad);color:#fff;flex:none}
.ch-topic-in .tx-body{display:flex;flex-direction:column;gap:5px;min-width:0}
.ch-topic-lab{text-transform:uppercase;letter-spacing:.04em;font-size:11px;font-weight:700;color:var(--accent-ink)}
.ch-topic-q{font-size:var(--fs-md);line-height:1.35;white-space:normal}
.ch-topic-btn{align-self:flex-start;margin-top:4px}
.dl-score{font-family:var(--font-head);font-variant-numeric:tabular-nums;flex:none;font-size:var(--fs-md)}
.dl-score small{font-family:var(--font-body,inherit);font-size:var(--fs-xs);color:var(--ink-dim)}
.dl-win{background:var(--accent-grad)!important;color:#fff!important}
.dl-note .tx-sq{background:var(--accent-soft);color:var(--accent-ink)}
/* нові повідомлення на «Друзі» в бічному меню */
.drawer .pc-badge{position:absolute;top:-5px;right:-5px;min-width:18px;height:18px;padding:0 5px;border-radius:9px;background:var(--accent-grad);color:#fff;font-family:var(--font-head);font-size:10px;display:grid;place-items:center;box-shadow:0 0 0 2px var(--drawer-bg,var(--bg));pointer-events:none}
/* домашнє від вчителя */
.ch-hw .tx-sq{background:var(--accent-grad);color:#fff}
.hw-note{display:flex;gap:10px;align-items:flex-start;background:var(--accent-soft);border-radius:16px;padding:10px 12px}
.hw-note .tx-sq{background:var(--accent-grad);color:#fff;flex:none}
.hw-note p{margin:0;line-height:1.45;color:var(--ink)}
.hw-task{width:100%;text-align:left;font:inherit;color:inherit;align-items:flex-start}
.hw-task .tx-body{display:flex;flex-direction:column;gap:5px;min-width:0}
.hw-task .tx-bar{margin-top:2px}
.hw-en{font-size:var(--fs-sm);line-height:1.4;color:var(--ink)}
.hw-focus{align-self:flex-start;font-size:var(--fs-xs);font-weight:700;color:var(--accent-ink);background:var(--accent-soft);border-radius:8px;padding:3px 8px}
.hw-val{flex:none;font-family:var(--font-head);font-size:var(--fs-sm);font-variant-numeric:tabular-nums;color:var(--ink-dim);white-space:nowrap}
.tx-no.hw-ok{background:var(--good-soft);color:var(--good)}
/* вчитель у групі */
.ch-msg.ch-tutor{background:var(--tile);border:1px solid color-mix(in srgb,var(--accent-ink) 35%,var(--tile-edge));box-shadow:var(--tile-shadow)}
.ch-tutor-name{display:inline-flex;align-items:center;gap:5px}
.ch-typing .typing{display:inline-flex;gap:4px;padding:6px 2px}
/* запрошення посиланням (js/invite.js) */
.inv-hero{display:flex;flex-direction:column;align-items:center;text-align:center;gap:10px;padding:24px 12px 8px}
.inv-ava{width:72px;height:72px;flex:0 0 72px;border-radius:22px;font-size:30px;background:var(--accent-grad);color:#fff}
.inv-t{font-family:var(--font-head);font-size:var(--fs-lg);line-height:1.25;color:var(--ink)}
.fr-add{flex:none}
/* пошук людей і запити в друзі (js/pages/friends.js) */
.fr-search{margin-bottom:8px}
.fr-req-acts{gap:4px;flex:none;align-items:center}
.fr-disc{gap:10px;align-items:center;margin-top:6px}
/* реакції, відповіді, підсумок тижня (2026-11-17) */
.ch-msg{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}
.ch-msg .w{cursor:pointer;border-radius:4px}
.ch-msg .w:active{background:color-mix(in srgb,currentColor 18%,transparent)}
.ch-reacts{display:flex;flex-wrap:wrap;gap:4px;margin-top:-6px;padding:0 6px;position:relative;z-index:1}
.ch-wrap.me .ch-reacts{justify-content:flex-end}
.ch-react{display:inline-flex;align-items:center;gap:3px;min-height:28px;padding:2px 8px;border-radius:14px;border:1px solid var(--tile-edge);background:var(--tile);color:var(--ink);font:inherit;font-size:12px;font-weight:700;box-shadow:var(--tile-shadow);cursor:pointer}
.ch-react.on{background:var(--accent-soft);color:var(--accent-ink);border-color:color-mix(in srgb,var(--accent-ink) 40%,transparent)}
.ch-react.tutor{cursor:default;color:var(--accent-ink)}
.ch-react-bar{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:6px}
.ch-react-pick{display:flex;flex-direction:column;align-items:center;gap:4px;padding:10px 2px;border-radius:14px;border:1px solid var(--tile-edge);background:var(--tile);color:var(--ink);font:inherit;font-size:11px;cursor:pointer;box-shadow:var(--tile-shadow);min-height:64px}
.ch-react-pick.on{background:var(--accent-soft);color:var(--accent-ink)}
.ch-react-pick span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
.ch-quote{display:flex;flex-direction:column;align-items:flex-start;gap:1px;width:100%;text-align:left;font:inherit;font-size:var(--fs-xs);border:0;border-left:3px solid currentColor;border-radius:8px;padding:4px 8px;margin:2px 0 6px;background:color-mix(in srgb,currentColor 10%,transparent);color:inherit;cursor:pointer;min-height:36px}
.ch-quote b{font-weight:700}
.ch-quote span{opacity:.85;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}
.ch-replybar{display:flex;align-items:center;gap:8px;background:var(--tile);border:1px solid var(--tile-edge);border-left:3px solid var(--accent-ink);border-radius:14px;padding:4px 4px 4px 10px;color:var(--accent-ink);box-shadow:var(--tile-shadow)}
.ch-replybar[hidden]{display:none}
.ch-replybar-t{flex:1;min-width:0;display:flex;flex-direction:column;font-size:var(--fs-xs);color:var(--ink)}
.ch-replybar-t b{color:var(--accent-ink)}
.ch-replybar-t span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ch-flash > .ch-msg,.ch-flash.ch-msg{animation:ch-flash 1.4s ease}
@keyframes ch-flash{0%,60%{box-shadow:0 0 0 3px var(--accent-ink)}100%{box-shadow:none}}
.ch-weekly-in{display:flex;flex-direction:column;gap:10px;background:var(--tile);border:1px solid color-mix(in srgb,var(--accent-ink) 30%,var(--tile-edge));box-shadow:var(--tile-shadow);border-radius:var(--r-tile,18px);padding:12px 14px}
.ch-weekly-t{margin:0;line-height:1.45;color:var(--ink)}
.ch-wk-row{min-height:52px}
.ch-wk-mist{gap:6px}
/* «Увімкніть сповіщення» (js/ui/notifyprompt.js) */
.np{display:flex;flex-direction:column;gap:8px}
.np[hidden]{display:none}
.np-later{align-self:flex-end;margin-top:-2px}
.np-sheet{gap:12px}
/* відкритий чат: без нижньої панелі (focus-mode) — уся висота екрана, поле вводу внизу */
body.focus-mode .ch-room{min-height:calc(100dvh - var(--header-h) - var(--safe-t) - var(--safe-b) - 40px)}
body.focus-mode .ch-dock{bottom:calc(var(--safe-b) + 8px)}
/* Живий чат (2026-11-17): «друкує…», «у мережі», «Переглянуто», теми для розмови, новини друзів */
.ch-title .tx-s.ch-live{color:var(--accent-ink);font-weight:600}
.ch-ava.ch-online{position:relative}
.ch-ava.ch-online::after{content:"";position:absolute;right:-2px;bottom:-2px;width:11px;height:11px;border-radius:50%;background:var(--good,#2E9E62);border:2px solid var(--bg)}
.ch-seen{align-self:flex-end;display:inline-flex;align-items:center;gap:4px;margin:-2px 4px 4px 0;font-size:11.5px;color:var(--ink-dim)}
.ch-seen.on{color:var(--accent-ink)}
.ch-starters{display:flex;gap:8px;overflow-x:auto;scrollbar-width:none;padding:0 2px 8px}
.ch-starters::-webkit-scrollbar{display:none}
.ch-starters[hidden]{display:none}
.ch-starter{flex:none;display:inline-flex;align-items:center;gap:5px;min-height:36px;padding:6px 11px;border-radius:18px;border:1px solid var(--tile-edge);background:var(--tile);color:var(--ink);font:inherit;font-size:13px;font-weight:600;box-shadow:var(--tile-shadow);cursor:pointer;white-space:nowrap}
.ch-starter svg{color:var(--accent-ink)}
.ch-starter:active{box-shadow:var(--tile-shadow-press,var(--tile-shadow))}
.ch-newswrap{display:flex;flex-direction:column;align-items:center;gap:4px}
.ch-news{align-items:center;gap:12px;width:100%;max-width:420px;background:var(--tile);border:1px solid var(--tile-edge);box-shadow:var(--tile-shadow);border-radius:var(--r-tile,18px);padding:10px 12px;cursor:pointer}
.ch-news .tx-sq{background:var(--accent-grad);color:#fff;flex:none}
.ch-news .tx-body{display:flex;flex-direction:column;gap:2px;min-width:0;flex:1}
.ch-news .tx-l{white-space:normal;line-height:1.3}
.ch-news-btn{flex:none}
.ch-newswrap .ch-reacts{justify-content:center}
/* Закріплене повідомлення (2026-11-17) */
.ch-pinbar[hidden]{display:none}
.ch-pin{display:flex;align-items:center;gap:10px;width:100%;text-align:left;font:inherit;color:var(--ink);background:var(--tile);border:1px solid var(--tile-edge);border-left:3px solid var(--accent-ink);border-radius:14px;padding:8px 10px;box-shadow:var(--tile-shadow);cursor:pointer}
.ch-pin-ic{color:var(--accent-ink);flex:none;display:inline-flex}
.ch-pin-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:1px}
.ch-pin-lab{font-size:11px;font-weight:700;letter-spacing:.03em;text-transform:uppercase;color:var(--accent-ink)}
.ch-pin-t{font-size:var(--fs-sm,14px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ch-pin > svg:last-child{flex:none;color:var(--ink-dim)}
.ch-pin-full{font-size:var(--fs-md);line-height:1.45;white-space:pre-wrap;margin:0}
.ch-head .ch-pinbar{margin-top:6px}
.fr-ginv{flex-wrap:wrap;row-gap:8px}
.fr-ginv .tx-body{flex:1 1 calc(100% - 64px)}
.fr-ginv .tx-s{white-space:normal}
.fr-ginv .fr-req-acts{width:100%;justify-content:flex-end}
/* Як у месенджерах (власник 2026-11-17: «коли виділяю повідомлення, виділяється весь текст»): у чаті нічого не виділяється й не з'являється системне меню;
   довге натискання — дії з повідомленням (копіювати там), бульбашка ледь стискається, поки тримаєте */
.ch-room,.ch-room *{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
.ch-room textarea,.ch-room input{-webkit-user-select:text;user-select:text;-webkit-touch-callout:default}
.ch-msg,.ch-news{transition:transform 160ms ease,filter 160ms ease}
.ch-msg.ch-press,.ch-news.ch-press{transform:scale(.97);filter:brightness(.96)}
@media (prefers-reduced-motion: reduce){.ch-msg.ch-press,.ch-news.ch-press{transform:none}}
