:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #1a1a1a);
  --hint: var(--tg-theme-hint-color, #8a8a8a);
  --secondary-bg: var(--tg-theme-secondary-bg-color, #f2f2f5);
  --accent: var(--tg-theme-button-color, #b5651d);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --link: var(--tg-theme-link-color, #2481cc);
  --border: color-mix(in srgb, var(--text) 12%, transparent);
  /* Едва заметная подложка: ответы Юми и поля ввода. */
  --soft-bg: color-mix(in srgb, var(--secondary-bg) 40%, var(--bg));
  /* Масштаб шрифтов (класс ставит app.js по клиенту Telegram). Рядом с текстом
     самого Telegram наш выходил крупнее: на iPhone чуть, на Android заметно
     (WebView там увеличивает текст), на компьютере — сильно. */
  --fs: 1;

  /* ---- Единые размеры (DESIGN.md). Новое — только из этого набора. ---- */
  /* Шрифт (2026-10-11, по скриншотам рядом с Telegram): 13 подписи и вторичный ·
     14 основной, кнопки, вкладки, звёзды · 17 заголовки · 20 крупные числа.
     Поля ввода — 16 (меньше — iPhone увеличивает страницу при фокусе). */
  --fs-xs: calc(13px * var(--fs));
  --fs-s: calc(13px * var(--fs));
  --fs-m: calc(14px * var(--fs));
  --fs-l: calc(17px * var(--fs));
  --fs-xl: calc(20px * var(--fs));
  --fs-input: calc(16px * var(--fs));
  /* Скругления: 8 мелкое (миниатюры, значки) · 12 кнопки, поля, карточки · 16 пузыри и листы. */
  --r-s: 8px;
  --r-m: 12px;
  --r-l: 16px;
  /* Высоты: кнопка 36 · поле и широкая кнопка 40 · иконка-кнопка 40. */
  --h-btn: 36px;
  --h-field: 40px;
  --h-icon: 40px;
  --danger: #d64532;
  /* Серый потемнее — неактивные вкладки: --hint на светлом фоне Telegram плохо виден. */
  --hint-strong: color-mix(in srgb, var(--text) 62%, var(--bg));
}
html.desktop { --fs: 0.87; }
/* iPhone: экран для страницы шире (iPhone 8 Plus — 414 против 360 у Android), один
   пиксель там физически мельче — те же 14 выглядят заметно меньше. Поле — ровно 16. */
html.ios { --fs: 1.07; --fs-input: 16px; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  /* Двойной тап не увеличивает страницу (iPhone): касания — только нажатия.
     Работу во весь экран увеличивают пальцами — там свой touch-action. */
  touch-action: manipulation;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  /* 15px — как текст сообщения в Telegram на телефоне. Автоувеличение шрифта в
     Android WebView отключено, иначе оно раздувает длинные абзацы. */
  font-size: var(--fs-m);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.topbar {
  padding: 12px 16px calc(10px);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.btn-feedback {
  flex: 0 0 auto;
  height: calc(28px * var(--fs));
  border: 1px solid var(--border);
  background: transparent;
  color: var(--hint);
  border-radius: var(--r-m);
  padding: 0 11px;
  font-size: var(--fs-s);
  cursor: pointer;
}
.btn-feedback[hidden] { display: none; }
/* Баланс в звёздах (у владельца скрыт). */
.balance {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  padding: 4px 0;
  font: inherit;
  cursor: pointer;
  color: var(--hint);
  font-size: var(--fs-s);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.balance[hidden] { display: none; }
.title { font-size: var(--fs-l); font-weight: 600; }
/* Подпись под «Юми» — тем же шрифтом, что и вкладки (.tab). */
.subtitle { font-size: var(--fs-s); color: var(--hint); margin-top: 2px; }

.chat {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg {
  max-width: 85%;
  padding: 9px 12px;
  border-radius: var(--r-l);
  font-size: var(--fs-m);
  line-height: 1.4;
  word-wrap: break-word;
}
.msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--accent-text);
  border-bottom-right-radius: 5px;
}
.msg.assistant {
  align-self: flex-start;
  max-width: 100%; /* ответы Юми — во всю ширину, экран телефона узкий */
  background: var(--soft-bg);
  color: var(--text);
  border-bottom-left-radius: 5px;
}

/* ---------- текст сообщения (лёгкий markdown) ---------- */
.md {
  white-space: pre-wrap;
  word-wrap: break-word;
}
.md:empty { display: none; }
.md strong { font-weight: 600; }
.md em { font-style: italic; }
.md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
  background: color-mix(in srgb, currentColor 12%, transparent);
  padding: 1px 4px;
  border-radius: 4px;
}
.md .md-h { font-weight: 600; }
.md .md-quote { opacity: 0.75; font-style: italic; }
.md hr {
  border: none;
  border-top: 1px solid color-mix(in srgb, currentColor 25%, transparent);
  margin: 6px 0;
}
.md a { color: inherit; }
.md .md-pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8em;
  line-height: 1.3;
  white-space: pre;
  overflow-x: auto;
  margin: 6px 0;
  padding: 8px 10px;
  border-radius: var(--r-s);
  background: color-mix(in srgb, currentColor 6%, transparent);
}

/* Схемы Юми (scheme.js): стена и план зала, SVG по ширине пузыря. */

/* Переключатель видов зала: План · Перспектива · Стены (scheme.js). */

.md a[href^="https://t.me/"], .empty a.tg-mention { color: var(--accent); text-decoration: none; }

.msg.assistant.typing .md::after {
  content: "▍";
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
/* Ожидание разбора: «Юми проводит разбор.» → «..» → «...» и снова. */
.msg.assistant.waiting .md::after { content: none; }
.wait-line { color: var(--hint); }
.wait-dots i { font-style: normal; animation: 1.8s steps(1, end) infinite; }
.wait-dots i:nth-child(2) { animation-name: wait-dot2; }
.wait-dots i:nth-child(3) { animation-name: wait-dot3; }
@keyframes wait-dot2 { 0% { opacity: 0; } 33.3% { opacity: 1; } 100% { opacity: 1; } }
@keyframes wait-dot3 { 0% { opacity: 0; } 66.6% { opacity: 1; } 100% { opacity: 1; } }

/* ---------- работы внутри сообщения ---------- */

/* Одна работа — миниатюрой ~160 px (крупно — по тапу): во всю ширину она
   занимала первый экран чата. */

/* ---------- просмотр работы во весь экран ---------- */

/* «Сохранить» у картинки в интерьере — слева от крестика, тот же круг. */

/* На телефоне листают свайпом — стрелки только мешают смотреть. */

.empty {
  margin: auto;
  text-align: center;
  color: var(--hint);
  font-size: var(--fs-s);
  max-width: 260px;
  line-height: 1.5;
}

/* ---------- кнопка «вниз», когда читаешь вверху ---------- */
.jump {
  position: fixed;
  right: 14px;
  bottom: calc(74px + env(safe-area-inset-bottom));
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-input);
  line-height: 1;
  cursor: pointer;
  z-index: 12;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}
.jump[hidden] { display: none; }

.composer {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.attach {
  flex: 0 0 auto;
  width: var(--h-icon); height: var(--h-icon);
  border-radius: 50%;
  background: var(--secondary-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: calc(22px * var(--fs)); color: var(--hint);
  border: none;
  padding: 0;
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
}
.attach:disabled { opacity: 0.4; cursor: default; }
.input {
  flex: 1 1 auto;
  min-height: var(--h-field);
  resize: none;
  max-height: 120px;
  border: 1px solid var(--border);
  border-radius: var(--r-m);
  padding: 9px 10px;
  font-family: inherit;
  /* 16px — ниже этого iOS зумит страницу при фокусе на поле ввода */
  font-size: var(--fs-input);
  line-height: 1.35;
  color: var(--text);
  background: var(--soft-bg);
  outline: none;
}

.btn-send {
  flex: 0 0 auto;
  width: var(--h-icon); height: var(--h-icon);
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--accent-text);
  font-size: var(--fs-input);
  cursor: pointer;
  /* Стрелка вверх — вектором, ровно по центру (символ «▲» съезжал). */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.btn-send svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.btn-send:disabled { opacity: 0.5; cursor: default; }

.flash {
  position: fixed;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%) translateY(10px);
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  font-size: var(--fs-s);
  padding: 8px 14px;
  border-radius: var(--r-m);
  max-width: 88%;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 60;
}
.flash.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- служебные строки и id для доступа ---------- */
.notice {
  align-self: center;
  max-width: 300px;
  margin-top: 4px;
  padding: 8px 12px;
  border: 1px dashed var(--border);
  border-radius: var(--r-m);
  color: var(--hint);
  font-size: var(--fs-s);
  line-height: 1.45;
  text-align: center;
}
.tg-id {
  display: block;
  margin: 10px auto 6px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-m);
  background: var(--soft-bg);
  font-family: inherit;
  cursor: pointer;
  color: var(--text);
  font-size: var(--fs-xl);
  font-weight: 600;
  letter-spacing: 0.02em;
  -webkit-user-select: all;
  user-select: all;
}

/* ---------- форма отзыва ---------- */
.fb {
  position: fixed;
  inset: 0;
  top: var(--vv-top, 0px);
  bottom: auto;
  height: var(--vv-height, 100%);
  z-index: 55; /* под .flash (60), чтобы «Спасибо» было видно */
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.45);
}
.fb[hidden] { display: none; }
.fb-card {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: var(--r-l);
  background: var(--bg);
  color: var(--text);
}
.fb-title { font-size: var(--fs-l); font-weight: 600; }
.fb-text {
  min-height: 120px;
  resize: vertical;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-m);
  background: var(--soft-bg);
  color: var(--text);
  font-family: inherit;
  /* 16px — ниже этого iOS зумит страницу при фокусе на поле ввода */
  font-size: var(--fs-input);
  line-height: 1.35;
  outline: none;
}
/* «Отправить» — основная во всю ширину, под ней тихая «Отмена» (как у листов). */
.fb-actions { display: flex; flex-direction: column-reverse; align-items: stretch; gap: 4px; }
.fb-send { width: 100%; height: var(--h-field); }

