/* ==========================================================================
   Школа RPG — Mini App
   Арт-дирекшн «ШКОЛЬНЫЙ КЛАСС + ТЕТРАДНЫЙ ЛИСТ»:
   деревянные стены класса и дневной свет из окон, меловая доска в дубовой
   раме, карточки — плотные листы тетради в клетку с красной полосой полей,
   нижнее меню — деревянный пенал с цветными иконками.
   Никаких размытых тёмно-болотных кругов и «тёмной каши».
   ========================================================================== */

:root {
  /* --- Дерево класса --- */
  --wood-deep: #241a12;
  --wood: #43301e;
  --wood-mid: #4e3421;
  --wood-light: #6d482c;
  --wood-warm: #8a5a34;
  --frame: #5a3d28;            /* массивная рама меловой доски */

  /* --- Дневной свет из окон --- */
  --daylight: #fff3cf;

  /* --- Меловая доска --- */
  --board: #1a3323;
  --board-deep: #142a1c;
  --chalk: #f3f7ef;
  --chalk-yellow: #ffe066;

  /* --- Тетрадный лист --- */
  --paper: #f8f2e0;
  --paper-2: #efe6cb;
  --paper-edge: #cbba90;
  /* Сетка листа смягчена: тонкие линии не спорят с текстом и бейджами */
  --grid-line: rgba(84, 124, 168, 0.085);
  --grid-line-soft: rgba(84, 124, 168, 0.05);
  --margin-line: rgba(200, 58, 58, 0.5);

  /* --- Чернила и маркеры --- */
  --ink: #241f18;
  --ink-soft: #4a3f2f;
  --ink-faint: rgba(36, 31, 24, 0.55);
  --red-ink: #b8302c;
  --blue-ink: #23508f;
  --green-ink: #1c7a44;
  --gold-ink: #a2700d;
  --epic-ink: #6b3fb5;
  --cyan-ink: #1c6f86;

  /* --- Графит (тёмные «записки» и тосты) --- */
  --slate: #2b3037;
  --slate-2: #1f242a;

  /* --- Светящиеся акценты на тёмном дереве --- */
  --lime: #4cf39a;
  --gold: #ffc83b;
  --amber: #ffb020;
  --danger: #ff6b6b;

  --line: rgba(247, 241, 222, 0.16);
  --shadow-soft: 0 10px 22px rgba(0, 0, 0, 0.38);

  --font-body: "Segoe UI", "Trebuchet MS", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Chalkboard SE", "Chalkboard", "Comic Sans MS", "Segoe Print", "Bradley Hand", Impact, "Arial Black", sans-serif;
  --font-mono: "Consolas", "Courier New", monospace;

  --radius: 12px;
  --radius-sm: 8px;
  --nav-height: 74px;
  /* Высота фикс. шапки: переопределяется из JS под реальный размер (мераTopbar). */
  --topbar-height: 150px;
  /* 📱 Высота нативной шапки Telegram (крестик/меню) поверх вьюпорта.
     JS обновляет из tg.contentSafeAreaInset (Bot API 9.0+); 0px — запасной
     вариант для старых клиентов: остаётся только env(safe-area-inset-top). */
  --tma-header-inset: 0px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* ===================== ANTI-WEB FEEL (МОБИЛЬНЫЕ ЖЕСТЫ) =====================
   Спам тапов по парте и картам не должен выделять текст/эмодзи и звать
   системное меню (iOS: лупа и синее выделение, Android: context menu). */
body,
.app,
.screen,
button {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Поля ввода — исключение: там выделение и копирование нужны. */
input,
textarea {
  -webkit-user-select: text;
  user-select: text;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

/* ===================== ФОН: КЛАСС С ДЕРЕВЯННЫМИ СТЕНАМИ ===================== */

body {
  position: relative;
  color: var(--chalk);
  font-family: var(--font-body);
  background-color: var(--wood);
  background-image:
    /* дневной свет из окон */
    radial-gradient(ellipse at 12% -8%, rgba(255, 244, 208, 0.34), transparent 46%),
    radial-gradient(ellipse at 88% 2%, rgba(255, 240, 197, 0.26), transparent 44%),
    /* стыки досок обшивки */
    repeating-linear-gradient(
      90deg,
      transparent 0 116px,
      rgba(0, 0, 0, 0.42) 116px 119px,
      rgba(255, 226, 178, 0.06) 119px 121px
    ),
    /* волокна дерева */
    repeating-linear-gradient(89deg, rgba(255, 222, 170, 0.05) 0 2px, transparent 2px 12px),
    repeating-linear-gradient(91deg, rgba(0, 0, 0, 0.11) 0 1px, transparent 1px 7px),
    linear-gradient(180deg, #5d4027 0%, #44301e 42%, #2b1f15 100%);
  background-attachment: fixed;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  box-shadow:
    inset 0 0 150px 40px rgba(20, 12, 6, 0.45),
    inset 0 -60px 90px -30px rgba(0, 0, 0, 0.55);
}

/* Окна класса, косой луч света и плинтус */
.classroom {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.classroom-window {
  position: absolute;
  top: -34px;
  width: 112px;
  height: 172px;
  border: 6px solid #6f4a2a;
  border-radius: 4px;
  background: linear-gradient(165deg, #fffef7, #ffeec4 58%, #f0d296);
  box-shadow:
    0 0 34px rgba(255, 238, 190, 0.38),
    inset 0 0 22px rgba(255, 255, 255, 0.85);
  opacity: 0.46;
}

.classroom-window::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(90deg, transparent calc(50% - 2px), #6f4a2a calc(50% - 2px) calc(50% + 2px), transparent calc(50% + 2px)),
    linear-gradient(180deg, transparent calc(42% - 2px), #6f4a2a calc(42% - 2px) calc(42% + 2px), transparent calc(42% + 2px));
}

.classroom-window-left {
  left: -30px;
  transform: rotate(-2deg);
}

.classroom-window-right {
  right: -30px;
  top: 46px;
  height: 146px;
  transform: rotate(2deg);
}

.classroom-shaft {
  position: absolute;
  top: -18%;
  left: -30%;
  width: 132%;
  height: 62%;
  transform: rotate(-8deg);
  background: linear-gradient(104deg, rgba(255, 244, 208, 0.17), rgba(255, 244, 208, 0) 64%);
  mix-blend-mode: screen;
}

.classroom-skirting {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 78px;
  border-top: 3px solid #7a5330;
  background: linear-gradient(180deg, #4b3320, #291d13);
  box-shadow:
    inset 0 3px 0 rgba(255, 214, 160, 0.18),
    0 -8px 26px rgba(0, 0, 0, 0.42);
}

/* Меловая пыль в воздухе */
.board-dust {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.34;
  background-image:
    radial-gradient(circle at 18% 24%, rgba(255, 250, 235, 0.5) 0 1px, transparent 2px),
    radial-gradient(circle at 72% 16%, rgba(255, 250, 235, 0.4) 0 1.5px, transparent 3px),
    radial-gradient(circle at 40% 62%, rgba(255, 250, 235, 0.28) 0 1px, transparent 2px),
    radial-gradient(circle at 86% 74%, rgba(255, 250, 235, 0.3) 0 1px, transparent 2px);
  background-size: 210px 210px, 290px 290px, 240px 240px, 320px 320px;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 460px;
  margin: 0 auto;
  padding: 12px 14px calc(var(--nav-height) + 26px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ===================== ТИПОГРАФИКА ===================== */

h1,
h2,
h3,
.nickname,
.hero-nick,
.screen-title,
.card-head h3,
.btn,
.seg-btn,
.desk-label,
.mult,
.income-value,
.cup-value,
.nav-label,
.tag,
.badge,
.chip,
.shop-item-name,
.box-name,
.box-price,
.arena-name,
.location-name,
.feed-type,
.pinned-title,
.loot-rarity,
.gain-bubble,
.wardrobe-title,
.wardrobe-group-title,
.wardrobe-item-name,
.wardrobe-toggle {
  font-family: var(--font-display);
  letter-spacing: 0.01em;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 900;
}

p {
  margin: 0;
}

button,
[role="button"],
.btn,
.desk-button,
.shop-buy,
.location-raid,
.seg-btn,
.nav-btn {
  touch-action: manipulation;
}

/* ===================== ШАПКА: ОБЛОЖКА ДНЕВНИКА ===================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 6px;
  /* 📱 Safe-area сверху: не заезжаем под нативный крестик/меню Telegram.
     Высота шапки поджата: на телефоне она не должна съедать четверть экрана. */
  padding: calc(6px + env(safe-area-inset-top, 0px) + var(--tma-header-inset, 0px)) 10px 8px;
  border-radius: 12px 12px 8px 8px;
  color: #f7ecd9;
  background-color: #3a2617;
  background-image:
    repeating-linear-gradient(92deg, rgba(255, 222, 180, 0.06) 0 2px, transparent 2px 10px),
    repeating-linear-gradient(88deg, rgba(0, 0, 0, 0.14) 0 1px, transparent 1px 8px),
    linear-gradient(180deg, #4d3420, #2e2013);
  border: 1px solid #6d482a;
  box-shadow:
    0 5px 0 rgba(0, 0, 0, 0.26),
    0 12px 20px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 214, 160, 0.22);
}

.topbar::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 10px;
  border: 1px solid rgba(214, 168, 102, 0.28);
  pointer-events: none;
}

.topbar-user {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-size: 17px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #fffaf0, #e9d9b2);
  border: 2px solid #8a5a34;
  box-shadow:
    0 3px 0 rgba(0, 0, 0, 0.3),
    inset 0 1px 0 #ffffff;
  transform: rotate(-3deg);
}

.topbar-name {
  min-width: 0;
  flex: 1 1 auto;
}

.topbar-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.nickname {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  font-weight: 900;
  color: #fff8e9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.42);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 2px;
  min-height: 0;
}

.chip {
  font-size: 9px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid rgba(247, 241, 222, 0.2);
  color: #ecdfc6;
  background: rgba(0, 0, 0, 0.24);
  white-space: nowrap;
}

.chip-vip {
  color: #2f2200;
  border-color: #e0b93c;
  background: linear-gradient(180deg, #ffeeb4, #f3c85c);
}

.chip-couple {
  color: #7d1f52;
  border-color: #e491bb;
  background: linear-gradient(180deg, #ffe2ef, #f6bad6);
}

.chip-brand {
  color: #7d1414;
  border-color: #e07c7c;
  background: linear-gradient(180deg, #ffdede, #f2aeae);
}

.wallet {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.energy-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.energy-label {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #e6d5b8;
}

.energy-bar {
  position: relative;
  height: 8px;
  border-radius: 6px;
  background: rgba(10, 6, 3, 0.72);
  border: 1px solid rgba(255, 220, 170, 0.26);
  overflow: hidden;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.62);
}

.energy-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, #8dfcbe, #1fbf61);
  box-shadow: 0 0 12px rgba(76, 243, 154, 0.55);
  transition: width 0.35s ease;
  position: relative;
  overflow: hidden;
}

.energy-bar span::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.5;
  background: repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.3) 0 3px, transparent 3px 9px);
}

.money-row {
  display: flex;
  gap: 7px;
}

.money-chip,
.respect-chip,
.style-chip {
  flex: 1 1 0;
  text-align: center;
  font-size: 11.5px;
  font-weight: 900;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.3);
  box-shadow:
    0 2px 0 rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.money-chip {
  color: #0d4f26;
  background: linear-gradient(180deg, #dcf8c6, #a6e089);
}

.respect-chip {
  color: #553800;
  background: linear-gradient(180deg, #ffeaa8, #f3c65a);
}

/* 👟 Стиль — голубая наклейка (обновляется из гардероба на лету) */
.style-chip {
  flex: 0 0 auto;
  min-width: 56px;
  color: #11314f;
  background: linear-gradient(180deg, #d9ecff, #93c6f0);
}

/* ===================== ЭКРАНЫ ===================== */

.screens {
  position: relative;
}

.screen {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.screen.is-active {
  display: flex;
  animation: screen-in 0.28s ease both;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Заголовок экрана — мелом на стене класса */
.screen-title {
  display: inline-block;
  align-self: flex-start;
  margin: 4px 2px 0;
  padding: 0 6px 3px;
  font-size: 22px;
  font-weight: 900;
  color: #fdf9e8;
  transform: rotate(-0.6deg);
  border-bottom: 3px solid rgba(255, 224, 102, 0.6);
  text-shadow:
    0 2px 0 rgba(0, 0, 0, 0.55),
    0 0 16px rgba(0, 0, 0, 0.45);
}

/* ===================== КАРТОЧКИ: ТЕТРАДНЫЙ ЛИСТ ===================== */

.card,
.shop-item,
.box-card,
.location,
.feed-item {
  position: relative;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(0deg, transparent 0 21px, var(--grid-line) 21px 22px),
    repeating-linear-gradient(90deg, transparent 0 21px, var(--grid-line-soft) 21px 22px);
  border: 1px solid var(--paper-edge);
  border-radius: 6px;
  box-shadow:
    0 4px 0 rgba(0, 0, 0, 0.2),
    0 14px 24px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 14px 14px 28px;
}

/* Красная полоса полей — как в школьной тетради */
.card::before,
.shop-item::before,
.feed-item::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 18px;
  width: 2px;
  background: linear-gradient(
    180deg,
    transparent,
    var(--margin-line) 7%,
    var(--margin-line) 93%,
    transparent
  );
  pointer-events: none;
}

/* Металлические скрепки сверху листа */
.card::after {
  content: "";
  position: absolute;
  top: -6px;
  left: 12px;
  width: 36px;
  height: 14px;
  z-index: 2;
  background-image:
    linear-gradient(180deg, #f4f7fa, #a9b3bd 46%, #d3dae1 72%, #7f8c99),
    linear-gradient(180deg, #f4f7fa, #a9b3bd 46%, #d3dae1 72%, #7f8c99);
  background-size: 8px 14px, 8px 14px;
  background-position: 0 0, 17px 0;
  background-repeat: no-repeat;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.42));
  pointer-events: none;
}

/* У карточек с обрезанным краем скрепки прячем внутрь листа */
.hero-card::after,
.arena-card::after,
.clan-card::after {
  top: 3px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-head h3 {
  font-size: 15px;
  font-weight: 900;
  color: var(--ink);
}

.muted {
  color: currentColor;
  opacity: 0.82;
}

.small {
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
}

.tiny {
  font-size: 11px;
  line-height: 1.5;
  margin: 0;
}

.tag {
  font-size: 11px;
  font-weight: 900;
  color: #fff8e2;
  padding: 3px 9px;
  border-radius: 5px;
  background: linear-gradient(180deg, #a2700d, #7b5205);
  border: 1px solid rgba(0, 0, 0, 0.3);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.26);
  transform: rotate(1.5deg);
  white-space: nowrap;
}

/* ===================== КНОПКИ ===================== */

.btn {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 2px solid #b7a67e;
  background: linear-gradient(180deg, #fffdf4, #ecdfc0);
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  position: relative;
  transition: transform 0.1s ease, box-shadow 0.16s ease, filter 0.16s ease;
  box-shadow:
    0 4px 0 #b7a67e,
    0 8px 14px rgba(0, 0, 0, 0.22);
}

.btn:active {
  transform: translateY(4px);
  box-shadow:
    0 0 0 #b7a67e,
    0 3px 7px rgba(0, 0, 0, 0.22);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.35);
}

.btn-primary {
  border-color: #1c7a44;
  background: linear-gradient(180deg, #bcf7c8, #63d68b);
  color: #0b3a20;
  box-shadow:
    0 4px 0 #166b3b,
    0 8px 16px rgba(0, 0, 0, 0.24);
}

.btn-gold {
  border-color: #a2700d;
  background: linear-gradient(180deg, #ffe9a8, #f0bf4d);
  color: #4a3000;
  box-shadow:
    0 4px 0 #8a6108,
    0 8px 16px rgba(0, 0, 0, 0.24);
}

.btn-ghost {
  border-style: dashed;
  border-color: #a49470;
  background: linear-gradient(180deg, rgba(255, 253, 244, 0.95), rgba(236, 223, 192, 0.95));
}

/* Маркерная подсветка под текстом кнопки «Собрать общак» */
.marker-btn::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 6px;
  height: 4px;
  border-radius: 3px;
  background: rgba(14, 82, 42, 0.4);
  pointer-events: none;
}

/* ===================== СЕГМЕНТЫ: ПЕРЕКЛАДКА В ПЕНАЛЕ ===================== */

.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 5px;
  padding: 5px;
  border-radius: 12px;
  background-color: #352516;
  background-image:
    repeating-linear-gradient(92deg, rgba(255, 222, 180, 0.06) 0 2px, transparent 2px 10px),
    linear-gradient(180deg, #42301c, #291d11);
  border: 1px solid #6d482a;
  box-shadow:
    inset 0 2px 8px rgba(0, 0, 0, 0.5),
    0 3px 0 rgba(0, 0, 0, 0.24);
}

.segmented-sm {
  border-radius: 9px;
}

.seg-btn {
  padding: 9px 5px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #e7d7bb;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.seg-btn.is-active {
  color: #0d2c17;
  border-color: #5fbf85;
  background: linear-gradient(180deg, #cbf9d3, #7fe0a0);
  box-shadow:
    0 2px 0 rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

/* ===================== ХАТА ===================== */

.hero-card {
  overflow: hidden;
}

.hero-doodle {
  position: absolute;
  right: 14px;
  bottom: 8px;
  font-family: var(--font-display);
  font-size: 15px;
  color: rgba(162, 112, 13, 0.2);
  transform: rotate(-7deg);
  pointer-events: none;
}

.hero-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hero-avatar {
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  font-size: 29px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 26%, #fffdf4, #e9ddbe);
  border: 2px dashed #b7a67e;
  box-shadow:
    0 4px 0 rgba(0, 0, 0, 0.12),
    inset 0 1px 0 #ffffff;
  transform: rotate(-3deg);
}

.hero-info {
  min-width: 0;
}

.hero-nick-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.nick-edit {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 13px;
  line-height: 1;
  border-radius: 50%;
  border: 1px dashed #b7a67e;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink-soft);
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease;
}

.nick-edit:active {
  transform: scale(0.92);
  background: #fff6d8;
}

.hero-nick {
  font-size: 20px;
  font-weight: 900;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: rotate(-0.4deg);
}

.hero-sub {
  margin-top: 3px;
  font-size: 12px;
  color: var(--ink-soft);
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  font-size: 11px;
  font-weight: 900;
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: rgba(255, 255, 255, 0.66);
  color: var(--ink-soft);
  transform: rotate(-0.6deg);
}

.badge-muted {
  color: var(--ink-soft);
}

.badge-vip {
  color: #5f4000;
  border-color: #d9a92c;
  background: linear-gradient(180deg, #ffeeb8, #f6cf72);
}

.badge-couple {
  color: #8a2a5e;
  border-color: #e08fb8;
  background: linear-gradient(180deg, #ffe0ef, #f8bcd8);
}

.badge-brand {
  color: #8e1e1e;
  border-color: #d97a7a;
  background: linear-gradient(180deg, #ffdede, #f2b0b0);
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

/* Клетчатые «зарисовки» в блокноте: дверь, ПК, завал, щит */
.stat-box {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 11px;
  border-radius: 8px;
  overflow: hidden;
  font-size: 11px;
  color: var(--ink-soft);
  background-color: rgba(255, 255, 255, 0.62);
  background-image:
    repeating-linear-gradient(0deg, transparent 0 10px, rgba(84, 124, 168, 0.14) 10px 11px),
    repeating-linear-gradient(90deg, transparent 0 10px, rgba(84, 124, 168, 0.11) 10px 11px);
  border: 2px solid rgba(87, 74, 56, 0.26);
  transform: rotate(-0.4deg);
}

.stat-box:nth-child(even) {
  transform: rotate(0.5deg);
}

.stat-box > span {
  position: relative;
  z-index: 1;
}

.stat-box b {
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 900;
  line-height: 1.25;
  color: var(--ink);
}

.sketch-door {
  border-color: rgba(28, 122, 68, 0.45);
}

.sketch-pc {
  border-color: rgba(162, 112, 13, 0.5);
}

.sketch-mess {
  border-color: rgba(184, 48, 44, 0.4);
}

.sketch-shield {
  border-color: rgba(28, 111, 134, 0.45);
}

/* Чернильные каракули в углу каждой клетки — еле заметные, чтобы не мешать
   читать подписи (раньше спорили с текстом «Дверь / ПК / Завал / Щит»). */
.doodle {
  position: absolute;
  right: 7px;
  bottom: 6px;
  width: 26px;
  height: 24px;
  opacity: 0.16;
  pointer-events: none;
}

.doodle-door {
  width: 16px;
  height: 22px;
  border: 2px solid var(--green-ink);
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
}

.doodle-door::after {
  content: "";
  position: absolute;
  right: 2px;
  top: 11px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--green-ink);
}

.doodle-pc {
  width: 24px;
  height: 16px;
  border: 2px solid var(--gold-ink);
  border-radius: 2px;
}

.doodle-pc::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 12px;
  height: 4px;
  margin-left: -6px;
  border-bottom: 2px solid var(--gold-ink);
  border-left: 2px solid var(--gold-ink);
  border-right: 2px solid var(--gold-ink);
  border-radius: 0 0 3px 3px;
}

.doodle-mess {
  width: 24px;
  height: 20px;
  background-image:
    linear-gradient(28deg, transparent 45%, var(--red-ink) 45%, var(--red-ink) 52%, transparent 52%),
    linear-gradient(-24deg, transparent 58%, var(--red-ink) 58%, var(--red-ink) 64%, transparent 64%),
    linear-gradient(12deg, transparent 74%, var(--red-ink) 74%, var(--red-ink) 79%, transparent 79%);
}

.doodle-shield {
  width: 18px;
  height: 18px;
  border: 2px solid var(--cyan-ink);
  border-radius: 3px 3px 9px 9px;
}

/* Общак — крупная маркерная цифра */
.income-card {
  background-color: #fffcee;
}

.income-value {
  font-size: 34px;
  font-weight: 900;
  line-height: 1.05;
  color: var(--blue-ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
}

.clan-pane .card .muted,
.card .muted {
  color: var(--ink-soft);
  opacity: 1;
}

/* ===================== ПАРТА: ДОСКА В ДУБОВОЙ РАМЕ ===================== */

.desk-card {
  gap: 12px;
}

.teacher-scene {
  position: relative;
  padding: 9px;
  border-radius: 8px;
  background-color: var(--frame);
  background-image:
    repeating-linear-gradient(92deg, rgba(255, 222, 180, 0.09) 0 2px, transparent 2px 9px),
    repeating-linear-gradient(88deg, rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 7px),
    linear-gradient(180deg, #6b492e, #4a3120);
  box-shadow:
    0 4px 0 rgba(0, 0, 0, 0.28),
    0 12px 20px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 214, 160, 0.3);
}

/* Сама доска: глубокий зелёный мел + массивная деревянная рама */
.chalkboard {
  position: relative;
  overflow: hidden;
  min-height: 172px;
  padding: 12px 14px;
  border: 6px solid #5a3d28;
  border-radius: 6px;
  background-color: #1a3323;
  background-image:
    radial-gradient(ellipse at 26% 16%, rgba(255, 255, 255, 0.09), transparent 58%),
    radial-gradient(ellipse at 78% 84%, rgba(255, 255, 255, 0.06), transparent 62%),
    repeating-linear-gradient(112deg, rgba(255, 255, 255, 0.028) 0 2px, transparent 2px 8px),
    linear-gradient(180deg, #1e3a29, #16291d);
  box-shadow:
    inset 0 0 52px rgba(0, 0, 0, 0.55),
    inset 0 0 0 2px rgba(255, 255, 255, 0.05),
    0 6px 14px rgba(0, 0, 0, 0.35);
  transition: box-shadow 0.3s ease;
}

.chalk-scribbles {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-family: var(--font-display);
  color: #f4f8f0;
}

.chalk-scribbles span {
  font-size: 16px;
  font-weight: 900;
  opacity: 0.9;
  text-shadow: 0 0 9px rgba(255, 255, 255, 0.22);
}

.chalk-scribbles span:nth-child(1) {
  transform: rotate(-1.4deg);
}

.scribble-star {
  color: var(--chalk-yellow) !important;
  font-size: 20px !important;
  transform: rotate(2deg);
  text-shadow: 0 0 12px rgba(255, 224, 102, 0.4) !important;
}

.chalk-arrow {
  font-size: 24px !important;
  color: rgba(255, 224, 102, 0.85) !important;
  transform: rotate(-8deg);
}

.teacher-figure {
  position: absolute;
  right: 14px;
  bottom: 6px;
  font-size: 48px;
  line-height: 1;
  transform: rotate(-3deg);
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.55));
  transition: transform 0.2s ease;
}

/* Тревожная табличка «ПРЕПОД КОСИТСЯ» */
.teacher-alert {
  position: absolute;
  left: 50%;
  top: 10px;
  transform: translate(-50%, -14px) rotate(-1.4deg);
  padding: 6px 10px;
  border: 2px solid #ff8f8f;
  border-radius: 6px;
  background: rgba(120, 12, 12, 0.92);
  color: #ffe6e6;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.teacher-scene.is-warn .teacher-alert {
  opacity: 1;
  transform: translate(-50%, 0) rotate(-1.4deg);
  border-color: #ffd166;
  background: rgba(118, 70, 0, 0.94);
  color: #fff4d2;
}

.teacher-scene.is-danger .teacher-alert {
  opacity: 1;
  transform: translate(-50%, 0) rotate(1.4deg);
  animation: alert-shake 0.5s ease-in-out infinite;
}

.teacher-scene.is-warn .chalkboard {
  box-shadow:
    inset 0 0 50px rgba(90, 60, 0, 0.45),
    inset 0 0 0 2px rgba(255, 209, 102, 0.55),
    0 0 18px rgba(255, 176, 32, 0.38);
}

.teacher-scene.is-danger .chalkboard {
  box-shadow:
    inset 0 0 58px rgba(90, 0, 0, 0.6),
    inset 0 0 0 3px rgba(255, 95, 95, 0.62),
    0 0 24px rgba(255, 95, 95, 0.46);
}

.teacher-scene.is-danger .teacher-figure {
  animation: teacher-shake 0.5s ease-in-out infinite;
}

@keyframes alert-shake {
  0%,
  100% {
    transform: translate(-50%, 0) rotate(-1.6deg);
  }
  50% {
    transform: translate(-50%, 0) rotate(1.6deg) scale(1.04);
  }
}

@keyframes teacher-shake {
  0%,
  100% {
    transform: rotate(-3deg) translateX(0);
  }
  25% {
    transform: rotate(-5deg) translateX(-2px);
  }
  75% {
    transform: rotate(-1deg) translateX(2px);
  }
}

/* 👀 «Взгляд препода»: короткий (2.5 сек) заметный сигнал, когда терпение
   падает ниже 25% — игрок успевает осознанно нажать «Уткнуться в тетрадь». */
.teacher-scene.is-glance .chalkboard {
  box-shadow:
    inset 0 0 52px rgba(90, 60, 0, 0.5),
    inset 0 0 0 3px rgba(255, 209, 102, 0.78),
    0 0 26px rgba(255, 176, 32, 0.55);
}

.teacher-scene.is-glance .teacher-figure {
  animation: teacher-shake 0.7s ease-in-out infinite;
}

.teacher-alert.is-glance,
.teacher-scene.is-glance .teacher-alert {
  opacity: 1;
  max-width: calc(100% - 20px);
  white-space: normal;
  text-align: center;
  line-height: 1.25;
  border-color: #ffd166;
  background: rgba(118, 70, 0, 0.96);
  color: #fff4d2;
  font-size: 11.5px;
  transform: translate(-50%, 0) rotate(-0.6deg);
  animation: teacher-glance-pulse 0.6s ease-in-out infinite;
}

@keyframes teacher-glance-pulse {
  0%,
  100% {
    transform: translate(-50%, 0) scale(1);
  }
  50% {
    transform: translate(-50%, 0) scale(1.05);
  }
}

.teacher-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.teacher-status {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 900;
  color: var(--ink);
  transform: rotate(-0.4deg);
}

.teacher-hint {
  font-size: 11.5px;
  color: var(--ink-soft);
}

/* Шкала терпения — деревянная линейка */
.patience-track {
  position: relative;
  height: 18px;
  border-radius: 6px;
  overflow: hidden;
  background: linear-gradient(180deg, #fffdf3, #e7dcbd);
  border: 2px solid #b7a67e;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.14);
}

.patience-track::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    90deg,
    transparent 0 calc(10% - 1px),
    rgba(87, 74, 56, 0.32) calc(10% - 1px) 10%
  );
}

.patience-fill {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(180deg, #7ae09f, #1c7a44);
  transition: width 0.3s ease, background 0.3s ease;
}

.patience-fill.is-warn {
  background: linear-gradient(180deg, #ffd36b, #d98a09);
}

.patience-fill.is-danger {
  background: linear-gradient(180deg, #ff9a9a, #c02f2f);
}

.patience-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-soft);
}

.patience-meta b {
  color: var(--ink);
}

.mult {
  font-size: 13px;
  font-weight: 900;
  padding: 3px 10px;
  border-radius: 6px;
  color: #0b3a20;
  background: linear-gradient(180deg, #a9f2bd, #5ecb85);
  border: 1px solid rgba(0, 0, 0, 0.18);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.22);
  transform: rotate(-2deg);
}

.mult.is-warn {
  color: #3a2600;
  background: linear-gradient(180deg, #ffd772, #f0a91c);
}

.mult.is-danger {
  color: #3d0505;
  background: linear-gradient(180deg, #ff9d9d, #e04b4b);
}

/* ===================== ПАРТА-КНОПКА: СВЕТЛЫЙ ДУБ + ГРАФФИТИ ===================== */

.desk-button {
  position: relative;
  display: block;
  width: 100%;
  padding: 0 0 12px;
  border: 0;
  background: none;
  cursor: pointer;
}

.desk-surface {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 154px;
  padding: 36px 16px 28px;
  overflow: hidden;
  border-radius: 10px 8px 6px 8px;
  color: #3b2a13;
  background-color: #e3bb81;
  background-image:
    repeating-linear-gradient(93deg, rgba(120, 78, 32, 0.14) 0 2px, transparent 2px 10px),
    repeating-linear-gradient(87deg, rgba(255, 244, 214, 0.55) 0 1px, transparent 1px 16px),
    linear-gradient(180deg, #f3d5a2, #dcae6f 60%, #cf9a57);
  border: 2px solid #a9762f;
  box-shadow:
    0 7px 0 #8c5f22,
    0 14px 22px rgba(0, 0, 0, 0.42),
    inset 0 2px 0 rgba(255, 255, 255, 0.55),
    inset 0 -12px 22px rgba(120, 80, 30, 0.22);
  transition: transform 0.09s ease, box-shadow 0.09s ease;
}

/* Царапины и следы ручки на столешнице */
.desk-surface::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image:
    linear-gradient(96deg, transparent 34%, rgba(120, 78, 32, 0.22) 34%, rgba(120, 78, 32, 0.22) 34.6%, transparent 34.6%),
    linear-gradient(84deg, transparent 62%, rgba(120, 78, 32, 0.18) 62%, rgba(120, 78, 32, 0.18) 62.5%, transparent 62.5%),
    linear-gradient(100deg, transparent 78%, rgba(120, 78, 32, 0.16) 78%, rgba(120, 78, 32, 0.16) 78.4%, transparent 78.4%);
}

.desk-button:active .desk-surface,
.desk-button.is-tapping .desk-surface {
  transform: scale(0.97) translateY(5px);
  box-shadow:
    0 3px 0 #8c5f22,
    0 6px 12px rgba(0, 0, 0, 0.4),
    inset 0 3px 8px rgba(120, 80, 30, 0.32);
}

.desk-button:disabled {
  cursor: default;
}

.desk-graffiti {
  position: absolute;
  font-family: var(--font-display);
  font-weight: 900;
  color: rgba(84, 55, 22, 0.34);
  pointer-events: none;
  opacity: 0.42;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* Чистая зона клика в центре парты: лёгкий блик под надписью, чтобы глаз
   сразу находил кнопку, а не разбирал граффити по краям. */
.desk-surface::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  top: 18%;
  bottom: 16%;
  border-radius: 16px;
  background: radial-gradient(
    58% 58% at 50% 50%,
    rgba(255, 252, 240, 0.5),
    rgba(255, 252, 240, 0.12) 62%,
    transparent 76%
  );
  pointer-events: none;
}

.desk-graffiti-main {
  left: 16px;
  top: 10px;
  font-size: 26px;
  transform: rotate(-6deg);
}

.desk-graffiti-star {
  right: 20px;
  top: 8px;
  font-size: 22px;
  color: rgba(120, 30, 26, 0.42);
  transform: rotate(9deg);
}

.desk-graffiti-tag {
  left: 14px;
  bottom: 12px;
  font-size: 14px;
  letter-spacing: 0.14em;
  color: rgba(62, 40, 16, 0.36);
  transform: rotate(2deg);
}

/* Лежащая ручка и тетрадь на парте */
.desk-pen {
  position: absolute;
  right: 18px;
  bottom: 16px;
  font-size: 22px;
  transform: rotate(-20deg);
  filter: drop-shadow(0 3px 3px rgba(90, 60, 25, 0.5));
  pointer-events: none;
}

.desk-notebook {
  position: absolute;
  left: 15px;
  top: 50%;
  font-size: 24px;
  opacity: 0.9;
  transform: translateY(-50%) rotate(-9deg);
  filter: drop-shadow(0 3px 4px rgba(90, 60, 25, 0.45));
  pointer-events: none;
}

.desk-label {
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #3b2a13;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.65),
    0 -1px 0 rgba(120, 80, 30, 0.35);
  transition: color 0.2s ease;
}

.desk-button.is-break .desk-label {
  color: #8b1f1c;
  font-size: 19px;
  letter-spacing: 0.04em;
}

/* Перемена: парта «гаснет» — граффити и мелочь уходят в тень, а на кнопке
   остаётся читаемый обратный отсчёт MM:SS (кнопка при этом НЕ блокируется). */
.desk-button.is-break .desk-surface {
  filter: grayscale(0.45) brightness(0.84);
}

.desk-button.is-break .desk-graffiti,
.desk-button.is-break .desk-pen,
.desk-button.is-break .desk-notebook {
  opacity: 0.18;
}

.desk-button.is-break .desk-surface::after {
  background: radial-gradient(
    58% 58% at 50% 50%,
    rgba(255, 244, 238, 0.62),
    rgba(255, 236, 232, 0.14) 60%,
    transparent 76%
  );
}

/* Ножки парты */
.desk-legs {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 24px;
  pointer-events: none;
}

.desk-legs i {
  display: block;
  width: 12px;
  height: 10px;
  border-radius: 0 0 3px 3px;
  background: linear-gradient(180deg, #5b6470, #2b3138);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.42);
}

.tap-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--ink-soft);
}

.tap-meta b {
  color: var(--ink);
}

.desk-note {
  padding: 7px 9px;
  border: 1.5px dashed rgba(87, 74, 56, 0.36);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink-soft);
}

/* 👆 Подсказка новичка над партой: «Жми на парту, чтобы заработать первые рубли!» */
.first-tap-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 9px 10px;
  border: 2px solid #c9a03c;
  border-radius: 7px;
  background:
    linear-gradient(180deg, #fff9e2, #fbeebc);
  box-shadow: 0 3px 0 rgba(162, 112, 13, 0.28);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  animation: first-tap-pulse 1.6s ease-in-out infinite;
}

.first-tap-hint[hidden] {
  display: none;
}

.first-tap-ico {
  font-size: 17px;
  line-height: 1;
  animation: first-tap-point 1.2s ease-in-out infinite;
}

.first-tap-text {
  flex: 1 1 auto;
}

.first-tap-close {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.08);
  color: var(--ink-soft);
  font-size: 11px;
  cursor: pointer;
}

@keyframes first-tap-pulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

@keyframes first-tap-point {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(0, -3px); }
}

/* Кнопка «Уткнуться в тетрадь» — пульс, когда препод косит */
.calm-btn {
  position: relative;
  overflow: hidden;
}

.calm-ico {
  display: inline-block;
  transform: rotate(-6deg);
}

.calm-btn.is-attention {
  border-color: #d98a09 !important;
  border-style: solid !important;
  color: #4a2d00 !important;
  background: linear-gradient(180deg, #ffe6a8, #ffca6b) !important;
  animation: calm-pulse 1.35s ease-in-out infinite;
}

@keyframes calm-pulse {
  0%,
  100% {
    box-shadow:
      0 4px 0 #b7a67e,
      0 0 0 0 rgba(255, 176, 32, 0.36);
    transform: scale(1);
  }
  50% {
    box-shadow:
      0 4px 0 #b7a67e,
      0 0 0 6px rgba(255, 176, 32, 0.14),
      0 0 22px rgba(255, 176, 32, 0.4);
    transform: scale(1.025);
  }
}

/* ===================== ЧАСТИЦЫ МОНЕТ И МЕЛА ===================== */

.gain-layer {
  position: fixed;
  inset: 0;
  z-index: 998;
  overflow: hidden;
  pointer-events: none;
}

.gain-bubble {
  position: absolute;
  font-size: 20px;
  font-weight: 900;
  color: #f4ffe9;
  text-shadow:
    0 0 14px rgba(0, 0, 0, 0.6),
    0 2px 0 rgba(0, 0, 0, 0.55);
  animation: gain-rise 0.9s ease-out forwards;
  white-space: nowrap;
}

.gain-particle {
  position: absolute;
  font-size: 18px;
  line-height: 1;
  pointer-events: none;
  will-change: transform, opacity;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
  animation: particle-fly 0.9s cubic-bezier(0.2, 0.7, 0.4, 1) forwards;
}

.gain-particle.is-chalk {
  filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.65));
}

@keyframes gain-rise {
  from {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -88px) scale(1.15);
  }
}

@keyframes particle-fly {
  0% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx, 0px)), var(--dy, -90px)) scale(0.55) rotate(var(--rot, 180deg));
  }
}

/* ===================== ЛАРЁК И ШКОЛЬНЫЕ ТАЙНИКИ ===================== */

.shop-pane,
.clan-pane {
  display: none;
  flex-direction: column;
  gap: 10px;
}

.shop-pane.is-active,
.clan-pane.is-active {
  display: flex;
  animation: screen-in 0.24s ease both;
}

.shop-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px 11px 26px;
}

.shop-item-emoji {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  font-size: 21px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.72);
  border: 1.5px dashed rgba(87, 74, 56, 0.36);
}

.shop-item-body {
  flex: 1 1 auto;
  min-width: 0;
}

.shop-item-name {
  font-size: 13.5px;
  font-weight: 900;
  color: var(--ink);
}

.shop-item-meta {
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--ink-soft);
}

.tier-budget {
  color: var(--ink-soft);
}

.tier-mid {
  color: var(--blue-ink);
  font-weight: 800;
}

.tier-elite {
  color: var(--epic-ink);
  font-weight: 800;
}

/* 👑 luxury «Люкс-мажор»: золотая наклейка с лёгким блеском */
.tier-luxury {
  color: var(--gold-ink);
  font-weight: 900;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 0 rgba(255, 214, 92, 0.45);
}

/* Ценник-наклейка */
.shop-buy {
  flex: 0 0 auto;
  padding: 9px 11px;
  border-radius: 8px;
  border: 2px solid #a2700d;
  background: linear-gradient(180deg, #ffeab0, #f2c659);
  color: #4a3000;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
  transform: rotate(-1.2deg);
  transition: transform 0.1s ease, box-shadow 0.16s ease, filter 0.16s ease;
  box-shadow:
    0 3px 0 #8a6108,
    0 5px 10px rgba(0, 0, 0, 0.2);
}

.shop-buy:active {
  transform: translateY(3px) rotate(-1.2deg);
  box-shadow: 0 0 0 #8a6108;
}

.shop-buy:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  filter: grayscale(0.4);
}

/* Тайники — школьные рюкзаки */
.box-card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 18px 14px 13px;
  overflow: hidden;
}

.box-card::before {
  content: "";
  position: absolute;
  top: -3px;
  left: 50%;
  width: 46px;
  height: 15px;
  margin-left: -23px;
  border: 3px solid rgba(87, 74, 56, 0.42);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  pointer-events: none;
}

.box-head {
  display: flex;
  align-items: center;
  gap: 11px;
}

.box-emoji {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  font-size: 26px;
  border-radius: 14px 10px 14px 10px;
  background: linear-gradient(180deg, #fffdf3, #e8dcc0);
  border: 2px solid rgba(87, 74, 56, 0.28);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.12);
}

.box-head-body {
  flex: 1 1 auto;
  min-width: 0;
}

.box-name {
  font-size: 15px;
  font-weight: 900;
  color: var(--ink);
}

.box-price {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 900;
  color: var(--gold-ink);
}

/* ===================== ГАРДЕРОБ: ШКАФ НА ТЕТРАДНОМ ЛИСТЕ ===================== */

body.is-wardrobe-open {
  overflow: hidden;
}

.wardrobe-card {
  gap: 8px;
}

.wardrobe-overlay {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: none;
  place-items: center;
  padding: 14px;
}

.wardrobe-overlay.is-open {
  display: grid;
}

.wardrobe-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 34%, rgba(44, 28, 12, 0.66), rgba(12, 7, 3, 0.92));
  backdrop-filter: blur(3px);
}

.wardrobe-sheet {
  position: relative;
  z-index: 1;
  width: min(430px, 100%);
  max-height: min(84vh, 700px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(0deg, transparent 0 21px, var(--grid-line) 21px 22px),
    repeating-linear-gradient(90deg, transparent 0 21px, var(--grid-line-soft) 21px 22px);
  border: 2px solid var(--paper-edge);
  border-radius: 8px;
  box-shadow:
    0 10px 0 rgba(0, 0, 0, 0.24),
    0 22px 44px rgba(0, 0, 0, 0.55);
  animation: loot-in 0.3s ease both;
}

/* Красная полоса полей — как в школьной тетради */
.wardrobe-sheet::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 22px;
  width: 2px;
  background: linear-gradient(
    180deg,
    transparent,
    var(--margin-line) 5%,
    var(--margin-line) 95%,
    transparent
  );
  pointer-events: none;
}

/* Металлическая скрепка сверху листа */
.wardrobe-sheet::after {
  content: "";
  position: absolute;
  top: -3px;
  left: 50%;
  width: 36px;
  height: 14px;
  margin-left: -18px;
  background-image:
    linear-gradient(180deg, #f4f7fa, #a9b3bd 46%, #d3dae1 72%, #7f8c99),
    linear-gradient(180deg, #f4f7fa, #a9b3bd 46%, #d3dae1 72%, #7f8c99);
  background-size: 8px 14px, 8px 14px;
  background-position: 0 0, 17px 0;
  background-repeat: no-repeat;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.42));
  pointer-events: none;
}

.wardrobe-head {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 16px 14px 10px 34px;
  border-bottom: 2px dashed rgba(162, 112, 13, 0.3);
}

.wardrobe-head-text {
  flex: 1 1 auto;
  min-width: 0;
}

.wardrobe-title {
  font-size: 17px;
  font-weight: 900;
  color: var(--ink);
}

.wardrobe-sub {
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--ink-soft);
}

.wardrobe-close {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  border: 2px solid #a2700d;
  background: linear-gradient(180deg, #ffeab0, #f2c659);
  color: #4a3000;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 3px 0 #8a6108;
  transition: transform 0.1s ease, box-shadow 0.16s ease;
}

.wardrobe-close:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #8a6108;
}

.wardrobe-totals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 10px 14px 10px 34px;
}

.wardrobe-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px 4px;
  border-radius: 8px;
  border: 1.5px dashed rgba(87, 74, 56, 0.34);
  background: rgba(255, 255, 255, 0.62);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: center;
}

