/* © 2026 Шайдуров Павел Анатольевич. Все права защищены.
   r269 (решение владельца 10.11, docs/сайт/чат-макет/, вариант А): новый вид «Ковчега в браузере».
   Телефон: сверху ☰ · модель ▾ · ✎; снизу ＋ · поле · одна круглая кнопка (пусто — микрофон, есть текст — отправить).
   ＋ и «Модель» — шторки снизу; меню — только чаты и плашка «Баланс · Пополнить».
   Компьютер (от 900 px): слева чаты, сверху «Ковчег» · модель ▾ … баланс · кабинет; переписка и ввод — по центру ≤ 760 px.
   Стили страницы (chat.html) остаются; этот файл грузится после них и меняет только вид. Без сторонних ресурсов. */

/* r274 (А2, решение владельца 11.11, п. 11): тема — по настройке аккаунта (theme), а не по устройству.
   /js/theme.js ставит <html data-theme="light|dark"> до отрисовки; по умолчанию — СВЕТЛАЯ (макет А).
   Тёмная — в цветах сайта (экран 7): фон #071422, шапка #08131f, поля #0e2437, рамка #23435a, ссылки #52c7f7, бирюза #65e0d0 */
:root { --bg: #F4F7FA; --me: #DCECFB; --soft: #586879; --line: #D5DEE7; --ink: #13202E; --card: #fff;
  --head: #0B1A2B; --go: #F59E1B; --go-ink: #1A1203; --teal: #0B7A6B; --teal-bg: #E6F7F4; --link2: #0B6FB8; }
:root[data-theme="dark"] {
  --bg: #071422; --card: #0e2437; --ink: #eef6f8; --soft: #a9bfcf; --line: #23435a; --me: #16405f; --head: #08131f;
  --night-2: #14304a; --code: #050e18; --wave: #52c7f7; --bad-bg: #3a1d19; --bad-ink: #f4b4a8;
  --teal: #65e0d0; --teal-bg: #0f3434; --link2: #52c7f7;
}
:root[data-theme="dark"] a { color: #52c7f7; }
:root[data-theme="dark"] header { border-bottom: 1px solid #14304a; }
:root[data-theme="dark"] .btn { background: #14304a; }
:root[data-theme="dark"] .btn.accent { background: var(--go); color: var(--go-ink); }
:root[data-theme="dark"] .btn.light { background: transparent; color: var(--ink); }
:root[data-theme="dark"] .balchip .bcab { background: #14304a; }

.si { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- шапка ---------- */
header { background: var(--head); gap: 4px; padding-top: calc(8px + env(safe-area-inset-top)); padding-bottom: 8px; }
header .hbtn { border: 0; }
header .hbtn.hib { width: 44px; padding: 0; border-radius: 12px; }
header .hbtn:hover { background: rgba(255,255,255,.08); }
.hgap { flex: 1; }
.brand { display: none; margin-right: 8px; }
.mbtn { min-width: 0; max-width: calc(100vw - 132px); font-weight: 600; font-size: 16px; padding: 0 10px; color: #fff; }
.mbtn #modelName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mbtn .chev { width: 18px; height: 18px; color: #9FB3C8; }
/* телефон: модель — по центру между ☰ и ✎ */
@media (max-width: 899px) {
  header { justify-content: space-between; }
  .mbtn { margin: 0 auto; }
  .hgap, header #bal { display: none !important; }
}
.balbtn { background: #13283F; border: 0; gap: 8px; padding: 0 14px; font-weight: 600; }
.balbtn .pay { color: #F5B955; font-weight: 500; }
.balbtn.low .sum { color: var(--cabin); }

/* ---------- строка «не хватает» (только при нехватке) ---------- */
.modelbar { border: 0; border-top: 1px solid var(--line); background: var(--bad-bg); color: var(--bad-ink); display: none; }
.modelbar.short { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.modelbar.short .hint { flex: 1 1 240px; margin: 0; color: var(--bad-ink); font-size: 14px; max-width: none; }
.modelbar .hint .warn { color: var(--bad-ink); }
.modelbar .hint .desc { display: none; }
.modelbar .hint .why { color: inherit; }
.modelbar #needPay { flex: none; }
@media (min-width: 900px) { .modelbar.short { padding: 8px max(20px, calc((100% - 760px) / 2)); } }

/* ---------- сообщения ---------- */
#msgs { max-width: 760px; gap: 16px; }
.msg.user { background: var(--me); border-radius: 18px 18px 4px 18px; padding: 12px 14px; max-width: 82%; }
.msg.bot { background: transparent; border: 0; padding: 0; border-radius: 0; }
.msg.bot > .md > :first-child { margin-top: 0; }
.tools { gap: 2px; margin-top: 4px; font-size: 14px; }
.tools .ibtn { width: 44px; height: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 10px; background: transparent; color: var(--soft);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.tools .ibtn:hover { background: rgba(127,127,127,.12); color: var(--ink); }
.tools .ibtn .si { width: 18px; height: 18px; }
.tools .ibtn .ki { width: 18px; height: 18px; }
.tools .cost { color: var(--soft); margin-left: 6px; font-variant-numeric: tabular-nums; }
.tools .tnote { color: var(--soft); margin-left: 6px; }
.searching { display: block; font-size: 14px; color: var(--soft); margin: 0 0 6px; }
.searching::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--wave); margin-right: 8px; vertical-align: 1px; animation: pulse 1.2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .searching::before { animation: none; } }
.sq { margin: 0 0 6px; font-size: 14px; color: var(--soft); }
.src { background: var(--card); border: 1px solid var(--line); }

/* ---------- поле ввода: ＋ · поле · одна кнопка ---------- */
.composer { background: var(--bg); border-top: 0; padding-top: 6px; }
.composer form { align-items: flex-end; max-width: 760px; }
.plus, .webb, .mic, .send { flex: none; width: 48px; min-width: 48px; height: 48px; border-radius: 24px; padding: 0; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative; }
.plus { border: 1px solid var(--line); background: var(--card); color: var(--ink); }
/* r274 (А2, п. 10): 🌐 — отдельная кнопка; нажата — бирюзовая, над полем подпись «Поиск включён · ≈ цена» */
.webb { border: 1px solid var(--line); background: var(--card); color: var(--soft); }
.webb[aria-pressed="true"] { border: 2px solid var(--teal); background: var(--teal-bg); color: var(--teal); }
.webnote { max-width: 760px; margin: 0 auto 6px; padding: 0 4px; font-size: 14px; line-height: 1.3; color: var(--teal); }
.wask { min-height: 44px; margin: 8px 0 2px; border: 1px solid var(--teal); background: var(--teal-bg); color: var(--teal); border-radius: 22px;
  padding: 6px 16px; font: 600 15px/1.25 "Golos Text", sans-serif; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; text-align: left; max-width: 100%; }
.wask .si { width: 18px; height: 18px; }
.plus .dotweb { position: absolute; right: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--wave); border: 2px solid var(--card); }
.mic { border: 0; background: var(--go); color: var(--go-ink); }
.send { border: 0; background: var(--go); color: var(--go-ink); }
.send svg { width: 22px; height: 22px; }
.send.stop { width: auto; padding: 0 14px; background: var(--bad); color: #fff; }
.composer textarea { min-height: 48px; border-radius: 24px; padding: 12px 16px; background: var(--card); font-size: 16px; }
@media (max-width: 899px) { .composer form { gap: 6px; } }
.composer .clip { display: none !important; }
/* одна круглая кнопка: поле пустое — 🎤 (если голос есть), есть текст или идёт ответ — «Отправить»/«Стоп» */
#form.voice-first #send:not(.stop) { display: none; }
#form:not(.voice-first) #micBtn { display: none; }
.under { text-align: center; font-size: 14px; max-width: 760px; }
@media (min-width: 900px) {
  .composer { padding: 6px 24px 14px; }
  .composer form { background: var(--card); border: 1px solid var(--line); border-radius: 26px; padding: 6px; gap: 8px; align-items: center; }
  .composer textarea { border: 0; background: transparent; min-height: 44px; padding: 10px 8px; }
  .composer textarea:focus { box-shadow: none; }
  .composer form:focus-within { border-color: var(--wave); box-shadow: 0 0 0 3px rgba(63,184,201,.2); }
  .plus, .webb { border: 0; background: var(--bg); width: 44px; min-width: 44px; height: 44px; }
  .webb[aria-pressed="true"] { border: 2px solid var(--teal); background: var(--teal-bg); }
  .mic, .send { width: 44px; min-width: 44px; height: 44px; }
  #msgs, .composer form, .atts, .rec, .under { max-width: 760px; }
}

/* ---------- шторки снизу (＋ и «Модель») ---------- */
dialog.sheet { margin: auto auto 0; width: 100%; max-width: 560px; height: fit-content; max-height: calc(100dvh - 40px); border-radius: 22px 22px 0 0;
  box-shadow: 0 -8px 30px rgba(0,0,0,.25); overflow: hidden; }
dialog.sheet .sh { max-height: calc(100dvh - 40px); }
dialog.sheet.tall .sh { max-height: min(720px, calc(100dvh - 60px)); }
dialog.sheet[open] { animation: sheetup .2s ease-out; }
@keyframes sheetup { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { dialog.sheet[open] { animation: none; } }
@media (min-width: 900px) { dialog.sheet { margin: auto; border-radius: 22px; max-width: 480px; } }
.sh { display: flex; flex-direction: column; gap: 4px; padding: 10px 16px calc(20px + env(safe-area-inset-bottom)); min-height: 0; box-sizing: border-box; }
.grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line); align-self: center; margin-bottom: 10px; flex: none; }
.shead { display: flex; align-items: center; justify-content: space-between; padding: 0 0 4px 8px; flex: none; }
.shead h2 { margin: 0; font-size: 20px; font-weight: 700; }
.shead .x { width: 44px; height: 44px; border: 0; background: none; color: var(--ink); cursor: pointer; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; }
.srow { min-height: 60px; width: 100%; border: 0; background: transparent; display: flex; align-items: center; gap: 14px; padding: 6px 8px; border-radius: 12px;
  text-align: left; cursor: pointer; color: var(--ink); font: inherit; }
.srow:hover { background: var(--bg); }
.srow .st { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.srow b { font-size: 16px; font-weight: 600; }
.srow small { font-size: 14px; color: var(--soft); }
.sic { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.sic.blue { background: #E8F3FD; color: #0B6FB8; } .sic.amber { background: #FFF3DF; color: #A35F00; }
.sic.teal { background: #E6F7F4; color: #0B7A6B; } .sic.grey { background: #EDF1F5; color: #3D4C5C; }
.sic.red { background: #FBE7E3; color: #B23A26; }
.srow.danger-row b { color: var(--bad); }
:root[data-theme="dark"] .sic.red { background: #3a1d19; color: #f4b4a8; }
:root[data-theme="dark"] .srow.danger-row b { color: #f4a08e; }
:root[data-theme="dark"] .sic.blue { background: #16405f; color: #9DD3FF; } :root[data-theme="dark"] .sic.amber { background: #4A3A16; color: #FFE3A8; }
  :root[data-theme="dark"] .sic.teal { background: #123F4A; color: #BFEFF5; } :root[data-theme="dark"] .sic.grey { background: #24405C; color: #E8EEF3; }
.sdiv { border: 0; height: 1px; background: var(--line); margin: 6px 8px; width: auto; }
.srow.sw input { width: 22px; height: 22px; accent-color: #0B7A6B; flex: none; }
.tog { width: 44px; height: 26px; border-radius: 13px; background: var(--line); position: relative; flex: none; transition: background .15s; }
.tog::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .15s; }
#webBtn[aria-pressed="true"] .tog { background: #0B7A6B; }
#webBtn[aria-pressed="true"] .tog::after { transform: translateX(18px); }
@media (prefers-reduced-motion: reduce) { .tog, .tog::after { transition: none; } }

/* выбор модели: группы по цене ответа */
.mlist { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 2px; }
.mgroup { font-size: 14px; font-weight: 600; color: var(--soft); text-transform: uppercase; letter-spacing: .04em; padding: 12px 8px 2px; margin: 0; }
.mrow { min-height: 48px; width: 100%; border: 0; background: transparent; border-radius: 10px; display: flex; align-items: center; gap: 10px; padding: 4px 10px;
  text-align: left; cursor: pointer; color: var(--ink); font: inherit; }
.mrow:hover { background: var(--bg); }
.mrow[aria-pressed="true"] { background: #E8F3FD; font-weight: 700; }
:root[data-theme="dark"] .mrow[aria-pressed="true"] { background: #16405f; }
.mrow .mn { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mrow .mn span { font-size: 16px; overflow-wrap: anywhere; }
.mrow .mn small { font-size: 14px; color: var(--soft); font-weight: 400; }
.mrow .mp { font-size: 14px; color: var(--soft); white-space: nowrap; font-weight: 400; font-variant-numeric: tabular-nums; }
.sbtn.link { border: 0; color: #0B6FB8; font-weight: 600; text-align: left; padding: 0 10px; font-size: 15px; flex: none; }
:root[data-theme="dark"] .sbtn.link { color: #7FD0DC; }
.sh > .note { margin: 0; padding: 0 10px; font-size: 14px; flex: none; }

/* ---------- меню: только чаты и баланс ---------- */
.menu { gap: 10px; }
.menu .top { min-height: 44px; padding-left: 6px; }
.menu h2 { font: 700 20px/1.2 "Golos Text", sans-serif; }
.menu h2 .mhome { color: var(--ink); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }   /* на главную сайта */
.menu .x { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; min-width: 44px; min-height: 44px; border-radius: 10px; }
dialog#menu .menu > .pane > #newChat { display: none; }           /* на телефоне новый чат — ✎ в шапке */
.chats { gap: 2px; }
.chats .grp { font-size: 14px; color: var(--soft); padding: 10px 8px 4px; }
.chats li.row { position: relative; overflow: hidden; border-radius: 10px; }
.chats li.row > [data-chat] { border: 0; background: none; min-height: 48px; padding: 12px 10px; border-radius: 10px; transition: transform .18s ease; }
.chats li.row > [data-chat] b { font-weight: 400; font-size: 15px; }
.chats li.row > [data-chat] { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }   /* r274: долгое нажатие — меню чата */
.chats li.row > [data-chat][aria-current="true"] { background: #E8F3FD; }
:root[data-theme="dark"] .chats li.row > [data-chat][aria-current="true"] { background: #16405f; }
.chats li.row > [data-chat]:hover { background: var(--bg); }
/* удалить чат: телефон — смахнуть влево (открывается красная кнопка), мышь — кнопка при наведении, клавиатура — по Tab */
.chats li.row > .del { position: absolute; right: 0; top: 0; bottom: 0; width: 72px; border: 0; border-radius: 0 10px 10px 0; background: var(--bad); color: #fff;
  font-size: 14px; display: inline-flex; align-items: center; justify-content: center; transform: translateX(100%); transition: transform .18s ease; }
.chats li.row > .del .si { width: 20px; height: 20px; }
.chats li.row.swiped > .del, .chats li.row > .del:focus-visible { transform: none; }
.chats li.row.swiped > [data-chat] { transform: translateX(-72px); }
@media (hover: hover) and (pointer: fine) {
  .chats li.row > .del { width: 44px; background: transparent; color: var(--soft); transform: none; opacity: 0; }
  .chats li.row:hover > .del, .chats li.row:focus-within > .del { opacity: 1; }
  .chats li.row > .del:hover, .chats li.row > .del:focus-visible { color: var(--bad); }
  .chats li.row > [data-chat] { padding-right: 48px; }
}
@media (prefers-reduced-motion: reduce) { .chats li.row > .del, .chats li.row > [data-chat] { transition: none; } }
.touch-only { display: none; }
@media (hover: none), (pointer: coarse) { .touch-only { display: inline; } .mouse-only { display: none; } }
.note.keep { margin: 0; font-size: 14px; padding: 4px 8px 0; line-height: 1.4; }
#pane-photo #toChats { justify-content: flex-start; gap: 8px; }
#pane-photo #toChats .si { width: 18px; height: 18px; }
.mfoot { border-top: 0; padding-top: 0; }
.balchip { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 12px 6px 8px; border-radius: 14px; background: var(--bg); border: 0; }
.balchip a { text-decoration: none; color: var(--ink); }
.balchip .bcab { width: 44px; height: 44px; border-radius: 22px; background: var(--head); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.balchip .bcab .si { width: 18px; height: 18px; }
.balchip .bsum { flex: 1; min-width: 0; min-height: 44px; display: flex; flex-direction: column; justify-content: center; }
.balchip .bsum span { font-size: 14px; color: var(--soft); }
.balchip .bsum b { font: 700 17px/1.2 "Golos Text", sans-serif; font-variant-numeric: tabular-nums; }
.balchip .bpay { font-weight: 600; color: #0B6FB8; min-height: 44px; display: inline-flex; align-items: center; padding: 0 6px; }
:root[data-theme="dark"] .balchip .bpay { color: #7FD0DC; }
.balchip.low .bsum b { color: var(--bad); }
/* r285 Н4: шестерёнка — сразу в «Настройки и безопасность» (тема), баланс — в «Баланс и пополнение» */
.balchip .bset { width: 44px; height: 44px; border-radius: 22px; display: inline-flex; align-items: center; justify-content: center; flex: none; color: var(--ink); }
.balchip .bset .ki { width: 22px; height: 22px; }
.balchip { gap: 6px; }
.balchip .bsum b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- компьютер ---------- */
@media (min-width: 900px) {
  .brand { display: flex; margin-right: 8px; }
  #newTop { display: none; }
  .mbtn { border: 1px solid #2A4059; height: 44px; max-width: 420px; }
  .side { width: 280px; }
  .side .menu { padding: 14px 12px; }
  .side #newChat { display: inline-flex; min-height: 44px; font-size: 15px; }
  .side .mfoot { display: none; }              /* баланс — в шапке справа */
  .side .chats li.row > [data-chat] { min-height: 44px; padding: 10px; }
  #photoView { max-width: none; }
}
@media (min-width: 1200px) { .side { width: 280px; } }

/* ---------- r274 (А2, п. 13, экраны 9–10): «Фото» — микростудия на одном экране ---------- */
body.photo-mode #modelBtn { visibility: hidden; }           /* модель чата здесь ни при чём: у правки — свои модели с ценой */
.pv { gap: 12px; padding-bottom: 0; }
.pv-top { gap: 6px; min-height: 44px; }
.pv-top h1 { font: 700 19px/1.25 "Golos Text", sans-serif; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-back { width: 44px; height: 44px; flex: none; border: 0; background: transparent; color: var(--ink); border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.pv-back:hover { background: rgba(127,127,127,.12); }
.pv-gap { width: 44px; flex: none; }
.pv-art .si { width: 44px; height: 44px; color: var(--soft); }
/* выбранное фото: миниатюра слева, справа — что это, «Другое фото»; во время правки — крупно */
.st-head { display: flex; gap: 12px; align-items: stretch; }
.pv-fig.st-src { width: 132px; flex: none; min-height: 0; display: block; border-radius: 14px; }
.pv-fig.st-src img { width: 100%; height: 150px; max-height: none; object-fit: cover; }
.pv-fig.st-src figcaption { position: static; display: block; background: var(--card); color: var(--soft); font-size: 12px; font-weight: 400; padding: 4px 8px; border-radius: 0; line-height: 1.3; }
.st-head.busy .st-src { width: 100%; }
.st-head.busy .st-src img { height: auto; max-height: 52dvh; object-fit: contain; margin: 0 auto; }
.st-info { display: flex; flex-direction: column; gap: 6px; justify-content: center; min-width: 0; flex: 1; }
.st-info b { font-size: 16px; overflow-wrap: anywhere; }
.st-info small { font-size: 14px; color: var(--soft); line-height: 1.35; }
.st-info .btn { min-height: 44px; justify-content: center; }
.st-info .btn.st-del { color: var(--bad); }
:root[data-theme="dark"] .st-info .btn.st-del { color: #f4a08e; }
@media (min-width: 700px) { .pv-fig.st-src { width: 200px; } .pv-fig.st-src img { height: 220px; } .st-info { justify-content: flex-start; padding-top: 6px; } .st-info .btn { align-self: flex-start; } }
/* готовые действия с ценой */
.st-acts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 640px) { .st-acts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.st-act { min-height: 56px; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 8px 12px; display: flex; flex-direction: column;
  align-items: flex-start; justify-content: center; gap: 2px; text-align: left; cursor: pointer; color: var(--ink); font: inherit; min-width: 0; }
.st-act b { font-size: 15px; font-weight: 600; }
.st-act small { font-size: 13px; color: var(--soft); line-height: 1.3; }
.st-act:hover { border-color: var(--go); }
.st-act[aria-pressed="true"] { border-color: var(--go); box-shadow: inset 0 0 0 1px var(--go); background: #FFF6E5; }
:root[data-theme="dark"] .st-act[aria-pressed="true"] { background: #2e2410; }
.st-act:disabled { opacity: .5; cursor: default; }
.pv-lbl small { font-weight: 400; font-size: 14px; color: var(--soft); }
.pv-form textarea { min-height: 64px; }
.pv-go .btn { background: var(--go); color: var(--go-ink); }
/* «Мои фото» — сетка, новые сверху */
.lib-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding-top: 6px; }
.lib-h h2 { margin: 0; font-size: 17px; font-weight: 700; }
.lib-h span { font-size: 13px; color: var(--soft); }
.lib-g { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 640px) { .lib-g { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .lib-g { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.lib-g li { min-width: 0; }
.lib-it { position: relative; width: 100%; min-height: 44px; border: 0; background: none; padding: 0; display: flex; flex-direction: column; gap: 3px; text-align: left;
  cursor: pointer; color: var(--ink); font: inherit; border-radius: 12px; }
.lib-it img, .lib-it .ph { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 12px; background: var(--line); }
.lib-it[aria-current="true"] img, .lib-it[aria-current="true"] .ph { outline: 3px solid var(--go); outline-offset: -3px; }
.lib-it b { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.lib-it small { font-size: 12px; color: var(--soft); }
.lib-pd { position: absolute; left: 6px; top: 6px; font-style: normal; font-size: 12px; background: rgba(8,20,34,.78); color: #fff; border-radius: 6px; padding: 2px 6px; }
/* внизу — «Снять» / «Выбрать», всегда под пальцем */
.st-bar { position: sticky; bottom: 0; z-index: 5; display: flex; gap: 8px; padding: 10px 0 calc(12px + env(safe-area-inset-bottom)); background: var(--bg); }
/* r285 Н1: кнопка с ценой, ошибка и подсказка о деньгах не встают под липкую полосу при прокрутке к ним и при фокусе */
.pv-go, #pvGo, #pvErr, #pvWarn { scroll-margin-bottom: calc(96px + env(safe-area-inset-bottom)); }
.st-bar .btn { flex: 1; min-height: 52px; border-radius: 14px; font-size: 16px; }
.st-bar .btn .si, .pv-acts .btn .si { width: 20px; height: 20px; }
.st-bar .btn.accent { background: var(--go); color: var(--go-ink); }
.st-bar .btn.light { background: var(--card); }
/* результат: «до/после» — одна картинка с ползунком (слева «до», справа «после») */
.pv-cmp.st-cmp { position: relative; display: block; width: 100%; max-height: 62dvh; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); touch-action: pan-y; }
.st-cmp .pv-fig, .st-cmp[data-show] .pv-b, .st-cmp[data-show] .pv-a { position: absolute; inset: 0; display: block; border: 0; border-radius: 0; min-height: 0; }
.st-cmp .pv-fig img, .st-cmp .pv-fig img { width: 100%; height: 100%; max-height: none; object-fit: contain; }
.st-cmp .pv-a { clip-path: inset(0 0 0 var(--pos, 50%)); will-change: clip-path; }   /* r284: режем, не двигаем разметку */
/* r284: линия и кружок — внутри дорожки во всю ширину; дорожка едет transform: translateX(--pos) — % от своей ширины = от картинки */
.st-track { position: absolute; inset: 0; transform: translateX(var(--pos, 50%)); will-change: transform; pointer-events: none; }
.st-line { position: absolute; top: 0; bottom: 0; left: 0; width: 3px; margin-left: -1.5px; background: var(--go); pointer-events: none; }
.st-knob { position: absolute; top: 50%; left: 0; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; background: var(--go); color: var(--go-ink);
  display: flex; align-items: center; justify-content: center; pointer-events: none; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.st-tag { position: absolute; top: 12px; font-size: 13px; font-weight: 600; background: rgba(11,26,43,.72); color: #fff; border-radius: 8px; padding: 4px 8px; pointer-events: none; }
.st-tag.l { left: 12px; } .st-tag.r { right: 12px; }
/* r284: range — только для клавиатуры и диктора; палец и мышь ловит сама картинка (pointer events в photo.js) */
.st-cmp { cursor: ew-resize; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.st-cmp img { -webkit-user-drag: none; pointer-events: none; }
.st-range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; pointer-events: none; touch-action: pan-y; -webkit-appearance: none; appearance: none; background: transparent; }
.st-range::-webkit-slider-thumb { -webkit-appearance: none; width: 4px; height: 100vh; }
.st-range::-moz-range-thumb { width: 4px; height: 100vh; border: 0; }
.st-cmp:has(.st-range:focus-visible) { outline: 3px solid var(--wave); outline-offset: 2px; }
.st-note { margin: 0; }
.pv-acts.st-res { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.st-res .st-dl { grid-column: 1 / -1; min-height: 52px; background: var(--go); color: var(--go-ink); }
.st-res .st-b { min-height: 56px; flex-direction: column; gap: 2px; font-size: 14px; padding: 4px 6px; line-height: 1.2; }
.st-res .st-b small { font-size: 12px; font-weight: 400; color: var(--soft); }
.st-nav { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
/* компьютер: слева — фото и что это (стоит на месте), справа — действия, поле и кнопка с ценой */
@media (min-width: 1000px) {
  .pv-work:has(> .st-head) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .pv-work > .st-head { grid-column: 1; grid-row: 1 / span 8; position: sticky; top: 8px; flex-direction: column; align-self: start; }
  .pv-work > .st-head ~ * { grid-column: 2; }
  .pv-work > .st-head .st-src { width: 100%; }
  .pv-work > .st-head .st-src img { height: auto; max-height: calc(100dvh - 320px); object-fit: contain; }
  .st-acts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .st-bar { max-width: 520px; margin: 0 auto; width: 100%; }
}
@media (min-width: 900px) {
  .pv-cmp.st-cmp, .pv-acts.st-res, .st-note, #photoView > .pv-meta { width: 100%; max-width: 760px; margin-left: auto; margin-right: auto; }
  .pv-cmp.st-cmp { max-height: calc(100dvh - 330px); }
}

/* ---------- r276 М3 (экраны 9–10): на телефоне у «Фото» одна шапка — тёмная, «←» · название · пусто. Шапка чата
   (☰ · модель · «Новый чат») здесь не нужна: «←» возвращает к чату. «Другое фото» — в студии под фото ---------- */
@media (max-width: 899px) {
  body.photo-mode > header { display: none; }
  body.photo-mode .pv-top { position: sticky; top: 0; z-index: 6; min-height: 60px; margin: -12px calc(-1 * max(12px, env(safe-area-inset-right))) 0 calc(-1 * max(12px, env(safe-area-inset-left)));
    padding: env(safe-area-inset-top) 8px 0; background: var(--head); color: #fff; }
  body.photo-mode .pv-top h1 { color: #fff; font-size: 17px; font-weight: 600; }
  body.photo-mode .pv-top .pv-back { color: #fff; }
  body.photo-mode .pv-top .pv-back:hover { background: rgba(255,255,255,.1); }
  body.photo-mode .pv-top [data-p="new"], body.photo-mode .pv-top .pv-gap { display: none; }
  body.photo-mode .pv-top .pv-menu { display: inline-flex; }
}
.pv-menu { display: none; width: 44px; height: 44px; flex: none; border: 0; background: transparent; color: #fff; border-radius: 10px; align-items: center; justify-content: center; cursor: pointer; }
.pv-menu:hover { background: rgba(255,255,255,.1); }
/* «Что сделано и отмена» под результатом — свёрнуто на телефоне */
.st-more { border-top: 1px solid var(--line); padding-top: 8px; }
.st-more > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--soft); font-size: 14px; list-style: none; }
.st-more > summary::-webkit-details-marker { display: none; }
.st-more > summary::before { content: "▸"; margin-right: 8px; transition: transform .15s; }
.st-more[open] > summary::before { transform: rotate(90deg); }
.st-more[open] > * + * { margin-top: 8px; }
.st-more .st-nav { display: flex; flex-wrap: wrap; gap: 8px; }
.st-more .st-nav .btn { min-height: 44px; }
@media (min-width: 900px) { .st-more { width: 100%; max-width: 760px; margin-left: auto; margin-right: auto; } }

/* r280: подсказка «Новый чат» — один раз при первом заходе, у кнопки с облачком */
.nchint { position: fixed; z-index: 40; background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 600; padding: 8px 12px; border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25); pointer-events: none; white-space: nowrap; }
.nchint::before { content: ""; position: absolute; top: -6px; left: calc(var(--ax, 50%) - 6px); border: 6px solid transparent; border-top: 0; border-bottom-color: var(--ink); }