/* ---------- вкладки и экраны ---------- */
/* Строка вкладок — она же шапка приложения: вкладки, звёзды, меню ☰. */
.tabs {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px 4px 2px 8px;
  border-bottom: 1px solid var(--border);
}
.tab {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--hint-strong);
  font: inherit;
  font-size: var(--fs-m);
  padding: 5px 4px;
  border-radius: var(--r-s);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tabs .balance { padding: 4px 6px; margin-left: 4px; font-size: var(--fs-m); color: var(--hint-strong); }
.btn-menu {
  flex: 0 0 auto;
  width: var(--h-icon);
  height: var(--h-icon);
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--hint-strong);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.btn-menu svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.btn-menu:active { background: var(--soft-bg); }
.tab.active { background: var(--soft-bg); color: var(--text); font-weight: 600; }
.tab-count { color: inherit; font-weight: 400; font-size: var(--fs-m); }

.view, .pane {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ---------- ветка: заголовок ---------- */
.chatbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}
.chat-title {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
  font-size: var(--fs-m);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- список веток ---------- */
.list-pane { overflow-y: auto; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); gap: 8px; }
.new-chat {
  flex: 0 0 auto;
  height: var(--h-field);
  border: 1px dashed var(--accent);
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: var(--fs-m);
  font-weight: 500;
  padding: 0 16px;
  border-radius: var(--r-m);
  cursor: pointer;
}
.chat-list { display: flex; flex-direction: column; gap: 6px; }
.chat-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  border: none;
  background: var(--soft-bg);
  color: var(--text);
  font: inherit;
  text-align: left;
  padding: 11px 12px;
  border-radius: var(--r-m);
  cursor: pointer;
}
.chat-row.current { outline: 1px solid var(--border); }
.chat-row-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--fs-m);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-row-date { flex: 0 0 auto; color: var(--hint); font-size: var(--fs-xs); }