.wardrobe-stat b {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
}

/* Живое превью примерки прямо в шкафу */
.wardrobe-preview-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px;
  margin: 0 14px 6px 34px;
  background: rgba(255, 255, 255, 0.55);
  border: 1.5px dashed rgba(87, 74, 56, 0.35);
  border-radius: 8px;
}

.wardrobe-preview-figure {
  width: 72px;
  height: 92px;
}

.wardrobe-preview-figure .student-svg {
  width: 68px;
  height: 86px;
}

.wardrobe-preview-hint {
  font-size: 10px;
  font-weight: 800;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.wardrobe-body {
  flex: 1 1 auto;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px 6px 34px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ===================== ГАРДЕРОБ: ВЕЩИ И ПЕРЕКЛЮЧАТЕЛИ ===================== */

.wardrobe-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wardrobe-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-bottom: 4px;
  font-size: 13px;
  font-weight: 900;
  color: var(--ink-soft);
  border-bottom: 2px solid rgba(162, 112, 13, 0.32);
}

.wardrobe-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1.5px dashed rgba(87, 74, 56, 0.35);
  background: rgba(255, 255, 255, 0.55);
  transition: background 0.18s ease, border-color 0.18s ease;
}

.wardrobe-item.is-equipped {
  border: 2px solid #4ea36d;
  background: linear-gradient(180deg, rgba(214, 249, 213, 0.92), rgba(163, 228, 180, 0.6));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.wardrobe-item.group-trophy:not(.is-equipped) {
  border-color: rgba(107, 63, 181, 0.45);
}

.wardrobe-item.group-mythic:not(.is-equipped) {
  border-color: rgba(224, 164, 26, 0.55);
  background: rgba(255, 240, 184, 0.55);
}

.wardrobe-item.is-focus {
  animation: wardrobe-focus 1.4s ease;
}

@keyframes wardrobe-focus {
  0% {
    transform: scale(1);
  }
  30% {
    transform: scale(1.02);
    box-shadow: 0 0 0 3px rgba(224, 164, 26, 0.55);
  }
  100% {
    transform: scale(1);
    box-shadow: none;
  }
}

.wardrobe-item-emoji {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  font-size: 19px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.78);
  border: 1.5px dashed rgba(87, 74, 56, 0.34);
}

