/* Приложение — внешний вид.
   Дизайн «ночь и золото» (заказчик, 18.11.2026): тёмно-синий фон с мягким свечением, карточки «стекло» с тонкой
   золотой рамкой, синие кнопки, заголовки — шрифт с засечками (Playfair Display). Чтобы поменять дизайн, начните
   с переменных ниже. Тема «Авто» — как в телефоне; светлая — тот же дизайн на слоновой кости. Цвета темы Telegram
   больше не используются (они ломали дизайн). */
:root {
  color-scheme: dark;
  --bg: #070b16;                     /* фон (и цвет строки состояния телефона) */
  --bg-glow: radial-gradient(130% 55% at 50% -12%, #1a2c55 0%, rgba(26, 44, 85, 0) 62%),
             radial-gradient(55% 32% at 100% 0%, rgba(216, 180, 106, .16), rgba(216, 180, 106, 0) 70%),
             linear-gradient(180deg, #0a1226 0%, #060910 100%);
  --card: #111a2e;                   /* сплошной фон карточек и листа книги */
  --glass: linear-gradient(180deg, rgba(31, 44, 74, .78) 0%, rgba(14, 21, 38, .88) 100%);
  --glass-hi: linear-gradient(180deg, rgba(40, 58, 100, .9) 0%, rgba(22, 32, 60, .95) 100%);
  --edge: rgba(216, 180, 106, .42);  /* золотая рамка */
  --edge-soft: rgba(255, 255, 255, .09);
  --text: #f2eee6;
  --hint: #8e95a8;
  --gold: #dcb76c;
  --gold-text: #cfae6a;
  --accent: #3f6ff2;
  --accent-text: #ffffff;
  --link: #7ea2ff;
  --danger: #ff6b6b;
  --btn: linear-gradient(180deg, #4a7bff 0%, #2a4fd0 55%, #2241b4 100%);
  --btn-edge: rgba(150, 180, 255, .55);
  --btn-glow: 0 6px 20px rgba(48, 92, 235, .38);
  --field: rgba(0, 0, 0, .32);
  --line: rgba(255, 255, 255, .08);
  --soft: rgba(255, 255, 255, .06);
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Playfair Display", Georgia, "Times New Roman", serif;  /* заголовки экранов */
  --radius: 18px;          /* скругление карточек */
  --radius-small: 13px;    /* скругление кнопок и полей */
  --gap: 14px;             /* расстояние между блоками */
  --pad: 16px;             /* поля по краям экрана */
}

/* Светлая тема: выбор игрока или «Авто» при светлой теме телефона. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4efe4;
  --bg-glow: radial-gradient(130% 55% at 50% -12%, #fffaf0 0%, rgba(255, 250, 240, 0) 62%),
             radial-gradient(55% 32% at 100% 0%, rgba(201, 160, 80, .18), rgba(201, 160, 80, 0) 70%),
             linear-gradient(180deg, #f6f1e7 0%, #ece5d6 100%);
  --card: #fffdf8;
  --glass: linear-gradient(180deg, #fffefb 0%, #f9f4ea 100%);
  --glass-hi: linear-gradient(180deg, #ffffff 0%, #f3ead8 100%);
  --edge: rgba(160, 122, 52, .42);
  --edge-soft: rgba(40, 34, 20, .1);
  --text: #1d2233;
  --hint: #7b7f8b;
  --gold: #a57a2c;
  --gold-text: #94702e;
  --accent: #2f5bd8;
  --link: #2f5bd8;
  --danger: #d6363c;
  --btn-glow: 0 6px 16px rgba(48, 92, 235, .25);
  --field: #ffffff;
  --line: rgba(29, 35, 51, .09);
  --soft: rgba(29, 35, 51, .05);
  --shadow: 0 8px 22px rgba(90, 70, 30, .12);
  --q-shadow: 0 0 6px rgba(255, 253, 248, .95), 0 0 2px rgba(255, 253, 248, .9);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg: #f4efe4;
    --bg-glow: radial-gradient(130% 55% at 50% -12%, #fffaf0 0%, rgba(255, 250, 240, 0) 62%),
               radial-gradient(55% 32% at 100% 0%, rgba(201, 160, 80, .18), rgba(201, 160, 80, 0) 70%),
               linear-gradient(180deg, #f6f1e7 0%, #ece5d6 100%);
    --card: #fffdf8;
    --glass: linear-gradient(180deg, #fffefb 0%, #f9f4ea 100%);
    --glass-hi: linear-gradient(180deg, #ffffff 0%, #f3ead8 100%);
    --edge: rgba(160, 122, 52, .42);
    --edge-soft: rgba(40, 34, 20, .1);
    --text: #1d2233;
    --hint: #7b7f8b;
    --gold: #a57a2c;
    --gold-text: #94702e;
    --accent: #2f5bd8;
    --link: #2f5bd8;
    --danger: #d6363c;
    --btn-glow: 0 6px 16px rgba(48, 92, 235, .25);
    --field: #ffffff;
    --line: rgba(29, 35, 51, .09);
    --soft: rgba(29, 35, 51, .05);
    --shadow: 0 8px 22px rgba(90, 70, 30, .12);
    --q-shadow: 0 0 6px rgba(255, 253, 248, .95), 0 0 2px rgba(255, 253, 248, .9);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
/* Страница никогда не шире экрана (замечание заказчика 24.11.2026: всё уезжало вбок): лишнее по ширине обрезается,
   а не растягивает страницу вместе с нижней панелью. */
html { overflow-x: hidden; }
body { overflow-x: clip; max-width: 100%; }
.screen { overflow-x: clip; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
/* Фон со свечением — неподвижный слой под страницей (background-attachment: fixed на iPhone не работает). */
body::before { content: ""; position: fixed; inset: 0; z-index: -1; background: var(--bg-glow); pointer-events: none; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.screen {
  padding: calc(var(--pad) + env(safe-area-inset-top)) var(--pad) calc(118px + env(safe-area-inset-bottom));
  max-width: 640px;
  margin: 0 auto;
}
h1 { font: 700 30px/1.15 var(--display); margin: 4px 0 var(--gap); letter-spacing: .005em; }
h2 { font-size: 17px; margin: 0 0 8px; }
.muted { color: var(--hint); }
.small { font-size: 13px; }
.caption { color: var(--gold-text); font-size: 13px; margin: 0 4px; }
.stack > * + * { margin-top: var(--gap); }

/* Шапка экрана: заголовок слева, знак приложения справа */
/* Шапка: знак (к квестам) слева, заголовок, кнопка «Профиль» справа (решение заказчика 19.11.2026) */
.head { display: flex; align-items: center; gap: 12px; margin: 6px 0 18px; }
.head h1 { flex: 1; margin: 0; min-width: 0; overflow-wrap: anywhere; font-size: 28px; }
.profile-btn { flex: none; width: 44px; height: 44px; border-radius: 50%; padding: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--glass-hi); border: 1px solid var(--edge);
  box-shadow: 0 0 12px rgba(216, 180, 106, .18); }
.profile-btn .ic { width: 26px; height: 26px; vertical-align: middle; }
/* Нет фото — золотой значок дизайнера (решение заказчика 01.12.2026): он сам круглый, рамка кнопки не нужна. */
.profile-btn.no-photo { background: url(icons/ui/profile-gold.png) center / 100% no-repeat; border: 0; }
.profile-btn.no-photo.on { box-shadow: 0 0 16px rgba(216, 180, 106, .55); }
.profile-btn.on { border-color: var(--gold); box-shadow: 0 0 16px rgba(216, 180, 106, .45); }
.profile-btn:active { transform: scale(.94); }
.logo { flex: none; width: 46px; height: 46px; border-radius: 50%; object-fit: cover;
  filter: drop-shadow(0 0 10px rgba(216, 180, 106, .35)); mix-blend-mode: screen; }
:root[data-theme="light"] .logo { mix-blend-mode: normal; }
@media (prefers-color-scheme: light) { :root:not([data-theme]) .logo { mix-blend-mode: normal; } }

/* Загрузка */
.loading { display: flex; justify-content: center; padding: 64px 0; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--gold);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Карточки: «стекло» с тонкой золотой рамкой */
.card {
  position: relative;
  background: var(--glass);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.card.flush { padding: 0; }
.card-body { padding: 14px 16px 16px; }
.poster {
  display: block; width: 100%; aspect-ratio: 16 / 9;
  object-fit: cover; background: var(--soft);
}
.title { font-weight: 650; font-size: 16px; }
.badges { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0 14px; }
.badge {
  font-size: 13px; padding: 4px 11px; border-radius: 999px;
  background: var(--soft); color: var(--text); border: 1px solid var(--edge-soft);
}
.badge.gold { background: rgba(216, 180, 106, .16); border-color: var(--edge); }
.badge.blue { background: rgba(63, 111, 242, .14); border-color: rgba(126, 162, 255, .4); }

/* Карточка квеста (решение заказчика 29.11.2026, вместо отдельной картинки 24.11.2026): постер — фоном в правой части
   карточки, растворяется влево и книзу; слева поверх него — название, жанр, 👍/👎; ★ «Избранное» — в правом верхнем
   углу (поверх постера); внизу «Играть» и «Подробнее». Страница «Подробнее» — .q-detail. Постер «Книг» архива — целиком (.q-poster). */
.q-card { padding: 14px; position: relative; overflow: hidden; }
.q-row { position: relative; min-height: 168px; }
.q-cover { position: absolute; right: -14px; top: -14px; bottom: -6px; width: calc(62% + 14px); overflow: hidden;
  display: grid; place-items: center; pointer-events: none;
  -webkit-mask-image: linear-gradient(270deg, #000 38%, transparent 100%), linear-gradient(180deg, #000 72%, transparent 100%);
  -webkit-mask-composite: source-in; mask-image: linear-gradient(270deg, #000 38%, transparent 100%),
  linear-gradient(180deg, #000 72%, transparent 100%); mask-composite: intersect; }
.q-cover > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 35%; }
.q-cover > .ic { width: 44px; height: 44px; opacity: .5; }
.q-info { position: relative; margin-right: 40%; min-width: 0; min-height: 168px; display: flex; flex-direction: column;
  gap: 6px; }
.q-card .title { font-size: 18px; line-height: 1.25; text-shadow: var(--q-shadow, 0 1px 8px rgba(0, 0, 0, .85), 0 0 2px rgba(0, 0, 0, .6)); }
.q-genre { align-self: flex-start; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--gold-text); text-shadow: var(--q-shadow, 0 1px 6px rgba(0, 0, 0, .85)); }
.q-info .vote-row { margin-top: auto; }
.q-actions { margin-top: 14px; gap: 10px; }
.q-actions .btn { flex: 1; min-width: 0; white-space: nowrap; padding-left: 8px; padding-right: 8px; }
.fav-btn { position: absolute; top: 10px; right: 10px; z-index: 1; width: 36px; height: 36px; padding: 0; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; border: 1px solid var(--edge-soft);
  background: rgba(7, 11, 22, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.fav-btn .ic { width: 22px; height: 22px; vertical-align: middle; }
.fav-btn.on { border-color: var(--gold); box-shadow: 0 0 10px rgba(216, 180, 106, .45); }
.vote-row { display: flex; gap: 8px; }
.vote-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--edge-soft); background: var(--soft); color: var(--text); font-size: 14px;
  font-variant-numeric: tabular-nums; }
.vote-btn .ic { width: 20px; height: 20px; vertical-align: middle; }
.vote-btn.on { border-color: var(--gold); background: rgba(216, 180, 106, .14); }
/* Страница квеста «Подробнее» */
.q-detail-card { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.q-detail-poster { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--edge-soft); }
.q-detail-poster img { display: block; width: 100%; height: auto; }
.q-detail-title { font: 700 24px/1.2 var(--display); margin: 2px 0 0; }
.q-detail-desc { color: var(--text); opacity: .85; line-height: 1.5; white-space: pre-line; }
.review + .review { border-top: 1px solid var(--line); padding-top: 12px; }
.review-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.review-head .ic { width: 18px; height: 18px; }
.review-avatar { flex: none; width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.review-avatar.none { display: grid; place-items: center; background: var(--soft); }
.review-avatar.none .ic { width: 18px; height: 18px; }
.review-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-text { white-space: pre-line; overflow-wrap: anywhere; }
/* Вкладки над квестами: не помещаются — прокручиваются сами, страницу не растягивают */
.q-tabs { overflow-x: auto; scrollbar-width: none; }
.q-tabs::-webkit-scrollbar { display: none; }
.q-tabs .segment { flex: 1 0 auto; font-size: 14px; padding: 9px 8px; white-space: nowrap; }
.q-poster { aspect-ratio: auto; height: auto; }

/* Значки (icons.js): объёмные рисунки вместо эмодзи — золото; у неоткрытых вкладок нижнего меню — серебро. */
.ic { display: inline-block; width: 1.3em; height: 1.3em; vertical-align: -.3em; flex: none; overflow: visible;
  --ib: url(#icgb); --id: url(#icgd); --ie: #5b3d0b;
  filter: drop-shadow(0 1px 1.2px rgba(0, 0, 0, .45)); }
.ic .b { fill: var(--ib); stroke: var(--ie); stroke-width: .8; stroke-linejoin: round; }
.ic .d { fill: var(--id); stroke: var(--ie); stroke-width: .8; stroke-linejoin: round; }
.ic .p { fill: url(#icp); stroke: var(--ie); stroke-width: .7; }
.ic .r { fill: url(#icr); stroke: #6b0d0d; stroke-width: .8; }
.ic .bl { fill: url(#icbl); stroke: #14286e; stroke-width: .8; }
.ic .k { fill: none; stroke: var(--ie); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.ic .kw { fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.ic .x { fill: var(--ie); }
.ic .xw { fill: #fff; }
.ic .w { fill: #fff; opacity: .6; }
.ic .t { fill: #fff; font: 800 8.5px/1 var(--font); text-anchor: middle; }
.ic-png { object-fit: contain; filter: none; }
.ic.metal, .tabs .tab:not(.on) .ic { --ib: url(#icmb); --id: url(#icmd); --ie: #373c46; }
.ach-icon .ic { width: 36px; height: 36px; vertical-align: middle; }
.tab-icon .ic { width: 26px; height: 26px; vertical-align: middle; }
.g-icon .ic, .icon-btn .ic { width: 20px; height: 20px; vertical-align: middle; }
.logo-btn { flex: none; border: 0; padding: 0; background: none; cursor: pointer; border-radius: 50%; line-height: 0; }
.logo-btn:active { transform: scale(.94); }

/* Кнопки и поля */
.btn {
  display: block; width: 100%; cursor: pointer;
  padding: 13px 16px; border-radius: var(--radius-small);
  border: 1px solid var(--btn-edge); background: var(--btn); color: var(--accent-text);
  font-weight: 650; font-size: 16px;
  box-shadow: var(--btn-glow), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.btn:active { transform: translateY(1px); }
/* Вторая кнопка — тёмная с золотой рамкой */
.btn.secondary { background: var(--glass-hi); color: var(--text); border-color: var(--edge);
  box-shadow: 0 0 14px rgba(216, 180, 106, .14), inset 0 1px 0 rgba(255, 255, 255, .08); }
.btn.small { display: inline-block; width: auto; padding: 8px 14px; font-size: 14px; }
.btn:disabled { opacity: .5; }
.row { display: flex; gap: 8px; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }
.input {
  width: 100%; padding: 13px 14px; border-radius: var(--radius-small);
  border: 1px solid var(--edge-soft); background: var(--field); outline: none;
  font-size: 16px;  /* меньше 16px — iPhone при вводе увеличивает страницу, и края экрана уезжают */
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .25);
}
.input::placeholder { color: var(--hint); }
.input:focus { border-color: var(--edge); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px; }
.chip {
  flex: none; border: 1px solid var(--edge-soft); padding: 8px 15px; border-radius: 999px;
  background: var(--soft); color: var(--text); font-size: 14px; cursor: pointer;
}
.chip.on { background: var(--btn); border-color: var(--btn-edge); color: var(--accent-text); }
.chips.lang .chip.on { background: var(--glass-hi); border-color: var(--gold); color: var(--text);
  box-shadow: 0 0 12px rgba(216, 180, 106, .3); }
.icon-btn { border: 0; background: none; color: var(--hint); font-size: 18px; padding: 4px 8px; cursor: pointer; }

/* Переключатель внутри вкладки (Книги / Достижения, разделы «Обучения», тема) */
.segments { display: flex; gap: 4px; background: var(--soft); border: 1px solid var(--edge-soft);
  border-radius: 16px; padding: 4px; }
.segment {
  flex: 1; border: 1px solid transparent; background: none; padding: 9px 6px; border-radius: 12px; cursor: pointer;
  color: var(--hint); font-size: 15px;
}
.segment.on { background: var(--glass-hi); color: var(--text); border-color: var(--gold); font-weight: 600;
  box-shadow: 0 0 14px rgba(216, 180, 106, .28), inset 0 1px 0 rgba(255, 255, 255, .08); }

/* Галерея концовок */
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.gallery .card { box-shadow: none; }
.gallery .poster { aspect-ratio: 3 / 4; }
.gallery .card-body { padding: 8px 10px 10px; }
/* «Книги» архива: постер в рамке внутри карточки, закрытая концовка («???»), оглавление книги пройденной игры. */
.book-card { padding: 14px; box-shadow: 0 0 22px rgba(216, 180, 106, .14), var(--shadow); }
.book-card .poster { border-radius: 14px; border: 1px solid var(--edge-soft); }
.book-card .card-body { padding: 14px 4px 2px; }
.book-card .title { font-size: 18px; font-weight: 500; }
.gallery .ending-lock { display: flex; align-items: center; justify-content: center; font-size: 34px; background: var(--soft); }
.gallery .card.locked { opacity: .6; }
.gallery .card.clickable { cursor: pointer; }
.bk-toc-pic { width: 48px; height: 60px; border-radius: 8px; object-fit: cover; flex: none; }
.bk-toc-none { display: flex; align-items: center; justify-content: center; font-size: 24px; background: var(--soft); }
/* «Книги»: карточка пройденного квеста, список концовок */
.book-item { display: flex; align-items: center; gap: 14px; padding: 12px; }
.book-item.clickable { cursor: pointer; }
.book-item .stack > * + * { margin-top: 10px; }
.book-item .title { font-size: 17px; }
.book-item .badges { margin: 8px 0 0; }
.book-thumb { flex: none; width: 76px; height: 100px; border-radius: 10px; object-fit: cover; border: 1px solid var(--edge-soft); }
.book-thumb.none, .ending-thumb.none { display: flex; align-items: center; justify-content: center; font-size: 28px; background: var(--soft); }
.ending-item { gap: 12px; }
.ending-item.locked { opacity: .6; }
.ending-thumb { flex: none; width: 52px; height: 66px; border-radius: 8px; object-fit: cover; }
.chevron { flex: none; color: var(--gold); font-size: 26px; line-height: 1; padding: 0 2px; }

/* Списки (разборы, словарь, достижения, уведомления, профиль) */
.list { background: var(--glass); border: 1px solid var(--edge); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); }
.item { padding: 15px 16px; }
.item + .item { border-top: 1px solid var(--line); }
.item.clickable { cursor: pointer; }
.word { font-weight: 650; }
.mistake { text-decoration: line-through; color: var(--danger); }
.error-line { margin-top: 10px; }
.error-line .fix { font-weight: 600; }

/* Профиль */
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; }
.kv + .kv { border-top: 1px solid var(--line); }
.link-box { word-break: break-all; font-size: 14px; padding: 9px 11px; border-radius: var(--radius-small);
  background: var(--field); border: 1px solid var(--edge-soft); }

/* Уведомления */
.notif .title { font-size: 17px; }
.notif-text { white-space: pre-line; margin-top: 4px; font-size: 15px; color: var(--text); opacity: .85; }
.notif-date { color: var(--gold-text); font-size: 13px; opacity: .8; }
.notif.unread { box-shadow: inset 3px 0 0 var(--gold); }

/* Карточка финала (картинка) в архиве */
.card-image { display: block; width: 100%; max-width: 420px; border-radius: var(--radius-small); margin-bottom: 10px; }

.empty { text-align: center; color: var(--hint); padding: 32px 16px; }

/* Нижнее меню вкладок: тёмная полоса с золотой линией сверху, значки — рисунки (см. index.html) */
.tabs {
  /* Панель — прямоугольник с закруглёнными краями над низом экрана; «Квесты» — в центре, в круге
     (решение заказчика 19.11.2026). */
  position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 4;
  max-width: 616px; margin: 0 auto; display: flex; gap: 0; padding: 6px 4px;
  border-radius: 26px; border: 1px solid var(--edge);
  background: linear-gradient(180deg, color-mix(in srgb, var(--card) 94%, transparent), color-mix(in srgb, var(--bg) 96%, transparent));
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .06);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
/* Подложка под панелью: тот же фон страницы, выше контента и ниже панели — прокручиваемое уходит под неё. */
.tabs-floor { position: fixed; left: 0; right: 0; bottom: 0; z-index: 3; pointer-events: none;
  height: var(--floor-h, calc(96px + env(safe-area-inset-bottom)));
  background: var(--bg-glow); background-size: 100% 100vh; background-position: center bottom; }
.tabs[hidden] + .tabs-floor { display: none; }
.tab {
  flex: 1; border: 0; background: none; cursor: pointer; padding: 6px 0 5px; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 11px; color: var(--hint);
}
.tab { position: relative; min-width: 0; }
.tabs .tab { font-size: 10.5px; letter-spacing: -.02em; }
.tab > span:nth-child(2) { max-width: 100%; padding: 0 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab-icon { font-size: 20px; line-height: 1; filter: grayscale(1); opacity: .7; }
/* Число непрочитанных уведомлений на вкладке */
.tab-dot {
  position: absolute; top: 2px; left: calc(50% + 7px); min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 600; line-height: 16px;
}
.tab.on { color: var(--gold); background: rgba(216, 180, 106, .12);
  box-shadow: inset 0 0 0 1px rgba(216, 180, 106, .18); }
.tabs .tab { border-radius: 20px; }
/* «Квесты» — круг, приподнятый над панелью */
.tabs .tab-center, .tabs .tab-center.on { flex: 0 0 64px; background: none; box-shadow: none; }
/* Значки вкладок — рисунки дизайнера (PNG, webapp/icons/ui/, 01.12.2026): открытая вкладка — золото, остальные —
   серебро; «Квесты» — круг с книгой целиком. */
.tabs .tab-img { width: 36px; height: 36px; background: center / contain no-repeat; }
.tabs .tab { gap: 1px; }
.tab[data-tab="feed"] .tab-img { background-image: url(icons/ui/feed-silver.png); }
.tab.on[data-tab="feed"] .tab-img { background-image: url(icons/ui/feed-gold.png); }
.tab.unread[data-tab="feed"]:not(.on) .tab-img { background-image: url(icons/ui/feed-silver-dot.png); }
.tab[data-tab="words"] .tab-img { background-image: url(icons/ui/cap-silver.png); }
.tab.on[data-tab="words"] .tab-img { background-image: url(icons/ui/cap-gold.png); }
.tab[data-tab="archive"] .tab-img { background-image: url(icons/ui/chest-silver.png); }
.tab.on[data-tab="archive"] .tab-img { background-image: url(icons/ui/chest-gold.png); }
.tab[data-tab="notifications"] .tab-img { background-image: url(icons/ui/bell-silver.png); }
.tab.on[data-tab="notifications"] .tab-img { background-image: url(icons/ui/bell-gold.png); }
.tab-circle { display: block; width: 66px; height: 66px; margin: -32px 0 1px; border-radius: 50%;
  background: url(icons/ui/book-silver.png) center / 100% no-repeat;
  box-shadow: 0 6px 18px rgba(48, 92, 235, .35), 0 0 0 4px var(--bg); }
.tabs .tab-center.on .tab-circle { background-image: url(icons/ui/book-gold.png);
  box-shadow: 0 0 22px rgba(216, 180, 106, .5), 0 6px 18px rgba(48, 92, 235, .35), 0 0 0 4px var(--bg); }
.tabs .tab-center:active .tab-circle { transform: scale(.95); }
.tab.on .tab-icon { filter: none; opacity: 1; }

/* Всплывающее сообщение */
.toast {
  position: fixed; left: 50%; bottom: calc(104px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 11px 16px; border-radius: var(--radius-small); border: 1px solid var(--edge);
  background: var(--card); color: var(--text); font-size: 14px; text-align: center; z-index: 10; white-space: pre-line;
  box-shadow: var(--shadow);
}

/* Достижения (Архив → Достижения) */
.achievement .title { font-size: 17px; font-weight: 500; }
.achievement:not(.done) { opacity: .8; }
.achievement:not(.done) .ach-icon { filter: grayscale(1); }
.ach-icon { font-size: 34px; line-height: 1; width: 44px; text-align: center; }
.ach-done { color: var(--gold); font-weight: 700; font-size: 22px; text-shadow: 0 0 8px rgba(216, 180, 106, .5); }
.ach-bar { height: 4px; border-radius: 2px; background: var(--line); margin-top: 10px; overflow: hidden; }
.ach-fill { height: 100%; background: linear-gradient(90deg, #2a4fd0, #5b8bff); }

/* Обучение: четыре раздела, карточки, упражнения */
.segments.four .segment { font-size: 13px; padding: 9px 1px; white-space: nowrap; }
.flash { text-align: center; padding: 30px 16px; }
.flash-front { font: 600 28px/1.3 var(--display); overflow-wrap: anywhere; }
.flash-back { margin-top: 14px; font-size: 18px; }
.flash-buttons { gap: var(--gap); }
.flash-listen { justify-content: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.q-sort { gap: 8px; flex-wrap: wrap; }
.rule-title { font-size: 17px; margin: 8px 4px 0; }
.flash-verdict { margin-top: 12px; font-weight: 600; }
.flash-verdict.ok { color: var(--ok, #3fb950); }
.flash-verdict.bad { color: var(--danger); }
.report { text-align: center; }
.report-nums { gap: var(--gap); }
.report-num { font: 600 34px/1.2 var(--display); }
.report-num.ok { color: var(--ok, #3fb950); }
.report-num.bad { color: var(--danger); }
.report .small { text-align: left; }
.flash-buttons .btn { flex: 1; }
.gap { font-weight: 600; color: var(--gold); }
.chips.options { flex-wrap: wrap; overflow: visible; margin-top: 8px; }

/* ---------------------------------------------------------------------
   Экран игры (game.js) — «страница сцены» по макету docs/mockups/scene-page.html.
   Цвета и размеры — те же переменные, что у кабинета (начало файла).
   --------------------------------------------------------------------- */
body.in-game { overflow: hidden; overscroll-behavior: none; }
html:has(body.in-game) { overflow: hidden; overscroll-behavior: none; }
/* Экран не сдвигается ни вверх-вниз, ни вбок (замечание заказчика): прокручивается только текст сцены. */
.game { overflow: hidden; overscroll-behavior: none; }
.g-top, .g-dock { touch-action: none; }
.game {
  position: fixed; inset: 0; z-index: 5; background: var(--bg);
  display: flex; flex-direction: column;
}
.g-top {
  flex: none; display: flex; align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) var(--pad) 8px; background: var(--card); border-bottom: 1px solid var(--line);
}
.g-title { flex: 1; min-width: 0; text-align: center; font-weight: 600; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-icon { border: 0; background: var(--soft); border-radius: 999px; width: 34px; height: 34px; font-size: 16px;
  cursor: pointer; flex: none; color: var(--text); }
.g-icon-space { width: 34px; flex: none; }
.g-body { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  touch-action: pan-y; padding: 12px var(--pad) 16px; }
.g-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.g-content { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.g-body > .stack { max-width: 640px; margin: 0 auto; }
.g-text { white-space: pre-line; font-size: 16px; line-height: 1.5; overflow-wrap: anywhere; }
.g-image { position: relative; display: block; width: 100%; padding: 0; border: 0; cursor: zoom-in;
  border-radius: var(--radius); overflow: hidden; background: var(--soft); }
.g-image img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.g-zoom { position: absolute; right: 8px; bottom: 8px; font-size: 12px; color: #fff;
  background: rgba(0, 0, 0, .4); border-radius: 999px; padding: 2px 8px; }
.g-mystery { margin-top: 12px; font-weight: 600; }
.g-entry { padding: 10px 12px; }
.g-action { box-shadow: inset 3px 0 0 var(--accent); }
.g-who { font-size: 12px; font-weight: 600; color: var(--hint); margin-bottom: 2px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.g-mini { border: 0; background: none; font-size: 15px; padding: 2px 4px; cursor: pointer; }
.g-speaker { color: var(--accent); }
.g-said { align-self: flex-end; max-width: 85%; background: var(--soft); border-radius: var(--radius); padding: 8px 12px;
  white-space: pre-line; overflow-wrap: anywhere; }
.g-fix { margin-top: 6px; font-size: 13px; color: var(--hint); }
.g-note-img { display: block; width: 100%; max-height: 50vh; object-fit: cover; border-radius: var(--radius-small); margin: 4px 0; }
.g-thinking { display: flex; align-items: center; gap: 10px; color: var(--hint); font-size: 14px; padding: 4px; }
.g-thinking .spinner { width: 18px; height: 18px; border-width: 2px; }
.g-version .btn { flex: 1; }
.g-ending-poster { border-radius: var(--radius); }
.g-card { max-width: 100%; margin: 0 auto; }
.g-reward { box-shadow: inset 3px 0 0 var(--accent); }

/* Нижняя строка пиктограмм — как вкладки кабинета (.tab) */
.g-dock { flex: none; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.g-tools { display: flex; }
.g-tools .tab { position: relative; }
.g-tools .tab-icon { filter: none; opacity: 1; }  /* в игре значки цветные (решение заказчика); в кабинете — серые, цвет у открытой вкладки */
.g-dot { position: absolute; top: 4px; left: calc(50% + 8px); width: 9px; height: 9px; border-radius: 50%;
  background: var(--danger); box-shadow: 0 0 0 2px var(--card); }
.g-compose { display: flex; gap: 8px; align-items: center; padding: 8px var(--pad); border-bottom: 1px solid var(--line); }
.g-compose .input { flex: 1; min-width: 0; border-radius: 999px; }
.g-send { flex: none; width: 40px; height: 40px; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--accent); color: var(--accent-text); font-size: 16px; }
.g-send:disabled { opacity: .5; }

/* Плеер озвучки */
.g-player { display: flex; gap: 10px; align-items: center; padding: 8px var(--pad); border-bottom: 1px solid var(--line); }
.g-finale .g-player { border: 0; padding: 0; }
.g-pp { flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--accent); color: var(--accent-text); }
.g-bar { flex: 1; min-width: 0; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.g-bar i { display: block; height: 100%; width: 0; background: var(--accent); }
.g-speed { flex: none; border: 1px solid var(--line); background: none; color: var(--text); border-radius: 999px;
  padding: 5px 10px; font-size: 13px; cursor: pointer; }
.g-speed.on { background: var(--soft); color: var(--accent); border-color: transparent; }

/* Выдвижная панель */
.g-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .35); z-index: 6; }
.g-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 7; max-height: 80%;
  display: flex; flex-direction: column; background: var(--card); border-radius: 18px 18px 0 0;
  padding-bottom: env(safe-area-inset-bottom); animation: g-up .2s ease-out;
}
@keyframes g-up { from { transform: translateY(30%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .g-sheet { animation: none; } }
.g-grab { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 8px auto 2px; flex: none; }
.g-sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 4px var(--pad) 8px; flex: none; }
.g-sheet-head h2 { margin: 0; }
.g-sheet-body { overflow-y: auto; padding: 0 var(--pad) 18px; display: flex; flex-direction: column; gap: 14px; }
.g-group-title { font-size: 12px; color: var(--hint); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.g-list { display: flex; flex-direction: column; gap: 6px; }
.g-row { border: 0; width: 100%; text-align: left; cursor: pointer; background: var(--bg); color: var(--text);
  border-radius: var(--radius-small); padding: 11px 12px; }
.g-row:disabled { opacity: .5; }
.g-row.g-decision { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.g-danger-text { color: var(--danger); }
.g-danger { background: var(--danger); }
.g-row.g-chosen { box-shadow: inset 0 0 0 2px var(--accent); font-weight: 600; }
.g-seg { background: var(--bg); overflow-x: auto; scrollbar-width: none; }
.g-seg::-webkit-scrollbar { display: none; }
.g-seg .segment { flex: 1 0 auto; white-space: nowrap; padding: 8px 10px; }
.g-dict { padding: 10px 12px; }
.g-note { display: flex; gap: 10px; align-items: flex-start; }
.g-note-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.g-note .btn { flex: none; }

/* Картинка на весь экран */
.g-viewer { position: absolute; inset: 0; z-index: 9; background: #000; display: flex; align-items: center; justify-content: center; }
.g-viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.g-viewer-close { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; background: rgba(255, 255, 255, .2); color: #fff; }

/* Блокнот: точка на вкладке с непрочитанной записью, новые записи открытой вкладки — с полоской слева */
.g-seg .segment { position: relative; }
.g-seg .g-dot { top: 3px; right: 4px; left: auto; }
.g-note-new { box-shadow: inset 3px 0 0 var(--danger); }
.g-note-new-box { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.g-note-new-box .btn { align-self: flex-end; }
.g-note-input { width: 100%; resize: vertical; font: inherit; }
.g-note:has(.g-note-input), .g-note-col { flex-direction: column; align-items: stretch; }
.g-note-col .row { justify-content: flex-end; }
.g-note .row { flex: none; gap: 6px; }
.g-mine { white-space: pre-wrap; }

/* Слово по нажатию: текст квеста можно и нажимать (перевод), и выделять долгим нажатием */
.g-tap { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; cursor: pointer; }
::highlight(lq-word) { background-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.g-word {
  position: fixed; z-index: 60; top: 8px; left: 8px; right: 8px; max-width: 624px; margin: 0 auto;
  background: var(--card); color: var(--text); border-radius: var(--radius); padding: 12px 14px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .28); animation: g-word-in .18s ease-out;
}
@keyframes g-word-in { from { transform: translateY(-110%); } to { transform: none; } }
.g-word .spinner { margin: 8px auto 4px; }
.g-word-head { display: flex; align-items: baseline; gap: 8px; }
.g-word-head .g-icon { margin-left: auto; }
.g-word-lemma { font-size: 19px; font-weight: 700; }
.g-word-ipa { font-size: 15px; }
.g-word-tr { font-size: 17px; margin: 4px 0 2px; }
.g-word-btns { margin-top: 10px; flex-wrap: wrap; }
.g-card-acts { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.g-listen { display: flex; justify-content: flex-end; margin: 2px -4px -6px 0; }
.g-listen:empty { display: none; }
.g-said-in { font-size: 14px; margin-bottom: 6px; }
.g-word-pos { font-size: 13px; font-style: italic; }
.g-word-src { font-size: 11px; margin-top: 6px; }

/* ---------------------------------------------------------------------
   Книжный вид экрана игры (book.js; макет docs/mockups/book-pages.html): лист по размеру экрана, загиб
   правого нижнего угла, стрелки внизу. Цвета — из темы приложения (светлой или тёмной).
   --------------------------------------------------------------------- */
.game {
  --bk-paper: var(--card);
  --bk-paper-back: color-mix(in srgb, var(--card) 88%, var(--hint));
  --bk-paper-edge: color-mix(in srgb, var(--card) 75%, var(--hint));
  --bk-fold-hi: color-mix(in srgb, var(--card) 40%, transparent);
  --bk-shade: rgba(0, 0, 0, .32);
  /* реплики героя — зелёным курсивом (решение заказчика); смесь с цветом текста: темнее в светлой теме, светлее в тёмной */
  --bk-me-ink: color-mix(in srgb, #2f9e5a 75%, var(--text));
  --bk-art-a: #1c2a3c; --bk-art-b: #3f5a7a; --bk-art-c: #a9bfd6;
  --bk-read: "Literata", Georgia, "Times New Roman", serif;
}
.g-title small { display: block; font-weight: 400; font-size: 12px; color: var(--hint); }
.bk-stage {
  position: relative; flex: 1; min-height: 0; margin: 10px 10px 0; border-radius: 4px 12px 12px 4px;
  overflow: hidden; touch-action: pan-y; user-select: none; -webkit-user-select: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 6px 18px rgba(0, 0, 0, .10);
}
.bk-page {
  position: absolute; inset: 0; background: var(--bk-paper); color: var(--text);
  padding: 22px 20px 38px; display: flex; flex-direction: column; overflow: hidden;
}
.bk-page::before { /* корешок: лёгкая тень слева, как у книги */
  content: ""; position: absolute; inset: 0 auto 0 0; width: 12px; pointer-events: none;
  background: linear-gradient(90deg, var(--line), transparent);
}
.bk-under { z-index: 1; pointer-events: none; }
.bk-shade { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.bk-top { z-index: 3; will-change: clip-path; }
.bk-flapwrap { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.bk-flap { position: absolute; left: 0; top: 0; width: 100%; height: 100%; transform-origin: 0 0; overflow: hidden;
  background-color: var(--bk-paper-back); will-change: transform, clip-path; }
.bk-ghost { position: absolute; inset: 0; padding: 22px 20px 38px; opacity: .07; }
.bk-meas { visibility: hidden; z-index: 0; pointer-events: none; }

.bk-content { flex: none; font: 17px/1.55 var(--bk-read); hyphens: auto; -webkit-hyphens: auto; }
.bk-content p { margin: 0; }
.bk-t { text-align: justify; text-indent: 1.3em; }
.bk-t.cont { text-indent: 0; }
.bk-t.d { text-indent: 0; margin-top: .35em; }
/* Новая сцена внутри главы — с отступом, без новой страницы; первая строка страницы — без отступа. */
.bk-t.sc, .bk-me.sc { margin-top: 1.1em; }
.bk-content > :first-child { margin-top: 0; }
.bk-label { margin: .8em 0 .4em; font: 600 13px/1.4 var(--font); color: var(--accent); }
.bk-q { margin: .8em 0; font-weight: 600; }
.bk-img { display: block; width: 100%; height: 170px; margin: 0 0 .8em; padding: 0; border: 0; border-radius: 8px;
  overflow: hidden; background: var(--bg); cursor: zoom-in; }
.bk-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Разговор — как текст книги: реплики с тире; свои — курсивом и чуть бледнее, имя персонажа — капителью. */
.bk-me .bk-t { font-style: italic; color: var(--bk-me-ink); }
.bk-who { font-variant: small-caps; letter-spacing: .05em; font-weight: 600; color: var(--accent); }
.bk-npc .g-mini { font-size: 13px; padding: 0 2px; vertical-align: 1px; }
.bk-fix { margin-top: 2px !important; font: 14px/1.4 var(--font); color: var(--hint); }
.bk-folio { position: absolute; left: 0; right: 0; bottom: 12px; text-align: center; font: 12px/1 var(--bk-read); color: var(--hint); }
.bk-page.bk-last { padding-bottom: 12px; }
.bk-page.bk-last .bk-folio { display: none; }
/* Кнопки и 🔊 сцены — одной строкой (🔊 справа): так кнопкам нужно меньше места и текст реже уходит на новую страницу. */
.bk-controls { margin-top: auto; padding-top: 12px; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; font-family: var(--font); }
.bk-controls > * { order: 1; flex: 1 1 100%; }
.bk-controls .g-card-acts { margin-top: 0; flex: 1 1 0; min-width: 0; align-items: flex-start; }
.bk-controls .g-thinking { flex: 1 1 0; }
.bk-controls .g-listen { order: 2; flex: 0 0 auto; margin: 0 -4px 0 auto; }

.bk-art-page { padding: 16px 16px 20px; }
.bk-art { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.bk-pic { position: relative; flex: 1; min-height: 0; border-radius: 6px; overflow: hidden; background: var(--bk-art-a); }
.bk-pic svg, .bk-pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* Иллюстрация главы — целиком, без обрезки (замечание заказчика 29.11.2026: лошадка главы 3 была обрезана) */
.bk-pic img { object-fit: contain; }
.bk-pic:has(img) { background: transparent; }
.bk-art h2 { margin: 0 0 4px; font: 600 24px/1.2 var(--bk-read); color: var(--text); }
.bk-art h2.bk-k { margin: 4px 0 0; }

.bk-nav { flex: none; display: flex; align-items: center; gap: 10px; padding: 8px 14px; touch-action: none; }
.bk-arrow { width: 52px; height: 40px; border-radius: 20px; border: 0; background: var(--card); color: var(--text);
  display: grid; place-items: center; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); cursor: pointer; }
.bk-arrow svg { width: 22px; height: 22px; }
.bk-arrow:disabled { opacity: .35; cursor: default; }
.bk-pos { flex: 1; min-width: 0; text-align: center; font-size: 12px; color: var(--hint); font-variant-numeric: tabular-nums; }
.bk-track { height: 3px; margin-top: 6px; border-radius: 2px; background: var(--line); overflow: hidden; }
.bk-track i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 2px; transition: width .3s; }
/* Поле реплики — только на последней странице главы (на прошлых страницах его нет). */
.game.bk-back .g-compose { visibility: hidden; }  /* место остаётся: страницы не пересобираются при листании */
/* Кнопки — на следующей, последней странице: стрелка «›» шире, с подписью «Дальше» и мягко пульсирует. */
.bk-more-label { display: none; font-size: 14px; font-weight: 600; }
.game.bk-more .bk-arrow[aria-label=next] { width: auto; padding: 0 12px 0 16px; gap: 2px; grid-auto-flow: column;
  background: var(--accent); color: #fff; animation: bk-more 1.6s ease-in-out infinite; }
.game.bk-more .bk-more-label { display: inline; }
@keyframes bk-more { 50% { transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .game.bk-more .bk-arrow[aria-label=next] { animation: none; } }
@media (prefers-reduced-motion: reduce) { .bk-track i { transition: none; } }

/* 🐞 Сообщить об ошибке: поле текста и кнопка при выделенном тексте книги (над нижней панелью). */
.g-report { resize: vertical; min-height: 96px; font: inherit; }
.g-report-chip { position: fixed; left: 50%; transform: translateX(-50%); z-index: 60; gap: 8px; flex-wrap: wrap; justify-content: center; width: max-content; max-width: calc(100vw - 32px);
  bottom: calc(150px + env(safe-area-inset-bottom, 0px)); }
.g-report-chip .btn { box-shadow: 0 2px 10px rgba(0, 0, 0, .25); white-space: nowrap; }
.g-report-chip .btn.secondary { background: var(--card); }
.g-phrase-orig { margin: 4px 0 2px; font-style: italic; }

/* Окно подтверждения вне Telegram (platform.confirm, этап С4) — в Telegram показывается его собственное. */
.dialog-shade {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: var(--pad);
}
.dialog {
  background: var(--card); color: var(--text);
  border-radius: var(--radius);
  padding: 20px var(--pad) var(--pad);
  width: 100%; max-width: 360px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}
.dialog-text { white-space: pre-line; margin-bottom: 18px; }
.dialog-buttons { display: flex; gap: 10px; }
.dialog-buttons .btn { flex: 1; }

/* Переключатели уведомлений (профиль → «Уведомления на телефон», решение заказчика 18.11.2026): как в iPhone, синие. */
.switches { display: flex; flex-direction: column; }
.switch-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; }
.switch-row > .grow { flex: 1; min-width: 0; }
.switch-row + .switch-row { border-top: 1px solid var(--line); }
.switch-row .input { width: auto; padding: 8px 10px; }
.switch {
  position: relative; flex: none; width: 51px; height: 31px; padding: 0; border: 0; border-radius: 16px; cursor: pointer;
  background: color-mix(in srgb, var(--hint) 38%, transparent); transition: background .2s;
  box-shadow: inset 0 0 0 1px var(--edge-soft);
}
.switch .knob {
  position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .3), 0 0 1px rgba(0, 0, 0, .2); transition: transform .2s;
}
.switch.on { background: linear-gradient(180deg, #4a7bff, #2a4fd0); box-shadow: 0 0 10px rgba(48, 92, 235, .35); }
.switch.on .knob { transform: translateX(20px); }
.switch:disabled { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .switch, .switch .knob { transition: none; } }

/* Кнопка «Профиль»: разделы выпадающим списком поверх страницы (решение заказчика 19.11.2026) */
.dropdown-menu { position: fixed; z-index: 20; min-width: 240px; max-width: calc(100vw - 32px); display: flex; flex-direction: column;
  padding: 6px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--edge);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .45); }
.dropdown-item { border: 0; background: none; color: var(--text); text-align: left; padding: 12px; border-radius: 10px;
  font-size: 16px; cursor: pointer; }
.dropdown-item + .dropdown-item { margin-top: 2px; }
.dropdown-item.on { background: rgba(216, 180, 106, .14); color: var(--gold); font-weight: 600; }
.dropdown-item:active { background: var(--soft); }
.popover { animation: pop-in .14s ease-out; transform-origin: top right; max-height: 60vh; overflow-y: auto; }
@keyframes pop-in { from { opacity: 0; transform: scale(.96) translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .popover { animation: none; } }
.stat-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.stat-row-value { color: var(--gold); font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.prose { white-space: pre-line; line-height: 1.5; }
.support-text { resize: vertical; min-height: 120px; font: inherit; }

/* «Лента» (этап Л1, docs/feed.md; webapp/feed.js): пост — карточка: автор, текст, фото и видео, реакции, комментарии */
.feed-soon { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; padding: 34px 20px;
  color: var(--hint); font-size: 16px; }
.feed-ic { width: 64px; height: 64px; }
.post { display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.post-head { margin: 0; }
.post-head > .grow { flex: 1; min-width: 0; }
.post-head .review-avatar { width: 38px; height: 38px; }
.post-head .review-avatar.none .ic { width: 24px; height: 24px; }
.post-menu { font-size: 22px; line-height: 1; color: var(--gold); padding: 2px 6px; }
.post-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; font-size: 16px; }
.post-text a, .review-text a { color: var(--link); text-decoration: underline; word-break: break-all; }
.post-text.clamped { display: -webkit-box; -webkit-line-clamp: 10; -webkit-box-orient: vertical; overflow: hidden; }
.post-translation { margin-top: 8px; padding: 10px 12px; border-radius: var(--radius-small); background: var(--soft);
  border-left: 3px solid var(--gold); }
.link-btn { align-self: flex-start; border: 0; background: none; padding: 2px 0; color: var(--link); cursor: pointer;
  font-size: 14px; }
.link-btn.danger { color: var(--danger); }
.link-btn:disabled { opacity: .5; }
.post-gallery { position: relative; margin: 0 -14px; }
.post-media { position: relative; background: #000; max-height: 75vh; overflow: hidden; display: flex; align-items: center;
  justify-content: center; }
.post-media img, .post-media video { display: block; width: 100%; height: 100%; max-height: 75vh; object-fit: contain; }
.post-gallery.one .post-media { aspect-ratio: auto; }
.post-strip { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  -webkit-overflow-scrolling: touch; }
.post-strip::-webkit-scrollbar { display: none; }
.post-strip .post-media { flex: 0 0 100%; scroll-snap-align: center; aspect-ratio: 4 / 5; }
.post-strip .post-media img, .post-strip .post-media video { object-fit: cover; }
.post-count { position: absolute; top: 10px; right: 12px; padding: 3px 9px; border-radius: 999px; font-size: 12px;
  background: rgba(0, 0, 0, .55); color: #fff; pointer-events: none; }
.reactions { display: flex; gap: 6px; flex-wrap: wrap; }
.reaction { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--edge-soft); background: var(--soft); color: var(--text); font-size: 14px; }
.reaction-emoji { font-size: 17px; line-height: 1; }
.reaction-n { font-variant-numeric: tabular-nums; font-weight: 600; }
.reaction.on { border-color: var(--gold); background: rgba(216, 180, 106, .16); box-shadow: 0 0 10px rgba(216, 180, 106, .25); }
.reaction:active { transform: scale(.94); }
.comments { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.comment-list > * + * { margin-top: 12px; }
.comment .review-avatar { width: 26px; height: 26px; }
.comment-reply { margin: -2px 0 2px; }
.comment-acts { display: flex; gap: 16px; margin-top: 4px; }
.comment-acts .link-btn { font-size: 13px; }
.comment-form { display: flex; gap: 8px; align-items: flex-end; }
.comment-input { resize: vertical; min-height: 48px; font: inherit; font-size: 16px; }
.reply-chip { display: flex; align-items: center; gap: 6px; color: var(--gold-text); }
.feed-viewer { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; align-items: center;
  justify-content: center; }
.feed-viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.feed-viewer-close { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; color: #fff;
  background: rgba(255, 255, 255, .2); border-radius: 50%; width: 38px; height: 38px; }
/* Редактор поста */
.post-input { resize: vertical; min-height: 160px; font: inherit; font-size: 16px; line-height: 1.45; }
.editor-media { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.editor-media:empty { display: none; }
.editor-thumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #000;
  border: 1px solid var(--edge-soft); }
.editor-thumb img, .editor-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.editor-thumb.failed { opacity: .4; border-color: var(--danger); }
.editor-badge { position: absolute; left: 6px; bottom: 6px; color: #fff; font-size: 12px; text-shadow: 0 1px 3px #000; }
.editor-progress { position: absolute; left: 6px; right: 6px; bottom: 6px; height: 5px; border-radius: 3px;
  background: rgba(255, 255, 255, .3); overflow: hidden; }
.editor-progress i { display: block; height: 100%; background: var(--gold); transition: width .2s; }
.editor-btn { position: absolute; top: 5px; width: 26px; height: 26px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(0, 0, 0, .6); color: #fff; font-size: 14px; line-height: 26px; padding: 0; }
.editor-btn.remove { right: 5px; }
.editor-btn.left { left: 5px; font-size: 18px; }
.editor-actions > .btn { flex: 1; }

/* «Мой профиль» (решение заказчика 19.11.2026): фото, значения-кнопки с выпадающим списком, тарифы */
.profile-btn.has-photo { overflow: hidden; }
.avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.avatar-row { gap: 16px; align-items: center; }
.avatar-row .stack > * + * { margin-top: 8px; }
.avatar-row .btn.small { width: 100%; }
.avatar-big { flex: none; width: 88px; height: 88px; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  background: var(--glass-hi); border: 2px solid var(--gold); box-shadow: 0 0 16px rgba(216, 180, 106, .3); }
.avatar-big img { width: 100%; height: 100%; object-fit: cover; }
.avatar-big .ic { width: 52px; height: 52px; vertical-align: middle; }
/* Значение-кнопка занимает всё место справа от подписи (замечание заказчика 19.11.2026: почта не влезала) */
.switch-row > .grow.muted:has(+ .pick-btn) { flex: 0 0 auto; }
.pick-btn { border-radius: 18px; }
.pick-btn { flex: 0 1 auto; min-width: 0; margin-left: auto; display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 7px 12px; border-radius: 999px; border: 1px solid var(--edge); background: var(--glass-hi); color: var(--text);
  font-size: 15px; }
.pick-btn > span:first-child { min-width: 0; overflow-wrap: anywhere; text-align: left; }
.pick-arrow { color: var(--gold); font-size: 12px; }
.plans { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: var(--radius-small);
  background: var(--soft); border: 1px solid var(--edge-soft); }
.plan-row { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.plan-current { font-size: 12px; font-weight: 600; color: var(--gold); border: 1px solid var(--edge); border-radius: 999px;
  padding: 2px 9px; }
.test-cancel { align-self: flex-start; }
@media (max-width: 380px) { .tabs .tab { font-size: 9.5px; } }

/* Лента, этап Л2: вкладки автора и состояние черновика / запланированного поста */
.feed-tabs { overflow-x: auto; scrollbar-width: none; }
.feed-tabs .segment { white-space: nowrap; font-size: 14px; flex: 1 0 auto; padding-left: 10px; padding-right: 10px; }
.post-status { color: var(--gold-text); }

/* Реакции на комментарии (миграция 029): мельче, чем у поста */
.comment-reacts, .comment-picker { margin-top: 6px; gap: 6px; }
.reaction.small { padding: 2px 8px; font-size: 13px; }
.reaction.small .reaction-emoji { font-size: 15px; }

/* Автопубликация (этап Л3): галочки сетей в редакторе и состояние отправки под постом (только автору) */
.editor-nets { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.editor-net { display: inline-flex; align-items: center; gap: 6px; }
.editor-net.off { opacity: .55; }
.post-deliveries { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 6px 0 2px; }
.post-delivery-failed { color: var(--danger, #e06b6b); }