.empty p { margin: 0 0 10px; }
.empty .empty-note { font-size: var(--fs-xs); opacity: 0.85; }

/* ---------- полный разбор ---------- */
.report-foot { margin-top: 10px; text-align: center; } /* «Открыть полный разбор» — по центру, как «Показать в интерьере» */
/* Картинка в интерьере: под схемой — кнопка (.report-open — второстепенная) и нарисованные картинки. */

.report-open {
  min-height: var(--h-btn);
  border: 1px solid var(--accent);
  background: var(--bg);
  color: var(--accent);
  font: inherit;
  font-size: var(--fs-m);
  font-weight: 500;
  padding: 0 16px;
  border-radius: var(--r-m);
  cursor: pointer;
}

.report {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.report-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  padding: env(safe-area-inset-top) 8px 0 4px;
  border-bottom: 1px solid var(--border);
}
.report-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 18px calc(28px + env(safe-area-inset-bottom));
  font-size: var(--fs-m);
  line-height: 1.5;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}
.report-body .md-h { display: inline-block; margin-top: 10px; color: var(--accent); }
.report-body .md-h1 { font-size: 1.3em; color: var(--text); margin-top: 0; }
.report-body .md-h2 { font-size: 1.08em; }

/* ---------- кнопки общего вида ---------- */
.grow { flex: 1 1 auto; }
/* Три вида кнопок (DESIGN.md): основная — заливка акцентом; второстепенная —
   контур акцентом; тихая — серый текст. Удаление — красный текст. Высота 36,
   во всю ширину — 40; скругление 12; шрифт 15. */