.wardrobe-item-body {
  flex: 1 1 auto;
  min-width: 0;
}

.wardrobe-item-name {
  font-size: 12.5px;
  font-weight: 900;
  color: var(--ink);
}

.wardrobe-item-meta {
  margin-top: 2px;
  font-size: 10.5px;
  line-height: 1.35;
  color: var(--ink-soft);
}

.wardrobe-item.group-mythic .wardrobe-item-meta {
  color: #7a5200;
  font-weight: 800;
}

.wardrobe-item.group-trophy .wardrobe-item-meta {
  color: var(--epic-ink);
  font-weight: 800;
}

.wardrobe-flag {
  margin-top: 3px;
  font-size: 10px;
  font-weight: 900;
  color: var(--green-ink);
}

.wardrobe-toggle {
  flex: 0 0 auto;
  min-width: 76px;
  padding: 8px 9px;
  border-radius: 8px;
  border: 2px solid #1c7a44;
  background: linear-gradient(180deg, #bcf7c8, #63d68b);
  color: #0b3a20;
  font-size: 11.5px;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 3px 0 #166b3b;
  transition: transform 0.1s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.wardrobe-toggle:active {
  transform: translateY(3px);
  box-shadow: 0 0 0 #166b3b;
}

.wardrobe-toggle.is-equipped {
  border-color: #b8302c;
  background: linear-gradient(180deg, #ffdede, #f2aeae);
  color: #7d1414;
  box-shadow: 0 3px 0 #8f2320;
}

.wardrobe-toggle.is-equipped:active {
  box-shadow: 0 0 0 #8f2320;
}

.wardrobe-toggle:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.35);
}

.wardrobe-empty {
  padding: 8px 2px;
}

.wardrobe-foot {
  padding: 8px 14px 12px 34px;
  border-top: 2px dashed rgba(162, 112, 13, 0.3);
}

/* ===================== ОВЕРЛЕЙ ЛУТА ===================== */



.loot-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  place-items: center;
  padding: 18px;
}

.loot-overlay.is-open {
  display: grid;
}

.loot-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 38%, rgba(44, 28, 12, 0.66), rgba(12, 7, 3, 0.92));
  backdrop-filter: blur(3px);
}

.loot-card {
  position: relative;
  z-index: 1;
  width: min(360px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  overflow: hidden;
  text-align: center;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(0deg, transparent 0 21px, var(--grid-line) 21px 22px),
    repeating-linear-gradient(90deg, transparent 0 21px, var(--grid-line-soft) 21px 22px);
  border: 2px solid var(--paper-edge);
  border-radius: 8px;
  box-shadow:
    0 10px 0 rgba(0, 0, 0, 0.24),
    0 22px 44px rgba(0, 0, 0, 0.55);
  animation: loot-in 0.3s ease both;
}

@keyframes loot-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.loot-card::after {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  width: 36px;
  height: 14px;
  margin-left: -18px;
  background-image:
    linear-gradient(180deg, #f4f7fa, #a9b3bd 46%, #d3dae1 72%, #7f8c99),
    linear-gradient(180deg, #f4f7fa, #a9b3bd 46%, #d3dae1 72%, #7f8c99);
  background-size: 8px 14px, 8px 14px;
  background-position: 0 0, 17px 0;
  background-repeat: no-repeat;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.42));
  pointer-events: none;
}

.loot-rarity {
  position: relative;
  z-index: 1;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border: 1.5px dashed rgba(87, 74, 56, 0.4);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.6);
}

.loot-icon {
  position: relative;
  z-index: 1;
  font-size: 64px;
  line-height: 1;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.28));
  animation: loot-pop 0.42s ease both;
}

@keyframes loot-pop {
  from {
    opacity: 0;
    transform: scale(0.5) rotate(-8deg);
  }
  60% {
    transform: scale(1.12) rotate(2deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

.loot-text {
  position: relative;
  z-index: 1;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  white-space: pre-line;
}

.loot-rays {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 520px;
  height: 520px;
  margin: -260px 0 0 -260px;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  background: repeating-conic-gradient(
    from 0deg,
    rgba(255, 205, 80, 0.42) 0deg 6deg,
    transparent 6deg 22deg
  );
}

/* Золотая пыль и лучи — только для мифика */
.loot-dust {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.loot-dust span {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff6cf, #f0bd35);
  box-shadow: 0 0 8px rgba(255, 214, 92, 0.9);
  animation: dust-fly 3.2s linear infinite;
}

.loot-dust span:nth-child(1) { left: 8%; top: 72%; animation-delay: 0s; }
.loot-dust span:nth-child(2) { left: 18%; top: 88%; animation-delay: 0.4s; }
.loot-dust span:nth-child(3) { left: 28%; top: 64%; animation-delay: 0.8s; }
.loot-dust span:nth-child(4) { left: 38%; top: 92%; animation-delay: 1.2s; }
.loot-dust span:nth-child(5) { left: 48%; top: 78%; animation-delay: 1.6s; }
.loot-dust span:nth-child(6) { left: 58%; top: 90%; animation-delay: 2s; }
.loot-dust span:nth-child(7) { left: 68%; top: 70%; animation-delay: 2.4s; }
.loot-dust span:nth-child(8) { left: 76%; top: 86%; animation-delay: 0.6s; }
.loot-dust span:nth-child(9) { left: 84%; top: 62%; animation-delay: 1s; }
.loot-dust span:nth-child(10) { left: 92%; top: 84%; animation-delay: 1.4s; }
.loot-dust span:nth-child(11) { left: 12%; top: 52%; animation-delay: 1.8s; }
.loot-dust span:nth-child(12) { left: 34%; top: 46%; animation-delay: 2.2s; }
.loot-dust span:nth-child(13) { left: 62%; top: 50%; animation-delay: 2.6s; }
.loot-dust span:nth-child(14) { left: 88%; top: 44%; animation-delay: 3s; }

@keyframes dust-fly {
  0% {
    opacity: 0;
    transform: translateY(0) scale(0.6);
  }
  25% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-170px) scale(1.15);
  }
}

/* Рамки редкости */
.loot-card.rarity-common {
  border-color: #c3b58e;
}

.loot-card.rarity-rare {
  border-color: #4b8fd6;
  box-shadow:
    0 0 0 3px rgba(75, 143, 214, 0.34),
    0 10px 0 rgba(0, 0, 0, 0.24),
    0 22px 44px rgba(0, 0, 0, 0.55);
}

.loot-card.rarity-rare .loot-rarity {
  color: #17406e;
  border-color: #4b8fd6;
  background: linear-gradient(180deg, #dcebff, #a9c9f2);
}

.loot-card.rarity-epic {
  border-color: #8b5cf6;
  box-shadow:
    0 0 0 3px rgba(139, 92, 246, 0.4),
    0 0 26px rgba(139, 92, 246, 0.42),
    0 10px 0 rgba(0, 0, 0, 0.24),
    0 22px 44px rgba(0, 0, 0, 0.55);
}

.loot-card.rarity-epic .loot-rarity {
  color: #40207e;
  border-color: #8b5cf6;
  background: linear-gradient(180deg, #e8dbff, #c3aaf8);
}

.loot-card.rarity-mythic {
  border-color: #e0a41a;
  box-shadow:
    0 0 0 4px rgba(255, 200, 60, 0.5),
    0 0 34px rgba(255, 190, 40, 0.5),
    0 10px 0 rgba(0, 0, 0, 0.24),
    0 22px 44px rgba(0, 0, 0, 0.55);
}

.loot-card.rarity-mythic .loot-rarity {
  color: #5a3d00;
  border-color: #e0a41a;
  background: linear-gradient(180deg, #fff0b8, #f3c95f);
}

.loot-card.rarity-mythic .loot-rays {
  opacity: 0.9;
  animation: rays-spin 14s linear infinite;
}

.loot-card.rarity-mythic .loot-dust {
  opacity: 1;
}

.loot-card.rarity-mythic .loot-icon {
  animation: loot-pop 0.42s ease both, mythic-glow 1.9s ease-in-out infinite;
}

@keyframes rays-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes mythic-glow {
  0%,
  100% {
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.3)) drop-shadow(0 0 8px rgba(255, 200, 60, 0.5));
  }
  50% {
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.3)) drop-shadow(0 0 22px rgba(255, 200, 60, 0.9));
  }
}

/* ===================== ДУЭЛИ ===================== */

.arena-card {
  overflow: hidden;
  background-color: #fffcee;
}

.arena-doodle {
  position: absolute;
  right: 14px;
  bottom: 10px;
  font-family: var(--font-display);
  font-size: 30px;
  color: rgba(184, 48, 44, 0.22);
  transform: rotate(-12deg);
  pointer-events: none;
}

.arena-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.arena-name {
  font-size: 15px;
  font-weight: 900;
  color: var(--ink);
  transform: rotate(-0.4deg);
}

.cup-value {
  font-size: 24px;
  font-weight: 900;
  color: var(--gold-ink);
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.85);
}

.cup-value::after {
  content: " 🏆";
  font-size: 14px;
}

.rules-card {
  gap: 12px;
}

.rules-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-soft);
}

.rules-list li {
  padding: 7px 10px;
  border-left: 3px solid rgba(162, 112, 13, 0.5);
  border-radius: 0 6px 6px 0;
  background: rgba(255, 255, 255, 0.55);
}

.rules-list b {
  color: var(--ink);
}

/* ===================== ДУЭЛИ: ЛОББИ, АРЕНА, КАРТЫ ===================== */

.bet-card {
  gap: 12px;
}

.bet-selector {
  display: grid;
  /* Пять ставок в два аккуратных ряда (3+2), а не пять узких кнопок в строку */
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.bet-btn {
  padding: 10px 6px;
  border: 2px solid #b7a67e;
  border-radius: 9px;
  background: linear-gradient(180deg, #fffdf4, #ecdfc0);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 3px 0 #b7a67e, 0 6px 10px rgba(0, 0, 0, 0.18);
  transition: transform 0.1s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.bet-btn.is-active {
  border-color: #a2700d;
  background: linear-gradient(180deg, #ffe9a8, #f0bf4d);
  color: #4a3000;
  box-shadow:
    0 3px 0 #8a6108,
    0 0 0 2px rgba(255, 200, 59, 0.35),
    0 6px 12px rgba(0, 0, 0, 0.22);
}

.bet-btn:active {
  transform: translateY(3px);
  box-shadow: 0 0 0 #b7a67e, 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* --- Боевая арена --- */

#duel-lobby {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#duel-arena-screen {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fighter-card {
  gap: 8px;
  overflow: hidden;
}

.fighter-me {
  background-color: #fffcee;
}

.fighter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.fighter-side {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.fighter-cups {
  font-size: 13px;
  font-weight: 900;
  color: var(--gold-ink);
  white-space: nowrap;
}

.fighter-nick {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 900;
  line-height: 1.1;
  color: var(--ink);
  transform: rotate(-0.4deg);
}

.hp-bar {
  position: relative;
  height: 14px;
  border-radius: 8px;
  background: rgba(36, 31, 24, 0.14);
  border: 1px solid rgba(36, 31, 24, 0.24);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.16);
  overflow: hidden;
}

.hp-fill {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 7px;
  background: linear-gradient(180deg, #8ff0a8, #2fbf63);
  transition: width 0.55s cubic-bezier(0.22, 0.9, 0.28, 1), background 0.3s ease;
}

.hp-fill.is-low {
  background: linear-gradient(180deg, #ffd27a, #e2961d);
}

.hp-fill.is-critical {
  background: linear-gradient(180deg, #ff9a9a, #cf2f2f);
}

.fighter-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--ink-soft);
}

.fighter-buff {
  font-size: 10.5px;
  font-weight: 900;
  color: var(--blue-ink);
  text-align: right;
}

.duel-round-line {
  text-align: center;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--chalk-yellow);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.55);
}

/* Записка за гаражами */
.duel-log {
  position: relative;
  padding: 14px 14px 14px 28px;
  color: var(--ink);
  background-color: var(--paper-2);
  background-image:
    repeating-linear-gradient(0deg, transparent 0 21px, var(--grid-line) 21px 22px),
    repeating-linear-gradient(90deg, transparent 0 21px, var(--grid-line-soft) 21px 22px);
  border: 1px dashed #a49470;
  border-radius: 6px;
  box-shadow:
    0 4px 0 rgba(0, 0, 0, 0.2),
    0 12px 20px rgba(0, 0, 0, 0.3);
  transform: rotate(-0.35deg);
}

/* Кусок скотча, которым записка приклеена к стене гаража */
.duel-log::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  margin-left: -26px;
  width: 52px;
  height: 14px;
  background: rgba(214, 196, 150, 0.8);
  border: 1px solid rgba(140, 120, 80, 0.35);
  transform: rotate(-2deg);
  pointer-events: none;
}

.duel-log-title {
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 4px;
}

.duel-log-text {
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre-line;
  word-break: break-word;
}

/* --- 4 карточные кнопки --- */

.duel-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.card-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 8px;
  border: 2px solid #b7a67e;
  border-radius: 10px;
  background: linear-gradient(180deg, #fffdf4, #ecdfc0);
  color: var(--ink);
  font-family: var(--font-body);
  cursor: pointer;
  box-shadow:
    0 4px 0 #b7a67e,
    0 8px 14px rgba(0, 0, 0, 0.24);
  transition: transform 0.1s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.card-btn-ico {
  font-size: 24px;
  line-height: 1;
}

.card-btn-name {
  font-size: 13px;
  font-weight: 900;
}

.card-btn-hint {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  color: var(--ink-faint);
}

.card-btn:active {
  transform: translateY(4px);
  box-shadow: 0 0 0 #b7a67e, 0 3px 7px rgba(0, 0, 0, 0.22);
}

.card-btn.is-picked {
  border-color: #1c7a44;
  background: linear-gradient(180deg, #c9fbd3, #7fe0a0);
  box-shadow:
    0 0 0 3px rgba(76, 243, 154, 0.35),
    0 4px 0 #166b3b,
    0 10px 16px rgba(0, 0, 0, 0.24);
  transform: translateY(-2px);
}

.card-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.3);
}

/* --- Тряска от полученного урона --- */

.fighter-card.is-hit {
  animation: duel-hit 0.42s ease;
}

.fighter-card.is-hit .hp-fill {
  animation: hp-pulse 0.5s ease;
}

@keyframes duel-hit {
  0%,
  100% {
    transform: translateX(0);
  }
  15% {
    transform: translateX(-7px) rotate(-0.6deg);
  }
  35% {
    transform: translateX(6px) rotate(0.5deg);
  }
  55% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(3px);
  }
}

@keyframes hp-pulse {
  0%,
  100% {
    filter: none;
  }
  50% {
    filter: brightness(1.45) saturate(1.2);
  }
}

/* --- Победный / пораженческий экран --- */

.duel-result {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.duel-result-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 14px 14px 28px;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(0deg, transparent 0 21px, var(--grid-line) 21px 22px),
    repeating-linear-gradient(90deg, transparent 0 21px, var(--grid-line-soft) 21px 22px);
  border: 1px solid var(--paper-edge);
  border-radius: 6px;
  box-shadow:
    0 4px 0 rgba(0, 0, 0, 0.2),
    0 14px 24px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.duel-result-card::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 18px;
  width: 2px;
  background: linear-gradient(
    180deg,
    transparent,
    var(--margin-line) 7%,
    var(--margin-line) 93%,
    transparent
  );
  pointer-events: none;
}

.duel-result-title {
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
  color: var(--red-ink);
  transform: rotate(-1deg);
}

.duel-result.is-win .duel-result-title {
  color: var(--green-ink);
}

.duel-result.is-cancelled .duel-result-title {
  color: var(--ink-soft);
  font-size: 20px;
}

.duel-result-sub {
  font-size: 11.5px;
  font-weight: 700;
  text-align: center;
  color: var(--ink-soft);
}

.duel-result-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.duel-result-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 9px 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(36, 31, 24, 0.12);
}

