*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --header-h: 48px;
  --sidebar-w: 72px;
  --chat-w: 300px;
  --bottom-h: 0px;

  /* Цвет должности (админ / модератор) — ЕДИНЫЙ источник для ника в шапке,
     чата, профиля и списков игроков (см. js/data/roles.js). *-rgb нужны там,
     где цвет идёт в rgba() (фон/рамка чипа роли). */
  --role-admin: #ff6161;
  --role-mod:   #4da3ff;
  --role-inspector: #ff9f43;   /* Инспектор (28.11): старше модератора */
  /* Наставник (роль `mentor`): помощь новичкам. Фиолетовый — единственный цвет,
     который не спутать ни с красным админом, ни с синим модератором. */
  --role-mentor: #b06cff;
  /* Шут (роль `jester`, «Занимается чем попало») — ЧИСТО декоративная, прав не
     даёт. Бирюзовый: единственный оттенок, который не путается ни с синим
     модератором, ни с фиолетовым наставником. */
  --role-jester: #2fd6c3;
  /* Куратор конкурсов (роль `curator`) — зелёный по решению владельца (2026-10-08). */
  --role-curator: #4fd16a;
  /* Гим-лидер (роль `gymleader`) — жёлтый по решению владельца (2026-10-21). */
  --role-gymleader: #ffd23f;
  --role-admin-rgb: 255, 97, 97;
  --role-mod-rgb:   77, 163, 255;
  --role-inspector-rgb: 255, 159, 67;
  --role-mentor-rgb: 176, 108, 255;
  --role-jester-rgb: 47, 214, 195;
  --role-curator-rgb: 79, 209, 106;
  --role-gymleader-rgb: 255, 210, 63;

  /* Единая шкала редкости окна локации (js/data/rarityScale.js): дикие и дроп — одни цвета.
     Смысловые — тема их не перекрашивает; красного в шкале нет намеренно. */
  --rarity-common: #9aa3ad;
  --rarity-uncommon: #4caf50;
  --rarity-rare: #3b82f6;
  --rarity-very-rare: #a855f7;

  /* Панель локации: тёплое полупрозрачное стекло. Текст подобран под контраст ≥ 4.5:1
     и на тёмном арте под стеклом (худший случай). */
  --loc-panel-bg: rgba(255, 250, 240, 0.85);
  --loc-panel-text: #2a241e;
  --loc-panel-text-2: #4f463c;
  --loc-panel-label: #655b51;
  --loc-panel-line: rgba(80, 60, 40, 0.14);
  --loc-panel-hover: rgba(80, 60, 40, 0.07);

  /* Палитра АКЦЕНТА и ФОНА — то, что перекрашивает сезонная тема
     (body[data-event="…"] в css/event-*.css). Тема переопределяет ТОЛЬКО --accent-* и
     --bg-*: текст, границы и смысловые цвета (редкость, статусы боя, роли, опасные
     кнопки) живут своими литералами и тему не видят — там цвет несёт смысл.
     Значения ниже = прежние литералы один в один: без темы игра не меняется.
     ⚠️ Акцент в трёх ролях, у каждой свой контраст: --accent — текст и заливка на
     СВЕТЛЫХ панелях (под белым текстом), --accent-dark — текст на ТЁМНОМ стекле,
     --accent-strong — заливка под белым текстом на тёмном. */
  --accent:          #5B5FEF;
  --accent-rgb:      91, 95, 239;
  --accent-dark:     #8A7CFF;
  --accent-dark-rgb: 138, 124, 255;
  --accent-strong:   #5B5BF0;
  --accent-strong-rgb: 91, 91, 240;
  --bg-page:         #111;
  --bg-glass-rgb:    15, 19, 34;
  --bg-header-alpha: 0.74;

  /* Палитра ПРОФИЛЯ (30.10) — значения, которые у профиля уже есть литералами. Сам профиль на них
     ещё не переведён (его литералы не тронуты); переменные нужны новому коду — экрану и разделу
     достижений, которые должны выглядеть частью профиля. Сезонная тема их НЕ перекрашивает. */
  --prof-bg:        #f5f5f5;
  --prof-card:      #fff;
  --prof-sub:       #f7f8fa;
  --prof-line:      #e6e7eb;
  --prof-line-soft: #eee;
  --prof-ink:       #1a1a2e;
  --prof-text:      #333;
  --prof-muted:     #6a6a75;
  --prof-faint:     #aaa;
  --prof-green:     #4CAF50;
  --prof-green-ink: #1b7a3f;
  --prof-green-bg:  #e8f8ee;
  --prof-amber:     #FFB300;
  /* Добавлены для контраста 4,5:1 и чтобы у экрана достижений не осталось литералов (30.10):
     --prof-green-btn — заливка под БЕЛЫМ текстом (кнопка «Получить», бейдж; #4CAF50 под белым — 2,78:1),
     --prof-chip — фон круглой кнопки закрытия, --prof-overlay — затемнение под окном (как .modal-overlay). */
  --prof-green-btn: #2e7d32;
  --prof-chip:      #f0f1f4;
  --prof-overlay:   rgba(0,0,0,.55);
}

/* Тёмная тема панели локации — тёплый тёмный тон. В игре нет переключателя темы, поэтому
   токены ждут атрибута data-theme="dark" и сами ничего не включают. */
:root[data-theme="dark"] {
  --loc-panel-bg: rgba(38, 32, 26, 0.85);
  --loc-panel-text: #f5ede2;
  --loc-panel-text-2: #d9cdbd;
  --loc-panel-label: #bfb2a2;
  --loc-panel-line: rgba(255, 235, 210, 0.14);
  --loc-panel-hover: rgba(255, 235, 210, 0.08);
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-page);
  overflow: hidden;
  height: 100vh;
  color: #333;
}

/* ══════════════════════════════════════════
   HEADER — glass bar over the scene
   Фон шапки pointer-events:none (клики проходят в игру); кликается ТОЛЬКО
   статус игрока (.g-header-status). Сцена (.location-bg) лежит ПОД шапкой
   (.g-body top:0), поэтому blur есть что размывать. Позиции панелей под
   шапкой считаются от --header-h → экранные координаты как раньше.
══════════════════════════════════════════ */

.g-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px 0 20px;
  /* blur(20px) saturate(125%) на всю ширину экрана — самый дорогой backdrop в игре, и
     он висит НАД сценой, то есть пересчитывался и во время боя. Опущен до blur(8px)
     без saturate (стекло читается, цена вчетверо ниже); фон уплотнён 0.62 → 0.74,
     чтобы текст шапки не потерялся на светлых фонах локаций. */
  background: rgba(var(--bg-glass-rgb), var(--bg-header-alpha));
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  z-index: 100;
  pointer-events: none;
}

/* ── Brand (left): full emblem + text wordmark (текст остаётся текстом) ── */
.g-header-brand {
  display: flex;
  align-items: center;
  min-width: 0;
}
.g-header-mark {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  margin-right: 8px;
  pointer-events: none;
}
.g-header-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
  letter-spacing: 0.5px;
  pointer-events: auto;
  white-space: nowrap;
}

/* ── Day/night + clock slot (ЗАДЕЛ, скрыт до появления механики) ──
   Разметка уже есть: иконка ☀/☾ + #game-clock (game.js тикает каждые 10 с).
   Показать = убрать [hidden] у #g-header-daynight. */
.g-header-daynight {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.80);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
  /* 🔴 Часы не переносятся и не сжимаются. С приходом пилюли пасса (21.09) правый
     кластер на телефоне стал из трёх пилюль, и при длинном нике «18 56» ломалось на
     две строки — шапка при этом НЕ переполнялась, просто сжался единственный, кто
     умел сжиматься. Растягиваться и обрезаться в этом ряду должен ТОЛЬКО ник: у него
     для этого есть и max-width, и многоточие. */
  white-space: nowrap;
  flex-shrink: 0;
}
.g-header-daynight[hidden] { display: none; }
/* Глиф ☀/☾ подставляет updateClock() в game.js с \uFE0E (текстовое представление),
   поэтому он наследует цвет пилюли и не превращается в цветной эмодзи. */
.g-daynight-icon {
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
  opacity: 0.9;
}
.g-header-daynight:not([hidden]) ~ .g-header-pass,
.g-header-daynight:not([hidden]) ~ .g-header-gems,
.g-header-daynight:not([hidden]) ~ .g-header-status { margin-left: 0; }

/* ── «Турниры и конкурсы» (02.10): кнопка-кубок, кнопку создаёт js/ui/upcomingEvents.js ──
   Только иконка: в правом кластере на телефоне уже три пилюли, четвёртая с текстом
   съела бы ник. Точка — «есть анонс, который ещё не открывали в окне».
   Цепочку margin-left:auto (см. пасс ниже) кубок берёт на себя, когда стоит первым. */
.g-header-events {
  margin-left: auto;
  position: relative;
  pointer-events: auto;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: #ffdf99;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
}
.g-header-events:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(240, 190, 80, 0.45);
}
.g-header-events:active { transform: scale(0.95); }
.g-header-events:focus-visible { outline: 2px solid rgba(240, 190, 80, 0.8); outline-offset: 2px; }
.g-header-daynight:not([hidden]) ~ .g-header-events { margin-left: 0; }
.g-header-events ~ .g-header-pass,
.g-header-events ~ .g-header-gems,
.g-header-events ~ .g-header-status { margin-left: 0; }
.g-events-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ff6b5a;
  border: 2px solid #171b2c;
  box-shadow: 0 0 6px rgba(255, 107, 90, 0.9);
}
.g-events-dot[hidden] { display: none; }

.g-events-pop {
  position: fixed;
  z-index: 1300;
  width: min(340px, calc(100vw - 24px));
  overflow-y: auto;
  padding: 12px;
  border-radius: 16px;
  background: rgba(20, 24, 40, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  color: #fff;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}
.ue-pop-title { font-size: 13px; font-weight: 700; color: rgba(255,255,255,0.7); padding: 0 4px 10px; letter-spacing: 0.3px; }
.ue-pop-empty { font-size: 13px; line-height: 1.5; color: rgba(255,255,255,0.65); padding: 2px 4px 6px; }
.ue-card {
  display: block;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: inherit;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.ue-card:last-child { margin-bottom: 0; }
.ue-card:hover { background: rgba(255, 255, 255, 0.09); border-color: rgba(240, 190, 80, 0.4); }
.ue-card-head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.ue-kind { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; padding: 2px 7px; border-radius: 999px; }
.ue-kind--t { color: #ffb3a8; background: rgba(255, 107, 90, 0.16); }
.ue-kind--c { color: #c9b8ff; background: rgba(138, 124, 255, 0.18); }
.ue-new { font-size: 10px; font-weight: 700; color: #ffdf99; }
.ue-card-title { font-size: 14px; font-weight: 700; line-height: 1.35; }
.ue-when { margin-top: 6px; font-size: 12.5px; line-height: 1.45; color: rgba(255,255,255,0.75); }
.ue-more { display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 600; color: #ffdf99; }

/* ── Батл-пасс (21.09): кнопка переехала сюда из сайдбара ──
   ЗАЧЕМ ПЕРЕЕХАЛА: в сайдбаре она была тринадцатой в списке, а уровень не показывала
   вовсе — про пасс вспоминали, только открыв меню. В шапке уровень виден всегда, и
   непросмотренная награда сама зовёт открыть окно.
   🔴 ПИЛЮЛЯ ТА ЖЕ, ЧТО У САМОЦВЕТОВ, И ЭТО НАМЕРЕННО: правый кластер шапки — «моё
   состояние» (пасс · самоцветы · я), и третья форма в ряду читалась бы как чужой
   элемент. Отличие одно — золотой акцент вместо фиолетового.
   ⚠️ Цепочка margin-left:auto идёт по ПЕРВОМУ видимому из [daynight, pass, gems,
   status]: каждый следующий обязан её гасить, иначе правый кластер расползётся по
   всей шапке, когда сосед скрыт. */
.g-header-pass {
  margin-left: auto;
  position: relative;
  pointer-events: auto;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 11px 3px 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.2px;
  white-space: nowrap;
  flex-shrink: 0;
}
.g-header-pass:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(240, 190, 80, 0.45);
}
.g-header-pass:active { transform: scale(0.97); }
.g-header-pass:focus-visible {
  outline: 2px solid rgba(240, 190, 80, 0.8);
  outline-offset: 2px;
}
.g-header-pass ~ .g-header-gems,
.g-header-pass ~ .g-header-status { margin-left: 0; }
.g-pass-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 4px rgba(240, 190, 80, 0.5));
}
.g-pass-level { color: #ffdf99; }
/* Точка «есть непросмотренная награда». Число не пишем: на 40-px шапке телефона
   бейдж с цифрой лезет на соседнюю пилюлю, а сколько именно наград — видно в окне.
   [hidden] снимает paintHeaderPass(), она же дописывает количество в подсказку. */
.g-pass-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ffc542;
  border: 2px solid #171b2c;
  box-shadow: 0 0 6px rgba(255, 197, 66, 0.9);
  animation: passDotPulse 1.8s ease-in-out infinite;
}
.g-pass-dot[hidden] { display: none; }
@keyframes passDotPulse {
  0%, 100% { transform: scale(1);    opacity: 1; }
  50%      { transform: scale(1.25); opacity: 0.75; }
}
@media (prefers-reduced-motion: reduce) {
  .g-pass-dot { animation: none; }
}

/* ── Самоцветы (донат-валюта) — баланс users/{uid}.gems, realtime из game.js ──
   Пилюля как у статуса. КЛИКАБЕЛЬНА: открывает привязку Telegram (в фазе 2b здесь же
   будет донат-магазин) — поэтому в разметке это <button>, а не <div>.
   ⚠️ font-family: inherit обязателен — кнопка НЕ наследует шрифт сама, и без него
   баланс в шапке съезжал бы на системный шрифт рядом с ником в игровом.
   Правый край: gems ← статус; margin-left:auto берёт первый видимый из
   [daynight, gems, status] → статус его теряет, когда gems в потоке. */
.g-header-gems {
  margin-left: auto;
  pointer-events: auto;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 11px 3px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.2px;
  white-space: nowrap;
  flex-shrink: 0;
}
.g-header-gems:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(var(--accent-dark-rgb), 0.45);
}
.g-header-gems:active { transform: scale(0.97); }
.g-header-gems:focus-visible {
  outline: 2px solid rgba(var(--accent-dark-rgb), 0.8);
  outline-offset: 2px;
}
.g-header-gems ~ .g-header-status { margin-left: 0; }
.g-gems-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 4px rgba(var(--accent-dark-rgb), 0.55));
}
.g-gems-count { color: #e6dcff; }

/* ── Player status (right): avatar + nick → click = own profile ── */
.g-header-status {
  margin-left: auto;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 3px 12px 3px 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: #fff;
  font: inherit;
  cursor: pointer;
  max-width: 260px;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.g-header-status:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(var(--accent-dark-rgb), 0.45);
}
.g-header-status:active { transform: scale(0.98); }
.g-header-status:focus-visible {
  outline: 2px solid rgba(var(--accent-dark-rgb), 0.7);
  outline-offset: 2px;
}

.g-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-dark));
  border: 1.5px solid rgba(var(--accent-dark-rgb), 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}
.g-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.g-username {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
/* Роль → цвет ника (те же цвета, что у авторов в чате, М3) */
.g-username.role-admin  { color: var(--role-admin); }
.g-username.role-mod    { color: var(--role-mod); }
.g-username.role-mentor { color: var(--role-mentor); }
.g-username.role-jester { color: var(--role-jester); }
.g-username.role-curator { color: var(--role-curator); }
.g-username.role-gymleader { color: var(--role-gymleader); }

/* ══════════════════════════════════════════
   GAME BODY LAYOUT
══════════════════════════════════════════ */

.g-body {
  position: fixed;
  top: 0;                 /* сцена уходит ПОД glass-шапку; отступы панелей — от --header-h */
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
}

/* ══════════════════════════════════════════
   LEFT SIDEBAR — floating glass card
══════════════════════════════════════════ */

.sidebar-wrapper {
  position: absolute;
  left: 12px;
  top: calc(var(--header-h) + 12px);
  bottom: calc(var(--bottom-h) + 12px);
  display: flex;
  align-items: center;
  z-index: 9999;
}

/* Collapsed by default (60px), expanded class → 220px */
.g-sidebar {
  width: 60px;
  height: 100%;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 20px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px 0;
  overflow: hidden;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.g-sidebar.expanded {
  width: 210px;
}

/* Toggle tab */
.sidebar-toggle {
  width: 18px;
  height: 48px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-left: none;
  border-radius: 0 10px 10px 0;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 3px 0 10px rgba(0, 0, 0, 0.18);
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.toggle-icon {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Flip chevron when expanded */
.g-sidebar.expanded ~ .sidebar-toggle .toggle-icon {
  transform: rotate(180deg);
}

/* Icon groups */
.sidebar-top,
.sidebar-bottom {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 0 8px;
}

/* 🔴 РЕЖЕТСЯ ВЕРХНЯЯ ГРУППА, А НЕ НИЖНЯЯ. У .g-sidebar `overflow: hidden`, и при нехватке
   высоты `justify-content: space-between` схлопывается в flex-start — низ уезжал под клип:
   первым «Выйти», следом «Охота». Порог = 126 + 48 × (кнопок в .sidebar-top), то есть рос
   с КАЖДОЙ новой кнопкой меню: 606 px (10 кнопок, 8 авг) → 655 px (11, «Аукцион», 21 авг).
   Ноутбук 1366×768 даёт окно ~620–640 — «Охоты» там не было вовсе, и молча.
   Телефон в альбомной (844×390) хуже всего: ширина > 768, мобильной панели нет по медиа-
   запросу, а в сайдбаре обрезано всё после 6-й кнопки — второго входа в охоту не остаётся.
   Теперь список прокручивается, а .sidebar-bottom прибита: «Охота» и «Выйти» видны всегда,
   на любой высоте окна. min-height: 0 обязателен — без него флекс-элемент не сжимается
   ниже своего содержимого и прокрутка не включается (клип вернулся бы как был).
   Полоса прокрутки тонкая и появляется САМА только когда список не влез, — это
   единственная подсказка, что меню можно листать; прятать её нельзя. */
.sidebar-top {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.32) transparent;
}
.sidebar-top::-webkit-scrollbar { width: 4px; }
.sidebar-top::-webkit-scrollbar-track { background: transparent; }
.sidebar-top::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.32);
  border-radius: 2px;
}
.sidebar-bottom {
  flex: 0 0 auto;
  /* Край прокрутки. Когда список не влез, последняя его строка обрезается ровно
     здесь — без линии огрызок читается как «кнопка наехала на Охоту», а не как
     «список продолжается выше». На высоком окне это просто разделитель групп. */
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  margin-top: 6px;
  padding-top: 6px;
}

/* Each button: icon + hidden label */
.sb-btn {
  position: relative;
  width: 100%;
  height: 46px;
  /* ⚠️ Без этого `height: 46px` — не высота, а пожелание: обе группы флекс-колонки, а
     flex-shrink по умолчанию 1, и на низком окне одиннадцать кнопок молча сжимались бы
     до 22px (иконка 26px в них уже не влезает) ВМЕСТО прокрутки списка. */
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 9px;
  color: rgba(255, 255, 255, 0.62);
  transition: background 0.18s, color 0.18s, transform 0.12s;
  white-space: nowrap;
  overflow: hidden;
}

.sb-icon {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sb-icon svg {
  width: 22px;
  height: 22px;
}

.sb-label {
  font-size: 0.84rem;
  font-weight: 600;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.2s 0.05s, transform 0.2s 0.05s;
  letter-spacing: 0.2px;
  color: rgba(255, 255, 255, 0.9);
}

.g-sidebar.expanded .sb-label {
  opacity: 1;
  transform: translateX(0);
}

.sb-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.95);
  transform: scale(1.03);
}

.sb-btn.active {
  background: rgba(255, 255, 255, 0.24);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

/* Hunt active state */
.sb-hunt-active {
  background: linear-gradient(135deg, #FF6B35, #FF4500) !important;
  color: #fff !important;
  box-shadow: 0 4px 16px rgba(255,69,0,0.5) !important;
  animation: huntPulse 2s ease infinite;
}

.sb-logout {
  color: rgba(255, 200, 200, 0.55);
}

.sb-logout:hover {
  background: rgba(220, 60, 60, 0.2);
  color: #ffaaaa;
}

/* ══════════════════════════════════════════
   MAIN GAME AREA
══════════════════════════════════════════ */

.g-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  margin-left: 0;
}

.game-canvas {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* ── Background scene ──
   Replace background-image with your own art:
   background-image: url('../images/location.jpg');
   background-size: cover;
   background-position: center;
*/
.location-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 88%, rgba(100, 190, 230, 0.55) 0%, transparent 28%),
    radial-gradient(ellipse at 18% 68%, rgba(60, 130, 60, 0.55) 0%, transparent 32%),
    radial-gradient(ellipse at 82% 62%, rgba(55, 120, 55, 0.5) 0%, transparent 28%),
    radial-gradient(ellipse at 50% 55%, rgba(180, 210, 180, 0.3) 0%, transparent 45%),
    linear-gradient(180deg,
      #8ecae6 0%,
      #a8d4ef 18%,
      #b8ddb8 42%,
      #9ec89e 62%,
      #88b488 78%,
      #74a074 100%
    );
}

/* Simulated buildings */
.location-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(170, 190, 215, 0.75), rgba(190, 205, 225, 0.5))
      no-repeat center 8% / 90px 52%,
    linear-gradient(to bottom, rgba(160, 180, 205, 0.65), rgba(175, 192, 215, 0.42))
      no-repeat 28% 14% / 65px 42%,
    linear-gradient(to bottom, rgba(165, 182, 208, 0.68), rgba(180, 195, 218, 0.45))
      no-repeat 70% 10% / 75px 48%,
    linear-gradient(to bottom, rgba(155, 175, 200, 0.55), rgba(170, 188, 210, 0.35))
      no-repeat 12% 20% / 50px 35%,
    linear-gradient(to bottom, rgba(158, 178, 202, 0.55), rgba(172, 190, 212, 0.35))
      no-repeat 87% 16% / 55px 40%;
}

/* Fountain hint */
.location-bg::after {
  content: '';
  position: absolute;
  bottom: 18%;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 80px;
  background: radial-gradient(ellipse, rgba(120, 200, 240, 0.6) 0%, transparent 70%);
  border-radius: 50%;
}

/* ── Location Panel (Pokémon GO style) ── */

.location-panel {
  position: absolute;
  top: calc(var(--header-h) + 14px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--loc-panel-bg);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-radius: 20px;
  box-shadow: 0 8px 28px rgba(40, 28, 16, 0.18), 0 1px 3px rgba(40, 28, 16, 0.08);
  /* ~300px — уже прежних 340, чтобы меньше закрывать арт; высота ограничена, дальше —
     прокрутка внутри: нижняя часть сцены (где нарисован тренер) остаётся открытой. */
  width: min(300px, calc(100vw - 80px));
  max-height: min(62vh, calc(100% - var(--header-h) - 28px));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--loc-panel-line) transparent;
  color: var(--loc-panel-text);
  transition: opacity 0.25s, transform 0.25s, left 0.3s ease;
}

.location-panel.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(-12px);
}

/* ── Header ── */

.loc-header {
  padding: 14px 12px 8px 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.loc-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--loc-panel-text);
  flex: 1;
  line-height: 1.2;
}

.loc-type-badge {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.loc-type-badge.city  { background: #2196F3; color: #fff; }
.loc-type-badge.route { background: #4CAF50; color: #fff; }

/* Тип локации — маленькая иконка перед названием (бейдж «МАРШРУТ» снят: дублировал заголовок). */
.loc-type-icon {
  width: 16px; height: 16px; flex-shrink: 0;
  background-color: var(--loc-panel-label);
  -webkit-mask: var(--loc-type-svg) center / contain no-repeat;
  mask: var(--loc-type-svg) center / contain no-repeat;
  --loc-type-svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M11 2h2v3h6l3 3-3 3h-6v2h4v3h-4v6h-2v-6H5l-3-3 3-3h6v-2H5V5h6z'/%3E%3C/svg%3E");
}
.loc-type-icon.city,
.loc-type-icon.town {
  --loc-type-svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 21V10l5-4 5 4v2h8v9h-7v-5h-3v5zm4-8h2v-2H7zm0 4h2v-2H7zm10 0h2v-2h-2z'/%3E%3C/svg%3E");
}
.loc-type-icon.stadium {
  --loc-type-svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 3h10v2h4v3a5 5 0 0 1-5 5 5 5 0 0 1-3 2.8V19h4v2H7v-2h4v-3.2A5 5 0 0 1 8 13a5 5 0 0 1-5-5V5h4zm-2 4v1a3 3 0 0 0 2 2.8V7zm14 0h-2v3.8A3 3 0 0 0 19 8z'/%3E%3C/svg%3E");
}
.loc-type-icon:empty:not([class*=' ']) { display: none; }   /* до первой отрисовки типа ещё нет */

/* Свернуть панель в заголовок — только десктоп (на телефоне своя шторка с ручкой). */
.loc-compact-btn {
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0;
  border: none; border-radius: 8px; background: transparent;
  color: var(--loc-panel-label); cursor: pointer;
  transition: background 0.14s, transform 0.2s;
}
.loc-compact-btn:hover { background: var(--loc-panel-hover); }
.loc-compact-btn:focus-visible { outline: 2px solid var(--rarity-rare); outline-offset: 1px; }
@media (min-width: 769px) {
  .location-panel.is-compact > :not(.loc-header):not(.loc-panel-handle) { display: none !important; }
  .location-panel.is-compact .loc-header { padding-bottom: 14px; }
  .location-panel.is-compact .loc-compact-btn svg { transform: rotate(180deg); }
}
@media (max-width: 768px) {
  .loc-compact-btn { display: none; }
}

/* Кнопка «Карта региона» в шапке панели локации — bare icon-кнопка под
   полноцветный арт (без тил-чипа, чтобы иконка читалась чисто). */
.loc-map-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  transition: background 0.14s, transform 0.14s;
}
.loc-map-btn:hover   { background: rgba(0, 0, 0, 0.06); }
.loc-map-btn:active  { transform: scale(0.92); }

/* ── Description ── */

.loc-desc {
  padding: 0 16px 12px;
  font-size: 0.78rem;
  color: var(--loc-panel-text-2);
  line-height: 1.5;
  border-bottom: 1px solid var(--loc-panel-line);
}

/* ── Section labels ── */

.loc-section-label {
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--loc-panel-label);
  padding: 10px 16px 5px;
}

/* ── Travel buttons ── */

.loc-body {
  padding: 0 0 6px;
}

.loc-nav {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.loc-nav .loc-section-label {
  padding-left: 16px;
  padding-right: 16px;
}

.loc-nav-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 4px;
}

.loc-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.loc-move-btn {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;   /* панель 300px: два перехода в строку */
  border-radius: 50px;
  border: 2px solid #4CAF50;
  color: #4CAF50;
  background: transparent;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s, box-shadow 0.15s;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(76, 175, 80, 0.15);
}

.loc-move-btn:hover {
  background: #4CAF50;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(76, 175, 80, 0.4);
}

.loc-move-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Переход идёт: нажатая кнопка остаётся яркой + спиннер (остальные — погашены).
   Игрок видит, что запрос ушёл, и не кликает повторно. */
.loc-move-btn.is-moving,
.loc-move-btn.is-moving:disabled {
  opacity: 1;
  cursor: progress;
  background: #4CAF50;
  color: #fff;
  box-shadow: 0 2px 10px rgba(76, 175, 80, 0.35);
}
.loc-move-btn.is-moving::after {
  content: '';
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-left: 8px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: locMoveSpin 0.8s linear infinite;
}
@keyframes locMoveSpin { to { transform: rotate(360deg); } }

.loc-npcs { padding: 0; }

/* ── NPC / People cards ── */

.loc-npc-card {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 3px 16px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.03);
  border: none;
  font-family: inherit;
  text-align: left;
  cursor: default;
  width: calc(100% - 32px);
}

.loc-npc-card.loc-npc-oak {
  background: rgba(74, 110, 40, 0.07);
  border: 1px solid rgba(74, 110, 40, 0.18);
  cursor: pointer;
  transition: background 0.15s;
}

.loc-npc-card.loc-npc-oak:hover {
  background: rgba(74, 110, 40, 0.15);
}

.loc-npc-card.oak-card-glow {
  box-shadow: 0 0 12px rgba(76, 175, 80, 0.5);
  border-color: rgba(76, 175, 80, 0.5) !important;
}

/* Oak quest badge */
.oak-quest-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.62rem;
  font-weight: 700;
  margin-top: 3px;
  letter-spacing: 0.02em;
}
.oak-quest-badge.quest-active   { color: #888; }
.oak-quest-badge.quest-ready    { color: #2e7d32; }
.oak-quest-badge.quest-complete { color: #aaa; }
.oak-quest-badge.quest2-active  { color: #e65100; }
.oak-quest-badge.quest2-complete { color: #2e7d32; }

.quest-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.quest-active   .quest-dot { background: #F9A825; }
.quest-ready    .quest-dot { background: #4CAF50; }
.quest2-active  .quest-dot { background: #FF6D00; }
.quest2-complete .quest-dot { background: #4CAF50; }

@keyframes questPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(1.4); }
}
.quest-dot.pulse {
  animation: questPulse 1.2s ease-in-out infinite;
}

/* Battle log item drop */
.bt-log-item-drop {
  background: linear-gradient(90deg, #FFF8E1, #FFFDE7);
  border-left: 3px solid #F9A825;
  padding: 3px 6px;
  font-size: 0.76rem;
  font-weight: 700;
  color: #E65100;
  border-radius: 3px;
  margin: 2px 0;
}

/* Battle toast notification */
.battle-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #F9A825, #FF8F00);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  /* Battle modal-overlay sits at z-index 10000 — keep toasts above it. */
  z-index: 100000;
  white-space: nowrap;
  pointer-events: none;
  animation: toastIn 0.3s ease;
}
.battle-toast.battle-toast-hide {
  animation: toastOut 0.5s ease forwards;
}
/* Typed battle toasts (used in place of alert() for PvP errors — 5.2) */
.battle-toast.battle-toast-error   { background: linear-gradient(135deg, #e53935, #c62828); }
.battle-toast.battle-toast-success { background: linear-gradient(135deg, #22a06b, #157a4f); }
.battle-toast.battle-toast-info    { background: linear-gradient(135deg, #2e7cd6, #1c5fa8); }

/* Coin reward toast (top-left corner, fades out after ~3s) */
@keyframes coinToastIn {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}
.coin-toast {
  position: fixed;
  left: 20px;
  top: 20px;
  background: #22c55e;
  color: #fff;
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  /* Battle modal-overlay sits at z-index 10000 — keep above it. */
  z-index: 100000;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  animation: coinToastIn 0.3s ease;
}
.coin-toast img { width: 32px; height: 32px; object-fit: contain; }

/* Drop toast — stacks below the coin toast, same slide-in animation */
.drop-toast {
  position: fixed;
  left: 20px;
  background: var(--accent);
  color: #fff;
  padding: 10px 18px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  z-index: 99999;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  animation: coinToastIn 0.3s ease;
}
.drop-toast img { width: 28px; height: 28px; object-fit: contain; }

.hunt-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #e53935, #b71c1c);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  z-index: 9999;
  white-space: nowrap;
  pointer-events: none;
  animation: toastIn 0.3s ease;
}
.hunt-toast.hunt-toast-hide {
  animation: toastOut 0.5s ease forwards;
}
@keyframes toastIn {
  from { opacity: 0; top: 8px; }
  to   { opacity: 1; top: 24px; }
}
@keyframes toastOut {
  from { opacity: 1; top: 24px; }
  to   { opacity: 0; top: 8px; }
}

/* Oak money counter */
.oak-money-counter {
  font-size: 1.6rem;
  font-weight: 800;
  color: #F9A825;
  text-align: center;
  margin: 8px 0 4px;
  letter-spacing: 0.03em;
}

/* Oak item flash */
@keyframes oakItemFlash {
  0%   { box-shadow: inset 0 0 0 0 rgba(249,168,37,0); }
  30%  { box-shadow: inset 0 0 60px 20px rgba(249,168,37,0.5); }
  100% { box-shadow: inset 0 0 0 0 rgba(249,168,37,0); }
}
.oak-item-flash { animation: oakItemFlash 0.6s ease; }

/* Macho Brace break-on-remove danger button */
.tm-unequip-warn { color: #b71c1c; }
.tm-unequip-btn-danger {
  background: #ffebee !important;
  color: #c62828 !important;
  border-color: #ef9a9a !important;
}
.tm-unequip-btn-danger:hover { background: #ffcdd2 !important; }

.loc-npc-icon {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}

.loc-npc-sprite {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(74, 110, 40, 0.08);
}

.loc-npc-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.loc-npc-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #1a1a2e;
}

.loc-npc-sub {
  font-size: 0.68rem;
  color: #aaa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Люди локации: разделы, сжатые строки, «дела закончены» (07.11, js/ui/locationPeople.js) ──
   Заголовки — как у разделов профиля (.mob-prof-section-title), на токенах панели (обе темы).
   Строка человека — вдвое ниже прежней: аватар 22px, имя и подпись в одну строку с обрезкой.
   Селекторы через #loc-npcs: у карточек десяток своих классов аватара (40px, рамка 3px). */
.loc-people { margin: 0 0 4px; }
.loc-people[hidden] { display: none; }
.loc-people-title {
  margin: 0 16px 3px; padding: 10px 0 5px;
  font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  color: var(--loc-panel-label); border-bottom: 1px solid var(--loc-panel-line);
}
#loc-npcs .loc-npc-card { gap: 8px; margin: 2px 16px; padding: 4px 8px; min-height: 30px; }
#loc-npcs .loc-npc-card > img {
  width: 22px; height: 22px; border-width: 2px; flex-shrink: 0;
}
#loc-npcs .loc-npc-info {
  flex: 1 1 auto; flex-direction: row; align-items: baseline; gap: 6px; min-width: 0; overflow: hidden;
}
#loc-npcs .loc-npc-name {
  flex: 0 1 auto; max-width: 62%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.25;
}
#loc-npcs .loc-npc-sub { flex: 1 1 0; min-width: 0; line-height: 1.25; }
/* Бейджи («Глава 3», «! Новый квест», готово к сдаче) — в той же строке справа; у них инлайн-отступ сверху. */
#loc-npcs .loc-npc-info > [class*="badge"] {
  margin: 0 0 0 auto !important; flex-shrink: 0; align-self: center; white-space: nowrap; font-size: 10px !important;
}
.loc-people-idle { margin: 2px 16px 0; }
.loc-people-idle[hidden] { display: none; }
.loc-idle-toggle {
  display: flex; align-items: center; gap: 6px; width: 100%; min-height: 30px; padding: 4px 8px;
  border: 1px dashed var(--loc-panel-line); border-radius: 10px; background: transparent;
  font: inherit; font-size: 0.72rem; color: var(--loc-panel-label); text-align: left; cursor: pointer;
}
.loc-idle-toggle:hover { background: var(--loc-panel-hover); }
.loc-idle-toggle:focus-visible { outline: 2px solid var(--rarity-rare); outline-offset: 1px; }
.loc-idle-title { flex-shrink: 0; font-weight: 700; }
.loc-idle-names { flex: 1 1 0; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0.8; }
.loc-idle-chev { flex-shrink: 0; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px); transition: transform 0.2s; }
.loc-people-idle.is-open .loc-idle-chev { transform: rotate(-135deg) translate(-2px, -2px); }
.loc-idle-list[hidden] { display: none; }
/* Внутри строки — без аватаров и бейджей («Завершён» тут и так понятен). */
#loc-npcs .loc-idle-list .loc-npc-card { margin: 2px 0; width: 100%; background: transparent; border-color: transparent !important; }
#loc-npcs .loc-idle-list .loc-npc-card > img,
#loc-npcs .loc-idle-list .loc-npc-info > [class*="badge"] { display: none !important; }
#loc-npcs .loc-idle-list .loc-npc-name { font-weight: 600; opacity: 0.85; }

/* Описание локации: нажатие на название сворачивает/разворачивает (со второго захода свёрнуто). */
.loc-name.loc-name-toggle { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.loc-name.loc-name-toggle::after {
  content: ''; flex-shrink: 0; width: 6px; height: 6px; margin-top: -3px;
  border-right: 2px solid var(--loc-panel-label); border-bottom: 2px solid var(--loc-panel-label);
  transform: rotate(45deg); transition: transform 0.2s;
}
.loc-name.loc-name-toggle[aria-expanded="true"]::after { transform: rotate(-135deg); margin-top: 3px; }
.loc-name.loc-name-toggle:focus-visible { outline: 2px solid var(--rarity-rare); outline-offset: 2px; border-radius: 4px; }
.loc-desc[hidden] { display: none; }
.location-panel.desc-collapsed .loc-header { border-bottom: 1px solid var(--loc-panel-line); padding-bottom: 10px; }

/* ── Nurse Joy NPC ────────────────────────────────────────────────────────── */

.npc-joy-card {
  background: rgba(233, 30, 99, 0.05);
  border: 1px solid rgba(233, 30, 99, 0.18) !important;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.npc-joy-card:hover {
  background: rgba(233, 30, 99, 0.12);
  border-color: rgba(233, 30, 99, 0.4) !important;
}

.npc-joy-sprite {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid #E91E63;
  object-fit: cover;
  flex-shrink: 0;
  background: #FCE4EC;
}

.npc-joy-sprite.large {
  width: 72px;
  height: 72px;
  margin: 0 auto;
  display: block;
}

.npc-joy-name {
  color: #E91E63 !important;
}

.npc-joy-label {
  color: #C2185B !important;
}

/* Joy dialog — same layout as Oak, pink accents */
.npc-joy-dialog {
  max-width: 560px;
}

.oak-btn-joy {
  background: #C2185B;
  border: 2px solid #C2185B;
  color: #fff;
  font-weight: 700;
}

.oak-btn-joy:hover {
  background: #AD1457;
  border-color: #AD1457;
}

.oak-btn-joy:active {
  background: #880E4F;
  border-color: #880E4F;
}

.oak-btn-joy:disabled {
  background: #C2185B;
  border-color: #C2185B;
}

/* Heal selection list */
.npc-heal-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
}

.npc-heal-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  background: #fafafa;
  border: 1.5px solid #eee;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}

.npc-heal-item:hover {
  border-color: #E91E63;
  background: #FFF0F5;
}

.npc-heal-item.fainted {
  background: #FFF5F5;
  border-color: #FFCDD2;
}

.npc-heal-check {
  margin-top: 4px;
  accent-color: #E91E63;
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.npc-heal-info {
  flex: 1;
  min-width: 0;
}

.npc-heal-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #222;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.npc-heal-level {
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
  background: #888;
  padding: 1px 6px;
  border-radius: 8px;
}

.npc-fainted-badge {
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  background: #e53935;
  padding: 1px 6px;
  border-radius: 8px;
}

.npc-heal-bar-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 3px;
}

.npc-heal-hp-label {
  font-size: 0.6rem;
  font-weight: 700;
  color: #999;
  width: 18px;
  flex-shrink: 0;
}

.npc-heal-hp-val {
  font-size: 0.62rem;
  color: #888;
  white-space: nowrap;
  flex-shrink: 0;
}

.npc-heal-pp {
  font-size: 0.68rem;
  color: #E91E63;
  font-weight: 600;
}

/* ── Guide NPC ────────────────────────────────────────────────────────────── */

.npc-guide-card {
  background: rgba(13, 148, 136, 0.05);
  border: 1px solid rgba(13, 148, 136, 0.18) !important;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.npc-guide-card:hover {
  background: rgba(13, 148, 136, 0.12);
  border-color: rgba(13, 148, 136, 0.4) !important;
}

.npc-guide-card .npc-joy-sprite,
/* Распорядитель боёв — карточка NPC арены. Форма как у остальных, кольцо тёплое,
   в цвет самой модалки арены, чтобы вход в режим читался с одного взгляда. */
.npc-arena-sprite {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid #c2410c;
  object-fit: cover;
  flex-shrink: 0;
}

.npc-guide-sprite {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  object-fit: cover;
  flex-shrink: 0;
  background: #eef0ff;
}

/* Смотритель питомника (type:'pc'). Зелёный кант — заповедник, а не аптека:
   карточку не надо путать с медсестрой, у которой питомник лишь одна кнопка из трёх. */
.npc-pc-sprite {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid #4d7c0f;
  object-fit: cover;
  flex-shrink: 0;
  background: #f0f7e6;
}

/* «Штаб Девон» (type:'unown_top') — учёт лучших охотников на Анноунов.
   ⚠️ ПРАВИЛО ЖИВЁТ ЗДЕСЬ, А НЕ В МОДУЛЕ. Сначала оно лежало в <style>, который
   npcUnownTop.js вставляет при открытии модалки, — но карточка рисуется РАНЬШЕ, чем
   модалку кто-то откроет, и без размеров портрет 512×512 растягивался на всю панель
   локации. У всех соседей (.npc-pc-sprite, .npc-ship-sprite, .npc-guide-sprite)
   класс тоже здесь — ровно по этой причине. Бирюзовый кант — фирменный Девона. */
.npc-unowntop-sprite {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid #14919b;
  object-fit: cover;
  flex-shrink: 0;
  background: #e6f6f7;
}

/* Антиквар Сол (type:'chess_collector') — меняет полный набор шахмат на покемона.
   ⚠️ ПРАВИЛО ЖИВЁТ ЗДЕСЬ, А НЕ В <style> модуля, по той же причине, что у соседей
   выше: карточка рисуется РАНЬШЕ, чем кто-то откроет модалку, и без размеров
   портрет 512×512 растянулся бы на всю панель локации.
   Янтарный кант — «лавка древностей»: рядом стоят медсестра (розовый) и проводник,
   и антиквар не должен читаться как ещё один из них. */
.npc-chess-sprite {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid #b45309;
  object-fit: cover;
  flex-shrink: 0;
  background: #fef3c7;
}

/* Скупщик рун (type:'unown_exchange') — лавка в Петалбургском лесу, обмен
   усмирённых Анноунов на награды. Кант фиолетовый — цвет рун и Анноунов: рядом
   в Хоэнне стоят янтарный антиквар и бирюзовый Штаб Девон, и лавка не должна
   читаться как одна из них. Класс живёт ЗДЕСЬ, а не в <style> модуля, по той же
   причине, что у сестёр: карточка рисуется раньше, чем откроют модалку. */
.npc-unownshop-sprite {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid #7c3aed;
  object-fit: cover;
  flex-shrink: 0;
  background: #ede9fe;
}

/* Моряк (type:'ship') — паром Джото↔Хоэнн. Морской кант, чтобы карточка не
   читалась как ещё один проводник: тот показывает дорогу, а этот увозит на
   другой материк на пятнадцать минут. */
.npc-ship-sprite {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid #0e7490;
  object-fit: cover;
  flex-shrink: 0;
  background: #e0f2fe;
}

/* Сводка рейса в диалоге моряка: куда / сколько плыть / чем платить. */
/* flex-shrink:0 — на телефоне диалог — flex-колонка, и блок с overflow:hidden сжимался до двух строк. */
.npc-ship-trip {
  flex-shrink: 0;
  margin: 10px 0 6px;
  border: 1px solid rgba(14, 116, 144, 0.25);
  border-radius: 10px;
  background: rgba(14, 116, 144, 0.06);
  overflow: hidden;
}
.npc-ship-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 12px;
  font-size: 13px;
}
.npc-ship-row + .npc-ship-row { border-top: 1px solid rgba(14, 116, 144, 0.15); }
/* Строки «В пути»/«Проезд» в обёртке (перерисовка под VIP) — линия над обёрткой вместо соседства. */
.npc-ship-rows { border-top: 1px solid rgba(14, 116, 144, 0.15); }
.npc-ship-row span { color: #64748b; }
.npc-ship-row b { color: #0e7490; }

/* ── Палуба в пути: обратный отсчёт вместо кнопок перехода ─────────────────
   Занимает место блока «Перейти к», потому что переходов у палубы нет вовсе:
   единственный выход из моря — время. */
.ship-voyage {
  border: 1px solid rgba(14, 116, 144, 0.28);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(14, 116, 144, 0.10), rgba(14, 116, 144, 0.04));
  padding: 14px 12px;
  text-align: center;
}
.ship-voyage-clock {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
  color: #0e7490;
  font-variant-numeric: tabular-nums;   /* цифры не «прыгают» на каждой секунде */
  letter-spacing: 1px;
}
.ship-voyage-sub {
  margin-top: 6px;
  font-size: 12px;
  color: #64748b;
}

/* ── Quest-giver NPC ───────────────────────────────────────────────────── */

.npc-quest-card {
  background: rgba(202, 138, 4, 0.06);
  border: 1px solid rgba(202, 138, 4, 0.22) !important;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.npc-quest-card:hover {
  background: rgba(202, 138, 4, 0.14);
  border-color: rgba(202, 138, 4, 0.45) !important;
}

.npc-quest-card .loc-npc-sprite {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid #ca8a04;
  object-fit: cover;
  flex-shrink: 0;
  background: #fef9c3;
}

/* ── Quest-trainer NPC ────────────────────────────────────────────────── */

.npc-quest-trainer-card {
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.22) !important;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.npc-quest-trainer-card:hover {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.45) !important;
}

.npc-quest-trainer-card .loc-npc-sprite {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid #ef4444;
  object-fit: cover;
  flex-shrink: 0;
  background: #fee2e2;
}

.npc-guide-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f0f0f0;
}

.npc-guide-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
  flex-shrink: 0;
  background: #eef0ff;
}

.npc-guide-header-text {
  min-width: 0;
}

.npc-guide-header-name {
  font-size: 17px;
  font-weight: 700;
  color: #1a1a2e;
}

.npc-guide-header-sub {
  font-size: 13px;
  color: #6b7280;
  margin-top: 2px;
  line-height: 1.35;
}

.npc-guide-label {
  color: var(--accent) !important;
}

.npc-guide-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
  margin-top: 8px;
  /* 🔴 Не сжиматься: .oak-content — flex-колонка, а у блока с overflow:auto min-height = 0,
     и длинная реплика сверху (глава 0 Хэллоуина) сплющивала список кнопок в ноль на
     телефоне — шторка 70vh. Пусть лучше прокручивается вся шторка (.oak-content). */
  flex-shrink: 0;
}

.npc-guide-city {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 0.92rem;
  font-weight: 600;
  color: #1a1a2e;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.08s;
}

.npc-guide-city:hover {
  background: #ecfeff;
  border-color: #0d9488;
}

.npc-guide-city:active {
  transform: scale(0.98);
}

.npc-guide-city:disabled {
  opacity: 0.55;
  cursor: default;
  transform: none;
}

/* Арена и Сафари — единственные пункты, куда проводник реально ВЕЗЁТ (и
   единственные платные), поэтому выделены цветом и стоят первыми в списке. */
.npc-guide-arena {
  background: linear-gradient(135deg, #fff7ed, #ffedd5);
  border-color: #fdba74;
  color: #7c2d12;
}

.npc-guide-arena:hover {
  background: linear-gradient(135deg, #ffedd5, #fed7aa);
  border-color: #c2410c;
}

/* Сафари — вторая поездка проводника. Цвет отличается от арены не ради красоты:
   платится она не деньгами, а разовым пропуском, и спутать их клик не должен. */
.npc-guide-safari {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border-color: #86efac;
  color: #14532d;
}

.npc-guide-safari:hover {
  background: linear-gradient(135deg, #dcfce7, #bbf7d0);
  border-color: #15803d;
}

.npc-guide-safari .npc-guide-price {
  color: #15803d;
}

.npc-guide-price {
  font-size: 0.82rem;
  font-weight: 700;
  color: #c2410c;
  white-space: nowrap;
}

.npc-guide-note {
  margin: 10px 0 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #64748b;
}

/* Предупреждение про Сафари-болы: игрок должен увидеть его ДО поездки, иначе
   узнает о гейте ловли на первой же встрече — и уже потратив пропуск. */
.npc-guide-warn {
  color: #b45309;
}

.npc-guide-chev {
  color: #94a3b8;
  font-size: 1.1rem;
  font-weight: 700;
}

.npc-guide-route {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
  max-height: 280px;
  overflow-y: auto;
}

.npc-guide-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #f1f5f9;
  font-size: 0.88rem;
  color: #334155;
}

.npc-guide-step.is-city {
  background: #ecfeff;
  color: #0f766e;
  font-weight: 600;
}

.npc-guide-step.is-current {
  background: #0d9488;
  color: #fff;
  font-weight: 700;
}

.npc-guide-step.is-dest {
  background: #14b8a6;
  color: #fff;
  font-weight: 700;
}

.npc-guide-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.6);
  color: inherit;
  font-size: 0.72rem;
  font-weight: 700;
}

.npc-guide-step.is-current .npc-guide-num,
.npc-guide-step.is-dest .npc-guide-num {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.npc-guide-step-name {
  flex: 1;
}

/* ── Shopkeeper NPC ────────────────────────────────────────────────────────── */

.npc-shop-card {
  background: rgba(var(--accent-rgb), 0.06);
  border: 1px solid rgba(var(--accent-rgb), 0.2) !important;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.npc-shop-card:hover {
  background: rgba(var(--accent-rgb), 0.14);
  border-color: rgba(var(--accent-rgb), 0.45) !important;
}

.npc-shop-sprite {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  object-fit: cover;
  flex-shrink: 0;
  background: #eef0ff;
}

.npc-shop-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f0f0f0;
}

.npc-shop-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
  flex-shrink: 0;
  background: #eef0ff;
}

.npc-shop-header-text { min-width: 0; }

.npc-shop-header-name {
  font-size: 17px;
  font-weight: 700;
  color: #1a1a2e;
}

.npc-shop-header-sub {
  font-size: 13px;
  color: #6b7280;
  margin-top: 2px;
  line-height: 1.35;
}

.npc-shop-label {
  color: var(--accent) !important;
}

.npc-shop-dialog {
  flex-direction: column;
  gap: 0;
  max-width: 520px;
  padding: 20px 22px;
}

.npc-shop-dialog .oak-content {
  gap: 12px;
}

.npc-shop-money {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8f9fa;
  border-radius: 12px;
  padding: 10px 14px;
}

.npc-shop-money-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.npc-shop-money-val {
  font-size: 14px;
  font-weight: 700;
  color: #1a1a2e;
}

.npc-shop-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
}

.npc-shop-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1.5px solid #e5e7eb;
  background: #fff;
  transition: background 0.12s, border-color 0.12s;
}

.npc-shop-row.is-locked {
  background: #fafafa;
  border-color: #f3f4f6;
  opacity: 0.65;
}

.npc-shop-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
}

.npc-shop-img.is-empty {
  background: linear-gradient(135deg, #eef0ff 0%, #e2e6ff 100%);
  border-radius: 10px;
}

.npc-shop-info {
  flex: 1;
  min-width: 0;
}

.npc-shop-name {
  font-size: 14px;
  font-weight: 700;
  color: #1a1a2e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.npc-shop-desc {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.npc-shop-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.npc-shop-buy-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.npc-shop-price {
  font-size: 13px;
  font-weight: 800;
  color: var(--accent);
}

.npc-shop-price.is-dim {
  color: #9ca3af;
}

.npc-shop-buy {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s, transform 0.08s;
}

.npc-shop-buy:hover:not(:disabled) {
  background: #4347d6;
}

.npc-shop-buy:active:not(:disabled) {
  transform: scale(0.96);
}

.npc-shop-buy:disabled {
  background: #e5e7eb;
  color: #9ca3af;
  cursor: not-allowed;
}

/* ── Weekly Trainer NPC ──────────────────────────────────────────────────── */

.npc-trainer-card {
  background: rgba(124, 58, 237, 0.04);
  border: 1px solid rgba(124, 58, 237, 0.2) !important;
  cursor: pointer;
  transition: background 0.15s, transform 0.08s;
}

.npc-trainer-card:hover {
  background: rgba(124, 58, 237, 0.1);
}

.npc-trainer-card:active {
  transform: scale(0.98);
}

.npc-trainer-sprite {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid #7c3aed;
  object-fit: cover;
  flex-shrink: 0;
  background: #f3e8ff;
}

.npc-trainer-dialog {
  flex-direction: column;
  gap: 0;
  max-width: 460px;
  padding: 20px 22px;
}

.npc-trainer-dialog .oak-content {
  gap: 12px;
}

.npc-trainer-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-bottom: 14px;
  border-bottom: 1px solid #f0f0f0;
}

.npc-trainer-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 3px solid #7c3aed;
  object-fit: cover;
  background: #f3e8ff;
}

.npc-trainer-name {
  font-size: 19px;
  font-weight: 800;
  color: #1a1a2e;
  text-align: center;
}

.npc-trainer-title {
  font-size: 12px;
  color: #6b7280;
  font-weight: 600;
  margin-top: 2px;
  text-align: center;
}

.npc-trainer-type-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.npc-trainer-dialogue {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  color: #374151;
  font-style: italic;
  text-align: center;
  line-height: 1.45;
}

.npc-trainer-section {
  background: #eef0ff;
  border-radius: 12px;
  padding: 10px 12px;
}

.npc-trainer-section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 8px;
}

.npc-trainer-team {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.npc-trainer-mon {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  border-radius: 8px;
  padding: 4px 8px 4px 4px;
  font-size: 12px;
  color: #374151;
  font-weight: 600;
}

.npc-trainer-mon-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.npc-trainer-mon-name {
  white-space: nowrap;
}

.npc-trainer-mon-item {
  width: 18px;
  height: 18px;
  object-fit: contain;
  margin-left: 2px;
  flex-shrink: 0;
}

.npc-trainer-reward {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fef9c3;
  border-radius: 12px;
  padding: 10px 14px;
}

.npc-trainer-reward-label {
  font-size: 12px;
  font-weight: 700;
  color: #ca8a04;
}

.npc-trainer-reward-val {
  font-size: 13px;
  font-weight: 700;
  color: #374151;
}

.npc-trainer-go-btn {
  font-weight: 800 !important;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25);
}

/* Greeting screen (step 1) */

.npc-trainer-greet {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid #f0f0f0;
}

.npc-trainer-greet-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid #7c3aed;
  object-fit: cover;
  flex-shrink: 0;
  background: #f3e8ff;
}

.npc-trainer-greet-info {
  min-width: 0;
}

.npc-trainer-greet-name {
  font-size: 16px;
  font-weight: 800;
  color: #1a1a2e;
}

.npc-trainer-greet-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  margin-top: 4px;
}

.npc-trainer-bubble {
  background: #f8f9fa;
  border-radius: 14px;
  border-left: 4px solid #7c3aed;
  padding: 14px 16px;
  font-size: 14px;
  color: #374151;
  line-height: 1.55;
}

/* ── Shop confirm screen ── */

.npc-shop-confirm-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 12px 14px;
  background: #f8f9ff;
  border-radius: 14px;
  border: 1px solid #e8eaff;
}

.npc-shop-confirm-img {
  width: 80px;
  height: 80px;
  object-fit: contain;
}

.npc-shop-confirm-img.is-empty {
  background: linear-gradient(135deg, #eef0ff 0%, #e2e6ff 100%);
  border-radius: 14px;
}

.npc-shop-confirm-name {
  font-size: 16px;
  font-weight: 800;
  color: #1a1a2e;
  text-align: center;
  line-height: 1.2;
}

.npc-shop-confirm-desc {
  font-size: 12px;
  color: #6b7280;
  text-align: center;
  line-height: 1.4;
  max-width: 360px;
}

.npc-shop-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 6px 0 2px;
}

.npc-shop-step-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: #fff;
  color: var(--accent);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, transform 0.08s;
  user-select: none;
}

.npc-shop-step-btn:hover:not(:disabled) {
  background: #eef0ff;
}

.npc-shop-step-btn:active:not(:disabled) {
  transform: scale(0.94);
}

.npc-shop-step-btn:disabled {
  border-color: #e5e7eb;
  color: #d1d5db;
  cursor: not-allowed;
  background: #fafafa;
}

.npc-shop-step-val {
  min-width: 56px;
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  color: #1a1a2e;
}

.npc-shop-step-max {
  margin-left: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1.5px solid #e5e7eb;
  background: #fff;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.npc-shop-step-max:hover:not(:disabled) {
  background: #eef0ff;
  border-color: var(--accent);
}

.npc-shop-step-max:disabled {
  color: #9ca3af;
  background: #fafafa;
  cursor: not-allowed;
}

.npc-shop-confirm-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  background: #f8f9fa;
  border-radius: 12px;
}

.npc-shop-confirm-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  color: #6b7280;
}

.npc-shop-confirm-row span:last-child {
  color: #1a1a2e;
  font-weight: 600;
}

.npc-shop-confirm-row.is-total {
  border-top: 1px dashed #e5e7eb;
  padding-top: 8px;
  margin-top: 2px;
  font-size: 14px;
}

.npc-shop-confirm-row.is-total span:last-child {
  color: var(--accent);
  font-weight: 800;
  font-size: 16px;
}

.npc-shop-confirm-row.is-after span:last-child {
  color: #4b5563;
  font-weight: 700;
}

/* ── «Дикие покемоны» и «Возможный дроп» (js/ui/locationWildGrid.js, locationDropsPanel.js) ──
   Секция = заголовок + сетка тайлов. Плашек у строк нет: один уровень вложенности
   (панель → контент), секции делит тонкая линия. Редкость — цветом рамки (единая шкала),
   текстом — в поповере (.loc-tile-pop). */

.loc-wild {
  border-top: 1px solid var(--loc-panel-line);
  padding-bottom: 6px;
}
.loc-drops:empty,
.loc-contest:empty,
.loc-wild:empty { display: none; }

/* ── «Состязание ловцов» (js/ui/catchContestPanel.js) — секция над дикими, токены панели ── */
.cc-wrap { padding: 2px 14px 10px; font-size: 12px; line-height: 1.45; color: var(--loc-panel-text); }
.cc-phase { font-weight: 600; margin-bottom: 6px; }
.cc-warn {
  margin: 6px 0; padding: 6px 8px; border-radius: 8px;
  background: var(--loc-panel-hover); border-left: 3px solid var(--rarity-very-rare);
}
.cc-h {
  margin: 10px 0 4px; font-size: 0.6rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--loc-panel-label);
}
.cc-muted { color: var(--loc-panel-label); }
.cc-own { padding: 6px 8px; border-radius: 8px; background: var(--loc-panel-hover); }
.cc-own-title { font-weight: 700; margin-bottom: 2px; }
.cc-own-line { color: var(--loc-panel-label); }
.cc-own-prize { margin-top: 4px; font-weight: 700; }
.cc-board { list-style: none; margin: 0; padding: 0; }
.cc-row {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto 34px; gap: 6px; align-items: baseline;
  padding: 3px 4px; border-bottom: 1px solid var(--loc-panel-line);
}
.cc-row.is-me { background: var(--loc-panel-hover); border-radius: 6px; font-weight: 700; }
.cc-place { color: var(--loc-panel-label); font-variant-numeric: tabular-nums; }
.cc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-species { color: var(--loc-panel-label); white-space: nowrap; }
.cc-score { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.cc-more {
  margin-top: 6px; padding: 4px 10px; border-radius: 8px; border: 1px solid var(--loc-panel-line);
  background: transparent; color: var(--loc-panel-text); font: inherit; cursor: pointer;
}
.cc-more:hover { background: var(--loc-panel-hover); }
.cc-more:focus-visible { outline: 2px solid var(--rarity-rare); outline-offset: 1px; }
.cc-text { margin: 4px 0; }
.cc-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.cc-chip { padding: 1px 7px; border-radius: 10px; border: 1px solid var(--loc-panel-line); white-space: nowrap; }
.cc-prizes { margin: 0; padding-left: 18px; }

.loc-wild-label {
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--loc-panel-label);
  padding: 10px 16px 5px;
}

/* Смысловые цвета шкалы — классы .loc-rarity-* задают --rc; тема их не видит. */
.loc-rarity-common    { --rc: var(--rarity-common); }
.loc-rarity-uncommon  { --rc: var(--rarity-uncommon); }
.loc-rarity-rare      { --rc: var(--rarity-rare); }
.loc-rarity-very-rare { --rc: var(--rarity-very-rare); }

/* Заголовок секции: подпись капсом, подсказка, ⓘ, справа — счётчик и шеврон. */
.wild-section-header {
  display: flex; align-items: center; gap: 5px;
  padding: 10px 12px 10px 14px; cursor: pointer; user-select: none; white-space: nowrap;
  transition: background 0.15s;
}
.wild-section-header:hover { background: var(--loc-panel-hover); }
.wild-section-header:focus-visible { outline: 2px solid var(--rarity-rare); outline-offset: -2px; border-radius: 8px; }
.wild-section-header .loc-wild-label { padding: 0; margin: 0; letter-spacing: 0.4px; }
.wild-section-meta { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.wild-count { font-size: 11px; color: var(--loc-panel-label); font-weight: 500; }
.wild-chevron {
  font-size: 18px; color: var(--loc-panel-label); display: inline-block; line-height: 1;
  transition: transform 0.25s ease;
}
.wild-section-header.open .wild-chevron { transform: rotate(90deg); }

.wild-section-body {
  overflow: hidden; max-height: 0;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.wild-section-body.open { max-height: 1600px; }

/* Сетки: дикие — auto-fill по 58px (4 колонки на панели 300px, 5 на телефоне), дроп — ровно 4 в ряд. */
.loc-tile-grid { display: grid; gap: 5px; padding: 2px 14px 8px; }
.loc-wild-grid { grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); }
.loc-drop-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.loc-tile {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-width: 0; padding: 3px 2px 4px;
  background: transparent;
  border: 2px solid var(--rc, var(--rarity-common));   /* умолчание здесь, а не `--rc:` в правиле — иначе перебило бы классы шкалы */
  border-radius: 10px;
  color: var(--loc-panel-text);
  font: inherit; cursor: pointer;
  transition: background 0.15s, transform 0.12s;
}
.loc-tile:hover { background: var(--loc-panel-hover); }
.loc-tile:active { transform: scale(0.96); }
.loc-tile:focus-visible { outline: 2px solid var(--rc, var(--rarity-common)); outline-offset: 2px; }
.loc-tile-art { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; overflow: hidden; }
.loc-tile-img { max-width: 100%; max-height: 100%; object-fit: contain; image-rendering: auto; }
/* dex-спрайты 120×120 с широкими прозрачными полями (вид занимает ~40–80 px): рисуем
   крупнее кадра и обрезаем поля — иначе покемон в тайле размером с ноготь. */
.loc-wild-tile .loc-tile-img { width: 60px; height: 60px; max-width: none; max-height: none; flex-shrink: 0; }
.loc-tile-name {
  max-width: 100%; font-size: 0.6rem; font-weight: 600; line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.loc-tile-lvl { font-size: 0.56rem; line-height: 1.1; color: var(--loc-panel-label); font-variant-numeric: tabular-nums; }
/* Время суток (29.10): подпись «днём/ночью» под уровнем; вне своей фазы тайл приглушён —
   вид есть на локации, но сейчас не встретится (бросок решает сервер, это только показ). */
.loc-tile-time { font-size: 0.54rem; line-height: 1.1; font-weight: 600; color: var(--loc-panel-label); letter-spacing: 0.02em; }
.loc-wild-tile.is-offphase { opacity: 0.45; }
.loc-wild-tile.is-offphase:hover, .loc-wild-tile.is-offphase:focus-visible { opacity: 0.8; }
.loc-drop-tile { height: 40px; padding: 2px; }
.loc-drop-tile .loc-tile-art { width: 28px; height: 28px; }

/* Заглушки, если картинки нет: силуэт покемона / ромб предмета. */
.loc-tile-ph {
  width: 30px; height: 30px; background-color: var(--rarity-common); opacity: 0.55;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Ccircle cx='20' cy='13' r='8'/%3E%3Cellipse cx='20' cy='30' rx='12' ry='9'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Ccircle cx='20' cy='13' r='8'/%3E%3Cellipse cx='20' cy='30' rx='12' ry='9'/%3E%3C/svg%3E") center / contain no-repeat;
}
.loc-tile-ph-item { width: 16px; height: 16px; -webkit-mask: none; mask: none; transform: rotate(45deg); border-radius: 4px; }
.loc-tile-ph[hidden] { display: none; }

/* Поповер тайла (js/ui/locTilePopover.js): один на страницу, над тайлом. */
.loc-tile-pop {
  position: fixed; z-index: 2000; max-width: 220px;
  padding: 8px 10px; border-radius: 10px;
  background: #2b241d; color: #fbf6ee;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
  font-size: 0.74rem; line-height: 1.35;
  pointer-events: none;
}
.loc-tile-pop[hidden] { display: none; }
.loc-tile-pop-title { font-weight: 700; margin-bottom: 2px; }
.loc-tile-pop-line { color: #e2d6c6; }
.loc-tile-pop-hint { margin-top: 4px; font-size: 0.66rem; color: #b8a994; }

.npc-link {
  display: block;
  padding: 4px 0;
  color: #555;
  text-decoration: none;
  font-size: 0.79rem;
  white-space: nowrap;
  transition: color 0.1s;
}

.npc-link:hover { color: #cc3300; }

/* ── Panel collapse toggle ── */

.panel-toggle {
  position: absolute;
  top: calc(var(--header-h) + 14px);
  right: 14px;
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.95);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.55rem;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: background 0.15s, transform 0.15s;
}

.panel-toggle:hover {
  background: #f0f0f0;
  transform: scale(1.1);
}

/* ── Bottom action bar ── */

.g-bottom-bar {
  height: var(--bottom-h);
  background: rgba(22, 22, 22, 0.98);
  border-top: 1px solid #2a2a2a;
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 10px;
  flex-shrink: 0;
}

.bottom-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bottom-actions {
  display: flex;
  gap: 4px;
}

.bb-paw-btn {
  height: 36px;
  padding: 0 18px;
  background: #555;
  border: none;
  border-radius: 50px;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  flex-shrink: 0;
  white-space: nowrap;
}

.bb-paw-btn:hover {
  background: #666;
  transform: translateY(-1px);
}

.bb-paw-btn.hunt-active {
  background: linear-gradient(135deg, #e53935, #ff6f00);
  box-shadow: 0 3px 12px rgba(229, 57, 53, 0.5);
  animation: hunt-pulse 1.4s ease-in-out infinite;
}

.bb-paw-btn.hunt-active:hover { background: linear-gradient(135deg, #c62828, #e65100); }

@keyframes hunt-pulse {
  0%, 100% { box-shadow: 0 3px 12px rgba(229, 57, 53, 0.4); }
  50%       { box-shadow: 0 4px 22px rgba(229, 57, 53, 0.85); }
}

.bb-companion-slot {
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
}

.companion-alert {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 14px;
  height: 14px;
  background: #cc4444;
  border-radius: 50%;
  font-size: 0.6rem;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  line-height: 1;
}

.bb-btn {
  width: 34px;
  height: 34px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  color: #888;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.bb-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ddd;
}

/* ══════════════════════════════════════════
   RIGHT CHAT PANEL
══════════════════════════════════════════ */

.g-chat {
  width: var(--chat-w);
  background: #fff;
  border-left: 1px solid #d0d0d0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.chat-tabs {
  display: flex;
  border-bottom: 1px solid #d8d8d8;
  background: #f4f3ef;
  flex-shrink: 0;
}

.ctab {
  flex: 1;
  padding: 7px 2px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 0.65rem;
  color: #777;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  font-family: inherit;
}

.ctab:hover { color: #333; }

.ctab.active {
  color: #2255bb;
  border-bottom-color: #2255bb;
  background: #fff;
  font-weight: 700;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: #f5f5f5; }
.chat-messages::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

/* Base message */
.chat-msg {
  font-size: 0.77rem;
  line-height: 1.45;
  word-break: break-word;
}

.msg-sender {
  font-weight: 700;
  margin-right: 3px;
}

.msg-text { color: #555; }

/* Announcement */
.chat-msg.announcement .msg-sender { color: #cc0000; }
.chat-msg.announcement .msg-text   { color: #bb5500; }
.chat-msg.announcement .msg-date {
  display: block;
  font-size: 0.63rem;
  color: #aaa;
  margin-top: 1px;
}

/* Player message colors */
.color-pink   { color: #cc4488; }
.color-green  { color: #2a9a2a; }
.color-blue   { color: #2255bb; }
.color-red    { color: #cc2222; }
.color-orange { color: #cc6600; }
.color-gray   { color: #666; }
.color-purple { color: #7744cc; }

/* Badge (e.g. "shadow rank") */
.msg-badge {
  display: inline-block;
  background: #3a3a3a;
  color: #ccc;
  font-size: 0.6rem;
  padding: 1px 5px;
  border-radius: 2px;
  margin-left: 4px;
  vertical-align: middle;
  font-weight: 400;
}

/* Info / system messages */
.chat-msg.info .msg-sender {
  color: #888;
  font-weight: 400;
}

.chat-msg.info .msg-text { color: #aa2255; }

.msg-info-icon {
  color: #2255bb;
  font-size: 0.72rem;
  margin-right: 2px;
}

.msg-heart {
  color: #aa2255;
  font-size: 0.72rem;
  margin-right: 2px;
}

/* Chat input */
.chat-input-row {
  display: flex;
  align-items: center;
  border-top: 1px solid #d8d8d8;
  padding: 6px;
  gap: 4px;
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.8rem;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s;
}

.chat-input:focus { border-color: #2255bb; }

.emoji-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 3px 5px;
  border-radius: 4px;
  line-height: 1;
  transition: background 0.15s;
}

.emoji-btn:hover { background: #f0f0f0; }


/* ══════════════════════════════════════════
   PROFILE MODAL
══════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.profile-modal {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 600px;
  max-width: 96vw;
  max-height: 85vh;
  background: #f5f5f5;
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  overflow: hidden;
  overflow-y: auto;
  transform: scale(0.93) translateY(14px);
  transition: transform 0.28s cubic-bezier(0.34, 1.46, 0.64, 1);
}

/* Show/hide helpers for mobile/desktop */
.mob-only { display: none; }
.desk-only { display: flex; }
.mob-battle-statusbar { display: none; }
.mob-battle-prompt { display: none; }

/* ── Profile hero (shared desktop+mobile) ── */
.mob-prof-hero {
  position: relative; width: 100%; min-height: 280px;
  overflow: hidden; display: flex; align-items: flex-end; color: #fff;
}
.mob-prof-hero-bg {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, #1a1a2e, #0f3460);
  background-size: cover; background-position: center; transform: scale(1.05);
}
.mob-prof-hero-blur {
  position: absolute; inset: 0;
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  background: rgba(0,0,0,0.1);
}
.mob-prof-hero-gradient {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, transparent 25%, rgba(0,0,0,0.4) 55%, rgba(0,0,0,0.85) 100%);
}
.mob-prof-hero-content {
  position: relative; z-index: 2; width: 100%; padding: 20px 24px 24px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.mob-prof-avatar-wrap { position: relative; margin-bottom: 12px; }
.mob-prof-avatar {
  width: 88px; height: 88px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.4); overflow: hidden;
  background: rgba(255,255,255,0.1); display: flex; align-items: center; justify-content: center;
}
.mob-prof-avatar img { width: 100%; height: 100%; object-fit: cover; }
.mob-prof-letter { font-size: 36px; font-weight: 700; color: #fff; }
.mob-prof-avatar-btn {
  position: absolute; bottom: 0; right: -4px;
  width: 30px; height: 30px; border-radius: 50%;
  background: #4CAF50; border: 2px solid #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; cursor: pointer; padding: 0;
}
.mob-prof-nick { font-size: 22px; font-weight: 700; text-shadow: 0 2px 8px rgba(0,0,0,0.5); }
.mob-prof-avatar-btn:disabled { opacity: .6; cursor: default; }
/* Итог загрузки аватара — под аватаром; ошибка обязана быть видна (раньше молчали) */
.mob-prof-avatar-status {
  max-width: 260px; margin: -4px auto 10px; font-size: 12px; line-height: 1.35;
  color: rgba(255,255,255,0.85); text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}
.mob-prof-avatar-status.is-error { color: #ff8a80; }
.mob-prof-avatar-status[hidden] { display: none; }
/* Ник в профиле — цвет должности (тот же, что в шапке и чате) */
.mob-prof-nick.role-admin  { color: var(--role-admin); }
.mob-prof-nick.role-mod    { color: var(--role-mod); }
.mob-prof-nick.role-mentor { color: var(--role-mentor); }
.mob-prof-nick.role-jester { color: var(--role-jester); }
.mob-prof-nick.role-curator { color: var(--role-curator); }
.mob-prof-nick.role-gymleader { color: var(--role-gymleader); }
.mob-prof-online {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 13px; color: rgba(255,255,255,0.85); margin-top: 4px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.prof-online-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: #9e9e9e;
}
.prof-online-dot.on {
  background: #4CAF50;
  box-shadow: 0 0 6px rgba(76, 175, 80, 0.8);
}
.mob-prof-rank { font-size: 13px; color: rgba(255,255,255,0.7); margin-top: 2px; }
/* М3: чип должности (модератор/админ) ВМЕСТО ранга; у игроков чипа нет, у них ранг.
   Классы — общий словарь roleClass() (role-admin/role-mod), как у ника. */
.prof-role-chip {
  display: inline-block; margin-top: 5px;
  font-size: 11px; font-weight: 800; letter-spacing: .02em;
  border-radius: 999px; padding: 3px 10px;
}
.prof-role-chip.role-mod {
  background: rgba(var(--role-mod-rgb), 0.22);
  border: 1px solid rgba(var(--role-mod-rgb), 0.55);
  color: #9dccff;
}
.prof-role-chip.role-admin {
  background: rgba(var(--role-admin-rgb), 0.20);
  border: 1px solid rgba(var(--role-admin-rgb), 0.55);
  color: #ffb3b3;
}
.prof-role-chip.role-mentor {
  background: rgba(var(--role-mentor-rgb), 0.20);
  border: 1px solid rgba(var(--role-mentor-rgb), 0.55);
  color: #d7b3ff;
}
.prof-role-chip.role-jester {
  background: rgba(var(--role-jester-rgb), 0.20);
  border: 1px solid rgba(var(--role-jester-rgb), 0.55);
  color: #a8f0e6;
}
.prof-role-chip.role-curator {
  background: rgba(var(--role-curator-rgb), 0.20);
  border: 1px solid rgba(var(--role-curator-rgb), 0.55);
  color: #b4f0c1;
}
.prof-role-chip.role-gymleader {
  background: rgba(var(--role-gymleader-rgb), 0.20);
  border: 1px solid rgba(var(--role-gymleader-rgb), 0.55);
  color: #ffeaa3;
}
.mob-prof-location {
  font-size: 12px; color: rgba(255,255,255,0.9);
  background: rgba(0,0,0,0.3); backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 4px 12px; border-radius: 50px; margin-top: 6px;
}
.mob-prof-join { font-size: 12px; color: rgba(255,255,255,0.4); margin-top: 4px; }
.mob-prof-back {
  position: absolute; top: 14px; left: 14px; z-index: 10;
  background: rgba(0,0,0,0.35); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff; padding: 7px 14px; border-radius: 20px; font-size: 14px; cursor: pointer;
}

/* Stats row */
.mob-prof-stats-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  padding: 14px 20px; background: #fff; border-bottom: 1px solid #f0f0f0;
}
.mob-prof-stat {
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 4px; background: #f8f9fa; border-radius: 12px;
}
.mob-prof-stat-val { font-size: 20px; font-weight: 700; color: #1a1a2e; }
.mob-prof-stat-lbl { font-size: 10px; color: #aaa; font-weight: 600; text-transform: uppercase; margin-top: 2px; }
.mob-prof-stat-shiny { font-size: 10px; font-weight: 700; color: #bf8a00; margin-top: 3px; }

/* Profile sections */
.mob-prof-section {
  background: #fff; margin: 8px 16px; border-radius: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.mob-prof-section-title {
  font-size: 11px; font-weight: 700; color: #aaa; letter-spacing: 1px;
  padding: 12px 16px 6px; border-bottom: 1px solid #f5f5f5;
}
/* Раздел «Достижения» в своём профиле (наполняет js/ui/achievementsModal.js mountAchievementsSection).
   Перенесено из CSS-строки экрана достижений 30.10, значения — на переменные палитры профиля. */
.ach-prof-stats { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px 4px; }
.ach-prof-stat { background: var(--prof-sub); border-radius: 10px; padding: 6px 10px; font-size: 12.5px; color: var(--prof-muted); }
.ach-prof-stat b { color: var(--prof-ink); font-size: 15px; margin-right: 4px; }
.ach-prof-stat.is-ready { background: var(--prof-green-bg); color: var(--prof-green-ink); }
.ach-prof-stat.is-ready b { color: var(--prof-green-ink); }
.ach-prof-open {
  display: block; width: calc(100% - 32px); margin: 8px 16px 14px; padding: 10px 12px; border: 0; border-radius: 10px;
  background: var(--prof-ink); color: var(--prof-card); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.mob-prof-active-poke { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.mob-prof-poke-sprite { width: 64px; height: 64px; object-fit: contain; }
.mob-prof-poke-name { font-size: 17px; font-weight: 700; color: #1a1a2e; }
.mob-prof-poke-lv { font-size: 13px; color: #888; }
.mob-prof-empty { padding: 16px; font-size: 13px; color: #aaa; font-style: italic; text-align: center; }
.mob-prof-desc-body { padding: 12px 16px; font-size: 14px; color: #333; line-height: 1.5; }
.mob-prof-edit-desc-btn {
  float: right; background: none; border: 1px solid #ddd; border-radius: 8px;
  padding: 3px 10px; font-size: 11px; font-weight: 600; color: #555; cursor: pointer;
}
.mob-prof-section-title:has(.mob-prof-edit-desc-btn) { padding-bottom: 12px; }
.mob-prof-fav-toggle {
  display: flex; align-items: center; gap: 4px;
  justify-content: flex-end; padding: 6px 16px 12px;
  font-size: 11px; font-weight: 500; color: #888; cursor: pointer;
}
.mob-prof-fav-toggle input { width: 14px; height: 14px; accent-color: #4CAF50; }
.mob-prof-fav-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 20px; }
.mob-prof-fav-set-btn {
  background: #FFB300; color: #fff; border: none; border-radius: 10px;
  padding: 8px 20px; font-size: 13px; font-weight: 600; cursor: pointer; margin-top: 4px;
}
.mob-prof-desc-input {
  width: 100%; border: 2px solid #eee; border-radius: 10px; padding: 10px;
  font-size: 14px; resize: vertical; min-height: 60px; outline: none; font-family: inherit;
}
.mob-prof-desc-input:focus { border-color: #4CAF50; }
.mob-prof-desc-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.mob-prof-desc-count { font-size: 11px; color: #aaa; flex: 1; }
.mob-prof-desc-cancel { background: none; border: 1px solid #ddd; border-radius: 8px; padding: 6px 14px; font-size: 13px; cursor: pointer; color: #666; }
.mob-prof-desc-save { background: #4CAF50; color: #fff; border: none; border-radius: 8px; padding: 6px 14px; font-size: 13px; font-weight: 600; cursor: pointer; }
.mob-prof-action {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 14px 16px; border: none; background: none; cursor: pointer;
  font-size: 15px; color: #1a1a2e; text-align: left;
}

/* Чёрный список (21.10): кнопка в чужом профиле + список в своём */
.mob-prof-block-btn { color: #c0392b; }
.mob-prof-block-btn:disabled { opacity: 0.5; cursor: default; }
.mob-prof-block-status { padding: 0 16px 10px; font-size: 12px; color: #6a6a75; }
.mob-prof-blocklist { padding: 0 16px 10px; }
.mob-prof-block-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #eee; }
.mob-prof-block-row:last-child { border-bottom: none; }
.mob-prof-block-nick { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: #1a1a2e; }
.mob-prof-block-unblock { background: none; border: 1px solid #ddd; border-radius: 8px; padding: 5px 12px; font-size: 12px; cursor: pointer; color: #666; flex-shrink: 0; }
.mob-prof-block-unblock:disabled { opacity: 0.5; cursor: default; }

/* Favorite picker (shared desktop + mobile) */
.fav-picker-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 99999; display: flex; align-items: center; justify-content: center;
}
.fav-picker-sheet {
  width: 400px; max-width: 95vw; max-height: 70vh; background: #fff;
  border-radius: 20px; overflow: hidden;
  display: flex; flex-direction: column;
  animation: favSlideUp 0.25s ease;
}
@keyframes favSlideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.fav-picker-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid #f0f0f0;
  font-size: 16px; font-weight: 700; color: #1a1a2e; flex-shrink: 0;
}
.fav-picker-close { background: none; border: none; font-size: 20px; color: #aaa; cursor: pointer; }
.fav-picker-list { overflow-y: auto; flex: 1; padding: 8px 0; }
.fav-picker-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; cursor: pointer; border-bottom: 1px solid #f5f5f5;
  transition: background 0.15s;
}
.fav-picker-row:hover { background: #f8f9fa; }
.fav-picker-row.selected { background: rgba(255,179,0,0.08); }
.fav-picker-left { display: flex; flex-direction: column; gap: 2px; }
.fav-picker-name { font-size: 15px; font-weight: 600; color: #1a1a2e; }
.fav-picker-meta { font-size: 12px; color: #aaa; }
.fav-picker-star { font-size: 24px; color: #ddd; transition: color 0.2s; }
.fav-picker-row.selected .fav-picker-star { color: #FFB300; }

/* Desktop close button */
.prof-close-btn {
  position: absolute; top: 16px; right: 16px; z-index: 10;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0,0,0,0.4); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.2); color: #fff;
  font-size: 16px; cursor: pointer;
  align-items: center; justify-content: center;
}

.modal-overlay.open .profile-modal {
  transform: scale(1) translateY(0);
}

/* ── Loading skeleton ── */
.pm-skeleton {
  background: linear-gradient(90deg, #ece9e3 25%, #e0ddd7 50%, #ece9e3 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
}

.pm-skeleton-line  { display: block; }
.pm-skeleton-block { display: block; height: 120px; width: 100%; }

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Error / empty states ── */
.pm-error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 100px;
  color: #aaa;
  font-size: 0.82rem;
}

.pm-retry-btn {
  padding: 5px 14px;
  border-radius: 6px;
  border: 1px solid #ddd;
  background: #fff;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.pm-retry-btn:hover { background: #f0f0f0; }

.pm-tab-empty {
  color: #bbb;
  font-size: 0.82rem;
  padding: 24px 0;
  text-align: center;
}

.pm-tab-loading {
  color: #bbb;
  font-size: 0.82rem;
  padding: 24px 0;
  text-align: center;
}

/* ── Close button ── */
.pm-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  background: rgba(0,0,0,0.06);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.78rem;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.15s, color 0.15s;
}

.pm-close:hover {
  background: rgba(220, 60, 60, 0.12);
  color: #cc2222;
}

/* ── Avatar wrap ── */
.pm-avatar-wrap {
  position: relative;
  margin-bottom: 14px;
  flex-shrink: 0;
}

.pm-avatar-edit-btn {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #3d7dca;
  border: 2px solid #fff;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.pm-avatar-edit-btn:hover { background: #2d6db8; }

.pm-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* ── Description editing ── */
.pm-desc-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.pm-desc-edit-btn {
  background: none;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 0.72rem;
  color: #888;
  cursor: pointer;
  font-family: inherit;
  align-self: flex-start;
  transition: border-color 0.15s, color 0.15s;
}

.pm-desc-edit-btn:hover {
  border-color: #3d7dca;
  color: #3d7dca;
}

.pm-desc-placeholder { color: #bbb; font-style: italic; }

.pm-desc-textarea {
  width: 100%;
  min-height: 72px;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 0.8rem;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
  line-height: 1.5;
  color: #333;
}

.pm-desc-textarea:focus { border-color: #3d7dca; }

.pm-desc-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pm-desc-count {
  font-size: 0.68rem;
  color: #bbb;
  margin-right: auto;
}

.pm-action-btn {
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid #ddd;
  background: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}

.pm-action-btn:hover { background: #f0f0f0; }

.pm-action-btn.primary {
  background: #3d7dca;
  border-color: #3d7dca;
  color: #fff;
}

.pm-action-btn.primary:hover { background: #2d6db8; }
.pm-action-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Left panel ── */
.pm-left {
  width: 210px;
  flex-shrink: 0;
  background: #eae9e4;
  border-right: 1px solid #dddcd8;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px 16px 20px;
  gap: 0;
  overflow-y: auto;
}

.pm-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c6fd4, #3d7dca);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 2.6rem;
  font-weight: 800;
  border: 4px solid #fff;
  box-shadow: 0 6px 24px rgba(0,0,0,0.18);
  margin-bottom: 14px;
  flex-shrink: 0;
}

/* Nickname as styled badge/button */
.pm-nick-badge {
  background: linear-gradient(135deg, #3d7dca, #6a5acd);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 5px 18px;
  border-radius: 20px;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 10px rgba(61, 125, 202, 0.35);
  margin-bottom: 12px;
}

/* Collectible icons row */
.pm-collectibles {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
}

.pm-badge-icon {
  width: 28px;
  height: 28px;
  background: rgba(255,255,255,0.7);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  border: 1px solid rgba(0,0,0,0.07);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.pm-divider {
  width: 100%;
  height: 1px;
  background: #d4d3ce;
  margin-bottom: 16px;
}

/* Stat cards */
.pm-stat-card {
  width: 100%;
  background: rgba(255,255,255,0.65);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.pm-sc-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: #222;
  line-height: 1;
}

.pm-sc-sm {
  font-size: 0.78rem;
  font-weight: 600;
}

.pm-sc-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #aaa;
  font-weight: 600;
}

/* ── Main area ── */
.pm-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.pm-main-header {
  padding: 24px 24px 16px;
  border-bottom: 1px solid #dddcd8;
  flex-shrink: 0;
}

.pm-main-nick {
  font-size: 1.5rem;
  font-weight: 800;
  color: #1a1a1a;
  line-height: 1;
  margin-bottom: 4px;
}

.pm-main-status {
  font-size: 0.82rem;
  font-weight: 600;
  color: #3d7dca;
  margin-bottom: 6px;
}

.pm-main-desc {
  font-size: 0.8rem;
  color: #888;
  line-height: 1.5;
}

/* Tabs */
.pm-tabs {
  display: flex;
  border-bottom: 1px solid #dddcd8;
  padding: 0 20px;
  flex-shrink: 0;
  background: #f0efeb;
}

.pm-tab {
  padding: 10px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: #aaa;
  transition: color 0.15s, border-color 0.15s;
  font-family: inherit;
  margin-bottom: -1px;
}

.pm-tab:hover { color: #555; }

.pm-tab.active {
  color: #3d7dca;
  border-bottom-color: #3d7dca;
}

/* Tab content */
.pm-content {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
  animation: fadeIn 0.18s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.pm-content::-webkit-scrollbar { width: 4px; }
.pm-content::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

/* Awards grid */
.awards-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.award-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: transform 0.15s;
}

.award-item:hover { transform: scale(1.12); }

.award-icon {
  width: 58px;
  height: 58px;
  background: linear-gradient(135deg, #fffbe6, #ffe066);
  border: 2px solid #f0c030;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
  box-shadow: 0 3px 10px rgba(0,0,0,0.12);
}

.award-name {
  font-size: 0.62rem;
  color: #888;
  text-align: center;
  max-width: 62px;
  line-height: 1.2;
  font-weight: 500;
}

/* Значок-КАРТИНКА: плитка та же 58×58, но золото под ней гасится.
   ⚠️ Не «поправить градиент», а СНЯТЬ: арт значка круглый и со своей рамкой, а
   плитка — скруглённый КВАДРАТ, поэтому золото вылезало бы четырьмя углами.
   Эмодзи-значки (иконка не путь) золото сохраняют — ветку выбирает разметка
   (`.award-item-img` ставит `awardsGridHtml` по тому же признаку, что и `<img>`). */
.award-item-img .award-icon {
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.award-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* Тень по силуэту, а не по коробке: у прозрачного PNG box-shadow обвёл бы квадрат. */
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.28));
}

/* Сетка внутри карточки «ТРОФЕИ» одноколоночного профиля: у `.mob-prof-section`
   своих отступов нет (их дают дети), поэтому поля задаём здесь — как у
   `.mob-prof-active-poke`. Во вкладке `.pm-content` отступ свой, её не трогаем. */
#mob-prof-awards .awards-grid,
#mob-prof-titles .awards-grid,
#mob-prof-gyms .awards-grid { padding: 14px 16px; }   /* гим-значки (31.10) — те же поля, что у трофеев и титулов */

/* Friends list */
.friends-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.friend-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid transparent;
}

.friend-item:hover {
  background: rgba(61, 125, 202, 0.06);
  border-color: rgba(61, 125, 202, 0.12);
}

.friend-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.friend-info { flex: 1; }

.friend-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #222;
}
/* Должность → цвет ника в списках на светлом фоне (Тренеры, друзья) */
.friend-name.role-admin  { color: var(--role-admin); }
.friend-name.role-mod    { color: var(--role-mod); }
.friend-name.role-mentor { color: var(--role-mentor); }
.friend-name.role-jester { color: var(--role-jester); }
.friend-name.role-curator { color: var(--role-curator); }
.friend-name.role-gymleader { color: var(--role-gymleader); }

.friend-status {
  font-size: 0.7rem;
  color: #bbb;
  margin-top: 1px;
}

.friend-online-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #44cc66;
  box-shadow: 0 0 6px rgba(68, 204, 102, 0.6);
  flex-shrink: 0;
}

/* ── Held-item durability badges (inventory `id@N` stacks + held slot) ── */
.inv-item-dur {
  position: absolute; top: 6px; left: 6px;
  font-size: 9.5px; font-weight: 800; line-height: 1;
  padding: 3px 6px; border-radius: 50px; color: #fff;
  pointer-events: none;
}
.inv-detail-dur {
  display: inline-block; margin-top: 4px;
  font-size: 11px; font-weight: 700;
  padding: 3px 10px; border-radius: 50px; color: #fff;
}
.tm-held-dur {
  position: absolute; top: 26px; right: 4px;
  font-size: 9px; font-weight: 800; line-height: 1;
  padding: 2px 5px; border-radius: 50px; color: #fff;
}
.inv-dur-4 { background: #43a047; }
.inv-dur-3 { background: #f0a020; }
.inv-dur-2 { background: #ef7d24; }
.inv-dur-1 { background: #e04343; }

/* ── Trainers directory modal (reuses .friend-item rows) ── */
.trainers-modal {
  position: relative;
  width: min(420px, calc(100vw - 32px));
  height: min(640px, 84vh);
  background: #fff;
  border-radius: 20px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
}
.trainers-title { font-size: 18px; font-weight: 700; color: #223; }
.trainers-close {
  position: absolute; top: 14px; right: 14px;
  width: 30px; height: 30px; border-radius: 50%;
  border: none; background: rgba(0, 0, 0, 0.06); color: #555;
  font-size: 14px; cursor: pointer; line-height: 1;
}
.trainers-close:hover { background: rgba(0, 0, 0, 0.12); }
/* Вкладки «Тренеры / Команда игры» — акцент самой модалки (#3d7dca), не
   тёмный .admin-tab и не inline-стили журнала. Карточка фиксированной высоты:
   вкладки не сжимаются, тянется только список. */
.trainers-tabs { display: flex; gap: 8px; flex-shrink: 0; }
.trainers-tab {
  flex: 1; padding: 9px 12px; border-radius: 12px;
  border: 1px solid rgba(61, 125, 202, 0.25); background: none; color: #6b7a90;
  font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.trainers-tab:hover { background: rgba(61, 125, 202, 0.06); }
.trainers-tab.active { background: #3d7dca; border-color: #3d7dca; color: #fff; }

.trainers-search {
  width: 100%; padding: 10px 14px;
  border: 1px solid rgba(61, 125, 202, 0.25); border-radius: 12px;
  font-size: 14px; outline: none;
}
.trainers-search:focus {
  border-color: #3d7dca;
  box-shadow: 0 0 0 3px rgba(61, 125, 202, 0.12);
}
.trainers-search-row { display: flex; gap: 8px; align-items: stretch; }
.trainers-search-row .trainers-search { flex: 1 1 auto; min-width: 0; }
.trainers-online-toggle {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px;
  border: 1px solid rgba(61, 125, 202, 0.25); border-radius: 12px; background: none;
  color: #6b7a90; font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer; white-space: nowrap;
}
.trainers-online-toggle:hover { background: rgba(61, 125, 202, 0.06); }
.trainers-online-dot { width: 8px; height: 8px; border-radius: 50%; background: #b8c2d0; }
.trainers-online-toggle.active { background: #3d7dca; border-color: #3d7dca; color: #fff; }
.trainers-online-toggle.active .trainers-online-dot { background: #4cd964; }
.trainers-list { overflow-y: auto; flex: 1; min-height: 120px; }
/* .friend-avatar has no background of its own — letter fallbacks need one */
.trainers-row .friend-avatar { background: linear-gradient(135deg, #3d7dca, #5a9be0); }
.trainers-empty { padding: 24px 0; text-align: center; color: #99a; font-size: 13px; }
.trainers-you {
  font-size: 10px; font-weight: 700; color: #3d7dca;
  background: rgba(61, 125, 202, 0.1); border-radius: 6px; padding: 1px 6px;
  vertical-align: middle;
}
.trainers-more {
  border: 1px solid rgba(61, 125, 202, 0.25); background: none; color: #3d7dca;
  border-radius: 12px; padding: 9px; font-size: 13px; font-weight: 600; cursor: pointer;
  flex-shrink: 0;
}
.trainers-more:hover { background: rgba(61, 125, 202, 0.06); }
.trainers-more:disabled { opacity: 0.5; cursor: default; }

/* Gifts grid */
.gifts-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.gift-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: transform 0.15s;
}

.gift-item:hover { transform: scale(1.12); }

.gift-icon {
  width: 58px;
  height: 58px;
  background: linear-gradient(135deg, #fce4f8, #e4a8f8);
  border: 2px solid #d080e8;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
  box-shadow: 0 3px 10px rgba(0,0,0,0.12);
}

.gift-name {
  font-size: 0.62rem;
  color: #888;
  text-align: center;
  max-width: 62px;
  line-height: 1.2;
  font-weight: 500;
}


/* ══════════════════════════════════════════
   TEAM MODAL
══════════════════════════════════════════ */

.team-modal {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 860px;
  max-width: 96vw;
  /* Было ровно 560px при любом экране, и правая панель детали не вмещала своё
     содержимое: бар опыта и кнопки действий уходили ПОД сгиб, а про прокрутку внутри
     панели никто не догадывался. На нормальном экране теперь помещается всё, на
     низком по-прежнему упирается в 94vh и панель скроллится, как раньше. */
  height: min(660px, 94vh);
  max-height: 94vh;
  background: #f5f4f0;
  border-radius: 20px;
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.38), 0 0 0 1px rgba(0,0,0,0.06);
  overflow: hidden;
  transform: scale(0.93) translateY(14px);
  transition: transform 0.28s cubic-bezier(0.34, 1.46, 0.64, 1);
}

.modal-overlay.open .team-modal {
  transform: scale(1) translateY(0);
}

/* Header */
.tm-header {
  padding: 14px 18px 10px;
  border-bottom: 1px solid #dddcd8;
  background: #eae9e4;
  flex-shrink: 0;
}

.tm-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 800;
  color: #333;
}

/* Body: grid + detail */
.tm-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* 2×3 grid */
.tm-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 10px;
  padding: 14px;
  width: 490px;
  flex-shrink: 0;
  align-content: start;
}

/* Pokémon card */
.tm-card {
  position: relative;
  background: #fff;
  border: 2px solid #e0deda;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.12s;
  display: flex;
  flex-direction: column;
}

.tm-card:hover {
  border-color: #3d7dca;
  box-shadow: 0 4px 16px rgba(61, 125, 202, 0.18);
  transform: translateY(-2px);
}

.tm-card.selected {
  border-color: #3d7dca;
  box-shadow: 0 0 0 3px rgba(61, 125, 202, 0.22), 0 4px 16px rgba(61, 125, 202, 0.18);
}

.tm-card.tm-active-card {
  background: linear-gradient(160deg, #f0f7ff 0%, #fff 100%);
}

.tm-card.empty {
  border-style: dashed;
  background: rgba(0,0,0,0.02);
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 110px;
}

.tm-empty-label {
  font-size: 0.72rem;
  color: #bbb;
  font-weight: 500;
}

.tm-card-top {
  position: relative;
  background: linear-gradient(160deg, #f8f7f5, #ece9e3);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 4px 2px;
  min-height: 72px;
}

.tm-sprite {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
  object-fit: contain;
}

.tm-active-badge {
  position: absolute;
  top: 5px;
  left: 6px;
  background: #3d7dca;
  color: #fff;
  font-size: 0.55rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.tm-shiny-badge {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 0.85rem;
  line-height: 1;
  filter: drop-shadow(0 0 3px rgba(255, 200, 40, 0.9));
  animation: shinyTwinkle 1.8s ease-in-out infinite;
}
.mob-shiny-badge {
  font-size: 0.9rem;
  filter: drop-shadow(0 0 3px rgba(255, 200, 40, 0.9));
}
@keyframes shinyTwinkle {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%      { opacity: 0.6; transform: scale(0.85); }
}

/* Shiny in the team modal — gold name + small "шайни" label (replaces the ✨
   badge), matching the battle plate. Darker gold here (#bf8a00) because these
   cards sit on a LIGHT background; !important beats the base name colors
   (.tm-nickname #222, .tm-detail-name, mobile .mob-poke-name color !important). */
.tm-shiny-name { color: #bf8a00 !important; }
.tm-shiny-tag {
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: lowercase;
  color: #bf8a00;
  line-height: 1;
  margin-bottom: 1px;
}
/* Sits on its own line ABOVE the name (like the desktop .tm-shiny-tag), so it no longer
   competes with the name/gender/letter/level row — the name itself carries the gold. */
.mob-shiny-tag {
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: lowercase;
  color: #bf8a00;
  line-height: 1;
  margin-bottom: 2px;
}

/* ── «Окрас Хоэнна» — ПАРА к трём классам выше ─────────────────────────────
   Награда верхней описи сбежавших: разовая покраска одного покемона. Золото то
   же самое — эстетика шайни и есть смысл награды, — а ПОДПИСЬ другая: «Хоэнн»
   вместо «шайни». Соперник в PvP и покупатель на аукционе обязаны отличать
   редкую находку от косметики, купленной за квест.
   Классы ОТДЕЛЬНЫЕ, хотя правила сегодня совпадают: метки разного смысла не
   должны делить одно имя — иначе следующая правка «подкрутить шайни» молча
   поедет и по окрасу. `text-transform` НЕ lowercase: «Хоэнн» — имя региона. */
.tm-hoenn-name { color: #bf8a00 !important; }
.tm-hoenn-tag {
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #bf8a00;
  line-height: 1;
  margin-bottom: 1px;
}
.mob-hoenn-tag {
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #bf8a00;
  line-height: 1;
  margin-bottom: 2px;
}

.tm-tag {
  position: absolute;
  top: 5px;
  right: 6px;
  background: rgba(200, 100, 20, 0.85);
  color: #fff;
  font-size: 0.55rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: capitalize;
}

.tm-card-info {
  padding: 6px 8px 8px;
  flex: 1;
}

.tm-card-name {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 1px;
}

.tm-nickname {
  font-size: 0.8rem;
  font-weight: 700;
  color: #222;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tm-gender {
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  /* iOS renders ♂/♀ (U+2642/U+2640) with Apple Color Emoji, whose glyphs are bigger and sit
     below the text baseline — the sign visibly "slid down" next to the name. The fix is the
     TEXT presentation, not a nudge: the markup carries U+FE0E after every glyph, and this is
     the modern equivalent for browsers that support it. Deliberately NO vertical-align here —
     `middle` aligns to half the x-height, not to the text centre, and measurably pushed the
     glyph 1.3px down in Chrome (i.e. it caused the very defect it looked like it was fixing). */
  font-variant-emoji: text;
}

.gender-m { color: #3d7dca; }
.gender-f { color: #cc4488; }
.gender-n { color: #9ca3af; }   /* genderless ⚲ */

/* Breeding letter badge (A–F) — shown next to the gender glyph in team / PC /
   trade. Only rendered for mons that have a `letter` (legacy mons have none). */
.tm-letter {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1;
  color: #6d28d9;
  background: #ede9fe;
  border-radius: 5px;
  padding: 2px 5px;
  margin-left: 4px;
  vertical-align: middle;
  flex-shrink: 0;
}

/* Nurse Joy breeding pair-selection list (Step 2.4) */
.npc-breed-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 42vh;
  overflow-y: auto;
  margin-top: 4px;
}
.npc-breed-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: #f8f9fa;
  cursor: pointer;
}
.npc-breed-item.selected { border-color: var(--accent); background: #eef0ff; }
.npc-breed-sprite { width: 40px; height: 40px; image-rendering: pixelated; object-fit: contain; flex-shrink: 0; }
.npc-breed-name { font-size: 14px; font-weight: 700; color: #1a1a2e; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.npc-breed-lvl { font-size: 11px; color: #9ca3af; font-weight: 600; }
.npc-breed-status { font-size: 13px; color: #15803d; margin: 8px 0 0; }
.npc-breed-error { color: #dc2626; }

.tm-card-species {
  font-size: 0.68rem;
  color: #999;
  margin-bottom: 5px;
}

.tm-level {
  color: #3d7dca;
  font-weight: 700;
}

/* HP / Energy bars */
.tm-bars {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tm-bar-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tm-bar-label {
  font-size: 0.58rem;
  font-weight: 700;
  color: #aaa;
  width: 16px;
  flex-shrink: 0;
  text-transform: uppercase;
}

.tm-bar-track {
  flex: 1;
  height: 5px;
  background: #eee;
  border-radius: 3px;
  overflow: hidden;
}

.tm-bar-track.wide {
  height: 7px;
}

.tm-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.hp-high { background: linear-gradient(90deg, #44cc66, #33bb55); }
.hp-mid  { background: linear-gradient(90deg, #ffcc00, #ffaa00); }
.hp-low  { background: linear-gradient(90deg, #ff4444, #cc2222); }
.happy-fill { background: linear-gradient(90deg, #ff9ec0, #ff5e8a); }

/* ── «При победе сейчас: …» — подсказка исхода эволюции по дружбе ──
   Показывается только у Иви с дружбой >= 220 (три исхода: Эспеон / Умбреон /
   Сильвеон). ТОЛЬКО ПОКАЗ — эволюцию решает сервер. */
.tm-pending-evo {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.72);
}
.tm-pending-evo b { color: #ff9ec0; font-weight: 700; }
.tm-pending-evo-why { color: rgba(255, 255, 255, 0.45); }

.tm-bar-label.tm-bar-heart {
  color: #ff5e8a;
  font-size: 0.72rem;
  text-transform: none;
  line-height: 1;
}

.tm-bar-val {
  font-size: 0.58rem;
  color: #aaa;
  font-weight: 600;
  width: 28px;
  text-align: right;
  flex-shrink: 0;
}

/* ── Detail panel ── */
.tm-detail-panel {
  flex: 1;
  border-left: 1px solid #dddcd8;
  background: #faf9f6;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tm-detail-panel::-webkit-scrollbar { width: 4px; }
.tm-detail-panel::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

.tm-detail-empty,
.tm-loading {
  margin: auto;
  color: #bbb;
  font-size: 0.82rem;
  font-weight: 500;
  text-align: center;
}

.tm-detail-header {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.tm-detail-sprite {
  width: 80px;
  height: 80px;
  image-rendering: pixelated;
  object-fit: contain;
  background: linear-gradient(160deg, #f0eeea, #e8e5df);
  border-radius: 12px;
  border: 1px solid #e0deda;
  flex-shrink: 0;
}

.tm-detail-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tm-detail-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: #1a1a1a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tm-held-item-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.25));
  vertical-align: middle;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
}
.tm-held-item-icon:hover {
  opacity: 0.75;
  transform: scale(0.95);
}
.tm-held-item-emoji {
  font-size: 1.2rem;
  line-height: 1;
}

.tm-detail-species {
  font-size: 0.78rem;
  color: #888;
}

.tm-detail-ability {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tm-ability-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  font-weight: 700;
  color: #aaa;
  letter-spacing: 0.5px;
}

.tm-ability-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: #555;
  background: rgba(0,0,0,0.05);
  padding: 2px 7px;
  border-radius: 5px;
}

.tm-detail-hp-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.tm-section-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #aaa;
  margin-bottom: -4px;
}

/* Moves */
.tm-moves {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tm-move {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(var(--mc-rgb, 61,125,202), 0.1);
  color: var(--mc);
  border: 1px solid var(--mc);
  opacity: 0.85;
}

/* Stats */
.tm-stats {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.tm-stat-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tm-stat-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: #999;
  width: 72px;
  flex-shrink: 0;
}

.tm-stat-track {
  width: 100px;
  flex-shrink: 0;
  height: 5px;
  background: #eee;
  border-radius: 3px;
  overflow: hidden;
}

.tm-stat-fill {
  height: 100%;
  background: linear-gradient(90deg, #3d7dca, #6a5acd);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.tm-stat-val {
  font-size: 0.72rem;
  font-weight: 700;
  color: #555;
  width: 28px;
  text-align: right;
  flex-shrink: 0;
}

.tm-nat-up   { color: #2e7d32; font-weight: 700; }
.tm-nat-down { color: #e53935; font-weight: 700; }

/* ── «Набор тренировок»: значок у прокачанного стата ──────────────────────
   Пришёл на смену подписи под блоком статов: она стояла В СТОРОНЕ от строки, к
   которой относилась, и на шести статах приходилось искать глазами, какой прокачан.

   Ступени 1–5 — гантель, цвет растёт вместе со ступенью. Ступень 6 (+40%, потолок) —
   ЗОЛОТАЯ КОРОНА: конец лестницы отличается не оттенком, а самим предметом.

   ⚠️ Цвет задаётся ОДНОЙ переменной на строку и достаётся и значку, и числу — иначе
   они разъехались бы при первой же правке палитры.
   ⚠️ Тона СВОИ, не природные (`.tm-nat-up` зелёный, `.tm-nat-down` красный): природа
   и тренировка — разные причины «стат не как у всех», и общий цвет сделал бы показ
   неразличимым. Зелёная ступень 15% намеренно ХОЛОДНЕЕ природного зелёного. */
/* ⚠️ Переменная объявлена И на строке статов, И на САМОМ значке: в карточке
   команды/ПК значок стоит в строке имени, где строки-родителя с классом ступени
   нет — без второго селектора он остался бы серым по умолчанию. */
.tm-stat-row.trained,
.mev-row.trained            { --train-color: #8b95a5; }
.tm-stat-row.lvl-1, .mev-row.lvl-1, .tm-train-badge.lvl-1 { --train-color: #8b95a5; }  /*  +9% — серый  */
.tm-stat-row.lvl-2, .mev-row.lvl-2, .tm-train-badge.lvl-2 { --train-color: #12946a; }  /* +15% — зелёный */
.tm-stat-row.lvl-3, .mev-row.lvl-3, .tm-train-badge.lvl-3 { --train-color: #1565c0; }  /* +22% — синий  */
.tm-stat-row.lvl-4, .mev-row.lvl-4, .tm-train-badge.lvl-4 { --train-color: #7b3fbf; }  /* +29% — фиолет */
.tm-stat-row.lvl-5, .mev-row.lvl-5, .tm-train-badge.lvl-5 { --train-color: #e2711d; }  /* +35% — оранж  */
.tm-stat-row.lvl-6, .mev-row.lvl-6, .tm-train-badge.lvl-6 { --train-color: #d4a017; }  /* +40% — золото */

.tm-stat-trained {
  color: var(--train-color, #1565c0);
  text-shadow: 0 0 6px color-mix(in srgb, var(--train-color, #1565c0) 35%, transparent);
}

/* ⚠️ Значок стоит В КОНЦЕ строки, ПОСЛЕ бейджей IV/EV, а не после названия стата.
   Встав в середину, он раздвигал строку: шкала EV укорачивалась, и числа одной
   строки переставали выравниваться с соседними — прокачанный стат выглядел
   «съехавшим», а не отмеченным. */
.tm-train-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;               /* строка статов тесная — значок не должен сжиматься */
  margin-left: 4px;
  color: var(--train-color, #1565c0);
  cursor: help;
  outline: none;
}
.tm-train-badge svg,
.tm-train-badge img { width: 100%; height: 100%; display: block; }
/* Корона потолка — рисованный арт, а не контур: ей нужен размер побольше (иначе
   самоцветы сливаются) и свечение, чтобы читалась как награда, а не как шестой
   оттенок гантели. `object-fit` — на случай неквадратной замены арта. */
.tm-train-badge.is-max {
  width: 19px;
  height: 19px;
  filter: drop-shadow(0 0 3px rgba(212, 160, 23, 0.65));
}
.tm-train-badge.is-max img { object-fit: contain; }

/* В карточке команды/ПК значок стоит среди пола и буквы спарки — там он обязан быть
   мельче, чем в строке статов, иначе перебивает имя покемона.
   ⚠️ Подсказка здесь центрируется обратно: значок стоит в НАЧАЛЕ карточки, и
   прижатая вправо подсказка уехала бы за её левый край. */
.tm-card-name .tm-train-badge,
.pc-card-name .tm-train-badge,
.pc-card-name-sm .tm-train-badge,
.mob-poke-name .tm-train-badge {
  width: 14px;
  height: 14px;
  margin-left: 2px;
  vertical-align: -2px;
}
.tm-card-name .tm-train-badge.is-max,
.pc-card-name .tm-train-badge.is-max,
.pc-card-name-sm .tm-train-badge.is-max,
.mob-poke-name .tm-train-badge.is-max { width: 16px; height: 16px; }
.tm-card-name .tm-train-badge::after,
.pc-card-name .tm-train-badge::after,
.pc-card-name-sm .tm-train-badge::after,
.mob-poke-name .tm-train-badge::after { right: auto; left: 50%; transform: translateX(-50%); }

/* ⚠️ В мобильном редакторе EV значок стоит СРАЗУ ПОСЛЕ названия стата, а не в конце
   строки: справа там счётчик «252/252», и на узком экране конец строки уезжает под
   край карточки — значок оказывался за обрезом. Слайдер живёт отдельной строкой
   ниже, поэтому в шапке значок ничего не раздвигает. */
.mev-row-head .tm-train-badge { margin-left: 4px; margin-right: 2px; }
.mev-row-head .tm-train-badge::after { right: auto; left: 0; transform: none; }

/* ── Значок на боевой плашке ──────────────────────────────────────────────
   Плашка тёмная, поэтому значок здесь светлее и с обводкой-свечением, иначе серая
   ступень (+9%) тонет в фоне.
   ⚠️ У СОПЕРНИКА подсказка не называет стат — сервер его и не присылает: знать, что
   противник прокачан, часть боя, знать КУДА — разведка чужой команды даром. */
.bt-train { display: inline-flex; align-items: center; vertical-align: -2px; }
.bt-train .tm-train-badge {
  width: 15px;
  height: 15px;
  margin-left: 3px;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.55));
}
.bt-train .tm-train-badge.lvl-1 { --train-color: #c3cbd8; }   /* на тёмном сером не видно */
.bt-train .tm-train-badge.is-max { width: 17px; height: 17px; }
/* ⚠️ Подсказка на плашке идёт ВВЕРХ, хотя над плашкой сцена боя. Вниз она уходить
   не может: там полоса HP того же покемона, и подсказка накрывала бы «660/660» —
   то есть прятала бы данные боя ради данных о тренировке. Сверху же она перекрывает
   только фон, и лишь пока курсор на значке. */
.bt-train .tm-train-badge::after {
  bottom: calc(100% + 6px);
  top: auto;
  right: auto;
  left: 50%;
  transform: translateX(-50%);
}

/* Подсказка. ⚠️ Показывается и по НАВЕДЕНИЮ, и по ФОКУСУ: фокус — единственный
   способ вызвать её пальцем (значок несёт tabindex). Без этого на телефоне значок
   молчал бы, и проценты за ним остались бы неизвестными. */
/* ⚠️ Подсказка прижата ПРАВЫМ краем, а не центрирована: значок стоит у самой
   границы карточки, и центрированная подсказка уезжала бы за её край. */
.tm-train-badge::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  right: -2px;
  padding: 5px 9px;
  border-radius: 8px;
  background: rgba(26, 26, 46, 0.95);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  letter-spacing: 0.01em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
  z-index: 40;
}
.tm-train-badge:hover::after,
.tm-train-badge:focus::after,
.tm-train-badge:focus-visible::after { opacity: 1; }

.tm-iv-badge,
.tm-ev-stat-badge {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  background: #f0f0f0;
  color: #999;
  flex-shrink: 0;
  white-space: nowrap;
}
.tm-ev-stat-badge.ev-has-value {
  background: #E3F2FD;
  color: #1565C0;
}


/* EXP bar */
.tm-exp-section {
  margin-top: 10px;
}
.tm-exp-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}
.tm-exp-label {
  font-size: 0.62rem;
  font-weight: 700;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tm-exp-nums {
  font-size: 0.62rem;
  color: #aaa;
}
.tm-exp-track {
  width: 100%;
  height: 6px;
  background: #eee;
  border-radius: 3px;
  overflow: hidden;
}
.tm-exp-fill {
  height: 100%;
  background: linear-gradient(90deg, #66BB6A, #43A047);
  border-radius: 3px;
  transition: width 0.4s ease;
}
.tm-max-level-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(90deg, #F9A825, #F57F17);
  padding: 2px 8px;
  border-radius: 8px;
  letter-spacing: 0.04em;
  margin-top: 10px;
}

/* Action buttons */
.tm-detail-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 4px;
}

.tm-action-btn {
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid #ddd;
  background: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tm-action-btn:hover {
  background: #f0f0f0;
  border-color: #bbb;
}

.tm-action-btn.primary {
  background: #3d7dca;
  border-color: #3d7dca;
  color: #fff;
}

.tm-action-btn.primary:hover {
  background: #2d6db8;
}

.tm-active-notice {
  font-size: 0.78rem;
  font-weight: 700;
  color: #3d7dca;
}

/* ══════════════════════════════════════════
   BATTLE MODAL
══════════════════════════════════════════ */

.battle-modal {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 780px;
  max-width: 96vw;
  height: 90vh;
  max-height: 900px;
  background: #1a1a2e;
  border-radius: 20px;
  box-shadow: 0 24px 72px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.06);
  overflow: visible;
  transform: scale(0.93) translateY(14px);
  transition: transform 0.28s cubic-bezier(0.34,1.46,0.64,1);
}
.battle-modal > .pm-close {
  position: absolute;
  top: 14px;
  right: -48px;
  z-index: 20;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-overlay.open .battle-modal {
  transform: scale(1) translateY(0);
}

/* Field */
.bt-field {
  flex: 1;
  position: relative;
  min-width: 0;
  background:
    linear-gradient(180deg, #16213e 0%, #0f3460 55%, #533483 100%);
  background-size: cover;
  background-position: center;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 24px 12px;
  overflow: hidden;
}

/* Grass hint at bottom */
.bt-field::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 28px;
  background: linear-gradient(180deg, transparent, rgba(60,160,60,0.35));
  pointer-events: none;
}

/* Each side row */
.bt-side {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  position: relative;
}

.bt-enemy {
  flex-direction: row;
  align-self: flex-end;
  margin-top: 50px;
}

.bt-player {
  flex-direction: row;
  align-self: flex-start;
}

/* Battle sprites are normalized by HEIGHT (not a fixed box): PS pixel-art has
   wildly different native dimensions, so a fixed width/height box + object-fit
   made wide sprites (Charizard) render short and tall ones (Seadra) render big.
   Fixed height + width:auto gives every species the same on-screen height (and
   upscales small mons like Pichu). object-fit:contain is kept so the rare ultra-
   wide sprite that hits max-width is letterboxed, not distorted. */
.bt-sprite {
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  image-rendering: crisp-edges;   /* fallback */
  image-rendering: pixelated;     /* keep pixel art sharp when scaled */
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
}

/* Heights are a PRE-JS fallback only — battleUI.spriteHeightPx() sets a
   per-species inline height (proportional to canonical size). Must NOT be
   !important or the inline scale can't win. max-width caps very wide sprites
   (object-fit:contain letterboxes them, no distortion). */
.bt-sprite-player {
  height: 126px;
  max-width: 210px;
}

.bt-sprite-enemy {
  height: 112px;     /* slightly smaller — back-of-field perspective */
  max-width: 188px;
}

/* Shiny: small "шайни" label above the name + gold name + golden sprite glow. */
.bt-shiny {
  display: block;
  align-self: flex-start;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: lowercase;
  color: #ffd24a;
  text-shadow: 0 1px 2px rgba(0,0,0,0.65);
  line-height: 1;
  margin-bottom: 3px;
}
.bt-shiny:empty { display: none; }
/* Gold name when shiny — !important to beat `.bt-pokemon-info .bt-name` and the
   mobile `.bt-name { color:#fff !important }`. */
.bt-name.bt-name-shiny { color: #ffd24a !important; text-shadow: 0 1px 3px rgba(0,0,0,0.55); }
/* «Окрас Хоэнна» на боевой площадке — пара к .bt-name-shiny/.bt-sprite-shiny.
   Тот же золотой, своя подпись (её текст ставит renderShiny). Отдельные классы —
   по той же причине, что у карточек команды. */
.bt-name.bt-name-hoenn { color: #ffd24a !important; text-shadow: 0 1px 3px rgba(0,0,0,0.55); }
.bt-sprite-hoenn {
  filter:
    drop-shadow(0 0 7px rgba(255,233,120,1))
    drop-shadow(0 0 18px rgba(255,205,50,0.9))
    drop-shadow(0 4px 8px rgba(0,0,0,0.5));
}
.bt-sprite-shiny {
  /* Strong static gold halo + base grounding shadow. Kept STATIC (no filter
     animation) on purpose: the hit-flash sets an inline `filter`, and a running
     filter-animation here would fight it in the cascade. Static means the flash
     can compose the halo in (battleAnims.flashHit) and hand control back via
     filter:'' — so the glow never drops out during a hit. */
  filter:
    drop-shadow(0 0 7px rgba(255,233,120,1))
    drop-shadow(0 0 18px rgba(255,205,50,0.9))
    drop-shadow(0 4px 8px rgba(0,0,0,0.5));
}

/* Protect shield — a translucent HORIZONTAL barrier PANEL (w > h) HELD in FRONT of the
   mon's body while Protect (or Detect / King's Shield / Spiky Shield / Baneful Bunker /
   Obstruct / Silk Trap / Burning Bulwark) is up. Spawned by fxScene.showPersistentNode
   (a <div>, not a sprite); the node carries `turnstatus-protect fx-persistent` and is
   sized/placed inline by the fx projection — only the LOOK lives here. NODE_Z_INDEX (45)
   stacks it OVER the sprite, so the panel sits in FRONT of the mon. Node opacity is 0.8
   (the rim/glow stays crisp); the SEE-THROUGH centre is baked into the gradient alphas
   below, so the mon shows through. Appears on |-singleturn| (reveal below), flashes on
   |-activate| (battleAnims.flashProtect runs a WAAPI brightness/opacity pulse on the
   live node), removed on |turn| (no |-end|: Protect is duration:1 and expires
   silently). Tune brightness via opacity in PERSISTENT_MON_FX.protect + the alphas
   below. */
.turnstatus-protect {
  border-radius: 10px;          /* rounded-rectangle barrier PANEL (not a ring/frame) */
  background:
    radial-gradient(ellipse at 50% 45%,
      rgba(190, 238, 255, 0.16) 0%,    /* see-through CENTRE → the mon shows through */
      rgba(130, 205, 255, 0.26) 60%,
      rgba(150, 220, 255, 0.42) 100%); /* brighter toward the edges (force-field rim) */
  border: 1.5px solid rgba(215, 246, 255, 0.85);
  box-shadow:
    0 0 18px rgba(140, 212, 255, 0.6),
    inset 0 0 20px rgba(190, 235, 255, 0.4);
  transform-origin: 50% 50%;
  animation: protectReveal 300ms cubic-bezier(.2,.7,.3,1);
}

/* Quiet appearance (|-singleturn|): the barrier sweeps OPEN horizontally (scaleX) and
   fades in — a panel projecting in front of the mon. showPersistentNode is static, so
   the reveal is pure CSS. Opacity is omitted at 100% on purpose → it lands on the
   node's own inline opacity (0.8), so there is no pop when the animation ends. */
@keyframes protectReveal {
  from { opacity: 0; transform: scaleX(0.4); }
  to   {             transform: scaleX(1); }
}

/* Side SCREENS — translucent BARRIER PANELS in front of a whole SIDE (Reflect / Light
   Screen / Aurora Veil / Safeguard / Mist). Same CSS-div primitive as the Protect
   shield (fxScene.showPersistentNode), but WIDER (covers the side, not one mon) and
   anchored to the side. Spawned/removed by battleAnims.createScreen/removeScreen off the
   |-sidestart|/|-sideend| protocol; persistent until -sideend (no per-turn logic). Node
   inline opacity is 0.7 (rim/glow crisp); the SEE-THROUGH tint is in the gradient alphas
   (~0.20–0.34) so the mon/side stays visible. Shared geometry + reveal here; colour per
   screen below. */
.sidecondition-reflect,
.sidecondition-lightscreen,
.sidecondition-auroraveil,
.sidecondition-safeguard,
.sidecondition-mist {
  border-radius: 12px;
  animation: screenReveal 320ms ease-out;
}
/* Appearance: a soft fade-in. Opacity ONLY — the per-screen stack offset is an inline
   transform: translateY (set in battleAnims.createScreen), so the keyframes must NOT
   touch transform or they'd wipe the stack. Opacity omitted at 100% → lands on the
   node's inline opacity (0.7), so there is no pop when the animation ends. */
@keyframes screenReveal {
  from { opacity: 0; }
}
.sidecondition-reflect {        /* blue — physical defence */
  background: linear-gradient(180deg, rgba(150,200,255,0.30), rgba(90,150,255,0.18) 50%, rgba(120,180,255,0.30));
  border: 1.5px solid rgba(185,222,255,0.8);
  box-shadow: 0 0 18px rgba(110,170,255,0.5), inset 0 0 24px rgba(150,200,255,0.35);
}
.sidecondition-lightscreen {    /* gold — special defence */
  background: linear-gradient(180deg, rgba(255,236,150,0.30), rgba(255,210,80,0.18) 50%, rgba(255,226,120,0.30));
  border: 1.5px solid rgba(255,240,185,0.8);
  box-shadow: 0 0 18px rgba(255,210,90,0.5), inset 0 0 24px rgba(255,236,150,0.35);
}
.sidecondition-auroraveil {     /* iridescent — white/blue rainbow */
  background: linear-gradient(120deg, rgba(255,180,220,0.26), rgba(180,230,255,0.24) 35%, rgba(200,255,210,0.24) 65%, rgba(230,200,255,0.28));
  border: 1.5px solid rgba(238,242,255,0.85);
  box-shadow: 0 0 20px rgba(200,220,255,0.55), inset 0 0 24px rgba(236,236,255,0.4);
}
.sidecondition-safeguard {      /* green — status guard */
  background: linear-gradient(180deg, rgba(170,255,180,0.30), rgba(90,220,120,0.18) 50%, rgba(140,240,160,0.30));
  border: 1.5px solid rgba(200,255,212,0.8);
  box-shadow: 0 0 18px rgba(110,225,140,0.5), inset 0 0 24px rgba(170,255,185,0.35);
}
.sidecondition-mist {           /* pale/misty — stat-drop guard */
  background: linear-gradient(180deg, rgba(236,246,250,0.34), rgba(208,224,234,0.22) 50%, rgba(230,240,248,0.34));
  border: 1.5px solid rgba(246,250,255,0.85);
  box-shadow: 0 0 18px rgba(220,232,242,0.55), inset 0 0 24px rgba(240,246,250,0.4);
}

/* "Раунд N" capsule — top-centre of the scene (Showdown round counter) */
/* Page-level chip while a battle is being requested (modal not yet open) */
.pre-battle-chip {
  position: fixed; bottom: 90px; left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  background: rgba(20, 25, 35, 0.88); color: #fff;
  padding: 10px 18px; border-radius: 50px;
  font-size: 13.5px; font-weight: 600;
  z-index: 12500; pointer-events: none;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
}

/* Pre-battle loading chip (shown until the first |switch| data arrives) */
.bt-loading {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 10px;
  background: rgba(20, 25, 35, 0.85); color: #fff;
  padding: 12px 20px; border-radius: 14px;
  font-size: 14px; font-weight: 600;
  z-index: 5; pointer-events: none;
}
.bt-loading-spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  animation: btspin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes btspin { to { transform: rotate(360deg); } }

.bt-round-badge {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  background: rgba(255,255,255,0.92);
  color: #1a1a2e;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.3px;
  padding: 4px 14px;
  border-radius: 12px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.35);
  pointer-events: none;
}

/* Pokemon info box */
/* ── HP info card — Pokémon X/Y / ORAS style (skewed parallelogram + tail) ── */
.bt-pokemon-info {
  position: relative;
  background: rgba(20, 20, 30, 0.94);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  padding: 7px 16px;
  min-width: 140px;
  /* 🔴 backdrop-filter здесь НЕ КОСМЕТИКА, А ЦЕНА ЗА КАДР: карточка висит над сценой,
     которая в бою двигается каждый кадр (спрайты, отдача, эффекты), поэтому размытие
     фона пересчитывалось на КАЖДОМ кадре — на телефонах это и был лаг боя. Убрано в
     пользу плотного фона: 0.85 → 0.94, читаемость без размытия та же.
     ⚠️ Плотность обязана совпадать с хвостиком `::after` — иначе стык виден. */
  box-shadow: 0 6px 18px rgba(0,0,0,0.45);
}
/* Skew the card; counter-skew the content so text/bars stay upright */
.bt-enemy  .bt-pokemon-info { transform: skewX(-11deg); }
.bt-player .bt-pokemon-info { transform: skewX(11deg); }
.bt-enemy  .bt-pokemon-info > * { transform: skewX(11deg); }
.bt-player .bt-pokemon-info > * { transform: skewX(-11deg); }

/* Diagonal tail pointing toward the sprite (enemy → right, own → left) */
.bt-pokemon-info::after {
  content: '';
  position: absolute;
  bottom: -7px;
  width: 0; height: 0;
  border-style: solid;
}
.bt-enemy  .bt-pokemon-info::after {
  right: 20px;
  border-width: 9px 12px 0 0;
  border-color: rgba(20,20,30,0.94) transparent transparent transparent;
}
.bt-player .bt-pokemon-info::after {
  left: 20px;
  border-width: 9px 0 0 12px;
  border-color: rgba(20,20,30,0.94) transparent transparent transparent;
}

/* Typography */
.bt-pokemon-info .bt-name  { font-size: 0.98rem; font-weight: 800; color: #fff; }
.bt-pokemon-info .bt-level { font-size: 0.78rem; font-weight: 600; color: #dfe3ee; }
.bt-pokemon-info .bt-hp-track { height: 9px; }
.bt-pokemon-info .bt-hp-val {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.72rem; color: #aab2c8; width: auto;
}
/* HP numbers are shown for BOTH sides (own absolute, opponent absolute in
   solo / percent "X/100" in PvP). */

.bt-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.bt-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
}

/* Пол дикого соперника (♂/♀/⚲). Цвета — общие .gender-m/.gender-f/.gender-n. */
.bt-gender {
  font-size: 0.82rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* Уровень покемона — виден всегда у обеих сторон. */
.bt-level {
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(255,255,255,0.72);
  flex-shrink: 0;
}

/* ── Battle animation keyframes (generic) ── */
@keyframes battleShake {
  0%   { transform: translateX(0); }
  20%  { transform: translateX(-8px); }
  40%  { transform: translateX(8px); }
  60%  { transform: translateX(-6px); }
  80%  { transform: translateX(6px); }
  100% { transform: translateX(0); }
}
@keyframes battleFlash {
  0%   { opacity: 1; }
  50%  { opacity: 0.2; }
  100% { opacity: 1; }
}
@keyframes battleHitmark {
  0%   { transform: scale(0.3) rotate(0deg);    opacity: 0.9; }
  60%  { transform: scale(1.4) rotate(45deg);   opacity: 1;   }
  100% { transform: scale(1.8) rotate(90deg);   opacity: 0;   }
}
.battle-effect-shadowball {
  background: url('/assets/battle/shadowball.png') center/contain no-repeat;
  filter: drop-shadow(0 0 10px rgba(180,100,255,0.85));
}

.battle-effect-hitmark {
  position: absolute;
  width: 60px;
  height: 60px;
  pointer-events: none;
  z-index: 60;
  background:
    radial-gradient(circle, rgba(255,255,255,0.95) 0%, rgba(255,220,80,0.7) 35%, rgba(255,120,0,0) 70%);
  border-radius: 50%;
  filter: drop-shadow(0 0 8px rgba(255,200,80,0.9));
  animation: battleHitmark 300ms ease-out forwards;
}

/* ── Battle move effects (sword slash etc.) ── */
.battle-effect-sword {
  position: absolute;
  width: 72px;
  height: 72px;
  background: url('/assets/battle/sword.png') center/contain no-repeat;
  filter: drop-shadow(0 0 6px rgba(255,255,255,0.9));
  pointer-events: none;
  z-index: 100;
}
@keyframes swordSlashRight {
  0%   { transform: translateX(0px)   scale(0.6) rotate(-30deg); opacity: 0; }
  30%  { transform: translateX(30px)  scale(1.2) rotate(0deg);   opacity: 1; }
  100% { transform: translateX(110px) scale(1.4) rotate(40deg);  opacity: 0; }
}
@keyframes swordSlashLeft {
  0%   { transform: translateX(0px)    scale(0.6) rotate(30deg);  opacity: 0; }
  30%  { transform: translateX(-30px)  scale(1.2) rotate(0deg);   opacity: 1; }
  100% { transform: translateX(-110px) scale(1.4) rotate(-40deg); opacity: 0; }
}
@keyframes swordSlashRightBack {
  0%   { transform: translateX(0px)   scale(0.6) scaleX(-1) rotate(30deg);  opacity: 0; }
  30%  { transform: translateX(30px)  scale(1.2) scaleX(-1) rotate(0deg);   opacity: 1; }
  100% { transform: translateX(110px) scale(1.4) scaleX(-1) rotate(-40deg); opacity: 0; }
}
@keyframes swordSlashLeftBack {
  0%   { transform: translateX(0px)    scale(0.6) scaleX(-1) rotate(-30deg); opacity: 0; }
  30%  { transform: translateX(-30px)  scale(1.2) scaleX(-1) rotate(0deg);   opacity: 1; }
  100% { transform: translateX(-110px) scale(1.4) scaleX(-1) rotate(40deg);  opacity: 0; }
}

/* ── Field hazard overlay — positioned at bottom of each .bt-side ── */
.bt-field-hazards {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  pointer-events: none;
  z-index: 2;
}

/* «Приманка» (Substitute): покемон спрятан, на его месте кукла (BattleAnims,
   showSubstituteDoll). visibility, а не display — коробка спрайта держит раскладку,
   и по ней же ставится кукла. */
.bt-sprite.bt-sprite-subbed { visibility: hidden; }
.bt-sub-doll {
  position: absolute;
  width: auto;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 1;
  image-rendering: pixelated;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
}

/* Individual hazard sprite image */
.bt-hazard-sprite {
  position: absolute;
  image-rendering: pixelated;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.6));
  opacity: 0.9;
  animation: hazardLand 0.4s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

@keyframes hazardLand {
  0%   { transform: translateY(-40px) scale(0.4) rotate(-15deg); opacity: 0; }
  70%  { transform: translateY(4px)   scale(1.1) rotate(3deg);   opacity: 1; }
  100% { transform: translateY(0)     scale(1)   rotate(0deg);   opacity: 0.9; }
}

.bt-stat-boosts {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-bottom: 3px;
  min-height: 0;
}

.bt-boost-badge {
  font-size: 0.58rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.3px;
}

.boost-up   { background: #22aa55; color: #fff; }
.boost-down { background: #cc3333; color: #fff; }

.bt-status-badge {
  font-size: 0.58rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  display: none;
}

.bt-status-badge.visible { display: inline-block; }

.status-par { background: #c8a000; color: #fff; }
.status-brn { background: #d04010; color: #fff; }
.status-tox { background: #8030a0; color: #fff; }
.status-psn { background: #a040a0; color: #fff; }
.status-slp { background: #607080; color: #fff; }
.status-frz { background: #4898c0; color: #fff; }

/* Item-uses-this-battle counter (e.g. "1/2"), shown only when > 0 */
.bt-item-uses {
  display: inline-block;
  font-size: 0.58rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.4px;
  background: rgba(var(--accent-rgb), 0.85);
  color: #fff;
  white-space: nowrap;
}
.bt-item-uses::before { content: '🎒 '; font-size: 0.7em; }

/* Держимый предмет СВОЕГО активного покемона. Соперника такого бейджа нет и быть
   не может — его предмет клиенту не приходит вовсе (приватный PS-стрим). */
.bt-held-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 130px;
  font-size: 0.58rem;
  font-weight: 800;
  padding: 1px 6px 1px 3px;
  border-radius: 3px;
  background: rgba(26, 138, 60, 0.85);
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bt-held-badge-icon { width: 13px; height: 13px; object-fit: contain; flex-shrink: 0; }
.bt-held-badge-emoji { font-size: 0.8em; line-height: 1; }
.bt-held-badge-name { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) {
  .bt-held-badge { max-width: 92px; }
}

/* ── Volatile-статусы (Насмешка, Спутанность, …) ─────────────────────────────
   Свой ряд под именем, а не внутри .bt-name-row: там уже имя/уровень/пол/статус/
   держимое, и несколько volatile переполнили бы карточку на узком экране.
   Пустой ряд схлопывается в ноль (нет детей → gap не применяется, высоты нет),
   поэтому на карточке без статусов ничего не меняется. */
.bt-volatile-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
}
/* Без бейджей ряда нет вовсе — иначе он оставлял бы отступ на каждой карточке,
   а карточка без статусов должна выглядеть ровно как до этой правки. */
.bt-volatile-row:empty { display: none; }

/* Форма — как у major-бейджа (.bt-status-badge), чтобы читались одним рядом
   понятий. Отличие намеренное: major залит цветом, volatile — контурный, так
   major остаётся главным и не теряется среди временных эффектов. */
.bt-volatile-badge {
  font-size: 0.54rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  white-space: nowrap;
  color: #fff;
  background: rgba(20, 22, 30, 0.55);
  border: 1px solid currentColor;
}

/* Цвет несёт смысл: красный — тебе запретили ход, синий — тебя обманывают,
   зелёный — из тебя тянут, серый — отложенная угроза. */
.vol-taunt      { color: #ff7a5c; }   /* нельзя статусные ходы     */
.vol-torment    { color: #ff9a6b; }   /* нельзя повторять ход      */
.vol-disable    { color: #ffb057; }   /* конкретный ход выключен   */
.vol-encore     { color: #ffd166; }   /* заперт на последнем ходе  */
.vol-confusion  { color: #b78bff; }   /* может ударить себя        */
.vol-leechseed  { color: #6fd18a; }   /* утечка здоровья           */
.vol-substitute { color: #8fd0e8; }   /* урон уходит в двойника    */
.vol-yawn       { color: #a8b3c4; }   /* уснёт в конце хода        */
.vol-saltcure   { color: #f0e6c8; }   /* соль: урон каждый ход     */

/* Switch slot status badge */
.bt-switch-status {
  font-size: 0.52rem;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 2px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  margin-top: 1px;
}

.bt-hp-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bt-hp-track {
  flex: 1;
  height: 7px;
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
  overflow: hidden;
}

.bt-hp-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.bt-hp-val {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.55);
  font-weight: 600;
  width: 40px;
  text-align: right;
  flex-shrink: 0;
}

/* Bottom panel */
.bt-bottom {
  flex: 1 1 0;
  background: #f5f4f0;
  border-top: 2px solid #dddcd8;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* Battle log — fills all remaining space */
.bt-log {
  /* Свежие ходы вставляются СВЕРХУ, а браузерное scroll anchoring на такой вставке
     само подкручивает scrollTop, чтобы «удержать картинку» — и уводит игрока от
     нового хода. Выключаем, позицией управляет stickLogToTop. */
  overflow-anchor: none;
  flex: 1 1 0;
  min-height: 48px;
  max-height: none;
  padding: 4px 0 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: #fff;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.15) transparent;
}

.bt-log::-webkit-scrollbar { width: 4px; }
.bt-log::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

/* Turn header — PS style: large bold + bottom separator, no bg */
.bt-log-turn {
  font-size: 0.82rem;
  font-weight: 800;
  color: #333;
  background: transparent;
  padding: 8px 10px 3px;
  margin: 0;
  border-bottom: 1px solid #d0d0d0;
  letter-spacing: 0;
  text-transform: none;
}
/* Блок одного хода. Лог — флекс-колонка, блоки её элементы; внутри блока строки
   идут сверху вниз (причина выше следствия), а сами блоки кладутся новым НАВЕРХ. */
.bt-log-block { display: flex; flex-direction: column; }
/* Верхний (самый свежий) блок не должен начинаться с большого отступа — раньше это
   же делало правило .bt-log-turn:first-child, пока лог был плоским. */
.bt-log > .bt-log-block:first-child > .bt-log-turn { padding-top: 4px; }

/* Generic event line */
.bt-log-line {
  font-size: 0.71rem;
  color: #222;
  line-height: 1.5;
  padding: 1px 10px;
}

/* Coloured event variants */
/* Иконка покемона перед именем (battleUI.logMonIcon). Файлы dex — 120×120 с полями,
   поэтому коробка чуть больше строки, а отрицательные поля не дают ей раздувать
   межстрочный интервал. */
.bt-log .bt-log-mon {
  width: 24px;
  height: 24px;
  margin: -6px 1px -6px -2px;
  vertical-align: middle;
  object-fit: contain;
  image-rendering: pixelated;
}
.bt-log-damage   { color: #880000; }
.bt-log-heal     { color: #006622; }
.bt-log-status   { color: #7a2d8a; }
.bt-log-hazard   { color: #7a5500; }
.bt-log-faint    { color: #555; font-style: italic; }
.bt-log-switch   { color: #224; }
.bt-log-super    { color: #c44800; font-weight: 700; }
.bt-log-crit     { color: #c44800; font-weight: 700; }
.bt-log-resisted { color: #888; font-style: italic; }
.bt-log-result { font-weight: 800; font-size: 0.78rem; color: #222; text-align: center; padding: 5px 10px; border-top: 1px solid #d0d0d0; margin-top: 6px; }
@keyframes levelUpFlash {
  0%   { background: #FFD600; }
  100% { background: linear-gradient(90deg, #FFF9C4, #FFFDE7); }
}
.bt-log-levelup {
  background: linear-gradient(90deg, #FFF9C4, #FFFDE7);
  border-left: 3px solid #F9A825;
  padding-left: 6px;
  font-weight: 700;
  color: #5a3e00;
  animation: levelUpFlash 0.8s ease-out;
}

/* Bottom controls — never shrink (descendant combinator: section/bag/prompt
   now live inside the .bt-controls wrapper, statusbar stays a direct child) */
.bt-bottom .bt-section,
.bt-bottom .bt-bag-btn,
.bt-bottom .bt-prompt-row,
.bt-bottom > .bt-controls,
.bt-bottom > .mob-battle-statusbar {
  flex: 0 0 auto;
}

.bt-bottom .bt-section {
  padding: 4px 12px 6px;
}

/* Controls column wrapper — right column on desktop, stacked on mobile */
.bt-controls { display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.bt-controls-row { display: flex; flex-direction: column; gap: 6px; }

/* Inert placeholder slot padding the 2×2 attack grid — same size as a real
   button, subtle dashed, centred "—", not clickable. */
.bt-move-empty {
  background: rgba(0,0,0,0.03);
  border: 1px dashed rgba(0,0,0,0.14);
  cursor: default;
  pointer-events: none;
  opacity: 0.55;
  justify-content: center;
  align-items: center;
}
.bt-move-empty .bt-move-name { color: #999; }

/* Prompt row */
.bt-prompt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  padding: 6px 12px;
}

.bt-prompt-text {
  font-size: 0.82rem;
  color: #333;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.bt-prompt-text strong { color: #111; font-size: 0.88rem; }
/* Трансляция: вместо «Что сделает…» — кто с кем дерётся (управление зрителю скрыто в JS) */
.bt-spectate-banner { font-size: 0.82rem; font-weight: 700; color: #e53935; }

.bt-hp-badge {
  background: #eee;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  color: #444;
  padding: 1px 7px;
  white-space: nowrap;
}

/* Timer */
.bt-timer {
  font-size: 0.78rem;
  font-weight: 700;
  color: #555;
  border: 1px solid #ccc;
  border-radius: 5px;
  padding: 2px 8px;
  background: #fff;
  white-space: nowrap;
  flex-shrink: 0;
}

.bt-timer.urgent {
  color: #cc0000;
  border-color: #cc0000;
  background: #fff0f0;
}

/* Section label */
.bt-section { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }

.bt-section-label {
  font-size: 0.72rem;
  font-weight: 800;
  font-style: italic;
  color: #993300;
}

/* Move grid — 2×2 (minmax(0,1fr) lets long move names ellipsis, never overflow) */
.bt-move-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 5px;
}

/* PvP "opponent's turn" indicator — fills the cleared move grid (5.4) */
.bt-waiting {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 64px;
  padding: 12px;
  font-size: 0.92rem;
  font-weight: 700;
  color: #5a5a6a;
}
.bt-waiting-dots span {
  display: inline-block;
  animation: bt-dot-pulse 1.4s infinite;
}
.bt-waiting-dots span:nth-child(2) { animation-delay: 0.2s; }
.bt-waiting-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bt-dot-pulse {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30%           { opacity: 1;   transform: translateY(-2px); }
}

/* Subtle type tint on move buttons — bg 10% / border 50%, hover 20% / 80%.
   Tint is a HINT (text stays dark, icon carries the full colour) — NOT the
   old "candy shop" full-saturation fill. Per-type CSS vars drive bg + border. */
.bt-move-grid .bt-move-btn:not(.bt-move-empty) {
  background: var(--type-bg, #fff);
  border: 2px solid var(--type-border, rgba(0,0,0,0.12));
}
.bt-move-grid .bt-move-btn:not(.bt-move-empty):hover:not(:disabled) {
  background: var(--type-bg-h, #f5f5f8);
  border-color: var(--type-border-h, rgba(0,0,0,0.22));
}
.bt-move-btn.type-normal   { --type-bg: rgba(168,168,120,0.10); --type-border: rgba(168,168,120,0.5); --type-bg-h: rgba(168,168,120,0.20); --type-border-h: rgba(168,168,120,0.8); }
.bt-move-btn.type-fire     { --type-bg: rgba(240,128,48,0.10);  --type-border: rgba(240,128,48,0.5);  --type-bg-h: rgba(240,128,48,0.20);  --type-border-h: rgba(240,128,48,0.8); }
.bt-move-btn.type-water    { --type-bg: rgba(104,144,240,0.10); --type-border: rgba(104,144,240,0.5); --type-bg-h: rgba(104,144,240,0.20); --type-border-h: rgba(104,144,240,0.8); }
.bt-move-btn.type-electric { --type-bg: rgba(248,208,48,0.12);  --type-border: rgba(248,208,48,0.5);  --type-bg-h: rgba(248,208,48,0.22);  --type-border-h: rgba(248,208,48,0.8); }
.bt-move-btn.type-grass    { --type-bg: rgba(120,200,80,0.10);  --type-border: rgba(120,200,80,0.5);  --type-bg-h: rgba(120,200,80,0.20);  --type-border-h: rgba(120,200,80,0.8); }
.bt-move-btn.type-ice      { --type-bg: rgba(152,216,216,0.14); --type-border: rgba(152,216,216,0.6); --type-bg-h: rgba(152,216,216,0.24); --type-border-h: rgba(152,216,216,0.9); }
.bt-move-btn.type-fighting { --type-bg: rgba(192,48,40,0.10);   --type-border: rgba(192,48,40,0.5);   --type-bg-h: rgba(192,48,40,0.20);   --type-border-h: rgba(192,48,40,0.8); }
.bt-move-btn.type-poison   { --type-bg: rgba(160,64,160,0.10);  --type-border: rgba(160,64,160,0.5);  --type-bg-h: rgba(160,64,160,0.20);  --type-border-h: rgba(160,64,160,0.8); }
.bt-move-btn.type-ground   { --type-bg: rgba(224,192,104,0.12); --type-border: rgba(224,192,104,0.5); --type-bg-h: rgba(224,192,104,0.22); --type-border-h: rgba(224,192,104,0.8); }
.bt-move-btn.type-flying   { --type-bg: rgba(168,144,240,0.10); --type-border: rgba(168,144,240,0.5); --type-bg-h: rgba(168,144,240,0.20); --type-border-h: rgba(168,144,240,0.8); }
.bt-move-btn.type-psychic  { --type-bg: rgba(248,88,136,0.10);  --type-border: rgba(248,88,136,0.5);  --type-bg-h: rgba(248,88,136,0.20);  --type-border-h: rgba(248,88,136,0.8); }
.bt-move-btn.type-bug      { --type-bg: rgba(168,184,32,0.12);  --type-border: rgba(168,184,32,0.5);  --type-bg-h: rgba(168,184,32,0.22);  --type-border-h: rgba(168,184,32,0.8); }
.bt-move-btn.type-rock     { --type-bg: rgba(184,160,56,0.12);  --type-border: rgba(184,160,56,0.5);  --type-bg-h: rgba(184,160,56,0.22);  --type-border-h: rgba(184,160,56,0.8); }
.bt-move-btn.type-ghost    { --type-bg: rgba(112,88,152,0.10);  --type-border: rgba(112,88,152,0.5);  --type-bg-h: rgba(112,88,152,0.20);  --type-border-h: rgba(112,88,152,0.8); }
.bt-move-btn.type-dragon   { --type-bg: rgba(112,56,248,0.10);  --type-border: rgba(112,56,248,0.5);  --type-bg-h: rgba(112,56,248,0.20);  --type-border-h: rgba(112,56,248,0.8); }
.bt-move-btn.type-dark     { --type-bg: rgba(112,88,72,0.12);   --type-border: rgba(112,88,72,0.5);   --type-bg-h: rgba(112,88,72,0.22);   --type-border-h: rgba(112,88,72,0.8); }
.bt-move-btn.type-steel    { --type-bg: rgba(184,184,208,0.14); --type-border: rgba(184,184,208,0.6); --type-bg-h: rgba(184,184,208,0.24); --type-border-h: rgba(184,184,208,0.9); }
.bt-move-btn.type-fairy    { --type-bg: rgba(238,153,172,0.10); --type-border: rgba(238,153,172,0.5); --type-bg-h: rgba(238,153,172,0.20); --type-border-h: rgba(238,153,172,0.8); }

.bt-move-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.15);
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  transition: filter 0.12s;
  background: #f0eee8;
  min-width: 0;
}

.bt-move-btn:hover:not(:disabled) { filter: brightness(0.94); }
.bt-move-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.bt-move-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #222;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bt-move-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2px;
}

.bt-move-type {
  font-size: 0.62rem;
  font-weight: 700;
  color: #444;
}

.bt-move-pp {
  font-size: 0.62rem;
  color: #888;
  font-weight: 600;
}

/* Type background tints */
.type-normal   { background: #e8e6dc; border-color: #a8a880; }
.type-fire     { background: #fde0c0; border-color: #f08030; }
.type-water    { background: #ccd8ff; border-color: #4a70e0; }
.type-electric { background: #fff0a0; border-color: #d8b000; }
.type-grass    { background: #ccf0b8; border-color: #58a838; }
.type-ice      { background: #c8f0f0; border-color: #60b8b8; }
.type-fighting { background: #f8c8c0; border-color: #c03028; }
.type-poison   { background: #f0c8f0; border-color: #a040a0; }
.type-ground   { background: #f8eab0; border-color: #c09020; }
.type-flying   { background: #dcd0ff; border-color: #8870d0; }
.type-psychic  { background: #ffc8dc; border-color: #e03068; }
.type-bug      { background: #d8f0a0; border-color: #88a000; }
.type-rock     { background: #e8d898; border-color: #988020; }
.type-ghost    { background: #ccc0e8; border-color: #604880; }
.type-dragon   { background: #c8b8ff; border-color: #5818e8; }
.type-dark     { background: #d0c8c0; border-color: #605040; }
.type-steel    { background: #d8d8e8; border-color: #8888a8; }
.type-fairy    { background: #ffd0e0; border-color: #d06880; }

/* Type icon inside move buttons — coloured circular SVG badge from
   assets/icons/types (the SVG is self-coloured, so no background needed). */
.bt-move-type {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.25));
}

/* Switch row */
.bt-switch-row {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  justify-content: center;
}

.bt-switch-row::-webkit-scrollbar { height: 3px; }
.bt-switch-row::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

.bt-switch-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 5px;
  border-radius: 6px;
  border: 1px solid #ddd;
  background: #fff;
  cursor: pointer;
  min-width: 68px;
  transition: border-color 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}

.bt-switch-slot:hover:not(.bt-switch-active):not(.bt-switch-fainted):not(.bt-switch-locked) {
  border-color: #3d7dca;
  box-shadow: 0 0 0 2px rgba(61,125,202,0.18);
}

.bt-switch-active {
  border-color: #aaa;
  background: #f0f0f0;
  cursor: default;
  opacity: 0.6;
}

.bt-switch-fainted {
  cursor: not-allowed;
  opacity: 0.38;
  filter: grayscale(1);
}

/* «Воскрешающее благословение»: павший — это ЕДИНСТВЕННАЯ легальная цель, и
   выглядеть запрещённым он не должен. Класс ставится только на те слоты, что
   реально кликабельны (benchClickable), поэтому спорить с `.bt-switch-fainted`
   ему не приходится — он всегда идёт вместе с ним и просто снимает траур. */
.bt-switch-revive {
  cursor: pointer;
  opacity: 1;
  filter: none;
  border-color: #7c5cff;
  box-shadow: 0 0 0 2px rgba(124,92,255,0.22);
}
.bt-switch-revive:hover {
  border-color: #5b39e0;
  box-shadow: 0 0 0 3px rgba(124,92,255,0.32);
  transform: translateY(-2px);
}

/* Скамейка под ловушкой: замену PS отклонит, поэтому слот не кликабелен.
   Отличается от павшего — покемон цел, просто уйти нельзя (Magma Storm и т.п.). */
.bt-switch-locked {
  cursor: not-allowed;
  opacity: 0.5;
  filter: saturate(0.35);
}

.bt-switch-icon {
  width: 36px;
  height: 36px;
  image-rendering: pixelated;
  object-fit: contain;
}

.bt-switch-name {
  font-size: 0.62rem;
  font-weight: 700;
  color: #333;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 64px;
}

.bt-switch-hp-track {
  width: 100%;
  height: 4px;
  background: #eee;
  border-radius: 2px;
  overflow: hidden;
}

.bt-switch-hp-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s;
}

/* ── Arena wrapper (panels + field side by side) ── */

.bt-arena {
  flex: 0 0 auto;
  height: 280px;
  display: flex;
  overflow: hidden;
}

/* ── Trainer side panels ── */

.bt-trainer-panel {
  width: 90px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 14px 8px 14px;
  background:
    linear-gradient(
      180deg,
      rgba(160, 210, 240, 0.45) 0%,
      rgba(140, 200, 170, 0.38) 100%
    );
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgba(255,255,255,0.32);
  box-shadow:
    0 8px 32px rgba(0,0,0,0.2),
    inset 0 1px 0 rgba(255,255,255,0.5);
}

.bt-panel-name {
  font-size: 0.68rem;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.bt-panel-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  border: 1px solid rgba(255,255,255,0.5);
  box-shadow:
    0 2px 8px rgba(0,0,0,0.12),
    inset 0 1px 0 rgba(255,255,255,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(80,120,160,0.9);
  font-size: 1.3rem;
  font-weight: 800;
}

.bt-panel-team { width: 100%; }

.bt-panel-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

/* Each slot */
.bt-slot {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: none;
  border: none;
  overflow: visible;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.bt-slot svg {
  width: 18px;
  height: 18px;
  opacity: 0.7;
}

.bt-slot-icon {
  width: 28px;
  height: 28px;
  image-rendering: pixelated;
  object-fit: contain;
}

/* Active — on the field RIGHT NOW: green halo + scale up so it clearly stands
   apart from the resting (alive) and fainted slots. Green (#4CAF50) matches the
   mobile status-bar active glow (.sbar-active) for a consistent look. */
.bt-slot-active {
  transform: scale(1.22);
  filter: drop-shadow(0 0 4px #4CAF50);
  z-index: 1;
}

/* Fainted — grayscale */
.bt-slot-fainted .bt-slot-icon {
  filter: grayscale(1) opacity(0.35);
}
.bt-slot-fainted svg { opacity: 0.2; }
.bt-slot-ball { width: 28px; height: 28px; object-fit: contain; opacity: 0.7; }
.bt-slot-fainted .bt-slot-ball { filter: grayscale(1) brightness(0.4); opacity: 0.5; }
.bt-slot-fainted .bt-slot-icon { filter: grayscale(1); opacity: 0.25; }
.bt-slot-empty-circle {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px dashed rgba(255,255,255,0.15);
}
.bt-slot-empty { opacity: 0.4; }

/* Team picker — full modal overlay */
.bt-team-picker {
  position: absolute;
  inset: 0;
  /* Fullscreen overlay ABOVE all battle UI (HP bars / prompts / action buttons),
     so nothing bleeds through. Opaque fallback colour guarantees no bleed even if
     the arena image (set inline via JS) is missing. */
  z-index: 100;
  background-color: #0d0f1c;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 24px;
}
/* Dark scrim over the arena image → readable title / timer / cards on any bg. */
.bt-team-picker::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  border-radius: inherit;
  z-index: 0;
}
.bt-team-picker > * { position: relative; z-index: 1; }

.bt-picker-title {
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.3px;
  text-align: center;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}

/* PvP lead-selection countdown + post-pick waiting state */
.bt-lead-timer {
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.5px;
  margin: 2px 0 6px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}
.bt-lead-timer-urgent { color: #ff5a5a; }
.lead-waiting {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  width: 100%;
  min-height: 240px;
  color: #fff;
}
.lead-waiting p { margin: 0; text-align: center; }
.lead-waiting-title { font-size: 1.1rem; font-weight: 800; }
.lead-waiting-opponent { color: rgba(255, 255, 255, 0.82); font-size: 0.95rem; }
.lead-waiting .bt-waiting-dots { display: flex; justify-content: center; gap: 4px; }

/* Post-pick waiting: the grid holds ONE centered message (not the card grid),
   and the "choose" prompt is hidden so it doesn't contradict "Стартовый выбран!". */
.bt-team-picker.bt-picker-waiting .bt-picker-title { display: none; }
.bt-team-picker.bt-picker-waiting .bt-picker-grid {
  display: flex;
  width: 100%;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
}

.bt-picker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.bt-picker-btn {
  background: rgba(255,255,255,0.07);
  border: 2px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 14px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
  min-width: 100px;
}

.bt-picker-btn:hover {
  background: rgba(61,125,202,0.3);
  border-color: #3d7dca;
  transform: scale(1.06);
}

.bt-picker-sprite {
  width: 72px;
  height: 72px;
  image-rendering: pixelated;
  object-fit: contain;
}

.bt-picker-name {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.85);
  font-weight: 700;
  text-align: center;
}

/* ── Oak Onboarding Dialog ───────────────────────────────────────────────── */

.oak-overlay {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 16px 80px;
}

.oak-dialog {
  background: rgba(255, 255, 255, 0.97);
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  display: flex;
  gap: 24px;
  max-width: 680px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px 28px;
}

/* ── Portrait ── */

.oak-portrait {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.oak-avatar-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid #4CAF50;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #f1f8f1;
}

.oak-avatar-name {
  font-size: 11px;
  font-weight: 700;
  color: #2e7d32;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.3;
}

/* ── Content ── */

.oak-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.oak-text {
  font-size: 16px;
  color: #1a1a2e;
  line-height: 1.6;
  font-weight: 400;
  min-height: 48px;
}
/* Реплики Оука пишутся через textContent с \n между абзацами (i18n oak*): без pre-line
   переносы схлопывались в стену текста. Скоуп ТОЛЬКО #oak-text: остальные .oak-text
   (Джой/Гид/Магазин/спарка) — HTML-шаблоны с переносами внутри <p>, глобальный
   pre-line дал бы им пустые строки сверху/снизу. */
#oak-text { white-space: pre-line; }

/* ── Step dots ── */

.oak-steps {
  display: flex;
  align-items: center;
  gap: 6px;
}

.oak-step-dot {
  height: 8px;
  width: 8px;
  border-radius: 4px;
  /* Точки — индикатор шагов (сколько их и где ты), не декор: обе ≥ 3:1 к фону шторки. */
  background: #8e8e96;
  transition: width 0.25s, background 0.25s;
  display: inline-block;
}

.oak-step-dot.active {
  width: 20px;
  background: #2e7d32;
}

/* ── Starter grid ── */

.oak-starter-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-height: 50vh;
  overflow-y: auto;
  padding-right: 4px;
}

.oak-gen-label {
  grid-column: 1 / -1;
  font-size: 11px;
  font-weight: 700;
  color: #6a6a75;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  padding: 6px 0 2px;
  border-bottom: 1px solid #f0f0f0;
  margin-top: 4px;
}

.oak-starter-card {
  background: #f8f9fa;
  border: 2px solid transparent;
  border-radius: 16px;
  padding: 12px 6px 10px;
  cursor: pointer;
  /* Спокойно и точно (DESIGN.md): ховер меняет тон и рамку, карточка не подпрыгивает.
     Выбор — тёмно-зелёная рамка (≥ 3:1 к фону), не цветное свечение. */
  transition: background 0.15s, border-color 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font: inherit;
}

.oak-starter-card:hover {
  background: #f1f8f1;
  border-color: #a5d6a7;
}

/* Кольцо ВНУТРИ рамки: сетка — область прокрутки, внешнее кольцо она обрезала бы. */
.oak-starter-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.oak-starter-card.selected {
  background: #e8f5e9;
  border-color: #2e7d32;
}

.oak-starter-sprite {
  width: 56px;
  height: 56px;
  image-rendering: pixelated;
  object-fit: contain;
}

.oak-starter-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: #1a1a2e;
}

.oak-starter-type {
  font-size: 0.62rem;
  font-weight: 700;
  color: #fff;
  border-radius: 12px;
  padding: 2px 8px;
}

/* ── Buttons ── */

.oak-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.oak-btn-row {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.oak-btn {
  border-radius: 50px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 24px;
  cursor: pointer;
  /* Спокойно и точно (DESIGN.md): состояние меняет ТОН, не размер — без scale() и цветных
     теней. Заливки под белым текстом держат ≥ 4,5:1 (прежние #4CAF50 / #f44336 — 2,8 / 3,7). */
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.oak-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.oak-btn:disabled,
.oak-btn:disabled:hover {
  opacity: 0.5;
  cursor: not-allowed;
}

.oak-btn-exit {
  background: transparent;
  border: 2px solid #cfd0d6;
  color: #5c5c66;
}

.oak-btn-exit:hover {
  background: #f3f3f5;
  border-color: #9a9aa3;
  color: #333;
}

.oak-btn-exit:active { background: #e8e8ec; }

.oak-btn-primary {
  background: #2e7d32;
  border: 2px solid #2e7d32;
  color: #fff;
  font-weight: 700;
}

.oak-btn-primary:hover {
  background: #256b29;
  border-color: #256b29;
}

.oak-btn-primary:active {
  background: #1b5e20;
  border-color: #1b5e20;
}

.oak-btn-primary:disabled {
  background: #2e7d32;
  border-color: #2e7d32;
}

.oak-btn-danger {
  background: #d32f2f;
  border: 2px solid #d32f2f;
  color: #fff;
  font-weight: 700;
}

.oak-btn-danger:hover {
  background: #c62828;
  border-color: #c62828;
}

.oak-btn-danger:active {
  background: #b71c1c;
  border-color: #b71c1c;
}

.oak-btn-danger:focus-visible { outline-color: #b71c1c; }

.oak-confirm-text {
  font-size: 0.82rem;
  color: #555;
  line-height: 1.5;
  margin: 0;
}

.oak-loading, .oak-error {
  font-size: 0.82rem;
  color: #6a6a75;
  padding: 8px 0;
}

.oak-error { color: #c62828; }

/* ── Onboarding UI lock ───────────────────────────────────────────────────── */

body.onboarding-active .bb-paw-btn,
body.onboarding-active .loc-hunt-btn {
  display: none;
}

body.onboarding-active #btn-team {
  pointer-events: none;
  opacity: 0.35;
}

/* ── Location background image override ─────────────────────────────────── */

.location-bg.has-image {
  /* background-image set inline by JS */
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* hide the CSS-drawn buildings/fountain when a real image is used */
.location-bg.has-image::before,
.location-bg.has-image::after {
  display: none;
}

/* ── EV System ──────────────────────────────────────────────────────────────── */

/* EV badge on team grid card */
@keyframes evPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(66, 165, 245, 0.6); }
  50%       { box-shadow: 0 0 0 5px rgba(66, 165, 245, 0); }
}
.tm-ev-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: #1976D2;
  color: #fff;
  font-size: 0.58rem;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 20px;
  animation: evPulse 1.8s ease-in-out infinite;
  z-index: 2;
  pointer-events: none;
}

/* "Distribute EVs" button in detail panel */
.tm-ev-btn {
  background: linear-gradient(135deg, #1565C0, #42A5F5);
  color: #fff;
  border-color: transparent !important;
}
.tm-ev-btn:hover {
  background: linear-gradient(135deg, #0D47A1, #1976D2);
}
.tm-ev-btn-badge {
  display: inline-block;
  background: rgba(255,255,255,0.25);
  border-radius: 10px;
  padding: 1px 6px;
  margin-left: 4px;
  font-size: 0.72em;
  vertical-align: middle;
}

/* Battle log EV line */
.bt-log-ev {
  color: #1976D2;
  font-style: italic;
}
.bt-log-evolution {
  background: linear-gradient(90deg, #E8EAF6, #EDE7F6);
  border-left: 3px solid #7C4DFF;
  padding-left: 6px;
  font-weight: 700;
  color: #4527A0;
  animation: levelUpFlash 0.8s ease-out;
}

/* ── Catch & Bag styles ────────────────────────────────────────────────────── */
.bt-bag-btn {
  width: calc(100% - 24px);
  margin: 6px 12px 6px;
  padding: 11px 16px;
  background: #fff;
  border: 1.5px solid #4CAF50;
  border-radius: 12px;
  color: #4CAF50;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.bt-bag-btn:hover {
  background: #4CAF50;
  color: #fff;
}
.bt-bag-btn:active {
  background: #43A047;
  color: #fff;
  transform: scale(0.98);
}

/* ── Action row: Рюкзак / Замена / Сдаться (one centred row, not stretched) ── */
.bt-action-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.bt-action-btn {
  flex: 0 1 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: #fff;
  border: 1.5px solid rgba(0,0,0,0.2);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.bt-action-btn:hover { box-shadow: 0 3px 10px rgba(0,0,0,0.12); }
.bt-action-bag       { border-color: #1a8a3c; color: #1a8a3c; }
.bt-action-bag:hover { background: #1a8a3c; color: #fff; }
.bt-action-switch       { border-color: #1a5dc7; color: #1a5dc7; }
.bt-action-switch:hover { background: #1a5dc7; color: #fff; }
.bt-action-team       { border-color: #6d28d9; color: #6d28d9; }
.bt-action-team:hover { background: #6d28d9; color: #fff; }
.bt-action-surrender       { border-color: #c73c1a; color: #c73c1a; }
.bt-action-surrender:hover { background: #c73c1a; color: #fff; }

/* ── Switch modal — team picker for swapping ── */
/* Окно команды, открытое ИЗ БОЯ. Оба оверлея — .modal-overlay c z-index 10000, а
   #team-overlay стоит в разметке РАНЬШЕ #battle-overlay, поэтому по умолчанию уехал бы
   под бой. Тот же этаж, что у модалки замены: выше боя, ниже подтверждений (99999). */
#team-overlay.tm-over-battle { z-index: 10001; }

.bt-switch-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;            /* above the battle overlay (10000), below confirm dialogs (99999) */
  display: none;              /* toggled to flex by JS */
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.bt-switch-modal {
  position: relative;
  width: 600px;
  max-width: 92vw;
  max-height: 80vh;
  overflow-y: auto;
  background: #f0f0f5;
  border-radius: 16px;
  padding: 20px 22px 24px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}
.bt-switch-modal-title {
  font-size: 1rem;
  font-weight: 800;
  color: #2a2a35;
  text-align: center;
  margin-bottom: 16px;
}
.bt-switch-modal-close {
  position: absolute;
  top: 12px; right: 14px;
  width: 30px; height: 30px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.08);
  color: #555;
  font-size: 15px;
  cursor: pointer;
}
.bt-switch-modal-close:hover { background: rgba(0,0,0,0.16); color: #222; }
/* Team grid inside the modal (3 across) — overrides the old inline flex row */
.bt-switch-modal .bt-switch-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  overflow: visible;
  justify-content: stretch;
}
.bt-switch-modal .bt-switch-slot {
  min-width: 0;
  width: auto;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 12px;
  padding: 10px 8px;
}
.bt-switch-modal .bt-switch-slot:hover:not(.bt-switch-active):not(.bt-switch-fainted):not(.bt-switch-locked) {
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transform: translateY(-2px);
}
.bt-switch-modal .bt-switch-name { color: #2a2a35; font-size: 0.8rem; }
.bt-switch-modal .bt-switch-icon { width: 56px; height: 56px; }

.bt-bag-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 38, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 16px;
  animation: btBagFade 0.15s ease-out;
}
@keyframes btBagFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.bt-bag-modal {
  background: rgba(255,255,255,0.98);
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
  width: 720px;
  max-width: 100%;
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: btBagPop 0.18s ease-out;
}
.bt-bag-body {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}
@keyframes btBagPop {
  from { transform: scale(0.94); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
.bt-bag-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  font-weight: 700;
  font-size: 1rem;
  border-bottom: 1px solid #eee;
}
.bt-bag-close {
  background: none; border: none;
  font-size: 1.3rem; cursor: pointer;
  color: #999;
}
.bt-bag-close:hover { color: #333; }
.bt-bag-empty {
  padding: 24px 18px;
  text-align: center;
  color: #888;
  font-size: 0.9rem;
}
.bt-bag-section-label {
  padding: 10px 14px 2px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #6b7280;
  letter-spacing: 0.04em;
}

/* Battle bag — item card grid (balls + potions) */
.battle-bag-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 4px 12px 10px;
}
.battle-ball-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  padding: 6px 8px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  min-width: 0;
}
.battle-ball-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(var(--accent-rgb),0.15);
}
.battle-ball-card:active { transform: scale(0.96); }
.battle-ball-card[data-ball="masterball"] {
  border-color: #c7d2fe;
  background: linear-gradient(135deg, #fafafa, #eef0ff);
}
.battle-ball-card[data-ball="geneticball"] {
  border-color: #bbf7d0;
  background: linear-gradient(135deg, #fafafa, #f0fdf4);
}
.battle-ball-card[data-ball="transferball"] {
  border-color: #fed7aa;
  background: linear-gradient(135deg, #fafafa, #fff7ed);
}
.battle-ball-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  image-rendering: pixelated;
  flex-shrink: 0;
}
.battle-ball-info {
  flex: 1;
  min-width: 0;
}
.battle-ball-name {
  font-size: 12px;
  font-weight: 700;
  color: #1a1a2e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.battle-ball-qty {
  font-size: 11px;
  color: #6b7280;
  margin-top: 1px;
}
@media (max-width: 900px) {
  .bt-bag-modal { width: 520px; }
  .battle-bag-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .bt-bag-modal { width: 100%; }
  .battle-bag-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 380px) {
  .battle-bag-grid { grid-template-columns: 1fr; }
}
.bt-log-catch-success {
  background: #E8F5E9;
  border-left: 3px solid #4CAF50;
  padding-left: 6px;
  color: #2E7D32;
  font-weight: 700;
}
.bt-log-catch-fail {
  border-left: 3px solid #f44336;
  padding-left: 6px;
  color: #f44336;
}
/* Анимация ловли (js/ui/catchAnim.js): узлы живут внутри .bt-field (position:relative),
   координаты ставит скрипт. Движение — только Web Animations, здесь лишь облик. */
.bt-catch-ball {
  position: absolute;
  z-index: 6;
  pointer-events: none;
  object-fit: contain;
  image-rendering: auto;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,0.55));
  will-change: transform;
}
.bt-catch-flash {
  position: absolute;
  z-index: 5;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.5) 40%, rgba(255,255,255,0) 70%);
}
.bt-catch-spark {
  position: absolute;
  z-index: 7;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  pointer-events: none;
  background: #ffe066;
  box-shadow: 0 0 8px 2px rgba(255, 214, 80, 0.9);
}
.bt-catch-label {
  position: absolute;
  z-index: 7;
  pointer-events: none;
  white-space: nowrap;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 800;
  color: #fff;
  background: rgba(20, 24, 40, 0.8);
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
/* Non-catchable дикий («Агрессивный») — пояснение в начале боя (battleUI.logAggroOnce) */
.bt-log-aggro {
  background: #FFF3E0;
  border-left: 3px solid #EF6C00;
  padding-left: 6px;
  color: #BF360C;
  font-weight: 600;
}
.bt-log-quest {
  background: #FFF8E1;
  border-left: 3px solid #F9A825;
  padding-left: 6px;
  color: #E65100;
  font-size: 13px;
}

/* ── Pokémon PC Modal ──────────────────────────────────────────────────────── */
.pc-overlay {
  z-index: 10000;
}
.pc-modal {
  background: rgba(255,255,255,0.97);
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  width: 900px;   /* было 680: карточкам питомника не хватало ширины на строку генов */
  max-width: 95vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pc-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
}
.pc-title { font-weight: 700; font-size: 18px; }
.pc-counts { font-size: 13px; color: #888; margin-left: auto; }
.pc-close {
  background: none; border: none; font-size: 22px;
  cursor: pointer; color: #999; margin-left: 8px;
}
.pc-close:hover { color: #333; }
.pc-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}
.pc-col {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
}
.pc-col-party {
  border-right: 1px solid #eee;
  min-width: 240px;
}
/* Питомнику — бóльшая доля ширины: в нём сетка карточек, у отряда — список строк. */
.pc-col-storage { flex: 1.5; }
.pc-col-label {
  font-size: 11px;
  font-weight: 700;
  color: #999;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 10px;
}
/* Оставленные Рите в питомнике НЕ лежат (их у игрока нет), но и пропасть бесследно
   не должны — иначе игрок идёт спрашивать, куда делся покемон. Отсюда строка-справка
   без кнопок: видно, кто занят и когда вернётся, но забрать/отпустить нельзя. */
.pc-at-rita {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: -4px 0 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
}
.pc-at-rita-title {
  font-size: 10.5px;
  font-weight: 700;
  color: #9a3412;
  letter-spacing: .6px;
  text-transform: uppercase;
}
.pc-at-rita-row {
  font-size: 12px;
  color: #9a3412;
  line-height: 1.4;
}
.pc-party-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8f9fa;
  margin-bottom: 8px;
  /* The HP bar is the last child and wraps onto its own full-width row (see .pc-hp-track).
     It used to live inside .pc-card-info, where it ran the full width of the name column and
     stopped 10px short of the deposit button — on a phone that reads as the bar crashing
     into the button. */
  flex-wrap: wrap;
}
.pc-sprite { width: 48px; height: 48px; object-fit: contain; }
.pc-card-info { flex: 1; min-width: 0; }
.pc-card-name { font-weight: 600; font-size: 14px; }
.pc-card-level { font-size: 12px; color: #888; }
/* Own row under the whole card (sprite + name + button), never beside the button.
   Реворк 26.10, этап 4: полоска подписана — «HP» слева, «текущее/макс» справа (раньше было
   непонятно, HP это или опыт). */
.pc-hp-row { flex-basis: 100%; display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.pc-hp-label { font-size: 10px; font-weight: 700; color: #999; letter-spacing: 0.5px; }
.pc-hp-nums { font-size: 10.5px; color: #888; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pc-hp-track { flex: 1 1 auto; height: 4px; background: #eee; border-radius: 2px; }
.pc-hp-fill { height: 100%; border-radius: 2px; }
.pc-hp-fill.hp-high { background: #4CAF50; }
.pc-hp-fill.hp-mid  { background: #FF9800; }
.pc-hp-fill.hp-low  { background: #f44336; }
.pc-btn {
  border: none; border-radius: 50px;
  padding: 6px 14px; font-weight: 600;
  font-size: 12px; cursor: pointer;
  white-space: nowrap;
}
.pc-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pc-btn-deposit {
  /* Реворк 26.10, этап 4: «Отправить» безобидно (покемон просто ложится в питомник) — синий,
     а не красный. Красный в питомнике — только у «Отпустить». */
  background: #fff;
  border: 1.5px solid #3d7dca;
  color: #3d7dca;
}
.pc-btn-deposit:hover:not(:disabled) { background: #3d7dca; color: #fff; }
.pc-btn-withdraw {
  background: #fff;
  border: 1.5px solid #4CAF50;
  color: #4CAF50;
}
.pc-btn-withdraw:hover:not(:disabled) { background: #4CAF50; color: #fff; }
.pc-grid {
  display: grid;
  /* 150 px — минимум, при котором строка генов «H40A40D40SA40SD40S40» влезает целиком. */
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.pc-storage-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px;
  border-radius: 12px;
  background: #f8f9fa;
  text-align: center;
}
.pc-sprite-sm { width: 40px; height: 40px; object-fit: contain; }
.pc-card-name-sm { font-weight: 600; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.pc-card-level-sm { font-size: 11px; color: #888; }
.pc-storage-card { position: relative; }
/* Гены на карточке питомника (pcModal.ivCodeHtml): одна строка без пробелов, цифры
   моноширинные. Не влезла — переносится по `<wbr>` перед «SA». `min-width:0` —
   иначе содержимое раздвигает колонку сетки. 🔴 Видна всегда (решение владельца 26.10). */
.pc-card-ivs {
  font-size: 10px; line-height: 1.35; color: #555; background: #eceef2; border-radius: 6px;
  padding: 1px 5px; font-variant-numeric: tabular-nums; letter-spacing: -0.2px;
  min-width: 0; max-width: 100%; overflow-wrap: normal;
}
/* Те же тона, что у характера в карточке покемона (.tm-nat-up / .tm-nat-down). */
.pc-card-ivs .pc-iv-up   { color: #2e7d32; font-weight: 700; }
.pc-card-ivs .pc-iv-down { color: #e53935; font-weight: 700; }
/* Типы — общие плашки обмена/покедекса (.tm-move-type-badge.trade-type-badge.type-*). */
.pc-card-types { display: flex; gap: 3px; justify-content: center; flex-wrap: wrap; max-width: 100%; }
/* Держимое — значок в правом верхнем углу (левый угол займёт галочка выделения). */
.pc-card-held {
  position: absolute; top: 6px; right: 6px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 1px #e4e6ea;
  display: flex; align-items: center; justify-content: center;
}
.pc-card-held img { width: 18px; height: 18px; object-fit: contain; }
.pc-empty {
  text-align: center; color: #999; font-style: italic;
  padding: 40px 20px; font-size: 14px;
  grid-column: 1 / -1;
}
.pc-error {
  display: none;
  text-align: center;
  color: #f44336;
  font-size: 13px;
  padding: 8px;
  background: #FFF3F3;
  border-top: 1px solid #fcc;
}
.tm-pc-count {
  font-size: 12px;
  color: #999;
  margin-left: 12px;
  font-weight: 400;
}

/* ── PC search ── */
.pc-search-wrap { position: relative; margin-bottom: 6px; }
.pc-search {
  width: 100%;
  padding: 8px 30px 8px 12px;
  border: 1.5px solid #ddd;
  border-radius: 10px;
  font-size: 0.8rem;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.pc-search:focus { border-color: #4CAF50; }
.pc-search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: #aaa;
  cursor: pointer;
  padding: 0 4px;
}
.pc-search-clear:hover { color: #555; }
.pc-search-hint {
  display: none;
  font-size: 11px;
  color: #c79100;
  margin-bottom: 6px;
  padding-left: 2px;
}

/* ── PC detail card (reuses tm-* classes for the body) ── */
.pc-detail { display: flex; flex-direction: column; gap: 8px; }
.pc-detail-back-row { margin-bottom: 2px; }
.pc-detail-back {
  background: none;
  border: none;
  color: #3d7dca;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 0;
  font-family: inherit;
}
.pc-detail-back:hover { text-decoration: underline; }
.pc-detail-nomoves { font-size: 0.75rem; color: #aaa; font-style: italic; }
.pc-action-danger {
  border-color: #f44336 !important;
  color: #f44336 !important;
}
.pc-action-danger:hover { background: #f44336 !important; color: #fff !important; }
.pc-detail-confirm { display: none; margin-top: 4px; }
.pc-rename-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pc-rename-input {
  flex: 1;
  min-width: 120px;
  padding: 7px 10px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 0.8rem;
  font-family: inherit;
  outline: none;
}
.pc-rename-input:focus { border-color: #3d7dca; }
.pc-rename-err { font-size: 11px; color: #f44336; margin-top: 4px; }

/* Заголовок «Отряд n/6» — кнопка (на телефоне сворачивает отряд), на компьютере выглядит и
   ведёт себя как прежняя подпись колонки: стрелки нет, курсор обычный. */
.pc-party-toggle {
  display: block; width: 100%;
  background: none; border: none; padding: 0;
  font-family: inherit; text-align: left; cursor: default;
}
.pc-party-chev { display: none; }
.pc-party-chev::before {
  content: ''; display: inline-block; width: 7px; height: 7px;
  border-right: 2px solid #999; border-bottom: 2px solid #999;
  transform: rotate(45deg); margin: 0 4px 3px 0;
  transition: transform 0.15s;
}
.pc-col-party:not(.is-collapsed) .pc-party-chev::before { transform: rotate(-135deg); margin-bottom: -3px; }

/* Кнопка «?» у строки поиска: синтаксис запросов вынесен из плейсхолдера (там он обрезался). */
.pc-search-help-btn {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  border: 1.5px solid #ddd; border-radius: 10px; background: #fff;
  font-family: inherit; font-size: 0.85rem; font-weight: 700; color: #888;
  cursor: pointer; transition: border-color 0.15s, color 0.15s;
}
.pc-search-help-btn:hover { border-color: #bbb; color: #555; }
.pc-search-help-btn.is-open { border-color: #4CAF50; color: #2e7d32; }
.pc-search-help {
  margin: 0 0 8px; padding: 8px 12px;
  border: 1.5px solid #e4e4e4; border-radius: 12px; background: #fafafa;
  font-size: 12px; color: #555; line-height: 1.5;
}
.pc-search-help[hidden] { display: none; }
.pc-search-help-title { font-weight: 700; color: #333; margin-bottom: 2px; }
.pc-search-help-list { margin: 0; padding-left: 16px; }
.pc-search-help-q { font-weight: 600; color: #2e7d32; }

/* ── Реворк 26.10, этап 3: режим выделения и действия над выбранными ── */
.pc-storage-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pc-select-toggle {
  flex: 0 0 auto;
  padding: 4px 12px; border-radius: 999px;
  border: 1.5px solid #ddd; background: #fff;
  font-family: inherit; font-size: 12px; font-weight: 600; color: #555;
  text-transform: none; letter-spacing: 0; cursor: pointer;
}
.pc-select-toggle:hover { border-color: #bbb; }
.pc-select-toggle.is-on { border-color: #3d7dca; background: #3d7dca; color: #fff; }
/* Галочка — левый верхний угол (правый занят значком предмета). */
.pc-storage-card.is-selectable { cursor: pointer; box-shadow: inset 0 0 0 2px transparent; transition: box-shadow 0.12s, background 0.12s; }
.pc-storage-card.is-selected { background: #eaf2fc; box-shadow: inset 0 0 0 2px #3d7dca; }
.pc-card-check {
  position: absolute; top: 6px; left: 6px;
  width: 20px; height: 20px; border-radius: 6px;
  border: 2px solid #b8bec8; background: #fff; box-sizing: border-box;
}
.pc-storage-card.is-selected .pc-card-check { background: #3d7dca; border-color: #3d7dca; }
.pc-storage-card.is-selected .pc-card-check::after {
  content: ''; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px;
  border-right: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(45deg);
}
.pc-bulk-bar {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 14px 12px; border-top: 1px solid #e4e6ea; background: #f7f9fc;
  max-height: 55%; overflow-y: auto; flex: 0 0 auto;
}
.pc-bulk-bar[hidden] { display: none; }
.pc-bulk-row-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pc-bulk-count { font-size: 13px; font-weight: 700; color: #333; }
.pc-bulk-link {
  background: none; border: none; padding: 4px 0; cursor: pointer;
  font-family: inherit; font-size: 12.5px; font-weight: 700; color: #3d7dca;
}
.pc-bulk-link:disabled { color: #aaa; cursor: default; }
.pc-bulk-actions { display: flex; gap: 8px; }
.pc-bulk-btn {
  flex: 1 1 0; min-height: 38px; padding: 8px 12px; border-radius: 10px;
  font-family: inherit; font-size: 13px; font-weight: 700; cursor: pointer; background: #fff;
}
.pc-bulk-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.pc-bulk-withdraw { border: 1.5px solid #4CAF50; color: #2e7d32; }
.pc-bulk-withdraw:hover:not(:disabled) { background: #4CAF50; color: #fff; }
.pc-bulk-release { border: 1.5px solid #f44336; color: #f44336; }
.pc-bulk-release:hover:not(:disabled) { background: #f44336; color: #fff; }
.pc-bulk-note { font-size: 12px; color: #8a6d00; }
.pc-bulk-confirm { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; border-top: 1px dashed #e0c9c9; }
.pc-bulk-summary { display: flex; gap: 6px; flex-wrap: wrap; }
.pc-bulk-list {
  list-style: none; margin: 0; padding: 0;
  max-height: 180px; overflow-y: auto;
  border: 1px solid #ececec; border-radius: 10px; background: #fff;
}
.pc-bulk-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 5px 10px; font-size: 12.5px; border-bottom: 1px solid #f2f2f2; }
.pc-bulk-row:last-child { border-bottom: none; }
.pc-bulk-row.is-marked { background: #fffaf0; }
.pc-bulk-name { font-weight: 600; color: #333; }
.pc-bulk-lv { color: #888; font-size: 11.5px; }
.pc-bulk-mark { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.pc-bulk-mark.mark-shiny  { background: #fff4d6; color: #a86b00; border: 1px solid #f3d27a; }
.pc-bulk-mark.mark-letter { background: #efe9fd; color: #6a3fc8; border: 1px solid #d9cbf7; }
.pc-bulk-msg { font-size: 12.5px; line-height: 1.45; padding: 7px 10px; border-radius: 8px; }
.pc-bulk-msg.is-ok   { background: #e6f5e9; color: #2e7d32; }
.pc-bulk-msg.is-warn { background: #fff4e5; color: #9a5b00; }

/* ── Питомник: избранное и команды (26.10) ── */
.pc-label-btns { display: inline-flex; gap: 6px; flex: 0 0 auto; }
/* Звезда избранного: левый верхний угол карточки сетки (правый — значок предмета). В режиме
   выделения угол занят галочкой — звезда-метка сдвигается правее и не нажимается. */
.pc-card-fav {
  position: absolute; top: 4px; left: 4px;
  width: 26px; height: 26px; padding: 0; border: none; border-radius: 50%;
  background: transparent; cursor: pointer; line-height: 26px; text-align: center;
  font-size: 18px; color: #c3c8d0; font-family: inherit;
}
.pc-card-fav::before { content: '\2606'; }
.pc-card-fav.is-on { color: #e8a400; }
.pc-card-fav.is-on::before { content: '\2605'; }
.pc-card-fav:hover:not(:disabled):not(.is-static) { color: #e8a400; }
.pc-card-fav:disabled { opacity: 0.5; cursor: progress; }
.pc-card-fav.is-static { left: 30px; top: 3px; cursor: inherit; pointer-events: none; }
.pc-fav-mark { color: #e8a400; margin-right: 3px; font-size: 13px; }
.pc-fav-mark::before { content: '\2605'; }
.pc-detail-org { display: flex; flex-direction: column; gap: 8px; }
.pc-fav-btn {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; border: 1.5px solid #ddd; background: #fff;
  font-family: inherit; font-size: 12.5px; font-weight: 600; color: #555; cursor: pointer;
}
.pc-fav-btn .pc-fav-icon::before { content: '\2606'; font-size: 15px; color: #b8bec8; }
.pc-fav-btn.is-on { border-color: #f3d27a; background: #fff8e1; color: #8a5a00; }
.pc-fav-btn.is-on .pc-fav-icon::before { content: '\2605'; color: #e8a400; }
.pc-team-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pc-team-chip {
  padding: 4px 10px; border-radius: 999px; border: 1.5px dashed #c9d3e0; background: #fff;
  font-family: inherit; font-size: 12px; font-weight: 600; color: #6b7480; cursor: pointer;
}
.pc-team-chip.is-on { border-style: solid; border-color: #3d7dca; background: #eaf2fc; color: #2a5d9b; }
.pc-team-chip:disabled { opacity: 0.45; cursor: not-allowed; }
.pc-org-msg { font-size: 12px; color: #9a5b00; min-height: 0; }
.pc-org-msg:empty { display: none; }
.pc-bulk-org { border: 1.5px solid #c9d3e0; color: #2a5d9b; }
.pc-bulk-org:hover:not(:disabled) { background: #eaf2fc; }

/* Панель «Команды» — тот же светлый ключ, что у панели фильтров. */
#pc-teams-host[hidden] { display: none; }
.pc-teams {
  margin: 0 0 8px; padding: 10px; border: 1.5px solid #e4e4e4; border-radius: 12px; background: #fafafa;
  display: flex; flex-direction: column; gap: 8px;
}
.pc-teams-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.pc-teams-title { font-size: 13px; font-weight: 700; color: #333; }
.pc-team-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pc-team-row { background: #fff; border: 1px solid #ececec; border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.pc-team-list .pc-team-row:has(> .pc-team-name) { flex-direction: row; align-items: center; }
.pc-team-row-top { display: flex; align-items: baseline; gap: 8px; }
.pc-team-name { font-weight: 700; font-size: 13px; color: #333; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-team-count { font-size: 11.5px; color: #888; font-variant-numeric: tabular-nums; }
.pc-team-minis { display: flex; gap: 4px; flex-wrap: wrap; }
.pc-team-mini {
  width: 34px; height: 34px; border-radius: 8px; background: #f3f5f8; display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #aaa;
}
.pc-team-mini img { width: 32px; height: 32px; object-fit: contain; }
.pc-team-mini.is-lead { box-shadow: inset 0 0 0 2px #e8a400; }
.pc-team-mini.is-gone { background: #f1f1f1; }
.pc-team-row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.pc-team-btn {
  padding: 5px 11px; border-radius: 8px; border: 1.5px solid #ddd; background: #fff;
  font-family: inherit; font-size: 12px; font-weight: 600; color: #555; cursor: pointer; white-space: nowrap;
}
.pc-team-btn:hover:not(:disabled) { border-color: #bbb; }
.pc-team-btn.is-primary { border-color: #4CAF50; color: #2e7d32; }
.pc-team-btn.is-primary:hover:not(:disabled) { background: #4CAF50; color: #fff; }
.pc-team-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.pc-team-hint { font-size: 12px; color: #888; line-height: 1.45; }
.pc-team-name-input, .pc-team-name { box-sizing: border-box; }
.pc-teams .pc-f-input.pc-team-name { white-space: normal; flex: none; font-weight: 400; font-size: 0.8rem; color: #333; }
.pc-team-edit-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.pc-team-edit-row { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #ececec; border-radius: 8px; padding: 4px 6px; }
.pc-team-edit-name { flex: 1 1 auto; min-width: 0; font-size: 12.5px; font-weight: 600; color: #333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-team-lead { font-size: 10.5px; font-weight: 700; color: #a86b00; background: #fff4d6; border-radius: 999px; padding: 1px 6px; margin-left: 4px; }
.pc-team-icon {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 8px; border: 1.5px solid #ddd; background: #fff;
  font-family: inherit; font-size: 14px; font-weight: 700; color: #666; cursor: pointer;
}
.pc-team-icon-x:hover { border-color: #f44336; color: #f44336; }
.pc-team-icon-gap { flex: 0 0 auto; width: 30px; }
.pc-team-load-row { display: flex; gap: 8px; font-size: 12.5px; color: #333; line-height: 1.45; }
.pc-team-load-k { flex: 0 0 82px; color: #888; font-weight: 600; }
/* Папки (26.10): «+N» вместо длинной полосы мини-спрайтов, метка «запас», выбор до 6 при «В отряд». */
.pc-team-more { align-self: center; font-size: 12px; font-weight: 700; color: #888; padding: 0 4px; }
.pc-team-spare { font-size: 10.5px; font-weight: 700; color: #5c6b7a; background: #eef1f5; border-radius: 999px; padding: 1px 6px; margin-left: 4px; }
.pc-team-picklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 280px; overflow-y: auto; }
.pc-team-pickrow { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #ececec; border-radius: 8px; padding: 4px 8px; cursor: pointer; }
.pc-team-pickrow.is-on { border-color: #3d7dca; background: #eaf2fc; }
.pc-team-pickrow input { width: 18px; height: 18px; margin: 0; accent-color: #3d7dca; flex: 0 0 auto; }
.pc-team-pickrow input:disabled + .pc-team-mini { opacity: 0.5; }
/* Генотип и в карточке отряда (решение владельца 26.10) — та же плашка, что в сетке, слева по строке. */
.pc-card-info .pc-card-ivs { display: inline-block; margin-top: 3px; }
.pc-team-delete {
  align-self: flex-start; background: none; border: none; padding: 2px 0; cursor: pointer;
  font-family: inherit; font-size: 12px; font-weight: 700; color: #f44336;
}

@media (max-width: 600px) {
  .pc-body { flex-direction: column; }
  .pc-col-party {
    border-right: none;
    border-bottom: 1px solid #eee;
    min-width: 0;
    /* Both columns used to stay `flex: 1` here. Stacked vertically, that made them share the
       sheet — but each is `overflow-y:auto`, so its automatic minimum height is 0, and the
       storage grid (up to 3000 mons) simply out-grew the party column and squeezed it down to
       a single visible row. The party is a short, fixed list: give it its content height and
       let the storage take whatever is left. */
    flex: 0 0 auto;
    overflow: visible;   /* the LIST scrolls, so the «ОТРЯД n/6» label stays put */
  }
  /* Show exactly three party rows, then scroll inside the list — the storage grid keeps the
     rest of the sheet. Card is 108px + 8px margin (measured; 84 → 92 с подписью HP → 108 с генотипом, 26.10) — сверяет
     test-client-pcmodal-browser.js; keep these in sync if the card
     layout changes. The 45vh guard keeps it sane on a short/landscape screen. */
  .pc-col-party .pc-list {
    --pc-card-h: 108px;
    --pc-card-gap: 8px;
    max-height: min(calc(var(--pc-card-h) * 3 + var(--pc-card-gap) * 2), 45vh);
    overflow-y: auto;
  }
  .pc-col-storage {
    flex: 1 1 auto;
    min-height: 0;      /* may shrink below its content — it scrolls internally */
  }
  /* Реворк 26.10, этап 1: отряд свёрнут в одну строку «Отряд n/6», тап разворачивает
     (pcModal: _partyOpen → .is-collapsed). Строка — кнопка во всю ширину, высота под палец. */
  .pc-col-party { padding-top: 6px; padding-bottom: 6px; }
  .pc-party-toggle {
    display: flex; align-items: center; justify-content: space-between;
    min-height: 36px; cursor: pointer; margin-bottom: 6px;
  }
  .pc-party-chev { display: inline-block; }
  .pc-col-party.is-collapsed .pc-party-toggle { margin-bottom: 0; }
  .pc-col-party.is-collapsed .pc-list { display: none; }
  /* Открыта карточка покемона — отряда нет вовсе: карточка начинается от шапки окна. */
  .pc-modal.is-detail .pc-col-party { display: none; }
}


/* ── Online players block ──────────────────────────────────────────────────── */
.players-block {
  padding: 10px 16px;
  border-top: 1px solid #eee;
  margin-top: 4px;
}
.players-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #aaa;
}
.players-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #ccc;
  display: inline-block;
  flex-shrink: 0;
}
.players-dot.active {
  background: #4CAF50;
  animation: presencePulse 2s ease-in-out infinite;
}
@keyframes presencePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.8); }
}
.players-dot-sm {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #4CAF50;
  display: inline-block;
  flex-shrink: 0;
}
.players-list { margin-top: 4px; max-height: 240px; overflow-y: auto; overscroll-behavior: contain; }
.players-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-size: 13px;
  color: #1a1a2e;
  border-bottom: 1px solid #f0f0f0;
}
.players-row:last-child { border-bottom: none; }

/* ── Идущие бои: иконка в шапке локации + окошко (js/ui/liveBattles.js) ── */
.loc-live-btn { position: relative; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; border: none; border-radius: 9px; background: transparent; color: #9aa0ad; cursor: pointer; transition: background .14s, color .14s, transform .14s; }
.loc-live-btn:hover { background: rgba(0,0,0,.06); color: #5b6070; }
.loc-live-btn:active { transform: scale(.92); }
.loc-live-btn.has-live { color: #e53935; }
.loc-live-btn[aria-expanded="true"] { background: rgba(229,57,53,.10); }
.loc-live-count { position: absolute; top: 1px; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: #e53935; color: #fff; font-size: 10px; font-weight: 800; line-height: 16px; text-align: center; box-shadow: 0 0 0 2px #fff; animation: presencePulse 2s ease-in-out infinite; }
.loc-live-count[hidden] { display: none; }
.loc-live-pop { position: fixed; z-index: 1200; width: min(300px, calc(100vw - 32px)); max-height: 320px; overflow-y: auto; background: #fff; border: 1px solid #eceef1; border-radius: 14px; box-shadow: 0 10px 30px rgba(20,24,40,.18); padding: 10px; }
.live-pop-title { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: #9aa0ad; padding: 2px 4px 8px; }
.live-pop-empty { font-size: 13px; color: #6b7280; padding: 6px 4px 8px; }
.live-battles-dot { width: 8px; height: 8px; border-radius: 50%; background: #e53935; display: inline-block; flex-shrink: 0; animation: presencePulse 2s ease-in-out infinite; }
.live-battle-row { display: flex; flex-direction: column; align-items: stretch; gap: 2px; width: 100%; text-align: left; border: 1px solid transparent; border-radius: 10px; padding: 8px 10px; background: #f8f9fa; margin-bottom: 6px; font: inherit; }
.live-battle-row:last-child { margin-bottom: 0; }
.live-battle-watch { cursor: pointer; transition: background .14s, border-color .14s; }
.live-battle-watch:hover { background: #fff1f0; border-color: #f7c6c4; }
.live-battle-watch:disabled { opacity: .6; cursor: default; }
.live-battle-names { font-size: 13.5px; font-weight: 700; color: #1a1a2e; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-battle-vs { color: #e53935; font-size: 11px; font-weight: 800; margin: 0 2px; }
.live-battle-meta { font-size: 11px; color: #8a90a0; }
.live-battle-mode { font-size: 10px; font-weight: 700; color: #7b61ff; background: rgba(123,97,255,.12); padding: 1px 6px; border-radius: 50px; margin-right: 6px; text-transform: uppercase; }
.live-battle-own { color: #2196F3; font-weight: 700; }
.live-battle-row.is-own { background: #f0f7ff; }
.players-more { color: #aaa; font-size: 12px; }
.players-empty { font-size: 12px; color: #aaa; font-style: italic; padding: 2px 0; }

/* ── Player action menu + profile modal ─────────────────────────────────────── */
.player-name { flex: 1; }
/* Должность → цвет ника в списке игроков на локации (роль из users, не presence) */
.player-name.role-admin  { color: var(--role-admin);  font-weight: 700; }
.player-name.role-mod    { color: var(--role-mod);    font-weight: 700; }
.player-name.role-mentor { color: var(--role-mentor); font-weight: 700; }
.player-name.role-jester { color: var(--role-jester); font-weight: 700; }
.player-name.role-curator { color: var(--role-curator); font-weight: 700; }
.player-name.role-gymleader { color: var(--role-gymleader); font-weight: 700; }
.player-action-btn {
  background: none; border: none; color: #aaa; cursor: pointer;
  padding: 4px 6px; border-radius: 8px; margin-left: auto;
  transition: all 0.15s; line-height: 1;
}
.player-action-btn:hover { background: #f0f0f0; color: #555; }
.players-row.self-row {
  background: rgba(33,150,243,0.06);
  border-radius: 10px;
  padding: 5px 8px;
  margin-bottom: 2px;
}
.player-self-label {
  font-size: 10px; font-weight: 700; color: #2196F3;
  background: rgba(33,150,243,0.12); padding: 2px 6px;
  border-radius: 50px; margin-right: 2px; text-transform: uppercase;
}
.players-dot-sm.self-dot { background: #2196F3; }
.player-action-btn.self-btn { color: #2196F3; }
.player-action-btn.self-btn:hover { background: rgba(33,150,243,0.1); }

.player-action-menu {
  position: fixed;
  background: rgba(255,255,255,0.97);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  padding: 6px;
  min-width: 200px;
  z-index: 950;
  animation: menuPop 0.15s ease;
}
@keyframes menuPop {
  from { opacity: 0; transform: scale(0.92) translateY(-4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.player-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 14px; border: none; background: none; border-radius: 10px;
  cursor: pointer; font-size: 14px; color: #1a1a2e; text-align: left;
  transition: background 0.1s;
}
.player-menu-item:hover { background: #f5f5f5; }
.player-menu-item svg { color: #555; flex-shrink: 0; }
.player-menu-item-disabled { cursor: not-allowed; color: #aaa; }
.player-menu-item-disabled:hover { background: none; }

/* ── Mobile bottom-sheet variant of the player action menu ──
   Used ≤768px instead of the dropdown (which got clipped by the
   viewport bottom / mobile nav on the last rows of the player list). */
.player-action-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 11900;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.player-action-backdrop.open { opacity: 1; }
.player-action-sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 11901;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.25);
  padding: 8px 14px calc(14px + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%);
  transition: transform 0.25s ease;
}
.player-action-sheet.open { transform: translateY(0); }
.pas-handle {
  width: 40px; height: 4px; border-radius: 2px;
  background: rgba(0, 0, 0, 0.15);
  margin: 4px auto 10px;
}
.pas-title {
  font-size: 12px; font-weight: 700; color: #99a;
  text-align: center; margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.player-action-sheet .player-menu-item {
  padding: 15px 12px;
  font-size: 15px;
  border-radius: 12px;
}
.player-action-sheet .pas-cancel {
  justify-content: center;
  color: #d33;
  font-weight: 600;
  margin-top: 6px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 0;
}
.coming-soon-badge {
  margin-left: auto; font-size: 10px; font-weight: 600;
  color: #FF9800; background: #FFF3E0; padding: 2px 8px;
  border-radius: 50px; text-transform: uppercase;
}

.player-profile-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.player-profile-modal {
  background: #fff; border-radius: 24px; width: 360px; max-width: 90vw;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25); overflow: hidden; position: relative;
}
.player-profile-loading {
  padding: 40px; text-align: center; color: #888; font-size: 14px;
}
.pp-close {
  position: absolute; top: 12px; right: 12px; background: rgba(255,255,255,0.3);
  border: none; width: 30px; height: 30px; border-radius: 50%;
  font-size: 16px; cursor: pointer; color: #fff; z-index: 1;
  display: flex; align-items: center; justify-content: center;
}
.pp-close:hover { background: rgba(255,255,255,0.5); }
.pp-header {
  background: linear-gradient(135deg, #4CAF50, #43A047);
  padding: 28px 24px 20px; text-align: center;
}
.pp-avatar-img {
  width: 72px; height: 72px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.5); object-fit: cover;
  margin: 0 auto 10px; display: block;
}
.pp-avatar-letter {
  width: 72px; height: 72px; border-radius: 50%;
  background: rgba(255,255,255,0.25); color: #fff;
  font-size: 28px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 10px;
}
.pp-name { color: #fff; font-size: 20px; font-weight: 700; }
.pp-join { color: rgba(255,255,255,0.8); font-size: 12px; margin-top: 2px; }
.pp-body { padding: 16px 20px 20px; }
.pp-stats {
  display: flex; gap: 12px; margin-bottom: 16px;
}
.pp-stat {
  flex: 1; background: #f8f9fa; border-radius: 12px; padding: 10px;
  text-align: center;
}
.pp-stat-val { display: block; font-size: 20px; font-weight: 700; color: #1a1a2e; }
.pp-stat-label { font-size: 11px; color: #888; }
.pp-section-label {
  font-size: 11px; font-weight: 700; color: #999; letter-spacing: 1px;
  margin-bottom: 8px;
}
.pp-party { display: flex; flex-wrap: wrap; gap: 6px; }
.pp-poke-chip {
  background: #f0f0f0; border-radius: 50px; padding: 4px 12px;
  font-size: 12px; font-weight: 600; color: #333;
}
.pp-empty { font-size: 13px; color: #aaa; font-style: italic; }

/* ── Hunt button in location panel ─────────────────────────────────────────── */
.loc-hunt-btn {
  display: block;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
  border-radius: 50px;
  padding: 10px 28px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  margin-top: 12px;
  margin-bottom: 8px;
  background: #f8f9fa;
  border: 2px solid #ddd;
  color: #888;
  transition: all 0.2s;
}
.loc-hunt-btn:hover { border-color: #bbb; color: #666; }
.loc-hunt-btn.hunt-btn-active {
  background: linear-gradient(135deg, #FF6B35, #FF4500);
  border: 2px solid transparent;
  color: #fff;
  box-shadow: 0 4px 15px rgba(255,69,0,0.4);
  animation: huntPulse 2s ease infinite;
}
@keyframes huntPulse {
  0%, 100% { box-shadow: 0 4px 15px rgba(255,69,0,0.4); }
  50%      { box-shadow: 0 4px 25px rgba(255,69,0,0.7); }
}

/* ── Admin Panel Modal — тёмное стекло (язык форума/чата) ────────────────────
   Токены ЛОКАЛЬНЫЕ (скоуп .admin-modal, НЕ :root — остальную игру не трогаем).
   Значения — из forum/css/forum.css. Имена классов не менялись (redesign rule). */
.admin-overlay { z-index: 10000; }
.admin-modal {
  --adm-glass:         rgba(15, 19, 34, 0.74);
  --adm-glass-row:     rgba(255, 255, 255, 0.04);
  --adm-glass-border:  rgba(255, 255, 255, 0.12);
  --adm-blur:          24px;
  --adm-accent:        #8A7CFF;
  --adm-accent-2:      #5B5BF0;
  --adm-accent-text:   #a99dff;
  --adm-accent-soft:   rgba(138, 124, 255, 0.15);
  --adm-accent-border: rgba(138, 124, 255, 0.42);
  --adm-text:          #ffffff;
  --adm-text-2:        rgba(255, 255, 255, 0.80);
  --adm-muted:         rgba(255, 255, 255, 0.60);
  --adm-faint:         rgba(255, 255, 255, 0.45);
  --adm-danger:        #ff8a80;

  background: var(--adm-glass);
  -webkit-backdrop-filter: blur(var(--adm-blur)) saturate(125%);
  backdrop-filter: blur(var(--adm-blur)) saturate(125%);
  border: 1px solid var(--adm-glass-border);
  border-radius: 24px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  color: var(--adm-text);
  accent-color: #8A7CFF;
  width: 720px;
  max-width: 95vw;
  max-height: 85vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--adm-glass-border);
  font-weight: 700;
  font-size: 18px;
}
.admin-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--adm-muted); }
.admin-close:hover { color: var(--adm-text); }
.admin-body { padding: 20px 24px; }
.admin-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--adm-text);
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}
.admin-input:focus { border-color: var(--adm-accent-border); background: rgba(255, 255, 255, 0.09); }
.admin-input::placeholder { color: var(--adm-faint); }
/* Нативный список option рисуется системным светлым попапом — тексту нужен тёмный цвет */
.admin-input option { color: #1a1a2e; background: #fff; }
.admin-input-sm { width: 100px; }
.admin-input-xs { width: 60px; text-align: center; }
.admin-search-wrap { position: relative; margin-bottom: 16px; }
.admin-dropdown {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: rgba(21, 26, 44, 0.98);
  border: 1px solid var(--adm-glass-border);
  border-top: none;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.5);
  z-index: 10;
  max-height: 240px;
  overflow-y: auto;
}
.admin-dd-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.1s;
}
.admin-dd-item:hover { background: rgba(255, 255, 255, 0.06); }
.admin-dd-name { font-weight: 600; font-size: 14px; }
.admin-dd-email { font-size: 12px; color: var(--adm-faint); }
.admin-dd-empty { padding: 10px 14px; color: var(--adm-muted); font-size: 13px; }
.admin-btn {
  /* transparent-бордер, а не none: у secondary-кнопок (-list/-cancel) бордер
     реальный — так primary и secondary в одном flex-ряду равны по высоте */
  border: 1px solid transparent; border-radius: 10px; padding: 10px 20px;
  font-weight: 700; font-size: 14px; cursor: pointer; transition: filter 0.15s, background 0.15s;
}
.admin-btn:hover { filter: brightness(1.08); }
.admin-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.admin-btn-search { background: linear-gradient(135deg, var(--adm-accent-2), var(--adm-accent)); color: #fff; }
.admin-btn-create { background: linear-gradient(135deg, var(--adm-accent-2), var(--adm-accent)); color: #fff; margin-top: 10px; }
.admin-btn-list {
  background: rgba(255, 255, 255, 0.08); color: var(--adm-text-2);
  border: 1px solid rgba(255, 255, 255, 0.16); margin-top: 10px;
}
.admin-btn-go { background: linear-gradient(135deg, var(--adm-accent-2), var(--adm-accent)); color: #fff; flex: 1; padding: 14px; font-size: 16px; margin-top: 16px; border-radius: 12px; }
.admin-btn-cancel { background: rgba(255, 255, 255, 0.06); color: var(--adm-muted); border: 1px solid var(--adm-glass-border); flex: 1; padding: 14px; font-size: 16px; margin-top: 16px; border-radius: 12px; }
.admin-btn-new-loc { background: linear-gradient(135deg, var(--adm-accent-2), var(--adm-accent)); color: #fff; padding: 8px 18px; font-size: 13px; border-radius: 10px; }
.admin-btn-sm {
  background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 8px;
  padding: 4px 10px; font-size: 12px; cursor: pointer; font-weight: 600; color: var(--adm-text-2);
}
.admin-btn-sm:hover { background: rgba(255, 255, 255, 0.12); }

/* ── Admin: daily rewards (Daily-бонус Этап 3) ── */
.admin-daily { display: flex; flex-direction: column; gap: 10px; }
.admin-daily-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.admin-daily-row .admin-input { flex: 1; min-width: 180px; }
.admin-daily-row .admin-btn-create { margin-top: 0; }
.admin-daily-hint { font-size: 12px; color: var(--adm-faint); line-height: 1.5; }
.admin-daily-json {
  width: 100%; min-height: 260px; resize: vertical;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.5;
}
.admin-daily-status { font-size: 13px; min-height: 18px; color: var(--adm-text-2); line-height: 1.5; }
.admin-daily-status.err { color: #ff8a80; }
.admin-daily-cu { gap: 14px; }
.admin-daily-cu-label { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--adm-text-2); cursor: pointer; }
.admin-daily-cu-range { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--adm-faint); }
.admin-daily-cu-range .admin-input-xs { flex: 0 0 auto; }
.admin-btn-sm.admin-give-tab.active {
  background: var(--adm-accent-soft);
  color: var(--adm-accent-text);
  border-color: var(--adm-accent-border);
}
.admin-player-card {
  background: var(--adm-glass-row); border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px; padding: 14px 18px; margin-top: 8px;
}
.admin-player-name { font-weight: 700; font-size: 16px; }
/* Заголовок внутри карточки-формы («Выдать мут», «Предупреждение») — воздух
   до первого поля; заголовкам с инлайн-margin (списки) инлайн важнее */
.admin-player-card .admin-player-name { margin-bottom: 10px; }
.admin-player-info { font-size: 13px; color: var(--adm-muted); margin-top: 2px; }
.admin-field { margin-bottom: 14px; }
.admin-field label { display: block; font-size: 13px; font-weight: 600; color: var(--adm-text-2); margin-bottom: 6px; }
.admin-iv-row { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-iv-row div { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.admin-iv-row span { font-size: 11px; color: var(--adm-muted); font-weight: 600; }
.admin-iv-quick { display: flex; gap: 6px; margin-top: 8px; }
.admin-move-row { display: flex; gap: 6px; margin-bottom: 6px; }
.admin-move-row .admin-input { flex: 1; }
.admin-move-rm { background: none; border: none; color: var(--adm-danger); font-size: 16px; cursor: pointer; }
.admin-checks { display: flex; gap: 16px; }
.admin-checks label { display: flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.admin-target { font-size: 14px; color: var(--adm-text-2); margin-bottom: 16px; padding: 10px 12px; background: var(--adm-accent-soft); border: 1px solid rgba(138, 124, 255, 0.25); border-radius: 8px; }
.admin-species-info { margin-top: 6px; font-size: 13px; }
.admin-bs-name { font-weight: 600; }
.admin-bs-types { color: var(--adm-muted); font-size: 12px; }
.admin-bs-row { color: var(--adm-muted); font-size: 12px; margin-top: 2px; }
.admin-loading { color: var(--adm-muted); font-size: 14px; padding: 10px; }
.admin-error { color: #ffb4ad; font-size: 13px; padding: 8px; background: rgba(229, 57, 53, 0.16); border: 1px solid rgba(255, 120, 110, 0.35); border-radius: 8px; }
.admin-success { color: #a5e8a7; font-size: 13px; padding: 8px; background: rgba(76, 175, 80, 0.16); border: 1px solid rgba(102, 187, 106, 0.35); border-radius: 8px; }
.admin-stat-preview { margin-top: 12px; }
.admin-preview-title { font-size: 13px; font-weight: 700; color: var(--adm-text-2); margin-bottom: 8px; }
.admin-preview-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.admin-preview-label { font-size: 12px; color: var(--adm-muted); width: 70px; }
.admin-preview-val { font-size: 13px; font-weight: 700; width: 36px; text-align: right; }
.admin-preview-bar { flex: 1; height: 8px; background: rgba(255, 255, 255, 0.10); border-radius: 4px; overflow: hidden; }
.admin-preview-bar div { height: 100%; border-radius: 4px; transition: width 0.2s; }
.sb-admin { background: rgba(255,50,50,0.08) !important; border: 1px solid rgba(255,50,50,0.2); }
/* Строка вкладок листается и на десктопе: вкладок у админа больше, чем влезает в ширину
   модалки (с «Рубильниками» и «Автобоем» — девять), и без прокрутки крайняя обрезалась,
   а модалка получала горизонтальную полосу. На телефоне так было и раньше (ниже).
   ⚠️ flex-shrink:0 обязателен: у контейнера с прокруткой в flex-колонке минимальная
   высота 0, и без него строка вкладок схлопывается в ноль, когда тело длинное. */
.admin-tabs { display: flex; gap: 0; border-bottom: 2px solid rgba(255, 255, 255, 0.10); padding: 0 20px; overflow-x: auto; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.18) transparent; flex-shrink: 0; }
.admin-tab {
  background: none; border: none; padding: 10px 16px; font-size: 13px;
  font-weight: 600; color: var(--adm-muted); cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all 0.15s; white-space: nowrap; flex-shrink: 0;
}
.admin-tab:hover { color: var(--adm-text-2); }
.admin-tab.active { color: var(--adm-accent-text); border-bottom-color: var(--adm-accent); }
#admin-list-back, #loc-form-back, #edit-back { margin-bottom: 10px; }
.admin-chips-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-chip {
  padding: 5px 12px; border-radius: 50px; font-size: 12px; font-weight: 600;
  cursor: pointer; background: rgba(255, 255, 255, 0.06); color: var(--adm-muted); border: 1px solid rgba(255, 255, 255, 0.16);
  transition: all 0.15s; user-select: none;
}
.admin-chip:hover { border-color: rgba(255, 255, 255, 0.35); }
.admin-chip-on { background: var(--adm-accent-soft); color: #cfc7ff; border-color: var(--adm-accent-border); }
.admin-list-section { margin-bottom: 16px; }
.admin-list-title { font-size: 14px; font-weight: 700; color: var(--adm-text-2); margin-bottom: 8px; padding-bottom: 4px; border-bottom: 1px solid rgba(255, 255, 255, 0.10); }
.admin-poke-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--adm-glass-row); border: 1px solid rgba(255, 255, 255, 0.07); border-radius: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.admin-poke-info { flex: 1; font-size: 13px; min-width: 140px; }
.admin-poke-hp { font-size: 12px; color: var(--adm-muted); white-space: nowrap; }
.admin-poke-actions { display: flex; gap: 4px; }
.admin-badge { display: inline-block; background: var(--adm-accent-soft); color: var(--adm-accent-text); border: 1px solid var(--adm-accent-border); font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 6px; vertical-align: middle; margin-left: 4px; }
.admin-delete-confirm { font-size: 13px; color: var(--adm-danger); font-weight: 600; padding: 4px 0; }

/* Заимствованные из инвентаря классы — тёмный оверрайд СТРОГО в скоупе
   .admin-modal (модалку самого инвентаря не трогаем). */
.admin-modal .inv-confirm-box { background: rgba(255, 255, 255, 0.05); border: 1px solid var(--adm-glass-border); }
.admin-modal .inv-confirm-msg { color: var(--adm-text-2); }
.admin-modal .inv-btn-cancel { background: rgba(255, 255, 255, 0.10); color: var(--adm-text-2); }

/* Слим-скроллбары внутри тёмной панели */
.admin-modal::-webkit-scrollbar, .admin-dropdown::-webkit-scrollbar { width: 8px; }
.admin-modal::-webkit-scrollbar-thumb, .admin-dropdown::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.18); border-radius: 4px; }

/* Под-табы ВНУТРИ тела (модерация #mod-tabs): без двойного отступа — строка
   вкладок выравнена по левому краю контента, подчёркивание строго под текстом.
   Главные вкладки (сосед .admin-body, не потомок) правило не затрагивает. */
.admin-body .admin-tabs { padding: 0; }
.admin-body .admin-tab { padding-left: 0; padding-right: 0; margin-right: 22px; }
/* Пустые состояния списков модерации/лога — по левому краю секции,
   а не с внутренним отступом дропдауна */
#mod-panel-body .admin-dd-empty, #admin-log-body .admin-dd-empty { padding: 8px 0; }
/* Строка статуса действия — воздух только когда непустая */
#mod-mute-status:not(:empty), #mod-warn-status:not(:empty) { margin-top: 8px; }

/* Правила модерации (под-таба «Правила») — статичный гайдлайн, без эмодзи */
.mod-rules-section { margin-bottom: 18px; }
.mod-rules-title { font-weight: 700; font-size: 14px; color: var(--adm-text); margin-bottom: 6px; }
.mod-rules-text { font-size: 13px; color: var(--adm-text-2); line-height: 1.55; margin: 0; }
.mod-rules-list { margin: 0; padding-left: 18px; font-size: 13px; color: var(--adm-text-2); line-height: 1.55; }
.mod-rules-list li { margin-bottom: 4px; }
.mod-rules-list b { color: var(--adm-text); }
.mod-rules-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mod-rules-table th {
  text-align: left; font-size: 12px; color: var(--adm-muted); font-weight: 600;
  padding: 6px 10px; border-bottom: 1px solid var(--adm-glass-border);
}
.mod-rules-table td {
  padding: 7px 10px; color: var(--adm-text-2); vertical-align: top; line-height: 1.45;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.mod-rules-table td:first-child { color: var(--adm-text); font-weight: 600; width: 38%; }
.mod-rules-row-danger td { background: rgba(229, 57, 53, 0.10); }
.mod-rules-row-danger td:first-child { color: #ffb4ad; }
.mod-rules-danger {
  border: 1px solid rgba(255, 120, 110, 0.45);
  background: rgba(229, 57, 53, 0.12);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 18px;
}
.mod-rules-danger .mod-rules-title { color: #ffb4ad; }
.mod-rules-danger .mod-rules-text { color: var(--adm-text-2); }
@media (max-width: 768px) {
  /* Таблица мер — списком на узком экране: «Нарушение» заголовком, «Реакция» под ним */
  .mod-rules-table thead { display: none; }
  .mod-rules-table, .mod-rules-table tbody, .mod-rules-table tr, .mod-rules-table td { display: block; width: 100%; }
  .mod-rules-table tr { border-bottom: 1px solid rgba(255, 255, 255, 0.07); padding: 8px 0; }
  .mod-rules-table td { padding: 2px 0; border-bottom: none; }
  .mod-rules-table td:first-child { width: auto; }
  .mod-rules-row-danger td { background: none; }
  .mod-rules-row-danger { background: rgba(229, 57, 53, 0.10); border-radius: 8px; padding: 8px; }
}

/* Шпаргалка слэш-команд (панель модерации) — текстом, без эмодзи */
.mod-cmds-card { margin-top: 16px; }
.mod-cmd { font-size: 13px; color: var(--adm-text-2); margin-top: 7px; line-height: 1.45; }
.mod-cmd code {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12px; color: #cfc7ff;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 6px; padding: 1px 6px;
  white-space: nowrap;
}

/* ── Admin — мобилка каркаса (768px, как основной брейкпоинт игры) ── */
@media (max-width: 768px) {
  .admin-modal {
    width: 100%; max-width: 100%; max-height: 92vh;
    border-radius: 20px 20px 0 0;
    border-left: none; border-right: none; border-bottom: none;
  }
  .admin-header { padding: 14px 16px; font-size: 16px; }
  .admin-body { padding: 14px 16px; }
  .admin-tabs { overflow-x: auto; padding: 0 12px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .admin-tabs::-webkit-scrollbar { display: none; }
  .admin-tab { padding: 10px 12px; white-space: nowrap; flex-shrink: 0; }
  .admin-poke-row { padding: 8px; }
  .admin-input-xs { width: 48px; }
}

/* ── Surrender confirmation ────────────────────────────────────────────────── */
.surrender-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 99999;
}
.surrender-modal {
  background: rgba(255,255,255,0.97);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  padding: 28px 32px;
  text-align: center;
  width: 320px;
}
.surrender-title { font-size: 20px; font-weight: 700; color: #1a1a2e; }
.surrender-text { font-size: 14px; color: #666; margin: 12px 0 20px; line-height: 1.5; }
.surrender-btns { display: flex; gap: 10px; }
.surrender-btn {
  flex: 1; padding: 10px; border-radius: 12px;
  font-weight: 700; font-size: 14px; cursor: pointer; border: none;
}
.surrender-btn-stay { background: #fff; border: 2px solid #4CAF50; color: #4CAF50; }
.surrender-btn-stay:hover { background: #E8F5E9; }
.surrender-btn-quit { background: #f44336; color: #fff; }
.surrender-btn-quit:hover { background: #d32f2f; }

/* ── Switch confirmation ───────────────────────────────────────────────────── */
.switch-confirm-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 99999;
}
.switch-confirm-modal {
  background: rgba(255,255,255,0.97); border-radius: 18px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  padding: 24px 28px; text-align: center; width: 300px;
}
.switch-confirm-text { font-size: 16px; color: #1a1a2e; margin-bottom: 16px; }
.switch-confirm-btns { display: flex; gap: 10px; }
.switch-confirm-btn {
  flex: 1; padding: 10px; border-radius: 12px;
  font-weight: 700; font-size: 14px; cursor: pointer; border: none;
}
.switch-btn-cancel { background: #f5f5f5; color: #666; }
.switch-btn-ok { background: #4CAF50; color: #fff; }

/* ── Officer Jenny gate modal ──────────────────────────────────────────────── */
.travel-btn-locked {
  opacity: 0.7;
  position: relative;
}
.travel-btn-locked::after {
  content: '🔒';
  margin-left: 6px;
  font-size: 12px;
}
.jenny-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.jenny-modal {
  background: rgba(255,255,255,0.97);
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  max-width: 420px;
  width: 90%;
  padding: 24px 28px;
}
.jenny-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid #1565C0;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.jenny-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-align: center;
  margin-top: 6px;
}
.jenny-btn {
  background: #1565C0;
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 10px 28px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: filter 0.15s;
}
.jenny-btn:hover { filter: brightness(0.9); }

/* ── Chat-open layout shift — center modals excluding chat panel ───────────── */
.modal-overlay,
.oak-overlay,
.ev-overlay,
.move-overlay,
.egg-hatch-overlay,
.jenny-modal-overlay {
  transition: right 0.3s ease;
}

body.chat-open .modal-overlay,
body.chat-open .oak-overlay,
body.chat-open .ev-overlay,
body.chat-open .move-overlay,
body.chat-open .egg-hatch-overlay,
body.chat-open .jenny-modal-overlay {
  /* Сдвиг = ТЕКУЩАЯ ширина панели (05.11: тянется 320–720, --chat-w ставит ui/chat.js).
     min(…, 90vw) — тот же потолок, что max-width у самой панели. */
  right: min(var(--chat-w, 340px), 90vw);
}
/* Свёрнутая в полоску панель занимает только ширину полосы вкладок. */
body.chat-open.chat-collapsed .modal-overlay,
body.chat-open.chat-collapsed .oak-overlay,
body.chat-open.chat-collapsed .ev-overlay,
body.chat-open.chat-collapsed .move-overlay,
body.chat-open.chat-collapsed .egg-hatch-overlay,
body.chat-open.chat-collapsed .jenny-modal-overlay {
  right: var(--chat-strip-w, 76px);
}

body.chat-open .location-panel {
  left: calc(50% - min(var(--chat-w, 340px), 90vw) / 2);
}
body.chat-open.chat-collapsed .location-panel {
  left: calc(50% - var(--chat-strip-w, 76px) / 2);
}
/* Пока тянем край — без анимаций, иначе окна догоняют курсор с опозданием. */
body.chat-resizing, body.chat-resizing * { user-select: none !important; cursor: ew-resize !important; }
body.chat-resizing .chat-panel,
body.chat-resizing .modal-overlay, body.chat-resizing .oak-overlay, body.chat-resizing .ev-overlay,
body.chat-resizing .move-overlay, body.chat-resizing .egg-hatch-overlay, body.chat-resizing .jenny-modal-overlay,
body.chat-resizing .location-panel { transition: none !important; }

@media (max-width: 768px) {
  body.chat-open .modal-overlay,
  body.chat-open .oak-overlay,
  body.chat-open .ev-overlay,
  body.chat-open .move-overlay,
  body.chat-open .egg-hatch-overlay,
  body.chat-open .jenny-modal-overlay {
    right: 0;
  }
  body.chat-open .location-panel,
  body.chat-open.chat-collapsed .location-panel {
    left: 50%;
  }
}

/* ── Global Chat Panel — тёмное «стекло» (в тон карте/форуму/покедексу) ──────
   Раньше панель была светлой Material-плашкой (белый фон, зелёная шапка) и
   выпадала из редизайна. Токены взяты из forum.css (--glass-panel/--glass-border):
   значения продублированы, а не импортированы — forum.css в game.html не грузится.
   ВАЖНО: имена классов вкладок — .chat-chan*, НЕ .chat-tabs: последний занят
   мёртвым легаси-блоком выше (строки ~2028+), который перебил бы стили. */
/* Подложка .chat-overlay УДАЛЕНА: чат не модальный — живёт параллельно
   бою/карте/модалкам, игра рядом кликабельна, click-outside не закрывает. */

/* FAB чата — «ручка» drawer-а на правом краю, вход из ЛЮБОГО состояния:
   z 12000 — выше боя (.modal-overlay 10000) и карты (11000), ниже панели
   чата (99999) и боевых тостов (100000). Середина правого края: углы
   заняты (низ — боевые контролы и мобнав, верх-право — крестик боя). */
.chat-fab {
  position: fixed; right: 0; top: 50%; transform: translateY(-50%);
  z-index: 12000;
  width: 46px; height: 64px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(var(--bg-glass-rgb), 0.88);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.16); border-right: none;
  border-radius: 14px 0 0 14px;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: background 0.15s, width 0.15s;
}
.chat-fab:hover { background: rgba(30, 38, 66, 0.95); width: 52px; }
.chat-fab img { width: 26px; height: 26px; object-fit: contain; }
.chat-fab-badge {
  position: absolute; top: 5px; left: 5px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: #ff5252; color: #fff;
  font-size: 10px; font-weight: 800; line-height: 16px; text-align: center;
  display: none;
}
body.chat-open .chat-fab { display: none; }

/* «⚔ В бой» в шапке чата — только мобилка + активный бой (body:has):
   фулскрин-чат там закрывает бой целиком, кнопка возвращает одним тапом.
   Браузеры без :has просто не показывают её (не критично: крестик рядом). */
.chat-battle-back {
  display: none;
  border: 1px solid rgba(255, 120, 110, 0.4);
  background: rgba(229, 57, 53, 0.22); color: #ffd7d5;
  font-weight: 700; font-size: 12px; font-family: inherit;
  border-radius: 10px; padding: 5px 10px; cursor: pointer;
}
@media (max-width: 768px) {
  body:has(#battle-overlay.open) .chat-battle-back { display: inline-flex; align-items: center; gap: 4px; }
}
.chat-panel {
  position: fixed;
  right: 0; top: 0; bottom: 0;
  width: var(--chat-w, 340px);   /* 05.11: тянется за левый край, 320–720 */
  max-width: 90vw;
  background: rgba(var(--bg-glass-rgb), 0.94);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: -24px 0 70px rgba(0, 0, 0, 0.42);
  border-radius: 16px 0 0 16px;
  color: #fff;
  display: flex; flex-direction: column;
  z-index: 99999;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}
.chat-panel-open { transform: translateX(0); }

/* ── Ширина и полоска (05.11, только компьютер) ── */
:root { --chat-strip-w: 76px; }
.chat-resize {
  position: absolute; left: -4px; top: 16px; bottom: 16px; width: 8px;
  cursor: ew-resize; z-index: 2; touch-action: none;
}
.chat-resize::after {
  content: ''; position: absolute; left: 3px; top: 50%; width: 2px; height: 44px;
  transform: translateY(-50%); border-radius: 2px;
  background: rgba(255, 255, 255, 0.18); opacity: 0; transition: opacity .15s;
}
.chat-resize:hover::after, .chat-resize:focus-visible::after,
body.chat-resizing .chat-resize::after { opacity: 1; }
.chat-resize:focus-visible { outline: none; }
.chat-collapse, .chat-expand {
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.72); width: 28px; height: 28px; border-radius: 8px;
  font-size: 18px; line-height: 1; cursor: pointer; flex-shrink: 0;
  transition: background .15s, color .15s;
}
.chat-collapse:hover, .chat-expand:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.chat-expand { display: none; }
.chat-panel.chat-collapsed { width: var(--chat-strip-w); }
.chat-collapsed .chat-header { padding: 10px 6px; }
.chat-collapsed .chat-head-top { justify-content: center; }
.chat-collapsed .chat-header-title, .chat-collapsed .chat-online, .chat-collapsed .chat-battle-back,
.chat-collapsed .chat-collapse, .chat-collapsed .chat-close, .chat-collapsed .chat-main,
.chat-collapsed .chat-resize, .chat-collapsed .chat-toast { display: none !important; }
.chat-collapsed .chat-expand { display: inline-block; }
.chat-collapsed .chat-chans { width: 100%; border-right: none; }

.chat-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(18, 22, 38, 0.55);
  border-radius: 16px 0 0 0;
  flex-shrink: 0;
}
/* Шапка — ОДНА строка: заголовок + «N онлайн» + крестик. Вкладки уехали из неё
   в вертикальную полосу слева (см. .chat-chans ниже). */
.chat-head-top { display: flex; align-items: center; gap: 10px; }
.chat-header-title {
  font-weight: 800; font-size: 15px; color: #fff; letter-spacing: .01em;
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-close {
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.72); width: 28px; height: 28px; border-radius: 8px;
  font-size: 18px; line-height: 1; cursor: pointer; transition: background .15s, color .15s;
}
.chat-close:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

/* ── Тело панели: вкладки КОЛОНКОЙ слева, лента и ввод — справа ─────────────
   Горизонтальная полоса в шапке при ширине панели 340px не вмещала пятую
   вкладку: «Помощь» уезжала за правый край и находилась только скроллом, о
   котором игрок не догадывался (полоса нарочно без видимой полосы прокрутки).
   Вертикально влезают все пять с запасом на шестую, а цена — 68px ширины ленты. */
.chat-body { flex: 1; min-height: 0; display: flex; }
.chat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.chat-chans {
  display: flex; flex-direction: column; gap: 6px;
  width: 76px; flex-shrink: 0;
  padding: 10px 6px;
  overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
  border-right: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(10, 13, 24, 0.45);
  /* Полоса упирается в левый НИЖНИЙ угол панели — повторяем её скругление,
     иначе подложка полосы вылезает за скруглённый край (overflow у панели
     не скрыт: его срезал бы боевой тост). */
  border-radius: 0 0 0 16px;
}
.chat-chans::-webkit-scrollbar { display: none; }
.chat-chan {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  width: 100%; padding: 9px 3px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.72);
  border-radius: 12px;
  font-size: 11px; font-weight: 700; font-family: inherit;
  cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.chat-chan-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.chat-chan:hover:not(:disabled) { background: rgba(255, 255, 255, 0.10); color: #fff; }
.chat-chan-active {
  background: rgba(var(--accent-strong-rgb), 0.9); border-color: rgba(var(--accent-dark-rgb), 0.9); color: #fff;
  box-shadow: 0 2px 10px rgba(var(--accent-strong-rgb), 0.35);
}
.chat-chan-off { opacity: 0.42; cursor: not-allowed; }
.chat-chan-note {
  font-size: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  background: rgba(255, 255, 255, 0.14); color: rgba(255, 255, 255, 0.85);
  border-radius: 999px; padding: 0 4px;
}
.chat-online { font-size: 11px; color: rgba(255, 255, 255, 0.52); white-space: nowrap; }

.chat-main { position: relative; container-type: inline-size; }   /* якорь кнопки «вниз»; ширина ленты для @container */
/* Узкая панель (≈320): «Отправить» компактнее — полю ввода остаётся место. */
@container (max-width: 260px) { .chat-main .chat-send-btn { padding: 10px 12px; font-size: 13px; } .chat-main .chat-input-field { padding: 10px 12px; } }
.chat-messages-area {
  position: relative;   /* offsetTop разделителя — от ленты */
  flex: 1; overflow-y: auto;
  padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.chat-empty {
  text-align: center; color: rgba(255, 255, 255, 0.52); font-style: italic;
  padding: 40px 20px; font-size: 13.5px;
}
.chat-bubble {
  max-width: 82%; padding: 8px 12px;
  overflow-wrap: anywhere;
  position: relative;   /* М3: якорь кнопки удаления */
}
.chat-bubble-me {
  align-self: flex-end;
  background: rgba(var(--accent-strong-rgb), 0.26);
  border: 1px solid rgba(var(--accent-dark-rgb), 0.34);
  border-radius: 14px 14px 4px 14px;
}
/* Чужое сообщение в канале — строка «аватар + пузырь» (05.11). */
.chat-line { align-self: flex-start; display: flex; align-items: flex-start; gap: 6px; max-width: 92%; min-width: 0; }
.chat-line > .chat-bubble { max-width: none; min-width: 0; }
.chat-ava.dm-ava { width: 26px; height: 26px; font-size: 11px; cursor: pointer; padding: 0; margin-top: 2px; font-family: inherit; }
.chat-ava.dm-ava:hover { filter: brightness(1.2); }
/* Упомянули игрока — пузырь подсвечен. */
.chat-bubble-mention {
  background: rgba(255, 179, 0, 0.12) !important;
  border-color: rgba(255, 179, 0, 0.55) !important;
  box-shadow: inset 3px 0 0 rgba(255, 179, 0, 0.85);
}
/* Разделитель «Непрочитанное». */
.chat-unread-divider {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
  color: #ff8a80; font-size: 11px; font-weight: 800; letter-spacing: .02em;
}
.chat-unread-divider::before, .chat-unread-divider::after {
  content: ''; flex: 1; height: 1px; background: rgba(255, 138, 128, 0.45);
}
/* Кнопка «вниз» над полосой ввода: лента прокручена вверх; число — новых с тех пор. */
.chat-jump {
  position: absolute; right: 14px; bottom: 92px; z-index: 3;
  display: inline-flex; align-items: center; gap: 4px;
  height: 32px; min-width: 32px; padding: 0 10px; border-radius: 16px;
  background: rgba(var(--accent-strong-rgb), 0.92); color: #fff;
  border: 1px solid rgba(var(--accent-dark-rgb), 0.9);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  font-weight: 700; font-size: 12px; line-height: 1; font-family: inherit; cursor: pointer;
}
.chat-jump[hidden] { display: none; }
.chat-jump-n:empty { display: none; }
.chat-dm-noinput .chat-jump { bottom: 14px; }
.chat-bubble-other {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 14px 14px 14px 4px;
}
.chat-bubble-user { color: var(--accent-dark); font-size: 11px; font-weight: 800; margin-bottom: 2px; }
/* Ник автора кликабелен (вставка @ник в поле ввода) — только у чужих
   сообщений: у своих ник не рендерится вовсе. */
.chat-author { cursor: pointer; width: fit-content; }
.chat-author:hover { text-decoration: underline; filter: brightness(1.2); }
/* pre-wrap живёт ТОЛЬКО на тексте (внутри — экранированный текст плюс
   инлайн-иконки !N, чья разметка эмитится одной строкой без whitespace).
   На контейнере .chat-bubble pre-wrap отображал бы отступы самого
   HTML-шаблона как пустые строки и раздувал баббл. */
.chat-bubble-text {
  color: rgba(255, 255, 255, 0.92); font-size: 13.5px; line-height: 1.45;
  white-space: pre-wrap;
  /* Высоту НЕ ограничиваем (2026-09-29): max-height 8.7em (6 строк) на ширине
     панели 340px резал 200-символьное сообщение на ~150–180 символах. От спама
     переводами строк защищает renderChatText (склеивает \n в пробел). */
}
.chat-bubble-time { font-size: 10px; color: rgba(255, 255, 255, 0.40); margin-top: 3px; text-align: right; }

/* Инлайн-иконка покемона из !N — клик → детальная покедекса. 28px, а не
   ~1.35em: у dex-спрайта прозрачные поля вокруг арта, em-размер выглядел
   крошечным. Отрицательные вертикальные margin гасят вклад в line-box —
   иконка крупная, но строку не распирает. */
.chat-poke { display: inline-block; cursor: pointer; text-decoration: none; }
.chat-poke-img {
  height: 34px; width: auto;
  vertical-align: middle; margin: -10px 0;
  transition: transform 0.15s ease;
}
.chat-poke:hover .chat-poke-img { transform: scale(1.2); }

/* Тег игрока @ник — клик открывает модалку профиля (резолв по клику). */
.chat-mention {
  color: var(--accent-dark); font-weight: 700; cursor: pointer;
  background: rgba(var(--accent-dark-rgb), 0.14);
  border-radius: 6px; padding: 0 3px;
  transition: background 0.15s;
}
.chat-mention:hover { background: rgba(var(--accent-dark-rgb), 0.26); text-decoration: underline; }

/* ── М3: модерация в чате ─────────────────────────────────────────────────── */
/* Цвет ника по роли автора (authorRole штампует сервер): красный админ,
   синий модератор; обычный игрок остаётся #8A7CFF (.chat-bubble-user). */
.chat-author-admin  { color: var(--role-admin); }
.chat-author-mod    { color: var(--role-mod); }
.chat-author-mentor { color: var(--role-mentor); }
.chat-author-jester { color: var(--role-jester); }
.chat-author-curator { color: var(--role-curator); }
.chat-author-gymleader { color: var(--role-gymleader); }
/* Титул рядом с ником (штамп authorTitle; «Тот, кому ответила река»). Цвет ника не трогает:
   цвет — это должность, титул — заслуга, и смешивать их нельзя. */
.chat-author-title { margin-left: 6px; font-size: 10px; font-weight: 600; color: #7dd3fc; opacity: .9; letter-spacing: .01em; }
.chat-author-title::before { content: '· '; color: rgba(255,255,255,.35); }
/* Клановый канал: роль и титул в клане у ника автора (штамп сервера) */
.chat-clan-role { margin-left: 6px; padding: 0 6px; border-radius: 999px; font-size: 10px; font-weight: 700; line-height: 16px;
  background: rgba(255,255,255,.12); color: rgba(255,255,255,.75); }
.chat-clan-role-founder { background: rgba(250, 204, 21, .22); color: #fde68a; }
.chat-clan-role-leader  { background: rgba(138, 124, 255, .28); color: #c4b5fd; }
.chat-clan-title { margin-left: 6px; font-size: 10px; font-weight: 600; color: #7dd3fc; }
.chat-clan-title::before { content: '· '; color: rgba(255,255,255,.35); }
.prof-title { margin-top: 2px; font-size: 12px; font-weight: 600; color: #7dd3fc; text-shadow: 0 1px 4px rgba(0,0,0,.5); }
.trainers-title { font-size: 11px; font-weight: 600; color: #0284c7; margin-top: 1px; }

/* Кнопка удаления — рендерится только staff (видимость), право — сервер.
   Полупрозрачна всегда (на таче hover нет), ярче при наведении. */
.chat-del-btn {
  position: absolute; top: -7px; right: -7px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #2a3150; border: 1px solid rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.8); font-size: 10px; line-height: 1;
  cursor: pointer; opacity: 0.4; transition: opacity .15s, background .15s;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.chat-bubble:hover .chat-del-btn, .chat-del-btn:hover { opacity: 1; }
.chat-del-btn.chat-del-armed {
  width: auto; padding: 0 8px; border-radius: 999px; opacity: 1;
  background: #c0392b; border-color: #e74c3c; color: #fff;
  font-size: 10.5px; font-weight: 700; white-space: nowrap;
}
.chat-del-btn:disabled { opacity: 0.5; cursor: wait; }

/* Объявления модерации в ленте (modAnnounce штампует сервер):
   предупреждение — оранжевая подсветка, мьют — красная. Идут ПОСЛЕ базовых
   .chat-bubble-me/-other — при равной специфичности побеждает порядок. */
.chat-bubble-announce-warn {
  background: rgba(255, 152, 0, 0.14);
  border-color: rgba(255, 152, 0, 0.5);
}
.chat-bubble-announce-mute {
  background: rgba(244, 67, 54, 0.14);
  border-color: rgba(244, 67, 54, 0.55);
}

/* Плейсхолдер удалённого модерацией сообщения — приглушённый, без контента. */
.chat-bubble-deleted {
  font-size: 12px; font-style: italic;
  color: rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.03) !important;
  border-style: dashed !important;
}

.chat-input-area {
  border-top: 1px solid rgba(255, 255, 255, 0.12); padding: 12px; flex-shrink: 0;
  background: rgba(18, 22, 38, 0.45);
}
.chat-input-row-new { display: flex; gap: 8px; }

/* ── Стикеры (20.11) ── кнопка у поля, панель над полосой ввода, блок в пузыре. */
.chat-input-area { position: relative; }
.chat-sticker-btn {
  align-self: flex-end; flex-shrink: 0; width: 42px; height: 42px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.06); color: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 50%;
  cursor: pointer; transition: background 0.15s, color 0.15s;
}
.chat-sticker-btn:hover, .chat-sticker-btn[aria-expanded="true"] { background: rgba(var(--accent-dark-rgb), 0.22); color: #fff; }
.chat-sticker-btn:focus-visible { outline: 2px solid rgba(var(--accent-dark-rgb), 0.9); outline-offset: 2px; }
.chat-sticker-btn[hidden] { display: none; }
.chat-sticker-pop {
  position: absolute; left: 8px; right: 8px; bottom: calc(100% + 6px); z-index: 5;
  max-height: min(52vh, 420px); overflow-y: auto; overscroll-behavior: contain;
  padding: 10px; border-radius: 14px;
  background: #161c30; border: 1px solid rgba(120, 140, 200, 0.28);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.45);
}
.chat-sticker-pop[hidden] { display: none; }
.chat-sticker-pack + .chat-sticker-pack, .chat-sticker-shop { margin-top: 12px; }
.chat-sticker-pack-title { margin: 0 0 6px; font-size: 12px; font-weight: 700; color: rgba(255, 255, 255, 0.62); }
/* Телефон и узкая панель — четыре в ряд; широкая панель — шесть. */
.chat-sticker-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
@container (min-width: 480px) { .chat-sticker-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.chat-sticker-tile {
  aspect-ratio: 1; padding: 4px; border-radius: 10px; cursor: pointer;
  background: rgba(255, 255, 255, 0.04); border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}
.chat-sticker-tile:hover, .chat-sticker-tile:focus-visible { background: rgba(var(--accent-dark-rgb), 0.18); border-color: rgba(var(--accent-dark-rgb), 0.5); outline: none; }
.chat-sticker-tile img { width: 100%; height: 100%; object-fit: contain; display: block; }
.chat-sticker-offer { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); }
.chat-sticker-offer + .chat-sticker-offer { margin-top: 6px; }
.chat-sticker-offer img { width: 48px; height: 48px; object-fit: contain; flex-shrink: 0; }
.chat-sticker-offer-text { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: #eaf0fb; }
.chat-sticker-offer-text span { color: rgba(255, 255, 255, 0.55); }
/* Пузырь со стикером: без заливки и рамки — картинка отдельным блоком, не в строке текста. */
.chat-bubble.chat-bubble-has-sticker { background: transparent; border-color: transparent; padding: 4px 4px 2px; }
.chat-bubble-sticker { line-height: 0; }
.chat-sticker-img { width: 96px; height: 96px; object-fit: contain; display: block; }
@container (min-width: 420px) { .chat-sticker-img { width: 120px; height: 120px; } }
.chat-input-field {
  flex: 1; min-width: 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 14px; font-family: inherit;
  outline: none;
  /* textarea (05.11, Shift+Enter): одна строка, растёт до ~5 строк (ui/chat.js autosizeInput). */
  resize: none; line-height: 20px; height: 42px; min-height: 42px; max-height: 120px;
  overflow-y: auto; display: block; box-sizing: border-box;
  transition: border-color 0.15s, background 0.15s;
}
.chat-input-field::placeholder { color: rgba(255, 255, 255, 0.42); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }   /* textarea: подсказка в одну строку */
.chat-input-field:focus { border-color: rgba(var(--accent-dark-rgb), 0.8); background: rgba(255, 255, 255, 0.09); }
.chat-send-btn {
  align-self: flex-end; height: 42px;
  background: var(--accent-strong); color: #fff;
  border: none; border-radius: 50px;
  padding: 10px 20px; font-weight: 700;
  cursor: pointer; font-size: 14px; font-family: inherit;
  transition: background 0.15s, opacity 0.15s;
}
.chat-send-btn:hover:not(:disabled) { background: #6d6dff; }
.chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-char-count {
  text-align: right; font-size: 11px; color: rgba(255, 255, 255, 0.40); margin-top: 4px;
}
.chat-char-count.chat-char-warn { color: #ff6b6b; }

/* Тост об отказе сервера (rate_limited / bad_text / …) — внутри панели. */
.chat-toast {
  position: absolute; left: 50%; bottom: 86px; transform: translateX(-50%) translateY(8px);
  background: #1c2540; color: #eaf0fb; border: 1px solid rgba(120, 140, 200, 0.28);
  padding: 9px 14px; border-radius: 12px; font-size: 12.5px; font-weight: 600;
  max-width: 88%; text-align: center; opacity: 0; pointer-events: none;
  transition: opacity .18s, transform .18s; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}
.chat-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.chat-unread-badge {
  position: absolute; top: -2px; right: -2px;
  background: #f44336; color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}

/* ── ЛС (личные сообщения) — вкладка «ЛС» в чат-панели ─────────────────────── */

/* Счётчик непрочитанных ЛС на вкладке — красный, в отличие от серого note. */
/* В вертикальной полосе бейдж висит в углу кнопки: в строку рядом с подписью
   он не влезал бы (ширина 68px), а перенос раздувал бы высоту вкладки. */
.chat-chan-mention {
  position: absolute; top: -5px; left: -3px;
  font-size: 9px; font-weight: 800; line-height: 14px;
  background: #ffb300; color: #1b1300;
  border-radius: 999px; padding: 0 4px; min-width: 14px; text-align: center;
  box-shadow: 0 0 0 2px rgba(var(--bg-glass-rgb), 0.95);
}
.chat-chan-unread {
  position: absolute; top: -5px; right: -3px;
  font-size: 9px; font-weight: 800; line-height: 14px;
  background: #f44336; color: #fff;
  border-radius: 999px; padding: 0 4px; min-width: 14px; text-align: center;
  box-shadow: 0 0 0 2px rgba(var(--bg-glass-rgb), 0.95);
}

/* Список диалогов: писать некому — полоса ввода скрыта (класс вешает/снимает
   enterDmMode/openDmDialog в js/ui/chat.js). */
.chat-panel.chat-dm-noinput .chat-input-area { display: none; }

/* Шапка открытого диалога — между шапкой панели и лентой. */
.dm-dialog-head {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(18, 22, 38, 0.35);
}
.dm-back-btn {
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.85); width: 30px; height: 30px; border-radius: 8px;
  font-size: 16px; line-height: 1; cursor: pointer; flex-shrink: 0;
  transition: background .15s;
}
.dm-back-btn:hover { background: rgba(255, 255, 255, 0.12); }
.dm-head-name {
  background: none; border: none; padding: 0; cursor: pointer;
  color: #fff; font-size: 14px; font-weight: 800; font-family: inherit;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.dm-head-name:hover { text-decoration: underline; color: var(--accent-dark); }

/* «Решено» — снять обращение с очереди наставников. Прижата вправо (`margin-left:auto`),
   потому что ник между аватаром и ею тянется и обрезается многоточием: кнопка обязана
   остаться видимой при любом нике, включая длинный. Шапку делим с ЛС — там её прячет
   `display:none` из разметки, поднимает только открытие ЧУЖОГО треда. */
.help-close-btn {
  margin-left: auto; flex-shrink: 0;
  background: rgba(var(--accent-dark-rgb), 0.16); border: 1px solid rgba(var(--accent-dark-rgb), 0.34);
  color: #cfc8ff; font-family: inherit; font-size: 12px; font-weight: 700;
  padding: 5px 11px; border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.help-close-btn:hover:not(:disabled) { background: rgba(var(--accent-dark-rgb), 0.28); color: #fff; }
.help-close-btn:disabled { opacity: .55; cursor: default; }

/* Аватар собеседника — общий для списка и шапки: картинка или буква-заглушка. */
.dm-ava {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: rgba(var(--accent-dark-rgb), 0.22); border: 1px solid rgba(var(--accent-dark-rgb), 0.30);
  display: inline-flex; align-items: center; justify-content: center;
  color: #cfc8ff; font-weight: 800; font-size: 14px;
  overflow: hidden;
}
.dm-ava img { width: 100%; height: 100%; object-fit: cover; }
.dm-dialog-head .dm-ava { width: 28px; height: 28px; font-size: 12px; cursor: pointer; }

/* Строка диалога в списке. <button> — фокус и Enter бесплатно. */
.dm-conv {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 12px; padding: 9px 11px;
  cursor: pointer; text-align: left; font-family: inherit;
  transition: background .15s, border-color .15s;
}
.dm-conv:hover { background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.18); }
.dm-conv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dm-conv-name {
  color: #fff; font-size: 13px; font-weight: 800;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Должность собеседника — тот же цвет, что у ника в шапке, чате и списках.
   У шапки диалога перекрываем и :hover, иначе он вернул бы общий #8A7CFF. */
.dm-conv-name.role-admin,
.dm-head-name.role-admin,
.dm-head-name.role-admin:hover { color: var(--role-admin); }
.dm-conv-name.role-mod,
.dm-head-name.role-mod,
.dm-head-name.role-mod:hover   { color: var(--role-mod); }
.dm-conv-name.role-mentor,
.dm-head-name.role-mentor,
.dm-head-name.role-mentor:hover { color: var(--role-mentor); }
.dm-conv-name.role-jester,
.dm-head-name.role-jester,
.dm-head-name.role-jester:hover { color: var(--role-jester); }
.dm-conv-name.role-curator,
.dm-head-name.role-curator,
.dm-head-name.role-curator:hover { color: var(--role-curator); }
.dm-conv-name.role-gymleader,
.dm-head-name.role-gymleader,
.dm-head-name.role-gymleader:hover { color: var(--role-gymleader); }

.dm-conv-preview {
  color: rgba(255, 255, 255, 0.55); font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dm-conv-unread .dm-conv-preview { color: rgba(255, 255, 255, 0.88); font-weight: 600; }
.dm-conv-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.dm-conv-time { font-size: 10px; color: rgba(255, 255, 255, 0.40); white-space: nowrap; }
.dm-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #f44336; box-shadow: 0 0 6px rgba(244, 67, 54, 0.6);
}

/* Подсказка под пустым списком («написать можно из профиля» — Э4). */
.dm-hint { margin-top: 8px; font-size: 12px; color: rgba(255, 255, 255, 0.38); font-style: normal; }

/* ── Egg card styles (inventory Eggs tab) ──────────────────────────────────── */
.egg-card {
  display: flex;
  gap: 14px;
  background: #FFF8E1;
  border: 2px solid #F9A825;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 10px;
}
.egg-card-ready {
  border-color: #4CAF50;
  background: #E8F5E9;
}
.egg-card-img { width: 64px; height: 64px; object-fit: contain; }
.egg-card-emoji { font-size: 2.5rem; }
.egg-card-info { flex: 1; min-width: 0; }
.egg-card-title { font-weight: 700; font-size: 1rem; color: #333; }
.egg-card-sub { color: #999; font-size: 0.85rem; font-style: italic; }
.egg-card-date { color: #888; font-size: 0.8rem; margin-top: 4px; }
.egg-card-countdown { font-weight: 600; font-size: 0.85rem; margin-top: 6px; color: #E65100; }
.egg-card-countdown.egg-ready { color: #2E7D32; animation: pulse 1.5s infinite; }
.egg-progress-track {
  margin-top: 6px;
  height: 8px;
  background: #eee;
  border-radius: 4px;
  overflow: hidden;
}
.egg-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #F9A825, #FF8F00);
  border-radius: 4px;
  transition: width 0.3s;
}
.egg-card-note { font-size: 0.75rem; color: #666; margin-top: 4px; font-style: italic; }

/* ── Egg hatch modal ───────────────────────────────────────────────────────── */
.egg-hatch-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.egg-hatch-modal {
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.3);
  padding: 32px;
  max-width: 380px;
  width: 90%;
  text-align: center;
}
.egg-hatch-header {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 18px;
  color: #333;
}
.egg-hatch-modal-shiny {
  background: linear-gradient(160deg, #fffaf0, #fff5d6);
  box-shadow: 0 12px 48px rgba(214, 168, 24, 0.45),
              0 0 0 2px rgba(255, 200, 40, 0.6);
}
.egg-hatch-shiny {
  font-size: 1.05rem;
  font-weight: 800;
  color: #b8860b;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
  text-shadow: 0 0 6px rgba(255, 200, 40, 0.6);
  animation: shinyTwinkle 1.8s ease-in-out infinite;
}
.egg-hatch-reveal { margin-bottom: 16px; }
.egg-hatch-img { width: 80px; height: 80px; object-fit: contain; margin-bottom: 8px; }
.egg-hatch-emoji { font-size: 3.5rem; display: block; margin-bottom: 8px; }
.egg-hatch-species {
  font-size: 1.5rem;
  font-weight: 800;
  color: #4527A0;
  animation: eggReveal 0.8s ease-out;
}
@keyframes eggReveal {
  0%   { opacity: 0; transform: scale(0.5); }
  60%  { transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1); }
}
.egg-hatch-stats {
  background: #F5F5F5;
  border-radius: 12px;
  padding: 10px 16px;
  margin-bottom: 14px;
  font-size: 0.85rem;
  color: #555;
  line-height: 1.6;
}
.egg-hatch-message {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 18px;
  line-height: 1.4;
}
.egg-hatch-btn {
  background: #7C4DFF;
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 10px 32px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s;
}
.egg-hatch-btn:hover { background: #651FFF; }

/* ── EV Distribution Modal overlay ─────────────────────────────────────────── */
.ev-overlay {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 11000;
  padding: 16px;
}
.ev-overlay.open {
  display: flex;
}

.ev-modal {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.25);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ev-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}
.ev-modal-sprite {
  width: 56px;
  height: 56px;
  image-rendering: pixelated;
  flex-shrink: 0;
}
.ev-modal-title {
  flex: 1;
}
.ev-modal-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: #222;
}
.ev-modal-sub {
  font-size: 0.72rem;
  color: #888;
  margin-top: 2px;
}
.ev-close-btn {
  position: absolute;
  top: 0;
  right: 0;
  background: none;
  border: none;
  font-size: 1rem;
  color: #999;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
.ev-close-btn:hover { color: #333; }

/* Points summary row */
.ev-points-row {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #E3F2FD;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.78rem;
  flex-wrap: wrap;
}
.ev-points-label { color: #555; }
.ev-points-val   { font-weight: 700; color: #1565C0; font-size: 0.92rem; }
.ev-points-sep   { color: #aaa; }
.ev-total-label  { color: #555; }
.ev-total-val    { font-weight: 700; color: #333; }
.ev-total-max    { color: #888; }

/* Подпись о бюджете 594: ставка за уровень + остаток. Спокойный тон, пока запас есть;
   янтарный — когда предел выбран и очки больше не капают. */
.ev-budget-note {
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #F5F5F5;
  color: #666;
  font-size: 0.72rem;
  line-height: 1.35;
}
.ev-budget-note.ev-budget-full {
  background: #FFF3E0;
  color: #A15C00;
  font-weight: 600;
}

/* Per-stat rows */
.ev-stats-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ev-stat-row {
  margin-bottom: 10px;
}
.ev-stat-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}
.ev-stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #444;
  width: 80px;
}
.ev-stat-current {
  font-size: 0.72rem;
  font-weight: 700;
  color: #1565C0;
}
.ev-stat-preview {
  font-size: 0.7rem;
  color: #888;
  margin-left: auto;
  min-width: 28px;
}
.ev-slider-desktop {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  margin: 4px 0;
  /* Three segments: the vitamin floor (lighter tint, can't be dragged away), then the battle
     EV the player is editing, then the empty remainder. --vit ≤ --fill always. */
  background: linear-gradient(to right,
    var(--ev-color-vit, var(--ev-color)) 0%, var(--ev-color-vit, var(--ev-color)) var(--vit,0%),
    var(--ev-color) var(--vit,0%), var(--ev-color) var(--fill,0%),
    #eee var(--fill,0%), #eee 100%);
}
.ev-slider-desktop::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 2.5px solid var(--ev-color);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15); cursor: grab;
}
.ev-slider-desktop::-webkit-slider-thumb:active { transform: scale(1.15); cursor: grabbing; }
.ev-slider-desktop::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 2.5px solid var(--ev-color);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* Footer buttons */
.ev-modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 4px;
}
.ev-btn {
  padding: 8px 20px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
}
.ev-btn:hover:not(:disabled) { opacity: 0.85; }
.ev-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ev-btn-cancel {
  background: #f0f0f0;
  color: #555;
}
.ev-btn-confirm {
  background: linear-gradient(135deg, #1565C0, #42A5F5);
  color: #fff;
}

/* ── Move Slots (team modal detail) ──────────────────────────────────────── */

.tm-section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  /* The EV budget sits on this row; in a narrow detail panel it must drop to its own
     line instead of overflowing (the panel is flex:1, so its width follows the modal). */
  flex-wrap: wrap;
}

/* EV budget in the desktop detail panel — mirrors the mobile card's .mev-budget
   ("Доступно: N · X/400 · вит. Y/75"). The mobile indicator lives in the pokemon card and
   is styled only inside @media(max-width:768px); the desktop panel had no summary at all,
   so the vitamin total was visible on mobile and nowhere on desktop. */
.tm-ev-budget {
  margin-left: auto;             /* push to the right edge of the section label row */
  display: flex;
  align-items: baseline;
  gap: 2px;
  text-transform: none;          /* the label row is uppercase; numbers/«вит.» must not be */
  letter-spacing: normal;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  color: #aaa;
}
.tm-ev-avail { color: #1976D2; }
.tm-ev-avail strong { font-size: 13px; font-weight: 700; }
.tm-ev-total { color: #aaa; }
/* «предел выбран» — тот же янтарный, что у подписи в модалке EV. */
.tm-ev-full { color: #A15C00; font-weight: 600; }

.tm-new-moves-badge {
  font-size: 0.63rem;
  font-weight: 700;
  color: #2E7D32;
  background: #E8F5E9;
  border-radius: 10px;
  padding: 2px 7px;
  border: 1px solid #A5D6A7;
}

.tm-move-slots {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.tm-move-slot {
  display: flex;
  align-items: center;
  gap: 7px;
  border-radius: 10px;
  padding: 6px 8px;
  min-height: 34px;
  cursor: pointer;
  transition: background 0.12s;
}

.tm-move-slot.filled {
  background: #f8f8f8;
  border: 1.5px solid #eee;
}
.tm-move-slot.filled:hover {
  background: #f0f0f0;
  border-color: #ddd;
}

.tm-move-slot.empty {
  background: transparent;
}

.tm-move-type-badge {
  font-size: 0.58rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 8px;
  border: 1.5px solid transparent;
  flex-shrink: 0;
  color: #444;
  min-width: 44px;
  text-align: center;
  white-space: nowrap;
}
.tm-move-type-unknown {
  background: #f0f0f0;
  border-color: #ccc;
  color: #aaa;
}

.tm-move-slot-name {
  flex: 1;
  font-size: 0.8rem;
  font-weight: 600;
  color: #222;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tm-move-slot-pp {
  font-size: 0.65rem;
  color: #888;
  flex-shrink: 0;
}

.tm-move-remove {
  background: none;
  border: none;
  color: #bbb;
  font-size: 0.72rem;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.12s;
}
.tm-move-remove:hover { color: #e53935; }

.tm-move-learn-btn {
  width: 100%;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1.5px dashed #ccc;
  background: transparent;
  color: #aaa;
  font-size: 0.75rem;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
  text-align: left;
}
.tm-move-learn-btn:hover {
  border-color: #42A5F5;
  color: #1976D2;
}

/* ── Move Selection Modal ────────────────────────────────────────────────── */

.move-overlay {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 12000;
  padding: 16px;
}
.move-overlay.open { display: flex; }

.move-modal {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.25);
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.move-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 18px 12px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 2;
}
.move-modal-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #222;
}
.move-modal-sub {
  font-size: 0.75rem;
  color: #F57C00;
  margin-top: 3px;
}
.move-close-btn {
  background: none;
  border: none;
  font-size: 1rem;
  color: #aaa;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
}
.move-close-btn:hover { color: #333; }

.move-modal-loading {
  padding: 32px;
  text-align: center;
  color: #888;
  font-size: 0.85rem;
}

/* Move list */
.move-list {
  overflow-y: auto;
  padding: 8px 0;
  flex: 1;
}

.move-row {
  display: grid;
  grid-template-columns: 56px 1fr 38px 22px 36px 42px;
  align-items: center;
  gap: 6px;
  padding: 7px 18px;
  cursor: pointer;
  transition: background 0.1s;
}
.move-row:hover:not(.move-row-known) { background: #f5f5f5; }
.move-row-known {
  opacity: 0.45;
  cursor: default;
}
.move-row-known-label {
  font-size: 0.6rem;
  color: #aaa;
  font-style: italic;
}

.move-type-badge {
  font-size: 0.58rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 8px;
  border: 1.5px solid transparent;
  text-align: center;
  color: #444;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 44px;
}

.move-row-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #222;
}
.move-row-lv {
  font-size: 0.65rem;
  color: #aaa;
  text-align: right;
}
.move-row-cat {
  font-size: 0.82rem;
  text-align: center;
}
.move-row-power {
  font-size: 0.72rem;
  color: #555;
  text-align: right;
}
.move-row-info-btn {
  background: none;
  border: none;
  color: #ccc;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
  line-height: 1;
}
.move-row-info-btn:active { color: #4CAF50; }
.move-row-pp {
  font-size: 0.65rem;
  color: #888;
  text-align: right;
}

/* Confirm step */
.move-confirm-box {
  padding: 18px 20px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.move-confirm-move-info {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8f8f8;
  border-radius: 10px;
  padding: 10px 12px;
}
.move-confirm-name {
  font-weight: 700;
  font-size: 0.9rem;
  flex: 1;
}
.move-confirm-cat {
  font-size: 0.72rem;
  color: #666;
}
.move-confirm-stats {
  font-size: 0.68rem;
  color: #888;
}
.move-confirm-desc {
  font-size: 0.8rem;
  color: #666;
  line-height: 1.5;
  margin: 0;
}
.move-confirm-msg {
  font-size: 0.85rem;
  color: #333;
  margin: 0;
}
.move-confirm-warn {
  font-size: 0.75rem;
  color: #F57C00;
  margin: 0;
}

.move-modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 12px 18px 16px;
  border-top: 1px solid #f0f0f0;
  flex-shrink: 0;
}
.move-btn {
  padding: 8px 20px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
}
.move-btn:hover:not(:disabled) { opacity: 0.85; }
.move-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.move-btn-cancel  { background: #f0f0f0; color: #555; }
.move-btn-confirm { background: linear-gradient(135deg, #2E7D32, #66BB6A); color: #fff; }

/* ══════════════════════════════════════════
   INVENTORY MODAL
══════════════════════════════════════════ */

.inv-modal {
  position: relative;
  background: rgba(255,255,255,0.97);
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  width: 1000px;
  max-width: calc(100vw - 32px);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Top bar */
.inv-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}

.inv-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 700;
  color: #222;
}

.inv-money {
  font-size: 1rem;
  font-weight: 700;
  color: #F9A825;
  padding-right: 40px;
}

/* Body */
.inv-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Left column: categories only */
.inv-left {
  width: 210px;
  flex-shrink: 0;
  border-right: 1px solid #eee;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Middle column: search + item grid */
.inv-middle {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #eee;
  overflow: hidden;
}

/* Category tabs */
.inv-category-tabs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 10px 8px;
  flex-shrink: 0;
}

.inv-cat-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border: none;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: #888;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.inv-cat-tab:hover:not(.disabled) { background: #f0f0f0; }
.inv-cat-tab.active {
  background: #e8f5e9;
  color: #2E7D32;
}
.inv-cat-tab.disabled {
  opacity: 0.4;
  cursor: default;
}

.inv-cat-icon     { font-size: 1.1rem; }
.inv-cat-icon-img { width: 22px; height: 22px; object-fit: contain; }
.inv-cat-label { flex: 1; }

/* Search */
.inv-search {
  margin: 0 10px 8px;
  padding: 8px 12px;
  border: 1.5px solid #ddd;
  border-radius: 10px;
  font-size: 0.8rem;
  outline: none;
  flex-shrink: 0;
  transition: border-color 0.15s;
}
.inv-search:focus { border-color: #4CAF50; }

/* Item grid */
.inv-item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  /* The grid is a flex child (flex:1) → its height is DEFINITE, and the cells are
     overflow:hidden → their automatic minimum size is 0. Chrome therefore squeezes the
     auto rows to fit that height instead of scrolling: with a full bag the cards collapse
     (icons cut off, names gone). The old min-height:108px was the prop holding the rows
     open — remove it and the grid folds. `max-content` sizes every row to its content, so
     rows never compress and the grid scrolls; `start` keeps them from ballooning when the
     bag is nearly empty (which is what produced the empty tails under the cards). */
  grid-auto-rows: max-content;
  align-content: start;
  gap: 10px;
  padding: 8px 14px 14px;
  overflow-y: auto;
  flex: 1;
}

.inv-grid-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: #aaa;
  font-size: 0.82rem;
  padding: 24px 0;
}

.inv-item-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Height follows the content. A fixed min-height (was 108px) left an empty tail under
     short items and, worse, leaked into the mobile list rows (which only need ~76px).
     `center` keeps the content centred when the grid stretches a row to match a taller
     neighbour, so a 2-line name never leaves its row-mates top-aligned with a gap. */
  justify-content: center;
  gap: 6px;
  padding: 12px 6px;
  background: #f8f9fa;
  border-radius: 12px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  min-width: 0;
  overflow: hidden;
}
.inv-item-cell:hover {
  border-color: #ccc;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.inv-item-cell.selected {
  border-color: #4CAF50;
  background: #f1f8f1;
}

.inv-item-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}
.inv-item-emoji { font-size: 2rem; line-height: 1; }

.inv-item-name {
  font-size: 0.72rem;
  line-height: 1.3;
  font-weight: 600;
  color: #333;
  text-align: center;
  /* Long Russian item names ("Кнопка катапультирования") don't fit a 96px column, so they
     wrap. With hyphens:none they used to snap mid-word ("катапультиров|ания"); the page is
     lang="ru", so the browser can hyphenate properly instead. break-word stays as the
     last-resort fallback for a word even hyphenation can't place. */
  overflow-wrap: break-word;
  hyphens: auto;
  width: 100%;
  text-wrap: pretty;
}

.inv-item-qty {
  position: absolute;
  top: 5px;
  right: 6px;
  background: #333;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 8px;
}

/* Right: detail panel */
.inv-detail-panel {
  width: 340px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.inv-detail-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #bbb;
  font-size: 0.85rem;
}

.inv-detail-header {
  background: linear-gradient(135deg, #FF8F00, #F9A825);
  border-radius: 0;
  padding: 20px 20px 16px;
  flex-shrink: 0;
}

.inv-detail-hero {
  display: flex;
  align-items: center;
  gap: 14px;
}

.inv-detail-img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}
.inv-detail-emoji { font-size: 4rem; line-height: 1; }

.inv-detail-hero-info { flex: 1; }

.inv-detail-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
}

.inv-detail-qty-text {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.85);
  margin-top: 4px;
}

.inv-detail-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.inv-detail-desc {
  font-size: 0.85rem;
  color: #555;
  line-height: 1.5;
}

.inv-detail-info-text {
  font-size: 0.8rem;
  color: #888;
  font-style: italic;
}

.inv-detail-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── Playable-audio quest items (readable-overlay audio block) ──────────────
   Sits on the dark readable-overlay, directly above the parchment note.
   Palette mirrors the paper note (#fdf6e3 / #8b6d38 / #d4b896) so the player
   reads as part of the same artifact. */
.item-audio-player {
  width: 100%;
  max-width: 340px;
  margin-bottom: 16px;
  padding: 14px 16px;
  background: #fdf6e3;
  border: 1px solid #d4b896;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.item-audio-player audio {
  width: 100%;
  height: 36px;
}
.audio-error {
  font-size: 13px;
  font-style: italic;
  color: #8a3a2a;
  text-align: center;
  padding: 6px 0;
}

/* Page illustration inside the paper-note overlay (readable items, e.g.
   bellsprout_charm). ~68% of the note width, centred, parchment-toned
   frame. onerror hides the <img> so a missing file never breaks the page. */
.item-page-illustration {
  display: block;
  width: 68%;
  max-width: 220px;
  margin: 4px auto 16px;
  border: 1px solid #d4b896;
  border-radius: 3px;
  background: rgba(139, 109, 56, 0.06);
  object-fit: contain;
}

/* ── TM items ───────────────────────────────────────────────────────────── */
.inv-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1.4;
  text-shadow: 0 1px 1px rgba(0,0,0,0.25);
  white-space: nowrap;
}
.inv-item-cell-tm .inv-type-badge {
  margin-top: 4px;
  font-size: 0.62rem;
  padding: 1px 6px;
}
.inv-detail-sub {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 4px 0 6px;
}
.inv-tm-num {
  font-size: 0.75rem;
  color: #888;
  font-weight: 600;
}
.inv-tm-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px;
  background: #f6f7f9;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}
.inv-tm-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.inv-tm-stat-label {
  font-size: 0.68rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.inv-tm-stat-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: #2b2f36;
}

/* Pokemon type colors */
.type-normal   { background: #a8a878; }
.type-fire     { background: #f08030; }
.type-water    { background: #6890f0; }
.type-grass    { background: #78c850; }
.type-electric { background: #f8d030; color: #2b2f36; text-shadow: none; }
.type-ice      { background: #98d8d8; color: #2b2f36; text-shadow: none; }
.type-fighting { background: #c03028; }
.type-poison   { background: #a040a0; }
.type-ground   { background: #e0c068; color: #2b2f36; text-shadow: none; }
.type-flying   { background: #a890f0; }
.type-psychic  { background: #f85888; }
.type-bug      { background: #a8b820; }
.type-rock     { background: #b8a038; }
.type-ghost    { background: #705898; }
.type-dragon   { background: #7038f8; }
.type-dark     { background: #705848; }
.type-steel    { background: #b8b8d0; color: #2b2f36; text-shadow: none; }
.type-fairy    { background: #ee99ac; }

/* Buttons */
.inv-btn {
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
}
.inv-btn:hover:not(:disabled) { opacity: 0.85; }
.inv-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.inv-btn-give   { background: linear-gradient(135deg, #2E7D32, #66BB6A); color: #fff; }
.inv-btn-take   { background: transparent; border: 2px solid #4CAF50; color: #2E7D32; }
.inv-btn-cancel { background: #f0f0f0; color: #555; }
/* Secondary destructive action — sits next to Use/Give. Red outline, slightly
   smaller padding so it reads as the lesser action. Fills red on hover. */
.inv-btn-discard {
  background: transparent;
  border: 2px solid #e05151;
  color: #d23a3a;
  padding: 7px 14px;
}
.inv-btn-discard:hover:not(:disabled) {
  background: #e05151;
  color: #fff;
  opacity: 1;
}

/* Pokémon picker */
.inv-picker-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #444;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.inv-picker-loading,
.inv-picker-empty {
  font-size: 0.82rem;
  color: #aaa;
  padding: 8px 0;
}

.inv-picker-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inv-picker-row {
  display: grid;
  grid-template-columns: 1fr 50px 1fr;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 10px;
  background: #f8f9fa;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.12s;
}
.inv-picker-row:hover { background: #e8f5e9; }
.inv-picker-row.inv-picker-row-dimmed {
  opacity: 0.4;
  cursor: default;
}
/* Неподходящий для мега-камня: причина обязана читаться, поэтому бледнее, но не 0.4. */
.inv-picker-row.inv-picker-row-blocked { opacity: 0.7; }
.inv-picker-row.inv-picker-row-blocked:hover { background: #f8f9fa; }
.inv-picker-note {
  grid-column: 1 / -1;
  font-size: 0.72rem;
  font-weight: 600;
  color: #b45309;
}

.inv-picker-name { font-weight: 700; color: #222; }
.inv-picker-lv   { color: #888; font-size: 0.72rem; text-align: center; }
.inv-picker-held { color: #555; font-size: 0.72rem; text-align: right; }

/* Confirm box */
.inv-confirm-box {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.inv-confirm-msg {
  font-size: 0.85rem;
  color: #333;
  line-height: 1.5;
}

.inv-confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── Discard modal (amount picker + confirm) ──────────────────────────────
   Standalone centered overlay above the mobile sheet (10501) and stone picker
   (11000), below the toast (12500). Works for desktop + mobile. */
.discard-overlay {
  position: fixed;
  inset: 0;
  z-index: 11500;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: discardOverlayIn 0.18s ease;
}
/* Overlay fades in WITHOUT a transform — it's the flex centering container,
   so any translate on it would shift the centered sheet off-axis (the sheet
   itself carries the pop-in transform below). */
@keyframes discardOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.discard-sheet {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 18px;
  padding: 22px 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  animation: discardSheetIn 0.2s cubic-bezier(0.32,0.72,0,1);
}
@keyframes discardSheetIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.discard-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #1a1a2e;
  margin-bottom: 12px;
}
.discard-confirm-text {
  font-size: 0.9rem;
  color: #444;
  line-height: 1.55;
  margin: 0 0 18px;
}
.discard-have {
  font-size: 0.85rem;
  color: #777;
  margin-bottom: 14px;
}
.discard-amount-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 8px;
}
.discard-slider {
  width: 100%;
  accent-color: #e05151;
  margin: 0 0 14px;
}
.discard-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}
.discard-step-btn {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: 1px solid #ddd;
  border-radius: 10px;
  background: #f7f7f9;
  font-size: 1.2rem;
  font-weight: 700;
  color: #444;
  cursor: pointer;
  line-height: 1;
}
.discard-step-btn:hover { background: #efeff2; }
.discard-input {
  flex: 1;
  min-width: 0;
  height: 38px;
  text-align: center;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  color: #1a1a2e;
  -moz-appearance: textfield;
}
.discard-input::-webkit-outer-spin-button,
.discard-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.discard-all-btn {
  flex-shrink: 0;
  height: 38px;
  padding: 0 14px;
  border: 1px solid #e05151;
  border-radius: 10px;
  background: transparent;
  color: #d23a3a;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}
.discard-all-btn:hover { background: #fdeaea; }
.discard-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.discard-actions .inv-btn { min-width: 96px; }

/* Unequip confirmation panel (inline in detail panel) */
.tm-unequip-confirm {
  background: #fff8f8;
  border: 1px solid #ffd0cc;
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tm-unequip-msg {
  font-size: 0.72rem;
  color: #333;
  line-height: 1.4;
}
.tm-unequip-sub {
  margin-top: 4px;
  font-size: 0.65rem;
  color: #999;
}
.tm-unequip-actions {
  display: flex;
  gap: 6px;
}
.tm-unequip-btn-cancel {
  font-size: 0.7rem;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
  background: #fff;
  color: #555;
  cursor: pointer;
}
.tm-unequip-btn-remove {
  font-size: 0.7rem;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid #f44336;
  background: #fff;
  color: #f44336;
  cursor: pointer;
  font-weight: 600;
}
.tm-unequip-btn-remove:hover { background: #fff5f5; }
.tm-unequip-btn-remove:disabled { opacity: 0.5; cursor: default; }

/* Held item icon on team card (bottom-left of sprite area) */
.tm-held-icon {
  position: absolute;
  bottom: 6px;
  left: 6px;
  width: 22px;
  height: 22px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
  z-index: 2;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
}
.tm-held-icon:hover {
  opacity: 0.8;
  transform: scale(0.97);
}
.tm-held-icon-emoji {
  font-size: 1rem;
  line-height: 22px;
  display: block;
}

/* ══════════════════════════════════════════════════════════════════════════════
   MOBILE LAYOUT (< 768px)
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── Panel handle (hidden on desktop) ── */
.loc-panel-handle { display: none; }
.mobile-nav { display: none; }
.mobile-hunt-fab { display: none; }

@media (max-width: 768px) {
  /* ── Hide desktop elements ── */
  .sidebar-wrapper { display: none !important; }
  .sidebar-toggle { display: none !important; }
  :root { --header-h: 40px; }
  .g-header { padding: 0 10px 0 12px; gap: 8px; }
  .g-header-mark { width: 28px; height: 28px; margin-right: 6px; }
  .g-header-title { font-size: 15px; }
  .g-header-status { padding: 2px 9px 2px 2px; gap: 7px; max-width: 42vw; }
  .g-header-gems { padding: 2px 8px 2px 4px; gap: 4px; font-size: 13px; }
  .g-gems-icon { width: 20px; height: 20px; }
  /* Пасс на телефоне — та же пилюля, только уже: в правом кластере их теперь ТРИ
     (пасс · самоцветы · я), и лишние 10 px каждой съедают ник целиком. */
  .g-header-pass { padding: 2px 8px 2px 3px; gap: 3px; font-size: 13px; }
  .g-pass-icon { width: 20px; height: 20px; }
  .g-pass-dot { width: 8px; height: 8px; top: -1px; right: -1px; }
  .g-header-events { width: 28px; height: 28px; }
  .g-header-events svg { width: 17px; height: 17px; }
  .g-events-dot { width: 8px; height: 8px; top: -1px; right: -1px; }
  .panel-toggle { display: none; }

  /* ── Main area ── */
  .g-body { top: 0; }
  .g-main { padding-bottom: 64px; }

  /* ── Location panel — bottom sheet ── */
  .location-panel {
    position: fixed !important;
    top: auto !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 64px !important;
    width: 100% !important;
    max-width: 100% !important;
    transform: translateY(var(--collapsed-offset, calc(100% - 160px))) !important;
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1) !important;
    border-radius: 20px 20px 0 0 !important;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.2) !important;
    z-index: 400 !important;
    max-height: 80vh;
    overflow-y: auto;
    padding-bottom: 16px;
  }
  .location-panel.hidden {
    transform: translateY(100%) !important;
  }
  .location-panel.mob-expanded {
    transform: translateY(0) !important;
  }

  /* Collapsed: hide everything except handle, name, badge, description */
  .location-panel:not(.mob-expanded) .loc-body,
  .location-panel:not(.mob-expanded) .loc-wild,
  .location-panel:not(.mob-expanded) .players-block {
    display: none !important;
  }

  /* ── Drag handle ── */
  .loc-panel-handle {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 16px 4px;
    cursor: pointer;
    user-select: none;
  }
  .handle-bar {
    width: 40px;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
  }

  /* ── Bottom navigation ── */
  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 64px;
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
    z-index: 600;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
    overflow: hidden;
  }
  .mobile-nav-scroll {
    display: flex; align-items: center;
    overflow-x: auto; overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    width: 100%; height: 100%;
    padding: 0 2px;
  }
  .mobile-nav-scroll::-webkit-scrollbar { display: none; }
  .mobile-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 0;
    border-radius: 12px;
    position: relative;
    color: #888;
    transition: color 0.15s;
    /* ⚠️ 20vw, а не 25vw: при четвёртой части экрана «Охота» стояла ЧЕТВЁРТОЙ, то есть
       ровно на границе видимости, и её же правый край накрывал градиент .nav-scroll-hint.
       Панель шире экрана втрое (14 кнопок), позиция прокрутки держится всю сессию — стоило
       браузеру доскроллить до «Чата» или «Форума», и главное действие игры уезжало за край
       без подсказки, что оно там. Пятой кнопкой запас появился: «Охота» больше не крайняя
       и под градиент не попадает. Порядок в DOM трогать не надо — он уже правился ради
       этого в 392c6d9. */
    min-width: calc(20vw - 2px);
    max-width: calc(20vw - 2px);
    flex-shrink: 0;
    scroll-snap-align: start;
  }
  .mobile-nav-btn svg { width: 22px; height: 22px; }
  .mobile-nav-btn img { flex-shrink: 0; }
  .mobile-nav-btn span { font-size: 10px; font-weight: 600; white-space: nowrap; }
  .mobile-nav-btn:active { transform: scale(0.92); }
  .mobile-nav-btn.active { color: #4CAF50; }
  .mob-hunt-active {
    color: #fff !important;
    background: linear-gradient(135deg, #FF6B35, #FF4500) !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 12px rgba(255,69,0,0.4) !important;
    animation: huntPulse 2s ease infinite;
  }
  .mobile-nav-admin:active { color: #f44336; }
  .mobile-nav-logout:active { color: #f44336; }
  .nav-scroll-hint {
    position: absolute; right: 0; top: 0; bottom: 0; width: 28px;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.9));
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; color: #ccc; pointer-events: none;
    transition: opacity 0.2s;
  }
  .nav-scroll-hint.hidden { opacity: 0; }
  .mobile-nav-badge {
    position: absolute;
    top: 6px; right: calc(50% - 16px);
    width: 8px; height: 8px;
    background: #f44336;
    border-radius: 50%;
    display: none;
  }
  .mobile-nav-badge.visible { display: block; }

  /* ── Hunt FAB ── */
  .mobile-hunt-fab {
    display: flex;
    position: fixed;
    bottom: 140px;
    right: 16px;
    width: 52px; height: 52px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    z-index: 500;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    font-size: 22px;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.92);
    transition: all 0.2s;
  }
  .mobile-hunt-fab.hunting {
    background: linear-gradient(135deg, #FF6B35, #FF4500);
    box-shadow: 0 4px 20px rgba(255,69,0,0.4);
    animation: huntPulse 2s ease infinite;
  }

  /* ── Modals — slide from bottom ── */
  .modal-overlay {
    align-items: flex-end !important;
  }
  .team-modal,
  .profile-modal {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 90vh !important;
    border-radius: 20px 20px 0 0 !important;
    margin: 0 !important;
  }

  /* ── Mobile team modal ── */
  .team-modal {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 100vh !important;
    max-height: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }
  #team-overlay {
    align-items: flex-start !important;
    padding: 0 !important;
    overflow-y: auto !important;
  }
  .tm-body { flex-direction: column !important; overflow-y: auto !important; flex: 1 !important; }
  .tm-header { flex-shrink: 0; }
  .tm-grid { flex: 1 !important; background: #f5f5f5 !important; padding-bottom: 80px !important; overflow: visible !important; }
  .tm-grid {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: unset !important;
    width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 4px 0 !important;
  }
  .tm-detail-panel { display: none !important; }
  /* Hide desktop cards on mobile — mobile renderer creates .mob-poke-card instead */
  .tm-card { display: none !important; }

  .mob-back-btn {
    display: block; background: none; border: 1px solid #ddd; border-radius: 20px;
    padding: 7px 16px; font-size: 14px; color: #555; cursor: pointer;
    margin: 12px 12px 4px;
  }
  .mob-poke-card {
    display: block !important;
    width: calc(100% - 24px) !important;
    background: #fff;
    border-radius: 16px;
    margin: 6px 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: box-shadow 0.2s;
  }
  .mob-poke-card.mob-expanded {
    box-shadow: 0 4px 16px rgba(76,175,80,0.2);
    border: 1.5px solid #4CAF50;
  }
  .mob-poke-card.mob-fainted { opacity: 0.6; }
  .mob-poke-header {
    display: flex; align-items: center; gap: 14px;
    padding: 16px; cursor: pointer;
  }
  .mob-poke-sprite { width: 56px; height: 56px; object-fit: contain; flex-shrink: 0; }
  .mob-poke-info { flex: 1; min-width: 0; }
  .mob-poke-name { font-size: 15px; font-weight: 600; color: #1a1a2e; }
  .mob-lv { font-size: 12px; color: #888; font-weight: 400; }
  .mob-active-badge { color: #FF9800; font-size: 12px; }
  .mob-fainted-badge { color: #f44336; font-size: 12px; margin-left: 4px; }
  .mob-hp-bar { height: 4px; background: #eee; border-radius: 2px; margin-top: 4px; width: 100%; }
  .mob-hp-fill { height: 100%; border-radius: 2px; transition: width 0.3s; }
  .mob-hp-fill.hp-high { background: #4CAF50; }
  .mob-hp-fill.hp-mid { background: #FF9800; }
  .mob-hp-fill.hp-low { background: #f44336; }

  /* Опыт и дружба в карточке команды. На десктопе эти бары живут в правой панели
     детали, а на телефоне её нет — раньше игрок не видел ни того, ни другого. */
  .mob-bars { display: flex; flex-direction: column; gap: 6px; }
  .mob-bar-row { display: flex; align-items: center; gap: 8px; }
  .mob-bar-label {
    font-size: 0.58rem; font-weight: 700; color: #aaa;
    text-transform: uppercase; letter-spacing: 0.04em;
    width: 34px; flex-shrink: 0;
  }
  .mob-bar-heart { color: #ff5e8a; font-size: 0.8rem; text-transform: none; }
  .mob-bar-track { flex: 1; height: 5px; background: #eee; border-radius: 3px; overflow: hidden; }
  .mob-bar-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }
  .mob-exp-fill   { background: linear-gradient(90deg, #66BB6A, #43A047); }
  .mob-happy-fill { background: linear-gradient(90deg, #ff9ec0, #ff5e8a); }
  .mob-bar-val { font-size: 0.58rem; color: #aaa; flex-shrink: 0; min-width: 46px; text-align: right; }
  .mob-bars .tm-pending-evo { margin: 2px 0 0; }
  .mob-expand-arrow {
    font-size: 20px; color: #ccc; transition: transform 0.2s; flex-shrink: 0;
  }

  .mob-poke-details { padding: 0 14px 14px; border-top: 1px solid #f0f0f0; }
  .mob-section { margin-bottom: 14px; }
  .mob-section-label {
    font-size: 10px; font-weight: 700; color: #aaa; letter-spacing: 1px;
    margin-bottom: 6px;
  }
  .mob-stat-row { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
  .mob-stat-name { width: 50px; font-size: 12px; color: #888; }
  .mob-stat-bar { width: 100px; flex-shrink: 0; height: 5px; background: #eee; border-radius: 3px; overflow: hidden; }
  .mob-stat-bar div { height: 100%; border-radius: 3px; }
  .mob-stat-val { width: 28px; font-size: 12px; font-weight: 600; text-align: right; }
  .mob-move-row {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 10px; background: #f8f9fa; border-radius: 8px; margin-bottom: 4px;
  }
  .mob-move-name { flex: 1; font-size: 13px; font-weight: 500; }
  .mob-move-pp { font-size: 11px; color: #888; }
  .mob-no-moves { font-size: 13px; color: #aaa; font-style: italic; }
  .mob-ev-avail {
    font-size: 13px; color: #2196F3; font-weight: 600;
    background: rgba(33,150,243,0.08); padding: 4px 10px; border-radius: 8px;
    display: inline-block;
  }
  .mob-detail-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
  /* Mobile EV inline with sliders */
  .mev-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px;
  }
  .mev-budget { font-size: 12px; color: #aaa; }
  .mev-avail { color: #1976D2; }
  .mev-avail strong { font-size: 14px; }
  .mev-total { font-size: 12px; color: #aaa; }
  .mev-row { margin-bottom: 12px; }
  .mev-row-head { display: flex; justify-content: space-between; margin-bottom: 2px; }
  .mev-name { font-size: 12px; color: #888; font-weight: 600; width: 72px; }
  .mev-stat-val { font-size: 14px; font-weight: 700; color: #1a1a2e; flex: 1; }
  .mev-count { font-size: 11px; color: #aaa; min-width: 48px; text-align: right; }
  .mev-iv {
    font-size: 10px; font-weight: 700; color: #999;
    background: #f0f0f0; border-radius: 8px; padding: 1px 6px;
    margin-right: 8px; align-self: center; white-space: nowrap; flex-shrink: 0;
  }
  .mev-has-ev { font-weight: 600; }
  .mev-save:disabled { opacity: 0.4; }

  .mev-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    margin: 6px 0 0;
    background: linear-gradient(to right, var(--ev-color,#4CAF50) 0%, var(--ev-color,#4CAF50) var(--fill,0%), #eee var(--fill,0%), #eee 100%);
  }
  .mev-row[data-stat="hp"]        .mev-slider { --ev-color: #F44336; }
  .mev-row[data-stat="attack"]    .mev-slider { --ev-color: #FF9800; }
  .mev-row[data-stat="defense"]   .mev-slider { --ev-color: #2196F3; }
  .mev-row[data-stat="spAttack"]  .mev-slider { --ev-color: #9C27B0; }
  .mev-row[data-stat="spDefense"] .mev-slider { --ev-color: #00BCD4; }
  .mev-row[data-stat="speed"]     .mev-slider { --ev-color: #4CAF50; }

  .mev-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px; height: 22px; border-radius: 50%;
    background: #fff; border: 2.5px solid var(--ev-color,#4CAF50);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    cursor: grab;
  }
  .mev-slider::-webkit-slider-thumb:active { transform: scale(1.15); cursor: grabbing; }
  .mev-slider::-moz-range-thumb {
    width: 22px; height: 22px; border-radius: 50%;
    background: #fff; border: 2.5px solid var(--ev-color,#4CAF50);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  }

  .mob-ev-label { font-size: 10px; font-weight: 600; min-width: 40px; text-align: right; margin-left: 4px; }
  .mob-moves-loading { font-size: 13px; color: #aaa; text-align: center; padding: 10px; }
  .mob-move-row {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 12px; background: #f8f9fa; border-radius: 10px; margin-bottom: 5px;
  }
  .mob-move-name { flex: 1; font-size: 14px; font-weight: 500; color: #1a1a2e; }
  .mob-move-pp { font-size: 12px; color: #aaa; white-space: nowrap; }
  .mob-move-empty { justify-content: center; border: 1.5px dashed #eee; background: transparent; }
  .mob-move-empty-text { font-size: 13px; color: #ccc; font-style: italic; }
  .mob-btn-outline {
    display: block; width: 100%; padding: 10px; margin-top: 8px;
    background: none; border: 1.5px solid #ddd; border-radius: 12px;
    font-size: 13px; font-weight: 600; color: #555; cursor: pointer; text-align: center;
  }

  .mob-held-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 12px; background: #f8f9fa; border-radius: 10px;
    font-size: 14px; color: #333;
  }
  .mob-no-item { font-size: 13px; color: #aaa; font-style: italic; }
  .mob-active-notice {
    text-align: center; color: #FF9800; font-size: 14px; font-weight: 600;
    padding: 10px; background: #FFF8E1; border-radius: 10px;
  }

  .mob-empty-slot {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: calc(100% - 24px);
    height: 72px;
    margin: 6px 12px;
    border: 2px dashed #ddd;
    border-radius: 16px;
    background: rgba(255,255,255,0.5);
    color: #ccc;
  }
  .mob-empty-icon { font-size: 24px; font-weight: 300; }
  .mob-empty-text { font-size: 13px; font-weight: 500; }

  .mob-btn-green {
    width: 100%; padding: 11px; background: #4CAF50; color: #fff;
    border: none; border-radius: 12px; font-size: 14px; font-weight: 600; cursor: pointer;
  }
  .mob-btn-danger {
    width: 100%; padding: 11px; background: #fff; color: #f44336;
    border: 1.5px solid #f44336; border-radius: 12px; font-size: 14px; font-weight: 600; cursor: pointer;
  }

  /* ── Mobile profile ── */
  #profile-overlay { align-items: flex-start !important; padding: 0 !important; overflow-y: auto !important; }
  .profile-modal {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 100vh !important;
    max-height: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    overflow-y: auto !important;
    padding-bottom: 80px !important;
    display: block !important;
  }
  .profile-modal .pm-close { display: none !important; }
  .pm-left, .pm-main, .pm-tabs { display: none !important; }
  .mob-only { display: block !important; }
  .desk-only { display: none !important; }

  .mob-prof-hero {
    position: relative;
    width: 100%;
    min-height: 300px;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    color: #fff;
  }
  .mob-prof-hero-bg {
    position: absolute; inset: 0;
    background: linear-gradient(135deg, #1a1a2e, #0f3460);
    background-size: cover; background-position: center;
    transform: scale(1.05);
  }
  .mob-prof-hero-blur {
    position: absolute; inset: 0;
    backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
    background: rgba(0,0,0,0.1);
  }
  .mob-prof-hero-gradient {
    position: absolute; inset: 0;
    background: linear-gradient(to bottom, transparent 0%, transparent 25%, rgba(0,0,0,0.4) 55%, rgba(0,0,0,0.85) 100%);
  }
  .mob-prof-hero-content {
    position: relative; z-index: 2;
    width: 100%; padding: 20px 20px 24px;
    display: flex; flex-direction: column; align-items: center; text-align: center;
  }
  .mob-prof-back {
    position: absolute; top: 14px; left: 14px; z-index: 10;
    background: rgba(0,0,0,0.35); backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff; padding: 7px 14px; border-radius: 20px; font-size: 14px; cursor: pointer;
  }
  .mob-prof-location {
    font-size: 12px; color: rgba(255,255,255,0.9);
    background: rgba(0,0,0,0.3); backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 4px 12px; border-radius: 50px; margin-top: 6px;
  }
  .mob-prof-avatar {
    width: 92px; height: 92px; border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.3);
    overflow: hidden; background: rgba(255,255,255,0.1);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 14px;
  }
  .mob-prof-avatar img { width: 100%; height: 100%; object-fit: cover; }
  .mob-prof-avatar-wrap { position: relative; }
  .mob-prof-avatar-btn {
    position: absolute; bottom: 0; right: -4px;
    width: 30px; height: 30px; border-radius: 50%;
    background: #4CAF50; border: 2px solid #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; cursor: pointer; padding: 0;
  }
  .mob-prof-letter { font-size: 38px; font-weight: 700; color: #fff; }
  .mob-prof-nick { font-size: 22px; font-weight: 700; }
  .mob-prof-rank { font-size: 13px; color: rgba(255,255,255,0.6); margin-top: 2px; }
  .mob-prof-desc { font-size: 13px; color: rgba(255,255,255,0.5); margin-top: 8px; text-align: center; }
  .mob-prof-join { font-size: 12px; color: rgba(255,255,255,0.4); margin-top: 6px; }

  .mob-prof-stats-row {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
    padding: 14px 16px; background: #fff; border-bottom: 1px solid #f0f0f0;
  }
  .mob-prof-stat {
    display: flex; flex-direction: column; align-items: center;
    padding: 10px 4px; background: #f8f9fa; border-radius: 12px;
  }
  .mob-prof-stat-val { font-size: 18px; font-weight: 700; color: #1a1a2e; }
  .mob-prof-stat-lbl { font-size: 10px; color: #aaa; font-weight: 600; text-transform: uppercase; margin-top: 2px; }

  .mob-prof-section {
    background: #fff; margin: 8px 12px; border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05); overflow: hidden;
  }
  .mob-prof-section-title {
    font-size: 11px; font-weight: 700; color: #aaa; letter-spacing: 1px;
    padding: 12px 16px 6px; border-bottom: 1px solid #f5f5f5;
  }

  .mob-prof-active-poke {
    display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  }
  .mob-prof-poke-sprite { width: 64px; height: 64px; object-fit: contain; }
  .mob-prof-poke-name { font-size: 17px; font-weight: 700; color: #1a1a2e; }
  .mob-prof-poke-lv { font-size: 13px; color: #888; }
  .mob-prof-poke-hp { font-size: 13px; color: #4CAF50; font-weight: 600; margin-top: 2px; }

  .mob-prof-quests { padding: 10px 16px; display: flex; flex-direction: column; gap: 10px; }
  .mob-prof-quest { display: flex; align-items: center; gap: 10px; font-size: 14px; }
  .mob-quest-dot { width: 18px; text-align: center; flex-shrink: 0; }
  .mob-prof-quest.done { color: #888; }
  .mob-prof-quest.active { color: #1a1a2e; font-weight: 600; }
  .mob-prof-quest.locked { color: #ccc; }

  .mob-prof-empty { padding: 16px; font-size: 13px; color: #aaa; font-style: italic; text-align: center; }
  .mob-prof-desc-body { padding: 12px 16px; font-size: 14px; color: #333; line-height: 1.5; }
  .mob-prof-fav-toggle {
    display: flex; align-items: center; gap: 4px;
    justify-content: flex-end;
    padding: 6px 16px 12px;
    font-size: 11px; font-weight: 500; color: #888; cursor: pointer;
  }
  .mob-prof-fav-toggle input { width: 14px; height: 14px; accent-color: #4CAF50; }
  .mob-prof-edit-desc-btn {
    float: right; background: none; border: 1px solid #ddd; border-radius: 8px;
    padding: 3px 10px; font-size: 11px; font-weight: 600; color: #555; cursor: pointer;
  }
  .mob-prof-section-title:has(.mob-prof-edit-desc-btn) {
    padding-bottom: 12px;
  }
  .mob-prof-desc-input {
    width: 100%; border: 2px solid #eee; border-radius: 10px; padding: 10px;
    font-size: 14px; resize: vertical; min-height: 60px; outline: none;
    font-family: inherit;
  }
  .mob-prof-desc-input:focus { border-color: #4CAF50; }
  .mob-prof-desc-actions {
    display: flex; align-items: center; gap: 8px; margin-top: 8px;
  }
  .mob-prof-desc-count { font-size: 11px; color: #aaa; flex: 1; }
  .mob-prof-desc-cancel {
    background: none; border: 1px solid #ddd; border-radius: 8px;
    padding: 6px 14px; font-size: 13px; cursor: pointer; color: #666;
  }
  .mob-prof-desc-save {
    background: #4CAF50; color: #fff; border: none; border-radius: 8px;
    padding: 6px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
  }

  .mob-prof-fav-empty {
    display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 20px;
  }
  .mob-prof-fav-set-btn {
    background: #FFB300; color: #fff; border: none; border-radius: 10px;
    padding: 8px 20px; font-size: 13px; font-weight: 600; cursor: pointer; margin-top: 4px;
  }

  /* Favorite picker */
  .fav-picker-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 99999; display: flex; align-items: flex-end;
  }
  .fav-picker-sheet {
    width: 100%; max-height: 70vh; background: #fff;
    border-radius: 20px 20px 0 0; overflow: hidden;
    display: flex; flex-direction: column;
    animation: favSlideUp 0.25s ease;
  }
  @keyframes favSlideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
  .fav-picker-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid #f0f0f0;
    font-size: 16px; font-weight: 700; color: #1a1a2e; flex-shrink: 0;
  }
  .fav-picker-close { background: none; border: none; font-size: 20px; color: #aaa; cursor: pointer; }
  .fav-picker-list { overflow-y: auto; flex: 1; padding: 8px 0; }
  .fav-picker-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px; cursor: pointer; border-bottom: 1px solid #f5f5f5;
    transition: background 0.15s;
  }
  .fav-picker-row:hover { background: #f8f9fa; }
  .fav-picker-row.selected { background: rgba(255,179,0,0.08); }
  .fav-picker-left { display: flex; flex-direction: column; gap: 2px; }
  .fav-picker-name { font-size: 15px; font-weight: 600; color: #1a1a2e; }
  .fav-picker-meta { font-size: 12px; color: #aaa; }
  .fav-picker-star { font-size: 24px; color: #ddd; transition: color 0.2s; }
  .fav-picker-row.selected .fav-picker-star { color: #FFB300; }

  .mob-prof-action {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 14px 16px; border: none; background: none; cursor: pointer;
    font-size: 15px; color: #1a1a2e; text-align: left;
  }

  /* ── Mobile battle ── */
  #battle-overlay {
    padding: 0 !important;
    align-items: stretch !important;
    background: #1a1a2e !important;
  }
  .battle-modal {
    width: 100% !important; max-width: 100% !important;
    height: 100dvh !important; max-height: 100dvh !important;
    border-radius: 0 !important; margin: 0 !important;
    display: flex !important; flex-direction: column !important;
    background: #1a1a2e !important;
    transform: none !important;
  }
  #battle-close-btn {
    position: fixed !important; top: 10px; right: 10px; z-index: 900;
    background: rgba(0,0,0,0.45) !important; color: #fff !important;
    backdrop-filter: blur(6px) !important; -webkit-backdrop-filter: blur(6px) !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    width: 36px !important; height: 36px !important; border-radius: 50% !important;
    font-size: 16px !important;
    display: flex !important; align-items: center !important; justify-content: center !important;
  }
  #battle-close-btn:active { background: rgba(239,68,68,0.5) !important; }

  /* Hide trainer panels */
  .bt-trainer-panel { display: none !important; }

  /* Arena: column layout.
     height:auto обязателен — базовое правило держит .bt-arena на жёстких 280px, и
     без этого поле внутри ужимается, а обёртка нет: логу ничего не достаётся. */
  .bt-arena {
    flex: 0 0 auto !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
  }

  /* Zone 1: Battle field — ГИБКАЯ зона, а не кирпич в 280px.
     Было: height:42vh + max-height:280px + flex-shrink:0. И 42vh там был МЁРТВЫМ
     кодом: содержимое (padding 18 + спрайт врага 120 + margin 30 + ряд игрока 114 =
     282px) само подпирало высоту снизу как автоматический min-height флекс-элемента,
     а max-height подрезал сверху — поле выходило ровно 280px на ЛЮБОМ телефоне: 42%
     большого экрана и 50% короткого, при том что логу оставалось 46px (2.5 строки).
     Плюс те же 280 при содержимом 303 (крупный вид) срезали лапы своему покемону.
     Теперь потолок в dvh (та же единица, что у .battle-modal — vh на iOS считает
     высоту БЕЗ адресной строки и с 100dvh модалки не сходится), пол — 170px, а
     содержимое ужимается вместе с экраном (см. max-height спрайтов ниже). */
  .bt-field {
    width: 100% !important;
    height: auto !important;
    flex: 0 1 auto !important;
    min-height: 170px !important;
    max-height: 38dvh !important;
    padding: 10px 14px 8px !important;
    position: relative !important;
  }

  /* Sprites on field — height-normalized (see desktop rule) */
  .bt-sprite { image-rendering: pixelated !important; width: auto !important; }
  /* Боковой отступ рядам — ЗАПАС ПОД АНИМАЦИЮ, а не косметика. Ряды прижаты к краям
     поля (align-self: flex-end/flex-start), поэтому спрайт всегда упирается в границу
     padding, сколько ему ни ставь max-width — замер до правки давал зазор 0px на
     390/360/320. А fxScene двигает спрайты на 30–60px наружу (отдача от удара, рывок
     к цели), и при overflow:hidden их срезало краем поля. 18px + padding 14 = 32px
     запаса, толчок укладывается. */
  .bt-enemy  { margin-top: 14px !important; padding-right: 18px !important; }
  .bt-player { padding-left: 18px !important; }
  /* Высота в px ставится инлайном по видам (battleUI.spriteHeightPx, мобильная база
     86/78). max-height в dvh — страховка от обрезки на КОРОТКИХ экранах: там 38dvh
     поля меньше, чем сумма двух спрайтов максимального масштаба, и без потолка
     overflow:hidden снова резал бы лапы. width:auto пересчитывается от зажатой
     высоты, пропорции целы (плюс object-fit:contain).
     max-width врага 150 → 128: при padding-right 14 спрайт вставал ВПРИТЫК к краю
     (замер: зазор 0px на 390/360/320), и толчок отдачи от удара (fxScene двигает
     спрайт на 30–60px) уезжал под overflow:hidden — соперник «обрезан справа». */
  .bt-sprite-enemy  { width: auto !important; max-width: 128px !important; max-height: 15dvh !important; }
  .bt-sprite-player { width: auto !important; max-width: 166px !important; max-height: 17dvh !important; }

  /* HP bars overlay style */
  .bt-pokemon-info {
    /* Размытие снято (см. десктопный блок) — телефон и был тем, ради чего снимали. */
    background: rgba(0,0,0,0.78) !important;
    border-radius: 10px !important;
    padding: 6px 10px !important;
  }
  .bt-name { color: #fff !important; font-size: 13px !important; }
  /* Shiny tag readable on the dark mobile info pill (0.6rem gold-on-dark is easy
     to miss otherwise). */
  .bt-shiny { font-size: 11px !important; color: #ffd24a !important; text-shadow: 0 1px 2px rgba(0,0,0,0.85) !important; }
  .bt-hp-fill { height: 5px !important; border-radius: 3px !important; }
  /* Цифры ОЗ на поле: было 10px полупрозрачным белым по полупрозрачной плашке поверх
     яркого фона — на телефоне их не читали. Полный белый, крупнее, с тенью. */
  .bt-hp-val {
    color: #fff !important;
    font-size: 11.5px !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.85) !important;
  }
  .bt-status-badge { font-size: 9px !important; }

  /* Держимый предмет на карточке покемона — ТОЛЬКО ИКОНКА, без названия.
     Название съедало до 92px в строке имени (там же уровень, пол, статус) и первым
     же выталкивалось за край. Иконки хватает, чтобы опознать предмет; полное имя и
     прочность остаются в title. Прячем именно span, не текстовый узел. */
  .bt-held-badge-name { display: none !important; }
  .bt-held-badge {
    max-width: none !important;
    gap: 0 !important;
    padding: 2px !important;
    border-radius: 5px !important;
  }
  .bt-held-badge-icon { width: 16px !important; height: 16px !important; }
  .bt-hp-track { background: rgba(255,255,255,0.2) !important; border-radius: 3px !important; }

  /* Zone 2: Battle bottom — flat vertical stack */
  .bt-bottom {
    flex: 1 1 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    background: #f0f0f0 !important;
    min-height: 0 !important;
  }

  /* Controls must not shrink (descendant: now nested in .bt-controls) */
  .bt-bottom .bt-section {
    flex: 0 0 auto !important;
    padding: 4px 10px 6px !important;
  }
  .bt-bottom .bt-bag-btn {
    flex: 0 0 auto !important;
  }
  /* Wrapper stacks naturally on mobile; identical visual order to before */
  .bt-bottom > .bt-controls { flex: 0 0 auto !important; display: flex; flex-direction: column; }
  .bt-controls-row { display: flex; flex-direction: column; }

  /* Battle log — fills ALL remaining space */
  .bt-log {
    flex: 1 1 0 !important;
    min-height: 30px !important;
    max-height: none !important;
    overflow-y: auto !important;
    background: #f5f5f5 !important;
    padding: 6px 12px !important;
    border-bottom: 1px solid #e0e0e0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .bt-log .bt-log-line { color: #555 !important; font-size: 11px !important; }
  .bt-log .bt-log-line b, .bt-log .bt-log-line strong { color: #1a1a2e !important; }
  .bt-log .bt-log-turn {
    color: #888 !important;
    border-color: #ddd !important;
    font-size: 11px !important;
  }
  .bt-log .bt-log-result { color: #e65100 !important; }

  /* Hide prompt row on mobile — replaced by status bar */
  .bt-prompt-row { display: none !important; }
  .bt-section-label { display: none !important; }

  /* Mobile status bar.
     Отдельной строки-промпта («Что сделает X? 120/196 ОЗ», 24.5px) больше нет — она
     дублировала и имя из статусбара, и полосу ОЗ на поле; элемент #mob-battle-prompt
     не создаётся. ОЗ показываются ТОЛЬКО на карточке самого покемона (.bt-hp-val) —
     там, где он стоит, и всегда. Сам бар ужат с 52 до ~44px: мельче подпись. */
  .mob-battle-statusbar {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: transparent;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
  }
  .sbar-side { display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; min-width: 0; }
  .sbar-right { align-items: flex-end; }
  .sbar-name { font-size: 10.5px; line-height: 1.15; font-weight: 700; color: #1a1a2e; }
  .sbar-opp-name { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sbar-balls { display: flex; gap: 3px; align-items: center; min-width: 0; }
  /* Размер болов оставлен прежним (18/22): на 16px спрайт в кружке уже не опознать,
     а экономия там всего 2px — бар ужимается подписью и отступами, не иконками. */
  .sbar-ball-img {
    width: 18px; height: 18px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
  }
  .sbar-ball-icon { width: 18px; height: 18px; object-fit: contain; }
  .sbar-ball-img.sbar-active { width: 22px; height: 22px; }
  .sbar-ball-img.sbar-active .sbar-ball-icon {
    width: 22px; height: 22px;
    filter: drop-shadow(0 0 3px #4CAF50);
  }
  .sbar-ball-img.sbar-faint .sbar-ball-icon { filter: grayscale(1) opacity(0.45); }
  .sbar-empty {
    width: 16px; height: 16px; border-radius: 50%;
    background: #eee; border: 1px dashed #ccc; opacity: 0.4;
  }
  .sbar-ball-img.sbar-wild { width: 20px; height: 20px; }
  .sbar-ball-img.sbar-wild .sbar-ball-icon { width: 20px; height: 20px; }

  /* Вход в чат ИЗ БОЯ. FAB (z 12000) лежал поверх боя на середине правого края —
     ровно на правом крае лога — поэтому в бою он прячется (правило ниже), а точкой
     входа становится эта кнопка в статусбаре: она видна весь бой и ничего не
     перекрывает. Клик проксируется на сам FAB (см. battleUI), бейдж зеркалит его. */
  .sbar-chat {
    position: relative;
    flex-shrink: 0;
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    padding: 0;
    background: rgba(26, 26, 46, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    cursor: pointer;
  }
  .sbar-chat:active { background: rgba(26, 26, 46, 0.16); }
  .sbar-chat img { width: 19px; height: 19px; object-fit: contain; }
  .sbar-chat-badge {
    position: absolute; top: -4px; right: -4px;
    min-width: 15px; height: 15px; padding: 0 4px;
    border-radius: 8px; background: #ff5252; color: #fff;
    font-size: 9px; font-weight: 800; line-height: 15px; text-align: center;
    display: none;
  }

  /* FAB чата в бою не нужен — его роль забрала .sbar-chat в статусбаре.
     Браузер без :has просто оставит FAB как раньше (не регресс, а статус-кво). */
  body:has(#battle-overlay.open) .chat-fab { display: none !important; }

  /* Move buttons: 2x2 grid with type colors */
  .bt-move-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 5px !important;
  }
  /* Кнопка хода — компактные ДВА ряда: имя во всю ширину сверху, служебная строка
     (иконка типа · PP · ⓘ) снизу. Было 71.5px на кнопку (2×2 = 158px, четверть
     экрана под четыре слова) — там каждый элемент занимал свою строку.
     Однострочная раскладка была бы 44px, но имя в ней ужималось до 55px на 360-м
     экране и до 35px на 320-м («Ледяной клык» → «Лед…»): иконка, PP и ⓘ съедают
     ~110px из 168. Здесь имя получает ВСЮ ширину кнопки, а высота всё равно падает
     до ~50px. 44px тап-порога держит вся кнопка целиком. */
  .bt-move-btn {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 4px 6px !important;
    border-radius: 10px !important;
    padding: 5px 8px !important;
    border: 1.5px solid var(--type-border, rgba(0,0,0,0.12)) !important;
    min-height: 44px !important;
  }
  /* flex-basis 100% = собственная строка; order -1 поднимает имя над DOM-порядком
     (в разметке оно идёт ПОСЛЕ иконки типа). */
  .bt-move-name {
    order: -1 !important;
    flex: 1 0 100% !important;
    min-width: 0 !important;
    font-size: 12px !important;
    text-align: left !important;
    line-height: 1.2 !important;
  }
  .bt-move-type { width: 18px !important; height: 18px !important; }
  .bt-move-pp { font-size: 10px !important; flex: 0 0 auto !important; }
  .bt-move-footer { margin-top: 1px !important; }
  /* ⓘ встаёт В строку и прижимается вправо, а не абсолютной меткой в углу: в
     компактной раскладке absolute top/right легла бы поверх имени. Селектор двойной —
     правило .move-info-btn ниже по файлу (в этом же медиазапросе) иначе перебьёт
     по порядку. */
  .bt-move-btn .move-info-btn {
    position: static !important;
    margin-left: auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 24px !important;
    min-height: 22px !important;         /* промах по ⓘ ТРАТИТ ход — тап-зона не мельче прежней угловой */
    padding: 0 !important;
    font-size: 15px !important;
    /* Была rgba(255,255,255,.4) — белым по светлой плашке типа её попросту не видно.
       В угловой абсолютной позиции это ещё сходило, в строке — занимает место и
       остаётся невидимой. */
    color: rgba(0, 0, 0, 0.35) !important;
  }

  /* Ряд действий — сетка в ОДНУ строку (был flex с wrap).
     ⚠ Это чинит функциональный баг, а не только вид: четыре пилюли по ~90px + gap 12
     дают 391px при 374 доступных на 390-м экране, поэтому ряд переносился на вторую
     строку (80px вместо 44). А .bt-bottom стоит с overflow:hidden и БЕЗ скролла —
     значит на коротких экранах (≤635px полезной высоты: iPhone SE в Safari, Android
     360×640) вторая строка уезжала ЗА КАДР и «Сдаться» становилась недоступна.
     grid-auto-flow:column + auto-columns 1fr раздают равные колонки по ЧИСЛУ ВИДИМЫХ
     кнопок — «Рюкзак» и «Команда» показываются не во всяком бою (display:none), и
     жёсткий repeat(4,…) оставил бы дыру справа. */
  .bt-action-row {
    display: grid !important;
    grid-auto-flow: column !important;
    grid-auto-columns: minmax(0, 1fr) !important;
    gap: 6px !important;
    margin: 8px 0 !important;
    padding: 0 8px !important;
  }
  .bt-action-btn {
    min-width: 0 !important;
    min-height: 44px !important;          /* тап-порог */
    justify-content: center !important;
    padding: 8px 4px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
  }

  /* Move buttons use same desktop type-* colors — no override needed */

  /* Switch row */
  .bt-switch-row { gap: 4px !important; padding: 2px 0 0 !important; overflow-x: auto !important; margin-bottom: 8px !important; }
  .bt-switch-slot {
    min-width: 54px !important; padding: 3px 4px !important;
    background: #fff !important;
    border-color: #ddd !important;
    border-radius: 8px !important;
  }
  .bt-switch-name { color: #555 !important; font-size: 9px !important; }
  .bt-switch-active { border-color: #4A90E2 !important; }
  .bt-switch-fainted { opacity: 0.3 !important; }
  .bt-switch-revive  { opacity: 1 !important; filter: none !important; }
  .bt-switch-hp-track { background: #eee !important; }

  /* Bag button — full width below moves */
  .bt-bag-btn {
    position: static !important;
    width: calc(100% - 20px) !important;
    height: auto !important;
    margin: 0 10px 6px !important;
    padding: 10px 14px !important;
    border-radius: 12px !important;
    text-indent: 0 !important;
    line-height: normal !important;
    overflow: visible !important;
    font-size: 13px !important;
  }
  .bt-bag-btn::after { content: none !important; }

  /* Team picker — fullscreen overlay (base CSS) carries the arena image + scrim;
     here just tighten spacing. Translucent frosted cards, text shadowed. */
  .bt-team-picker { padding: 16px !important; gap: 14px !important; }
  .bt-picker-title { color: #fff !important; text-shadow: 0 2px 6px rgba(0,0,0,0.85); }
  .bt-lead-timer   { text-shadow: 0 2px 6px rgba(0,0,0,0.85); }
  .bt-picker-grid  { grid-template-columns: repeat(2, 1fr) !important; gap: 12px !important; width: 100%; max-width: 360px; }
  .bt-picker-btn {
    background: rgba(255,255,255,0.1) !important;
    border-color: rgba(255,255,255,0.22) !important;
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  }
  .bt-picker-btn:active { background: rgba(61,125,202,0.4) !important; border-color: #3d7dca !important; transform: scale(0.96); }
  .bt-picker-name { color: #fff !important; text-shadow: 0 1px 3px rgba(0,0,0,0.9); }

  /* Hazard sprites smaller on mobile */
  .bt-hazard-sprite { width: 20px !important; height: 20px !important; }

  /* ── Chat panel ── */
  .chat-panel {
    width: 100% !important;
    /* Базовое max-width:90vw перебивало width:100% — панель занимала 90% и
       висела с зазором слева (было и до редизайна, на тёмном фоне стало видно). */
    max-width: 100% !important;
    border-radius: 20px 20px 0 0 !important;
    bottom: 64px;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
  }
  .chat-header { border-radius: 20px 20px 0 0; }
  /* Панель снизу квадратная (radius 20px 20px 0 0) — полосе вкладок скруглять
     нечего. Сама полоса чуть уже: экран и так узкий. */
  .chat-chans { width: 72px; border-radius: 0; padding: 8px 5px; }
  .chat-toast { bottom: 96px; }
  /* Телефон: ширины и полоски нет — панель во весь экран. */
  .chat-resize, .chat-collapse, .chat-expand { display: none !important; }

  /* ── Chat open — no layout shift on mobile ── */
  body.chat-open .location-panel { left: 0 !important; }
  body.chat-open .modal-overlay { right: 0 !important; }

  /* ── NPC Dialog — mobile bottom-sheet (DS style) ─────────────────────────── */

  .oak-overlay {
    align-items: flex-end !important;
    padding: 0 !important;
    background: rgba(0,0,0,0.4) !important;
  }

  .oak-dialog {
    position: fixed !important;
    bottom: 64px !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 20px 20px 0 0 !important;
    padding: 16px 20px 20px !important;
    margin: 0 !important;
    background: rgba(255,255,255,0.97) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.2) !important;
    animation: npcDialogSlideUp 0.3s cubic-bezier(0.32,0.72,0,1) !important;
    z-index: 700 !important;
    flex-direction: column !important;
    gap: 12px !important;
    max-height: 70vh !important;
    /* `overflow: visible` together with max-height meant a tall sheet never scrolled — it just
       spilled out of its own rounded box, so the action buttons rendered OUTSIDE the panel, on
       top of the page and the bottom nav. The sheet now clips and .oak-content is the scroll
       area. Only the shop dialog used to get this treatment; every other NPC sheet leaked. */
    overflow: hidden !important;
    padding-bottom: 24px !important;
  }

  /* Handle bar at top */
  .oak-dialog::before {
    content: '' !important;
    display: block !important;
    width: 36px !important;
    height: 4px !important;
    background: #ddd !important;
    border-radius: 2px !important;
    margin: 0 auto 4px !important;
    flex-shrink: 0 !important;
  }

  @keyframes npcDialogSlideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
  }

  /* Portrait row — horizontal on mobile */
  .oak-portrait {
    flex-direction: row !important;
    gap: 12px !important;
  }

  .oak-avatar-icon {
    width: 52px !important;
    height: 52px !important;
    border-width: 2px !important;
  }
  .oak-avatar-icon img {
    width: 44px !important;
    height: 44px !important;
  }

  .npc-joy-sprite.large {
    width: 52px !important;
    height: 52px !important;
  }

  .oak-avatar-name {
    font-size: 13px !important;
    margin: 0 !important;
  }
  .npc-joy-label {
    font-size: 13px !important;
    color: #C2185B !important;
  }

  /* The scroll area of every NPC bottom-sheet. */
  .oak-dialog .oak-content {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto !important;
    min-height: 0 !important;   /* a flex child may shrink below its content → it scrolls */
    /* 🔴 Область прокрутки — от края до края шторки (поля шторки переехали сюда паддингом),
       и по горизонтали ничего не прокручивается. Раньше прилипшая полоса кнопок ниже
       (margin -20px) вылезала за .oak-content на ширину вертикальной полосы прокрутки, и
       у ДЛИННОЙ шторки появлялась горизонтальная прокрутка — содержимое уезжало вбок. */
    margin-left: -20px !important;
    margin-right: -20px !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
    overflow-x: hidden !important;
  }
  /* Buttons stay reachable at the bottom of the sheet instead of scrolling away. Only when the
     row is the LAST block of the content — mid-content action groups keep flowing normally. */
  .oak-dialog .oak-content > .oak-actions:last-child {
    position: sticky !important;
    bottom: 0 !important;
    margin: 4px -20px -20px !important;
    padding: 10px 20px 6px !important;
    background: rgba(255, 255, 255, 0.98) !important;
    border-top: 1px solid #f0f0f0 !important;
    z-index: 2 !important;
  }

  /* Dialog text */
  .oak-dialog .oak-text {
    font-size: 15px !important;
    line-height: 1.55 !important;
    min-height: unset !important;
  }

  /* Shop dialog: nested scroll so close button stays pinned above the bottom nav */
  .oak-dialog.npc-shop-dialog {
    overflow: hidden !important;
  }
  .oak-dialog.npc-shop-dialog .oak-content {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto !important;
    min-height: 0 !important;
  }
  .npc-shop-dialog .npc-shop-list {
    max-height: none !important;
    overflow: visible !important;
  }
  .npc-shop-dialog .oak-actions {
    position: sticky !important;
    bottom: 0 !important;
    margin: 4px -20px -20px !important;
    padding: 10px 20px 6px !important;
    background: rgba(255, 255, 255, 0.98) !important;
    border-top: 1px solid #f0f0f0 !important;
    z-index: 2 !important;
  }
  /* Confirm screen: keep summary readable on small screens */
  .npc-shop-dialog .npc-shop-confirm-img { width: 64px !important; height: 64px !important; }
  .npc-shop-dialog .npc-shop-step-btn { width: 48px !important; height: 48px !important; }
  .npc-shop-dialog .npc-shop-step-val { font-size: 24px !important; min-width: 60px !important; }

  /* Action buttons — stack vertically by default */
  .oak-btn-row {
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .oak-btn {
    width: 100% !important;
    padding: 14px !important;
    border-radius: 14px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    min-height: 50px !important;
  }

  /* 2 buttons side by side, wrap if too tight */
  .oak-btn-row:has(.oak-btn:nth-child(2)):not(:has(.oak-btn:nth-child(3))) {
    flex-direction: row !important;
    flex-wrap: wrap !important;
  }
  .oak-btn-row:has(.oak-btn:nth-child(2)):not(:has(.oak-btn:nth-child(3))) .oak-btn {
    flex: 1 1 auto !important;
    min-width: 140px !important;
  }

  /* Starter grid adjustments */
  .oak-starter-grid {
    max-height: 40vh !important;
  }

  /* ── Inventory modal — mobile full-screen ────────────────────────────────── */

  #inventory-overlay {
    align-items: stretch !important;
    padding: 0 !important;
  }

  .inv-modal {
    width: 100% !important;
    max-width: 100% !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding-bottom: 64px !important;
  }

  /* Header */
  .inv-topbar {
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
    background: rgba(255,255,255,0.97) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    padding: 16px 16px 12px 60px !important;
  }

  .inv-modal > .pm-close {
    top: 12px !important;
    right: auto !important;
    left: 16px !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    background: #f5f5f5 !important;
    font-size: 16px !important;
    z-index: 11 !important;
  }

  .inv-title {
    font-size: 18px !important;
  }

  .inv-money {
    font-size: 15px !important;
    padding-right: 0 !important;
  }

  /* Body: stack vertically */
  .inv-body {
    flex-direction: column !important;
    overflow-y: auto !important;
  }

  /* Left column becomes full-width top section */
  .inv-left {
    width: 100% !important;
    border-right: none !important;
    border-bottom: none !important;
    overflow: visible !important;
  }

  /* Middle column flows after the category tabs on mobile */
  .inv-middle {
    width: 100% !important;
    border-right: none !important;
    overflow: visible !important;
    flex: 1 1 auto !important;
  }

  /* Category tabs: horizontal scroll */
  .inv-category-tabs {
    flex-direction: row !important;
    overflow-x: auto !important;
    scrollbar-width: none !important;
    gap: 8px !important;
    padding: 10px 16px !important;
    border-bottom: 1px solid #f0f0f0 !important;
  }
  .inv-category-tabs::-webkit-scrollbar { display: none !important; }

  .inv-cat-tab {
    padding: 8px 16px !important;
    border-radius: 50px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    background: #f5f5f5 !important;
    border: none !important;
  }
  .inv-cat-tab.active {
    background: #4CAF50 !important;
    color: white !important;
  }
  .inv-cat-tab.active .inv-cat-label { color: white !important; }
  .inv-cat-icon-img { width: 18px !important; height: 18px !important; }

  /* Search */
  .inv-search {
    margin: 8px 16px !important;
    width: calc(100% - 32px) !important;
    border-radius: 12px !important;
    font-size: 14px !important;
    background: #f8f9fa !important;
  }

  /* Item grid: vertical list */
  .inv-item-grid {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: unset !important;
    gap: 0 !important;
    padding: 0 16px !important;
    overflow-y: auto !important;
    flex: 1 !important;
  }

  .inv-item-cell {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 14px 0 !important;
    /* The desktop card min-height used to leak in here and inflate every list row.
       flex-shrink:0 replaces it as the guard: this list is a column flex container with a
       definite height, so with a full bag the rows would otherwise shrink below their
       content (cells are overflow:hidden) and clip instead of scrolling. */
    min-height: 0 !important;
    flex-shrink: 0 !important;
    border-bottom: 1px solid #f5f5f5 !important;
    border-radius: 0 !important;
    background: transparent !important;
    text-align: left !important;
    box-shadow: none !important;
    border-left: none !important;
    border-right: none !important;
    border-top: none !important;
  }
  .inv-item-cell.selected {
    background: #f0faf0 !important;
    border-radius: 12px !important;
    margin: 0 -8px !important;
    padding: 14px 8px !important;
  }

  .inv-item-img {
    width: 48px !important;
    height: 48px !important;
    border-radius: 12px !important;
    background: #f5f5f5 !important;
    flex-shrink: 0 !important;
  }

  .inv-item-name {
    flex: 1 !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    color: #1a1a2e !important;
  }

  .inv-item-qty {
    font-size: 14px !important;
    font-weight: 700 !important;
    color: #4CAF50 !important;
    background: rgba(76,175,80,0.1) !important;
    padding: 4px 10px !important;
    border-radius: 50px !important;
    position: static !important;
    min-width: unset !important;
  }

  .inv-grid-empty {
    padding: 40px 20px !important;
  }

  /* Hide desktop detail panel */
  .inv-detail-panel {
    display: none !important;
  }

  /* ── Item detail bottom sheet ──
     z-index must beat .modal-overlay (10000) so the sheet isn't clipped
     behind the inventory modal it's being opened from. */
  .inv-mob-sheet-overlay {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0,0,0,0.4) !important;
    z-index: 10500 !important;
  }

  .inv-mob-sheet {
    position: fixed !important;
    bottom: 64px !important;
    left: 0 !important;
    right: 0 !important;
    background: white !important;
    border-radius: 20px 20px 0 0 !important;
    padding: 20px !important;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.15) !important;
    z-index: 10501 !important;
    animation: invSheetUp 0.25s cubic-bezier(0.32,0.72,0,1) !important;
    max-height: 70vh !important;
    overflow-y: auto !important;
  }

  .inv-mob-sheet::before {
    content: '' !important;
    display: block !important;
    width: 36px !important;
    height: 4px !important;
    background: #ddd !important;
    border-radius: 2px !important;
    margin: 0 auto 16px !important;
  }

  @keyframes invSheetUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
  }

  .inv-mob-sheet-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
  }
  .inv-mob-sheet-img {
    width: 64px; height: 64px;
    border-radius: 16px; background: #f5f5f5;
    object-fit: contain;
  }
  .inv-mob-sheet-name {
    font-size: 18px; font-weight: 700; color: #1a1a2e;
  }
  .inv-mob-sheet-qty {
    font-size: 14px; color: #4CAF50; font-weight: 600;
  }
  .inv-mob-sheet-desc {
    font-size: 14px; color: #666; line-height: 1.5;
    margin-bottom: 16px;
  }
  .inv-mob-sheet-actions {
    display: flex; flex-direction: column; gap: 8px;
  }
  .inv-mob-sheet-btn {
    width: 100%; padding: 14px;
    border: none; border-radius: 14px;
    font-size: 15px; font-weight: 600;
    cursor: pointer;
  }
  .inv-mob-sheet-btn-primary {
    background: #4CAF50; color: white;
  }
  .inv-mob-sheet-btn-secondary {
    background: #f5f5f5; color: #555;
  }
  .inv-mob-sheet-btn-discard {
    background: #fff; color: #d23a3a;
    border: 2px solid #e05151 !important;
  }

  /* ── Move info button (mobile) ── */
  .move-info-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    flex-shrink: 0;
    line-height: 1;
    position: absolute;
    top: 4px;
    right: 4px;
  }
  .move-info-btn:active { color: rgba(255,255,255,0.9); }

  .bt-move-btn { position: relative !important; }

  /* ── Move info bottom sheet (mobile) ── */
  .move-info-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999998;
  }
  .move-info-sheet {
    position: fixed;
    bottom: 0;
    left: 0; right: 0;
    background: white;
    border-radius: 20px 20px 0 0;
    padding: 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    z-index: 999999;
    animation: invSheetUp 0.25s cubic-bezier(0.32,0.72,0,1);
  }
  .move-info-handle {
    width: 36px; height: 4px;
    background: #ddd; border-radius: 2px;
    margin: 0 auto 16px;
  }
  .move-info-title {
    font-size: 18px; font-weight: 700;
    color: #1a1a2e; margin-bottom: 12px;
  }
  .move-info-stats {
    display: flex; gap: 0;
    border-radius: 12px; overflow: hidden;
    margin-bottom: 16px; border: 1px solid #eee;
  }
  .move-info-stat {
    flex: 1; text-align: center;
    padding: 12px 8px;
    border-right: 1px solid #eee;
  }
  .move-info-stat:last-child { border-right: none; }
  .move-info-stat-label {
    font-size: 10px; color: #aaa;
    text-transform: uppercase; margin-bottom: 4px;
  }
  .move-info-stat-value {
    font-size: 20px; font-weight: 700; color: #1a1a2e;
  }
  .move-info-desc {
    font-size: 14px; color: #555;
    line-height: 1.6; margin: 0;
  }

  /* Hide desktop tooltip on mobile */
  .move-tooltip { display: none !important; }
}

/* Очень узкие экраны: эмблема + самоцветы + статус не влезают вместе с текстом
   бренда → прячем «WildLegacy» (эмблема остаётся якорем бренда).
   ВАЖНО: блок стоит ПОСЛЕ всей мобильной секции @media (max-width: 768px) и содержит
   ТОЛЬКО правила шапки — в 01e34e5 он случайно был открыт внутри мобильной секции и
   утащил под 420px мобнав/bottom-sheet/бой (421–768px оставались без навигации). */
@media (max-width: 420px) {
  .g-header-title { display: none; }
  .g-header-mark { margin-right: 0; }
  .g-avatar { width: 26px; height: 26px; font-size: 12px; }
  .g-username { font-size: 13px; }
  /* Третья пилюля (пасс) отобрала у ника ~55 px — отдаём их обратно из лимита ника:
     ник обрезается многоточием, а пилюли — нет, они уехали бы за край экрана. */
  .g-header-status { max-width: 28vw; }
}

/* Совсем узкие (iPhone SE, 320 px): четыре пилюли в ряд при трёхзначном уровне и
   длинном нике перебирали ширину на 10 px, и шапка начинала прокручиваться вбок.
   Забираем их отступами и лимитом ника — сами пилюли не трогаем: обрезанный уровень
   или обрезанный баланс хуже обрезанного ника, у ника обрезание хотя бы ожидаемо. */
@media (max-width: 360px) {
  .g-header { gap: 6px; padding: 0 8px 0 10px; }
  .g-header-status { max-width: 26vw; }
}

/* ── Move tooltip (desktop) ──────────────────────────────────────────────── */
.move-tooltip {
  position: fixed;
  background: rgba(20,20,40,0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 12px 16px;
  min-width: 220px;
  max-width: 280px;
  z-index: 999999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  color: white;
}
.move-tooltip.visible {
  opacity: 1;
}
.move-tooltip-name {
  font-size: 14px; font-weight: 700;
  color: white; margin-bottom: 8px;
}
.move-tooltip-stats {
  display: flex; gap: 12px;
  margin-bottom: 8px; padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.move-tooltip-stats > span {
  display: flex; flex-direction: column;
  align-items: center; gap: 2px;
}
.tooltip-label {
  font-size: 9px; color: rgba(255,255,255,0.5);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.tooltip-value {
  font-size: 15px; font-weight: 700; color: white;
}
.move-tooltip-desc {
  font-size: 12px; color: rgba(255,255,255,0.7);
  line-height: 1.5;
}

/* ── Team modal move info ────────────────────────────────────────────────── */
.tm-move-slot-info {
  display: none;
}

/* Mobile move details in team modal */
.mob-move-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.mob-move-info {
  font-size: 11px;
  color: #999;
}
.mob-move-desc {
  font-size: 11px;
  color: #aaa;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ⓘ button on team modal move rows */
.tm-move-info-btn {
  background: none;
  border: none;
  color: #ccc;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
  line-height: 1;
}
.tm-move-info-btn:active { color: #4CAF50; }

/* Team move info sheet */
.tm-move-sheet-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 999998;
}
.tm-move-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: white;
  border-radius: 20px 20px 0 0;
  padding: 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 999999;
  animation: invSheetUp 0.25s cubic-bezier(0.32,0.72,0,1);
}
.tm-sheet-handle {
  width: 36px; height: 4px;
  background: #ddd; border-radius: 2px;
  margin: 0 auto 16px;
}
.tm-sheet-title {
  font-size: 18px; font-weight: 700;
  color: #1a1a2e; margin-bottom: 12px;
}
.tm-sheet-stats {
  display: flex; gap: 0;
  border-radius: 12px; overflow: hidden;
  margin-bottom: 16px; border: 1px solid #eee;
}
.tm-sheet-stat {
  flex: 1; text-align: center;
  padding: 12px 8px;
  border-right: 1px solid #eee;
}
.tm-sheet-stat:last-child { border-right: none; }
.tm-sheet-stat-label {
  font-size: 10px; color: #aaa;
  text-transform: uppercase; margin-bottom: 4px;
}
.tm-sheet-stat-value {
  font-size: 20px; font-weight: 700; color: #1a1a2e;
}
.tm-sheet-desc {
  font-size: 14px; color: #555;
  line-height: 1.6; margin: 0;
}
.tm-sheet-label {
  font-size: 10px; color: #aaa;
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 4px;
}

/* Mobile ability/nature info row */
.mob-info-row {
  display: flex;
  gap: 16px;
  padding: 10px 0 8px;
}
.mob-info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mob-info-label {
  font-size: 10px;
  font-weight: 700;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.mob-info-item > span:last-child {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a2e;
}

/* ── Trade system ────────────────────────────────────────────────────────── */

.trade-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.trade-modal {
  background: rgba(255,255,255,0.98);
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 24px;
  position: relative;
}

.trade-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.trade-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #1a1a2e;
}

.trade-status-badge {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 20px;
  background: #f0f0f0;
  color: #888;
  font-weight: 500;
}
.trade-status-waiting { background: #FFF3E0; color: #E65100; }
.trade-status-executing { background: #E8F5E9; color: #2E7D32; }

.trade-sides {
  display: flex;
  gap: 12px;
  flex: 1;
  margin: 16px 0;
}

.trade-side {
  flex: 1;
  background: #f8f9fa;
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.trade-side-mine { border: 2px solid #4CAF50; }
.trade-side-theirs { border: 2px solid #2196F3; }

.trade-side-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.trade-player-name {
  font-weight: 600;
  font-size: 15px;
  color: #1a1a2e;
}

.trade-ready-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 12px;
  background: #eee;
  color: #999;
  font-weight: 500;
}
.trade-ready-badge.ready {
  background: #C8E6C9;
  color: #2E7D32;
}

.trade-divider {
  display: flex;
  align-items: center;
  font-size: 22px;
  color: #bbb;
  flex-shrink: 0;
  user-select: none;
}

.trade-section-label {
  font-size: 12px;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.trade-offer-pokemon,
.trade-offer-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trade-slot {
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.trade-slot-empty {
  background: white;
  border: 2px dashed #ddd;
  justify-content: center;
  cursor: pointer;
  color: #aaa;
  font-size: 13px;
  padding: 14px 12px;
  transition: border-color 0.2s;
}
.trade-slot-empty:hover { border-color: #4CAF50; color: #4CAF50; }

.trade-slot-filled {
  background: white;
  border: 1px solid #e0e0e0;
}

.trade-slot-sprite {
  width: 48px;
  height: 48px;
  object-fit: contain;
  image-rendering: pixelated;
}

.trade-slot-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.trade-slot-info > span:first-child {
  font-weight: 600;
  font-size: 14px;
  color: #1a1a2e;
}
.trade-slot-level {
  font-size: 12px;
  color: #888;
}

.trade-slot-remove {
  background: none;
  border: none;
  font-size: 16px;
  color: #ccc;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}
.trade-slot-remove:hover { color: #f44336; background: rgba(244,67,54,0.08); }

.trade-offer-money {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #555;
}
.trade-offer-money label { font-weight: 500; }
.trade-offer-money input {
  width: 80px;
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
}
.trade-offer-money input:focus { border-color: #4CAF50; }
.money-balance { font-size: 11px; color: #aaa; }

.trade-ready-btn {
  width: 100%;
  padding: 12px;
  background: #4CAF50;
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: auto;
  transition: background 0.2s;
}
.trade-ready-btn:hover { background: #43A047; }
.trade-ready-btn.active { background: #FF9800; }
.trade-ready-btn.active:hover { background: #F57C00; }

.trade-cancel-btn {
  width: 100%;
  padding: 10px;
  background: rgba(244,67,54,0.08);
  border: 1px solid rgba(244,67,54,0.2);
  border-radius: 12px;
  color: #f44336;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.trade-cancel-btn:hover { background: rgba(244,67,54,0.15); }

/* Trade request toast */
.trade-request-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  border-radius: 16px;
  padding: 14px 18px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.2);
  z-index: 11000;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 420px;
  animation: tradeToastIn 0.3s ease;
}

.trade-request-title {
  font-weight: 600;
  font-size: 14px;
  color: #1a1a2e;
}

.trade-request-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.trade-accept-btn {
  background: #4CAF50;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: background 0.15s;
}
.trade-accept-btn:hover { background: #43A047; }

.trade-decline-btn {
  background: #f5f5f5;
  color: #888;
  border: none;
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s;
}
.trade-decline-btn:hover { background: #eee; color: #666; }

/* Trade toast (simple message) */
.trade-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30,30,50,0.92);
  backdrop-filter: blur(8px);
  color: white;
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 13px;
  z-index: 11000;
  animation: tradeToastIn 0.3s ease;
}
.trade-toast-hide {
  opacity: 0;
  transition: opacity 0.4s ease;
}

/* Pokemon picker */
.trade-pokemon-picker {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.98);
  border-radius: 24px;
  padding: 20px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.trade-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.trade-picker-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #1a1a2e;
}

.trade-picker-close {
  background: none;
  border: none;
  font-size: 18px;
  color: #aaa;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}
.trade-picker-close:hover { background: #f0f0f0; color: #555; }

.trade-picker-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.trade-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #f8f9fa;
  transition: background 0.15s;
}
.trade-picker-row:hover { background: #eef7ee; }

.trade-picker-sprite {
  width: 40px;
  height: 40px;
  object-fit: contain;
  image-rendering: pixelated;
}

.trade-picker-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.trade-picker-name { font-weight: 600; font-size: 13px; color: #1a1a2e; }
.trade-picker-level { font-size: 12px; color: #888; }
.trade-picker-tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 6px;
  background: #e8e8e8;
  color: #666;
}

.trade-item-qty-input {
  width: 50px;
  padding: 5px 8px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 13px;
  text-align: center;
  outline: none;
}
.trade-item-qty-input:focus { border-color: #4CAF50; }

.trade-picker-add-btn {
  background: #4CAF50;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.trade-picker-add-btn:hover { background: #43A047; }

.trade-picker-empty {
  text-align: center;
  color: #aaa;
  padding: 32px 0;
  font-size: 14px;
}

@keyframes tradeToastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@media (max-width: 768px) {
  .trade-sides {
    flex-direction: column;
  }
  .trade-divider {
    transform: rotate(90deg);
    margin: 0 auto;
    padding: 4px 0;
  }
  .trade-modal {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
    padding: 16px;
  }
  .trade-overlay {
    padding: 0;
  }

  /* Mobile trade-request toast: full-width banner under the safe area, not
     a centered pill that can get clipped by status bars / notches. */
  .trade-request-toast {
    top: calc(env(safe-area-inset-top, 0px) + 8px);
    left: 8px;
    right: 8px;
    transform: none;
    max-width: none;
    min-width: 0;
    width: auto;
    padding: 12px 14px;
    flex-wrap: wrap;
  }
  .trade-request-actions {
    width: 100%;
    margin-left: 0;
    margin-top: 6px;
    justify-content: flex-end;
  }
  .trade-accept-btn,
  .trade-decline-btn {
    padding: 9px 16px;
    font-size: 14px;
    min-height: 40px;
  }
}

/* Clickable slot: shows a subtle affordance and scales on press. */
.trade-slot-clickable {
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}
.trade-slot-clickable:hover {
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}
.trade-slot-clickable:active {
  transform: scale(0.97);
}

/* Small preview button in picker rows */
.trade-picker-preview-btn {
  background: #f5f5f5;
  color: #666;
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.trade-picker-preview-btn:hover { background: #e8e8e8; color: #333; }

/* Выбор покемона: поиск, фильтры, недоступные строки (этап 1 реворка обмена). Палитра — та же,
   что у остального окна обмена: зелёный #4CAF50, нейтральные #f5f5f5/#e0e0e0/#888, красный #f44336. */
.trade-picker-count { margin-left: auto; margin-right: 8px; font-size: 12px; color: #888; }
.trade-picker-tools { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.trade-picker-search {
  width: 100%; box-sizing: border-box; padding: 9px 12px; border: 1px solid #ddd; border-radius: 10px;
  font-size: 14px; outline: none; background: white; color: #1a1a2e;
}
.trade-picker-search:focus { border-color: #4CAF50; }
.trade-picker-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.trade-picker-select {
  padding: 6px 8px; border: 1px solid #ddd; border-radius: 8px; font-size: 12px; background: white; color: #555; outline: none;
}
.trade-picker-select:focus { border-color: #4CAF50; }
.trade-picker-chip {
  padding: 6px 10px; border: 1px solid #ddd; border-radius: 8px; font-size: 12px; background: white; color: #555; cursor: pointer;
}
.trade-picker-chip.on { background: #eef7ee; border-color: #4CAF50; color: #43A047; font-weight: 600; }
.trade-picker-row .trade-picker-info { flex-direction: column; align-items: flex-start; gap: 3px; }
.trade-picker-line { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.trade-type-row { display: flex; gap: 4px; flex-wrap: wrap; }
.tm-move-type-badge.trade-type-badge { min-width: 0; padding: 1px 6px; font-size: 10px; line-height: 1.3; }
/* Цвета — общие «Pokemon type colors» ниже по файлу (как в покедексе): насыщенный фон под белый
   текст; светлым типам тот же блок уже задаёт тёмный #2b2f36. */
.trade-type-badge:not(.type-electric):not(.type-ice):not(.type-ground):not(.type-steel) { color: #fff; }
.trade-picker-reason { font-size: 11px; color: #f44336; }
.trade-picker-row.is-blocked { background: #f5f5f5; }
.trade-picker-row.is-blocked:hover { background: #f5f5f5; }
.trade-picker-row.is-blocked .trade-picker-sprite { opacity: 0.45; filter: grayscale(1); }
.trade-picker-row.is-blocked .trade-picker-name,
.trade-picker-row.is-blocked .trade-picker-level { color: #aaa; }
.trade-picker-add-btn:disabled { background: #e0e0e0; color: #aaa; cursor: not-allowed; }
.trade-picker-note { padding: 8px 12px; font-size: 12px; color: #888; }
/* Карточки предложения (этап 2): спрайт ×1.5 (48 → 72), метка/пол/типы/держимое на самой карточке.
   Иерархия: имя покемона — главный текст карточки; подписи разделов — служебные, мельче и светлее. */
.trade-mon-card { gap: 12px; padding: 8px 10px; align-items: center; }
.trade-mon-sprite-wrap { position: relative; width: 72px; height: 72px; flex-shrink: 0; }
.trade-mon-sprite { width: 72px; height: 72px; object-fit: contain; image-rendering: pixelated; }
.trade-mon-held {
  position: absolute; right: -2px; bottom: -2px; width: 24px; height: 24px; border-radius: 50%;
  background: white; border: 1px solid #e0e0e0; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
.trade-mon-held-img { width: 18px; height: 18px; object-fit: contain; image-rendering: pixelated; font-size: 10px; }
.trade-mon-info { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.trade-mon-mark { margin-bottom: 0; }
.trade-mon-title { display: flex; align-items: center; gap: 4px; min-width: 0; }
.trade-mon-name { font-size: 15px; font-weight: 700; color: #1a1a2e; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trade-mon-sub { font-size: 12px; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trade-mon-held-name { color: #555; }
.trade-item-img { width: 40px; height: 40px; object-fit: contain; image-rendering: pixelated; flex-shrink: 0; }
.trade-item-name { font-weight: 600; font-size: 14px; color: #1a1a2e; }
.trade-item-ph {
  display: inline-flex; align-items: center; justify-content: center; border-radius: 8px;
  background: #f0f0f0; color: #888; font-weight: 700; font-size: 14px;
}
.trade-mon-held .trade-item-ph { border-radius: 50%; font-size: 10px; }
.trade-player-name { font-size: 16px; font-weight: 700; }
.trade-section-label { font-size: 10.5px; font-weight: 600; color: #aaa; letter-spacing: 0.8px; margin-top: 6px; }
.trade-picker-preview-btn { display: inline-flex; align-items: center; justify-content: center; }
/* Сборка покемона на карточке: характер ± (общие .tm-nat-up/.tm-nat-down), тренировка (общий .tm-train-badge), EV. */
.trade-mon-build { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; font-size: 11px; color: #888; }
.trade-build-sep { color: #ddd; }
.trade-build-train { display: inline-flex; align-items: center; gap: 3px; }
.trade-mon-build .tm-train-badge { width: 14px; height: 14px; }
.trade-preview-stat-val { display: inline-flex; align-items: center; gap: 3px; }
.trade-preview-stat-val .tm-train-badge { width: 14px; height: 14px; }
.trade-preview-stat-ev { font-size: 10px; color: #888; margin-top: 1px; }
.trade-preview-stat.has-ev .trade-preview-stat-ev { color: #43A047; font-weight: 600; }
.trade-preview-stat-vit { color: #888; font-weight: 400; }
.trade-preview-nat-eff { color: #888; }
.trade-preview-ev-total { font-size: 11px; color: #aaa; text-align: center; margin: -4px 0 8px; }
/* Этап 3: итог, статусы, «соперник изменил предложение». Оранжевый — тот же, что у статуса ожидания
   (.trade-status-waiting) и активной кнопки (.trade-ready-btn.active): «внимание, не финал». */
.trade-summary { font-size: 13px; line-height: 1.4; color: #1a1a2e; font-weight: 600; text-align: center; margin-top: auto; padding: 4px 2px 0; }
.trade-summary + .trade-ready-btn { margin-top: 0; }
.trade-status-changed { background: #FFF3E0; color: #E65100; font-weight: 600; }
.trade-ready-badge.stale { background: #FFF3E0; color: #E65100; }
.trade-ready-btn.stale { background: #FF9800; }
.trade-ready-btn.stale:hover { background: #F57C00; }
.trade-change-notice { background: #FFF3E0; border: 1px solid #FF9800; border-radius: 12px; padding: 10px 12px; }
.trade-change-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.trade-change-title { font-size: 13px; font-weight: 700; color: #E65100; }
.trade-change-ok { background: white; border: 1px solid #FF9800; color: #E65100; border-radius: 8px; padding: 4px 10px; font-size: 12px; font-weight: 600; cursor: pointer; }
.trade-change-list { list-style: none; margin: 6px 0 0; padding: 0; font-size: 12px; color: #555; display: flex; flex-direction: column; gap: 2px; }
.trade-change-list .is-add { color: #43A047; font-weight: 600; }
.trade-change-list .is-del { color: #f44336; font-weight: 600; text-decoration: line-through; }
.trade-slot.is-new { border-color: #FF9800; box-shadow: 0 0 0 2px #FFF3E0; position: relative; }
.trade-new-tag {
  position: absolute; top: -7px; right: 10px; background: #FF9800; color: white; font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 6px; letter-spacing: 0.3px;
}
#their-money-offer.is-new { color: #E65100; font-weight: 700; }
.trade-status-badge { text-align: right; max-width: 60%; }
/* Этап 4. Подвал: итог и «Готов» под обеими колонками. */
.trade-footer { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.trade-footer .trade-summary { margin-top: 0; }
/* Карточка: «✕» в углу, доп. блок (держимое/характер/EV/«Подробнее») — строкой под именем. */
.trade-mon-card { position: relative; flex-wrap: wrap; }
.trade-mon-card .trade-mon-info { padding-right: 22px; }
.trade-mon-card .trade-slot-remove { position: absolute; top: 4px; right: 4px; padding: 2px 6px; }
.trade-mon-extra { flex: 1 0 100%; padding-left: 84px; margin-top: -6px; }
.trade-mon-extra-held, .trade-mon-more-btn { display: none; }
.trade-mon-more-btn {
  margin-top: 2px; padding: 5px 8px; border: 1px solid #ddd; border-radius: 8px; background: white;
  color: #555; font-size: 11px; font-weight: 600; cursor: pointer; align-self: flex-start;
}
.trade-mon-extra-held { font-size: 11px; color: #555; }

@media (max-width: 768px) {
  /* Две колонки рядом: сравнить стороны можно без прокрутки. */
  .trade-modal { padding: 12px; }
  .trade-header { flex-wrap: wrap; gap: 6px; margin-bottom: 0; }
  .trade-header h2 { font-size: 16px; }
  .trade-status-badge { max-width: 100%; width: 100%; box-sizing: border-box; text-align: left; font-size: 11px; padding: 5px 10px; }
  .trade-sides { flex-direction: row; gap: 6px; margin: 10px 0; }
  .trade-divider { display: none; }
  .trade-side { min-width: 0; padding: 8px; gap: 8px; border-radius: 12px; }
  .trade-side-header { flex-wrap: wrap; gap: 4px; }
  .trade-player-name { font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
  .trade-ready-badge { font-size: 10px; padding: 2px 8px; }
  .trade-slot { padding: 6px; gap: 6px; border-radius: 10px; }
  .trade-slot-empty { padding: 10px 4px; font-size: 12px; text-align: center; }

  /* Свёрнутая карточка: спрайт, метка, имя, уровень, типы. Остальное — по тапу. */
  .trade-mon-card { align-items: flex-start; padding: 6px 6px 8px; }
  .trade-mon-sprite-wrap, .trade-mon-sprite { width: 44px; height: 44px; }
  .trade-mon-held { width: 18px; height: 18px; right: -3px; bottom: -3px; }
  .trade-mon-held-img { width: 13px; height: 13px; }
  .trade-mon-card .trade-mon-info { padding-right: 14px; gap: 2px; }
  .trade-mon-name { font-size: 13px; }
  .trade-mon-title { flex-wrap: wrap; row-gap: 0; }
  .trade-mon-sub { font-size: 11px; }
  .trade-mon-card .trade-slot-remove { top: 2px; right: 2px; font-size: 14px; padding: 2px 4px; }
  .tm-move-type-badge.trade-type-badge { font-size: 9px; padding: 1px 5px; }
  .trade-mon-card::after { content: '▾'; position: absolute; right: 6px; bottom: 2px; font-size: 11px; color: #aaa; }
  .trade-mon-card.is-open::after { content: '▴'; }
  .trade-mon-extra { display: none; padding: 6px 0 0; margin-top: 2px; border-top: 1px dashed #e0e0e0; }
  .trade-mon-card.is-open .trade-mon-extra { display: flex; flex-direction: column; gap: 4px; }
  .trade-mon-card.is-open .trade-mon-extra-held,
  .trade-mon-card.is-open .trade-mon-more-btn { display: block; }
  .trade-mon-build { font-size: 10.5px; }

  .trade-item-card, .trade-egg-card { position: relative; }
  .trade-item-card .trade-slot-info, .trade-egg-card .trade-slot-info { padding-right: 12px; min-width: 0; }
  .trade-egg-card .trade-slot-remove { position: absolute; top: 2px; right: 2px; font-size: 14px; padding: 2px 4px; }
  .trade-egg-card .trade-item-name { font-size: 12px; }
  .trade-egg-move { font-size: 10.5px; }
  .trade-item-card .trade-slot-remove { position: absolute; top: 2px; right: 2px; font-size: 14px; padding: 2px 4px; }
  .trade-item-img { width: 28px; height: 28px; }
  .trade-item-name { font-size: 12px; }
  .trade-item-card .trade-slot-info { min-width: 0; }
  .trade-item-card .trade-item-name { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .trade-offer-money { flex-wrap: wrap; gap: 4px 6px; font-size: 12px; }
  .trade-offer-money input { flex: 1 1 60px; min-width: 0; width: auto; padding: 5px 8px; }
  .money-balance { flex-basis: 100%; }
  .trade-new-tag { right: 6px; font-size: 9px; }
  .trade-change-notice { padding: 8px; }
  .trade-change-head { flex-wrap: wrap; }
  .trade-change-title { font-size: 12px; }
  .trade-change-list { font-size: 11px; }
  .trade-summary { font-size: 13px; }
}
/* Яйца в обмене (26.10): карточка — как у предмета, подписи служебные. */
.trade-egg-card .trade-slot-info, .trade-egg-row .trade-picker-info { gap: 2px; }
.trade-egg-move { font-size: 11px; color: #888; }
/* Гены яйца — по статам, сеткой 3×2 (в узкой колонке шесть в ряд не читаются): подпись служебная, число — главное. */
.trade-egg-ivs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; margin: 2px 0; width: 100%; max-width: 200px; }
.trade-egg-iv { display: flex; flex-direction: column; align-items: center; background: #f8f9fa; border-radius: 6px; padding: 2px 0; }
.trade-egg-iv-label { font-size: 9px; color: #aaa; line-height: 1.2; }
.trade-egg-iv-val { font-size: 12px; font-weight: 700; color: #1a1a2e; line-height: 1.2; }
.trade-egg-card { position: relative; }
.trade-picker-row.trade-egg-row.is-blocked .trade-picker-sprite { opacity: 0.45; filter: grayscale(1); }
/* Окно выбора не должно жить в высоте пустого окна обмена: шесть строк с фильтрами в него не влезают. */
.trade-modal:has(.trade-pokemon-picker) { min-height: min(560px, 88vh); }
.trade-picker-line { flex-wrap: wrap; row-gap: 2px; }
@media (max-width: 768px) {
  .trade-pokemon-picker { padding: 14px; }
  .trade-picker-row { gap: 8px; padding: 8px; }
  .trade-picker-add-btn { padding: 7px 10px; }
  .trade-picker-preview-btn { padding: 6px 8px; }
}

/* ── Pokemon preview modal ─────────────────────────────────────────────── */
.trade-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: tradePreviewIn 0.18s ease;
}
@keyframes tradePreviewIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.trade-preview-card {
  background: white;
  border-radius: 20px;
  padding: 18px 20px;
  max-width: 380px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}
.trade-preview-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  font-size: 20px;
  color: #999;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  line-height: 1;
}
.trade-preview-close:hover { background: #f0f0f0; color: #333; }

.trade-preview-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.trade-preview-sprite {
  width: 84px;
  height: 84px;
  object-fit: contain;
  image-rendering: pixelated;
  flex-shrink: 0;
}
.trade-preview-title { flex: 1; min-width: 0; }
.trade-preview-name {
  font-size: 17px;
  font-weight: 700;
  color: #1a1a2e;
}
.trade-preview-gender { color: #888; font-weight: 400; }
.trade-preview-nick {
  font-size: 13px;
  color: #888;
  font-style: italic;
}
.trade-preview-lvl {
  font-size: 13px;
  color: #555;
  font-weight: 600;
  margin-top: 2px;
}

.trade-preview-meta {
  font-size: 13px;
  line-height: 1.6;
  color: #333;
  padding: 10px 12px;
  background: #f8f9fa;
  border-radius: 10px;
  margin-bottom: 12px;
}
.trade-preview-meta-label {
  font-weight: 600;
  color: #666;
  margin-right: 4px;
}

.trade-preview-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}
.trade-preview-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px;
  background: #f8f9fa;
  border-radius: 8px;
}
.trade-preview-stat-label {
  font-size: 10px;
  text-transform: uppercase;
  color: #888;
  letter-spacing: 0.3px;
}
.trade-preview-stat-val {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a2e;
}
.trade-preview-stat-iv {
  font-size: 10px;
  color: #aaa;
  margin-top: 1px;
}

.trade-preview-moves-label {
  font-size: 12px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 6px;
}
.trade-preview-moves {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.trade-preview-moves li {
  padding: 8px 12px;
  background: #f0f4ff;
  border-radius: 8px;
  font-size: 13px;
  color: #1a1a2e;
  text-align: center;
}
.trade-preview-moves-empty {
  grid-column: 1 / -1;
  background: transparent !important;
  color: #999 !important;
  font-style: italic;
}

/* ── Evolution stones ──────────────────────────────────────────────────── */
.inv-stone-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.inv-stone-circle-detail {
  width: 96px;
  height: 96px;
}
.inv-stone-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  image-rendering: pixelated;
}
.inv-stone-circle-detail .inv-stone-img {
  width: 64px;
  height: 64px;
}

/* ── Stone picker bottom sheet ─────────────────────────────────────────── */
/* Positioning + z-index are set inline in openStonePokemonPicker so the
   picker can be the only modal on screen without fighting any cascade.
   These rules cover the inner layout only. */
@keyframes stoneSheetSlide {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
@keyframes stoneSheetSlide {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.stone-picker-grabber {
  width: 36px;
  height: 4px;
  background: #ddd;
  border-radius: 2px;
  margin: 0 auto 16px;
}
.stone-picker-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.stone-picker-title {
  flex: 1;
  min-width: 0;
}
.stone-picker-name {
  font-size: 17px;
  font-weight: 700;
  color: #1a1a2e;
}
.stone-picker-sub {
  font-size: 13px;
  color: #888;
  margin-top: 2px;
}
.stone-picker-close {
  background: none;
  border: none;
  font-size: 20px;
  color: #999;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  line-height: 1;
}
.stone-picker-close:hover { background: #f0f0f0; color: #333; }

.stone-picker-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stone-picker-empty {
  text-align: center;
  color: #888;
  padding: 48px 24px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
}

/* Vitamin stat badge + progress bar inside the picker */
.inv-vitamin-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1.4;
  margin-top: 3px;
}
.vitamin-progress-track {
  height: 4px;
  background: #f0f0f0;
  border-radius: 2px;
  margin-top: 5px;
  overflow: hidden;
}
.vitamin-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.25s ease;
}

/* Vitamin quantity stepper (inside the confirm box) */
.vitamin-qty-row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  margin: 10px 0 6px;
  flex-wrap: wrap;
}
.vitamin-qty-btn {
  width: 36px;
  height: 36px;
  border: 1px solid #ddd;
  border-radius: 10px;
  background: #f5f5f5;
  font-size: 18px;
  font-weight: 700;
  color: #1a1a2e;
  cursor: pointer;
  line-height: 1;
  transition: background 0.1s;
}
.vitamin-qty-btn:hover   { background: #eee; }
.vitamin-qty-btn:active  { transform: scale(0.95); }
.vitamin-qty-input {
  width: 64px;
  height: 36px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  color: #1a1a2e;
  background: white;
  -moz-appearance: textfield;
}
.vitamin-qty-input::-webkit-outer-spin-button,
.vitamin-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.vitamin-qty-max {
  padding: 0 12px;
  height: 36px;
  border: 1px solid #ddd;
  border-radius: 10px;
  background: #f5f5f5;
  font-size: 12px;
  font-weight: 700;
  color: #666;
  cursor: pointer;
  text-transform: lowercase;
}
.vitamin-qty-max:hover  { background: #eee; color: #333; }
.vitamin-qty-hint {
  text-align: center;
  font-size: 12px;
  color: #888;
  margin-bottom: 8px;
}

/* Inventory toast (vitamin success etc.) */
.inv-toast {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30,30,50,0.94);
  backdrop-filter: blur(8px);
  color: white;
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  z-index: 12500;
  box-shadow: 0 8px 28px rgba(0,0,0,0.25);
  animation: invToastIn 0.25s ease;
  opacity: 1;
  transition: opacity 0.35s ease;
}
.inv-toast-hide { opacity: 0; }
@keyframes invToastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(6px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.stone-picker-loading {
  text-align: center;
  color: #666;
  padding: 16px 0;
  font-size: 14px;
}
.stone-picker-error {
  text-align: center;
  color: #f44336;
  padding: 12px 0;
  font-size: 13px;
}

.stone-pokemon-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8f9fa;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.stone-pokemon-row:hover { background: #eef7ee; }
.stone-pokemon-row:active { transform: scale(0.98); }
.stone-pokemon-sprite {
  width: 56px;
  height: 56px;
  object-fit: contain;
  image-rendering: pixelated;
  flex-shrink: 0;
}
.stone-pokemon-info {
  flex: 1;
  min-width: 0;
}
.stone-pokemon-name {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a2e;
}
.stone-pokemon-level {
  color: #aaa;
  font-weight: 400;
  font-size: 13px;
  margin-left: 4px;
}
.stone-pokemon-evo {
  font-size: 13px;
  color: #666;
  margin-top: 2px;
}
.stone-pokemon-where {
  font-size: 11px;
  color: #bbb;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-top: 2px;
}
.stone-pokemon-chevron {
  font-size: 22px;
  color: #ddd;
  flex-shrink: 0;
}

/* ── Evolution animation overlay ───────────────────────────────────────── */
.evolution-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 13000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  transition: opacity 0.3s ease;
}
.evolution-overlay.evolution-fade-out {
  opacity: 0;
}
.evolution-stage {
  position: relative;
  width: 160px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.evolution-sprite {
  width: 160px;
  height: 160px;
  object-fit: contain;
  image-rendering: pixelated;
  position: relative;
  z-index: 2;
}
.evolution-glow {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.6) 0%, rgba(255,255,255,0) 70%);
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}
.evolution-label {
  color: white;
  font-size: 18px;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
  text-align: center;
  padding: 0 24px;
}
@keyframes evolutionFlash {
  0%   { filter: brightness(1); }
  20%  { filter: brightness(6) saturate(0); }
  40%  { filter: brightness(1); }
  55%  { filter: brightness(8) saturate(0); }
  70%  { filter: brightness(1); }
  85%  { filter: brightness(10) saturate(0); }
  100% { filter: brightness(1); }
}
@keyframes evolutionScale {
  0%   { transform: scale(1) rotate(0deg); }
  50%  { transform: scale(1.25) rotate(0deg); }
  100% { transform: scale(1) rotate(0deg); }
}
.evolution-animation {
  animation: evolutionFlash 2.4s ease, evolutionScale 2.4s ease;
}

/* Ability name — hover tooltip (desktop) */
.ability-name {
  cursor: help;
  border-bottom: 1px dashed #ccc;
  position: relative;
}
@media (min-width: 769px) {
.ability-name[data-desc]:not([data-desc=""]):hover::after {
  content: attr(data-desc);
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: rgba(20,20,40,0.95);
  backdrop-filter: blur(8px);
  color: white;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  padding: 10px 14px;
  border-radius: 12px;
  width: 220px;
  white-space: normal;
  z-index: 99999;
  pointer-events: none;
}
}

/* ── Admin · Pokedex tab ───────────────────────────────────────────── */
.pdx-wrap { padding: 4px 0 0; }

.admin-pokedex-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: #f0f2f8;
  padding: 3px;
  border-radius: 10px;
  width: fit-content;
}
.pdx-tab {
  padding: 6px 16px;
  border: none;
  border-radius: 8px;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s;
}
.pdx-tab.active { background: #5B5FEF; color: #fff; }
.pdx-tab:hover:not(.active) { color: #1a1a2e; }

.pdx-search-row {
  margin-bottom: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.pdx-search-row input {
  flex: 1;
  padding: 10px 16px;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  font-size: 14px;
  outline: none;
  background: #fff;
}
.pdx-search-row input:focus { border-color: #5B5FEF; }
.pdx-add-new-btn {
  background: #5B5FEF;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s;
}
.pdx-add-new-btn:hover { background: #4f46e5; }

.pdx-search-results {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}
.pdx-search-results:not(:empty) {
  border: 1px solid #e5e7eb;
}
.pdx-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.15s;
}
.pdx-result-item:hover { background: #f8f9fa; }
.pdx-result-item:last-child { border-bottom: none; }
.pdx-result-item img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  image-rendering: pixelated;
  flex-shrink: 0;
}
.pdx-result-name { font-weight: 600; color: #1a1a2e; }
.pdx-result-num  { color: #9ca3af; font-size: 12px; font-weight: 600; }
.pdx-result-id   { color: #9ca3af; font-size: 11px; margin-left: auto; font-family: monospace; }
.pdx-empty {
  font-size: 13px;
  color: #9ca3af;
  font-style: italic;
  padding: 12px 14px;
  text-align: center;
}

/* Статус публикации: правки лежат в Firestore, игроки читают статику — между
   ними стоит scripts/publish-pokedex.sh. Блок-подсказка, не кнопка. */
.pdx-publish {
  margin: -6px 0 14px;
}
.pdx-publish:empty { display: none; }
.pdx-publish-line {
  font-size: 12px;
  color: #6b7280;
  padding: 8px 12px;
  background: #f8f9fa;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}
.pdx-publish-line.pending {
  color: #92400e;
  background: #fffbeb;
  border-color: #fde68a;
}
.pdx-publish-cmd {
  font-size: 11px;
  color: #9ca3af;
  padding: 4px 12px 0;
}
.pdx-publish-cmd code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #f3f4f6;
  border-radius: 5px;
  padding: 1px 5px;
  color: #4b5563;
}

.pdx-placeholder {
  font-size: 13px;
  color: #9ca3af;
  font-style: italic;
  padding: 24px 14px;
  text-align: center;
  background: #f8f9fa;
  border: 1px dashed #e5e7eb;
  border-radius: 12px;
}

.pdx-editor-card {
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 16px;
  padding: 20px;
  margin-top: 12px;
}
.pdx-editor-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e5e7eb;
}
.pdx-editor-header img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  image-rendering: pixelated;
}
.pdx-eh-name { font-size: 18px; font-weight: 800; color: #1a1a2e; }
.pdx-eh-meta { font-size: 12px; color: #9ca3af; margin-top: 2px; }
.pdx-customized {
  color: #5B5FEF;
  font-weight: 600;
  margin-left: 8px;
}

.pdx-fields { display: flex; flex-direction: column; gap: 14px; }
.pdx-field  { display: flex; flex-direction: column; gap: 4px; }
.pdx-field label {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.pdx-field input,
.pdx-field select,
.pdx-field textarea {
  padding: 8px 12px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  resize: vertical;
  background: #fff;
  color: #1a1a2e;
}
.pdx-field input:focus,
.pdx-field select:focus,
.pdx-field textarea:focus { border-color: #5B5FEF; }
.pdx-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.pdx-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}
.pdx-save-btn {
  background: #5B5FEF;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.pdx-save-btn:hover { background: #4f46e5; }
.pdx-cancel-btn {
  background: none;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 600;
  color: #374151;
  transition: all 0.15s;
}
.pdx-cancel-btn:hover { background: #f8f9fa; border-color: #d1d5db; }
.pdx-save-status { font-size: 13px; color: #6b7280; }

.pdx-stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.pdx-stat-input {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.pdx-stat-input label {
  font-size: 10px;
  color: #9ca3af;
  font-weight: 600;
  text-transform: uppercase;
}
.pdx-stat-input input {
  padding: 6px 8px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  text-align: center;
  outline: none;
  width: 100%;
  background: #fff;
  color: #1a1a2e;
}
.pdx-stat-input input:focus { border-color: #5B5FEF; }
@media (max-width: 600px) {
  .pdx-stats-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Learnset editor */
.ls-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid #f3f4f6;
}
.ls-section:last-of-type { border-bottom: none; margin-bottom: 12px; padding-bottom: 12px; }
.ls-section-title {
  font-size: 14px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ls-count {
  background: #f0f2f8;
  color: #6b7280;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.ls-move-list { display: flex; flex-direction: column; gap: 4px; }
.ls-move-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: #f8f9fa;
  border-radius: 8px;
  font-size: 13px;
}
.ls-level {
  font-size: 11px;
  font-weight: 700;
  color: #5B5FEF;
  min-width: 52px;
  flex-shrink: 0;
}
.ls-move-name { font-weight: 600; flex: 1; color: #1a1a2e; }
.ls-move-id   { font-size: 11px; color: #9ca3af; font-family: monospace; }
.ls-remove-btn {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 14px;
  padding: 0 6px;
  flex-shrink: 0;
  opacity: 0.6;
}
.ls-remove-btn:hover { opacity: 1; }

.ls-move-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.ls-tm-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #eef0ff;
  color: #5B5FEF;
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}
.ls-tm-chip button {
  background: none;
  border: none;
  color: #5B5FEF;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  opacity: 0.6;
}
.ls-tm-chip button:hover { opacity: 1; }

.ls-add-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.ls-add-row input {
  flex: 1;
  padding: 7px 12px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  background: #fff;
  color: #1a1a2e;
}
.ls-add-row input:focus { border-color: #5B5FEF; }
.ls-add-level-input { flex: 0 0 70px; }
.ls-add-row button {
  background: #5B5FEF;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.ls-add-row button:hover { background: #4f46e5; }
.ls-empty {
  font-size: 13px;
  color: #9ca3af;
  font-style: italic;
  padding: 8px;
}

.pdx-result-hidden {
  color: #ef4444;
  font-size: 11px;
  font-weight: 600;
  margin-left: auto;
}
.pdx-toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  padding: 8px 0;
}
.pdx-toggle-row input { display: none; }
.pdx-toggle-track {
  width: 40px;
  height: 22px;
  background: #e5e7eb;
  border-radius: 50px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.pdx-toggle-row input:checked + .pdx-toggle-track { background: #ef4444; }
.pdx-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.pdx-toggle-row input:checked + .pdx-toggle-track .pdx-toggle-thumb {
  transform: translateX(18px);
}

@media (max-width: 640px) {
  .pdx-field-row { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════════════
   DESKTOP BATTLE SCREEN (≥769px)
   Two columns under the arena (log | controls), dark panel in tone with the
   scene, dominant 2×2 attack grid, coloured log. Mobile (≤768px) is handled
   by the @media (max-width:768px) block above and is intentionally untouched.
   ═══════════════════════════════════════════════════════════════════════ */
@media (min-width: 769px) {
  /* Scene grows to fill the modal; controls panel takes a fixed slice at the
     bottom (kills the huge empty zone — arena absorbs the spare height). */
  .bt-arena {
    flex: 1 1 auto;
    height: auto;
    min-height: 240px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas: "p1 p2" "field field";
    column-gap: 0;
  }
  #bt-field   { grid-area: field; min-height: 0; }

  /* Trainer avatars become a thin header bar above the full-width scene */
  #bt-panel-p1, #bt-panel-p2 {
    flex-direction: row;
    align-items: center;
    width: auto;
    gap: 8px;
    padding: 7px 14px;
    background: rgba(255, 255, 255, 0.82);
    border: none;
    box-shadow: none;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
  #bt-panel-p1 { grid-area: p1; justify-content: flex-start; }
  #bt-panel-p2 { grid-area: p2; justify-content: flex-end; }
  .bt-panel-avatar { order: -1; width: 36px; height: 36px; font-size: 0.95rem; }
  .bt-panel-name { color: #2a2a35; max-width: 130px; }
  .bt-panel-team { width: auto; }
  .bt-panel-grid { grid-template-columns: repeat(6, 1fr); gap: 3px; }
  .bt-slot { width: 22px; height: 22px; }
  .bt-slot-icon, .bt-slot-ball { width: 24px; height: 24px; }
  .bt-slot-empty-circle { width: 15px; height: 15px; }

  /* Light-grey controls panel — vertical stack: log (grows) → prompt →
     attacks (4-in-a-row) → action buttons. */
  .bt-bottom {
    flex: 0 0 auto;
    height: 360px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 14px 18px;
    background: #f0f0f5;
    border-top: 1px solid rgba(0,0,0,0.08);
    color: #2a2a35;
  }
  .bt-bottom > .mob-battle-statusbar { display: none; }

  /* Battle log — full width, grows to fill the panel (~half its height) */
  .bt-bottom > .bt-log {
    flex: 1 1 auto;
    min-height: 140px;
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.10);
    border-radius: 8px;
    padding: 10px 14px;
  }

  /* Attacks: a single compact row of four — never grows */
  #bt-attack-section { flex: 0 0 auto; }
  #bt-attack-section .bt-move-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: 1fr;
    gap: 8px;
  }
  .bt-prompt-row { flex: 0 0 auto; }
  .bt-prompt-row { padding: 0 2px; }
  .bt-prompt-text { color: #4a4a55; }
  .bt-prompt-text strong { color: #1a1a25; }
  .bt-hp-badge { background: #e6e6ee; border-color: rgba(0,0,0,0.1); color: #4a4a55; }
  .bt-timer { background: #fff; border-color: rgba(0,0,0,0.12); color: #4a4a55; }
  .bt-timer.urgent { background: #fff0f0; border-color: #c73c1a; color: #c73c1a; }
  .bt-section-label { color: #6a6a75; }

  /* Compact 4-in-a-row attack buttons — vertical: icon → name → PP */
  .bt-move-grid { gap: 8px; }
  .bt-move-btn {
    min-height: 72px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 3px;
    padding: 8px;
    border-width: 2px;
    border-radius: 10px;
    transition: filter 0.12s, transform 0.12s, box-shadow 0.12s;
  }
  .bt-move-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  }
  .bt-move-btn:active:not(:disabled) { transform: translateY(1px); filter: brightness(0.96); }
  /* Adaptive name size for long move names; ellipsis + title tooltip beyond */
  .bt-move-name { font-size: clamp(11px, 0.92vw, 14px); font-weight: 700; color: #2a2a35; max-width: 100%; line-height: 1.15; }
  .bt-move-type { width: 26px; height: 26px; }
  .bt-move-pp   { font-size: 0.66rem; color: #888; font-variant-numeric: tabular-nums; }
  .bt-move-empty { background: rgba(0,0,0,0.02); border: 2px dashed rgba(0,0,0,0.12); }
  .bt-move-empty .bt-move-name { color: #bbb; }

  /* Coloured log on the cream background — dark text, readable size */
  .bt-bottom > .bt-log .bt-log-line {
    color: #2a2a30;
    font-size: 0.84rem;
    line-height: 1.5;
    padding: 2px 2px;
  }
  .bt-bottom > .bt-log .bt-log-line b,
  .bt-bottom > .bt-log .bt-log-line strong { color: #2a2a30; font-weight: 700; }
  .bt-bottom > .bt-log .bt-log-turn {
    color: #6a6a70;
    font-size: 0.82rem;
    border-bottom: 1px dashed rgba(0,0,0,0.18);
    padding: 8px 2px 3px;
  }
  .bt-bottom > .bt-log .bt-log-damage   { color: #c73c1a; }
  .bt-bottom > .bt-log .bt-log-heal     { color: #1a8a3c; }
  .bt-bottom > .bt-log .bt-log-super    { color: #d4940a; font-weight: 700; }
  .bt-bottom > .bt-log .bt-log-crit     { color: #d4940a; font-weight: 700; }
  .bt-bottom > .bt-log .bt-log-resisted { color: #8a8a90; }
  .bt-bottom > .bt-log .bt-log-faint    { color: #4a4a52; font-style: italic; }
  .bt-bottom > .bt-log .bt-log-status   { color: #7a2d8a; }
  .bt-bottom > .bt-log .bt-log-hazard   { color: #8a6a10; }
  .bt-bottom > .bt-log .bt-log-result   { color: #1a1a20; border-top: 1px solid rgba(0,0,0,0.15); }
}

/* Per-side actor-name colouring in the log: own = blue, opponent = red.
   Targets the first <b> (the Pokémon name; move names are the 2nd <b>).
   Applies on every viewport — the log is light on desktop and mobile. */
/* Per-name side colour: every Pokémon name in the log is wrapped in a
   <span class="bt-name-p1|p2"> (own → blue, foe → red), so a grouped line colours
   EVERY mention, not just the first <b>. !important beats the mobile b/strong rule
   when a name span sits inside a template's <b>. */
.bt-log .bt-name-p1 { color: #1a5dc7 !important; font-weight: 700; }
.bt-log .bt-name-p2 { color: #c73c1a !important; font-weight: 700; }

/* ── Клик по покемону → карточка покедекса (js/ui/battleDexLink.js) ─────────
   Имя в логе — настоящая <a> (работают средняя кнопка и Ctrl+клик), поэтому
   гасим подчёркивание и наследуем цвет стороны: ссылка не должна перекрашивать
   имя в синий браузерный. Пунктир снизу показывает, что она кликабельна, и
   появляется только на hover — лог и без того плотный. */
.bt-log .bt-name-dex { text-decoration: none; color: inherit; }
.bt-log .bt-name-dex:hover span { text-decoration: underline dotted; text-underline-offset: 2px; }

/* Картинки (спрайт поля, иконки ряда, мобильная полоса) кликабельны ровно
   тогда, когда на них есть data-dex. Атрибут ставится ТОЛЬКО для вида, который
   реально есть в покедексе, — значит «курсор-рука» и «ссылка работает» это
   один и тот же факт, а не два согласованных. */
[data-dex] { cursor: pointer; }
.bt-sprite[data-dex]:hover { filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5)) brightness(1.08); }
.bt-slot-icon[data-dex]:hover, .sbar-ball-icon[data-dex]:hover { transform: scale(1.12); }

/* ── Приглашение на спарку (входящий запрос) ────────────────────────────────
   Раньше это был обычный белый тост от системы обменов (.trade-request-toast):
   аватар-заглушка, строчка текста и две серые кнопки. Теперь — тёплая карточка
   со спрайтом покемона-инициатора, чипами пола/буквы и полоской обратного
   отсчёта: окно запроса всего 60 секунд, и раньше игрок его не видел. */
.breed-request-toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: min(380px, calc(100vw - 24px));
  padding: 14px 16px 0;
  border-radius: 20px;
  background: linear-gradient(160deg, #fff 0%, #fff5f8 100%);
  border: 1.5px solid #f9cfe0;
  box-shadow: 0 12px 34px rgba(214, 51, 108, 0.18);
  z-index: 11000;
  overflow: hidden;
  animation: tradeToastIn 0.3s ease;
}
.breed-req-top { display: flex; align-items: center; gap: 12px; }
.breed-req-sprite-wrap {
  position: relative;
  width: 56px; height: 56px;
  flex-shrink: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, #ffe3ee 0%, #fdd0e2 100%);
  display: flex; align-items: center; justify-content: center;
}
.breed-req-sprite { width: 46px; height: 46px; object-fit: contain; image-rendering: pixelated; }
.breed-req-heart {
  position: absolute; right: -4px; bottom: -2px;
  font-size: 15px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15));
}
.breed-req-body { flex: 1; min-width: 0; }
.breed-req-title { font-size: 14px; color: #4a4a55; line-height: 1.25; }
.breed-req-title b { color: #d6336c; font-weight: 800; }
.breed-req-mon {
  display: flex; align-items: center; flex-wrap: wrap; gap: 5px;
  margin-top: 4px;
}
.breed-req-mon-name { font-size: 13px; font-weight: 700; color: #1a1a2e; }
.breed-req-lv { font-size: 11px; color: #9aa0a6; }
.breed-req-actions { display: flex; gap: 8px; margin: 12px 0 14px; }
.breed-req-btn {
  flex: 1;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
}
.breed-req-btn:active { transform: scale(0.97); }
.breed-req-yes {
  border: none;
  color: #fff;
  background: linear-gradient(135deg, #f76a9b 0%, #d6336c 100%);
  box-shadow: 0 4px 12px rgba(214, 51, 108, 0.32);
}
.breed-req-yes:hover { box-shadow: 0 6px 16px rgba(214, 51, 108, 0.42); }
.breed-req-no {
  background: #fff;
  border: 1.5px solid #e6e6ee;
  color: #8a8a99;
}
.breed-req-no:hover { background: #f6f6fa; color: #5a5a6a; }
/* Полоска обратного отсчёта: длительность выставляется инлайном по реальному
   остатку времени сессии, поэтому она честная, а не «примерно 60 секунд». */
.breed-req-timer { height: 3px; background: #f7e0e9; margin: 0 -16px; }
.breed-req-timer i {
  display: block; height: 100%;
  background: linear-gradient(90deg, #f76a9b, #d6336c);
  transform-origin: left center;
  animation: breedReqCountdown linear forwards;
}
@keyframes breedReqCountdown {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}
@media (max-width: 480px) {
  .breed-request-toast { top: 10px; padding: 12px 14px 0; }
  .breed-req-timer { margin: 0 -14px; }
}

/* ── Туториал Оука (Этап 1): скрим-с-дыркой + плашка ───────────────────────
   Слой живёт между обычным UI и критичными подтверждениями: скрим 12800 /
   кольцо 12850 / плашка 12900 (модалки .modal-overlay = 10000, confirm-диалоги
   99999). При открытых модалках слой прячется в JS (isBlockingUiOpen). */
.tut-hole {
  position: fixed;
  z-index: 12800;
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  transition: top 0.18s ease-out, left 0.18s ease-out,
              width 0.18s ease-out, height 0.18s ease-out,
              opacity 0.25s ease, visibility 0.25s ease;
}
.tut-ring {
  position: fixed;
  z-index: 12850;
  border: 2px solid rgba(66, 165, 245, 0.9);
  border-radius: 12px;
  pointer-events: none;
  animation: evPulse 1.8s ease-in-out infinite;
  transition: top 0.18s ease-out, left 0.18s ease-out,
              width 0.18s ease-out, height 0.18s ease-out,
              opacity 0.25s ease, visibility 0.25s ease;
}
.tut-tip {
  position: fixed;
  z-index: 12900;
  max-width: 280px;
  background: linear-gradient(160deg, rgba(28, 34, 48, 0.97), rgba(18, 22, 32, 0.97));
  border: 1px solid rgba(66, 165, 245, 0.35);
  border-radius: 12px;
  padding: 12px 14px;
  color: #fff;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  transition: top 0.18s ease-out, left 0.18s ease-out,
              opacity 0.25s ease, visibility 0.25s ease;
}
.tut-tip-text {
  font-size: 0.85rem;
  line-height: 1.45;
}
/* Полоса EXP-прогресса к 16-му уровню (квест 1; tutorialOverlay eff.progress) */
.tut-tip-bar {
  margin-top: 8px;
  height: 4px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 2px;
  overflow: hidden;
}
.tut-tip-bar[hidden] { display: none; }
.tut-tip-bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #42A5F5, #66BB6A);
  border-radius: 2px;
  transition: width 0.3s ease-out;
}
/* Действия плашки: «Понятно» (основная) + «Скрыть подсказки» (вторичная ссылка) */
.tut-tip-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
}
.tut-tip-ok {
  padding: 6px 16px;
  background: rgba(66, 165, 245, 0.9);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 30px;                 /* тап-цель на мобилке */
}
.tut-tip-ok:hover { background: rgba(66, 165, 245, 1); }
.tut-tip-danger {
  padding: 6px 14px;
  background: rgba(229, 57, 53, 0.85);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 30px;
}
.tut-tip-danger:hover { background: rgba(229, 57, 53, 1); }
.tut-tip-hide {
  padding: 4px 0;                   /* без фона: заметно меньше «Понятно», но тапабельно */
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.72rem;
  cursor: pointer;
  text-decoration: underline;
}
.tut-tip-hide:hover { color: rgba(255, 255, 255, 0.75); }
/* Подтверждение «Скрыть» — внутри плашки: обычное содержимое прячется, показывается блок */
.tut-tip-confirm { display: none; }
.tut-tip.tut-tip-confirming > .tut-tip-text,
.tut-tip.tut-tip-confirming > .tut-tip-bar,
.tut-tip.tut-tip-confirming > .tut-tip-actions { display: none; }
.tut-tip.tut-tip-confirming > .tut-tip-confirm { display: block; }
/* Одноразовые механические подсказки (hintBubble.js) — кнопка «Понятно»
   заметнее, чем ссылка «Скрыть подсказки» туториала */
.hint-tip-ok {
  margin-top: 10px;
  padding: 6px 16px;
  background: rgba(66, 165, 245, 0.9);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.hint-tip-ok:hover { background: rgba(66, 165, 245, 1); }
.tut-hidden {
  opacity: 0;
  visibility: hidden;
}

/* Э3: боевой рюкзак (.bt-bag-overlay) живёт на z-99999 — при подсветке
   секции «Поймать» слой поднимается выше, но остаётся ниже move-info (999998). */
.tut-hole.tut-elevated { z-index: 100000; }
.tut-ring.tut-elevated { z-index: 100010; }
.tut-tip.tut-elevated  { z-index: 100020; }

@media (prefers-reduced-motion: reduce) {
  .tut-hole, .tut-ring, .tut-tip { transition: none !important; }
  .tut-ring { animation: none !important; }
}

/* ── Питомник: панель фильтров ──────────────────────────────────────────────
   Сворачиваемая намеренно: медиана питомника — ОДИН покемон, и сетка из десяти
   полей над одним спрайтом мешала бы всем ради единиц. Стиль — тот же светлый
   ключ, что у строки поиска (#ddd рамка, радиус 10, акцент #4CAF50). */
.pc-search-row { display: flex; gap: 6px; align-items: flex-start; }
.pc-search-row .pc-search-wrap { flex: 1 1 auto; min-width: 0; }
.pc-f-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1.5px solid #ddd;
  border-radius: 10px;
  background: #fff;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.pc-f-toggle:hover { border-color: #bbb; }
.pc-f-toggle.is-open { border-color: #4CAF50; color: #2e7d32; }
.pc-f-toggle.is-active { border-color: #4CAF50; }
.pc-f-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #4CAF50;
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}
.pc-filters {
  margin: 6px 0 8px;
  padding: 10px;
  border: 1.5px solid #e4e4e4;
  border-radius: 12px;
  background: #fafafa;
}
.pc-f-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
}
/* Узкая колонка питомника на телефоне: два поля в ряд становятся нечитаемыми. */
@media (max-width: 560px) { .pc-f-grid { grid-template-columns: 1fr; } }
.pc-f-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pc-f-label { font-size: 11px; color: #888; padding-left: 2px; }
.pc-f-select,
.pc-f-input {
  width: 100%;
  padding: 7px 10px;
  border: 1.5px solid #ddd;
  border-radius: 10px;
  background: #fff;
  font-family: inherit;
  font-size: 0.78rem;
  color: #333;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.pc-f-select:focus,
.pc-f-input:focus { border-color: #4CAF50; }
.pc-f-range { display: flex; gap: 6px; }
.pc-f-range .pc-f-input { width: 50%; }
/* «Ген»: выбор стата + значение в одной строке, как границы уровня. */
.pc-f-range .pc-f-select { width: 50%; }
.pc-f-actions { display: flex; gap: 8px; margin-top: 10px; }
/* «Показывать типы на карточках» — настройка показа, не фильтр: стоит над полями отдельной строкой. */
.pc-f-check { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; padding: 2px 2px 10px;
  border-bottom: 1px dashed #e0e0e0; font-size: 12.5px; color: #444; cursor: pointer; user-select: none; }
.pc-f-check input { width: 18px; height: 18px; margin: 0; accent-color: #4CAF50; cursor: pointer; }
.pc-f-btn {
  flex: 1 1 0;
  padding: 8px 12px;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.pc-f-btn-apply { background: #4CAF50; color: #fff; }
.pc-f-btn-apply:hover { background: #43a047; }
.pc-f-btn-reset { background: #eee; color: #555; }
.pc-f-btn-reset:hover { background: #e2e2e2; }

/* ── Мега-эволюция: переключатель над сеткой атак ─────────────────────────────
   Виден только при canMegaEvo (battleUI.renderMegaToggle); включённый добавляет к
   следующей атаке суффикс ` mega` и сбрасывается после хода. [hidden] прописан явно:
   иначе display:flex перебил бы атрибут и пустой переключатель висел бы всегда. */
.bt-mega-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 10px;
  border: 2px solid rgba(143, 88, 230, 0.55);
  background: rgba(143, 88, 230, 0.08);
  color: #5b2aa8;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, color 0.15s;
}
.bt-mega-toggle[hidden] { display: none; }
.bt-mega-toggle:hover { background: rgba(143, 88, 230, 0.16); }
.bt-mega-toggle:focus-visible { outline: 2px solid #8f58e6; outline-offset: 2px; }
.bt-mega-ring {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  box-sizing: border-box;
  border-radius: 50%;
  border: 2px solid currentColor;
}
.bt-mega-toggle.armed {
  background: linear-gradient(135deg, #8a5cf6 0%, #d946ef 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25), 0 4px 16px -4px rgba(217, 70, 239, 0.8);
}
.bt-mega-toggle.armed .bt-mega-ring {
  background: #fff;
  border-color: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.9);
}
@media (max-width: 768px) {
  .bt-mega-toggle { min-height: 40px; font-size: 0.8rem; }
}
@media (prefers-reduced-motion: reduce) {
  .bt-mega-toggle { transition: none; }
}

/* ── Тюрьма: плашка со сроком (js/ui/jailBanner.js, 28.11) ── */
.jail-banner {
  position: fixed;
  top: calc(var(--header-h) + 10px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 900;
  max-width: min(92vw, 440px);
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 97, 97, 0.55);
  background: rgba(24, 14, 16, 0.92);
  color: #f3eaea;
  text-align: center;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
.jail-banner[hidden] { display: none; }
.jail-banner-title { font-weight: 700; letter-spacing: 0.04em; color: #ff8a8a; }
.jail-banner-reason { margin-top: 2px; font-size: 13px; overflow-wrap: anywhere; }
.jail-banner-left { margin-top: 4px; font-size: 13px; color: #d9c9c9; }

/* ── Инспектор (28.11): ник и чип — те же места, что у модератора ── */
.g-username.role-inspector,
.mob-prof-nick.role-inspector,
.friend-name.role-inspector,
.chat-author-inspector,
.dm-conv-name.role-inspector,
.dm-head-name.role-inspector,
.dm-head-name.role-inspector:hover { color: var(--role-inspector); }
.player-name.role-inspector { color: var(--role-inspector); font-weight: 700; }
.prof-role-chip.role-inspector {
  background: rgba(var(--role-inspector-rgb), 0.20);
  border: 1px solid rgba(var(--role-inspector-rgb), 0.55);
  color: #ffd2a6;
}

/* ── Панель «Выдача» (js/ui/grantPanel.js, 29.11) ── */
.grant-panel .grant-grid6 { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin-top: 6px; }
.grant-panel .grant-grid6 label { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--adm-faint, rgba(255,255,255,.55)); }
.grant-panel .grant-grid6 .admin-input { width: 100%; min-width: 0; }
.grant-panel .grant-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
@media (max-width: 520px) { .grant-panel .grant-grid6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