.btn-primary, .btn-ghost, .btn-quiet, .notice-btn, .fb-send, .fb-cancel {
  flex: 0 0 auto;
  min-height: var(--h-btn);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-size: var(--fs-m);
  font-weight: 500;
  padding: 0 16px;
  border-radius: var(--r-m);
  cursor: pointer;
  white-space: nowrap;
}
.btn-primary, .notice-btn, .fb-send { border: none; background: var(--accent); color: var(--accent-text); }
.btn-primary.danger { background: var(--danger); color: #fff; }
.btn-ghost { border: 1px solid var(--accent); background: transparent; color: var(--accent); }
.btn-quiet, .fb-cancel { border: none; background: transparent; color: var(--hint); }
.btn-primary:disabled, .btn-ghost:disabled, .fb-send:disabled { opacity: 0.5; cursor: default; }
.notice-btn { display: flex; width: fit-content; margin: 8px auto 0; }
.link-danger {
  min-height: var(--h-btn);
  border: none;
  background: transparent;
  color: var(--danger);
  font: inherit;
  font-size: var(--fs-m);
  padding: 0 4px;
  cursor: pointer;
}

/* ---------- библиотека работ ---------- */

/* Как «＋ Новый чат»: пунктирная обводка — вид «добавить». */

/* Зона нажатия больше кружка — по нему легко попасть пальцем. */

.report-bar .chat-title { text-align: left; }

/* ---------- карточка работы, меню ---------- */
.sheet {
  position: fixed;
  inset: 0;
  /* Клавиатура: лист — в видимой части экрана, а не под клавиатурой (iPhone
     не сжимает страницу, только видимую область). --vv-* ставит app.js. */
  top: var(--vv-top, 0px);
  bottom: auto;
  height: var(--vv-height, 100%);
  z-index: 45;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px 12px calc(12px + env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.45);
}
.sheet-card {
  width: 100%;
  max-width: 480px;
  max-height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border-radius: var(--r-l);
  background: var(--bg);
  color: var(--text);
}

.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.field > span { font-size: var(--fs-xs); color: var(--hint-strong); }
.field input, .field select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--r-m);
  background: var(--soft-bg);
  color: var(--text);
  font-family: inherit;
  /* 16px — ниже этого iOS зумит страницу при фокусе на поле ввода */
  font-size: var(--fs-input);
  padding: 0 9px;
  /* Одна высота у полей и списков: списки браузер рисует по-своему. */
  height: 40px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.field select {
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238a8a8a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.field-row { display: flex; align-items: flex-end; gap: 8px; }
.field-row .field { flex: 1 1 0; }
.field-row .field.grow { flex: 2 1 0; }
.times { padding-bottom: 9px; color: var(--hint); }
/* Карточка работы: поля ниже обычных, чтобы влезло уточнение медиума. */

.sheet-actions { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
/* Пункт листа: строка 44 px. .primary — главное действие листа (заливка акцентом),
   .muted — «Закрыть» / «Отмена» тихим текстом внизу. */
.menu-item {
  min-height: 44px;
  border: none;
  background: var(--soft-bg);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-m);
  padding: 0 12px;
  border-radius: var(--r-m);
  cursor: pointer;
}
.menu-item.primary { background: var(--accent); color: var(--accent-text); font-weight: 500; }
.menu-item.danger { color: var(--danger); }
.menu-item.muted { background: transparent; color: var(--hint); min-height: var(--h-btn); }
/* Пакеты звёзд: строка «1000 ⭐   ~25 разборов и ~250 сообщений» — в одну строку на телефоне. */
.menu-item.pack { font-size: var(--fs-s); padding: 11px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-text { font-size: var(--fs-m); line-height: 1.45; }
.menu-text.menu-title { font-weight: 600; font-size: var(--fs-l); }

/* ---------- шапка чата без «‹ Чаты»: название слева, меню справа ---------- */
.chatbar { padding: 4px 6px 4px 14px; }
.chatbar .chat-title { text-align: left; }
.chatbar { gap: 2px; padding: 0 4px; }
.chatbar .chat-title { padding-left: 2px; }
/* ‹ все чаты, карандаш — новый чат, ⋯ в кружке — этот чат */
/* «‹ Назад» на экранах поверх приложения (разбор, выбор работ, памятки).
   Не сжимается и не переносится: рядом бывает длинный заголовок. */

.chatbar-icon {
  flex: 0 0 auto;
  width: var(--h-icon);
  height: var(--h-icon);
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--accent);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.chatbar-icon[hidden] { display: none; }
.chatbar-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* ⋯ «этот чат» — три точки без кружка, той же семьи, что карандаш и ‹
   (кружок рамкой на iPhone и Android выходил по-разному, 2026-10-11). */
.chatbar-icon svg.dots { fill: currentColor; stroke: none; }
.chatbar-icon:active { background: var(--soft-bg); }

/* «?» в шапке Юми: как работает Юми, данные */
/* Высота и контур — как у «Отзыв» и «Админка» */
/* Переключатель языка — левее «?»; он виден всегда (и на согласии), поэтому
   свободное место шапки отдаётся слева от него. */
.btn-lang {
  flex: 0 0 auto;
  height: calc(28px * var(--fs));
  margin-left: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-m);
  background: transparent;
  color: var(--hint);
  padding: 0 8px;
  font: inherit;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.btn-lang:active { background: var(--soft-bg); }
.consent-lang { position: absolute; top: 12px; right: 16px; z-index: 1; }
/* Длинные тексты в разметке — в двух вариантах (см. i18n.js). */
html[lang="en"] .ru-only,
html:not([lang="en"]) .en-only { display: none !important; }

/* ---------- экран разбора: работы по две в ряд ---------- */

.report-body .md { white-space: pre-wrap; word-wrap: break-word; }

/* ---------- вкладка «Разборы» ---------- */

.report-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: none;
  background: var(--soft-bg);
  color: var(--text);
  font: inherit;
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--r-m);
  cursor: pointer;
}
.report-row-thumbs { display: flex; flex: 0 0 auto; }
.report-row-thumbs img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: var(--r-s);
  border: 2px solid var(--bg);
  background: var(--bg);
}
.report-row-thumbs img + img { margin-left: -16px; }
.report-row-text { flex: 1 1 auto; min-width: 0; }