.duel-result-stat span {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.duel-result-stat b {
  font-size: 20px;
  font-weight: 900;
  color: var(--gold-ink);
}

.duel-result-stat b.is-plus {
  color: var(--green-ink);
}

.duel-result-stat b.is-minus {
  color: var(--red-ink);
}

.duel-result-stat b.is-pop {
  animation: cup-pop 0.6s ease;
}

@keyframes cup-pop {
  0% {
    transform: scale(0.6) rotate(-6deg);
    opacity: 0.2;
  }
  55% {
    transform: scale(1.18) rotate(3deg);
    opacity: 1;
  }
  100% {
    transform: scale(1);
  }
}

.duel-result-log {
  max-height: 180px;
  overflow-y: auto;
  padding: 10px 10px 10px 14px;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-line;
  word-break: break-word;
  color: var(--ink-soft);
  border-left: 3px solid rgba(162, 112, 13, 0.5);
  border-radius: 0 6px 6px 0;
  background: rgba(255, 255, 255, 0.55);
}

/* ===================== БАНДА ===================== */

.clan-card {
  overflow: hidden;
  background-color: #fffcee;
}

.clan-doodle {
  position: absolute;
  right: 12px;
  bottom: 10px;
  font-size: 24px;
  opacity: 0.24;
  transform: rotate(10deg);
  pointer-events: none;
}

.locations {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.location {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
}

.location.is-owned {
  border-color: #7cc99a;
  background-color: #f4fbe9;
  box-shadow:
    inset 4px 0 0 var(--green-ink),
    0 4px 0 rgba(0, 0, 0, 0.18),
    0 12px 20px rgba(0, 0, 0, 0.3);
}

.location .shop-item-emoji {
  width: 38px;
  height: 38px;
  font-size: 19px;
  border-style: solid;
  border-color: rgba(87, 74, 56, 0.24);
}

.location-body {
  flex: 1 1 auto;
  min-width: 0;
}

.location-name {
  font-size: 13px;
  font-weight: 900;
  color: var(--ink);
}

.location-meta {
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--ink-soft);
}

.location-raid {
  flex: 0 0 auto;
  padding: 9px 10px;
  border-radius: 8px;
  border: 2px solid #8a6108;
  background: linear-gradient(180deg, #ffe6a2, #efb943);
  color: #4a3000;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.16s ease, filter 0.16s ease;
  box-shadow:
    0 3px 0 #7c5606,
    0 5px 10px rgba(0, 0, 0, 0.18);
}

.location-raid:active {
  transform: translateY(3px);
  box-shadow: 0 0 0 #7c5606;
}

.location-raid:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  filter: grayscale(0.4);
}

/* ===================== БАНДА: ВОЛК-ОДИНОЧКА И КАТАЛОГ ===================== */

.loner-card {
  overflow: hidden;
  background-color: #fffcee;
}

.loner-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 900;
  color: var(--ink);
  margin-bottom: 5px;
}

#clan-loner,
#clan-member {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Атрибут hidden должен побеждать display: flex выше */
#clan-loner[hidden],
#clan-member[hidden] {
  display: none;
}

/* .card { display: flex } тоже перебивает [hidden] — фиксируем явно */
#clan-catalog-card[hidden] {
  display: none;
}

.clan-catalog {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

/* Каталог банд — записки на тетрадном листе */
.clan-choice {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 11px 10px 20px;
  border-radius: 7px;
  border: 1px solid rgba(87, 74, 56, 0.28);
  border-left: 3px solid var(--green-ink);
  background-color: #fdf8e8;
  background-image:
    repeating-linear-gradient(0deg, transparent 0 18px, rgba(58, 106, 148, 0.14) 18px 19px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12);
}

.clan-choice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.clan-choice-tag {
  font-size: 11px;
  font-weight: 900;
  color: #fff8e2;
  padding: 2px 8px;
  border-radius: 5px;
  background: linear-gradient(180deg, #a2700d, #7b5205);
  transform: rotate(-1deg);
  white-space: nowrap;
}

.clan-choice-slots {
  font-size: 11px;
  font-weight: 900;
  color: var(--ink-soft);
}

.clan-choice-name {
  font-size: 13px;
  font-weight: 900;
  color: var(--ink);
}

.clan-choice-meta {
  font-size: 11px;
  line-height: 1.35;
  color: var(--ink-soft);
}

.clan-join {
  align-self: flex-start;
  margin-top: 3px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 2px solid #1c7a44;
  background: linear-gradient(180deg, #bcf7c8, #63d68b);
  color: #0b3a20;
  font-size: 12px;
  font-weight: 900;
  font-family: var(--font-display);
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.16s ease, filter 0.16s ease;
  box-shadow:
    0 3px 0 #166b3b,
    0 5px 10px rgba(0, 0, 0, 0.18);
}

.clan-join:active {
  transform: translateY(3px);
  box-shadow: 0 0 0 #166b3b;
}

.clan-join:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  filter: grayscale(0.35);
}

/* Роль в банде и лига */
.clan-role-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 7px 0 9px;
}

.clan-role {
  font-size: 11px;
  font-weight: 900;
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px dashed #a49470;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.6);
  transform: rotate(-1deg);
}

.clan-role.is-leader {
  color: #654300;
  border-color: #e0b93c;
  border-style: solid;
  background: linear-gradient(180deg, #ffeeb8, #f6cf72);
}

.clan-league-badge {
  font-size: 11px;
  font-weight: 900;
  color: var(--ink-soft);
}

.clan-card .btn + .btn {
  margin-top: 7px;
}

/* 🗺 Карта Войны */
.map-card .locations {
  margin-top: 8px;
}

.location-owner {
  margin-top: 3px;
  font-size: 11px;
  font-weight: 900;
  color: var(--ink);
}

.location-points {
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--ink-soft);
}

.location-points.is-top {
  color: #1c7a44;
  font-weight: 900;
}

.location-buff {
  margin-top: 3px;
  padding-top: 3px;
  border-top: 1px dashed rgba(87, 74, 56, 0.32);
  font-size: 10.5px;
  line-height: 1.35;
  color: var(--ink-soft);
}

/* Всплывающая награда за рейд «+120 ₽ / +15 😎» */
.clan-reward-fly {
  position: absolute;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 900;
  color: #f6ffe9;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid #7fe0a0;
  background: linear-gradient(180deg, rgba(38, 88, 52, 0.96), rgba(19, 54, 32, 0.96));
  box-shadow:
    0 3px 0 rgba(0, 0, 0, 0.32),
    0 0 16px rgba(127, 224, 160, 0.42);
  white-space: nowrap;
  pointer-events: none;
  animation: clan-reward-rise 1.05s ease-out forwards;
}

@keyframes clan-reward-rise {
  0% {
    opacity: 0;
    transform: translate(-50%, -20%) scale(0.8);
  }
  22% {
    opacity: 1;
    transform: translate(-50%, -60%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -170%) scale(1.04);
  }
}

/* ===================== ЖИВАЯ ЛЕНТА ===================== */

.feed-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

/* Закреплённый «Главный Рупор» — графитовая записка на стене */
.pinned-shout {
  position: relative;
  padding: 13px 14px 12px 16px;
  border-radius: 8px;
  color: #f8efdb;
  background-color: var(--slate);
  background-image:
    repeating-linear-gradient(0deg, transparent 0 18px, rgba(255, 255, 255, 0.045) 18px 19px),
    linear-gradient(180deg, #333940, #262b31);
  border: 1px solid #4b535c;
  box-shadow:
    0 4px 0 rgba(0, 0, 0, 0.26),
    0 12px 20px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.pinned-title {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #ffd777;
}

.pinned-text {
  margin-top: 5px;
  font-size: 13px;
  line-height: 1.45;
  color: #fbf3e1;
}

.feed-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 11px 12px 11px 26px;
}

.feed-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 10px;
  color: var(--ink-soft);
}

.feed-type {
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 900;
  border-radius: 5px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink-soft);
}

.feed-type-mythic_drop {
  color: #654300;
  border-color: #e0b93c;
  background: linear-gradient(180deg, #ffeeb8, #f6cf72);
}

.feed-type-shoutout {
  color: #7a2410;
  border-color: #e79b76;
  background: linear-gradient(180deg, #ffdcc6, #f7b895);
}

.feed-type-couple {
  color: #8a2a5e;
  border-color: #e08fb8;
  background: linear-gradient(180deg, #ffe0ef, #f8bcd8);
}

.feed-type-clan_join,
.feed-type-clan {
  color: #22456f;
  border-color: #8fb6e0;
  background: linear-gradient(180deg, #dbeaff, #a8c9f2);
}

.feed-type-clan_feast {
  color: #7a4a00;
  border-color: #e0b96a;
  background: linear-gradient(180deg, #ffe7b8, #f7cf85);
}

.feed-type-league_promotion {
  color: #4b2b8a;
  border-color: #a98be0;
  background: linear-gradient(180deg, #e6d9ff, #c1a9f2);
}

.feed-type-global {
  color: var(--ink-soft);
}

.feed-text {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink);
}

/* ===================== НИЖНЯЯ НАВИГАЦИЯ: ДЕРЕВЯННЫЙ ПЕНАЛ ===================== */

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 30;
  width: min(460px, 100%);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 5px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  border-radius: 16px 16px 0 0;
  background-color: #2e2014;
  background-image:
    repeating-linear-gradient(92deg, rgba(255, 222, 180, 0.07) 0 2px, transparent 2px 10px),
    repeating-linear-gradient(88deg, rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 7px),
    linear-gradient(180deg, #3d2a19, #241a11);
  border-top: 3px solid #7a5330;
  box-shadow:
    0 -10px 24px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 214, 160, 0.22);
}

.nav-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 2px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #d6c0a0;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease;
}

.nav-ico {
  font-size: 20px;
  line-height: 1;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.5));
  transition: transform 0.16s ease, filter 0.16s ease;
}

.nav-label {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.03em;
  line-height: 1.1;
}

/* Цветные маркеры вкладок — как карандаши в пенале */
.nav-btn::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 3px;
  width: 26px;
  height: 3px;
  border-radius: 3px;
  transform: translateX(-50%) scaleX(0.25);
  opacity: 0.5;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-btn:nth-child(1)::after {
  background: #4cf39a;
}

.nav-btn:nth-child(2)::after {
  background: #ffd166;
}

.nav-btn:nth-child(3)::after {
  background: #ff9f5a;
}

.nav-btn:nth-child(4)::after {
  background: #ff6b6b;
}

.nav-btn:nth-child(5)::after {
  background: #66c7ff;
}

.nav-btn:active {
  transform: translateY(1px);
}

.nav-btn.is-active {
  color: #fffaf0;
  background: linear-gradient(180deg, rgba(255, 224, 160, 0.16), rgba(0, 0, 0, 0.24));
  box-shadow: inset 0 1px 0 rgba(255, 226, 170, 0.32);
}

.nav-btn.is-active::after {
  opacity: 1;
  transform: translateX(-50%) scaleX(1);
}

.nav-btn.is-active .nav-ico {
  transform: translateY(-2px) scale(1.12);
  filter: drop-shadow(0 0 9px rgba(255, 214, 120, 0.75));
}

/* ===================== ТОСТЫ: ГРАФИТОВЫЕ ЗАПИСКИ ===================== */

.toast-stack {
  position: fixed;
  left: 50%;
  /* ⚠️ --topbar-height уже замеряет РЕАЛЬНУЮ высоту шапки через measureTopbar()
     (она включает env(safe-area-inset-top) из своего padding-top), поэтому
     второй раз системный отступ не прибавляем — иначе тосты уезжали вниз
     и наезжали на кнопки карт в бою. */
  top: calc(var(--topbar-height) + 12px);
  bottom: auto;
  z-index: 999;
  width: min(420px, calc(100% - 28px));
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  transform: translateX(-50%);
  pointer-events: none !important;
}

.toast {
  padding: 11px 13px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-left: 4px solid #8ef0b3;
  border-radius: 8px;
  color: #f6f1e4;
  font-size: 12.5px;
  line-height: 1.4;
  background-color: var(--slate);
  background-image: repeating-linear-gradient(0deg, transparent 0 16px, rgba(255, 255, 255, 0.05) 16px 17px);
  box-shadow:
    0 6px 0 rgba(0, 0, 0, 0.28),
    0 12px 26px rgba(0, 0, 0, 0.46);
  animation: toast-in 0.22s ease both;
  pointer-events: none !important;
}

.toast.is-error {
  border-left-color: #ff6b6b;
  color: #ffe6e6;
}

.toast.is-success {
  border-left-color: #8ef0b3;
}

.toast.is-leaving {
  animation: toast-out 0.25s ease forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}

/* ===================== СЛУЖЕБНОЕ И АДАПТИВ ===================== */

/* ===================== АВАТАР ШКОЛЬНИКА В ХАТЕ ===================== */

.hero-figure {
  flex: 0 0 auto;
  width: 104px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.hero-avatar-figure {
  width: 100px;
  height: 124px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 2px dashed #b7a67e;
  border-radius: 14px 14px 20px 20px;
  background: radial-gradient(circle at 34% 24%, #fffdf4, #e9ddbe);
  box-shadow:
    0 4px 0 rgba(0, 0, 0, 0.12),
    inset 0 1px 0 #ffffff;
  transform: rotate(-1.5deg);
}

.student-svg {
  width: 92px;
  height: 114px;
  display: block;
}

.student-shadow {
  fill: rgba(36, 31, 24, 0.14);
}

.student-bag {
  fill: #8a5a34;
  stroke: #5a3d28;
  stroke-width: 2;
}

.student-leg {
  fill: #3f4a63;
  stroke: #26303f;
  stroke-width: 2;
}

.student-shoe {
  fill: #f3f0e6;
  stroke: #26303f;
  stroke-width: 2;
}

.student-arm,
.student-jacket {
  fill: #455a78;
  stroke: #26303f;
  stroke-width: 2;
}

.student-shirt {
  fill: #fdf9e8;
  stroke: #26303f;
  stroke-width: 2;
}

.student-head {
  fill: #f6d3ae;
  stroke: #26303f;
  stroke-width: 2;
}

.student-hair {
  fill: #4a3324;
}

.student-hair-girl,
.student-bow {
  display: none;
}

.hero-avatar-figure.is-girl .student-hair-boy {
  display: none;
}

.hero-avatar-figure.is-girl .student-hair-girl,
.hero-avatar-figure.is-girl .student-bow {
  display: block;
}

.hero-avatar-figure.is-girl .student-jacket {
  fill: #a8537a;
}

.hero-avatar-figure.is-girl .student-arm {
  fill: #c47194;
}

.student-eye {
  fill: #241f18;
}

.student-smile {
  fill: none;
  stroke: #241f18;
  stroke-width: 2;
  stroke-linecap: round;
}

/* Дерзкое скетч-лицо: брови дугой + венка у виска */
.hero-avatar-figure .student-brow {
  fill: none;
  stroke: #241f18;
  stroke-width: 2;
  stroke-linecap: round;
}

.hero-avatar-figure.is-girl .student-brow {
  stroke: #b8302c;
}

.hero-avatar-figure .student-vein {
  fill: none;
  stroke: #b8302c;
  stroke-width: 1.6;
  stroke-linecap: round;
  opacity: 0.85;
}

/* Накладываемые слоты шмота: лёгкое появление при надевании */
.av-slot .slot-art {
  animation: slot-pop 0.26s ease;
}

.av-slot.is-mythic .slot-art {
  filter: drop-shadow(0 0 4px rgba(124, 255, 107, 0.55));
}

@keyframes slot-pop {
  from {
    opacity: 0.25;
  }
  to {
    opacity: 1;
  }
}

.hero-gender {
  padding: 2px 8px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.hero-figure-note {
  margin-top: 4px;
  color: var(--ink-faint);
  font-size: 10.5px;
  line-height: 1.3;
}

.avatar-slots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

/* 5 слотов (обувь/куртка/штаны/шапка/аксессуары): последний занимает всю строку */
.avatar-slot[data-slot="accessory"] {
  grid-column: 1 / -1;
}

.avatar-slot {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px 8px;
  border: 1px dashed rgba(90, 61, 40, 0.35);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.42);
}

.avatar-slot-label {
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.avatar-slot-items {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  min-height: 18px;
}

.avatar-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  padding: 2px 6px;
  border: 1px solid #d9c48a;
  border-radius: 999px;
  background: #fff7dd;
  color: var(--ink);
  font-size: 10px;
  font-weight: 800;
}

.avatar-chip.is-empty {
  padding-left: 0;
  border-color: transparent;
  background: transparent;
  color: var(--ink-faint);
  font-weight: 700;
}

.upgrade-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.upgrade-btn {
  padding: 9px 6px;
  font-size: 11px;
  line-height: 1.2;
}

.upgrade-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.35);
}

/* ===================== ПАРТА: ПОД-ВКЛАДКИ, ДЕЛА И БОССЫ ===================== */

.desk-pane {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.desk-pane.is-active {
  display: flex;
  animation: screen-in 0.24s ease both;
}

.quest-event-card {
  gap: 10px;
}

.quest-event-panel {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px;
  border: 1px dashed #a49470;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.45);
}

.quest-event-name {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 900;
}

.quest-event-desc {
  color: var(--ink-soft);
  font-size: 11.5px;
  line-height: 1.4;
}

.quest-event-choices {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.quest-choice-btn {
  width: 100%;
  padding: 9px 10px;
  border: 2px solid #7a5330;
  border-radius: 8px;
  background: linear-gradient(180deg, #fffdf4, #ecdfc0);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 900;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 3px 0 #b7a67e;
  transition: transform 0.1s ease, box-shadow 0.16s ease;
}

.quest-choice-btn:active {
  transform: translateY(3px);
  box-shadow: 0 0 0 #b7a67e;
}

.quest-choice-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.quest-list,
.boss-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quest-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 9px 10px;
  border: 1px dashed rgba(90, 61, 40, 0.32);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.4);
}

.quest-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.quest-name {
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 900;
}

.quest-cost {
  color: #8a3b00;
  font-size: 10.5px;
  font-weight: 900;
  white-space: nowrap;
}

.quest-desc {
  color: var(--ink-soft);
  font-size: 10.5px;
  line-height: 1.35;
}

.quest-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.quest-reward {
  color: #16603a;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.35;
}

.quest-risk {
  color: #9b2b2b;
  font-size: 10px;
  font-weight: 800;
}

.quest-do-btn {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid #7a5330;
  border-radius: 7px;
  background: linear-gradient(180deg, #fffdf4, #ecdfc0);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 2px 0 #b7a67e;
}

.quest-do-btn:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 #b7a67e;
}

.quest-do-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.boss-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.boss-card.is-active {
  border-color: #d9a92c;
  box-shadow:
    0 0 0 2px rgba(255, 201, 74, 0.55),
    0 4px 0 rgba(0, 0, 0, 0.2),
    0 14px 24px rgba(0, 0, 0, 0.34);
}

.boss-card.is-locked {
  opacity: 0.84;
  filter: grayscale(0.2);
}

.boss-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.boss-name {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 900;
  line-height: 1.2;
}

.boss-req {
  color: var(--gold-ink);
  font-size: 10.5px;
  font-weight: 900;
  white-space: nowrap;
}

.boss-desc {
  color: var(--ink-soft);
  font-size: 10.5px;
  line-height: 1.35;
}

.boss-hp-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 800;
}

.boss-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.boss-attack-btn {
  padding: 8px 6px;
  border: 2px solid #7a5330;
  border-radius: 8px;
  background: linear-gradient(180deg, #d6f8dd, #93e0aa);
  color: #0d3c22;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 3px 0 #4f8a63;
}

.boss-attack-btn.is-petard {
  background: linear-gradient(180deg, #ffe6b8, #f4b45a);
  color: #5c2c00;
  box-shadow: 0 3px 0 #b07a2a;
}

.boss-attack-btn:active {
  transform: translateY(3px);
  box-shadow: 0 0 0 transparent;
}

.boss-attack-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.35);
}

.boss-lock-note {
  color: #9b2b2b;
  font-size: 10px;
  font-weight: 800;
}

.boss-active-note {
  color: #16603a;
}

/* 🌟 «Первый бой»: подсказка на вводном мини-боссе «Дежурный по этажу» */
.boss-first-note {
  padding: 5px 8px;
  border: 1px dashed #c8961e;
  border-radius: 6px;
  background: rgba(255, 233, 168, 0.55);
  color: #6b4a00;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.35;
}
/* ===================== БОЕВАЯ АРЕНА: ВСЁ В ОДИН ЭКРАН ===================== */

body.is-duel-arena {
  overflow: hidden;
}

body.is-duel-arena .screen.is-active {
  animation: none;
}

/* ===================== БОЕВАЯ АРЕНА ДУЭЛЕЙ (ФИКСИРОВАННЫЙ ЭКРАН) ===================== */
#duel-arena-screen.duel-arena {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  width: min(440px, 100%);
  height: calc(100vh - var(--nav-height) - env(safe-area-inset-bottom, 0px));
  height: calc(100dvh - var(--nav-height) - env(safe-area-inset-bottom, 0px));
  /* 📱 Учитываем и системный отступ, и высоту нативной шапки Telegram
     (--tma-header-inset из app.js) — иначе верх арены уезжает под крестик. */
  padding: calc(6px + env(safe-area-inset-top, 0px) + var(--tma-header-inset, 0px)) 10px 6px;
  background: linear-gradient(180deg, #3a2718 0%, #24190f 100%);
  overflow: hidden;
  box-sizing: border-box;
  display: block;
  gap: 0;
  border-bottom: 3px solid #7a5330;
  box-shadow:
    0 -10px 24px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 214, 160, 0.18);
}

.duel-arena-inner {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  overflow: hidden;
}

.duel-fighter {
  flex: 0 0 auto;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 7px 10px 6px 15px;
  overflow: hidden;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(0deg, transparent 0 21px, var(--grid-line) 21px 22px),
    repeating-linear-gradient(90deg, transparent 0 21px, var(--grid-line-soft) 21px 22px);
  border: 1px solid var(--paper-edge);
  border-radius: 6px;
  box-shadow:
    0 3px 0 rgba(0, 0, 0, 0.22),
    0 8px 14px rgba(0, 0, 0, 0.26);
}

.duel-fighter::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: #cf5f2f;
}

.duel-fighter-me::before {
  background: #2fbf63;
}

.duel-fighter-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.duel-fighter-side {
  color: var(--ink-faint);
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.duel-fighter-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hp-bar-compact {
  height: 10px;
}

.duel-fighter-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 800;
}

.duel-fighter.is-hit {
  animation: duel-hit 0.42s ease;
}

.duel-fighter.is-hit .hp-fill {
  animation: hp-pulse 0.5s ease;
}

.duel-arena-mid {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  overflow: hidden;
}

#duel-arena-screen .duel-round-line {
  font-size: 10.5px;
  line-height: 1.2;
}

#duel-arena-screen .duel-log {
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  padding: 8px 10px 6px 24px;
  transform: none;
}

#duel-arena-screen .duel-log::before {
  top: -5px;
  width: 44px;
  height: 10px;
  margin-left: -22px;
}

#duel-arena-screen .duel-log-title {
  margin-bottom: 0;
  font-size: 10.5px;
}

#duel-arena-screen .duel-log-text {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  font-size: 11px;
  line-height: 1.35;
}

#duel-arena-screen .duel-cards {
  flex: 0 0 auto;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

#duel-arena-screen .card-btn {
  min-height: 56px;
  gap: 0;
  padding: 6px 4px;
  border-radius: 9px;
  box-shadow:
    0 3px 0 #b7a67e,
    0 6px 10px rgba(0, 0, 0, 0.2);
}

#duel-arena-screen .card-btn-ico {
  font-size: 20px;
}

#duel-arena-screen .card-btn-name {
  font-size: 12px;
}

#duel-arena-screen .card-btn-hint {
  font-size: 10.5px;
  line-height: 1.15;
}

.duel-surr-wrap {
  flex: 0 0 auto;
  min-height: 0;
}

.duel-surrender {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 1px dashed rgba(255, 255, 255, 0.3);
  border-radius: 9px;
  background: rgba(43, 33, 18, 0.65);
  color: #f2d9b0;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.03em;
  cursor: pointer;
  opacity: 0.9;
}

.duel-surrender:active {
  transform: translateY(1px);
  opacity: 1;
}

.duel-surrender[disabled] {
  opacity: 0.45;
  cursor: default;
}

@media (max-height: 700px) {
  #duel-arena-screen.duel-arena {
    padding-top: calc(5px + env(safe-area-inset-top, 0px) + var(--tma-header-inset, 0px));
    padding-left: 8px;
    padding-right: 8px;
  }

  .duel-arena-inner {
    gap: 4px;
  }

  .duel-fighter {
    gap: 3px;
    padding: 5px 8px 4px 13px;
  }

  .duel-fighter-name {
    font-size: 12.5px;
  }

  #duel-arena-screen .duel-log {
    min-height: 0;
    padding: 6px 8px 5px 20px;
  }

  #duel-arena-screen .duel-log-text {
    min-height: 0;
    font-size: 10.5px;
  }

  #duel-arena-screen .card-btn {
    min-height: 50px;
    padding: 4px 3px;
  }

  #duel-arena-screen .card-btn-hint {
    display: none;
  }

  .duel-surrender {
    font-size: 10px;
    padding: 8px 6px;
  }
}

@media (max-height: 580px) {
  #duel-arena-screen .card-btn {
    min-height: 44px;
  }

  #duel-arena-screen .card-btn-ico {
    font-size: 17px;
  }

  #duel-arena-screen .card-btn-name {
    font-size: 11px;
  }

  #duel-arena-screen .duel-log {
    min-height: 0;
  }

  #duel-arena-screen .duel-log-text {
    min-height: 0;
  }

  .duel-fighter-meta {
    font-size: 10.5px;
  }
}

[hidden] {
  display: none !important;
}

@media (max-width: 360px) {
  .app {
    padding-left: 10px;
    padding-right: 10px;
  }

  .screen-title {
    font-size: 19px;
  }

  .income-value {
    font-size: 29px;
  }

  .card {
    padding: 14px 11px 12px 24px;
  }

  .card::before,
  .shop-item::before,
  .feed-item::before {
    left: 15px;
  }

  .stat-box {
    padding: 8px 9px;
  }

  .nav-label {
    font-size: 10px;
  }

  .desk-label {
    font-size: 15px;
  }

  .desk-surface {
    min-height: 140px;
    padding: 32px 12px 22px;
  }

  .teacher-alert {
    font-size: 10px;
    padding: 5px 8px;
  }

  .box-card {
    padding: 16px 12px 12px;
  }

  .shop-buy {
    padding: 8px 9px;
    font-size: 11px;
  }

  .location-raid {
    padding: 8px 9px;
    font-size: 10px;
  }

  .clan-join {
    padding: 7px 10px;
    font-size: 11px;
  }

  .clan-choice-name {
    font-size: 12px;
  }

  .loner-title {
    font-size: 15px;
  }

  .money-chip,
  .respect-chip,
  .style-chip {
    font-size: 12px;
    padding: 6px 5px;
  }

  .wardrobe-head,
  .wardrobe-totals,
  .wardrobe-body,
  .wardrobe-foot {
    padding-left: 30px;
    padding-right: 10px;
  }

  .wardrobe-item-name {
    font-size: 12px;
  }

  .wardrobe-toggle {
    min-width: 66px;
    padding: 7px 7px;
    font-size: 10.5px;
  }

  .bet-btn {
    font-size: 10px;
    padding: 8px 1px;
  }

  .card-btn {
    padding: 10px 6px;
  }

  .card-btn-name {
    font-size: 12px;
  }

  .fighter-nick {
    font-size: 17px;
  }

  .duel-result-title {
    font-size: 21px;
  }

  .duel-result-stat b {
    font-size: 18px;
  }
}

@media (min-width: 620px) {
  .app {
    max-width: 520px;
  }

  .bottom-nav {
    max-width: 520px;
    border-radius: 16px 16px 0 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* --- Финальные адаптивы для новых блоков (узкие экраны) --- */
@media (max-width: 360px) {
  .hero-figure {
    width: 86px;
  }

  .hero-avatar-figure {
    width: 82px;
    height: 104px;
  }

  .student-svg {
    width: 76px;
    height: 94px;
  }

  .hero-nick {
    font-size: 18px;
  }

  .avatar-slots {
    grid-template-columns: 1fr;
  }

  .upgrade-row {
    grid-template-columns: 1fr;
  }

  .quest-meta {
    flex-direction: column;
    align-items: stretch;
  }

  .quest-do-btn {
    width: 100%;
  }

  .boss-actions {
    grid-template-columns: 1fr;
  }

  #duel-arena-screen.duel-arena {
    padding-left: 6px;
    padding-right: 6px;
  }
}

/* ===================== 📓 ДНЕВНИК: КАРТОЧКА В ХАТЕ ===================== */

.diary-card {
  position: relative;
  overflow: hidden;
}

.diary-doodle {
  position: absolute;
  right: 10px;
  bottom: 6px;
  font-size: 44px;
  line-height: 1;
  opacity: 0.16;
  transform: rotate(-9deg);
  pointer-events: none;
}

/* ===================== 📓 ДНЕВНИК: ТЕТРАДНЫЙ ОВЕРЛЕЙ ===================== */

body.is-diary-open,
body.is-register-open {
  overflow: hidden;
}

.diary-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  place-items: center;
  padding: 12px;
}

.diary-overlay.is-open {
  display: grid;
}

.diary-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 50% 32%,
    rgba(44, 28, 12, 0.66),
    rgba(10, 6, 3, 0.93)
  );
  backdrop-filter: blur(3px);
}

.diary-sheet {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  max-height: min(88vh, 760px);
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(0deg, transparent 0 21px, var(--grid-line-soft) 21px 22px),
    radial-gradient(120% 45% at 50% 0%, rgba(255, 255, 255, 0.7), transparent 70%);
  border: 2px solid #d7c79f;
  border-radius: 6px;
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.45),
    inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  overflow: hidden;
}

.diary-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.diary-block {
  padding: 10px 11px 12px;
  border-radius: 8px;
  background: rgba(255, 252, 244, 0.85);
  border: 1px solid #ddcda4;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.diary-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.diary-block-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 15px;
  color: #4a3208;
}

.diary-block .btn {
  margin-top: 8px;
}

.tag-gold {
  background: linear-gradient(180deg, #f6d470, #c9971f);
  color: #4a3208;
}

/* --- Дни ежедневного подгона --- */

.diary-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin: 8px 0 6px;
}

.diary-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px 2px 5px;
  border-radius: 6px;
  border: 1px dashed #c9b585;
  background: rgba(255, 255, 255, 0.6);
  font-size: 10.5px;
  line-height: 1.2;
  color: #5b4a32;
  text-align: center;
}

.diary-day-no {
  font-weight: 900;
  font-size: 10px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  opacity: 0.75;
}

.diary-day-money {
  font-weight: 900;
  font-size: 11px;
  color: #2f5e2a;
}

.diary-day-extra {
  font-size: 10px;
  opacity: 0.8;
}

.diary-day.is-next {
  border: 2px solid #2f8f3c;
  background: linear-gradient(180deg, #eaffd9, #cdf3b4);
  box-shadow: 0 0 0 2px rgba(47, 143, 60, 0.18);
  transform: translateY(-1px);
}

.diary-day.is-claimed {
  opacity: 0.55;
  background: rgba(214, 205, 176, 0.55);
}

.diary-day-check {
  position: absolute;
  top: -5px;
  right: -4px;
  font-size: 10px;
}

.diary-timer {
  font-size: 10.5px;
  font-weight: 700;
  color: #7a5a24;
  padding: 4px 8px;
  border-radius: 5px;
  background: rgba(255, 236, 186, 0.65);
  text-align: center;
}

/* --- 🔐 Секретное комбо дня --- */

.combo-status {
  padding: 6px 9px;
  border-radius: 6px;
  background: rgba(255, 236, 180, 0.55);
  border: 1px dashed #c9a95c;
  font-size: 11px;
  font-weight: 800;
  color: #6a4c12;
}

.combo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  max-height: 168px;
  overflow-y: auto;
  padding: 3px;
  margin-top: 6px;
}

.combo-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 3px;
  border-radius: 7px;
  border: 1px solid #cbbb92;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-size: 10.5px;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.combo-item-ico {
  font-size: 16px;
  line-height: 1;
}

.combo-item-name {
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.combo-item-price {
  font-size: 10px;
  opacity: 0.7;
}

.combo-item.is-selected {
  border: 2px solid #2f8f3c;
  background: linear-gradient(180deg, #edffdc, #c9f0ad);
  box-shadow: 0 0 0 2px rgba(47, 143, 60, 0.16);
  transform: translateY(-1px);
}

.combo-item:disabled {
  opacity: 0.5;
  cursor: default;
}

.combo-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 8px;
}

.combo-message {
  margin: 8px 0 0;
  padding: 7px 9px;
  border-radius: 6px;
  background: rgba(255, 252, 235, 0.9);
  border-left: 3px solid var(--gold-ink);
  font-size: 11px;
  line-height: 1.45;
  color: #4b3c1d;
  white-space: pre-line;
}

/* 💡 «Умное комбо»: предмет точно входит в связку — золотая рамка с меткой */
.combo-item.is-hint {
  border: 2px solid #c9971f;
  background: linear-gradient(180deg, #fff6d6, #ffe9a8);
  box-shadow: 0 0 0 2px rgba(201, 151, 31, 0.22);
}

.combo-item.is-selected.is-hint {
  border-color: #2f8f3c;
  box-shadow: 0 0 0 2px rgba(47, 143, 60, 0.28),
    inset 0 0 0 2px rgba(201, 151, 31, 0.55);
}

.combo-item-hint {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #7a5307;
  background: rgba(255, 236, 180, 0.9);
  border-radius: 4px;
  padding: 1px 3px;
  white-space: nowrap;
}

/* --- 📋 «Дела на сегодня» --- */

.diary-tasks .diary-block-head .tag {
  background: linear-gradient(180deg, #e9f7d8, #c8e8ad);
  color: #2f5e2a;
}

.diary-task-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 6px;
}

.diary-task {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 6px 7px;
  border-radius: 7px;
  border: 1px dashed #cbbb92;
  background: rgba(255, 255, 255, 0.66);
  font-size: 10.5px;
  line-height: 1.25;
  color: var(--ink);
}

.diary-task.is-done {
  border: 1px solid #2f8f3c;
  background: linear-gradient(180deg, #f2ffe4, #dcf5c6);
}

.diary-task.is-claimed {
  opacity: 0.62;
  border-style: solid;
}

.diary-task.is-chest {
  border: 2px solid #c9971f;
  background: linear-gradient(180deg, #fff8e0, #ffeec0);
}

.diary-task.is-chest.is-done {
  box-shadow: 0 0 0 2px rgba(201, 151, 31, 0.25);
}

.diary-task-ico {
  font-size: 15px;
  line-height: 1;
  text-align: center;
}

.diary-task-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.diary-task-title {
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
}

.diary-task-progress {
  height: 5px;
  border-radius: 3px;
  background: rgba(122, 90, 36, 0.18);
  overflow: hidden;
}

.diary-task-progress span {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #7cff6b, #2f8f3c);
  transition: width 0.25s ease;
}

.diary-task-num {
  font-size: 9.5px;
  font-weight: 800;
  color: #6d5730;
  opacity: 0.85;
}

.diary-task-btn {
  margin: 0 !important;
  padding: 5px 8px;
  font-size: 10px;
  white-space: nowrap;
}

@media (max-width: 360px) {
  .diary-task {
    grid-template-columns: 16px minmax(0, 1fr);
  }
  .diary-task .diary-task-btn {
    grid-column: 1 / -1;
    width: 100%;
  }
}

/* --- 🎟 Battle Pass --- */

.bp-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 10.5px;
  font-weight: 800;
  color: #5b4a32;
  margin: 4px 0 6px;
}

.bp-summary b {
  color: #2f5e2a;
}

.bp-progress {
  position: relative;
  height: 10px;
  border-radius: 5px;
  background: rgba(120, 100, 60, 0.18);
  border: 1px solid #c9b585;
  overflow: hidden;
}

.bp-progress span {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #7cc95f, #2f8f3c);
  transition: width 0.35s ease;
}

.bp-levels {
  display: grid;
  /* 5 крупных карточек в ряд (20 уровней = 4 читаемых ряда) вместо
     десяти микро-колонок, где номер уровня и XP не читались. */
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin: 8px 0 6px;
}

.bp-level {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px 2px 5px;
  border-radius: 6px;
  border: 1px dashed #c9b585;
  background: rgba(255, 255, 255, 0.55);
  font-size: 10px;
  color: #6b5940;
  line-height: 1.2;
}

.bp-mark {
  font-size: 10px;
  line-height: 1;
}

.bp-no {
  font-weight: 900;
  font-size: 11px;
}

.bp-xp {
  font-size: 10px;
  opacity: 0.72;
}

.bp-level.is-reached {
  border: 1px solid #2f8f3c;
  background: linear-gradient(180deg, #f0ffe4, #d5f2bd);
  color: #245c22;
}

.bp-level.is-next {
  border: 2px solid #a2700d;
  background: linear-gradient(180deg, #fff4cf, #f6d98b);
  color: #5a3f0a;
  box-shadow: 0 0 0 2px rgba(162, 112, 13, 0.16);
}

/* ===================== 🏫 ОФОРМЛЕНИЕ В ШКОЛУ (НОВИЧОК) ===================== */

:root {
  /* Красный штамп «8-Б» на личном деле */
  --stamp: #b8302c;
}

.register-overlay {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: none;
  place-items: center;
  padding: 14px;
}

.register-overlay.is-open {
  display: grid;
}

.register-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 50% 28%,
    rgba(58, 40, 18, 0.72),
    rgba(8, 5, 2, 0.95)
  );
  backdrop-filter: blur(4px);
}

.register-sheet {
  position: relative;
  z-index: 1;
  width: min(400px, 100%);
  max-height: min(92vh, 720px);
  overflow-y: auto;
  padding: 52px 18px 18px;
  /* 📱 Не упираемся в «Home indicator» iPhone на экране регистрации */
  padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(0deg, transparent 0 21px, var(--grid-line) 21px 22px),
    repeating-linear-gradient(90deg, transparent 0 21px, var(--grid-line-soft) 21px 22px);
  border: 2px solid #d7c79f;
  border-radius: 6px;
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  animation: loot-in 0.3s ease both;
}

.register-stamp {
  position: absolute;
  top: 8px;
  right: 14px;
  padding: 3px 12px;
  border: 2px solid var(--stamp);
  border-radius: 4px;
  color: var(--stamp);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.08em;
  transform: rotate(8deg);
  opacity: 0.6;
}

.register-head {
  text-align: center;
  margin-bottom: 12px;
}

.register-head .wardrobe-title {
  font-size: 19px;
}

.register-sub {
  margin-top: 3px;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--ink-soft);
}

.register-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.register-label {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--stamp);
}

.register-gender {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.gender-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 8px;
  border-radius: 9px;
  border: 2px dashed #c2b18a;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease, border-color 0.15s ease;
}

.gender-ico {
  font-size: 17px;
  line-height: 1;
}

.gender-btn.is-active {
  border: 2px solid var(--stamp);
  background: linear-gradient(180deg, #fff6d8, #f4dfa4);
  color: var(--ink);
  box-shadow: 0 3px 0 rgba(162, 112, 13, 0.35);
}

.gender-btn:active {
  transform: translateY(1px);
}

.register-input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 9px;
  border: 2px solid #c2b18a;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  outline: none;
}

.register-input:focus {
  border-color: var(--stamp);
  box-shadow: 0 0 0 3px rgba(162, 112, 13, 0.18);
}

.register-hint {
  margin: -2px 0 2px;
  font-size: 10.5px;
  line-height: 1.4;
  color: var(--ink-soft);
}

/* 🎲 Автопогоняло: поле + кость в один ряд — первый вход без трения */
.register-nick-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.register-nick-row .register-input {
  flex: 1 1 auto;
}

.register-dice {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 19px;
  line-height: 1;
  border-radius: 9px;
  border: 2px dashed #c2b18a;
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease;
}

.register-dice:active {
  transform: translateY(1px) rotate(-8deg);
  background: #fff6d8;
}

/* ✏️ Смена погоняла: тетрадный лист в стиле шкафа */
body.is-nickname-open {
  overflow: hidden;
}

.nickname-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nickname-note {
  margin: 0;
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--ink-soft);
}

.register-submit {
  margin-top: 2px;
  font-size: 15px;
  padding: 14px 12px;
}

.register-note {
  margin: 2px 0 0;
  text-align: center;
  font-size: 10px;
  line-height: 1.4;
  color: var(--ink-soft);
}

/* ===================== 🧼 КЛЕЙМО, 💘 ПАРА И 🚪 В ГОСТИ ===================== */

body.is-visit-open,
body.is-note-open {
  overflow: hidden;
}

/* --- 🧼 Позорное клеймо: красная записка в дневнике --- */
.brand-card {
  border-color: rgba(184, 48, 44, 0.55);
  background-color: #f8e5dc;
}

/* ⚠️ `.card { display:flex }` ломает атрибут hidden — прячем принудительно */
.brand-card[hidden],
.couple-card[hidden] {
  display: none;
}