/* ---------- согласие и памятка о данных ---------- */
.consent-body { display: flex; flex-direction: column; justify-content: center; min-height: 100%; box-sizing: border-box; }
.consent-title { font-size: 1.3em; margin: 0 0 6px; }
.consent-text p { margin: 10px 0; }
.consent-list { margin: 10px 0; padding-left: 20px; }
.consent-list li { margin-bottom: 8px; }
.welcome-body .consent-title { margin-top: 0; }
.btn-primary[hidden] { display: none; }
.consent-ok { width: 100%; min-height: var(--h-field); margin-top: 12px; }
.link-btn { border: none; background: none; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-align: left; }
.privacy-body h1 { font-size: 1.3em; margin: 0 0 4px; }
.privacy-body h2 { font-size: 1.05em; margin: 20px 0 6px; color: var(--accent); }
.privacy-body p, .privacy-body li { margin: 0 0 8px; }
.privacy-body ul { padding-left: 20px; margin: 0 0 8px; }
.privacy-body a { color: var(--accent); }
.privacy-body .updated { color: var(--hint); font-size: 0.9em; margin-bottom: 14px; }
#privacy { z-index: 42; }
/* Общий лист меню — над просмотром во весь экран (50): из него открывается «Сохранить». */
#menu { z-index: 52; }

/* Ссылка-приглашение в меню «?» → «Пригласить друга». */
.invite-link {
  color: var(--hint);
  font-size: var(--fs-s);
  word-break: break-all;
  user-select: all;
  -webkit-user-select: all;
}
.muted-text { color: var(--hint); }

/* «Мои звёзды»: история баланса строками. */
.stars-line { font-variant-numeric: tabular-nums; padding: 2px 0; }
.stars-total { font-weight: 600; font-size: var(--fs-l); margin-bottom: 6px; }
.stars-line.muted-text { margin-top: 10px; font-size: var(--fs-s); }
.stars-sum { font-weight: 600; margin-top: 4px; }

/* «Прежде чем начать»: кто пригласил и бонус. */
.consent-invite { font-weight: 600; }