.tag-danger {
  background: linear-gradient(180deg, #e2574f, #a52a24);
  color: #fff4ef;
}

.btn-wash {
  border-color: #a52a24;
  background: linear-gradient(180deg, #ffe3d9, #f2938b);
  color: #5e0d0d;
  box-shadow:
    0 4px 0 #7d1a16,
    0 8px 16px rgba(0, 0, 0, 0.24);
}

/* --- 💞 Вторая половинка: розовая тетрадная страничка --- */
.couple-card {
  overflow: hidden;
  border-color: rgba(178, 53, 107, 0.45);
  background-color: #f9e8ee;
}

.couple-doodle {
  position: absolute;
  top: 8px;
  right: 14px;
  font-size: 34px;
  opacity: 0.24;
  transform: rotate(-9deg);
  pointer-events: none;
}

.couple-name {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 900;
  color: #8d2247;
}

.couple-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.couple-actions .btn {
  padding: 10px 8px;
  font-size: 12px;
}

.couple-actions .btn-gold {
  grid-column: 1 / -1;
}

.btn-danger {
  border-color: #8f2320;
  background: linear-gradient(180deg, #ffdede, #f2aeae);
  color: #7d1414;
  box-shadow:
    0 4px 0 #8f2320,
    0 8px 16px rgba(0, 0, 0, 0.22);
}

/* --- 🚪 Карточка «В гости по школе» --- */
.visit-card {
  overflow: hidden;
}

.visit-doodle {
  position: absolute;
  top: 6px;
  right: 16px;
  font-size: 42px;
  opacity: 0.2;
  transform: rotate(-4deg);
  pointer-events: none;
}

/* --- 🚪 Оверлей чужой комнаты (тетрадный лист) --- */
.visit-sheet {
  max-height: min(88vh, 760px);
}

.visit-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.visit-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  border: 1.5px dashed rgba(87, 74, 56, 0.34);
}

.visit-stat span {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.visit-stat b {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--ink);
}

.visit-stat i {
  font-style: normal;
  font-size: 10px;
  line-height: 1.35;
  color: var(--ink-soft);
}

.visit-warning {
  padding: 8px 10px;
  font-size: 11px;
  line-height: 1.45;
  color: #6d3b00;
  background: rgba(255, 214, 145, 0.55);
  border: 1.5px dashed rgba(162, 112, 13, 0.55);
  border-radius: 8px;
}

/* --- 🚪 Кнопки взаимодействия в гостях --- */
.visit-actions {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.visit-action {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
  border-radius: 9px;
  border: 2px solid #b7a67e;
  background: linear-gradient(180deg, #fffdf4, #ecdfc0);
  color: var(--ink);
  box-shadow: 0 3px 0 #b7a67e;
  transition: transform 0.1s ease, box-shadow 0.16s ease;
}

.visit-action:active {
  transform: translateY(3px);
  box-shadow: 0 0 0 #b7a67e;
}

.visit-action:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.35);
}

.visit-action-ico {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  font-size: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.82);
  border: 1.5px dashed rgba(87, 74, 56, 0.3);
}

.visit-action-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.visit-action-body b {
  font-family: var(--font-display);
  font-size: 12.5px;
}

.visit-action-body i {
  font-style: normal;
  font-size: 10.5px;
  color: var(--ink-soft);
}

.visit-action.is-green {
  border-color: #1c7a44;
  background: linear-gradient(180deg, #d7f8dd, #99e3b4);
  box-shadow: 0 3px 0 #166b3b;
}

.visit-action.is-red {
  border-color: #a52a24;
  background: linear-gradient(180deg, #ffe1d8, #f4a99f);
  box-shadow: 0 3px 0 #7d1a16;
}

.visit-action.is-blue {
  border-color: #23508f;
  background: linear-gradient(180deg, #e2ecff, #b3c9f0);
  box-shadow: 0 3px 0 #1a3c6d;
}

.visit-action.is-heart {
  border-color: #b2356b;
  background: linear-gradient(180deg, #ffe6f0, #f3b8d0);
  box-shadow: 0 3px 0 #8d2247;
}

/* 👍 «Бесплатный лайк дня»: яркая золотая наклейка, доступна новичку */
.visit-action.is-free-like {
  border-color: #a2700d;
  background: linear-gradient(180deg, #fff7d6, #ffd766);
  box-shadow: 0 3px 0 #7b5205, 0 0 0 3px rgba(255, 215, 102, 0.28);
}
.visit-action.is-free-like.is-locked {
  border: 2px dashed rgba(122, 83, 48, 0.5);
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink-soft);
  box-shadow: none;
}

.visit-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.55);
  border: 1.5px dashed rgba(162, 112, 13, 0.45);
}

.visit-picker[hidden] {
  display: none;
}

.visit-pick {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
  border-radius: 8px;
  border: 2px solid #b7a67e;
  background: linear-gradient(180deg, #fffdf4, #f3e8cb);
  color: var(--ink);
  box-shadow: 0 2px 0 #b7a67e;
  transition: transform 0.1s ease, box-shadow 0.16s ease;
}

.visit-pick:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 #b7a67e;
}

.visit-pick:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.visit-pick b {
  font-family: var(--font-display);
  font-size: 12px;
}

.visit-pick i {
  font-style: normal;
  font-size: 10px;
  color: var(--ink-soft);
}

.visit-pick.is-brand {
  border-color: #a52a24;
  background: linear-gradient(180deg, #fff1ec, #f7cfc7);
  box-shadow: 0 2px 0 #7d1a16;
}

.visit-balance {
  font-size: 10.5px;
  line-height: 1.4;
  color: var(--ink-soft);
  text-align: center;
}

.visit-foot {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.visit-foot .btn {
  padding: 10px 8px;
  font-size: 12.5px;
}

/* --- 💌 Записка половинке --- */
.note-sheet {
  max-height: min(80vh, 580px);
}

.note-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.note-input {
  width: 100%;
  min-height: 112px;
  padding: 10px 12px;
  resize: none;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background-color: #fffdf3;
  background-image: repeating-linear-gradient(
    0deg,
    transparent 0 27px,
    rgba(84, 124, 168, 0.22) 27px 28px
  );
  border: 2px solid var(--paper-edge);
  border-radius: 8px;
  outline: none;
}

.note-input:focus {
  border-color: #a2700d;
  box-shadow: 0 0 0 3px rgba(162, 112, 13, 0.18);
}

.note-hint {
  font-size: 10.5px;
  line-height: 1.4;
  color: var(--ink-soft);
}

@media (max-width: 360px) {
  .couple-actions {
    grid-template-columns: 1fr;
  }

  .visit-sheet,
  .note-sheet {
    max-height: 90vh;
  }

  .visit-stat b {
    font-size: 12px;
  }

  .visit-action-body b {
    font-size: 11.5px;
  }

  .visit-action-body i {
    font-size: 10px;
  }
}

/* --- 📓 Адаптив дневника и оформления на узких экранах --- */
@media (max-width: 360px) {
  .diary-overlay,
  .register-overlay {
    padding: 8px;
  }

  .diary-days {
    gap: 3px;
  }

  .diary-day {
    padding: 5px 1px 4px;
    font-size: 10px;
  }

  .diary-day-money {
    font-size: 10.5px;
  }

  .combo-grid {
    grid-template-columns: repeat(2, 1fr);
    max-height: 208px;
  }

  .bp-levels {
    grid-template-columns: repeat(5, 1fr);
  }

  .register-sheet {
    padding: 46px 14px 14px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }

  .register-stamp {
    font-size: 17px;
  }
}

/* ===================== ⭐️ ЛАРЁК МАЖОРА: TELEGRAM STARS ===================== */

.stars-item {
  flex-wrap: wrap;
  border-color: rgba(162, 112, 13, 0.5);
  background-image:
    repeating-linear-gradient(0deg, transparent 0 20px, var(--grid-line-soft) 20px 21px),
    linear-gradient(135deg, rgba(255, 201, 74, 0.2), transparent 58%);
}

.stars-item.is-owned,
.stars-item.is-active {
  opacity: 0.78;
}

.stars-price {
  display: inline-block;
  margin: 3px 0 4px;
  padding: 2px 9px;
  border-radius: 999px;
  background: #fff3c4;
  border: 1.5px solid #d9a52a;
  color: #7a5300;
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.stars-buy {
  flex: 1 1 100%;
  margin-top: 2px;
  padding: 10px 12px;
  border-radius: 9px;
  border: 2px solid #a2700d;
  background: linear-gradient(180deg, #fff0b8, #ffc83b);
  color: #4a3000;
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.16s ease, filter 0.16s ease;
  box-shadow:
    0 3px 0 #8a6108,
    0 6px 12px rgba(0, 0, 0, 0.18);
}

.stars-buy:active {
  transform: translateY(3px);
  box-shadow: 0 0 0 #8a6108;
}

.stars-buy:disabled {
  opacity: 0.62;
  cursor: not-allowed;
  filter: grayscale(0.35);
}

/* ===================== 🏆 ДОСКА ПОЧЁТА ===================== */

.board-teaser {
  position: relative;
}

.board-doodle {
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 30px;
  opacity: 0.28;
  transform: rotate(8deg);
  pointer-events: none;
}

body.is-leaderboard-open {
  overflow: hidden;
}

.leaderboard-sheet {
  max-height: 88vh;
}

.leaderboard-tabs {
  margin: 0 16px 8px;
}

.leaderboard-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.leaderboard-me {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1.5px dashed rgba(28, 122, 68, 0.55);
  background: rgba(124, 255, 107, 0.14);
  font-size: 12px;
  color: var(--ink-soft);
}

.leaderboard-me b {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--ink);
}

.leaderboard-top-note {
  font-style: normal;
  font-size: 10px;
  font-weight: 900;
  color: var(--green-ink);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.board-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  border-bottom: 1.5px dashed rgba(87, 74, 56, 0.28);
  background: rgba(255, 255, 255, 0.5);
}

.board-row.is-top {
  border: 1.5px solid rgba(162, 112, 13, 0.5);
  background: linear-gradient(90deg, rgba(255, 201, 74, 0.34), rgba(255, 255, 255, 0.62));
}

.board-row.is-me {
  box-shadow: inset 0 0 0 2px rgba(28, 122, 68, 0.45);
}

.board-medal {
  flex: 0 0 auto;
  width: 34px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 900;
  color: var(--ink-soft);
}

.board-body {
  flex: 1 1 auto;
  min-width: 0;
}

.board-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 900;
  color: var(--ink);
}

.board-score {
  font-size: 11px;
  font-weight: 800;
  color: var(--gold-ink);
}

.board-visit {
  flex: 0 0 auto;
  padding: 7px 9px;
  border-radius: 8px;
  border: 2px solid #23508f;
  background: linear-gradient(180deg, #eaf2ff, #c9dcff);
  color: #163a6e;
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 2px 0 #163a6e;
}

.board-visit:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 #163a6e;
}

.board-self {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  border: 1.5px dashed rgba(28, 122, 68, 0.6);
  color: var(--green-ink);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

 
/* ===================== 📣 ШКОЛЬНЫЙ РУПОР ===================== */

.shoutout-card {
  position: relative;
}

.shoutout-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.shoutout-form[hidden] {
  display: none;
}

.shoutout-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.shoutout-actions .btn {
  flex: 1 1 140px;
}

/* ===================== 👑 БАНДА: ФОРМЫ СОЗДАНИЯ И ВЗНОСА ===================== */

.clan-form-card[hidden] {
  display: none;
}

.clan-form-label {
  display: block;
  margin: 10px 0 4px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  text-transform: uppercase;
}

.clan-input {
  width: 100%;
  padding: 9px 11px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  background-color: #fffdf3;
  background-image: repeating-linear-gradient(
    0deg,
    transparent 0 27px,
    rgba(84, 124, 168, 0.2) 27px 28px
  );
  border: 2px solid var(--paper-edge);
  border-radius: 8px;
  outline: none;
}

.clan-input:focus {
  border-color: #a2700d;
  box-shadow: 0 0 0 3px rgba(162, 112, 13, 0.18);
}

.clan-form-hint {
  margin: 6px 0 2px;
  font-size: 10.5px;
  line-height: 1.4;
  color: var(--ink-soft);
}

.clan-form-presets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 10px 0 2px;
}

.clan-preset {
  padding: 8px 4px;
  border-radius: 8px;
  border: 2px solid #7d6a45;
  background: linear-gradient(180deg, #fff8dd, #e9dcb4);
  color: #4a3a1c;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 2px 0 #7d6a45;
}

.clan-preset:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 #7d6a45;
}

/* 📢 B2B/creator-канал банды: кликабельный бейдж @channel */
.clan-channel-badge {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 2px solid #2b5f8e;
  background: linear-gradient(180deg, #e8f4ff, #b9dcf7);
  color: #123a5c;
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 900;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 2px 0 #2b5f8e;
  transition: transform 0.1s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.clan-channel-badge:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 #2b5f8e;
}

.clan-choice-channel {
  margin-top: 3px;
  font-size: 10.5px;
  padding: 4px 9px;
}

.clan-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.clan-form-actions .btn {
  flex: 1 1 140px;
}

@media (max-width: 360px) {
  .leaderboard-sheet {
    max-height: 91vh;
  }

  .board-row {
    gap: 7px;
    padding: 7px 8px;
  }

  .board-medal {
    width: 26px;
    font-size: 13px;
  }

  .board-visit {
    padding: 6px 7px;
    font-size: 10.5px;
  }

  .clan-form-presets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stars-buy {
    font-size: 11.5px;
  }
}

/* 4 под-вкладки ларька: подписи не должны разрываться на узких экранах */
#shop-tabs .seg-btn {
  padding: 9px 3px;
  font-size: 11px;
  line-height: 1.2;
}

@media (max-width: 360px) {
  #shop-tabs .seg-btn {
    padding: 8px 1px;
    font-size: 10.5px;
  }
}

/* ===================== 📱 SAFE-AREA: НАТИВНЫЕ ОТСТУПЫ TMA =====================
   Оверлеи-«тетрадные листы» не должны упираться в «Home indicator» iPhone:
   добавляем системный отступ снизу (env() = 0 на Android/ПК — без изменений). */
.wardrobe-sheet,
.visit-sheet,
.note-sheet,
.diary-sheet {
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
}

/* ===================== 🤝 РЕЙДЫ КОРЕШЕЙ (КООП ИЗ MINI APP) ===================== */
#friend-raids-card[hidden],
#prestige-card[hidden] {
  display: none;
}
.friend-raid-card {
  margin-top: 10px;
}
.friend-raid-card .hp-bar {
  margin: 10px 0 6px;
}
.boss-attack-btn.is-assist {
  background: linear-gradient(180deg, #dff7cf, #8fdc73);
  color: #1e3d10;
}
.boss-attack-btn.is-assist:active {
  transform: translateY(3px);
  box-shadow: 0 0 0 transparent;
}

/* ===================== 🏅 ПАЦАНСКИЙ ПОЧЕТ (ЭНДГЕЙМ-ФЛЕКС) ===================== */
.prestige-card .card-head h3 {
  letter-spacing: 0.3px;
}
.prestige-title {
  margin: 8px 0 4px;
  font-weight: 800;
  font-size: 17px;
  color: var(--ink, #241f18);
}
.prestige-card .btn-gold {
  margin-top: 10px;
}
.board-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border: 1.5px solid #b8860b;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff3cf, #ffd766);
  font-size: 10px;
  font-weight: 800;
  color: #5c3a00;
  vertical-align: middle;
  white-space: nowrap;
}
.board-row.is-me .board-badge {
  border-color: #7a5330;
}

@media (max-width: 360px) {
  .prestige-title {
    font-size: 15px;
  }
  .board-badge {
    display: block;
    margin: 3px 0 0;
    width: fit-content;
  }
}

/* ===================== 🤝 РЕФЕРАЛКА И 🔍 ПОИСК СОСЕДА ===================== */
.visit-search-row {
  display: flex;
  gap: 8px;
  margin: 8px 0;
}
.visit-nick-input {
  flex: 1 1 auto;
  min-width: 0;
}
.visit-nick-btn {
  flex: 0 0 auto;
  width: auto;
  padding: 9px 14px;
}
.ref-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
#duel-share-chat-btn {
  margin-top: 8px;
}
@media (max-width: 360px) {
  .ref-actions {
    grid-template-columns: 1fr;
  }
}

/* 🤝 Список приглашённых корешей: статус и ⭐️ Premium */
.ref-friends-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1.5px dashed rgba(87, 74, 56, 0.32);
}
.ref-friends-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ref-friends-title {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.ref-friends-count {
  padding: 1px 8px;
  border: 1.5px solid #b8860b;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff3cf, #ffd766);
  font-size: 10px;
  font-weight: 800;
  color: #5c3a00;
}
.ref-friends {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 190px;
  overflow-y: auto;
}
.ref-empty {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--ink-soft);
}
.ref-friend {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 9px;
  border-radius: 8px;
  border: 1.5px solid rgba(87, 74, 56, 0.28);
  background: rgba(255, 255, 255, 0.62);
}
.ref-friend.is-active {
  border-color: #1c7a44;
  background: linear-gradient(180deg, #e6fbe9, #c7f0d4);
}
.ref-friend-top {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.ref-friend-nick {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
}
.ref-premium {
  flex: 0 0 auto;
  padding: 0 6px;
  border: 1.5px solid #b8860b;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff6d8, #ffd766);
  font-size: 9px;
  font-weight: 800;
  color: #5c3a00;
  white-space: nowrap;
}
.ref-friend-respect {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 800;
  color: var(--ink-soft);
}
.ref-friend-status {
  font-size: 10px;
  line-height: 1.4;
  color: var(--ink-soft);
}
.ref-friend.is-active .ref-friend-status {
  color: #14612f;
  font-weight: 700;
}
@media (max-width: 360px) {
  .ref-friends {
    max-height: 160px;
  }
  .ref-friend-nick {
    font-size: 11.5px;
  }
}

/* ===================== 🧑‍🎓 КУКЛА ХОЗЯИНА В ГОСТЯХ ===================== */
.visit-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 10px;
  border: 1.5px dashed rgba(87, 74, 56, 0.35);
  background: rgba(255, 255, 255, 0.58);
}
.visit-avatar-figure {
  width: 78px;
  height: 98px;
  flex: 0 0 auto;
}
.visit-avatar-figure .student-svg {
  width: 72px;
  height: 90px;
}
.visit-hero-wardrobe {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.visit-hero-title {
  font-size: 10.5px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}
.visit-hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.avatar-chip.is-mythic-chip {
  border-color: #d9a52a;
  background: linear-gradient(180deg, #fff6cf, #ffd766);
  color: #5a3d00;
}

/* ===================== ✨ КАСТОМ ШМОТА В ГАРДЕРОБЕ (+1..+5) ===================== */
.wardrobe-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  flex: 0 0 auto;
}
.wardrobe-upg-badge {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff0b8, #f3c65a);
  border: 1px solid #a2700d;
  color: #4a3000;
  font-size: 10px;
  font-weight: 900;
  vertical-align: middle;
}
.wardrobe-upgrade {
  padding: 6px 8px;
  border-radius: 7px;
  border: 1.5px solid #a2700d;
  background: linear-gradient(180deg, #fff4cc, #f4ca64);
  color: #4a3000;
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 2px 0 #8a6108;
}
.wardrobe-upgrade:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 #8a6108;
}
.wardrobe-upgrade:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.wardrobe-max-tag {
  font-size: 10.5px;
  font-weight: 900;
  text-align: center;
  color: var(--gold-ink);
}

/* ===================== 🧑‍🎓 КУКЛА: НАДЕТЫЙ ШМОТ ЗАМЕНЯЕТ БАЗОВЫЕ СЛОИ ===================== */
/* Базовый синий пиджак/штаны/кеды были непрозрачными и торчали из-под шмота —
   пока на фигуре стоит has-*, соответствующая часть базового тела скрыта. */
.hero-avatar-figure.has-jacket .student-jacket,
.hero-avatar-figure.has-jacket .student-arm,
.hero-avatar-figure.has-jacket .student-shirt,
.hero-avatar-figure.has-pants .student-leg,
.hero-avatar-figure.has-shoes .student-shoe {
  display: none;
}

/* Дымок вейпа: мягко поднимается и тает */
.vape-smoke {
  opacity: 0;
  animation: vape-puff 2.6s ease-out infinite;
}

/* ===================== 📨 PVP-ВЫЗОВ, 📸 STORIES И ДИПЛИНКИ ===================== */

/* 📸 Кнопка «Поделиться в Сторис» — тихая, но заметная */
.share-btn {
  margin-top: 8px;
  border-style: dashed !important;
  font-size: 12.5px;
  letter-spacing: 0.02em;
}
.share-btn:active {
  transform: translateY(2px);
}

/* 🤝 Бейдж «откуда кореш» в карточке рейда */
.tag-relation {
  background: rgba(124, 255, 107, 0.18);
  color: var(--ink);
  border: 1px solid rgba(36, 31, 24, 0.22);
  font-weight: 900;
}

/* 🥊 Подсветка рейда, к которому позвали ссылкой raid_<owner_id> */
.friend-raid-card.is-highlight {
  border-color: var(--gold);
  box-shadow:
    0 0 0 3px rgba(255, 201, 74, 0.45),
    0 8px 0 rgba(0, 0, 0, 0.18);
  animation: raid-highlight 1.4s ease-in-out 2;
}
@keyframes raid-highlight {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

/* 📨 Ссылка-вызов на живую PvP-дуэль в лобби */
.duel-challenge-box {
  margin-top: 10px;
  padding: 10px;
  border-radius: 8px;
  border: 2px dashed rgba(36, 31, 24, 0.35);
  background: rgba(255, 201, 74, 0.14);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.duel-challenge-box[hidden] {
  display: none !important;
}
.duel-challenge-link {
  display: block;
  padding: 7px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(36, 31, 24, 0.2);
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--ink-soft);
  word-break: break-all;
}
.duel-challenge-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* ⏳ Экран ожидания создателя: вызов ушёл, ждём принятия друга */
.duel-challenge-box.is-waiting {
  border-style: solid;
  border-color: rgba(124, 255, 107, 0.55);
  background: rgba(124, 255, 107, 0.16);
  box-shadow: 0 0 0 2px rgba(124, 255, 107, 0.16) inset;
}
.duel-wait-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-display);
  font-size: 13.5px;
  color: var(--ink);
}
.duel-wait-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #3fbf4a;
  box-shadow: 0 0 0 0 rgba(63, 191, 74, 0.55);
  animation: duel-wait-pulse 1.4s ease-out infinite;
}
@keyframes duel-wait-pulse {
  0% { box-shadow: 0 0 0 0 rgba(63, 191, 74, 0.55); }
  70% { box-shadow: 0 0 0 9px rgba(63, 191, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(63, 191, 74, 0); }
}
.duel-challenge-cancel {
  width: 100%;
}
.duel-wait-hint {
  margin: 0;
  text-align: center;
}

/* ⚔️ Экран принятия вызова (тетрадный лист поверх игры) */
body.is-challenge-open {
  overflow: hidden;
}
.challenge-overlay {
  position: fixed;
  inset: 0;
  z-index: 88;
  display: none;
  place-items: center;
  padding: 14px;
}
.challenge-overlay.is-open {
  display: grid;
}
.challenge-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 30%, rgba(44, 28, 12, 0.66), rgba(12, 7, 3, 0.93));
  backdrop-filter: blur(3px);
}
.challenge-sheet {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  max-height: min(86vh, 700px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(0deg, transparent 0 21px, var(--grid-line) 21px 22px),
    repeating-linear-gradient(90deg, transparent 0 21px, var(--grid-line-soft) 21px 22px);
  border: 2px solid var(--paper-edge);
  border-radius: 8px;
  box-shadow:
    0 10px 0 rgba(0, 0, 0, 0.24),
    0 22px 44px rgba(0, 0, 0, 0.55);
  animation: loot-in 0.3s ease both;
}
.challenge-sheet::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 22px;
  width: 2px;
  background: linear-gradient(
    180deg,
    transparent,
    var(--margin-line) 5%,
    var(--margin-line) 95%,
    transparent
  );
  pointer-events: none;
}
.challenge-body {
  padding: 14px 18px calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}
.challenge-vs {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  text-align: center;
}
.challenge-side {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 15px;
  font-weight: 900;
}
.challenge-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}
.challenge-vs-badge {
  padding: 5px 9px;
  border-radius: 50%;
  border: 2px solid var(--stamp, #b0342c);
  color: var(--stamp, #b0342c);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 900;
  transform: rotate(-8deg);
}
.challenge-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.challenge-stat {
  padding: 7px 9px;
  border-radius: 7px;
  border: 1.5px solid rgba(36, 31, 24, 0.18);
  background: rgba(255, 255, 255, 0.5);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.challenge-stat span {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
}
.challenge-stat b {
  font-family: var(--font-display);
  font-size: 15px;
}

@media (max-width: 360px) {
  .duel-challenge-actions {
    grid-template-columns: 1fr;
  }
  .challenge-stats {
    grid-template-columns: 1fr;
  }
  .challenge-side {
    font-size: 13px;
  }
}


.vape-smoke.is-late {
  animation-delay: 1.1s;
}

@keyframes vape-puff {
  0% {
    opacity: 0;
    transform: translateY(5px);
  }
  30% {
    opacity: 0.85;
  }
  100% {
    opacity: 0;
    transform: translateY(-9px);
  }
}

/* ===================== 🥊 СЦЕНА ПОЕДИНКА: КУКЛЫ БОЙЦОВ ===================== */
.duel-clash-stage {
  flex: 0 1 auto;
  min-height: 0;
  height: clamp(110px, 20vh, 130px);
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  padding: 0 6px;
  overflow: visible;
}

/* Меловая линия пола под бойцами */
.duel-clash-stage::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 3px;
  height: 0;
  border-bottom: 2px dashed rgba(244, 241, 230, 0.35);
  pointer-events: none;
}

.duel-fighter-sprite {
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  --lunge-dir: 1;
  will-change: transform;
}

.duel-fighter-sprite.is-me {
  --lunge-dir: -1;
}

/* Внутри сцены кукла — без рамки тетради, подгоняется по высоте */
.duel-fighter-sprite .hero-avatar-figure {
  width: auto;
  height: 100%;
  aspect-ratio: 120 / 150;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
  transform: none;
}

.duel-fighter-sprite .student-svg {
  width: auto;
  height: 100%;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.45));
}

/* Соперник развёрнут лицом к игроку */
.duel-fighter-sprite.is-opp .hero-avatar-figure {
  transform: scaleX(-1);
}

.duel-vs-badge {
  flex: 0 0 auto;
  align-self: center;
  padding: 2px 8px;
  color: #f4f1e6;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.55);
  border: 2px dashed rgba(244, 241, 230, 0.55);
  border-radius: 10px;
  transform: rotate(-6deg);
}

/* Выпад при атаке и тряска при получении урона */
.duel-fighter-sprite.is-lunge {
  animation: fighter-lunge 0.46s ease;
}

.duel-fighter-sprite.is-hit {
  animation: fighter-hurt 0.56s ease;
}

.duel-fighter-sprite.is-hit .student-svg {
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.45)) drop-shadow(0 0 6px rgba(255, 70, 50, 0.85));
}

@keyframes fighter-lunge {
  0%,
  100% {
    transform: translateX(0) scale(1);
  }
  35% {
    transform: translateX(calc(var(--lunge-dir) * 16px)) scale(1.08);
  }
  60% {
    transform: translateX(calc(var(--lunge-dir) * 10px)) scale(1.04);
  }
}

@keyframes fighter-hurt {
  0%,
  100% {
    transform: translateX(0) rotate(0deg);
  }
  15% {
    transform: translateX(calc(var(--lunge-dir) * -9px)) rotate(calc(var(--lunge-dir) * -6deg));
  }
  35% {
    transform: translateX(calc(var(--lunge-dir) * 6px)) rotate(calc(var(--lunge-dir) * 4deg));
  }
  55% {
    transform: translateX(calc(var(--lunge-dir) * -4px)) rotate(calc(var(--lunge-dir) * -2deg));
  }
  75% {
    transform: translateX(calc(var(--lunge-dir) * 2px));
  }
}

@media (max-height: 700px) {
  .duel-clash-stage {
    height: clamp(86px, 16vh, 110px);
  }

  .duel-vs-badge {
    font-size: 15px;
  }
}

@media (max-height: 580px) {
  .duel-clash-stage {
    height: 72px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .vape-smoke,
  .duel-fighter-sprite.is-lunge,
  .duel-fighter-sprite.is-hit {
    animation: none;
  }
}


/* ===================== БОЕВАЯ АРЕНА: СЦЕНА, ЛОГ И ПРИЁМЫ (ФИКСИРОВАННЫЙ ПОРЯДОК) ===================== */
.duel-stage-box {
  position: relative;
  z-index: 5;
  /* Сцена бойцов НИКОГДА не сжимается — иначе спрайты вылезают под лог */
  flex: 0 0 auto;
  height: 120px;
  min-height: 120px;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  padding: 0 16px 8px;
  background: radial-gradient(ellipse at 50% 90%, rgba(255, 230, 160, 0.22), transparent 70%);
  border-bottom: 2px dashed rgba(255, 214, 160, 0.25);
}

.duel-fighter-sprite {
  width: 80px;
  height: 106px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transition: transform 0.15s ease;
}

.duel-fighter-sprite.is-opp {
  transform: scaleX(-1);
}

/* Кукла уже развёрнута на уровне спрайта — внутренний SVG не переворачиваем */
.duel-fighter-sprite.is-opp .hero-avatar-figure {
  transform: none;
}

.duel-fighter-sprite .student-svg {
  width: 76px;
  height: 98px;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5));
}

.duel-vs-circle {
  align-self: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #a22222;
  border: 2px solid #ffce7a;
  color: #fff;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 900;
  display: grid;
  place-items: center;
  box-shadow: 0 0 10px rgba(255, 100, 100, 0.5);
}

.duel-log-box {
  position: relative;
  z-index: 2;
  /* Сжимается только лог (а не сцена), и физически лежит ПОД бойцами */
  flex: 0 1 auto;
  min-height: 0;
  margin-top: 4px;
  background: rgba(248, 242, 224, 0.95);
  border: 1px dashed #b7a67e;
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--ink);
  max-height: 72px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.duel-log-box .duel-round-line {
  font-size: 10.5px;
  line-height: 1.2;
  color: #7a5330;
  text-shadow: none;
}

.duel-log-content {
  font-size: 11px;
  line-height: 1.35;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  max-height: 52px;
  color: var(--ink-soft);
}

.duel-controls-box {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.duel-controls-box .duel-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.duel-controls-box .card-btn {
  padding: 8px 4px;
  border-radius: 8px;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

/* Перебиваем старые правила арены с id-специфичностью (сетка 2×2 и крупные кнопки) */
#duel-arena-screen .duel-controls-box .duel-cards {
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

#duel-arena-screen .duel-controls-box .card-btn {
  min-height: 0;
  padding: 8px 4px;
  border-radius: 8px;
  gap: 2px;
  box-shadow:
    0 3px 0 #b7a67e,
    0 6px 10px rgba(0, 0, 0, 0.2);
}

#duel-arena-screen .duel-controls-box .card-btn-ico {
  font-size: 18px;
}

#duel-arena-screen .duel-controls-box .card-btn-name {
  font-size: 11px;
}

/* Подсказки приёмов НЕ прячем на обычных экранах — они объясняют треугольник */
#duel-arena-screen .duel-controls-box .card-btn-hint {
  display: block;
  font-size: 10px;
  line-height: 1.15;
  margin-top: 1px;
  color: var(--ink-faint);
}

.duel-surrender-btn {
  width: 100%;
  padding: 6px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: #d8c2a4;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.duel-surrender-btn:active {
  transform: translateY(1px);
}

.duel-surrender-btn[disabled] {
  opacity: 0.45;
  cursor: default;
}

@media (max-height: 700px) {
  .duel-stage-box {
    height: 100px;
    min-height: 100px;
    padding-bottom: 6px;
  }

  .duel-fighter-sprite {
    width: 66px;
    height: 88px;
  }

  .duel-fighter-sprite .student-svg {
    width: 64px;
    height: 82px;
  }

  .duel-log-box {
    max-height: 64px;
  }

  .duel-log-content {
    max-height: 44px;
  }

  /* На низких экранах арена борется за каждый пиксель — подсказки скрываем */
  #duel-arena-screen .duel-controls-box .card-btn-hint {
    display: none;
  }
}

@media (max-height: 580px) {
  .duel-stage-box {
    height: 78px;
    min-height: 78px;
    padding-bottom: 4px;
  }

  .duel-fighter-sprite {
    width: 54px;
    height: 70px;
  }

  .duel-fighter-sprite .student-svg {
    width: 52px;
    height: 66px;
  }

  .duel-vs-circle {
    width: 26px;
    height: 26px;
    font-size: 11px;
  }

  .duel-log-box {
    max-height: 56px;
  }

  .duel-log-content {
    max-height: 36px;
  }

  #duel-arena-screen .duel-controls-box .card-btn {
    padding: 6px 3px;
  }
}

/* Направления выпадов: игрок слева, соперник справа (и зеркален) — флип не теряется в анимации */
.duel-fighter-sprite {
  --flip: 1;
}

.duel-fighter-sprite.is-opp {
  --flip: -1;
}

@keyframes fighter-lunge {
  0%,
  100% {
    transform: scaleX(var(--flip, 1)) translateX(0) scale(1);
  }
  35% {
    transform: scaleX(var(--flip, 1)) translateX(16px) scale(1.08);
  }
  60% {
    transform: scaleX(var(--flip, 1)) translateX(10px) scale(1.04);
  }
}

@keyframes fighter-hurt {
  0%,
  100% {
    transform: scaleX(var(--flip, 1)) translateX(0) rotate(0deg);
  }
  15% {
    transform: scaleX(var(--flip, 1)) translateX(-9px) rotate(-6deg);
  }
  35% {
    transform: scaleX(var(--flip, 1)) translateX(6px) rotate(4deg);
  }
  55% {
    transform: scaleX(var(--flip, 1)) translateX(-4px) rotate(-2deg);
  }
  75% {
    transform: scaleX(var(--flip, 1)) translateX(2px);
  }
}

/* ===================== 📱 НАТИВНАЯ MAINBUTTON: НЕ ДУБЛИРУЕМ КНОПКИ =====================
   Когда Telegram MainButton реально активна (текстовая форма открыта),
   HTML-кнопку подтверждения прячем — нативная кнопка уже поднята над
   экранной клавиатурой. Как только форма/оверлей закрывается, класс
   body.has-main-button снимается и HTML-кнопка возвращается на место. */
body.has-main-button .register-submit,
body.has-main-button #note-send,
body.has-main-button #shoutout-submit,
body.has-main-button #clan-create-submit,
body.has-main-button #clan-deposit-submit {
  display: none;
}

/* ===================== 🏠 ХАТА: ИЕРАРХИЯ И БЫСТРЫЕ ПЛИТКИ =====================
   Наверху только персонаж и «Общак». Всё второстепенное (шкаф, дневник, гости,
   доска почёта, кореши, обстановка комнаты) живёт в компактной сетке плиток —
   экран больше не растягивается на несколько прокруток ради мелких карточек. */

/* Кукла и слоты шмота — прямой вход в гардероб */
.hero-avatar-figure.is-tappable,
.avatar-slots.is-tappable {
  cursor: pointer;
}

.hero-avatar-figure.is-tappable:active {
  transform: scale(0.97);
}

.avatar-slots.is-tappable:active .avatar-slot {
  border-color: rgba(162, 112, 13, 0.55);
}