/* Удалить себя: кнопка внизу «Данные и конфиденциальность» и экран после. */
.danger-btn {
  width: 100%;
  min-height: var(--h-field);
  margin: 24px 0 8px;
  padding: 0 16px;
  border: 1px solid var(--danger);
  border-radius: var(--r-m);
  background: transparent;
  color: var(--danger);
  font: inherit;
  cursor: pointer;
}
.deleted-screen { padding: 32px 20px; max-width: 480px; margin: 0 auto; }
.deleted-screen h1 { font-size: 1.3em; margin: 0 0 12px; }

/* ---------- ракурсы одной работы ---------- */
/* Пометка «3 снимка» поверх главного снимка — в сетке работ и в чате. */

/* Карточка работы: все снимки с подписями и «＋ Ракурс». */

/* Экран разбора: ракурсы маленькими под главным снимком. */
.report-views { display: flex; gap: 6px; margin-top: 6px; justify-content: center; }
.report-views img {
  width: 30%;
  max-width: 120px;
  aspect-ratio: 1;
  object-fit: cover;
  max-height: none;
}

/* ---------- сайт (data-platform="web") ---------- */
/* Только в Telegram / только на сайте. */

/* Кнопки входа — ссылки (уходят на Google / Telegram), вид как у кнопок. */

#login-buttons p { color: var(--hint); text-align: center; }
/* На широком экране — колонка по центру: приложение задумано под телефон.
   transform делает body опорой для position: fixed — окна, листы и экраны
   разбора остаются в колонке, а не растягиваются на всё окно. */


/* ---------- комнаты (этап 2, макет mockups/rooms-v1.html) ---------- */
/* Снимок-миниатюра: угол 8, пока грузится — подложка. */
.shot {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--r-s);
  background: var(--soft-bg);
  cursor: zoom-in;
}
/* Строка комнаты = строка чата + миниатюра главного снимка и вторая строка. */
.room-row { align-items: center; padding: 8px 12px 8px 8px; }
.room-row .shot { flex: 0 0 auto; width: 56px; aspect-ratio: 1; cursor: inherit; }
.room-row-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.room-row-meta { color: var(--hint-strong); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Снимки в форме комнаты: по 3 в ряд, последняя клетка — «＋ Снимок» (вид «добавить»). */
.shots-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.shot-add {
  aspect-ratio: 4 / 3;
  border: 1px dashed var(--accent);
  border-radius: var(--r-s);
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: var(--fs-m);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}
.shot-wrap { position: relative; }
.shot-x {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: var(--fs-s);
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
/* Зона нажатия больше кружка. */
.shot-x::before { content: ""; position: absolute; inset: -8px; }
.form-note { font-size: var(--fs-s); color: var(--hint-strong); line-height: 1.45; }
.form-note b { color: var(--text); font-weight: 600; }
.room-form {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 12px calc(16px + env(safe-area-inset-bottom));
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
}
/* Лента снимков над разговором комнаты. */
.room-strip {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.room-strip .shot, .room-strip .shot-add { flex: 0 0 auto; width: 72px; }
.room-strip .shot-add { font-size: var(--fs-s); }
/* Снимки в сообщении (запрос разбора, «стало»). */
.msg-shots { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.msg-shots .shot { width: 64px; }
.empty .btn-primary { margin-top: 4px; }

/* Снимок во весь экран: тап — закрыть, свайп и ← → — соседние. */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
}
.viewer img { max-width: 100%; max-height: calc(100% - 32px); object-fit: contain; border-radius: var(--r-m); }
.viewer img:not([src]) { visibility: hidden; }
.viewer-cap { color: #fff; opacity: 0.8; font-size: var(--fs-s); }

/* ---------- стиль (этап 3): кнопка под разбором и две картинки ---------- */
.style-foot { margin-top: 10px; text-align: center; }
.render-box { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.render-fig { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.render-fig img {
  display: block;
  width: 100%;
  border-radius: var(--r-m);
  background: var(--soft-bg);
  cursor: zoom-in;
}
.render-fig img:not([src]) { display: none; }
.render-fig figcaption { font-size: var(--fs-s); color: var(--hint-strong); }
/* Пока рисуется — место под картинку с «Рисую…». */
.render-wait {
  aspect-ratio: 4 / 3;
  border-radius: var(--r-m);
  background: var(--soft-bg);
  color: var(--hint);
  font-size: var(--fs-s);
  display: flex;
  align-items: center;
  justify-content: center;
}
.render-note { font-size: var(--fs-xs); color: var(--hint); }