/* 💰 Общак — акцентная карточка с подсветкой, когда накопилась заметная сумма */
.income-card {
  border-color: rgba(35, 80, 143, 0.35);
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.income-card.is-rich {
  border-color: rgba(28, 122, 68, 0.65);
  box-shadow:
    0 4px 0 rgba(28, 122, 68, 0.32),
    0 14px 26px rgba(0, 0, 0, 0.36),
    0 0 0 3px rgba(124, 255, 107, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.income-card.is-rich .income-value {
  color: var(--green-ink);
}

/* 🧹 Уборка: карточка появляется только при mess_level > 0 (иначе [hidden]) */
.clean-card {
  border-color: rgba(184, 48, 44, 0.45);
  background-color: #fbeade;
}

/* 🏠 Сетка быстрых плиток: 2 колонки, 3 ряда */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.quick-tile {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  min-height: 62px;
  text-align: left;
  font-family: inherit;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(0deg, transparent 0 21px, var(--grid-line) 21px 22px),
    repeating-linear-gradient(90deg, transparent 0 21px, var(--grid-line-soft) 21px 22px);
  border: 1.5px solid var(--paper-edge);
  border-radius: 9px;
  box-shadow:
    0 3px 0 rgba(0, 0, 0, 0.16),
    0 8px 16px rgba(0, 0, 0, 0.26);
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.quick-tile:active {
  transform: translateY(3px);
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.18),
    0 4px 10px rgba(0, 0, 0, 0.24);
}

.quick-ico {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  font-size: 17px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(87, 74, 56, 0.22);
}

.quick-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 20px;
}

.quick-title {
  font-size: 12.5px;
  font-weight: 900;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-status {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 1px 6px;
  font-size: 9.5px;
  font-weight: 900;
  color: #fff8e2;
  background: linear-gradient(180deg, #a2700d, #7b5205);
  border-radius: 5px;
  border: 1px solid rgba(0, 0, 0, 0.28);
}

.quick-badge.is-gold {
  color: #553800;
  background: linear-gradient(180deg, #ffeaa8, #f3c65a);
}

/* Красный бейдж: сегодня есть что забрать (подгон / награды сезона) */
.quick-badge.is-alert {
  color: #fff4ef;
  background: linear-gradient(180deg, #e2574f, #a52a24);
  box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.32);
}

/* Разворачиваемые блоки под сеткой: поиск соседа, рефералка, обстановка */
.quick-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background-color: var(--paper-2);
  background-image:
    repeating-linear-gradient(0deg, transparent 0 21px, var(--grid-line) 21px 22px),
    repeating-linear-gradient(90deg, transparent 0 21px, var(--grid-line-soft) 21px 22px);
  border: 1.5px dashed rgba(87, 74, 56, 0.4);
  border-radius: 9px;
}

/* 🏅 «Пацанский почет» по умолчанию — одна компактная строка */
.prestige-card.is-compact {
  gap: 4px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.prestige-card.is-compact .prestige-desc {
  display: none;
}

.prestige-card.is-compact .prestige-title {
  margin: 2px 0 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
}

.prestige-card.is-compact .btn-gold {
  padding: 8px 12px;
  font-size: 12.5px;
}

@media (max-width: 360px) {
  .quick-grid {
    gap: 7px;
  }

  .quick-tile {
    padding: 9px 8px;
    min-height: 58px;
    gap: 6px;
  }

  .quick-ico {
    width: 26px;
    height: 26px;
    font-size: 15px;
  }

  .quick-title {
    font-size: 11.5px;
  }

  .quick-status {
    font-size: 9.5px;
  }

  .prestige-card.is-compact .btn-gold {
    font-size: 11.5px;
  }
}

/* ===================== 🔔 «ПОКА ТЕБЯ НЕ БЫЛО» ===================== */

.alerts-banner {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 12px;
  padding: 12px 14px 12px 18px;
  position: relative;
  border-radius: 14px;
  background: linear-gradient(180deg, #fff3d8, #ffe6b8);
  border: 2px solid #d9a441;
  box-shadow: 0 6px 14px rgba(60, 36, 10, 0.18);
  color: var(--ink);
}

.alerts-banner[hidden] {
  display: none;
}

.alerts-banner::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 3px;
  background: #e0574a;
}

.alerts-banner-main {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.alerts-banner-ico {
  font-size: 20px;
  line-height: 1;
}

.alerts-banner-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.alerts-banner-title {
  font-size: 13.5px;
  color: #7a3415;
}

.alerts-banner-note {
  font-size: 12px;
  color: var(--ink-soft);
}

.alerts-banner-actions {
  display: flex;
  gap: 8px;
}

.alerts-banner-actions .btn {
  flex: 1 1 0;
  padding: 8px 10px;
  font-size: 12px;
}

.alerts-dismiss {
  flex: 0 0 auto;
}

@media (max-width: 360px) {
  .alerts-banner-actions {
    flex-direction: column;
  }
}

/* ===================== ✨ СЕТЫ В ГАРДЕРОБЕ ===================== */

.wardrobe-sets {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 16px 4px;
}

.wardrobe-sets[hidden] {
  display: none;
}

.wardrobe-sets-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.wardrobe-set {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(36, 31, 24, 0.045);
  border: 1px dashed rgba(36, 31, 24, 0.22);
}

.wardrobe-set.is-active {
  background: linear-gradient(180deg, #eef9dd, #dbf0bd);
  border: 1px solid #8cc055;
  box-shadow: 0 2px 6px rgba(80, 120, 40, 0.18);
}

.wardrobe-set-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.wardrobe-set-name {
  font-weight: 700;
  color: var(--ink);
}

.wardrobe-set-count {
  font-variant-numeric: tabular-nums;
  color: #7a6a52;
}

.wardrobe-set.is-active .wardrobe-set-count {
  color: #37651f;
}

.wardrobe-set-bar {
  margin: 6px 0 4px;
  height: 6px;
  border-radius: 4px;
  background: rgba(36, 31, 24, 0.12);
  overflow: hidden;
}

.wardrobe-set-bar span {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #c9b27a, #8cc055);
  transition: width 0.25s ease;
}

.wardrobe-set-desc {
  font-size: 11px;
  color: var(--ink-soft);
}

/* ===================== 🏅 КЛАСС НЕДЕЛИ ===================== */

.leaderboard-hint {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, #fff6de, #ffe9b8);
  border: 1px solid #e0b45a;
  font-size: 12.5px;
  color: #6b4416;
}

.leaderboard-hint .muted {
  font-size: 10.5px;
  color: #8a6a3c;
}

/* ===================== 🗓 НЕДЕЛЬНЫЕ МИССИИ ===================== */

.diary-weekly .diary-block-head .tag {
  background: linear-gradient(180deg, #e9f0ff, #c9d9f7);
  color: #2b4d86;
}

/* ===================== ⭐️ МИКРО-ПОКУПКИ STARS В ТОЧКАХ БОЛИ ===================== */

/* Кнопки «Откуп от завуча», «Связка петард», «Срочный клининг» — золотые
   «таблетки» ровно там, где у игрока болит (перемена / нет петард / завал). */
.stars-shortcut {
  margin-top: 8px;
  border-color: #d9a63a;
  background: linear-gradient(180deg, #fff3c4, #f6cf6b);
  color: #4a3106;
  box-shadow: 0 6px 14px rgba(160, 110, 20, 0.22);
}

.stars-shortcut[hidden] {
  display: none !important;
}

.stars-shortcut:active {
  transform: translateY(1px) scale(0.99);
}

/* 💎 VIP = золотое оформление статуса: тёплая золотая рамка карточки персонажа */
#hero-card.is-vip {
  border-color: #d9a63a;
  box-shadow:
    0 0 0 1px rgba(217, 166, 58, 0.55),
    0 12px 26px rgba(60, 40, 10, 0.28),
    inset 0 1px 0 rgba(255, 240, 190, 0.6);
}

#hero-card.is-vip .hero-nick-row .hero-nick::after {
  content: " 💎";
}

/* ==========================================================================
   📺 REWARDED VIDEO (ADSGRAM): кнопки «Бесплатно за просмотр»
   Реклама — необязательный слой: если блок не подключён, все элементы
   скрыты атрибутом `hidden` (и это правило гарантирует display:none,
   потому что у `.btn` задан свой display).
   ========================================================================== */

.ad-btn[hidden],
.ad-card[hidden] {
  display: none !important;
}

.ad-card {
  border-color: rgba(217, 166, 58, 0.75);
  background:
    linear-gradient(180deg, rgba(255, 214, 120, 0.22), rgba(248, 242, 224, 0.96));
}

.ad-card .card-head h3 {
  color: #6b4a13;
}

/* Кнопка ролика: золотая наклейка с «телевизором», читается на тетрадном листе */
.btn.ad-btn {
  position: relative;
  background: linear-gradient(180deg, #ffd977, #e9b13f);
  color: #3a2708;
  border: 1px solid #b98620;
  box-shadow:
    0 2px 0 #a8761a,
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
  font-weight: 700;
  letter-spacing: 0.1px;
}

.btn.ad-btn::after {
  content: "AD";
  position: absolute;
  top: -7px;
  right: -6px;
  padding: 1px 4px;
  border-radius: 6px;
  background: #241f18;
  color: #ffd977;
  font-size: 8px;
  line-height: 1.3;
  letter-spacing: 0.4px;
}

.btn.ad-btn:active {
  transform: translateY(1px);
  box-shadow:
    0 1px 0 #a8761a,
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.btn.ad-btn:disabled {
  filter: grayscale(0.35) brightness(0.96);
  opacity: 0.75;
}

.combo-actions .ad-btn {
  width: 100%;
}

/* ===================== 🎡 ШКОЛЬНАЯ РУЛЕТКА ===================== */
/* Тетрадный лист + колесо из 8 секторов: дуги рисует conic-gradient по
   весам с сервера, эмодзи-подписи стоят на центрах дуг, указатель сверху.
   Остановка колеса — CSS-transition 1.5 сек (класс .is-spinning).
   📱 Вся рулетка обязана влезать в один экран БЕЗ прокрутки: колесо сжато
   по vh/vw, призы — компактная сетка 2×4, кнопка «КРУТИТЬ!» есть и в центре
   колеса, и сразу под ним. */

body.is-roulette-open {
  overflow: hidden;
}

.roulette-sheet {
  gap: 6px;
  max-height: min(94vh, 100%);
  overflow: hidden;
}

/* Голова и подвал рулетки компактнее гардероба: экран не должен прокручиваться */
.roulette-sheet .wardrobe-head {
  padding: 12px 12px 8px 30px;
}

.roulette-sheet .wardrobe-foot {
  padding: 6px 12px calc(8px + env(safe-area-inset-bottom, 0px));
}

.roulette-body {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 7px;
  padding: 6px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  min-height: 0;
  overflow: hidden;
}

.roulette-stage {
  position: relative;
  /* Колесо ужимается и по ширине, и по высоте экрана (узкие/низкие модели) */
  width: min(62vw, 33vh, 232px);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.roulette-wheel {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 6px solid #5a3d28;
  background: #efe2b8;
  overflow: hidden;
  box-shadow:
    inset 0 0 0 3px rgba(248, 242, 224, 0.85),
    inset 0 0 22px rgba(36, 31, 24, 0.32),
    0 10px 18px rgba(20, 14, 8, 0.35);
  transition: transform 1.5s cubic-bezier(0.15, 0.85, 0.1, 1);
}

.roulette-wheel::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(0deg, rgba(36, 31, 24, 0.07) 0 1px, transparent 1px 14px),
    repeating-linear-gradient(90deg, rgba(36, 31, 24, 0.07) 0 1px, transparent 1px 14px);
}

.roulette-wheel.is-spinning {
  will-change: transform;
}

.roulette-slice-label {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  transform-origin: 50% 50%;
  pointer-events: none;
}

.roulette-slice-label b {
  margin-top: 7.5%;
  height: 22px;
  font-size: 19px;
  line-height: 1;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.55));
  transition: transform 0.25s ease, filter 0.25s ease;
}

.roulette-slice-label.is-win b {
  transform: scale(1.4);
  filter: drop-shadow(0 0 7px rgba(255, 201, 74, 0.95));
}

.roulette-hub {
  position: relative;
  z-index: 2;
  width: 42%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 0;
  background: radial-gradient(circle at 35% 30%, #fff6d8, #e6cf94);
  border: 3px solid #5a3d28;
  box-shadow:
    0 4px 10px rgba(20, 14, 8, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
  color: var(--ink);
  font-family: inherit;
  font-weight: 900;
  letter-spacing: 0.3px;
  line-height: 1.05;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  animation: roulette-hub-pulse 2.2s ease-in-out infinite;
}

.roulette-hub-ico {
  font-size: 15px;
  line-height: 1;
}

.roulette-hub-text {
  font-size: 10.5px;
  white-space: nowrap;
}

.roulette-hub:active {
  transform: scale(0.95);
}

.roulette-hub:disabled {
  cursor: default;
  animation: none;
  filter: grayscale(0.45) brightness(0.97);
  opacity: 0.82;
}

@keyframes roulette-hub-pulse {
  0%,
  100% {
    box-shadow:
      0 4px 10px rgba(20, 14, 8, 0.4),
      inset 0 1px 0 rgba(255, 255, 255, 0.85);
  }

  50% {
    box-shadow:
      0 4px 10px rgba(20, 14, 8, 0.4),
      0 0 14px rgba(255, 201, 74, 0.85),
      inset 0 1px 0 rgba(255, 255, 255, 0.95);
  }
}

.roulette-pointer {
  position: absolute;
  top: -6px;
  left: 50%;
  z-index: 3;
  transform: translateX(-50%);
  font-size: 20px;
  line-height: 1;
  color: #b3261e;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.55);
}

.roulette-result {
  min-height: 30px;
  padding: 5px 9px;
  border-radius: 10px;
  border: 1px dashed rgba(36, 31, 24, 0.25);
  background: rgba(36, 31, 24, 0.05);
  text-align: center;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-soft);
}

.roulette-result.is-win {
  color: #1f5c2a;
  border-color: rgba(31, 92, 42, 0.55);
  background: rgba(124, 255, 107, 0.18);
}

.roulette-result.is-spinning {
  color: #7a5a10;
  border-color: rgba(255, 201, 74, 0.8);
  background: rgba(255, 201, 74, 0.18);
}

.roulette-ticket-note {
  text-align: center;
  font-size: 11.5px;
  color: var(--ink-faint);
}

.roulette-spin {
  width: 100%;
  flex: 0 0 auto;
  padding: 10px 12px;
  font-size: 14px;
}

.roulette-prizes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 6px;
  margin-top: 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.roulette-prize {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 6px;
  border-radius: 8px;
  border: 1px solid rgba(36, 31, 24, 0.14);
  background: rgba(248, 242, 224, 0.72);
  font-size: 10.5px;
  color: var(--ink-soft);
  min-width: 0;
}

.roulette-prize.is-win {
  border-color: rgba(255, 201, 74, 0.9);
  background: rgba(255, 201, 74, 0.28);
  box-shadow: inset 0 0 0 1px rgba(255, 201, 74, 0.45);
}

.roulette-prize-ico {
  font-size: 14px;
  line-height: 1;
  flex: 0 0 auto;
}

.roulette-prize-main {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.roulette-prize-main b {
  font-size: 11px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.roulette-prize-main .muted {
  font-size: 9.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.roulette-prize-chance {
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
  color: var(--ink);
  flex: 0 0 auto;
}

.diary-roulette {
  border-color: rgba(255, 201, 74, 0.55);
}

@media (max-width: 360px) {
  .roulette-stage {
    width: min(58vw, 30vh, 196px);
  }

  .roulette-hub-text {
    font-size: 9px;
  }

  .roulette-prize {
    padding: 3px 5px;
  }

  .roulette-prize-main b {
    font-size: 10.5px;
  }

  .roulette-prize-chance {
    font-size: 9.5px;
  }
}

/* Низкие экраны (iPhone SE / старые Android): рулетка обязана влезать целиком */
@media (max-height: 700px) {
  .roulette-stage {
    width: min(46vw, 25vh, 180px);
  }

  .roulette-body {
    gap: 5px;
  }

  .roulette-result {
    min-height: 26px;
    font-size: 11.5px;
    padding: 4px 8px;
  }

  .roulette-spin {
    padding: 8px 10px;
    font-size: 13px;
  }

  .roulette-prizes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3px 5px;
  }
}

@media (max-height: 600px) {
  .roulette-stage {
    width: min(38vw, 22vh, 150px);
  }

  .roulette-hub-ico {
    font-size: 12px;
  }

  .roulette-hub-text {
    font-size: 8.5px;
  }

  .roulette-ticket-note {
    font-size: 10.5px;
  }
}

/* ===================================================================
   🔥 FOMO: «ОФФЕР НОВИЧКА» (24ч) И «ТОВАР ДНЯ −25%»
   Золотые наклейки на тетрадном листе: работают как таймер-триггер,
   не ломая арт-стиль «школьный класс + тетрадь».
   =================================================================== */

.hot-offer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 2px solid #e0a72a;
  background: linear-gradient(180deg, #ffe9a8 0%, #ffd166 100%);
  color: #4a3208;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.2px;
  text-align: center;
  box-shadow: 0 2px 0 rgba(122, 90, 16, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.55);
  animation: hot-offer-pulse 2.4s ease-in-out infinite;
}

.hot-offer[hidden] {
  display: none !important;
}

.hot-offer:active {
  transform: scale(0.98);
}

@keyframes hot-offer-pulse {
  0%,
  100% {
    box-shadow: 0 2px 0 rgba(122, 90, 16, 0.35),
      inset 0 0 0 1px rgba(255, 255, 255, 0.55);
  }

  50% {
    box-shadow: 0 2px 0 rgba(122, 90, 16, 0.35),
      0 0 14px rgba(255, 178, 44, 0.75),
      inset 0 0 0 1px rgba(255, 255, 255, 0.85);
  }
}

.hot-offer-banner {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 8px 0 2px;
  padding: 9px 11px;
  border-radius: 12px;
  border: 2px dashed rgba(224, 167, 42, 0.9);
  background: linear-gradient(
    180deg,
    rgba(255, 241, 196, 0.96),
    rgba(255, 214, 122, 0.96)
  );
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.35;
}

.hot-offer-banner[hidden] {
  display: none !important;
}

.hot-offer-ico {
  font-size: 20px;
  line-height: 1;
  flex: 0 0 auto;
  filter: drop-shadow(0 1px 0 rgba(90, 61, 40, 0.35));
}

.hot-offer-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.hot-offer-body b {
  color: #7a2b12;
}

.hot-offer-note {
  font-size: 11px;
  color: rgba(74, 50, 8, 0.75);
}

.deal-banner {
  border-style: solid;
  border-color: rgba(196, 70, 45, 0.75);
  background: linear-gradient(
    180deg,
    rgba(255, 236, 214, 0.97),
    rgba(255, 203, 158, 0.97)
  );
}

.shop-item.is-deal {
  border-color: rgba(224, 167, 42, 0.95);
  box-shadow: 0 0 0 2px rgba(255, 201, 74, 0.45),
    0 3px 10px rgba(122, 90, 16, 0.18);
}

.stars-item.is-hot {
  border-color: rgba(255, 201, 74, 0.95);
  box-shadow: 0 0 0 2px rgba(255, 201, 74, 0.5),
    0 3px 10px rgba(122, 90, 16, 0.2);
}

.deal-tag {
  margin-top: 4px;
  align-self: flex-start;
  padding: 1px 7px;
  border-radius: 8px;
  border: 1px solid rgba(196, 70, 45, 0.7);
  background: rgba(255, 201, 74, 0.35);
  color: #8c2e14;
  font-size: 11px;
  font-weight: 800;
}

.shop-buy .price-old {
  margin-right: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: rgba(36, 31, 24, 0.55);
  text-decoration: line-through;
}

.shop-buy .price-new {
  font-size: 13px;
  font-weight: 900;
  color: #c0392b;
}

@media (max-width: 360px) {
  .hot-offer {
    font-size: 11.5px;
    padding: 7px 8px;
  }

  .hot-offer-banner {
    padding: 7px 9px;
    font-size: 11.5px;
  }

  .hot-offer-ico {
    font-size: 17px;
  }

  .deal-tag {
    font-size: 10.5px;
  }
}

/* ===================== 🗺 КАРТА ВОЙНЫ: ГОРЯЧАЯ ТОЧКА, ЩИТ И ШТУРМ ===================== */

/* 🔥 Плашка «Горячая точка (×2)» над списком локаций */
.clan-hot-banner {
  margin: 0 0 10px;
  padding: 8px 12px;
  border-radius: 9px;
  border: 2px solid #b07414;
  background: linear-gradient(180deg, #fff1c4, #ffd56e);
  color: #4a3000;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.01em;
  box-shadow:
    inset 4px 0 0 #d97706,
    0 3px 0 #8a6108;
  animation: clan-hot-pulse 2.4s ease-in-out infinite;
}

.clan-hot-banner[hidden] {
  display: none !important;
}

@keyframes clan-hot-pulse {
  0%,
  100% {
    box-shadow:
      inset 4px 0 0 #d97706,
      0 3px 0 #8a6108;
  }
  50% {
    box-shadow:
      inset 4px 0 0 #d97706,
      0 3px 0 #8a6108,
      0 0 0 4px rgba(255, 201, 74, 0.32);
  }
}

/* Колонка тактических кнопок у точки */
.location-actions {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: stretch;
}

.location-storm {
  border-color: #8e2f2f;
  background: linear-gradient(180deg, #ffd0c4, #ef8b73);
  color: #4a0f0f;
  box-shadow:
    0 3px 0 #7c2a2a,
    0 5px 10px rgba(0, 0, 0, 0.18);
}

.location-storm:active {
  box-shadow: 0 0 0 #7c2a2a;
}

.location-fortify {
  border-color: #2b5f8e;
  background: linear-gradient(180deg, #e8f4ff, #a9d3f2);
  color: #123a5c;
  box-shadow:
    0 3px 0 #2b5f8e,
    0 5px 10px rgba(0, 0, 0, 0.18);
}

.location-fortify:active {
  box-shadow: 0 0 0 #2b5f8e;
}

/* Статус-чипы точки: 🛡 щит, 👥 налёт, 🔥 ×2 */
.location-status {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.location-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1.5px solid rgba(87, 74, 56, 0.4);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink-soft);
  font-size: 9.5px;
  font-weight: 800;
  line-height: 1.3;
  white-space: nowrap;
}

/* 🔥 Горячая точка подсвечивается золотом даже без владельца */
.location.is-hot {
  border-color: #d9a52a;
  box-shadow:
    inset 4px 0 0 #c98a10,
    0 4px 0 rgba(0, 0, 0, 0.18),
    0 12px 20px rgba(0, 0, 0, 0.3);
}

.location.is-hot .location-status-chip {
  border-color: rgba(176, 116, 20, 0.55);
  color: #6b4700;
}

@media (max-width: 360px) {
  .location {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .location-actions {
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
  }

  .location-actions .location-raid {
    flex: 1 1 118px;
  }

  .clan-hot-banner {
    font-size: 11px;
    padding: 7px 10px;
  }
}

/* ===================================================================
   🏠 ПЛАШКА КОМНАТЫ В «ХАТЕ» (ДВЕРЬ · ПК) + РАСКРЫТИЕ БЛОКА
   Живые игроки не находили апгрейды двери/ПК в глубине экрана: теперь под
   «Общаком» стоит компактная плашка с уровнями, а блок «Обстановка хаты»
   раскрывается и плавно подскролливается (scrollIntoView) прямо к нему.
   =================================================================== */

.room-strip {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  margin-top: 8px;
  padding: 8px 11px;
  border-radius: 10px;
  border: 2px solid rgba(90, 61, 40, 0.55);
  background:
    linear-gradient(180deg, rgba(255, 250, 232, 0.97), rgba(240, 227, 191, 0.97));
  color: var(--ink);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.16);
}

.room-strip:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
}

.room-strip-ico {
  font-size: 20px;
  line-height: 1;
  flex: 0 0 auto;
  filter: drop-shadow(0 1px 0 rgba(90, 61, 40, 0.28));
}

.room-strip-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1 1 auto;
  min-width: 0;
}

.room-strip-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.room-strip-status {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-strip-cta {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid #b98620;
  background: linear-gradient(180deg, #ffe08a, #e9b13f);
  color: #3a2708;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

/* Подсветка блока, к которому только что проскроллили */
.quick-panel.is-flash,
.room-details-card.is-flash,
.couple-card.is-flash {
  animation: quick-flash 1.4s ease-out 1;
}

@keyframes quick-flash {
  0% {
    box-shadow: 0 0 0 3px rgba(255, 201, 74, 0.95);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(255, 201, 74, 0);
  }
}

/* ===================================================================
   🎟 BATTLE PASS: ПОНЯТНЫЙ ЗОЛОТОЙ ПРОПУСК НА МОБИЛЬНОМ ЭКРАНЕ
   Плашка преимуществ + тап по ячейке уровня → мини-карточка наград
   («Бесплатно» / «Золотой») прямо под сеткой (без hover, без title).
   =================================================================== */

.bp-gold-banner {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 6px 0 8px;
  padding: 8px 10px;
  border-radius: 9px;
  border: 2px solid rgba(224, 167, 42, 0.9);
  background: linear-gradient(180deg, #fff5cf, #ffe29a);
  color: #4a3208;
  font-size: 10.5px;
  line-height: 1.4;
}

.bp-gold-banner-ico {
  font-size: 17px;
  line-height: 1;
  flex: 0 0 auto;
}

.bp-gold-banner b {
  color: #7a2b12;
}

.bp-gold-banner.is-owned {
  border-color: rgba(47, 143, 60, 0.75);
  background: linear-gradient(180deg, #f0ffe4, #d5f2bd);
  color: #245c22;
}

.bp-gold-banner.is-owned b {
  color: #1c4a1c;
}

/* Ячейка уровня — кликабельная (тап показывает награды под сеткой) */
.bp-level {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.bp-level:active {
  transform: scale(0.96);
}

.bp-level.is-selected {
  border: 2px solid #7a2b12 !important;
  box-shadow: 0 0 0 2px rgba(176, 52, 44, 0.28);
}

.bp-level-hint {
  margin: -2px 0 6px;
  font-size: 9.5px;
  font-weight: 800;
  color: #6d5730;
  opacity: 0.85;
}

.bp-detail {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 2px 0 8px;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px dashed rgba(162, 112, 13, 0.55);
  background: rgba(255, 250, 232, 0.92);
}

.bp-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  font-weight: 900;
  color: #5a3f0a;
}

.bp-detail-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 10.5px;
  line-height: 1.35;
  color: #4a3f2f;
}

.bp-detail-row b {
  color: #241f18;
}

.bp-detail-row.is-gold {
  color: #6b4700;
}

.bp-detail-row.is-gold b {
  color: #7a2b12;
}

.bp-detail-tag {
  flex: 0 0 auto;
  padding: 1px 5px;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 900;
  border: 1px solid rgba(47, 143, 60, 0.55);
  background: rgba(124, 255, 107, 0.2);
  color: #245c22;
}

.bp-detail-tag.is-gold {
  border-color: rgba(176, 116, 20, 0.65);
  background: rgba(255, 201, 74, 0.32);
  color: #6b4700;
}

@media (max-width: 360px) {
  .room-strip-status {
    font-size: 11px;
  }

  .room-strip-cta {
    font-size: 10px;
    padding: 3px 6px;
  }

  .bp-gold-banner {
    font-size: 10px;
  }

  .bp-detail-row {
    font-size: 10px;
  }
}

/* --- END OF FILE webapp/style.css --- */

