/* ============ Тень Сёгуна — оформление ============ */

/* Pixeloid Sans — пиксельный шрифт с полной кириллицей, лицензия SIL OFL
   (текст лицензии лежит рядом со шрифтом). Родной размер — 12 px, поэтому
   все размеры в интерфейсе кратны ему, иначе буквы замыливаются. */
@font-face {
  font-family: 'Pixeloid';
  src: url('assets/ui/font/PixeloidSans.otf') format('opentype');
  font-weight: 400;
  font-display: block;
}
@font-face {
  font-family: 'Pixeloid';
  src: url('assets/ui/font/PixeloidSans-Bold.otf') format('opentype');
  font-weight: 700;
  font-display: block;
}
:root {
  --ink: #0b0910;
  --ink-2: #14111c;
  --paper: #e8ddc4;
  --paper-dark: #cbbd9c;
  --gold: #d8a83a;
  --gold-dim: #8a6c26;
  --blood: #b3232b;
  --blood-dim: #6d1519;
  --jade: #37b58a;
  --ki: #4aa3d8;
  --soul: #9d7ad8;
  --txt: #efe6d4;
  --muted: #b8ad97;

  --r-common: #9aa0a6;
  --r-uncommon: #4cae4c;
  --r-rare: #3f8fd6;
  --r-epic: #a45fd6;
  --r-legend: #e08b2a;
  --r-myth: #e0453f;

  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* ============ пиксельный интерфейс ============
   Рамки и кнопки — девятисрезовые картинки из Ninja Adventure, перекрашенные
   под палитру игры. Ключевое: image-rendering: pixelated, чтобы растяжение
   border-image не мылило пиксель, и никаких скруглений с размытием. */
.px {
  image-rendering: pixelated;
  border-style: solid;
  border-image-repeat: repeat;
  border-radius: 0 !important;
  background: none;
}
.px-panel {
  border-width: 15px;
  border-image-source: url('assets/ui/theme/nine_path_panel.png');
  border-image-slice: 5 fill;
}
.px-bg {
  border-width: 12px;
  border-image-source: url('assets/ui/theme/nine_path_bg.png');
  border-image-slice: 4 fill;
}
.px-cell {
  border-width: 9px;
  border-image-source: url('assets/ui/theme/inventory_cell.png');
  border-image-slice: 3 fill;
}
html, body {
  margin: 0; padding: 0; height: 100%; overflow: hidden;
  background: var(--ink); color: var(--txt);
  font-family: 'Pixeloid', 'Segoe UI', system-ui, sans-serif;
  font-size: 18px; -webkit-font-smoothing: none;
  user-select: none; -webkit-user-select: none; touch-action: none;
  overscroll-behavior: none;
}
#app { position: fixed; inset: 0; }
canvas#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.panel-body, .panel-head { text-shadow: 1px 1px 0 rgba(0,0,0,.75); }
.small { font-size: 18px; }

/* ---------- экраны ---------- */
.screen {
  position: absolute; inset: 0; z-index: 40;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  /* safe center + прокрутка: на низком экране обычный center обрезал меню
     сверху и снизу, до кнопок было не добраться. */
  justify-content: safe center;
  overflow-y: auto; padding: 14px 12px;
  background:
    radial-gradient(120% 90% at 50% 20%, rgba(179,35,43,.16), transparent 60%),
    radial-gradient(140% 100% at 50% 110%, rgba(216,168,58,.10), transparent 60%),
    var(--ink);
}
/* За меню крутится живая деревня, поэтому фон убираем и оставляем
   только мягкое затемнение сверху и снизу — иначе текст теряется. */
#menu.screen {
  background:
    radial-gradient(90% 55% at 50% 42%, rgba(6,4,12,.55), transparent 70%),
    linear-gradient(180deg, rgba(6,4,12,.55) 0%, rgba(6,4,12,0) 30%,
      rgba(6,4,12,0) 62%, rgba(6,4,12,.6) 100%);
}
#menu .logo { text-shadow: 0 3px 0 #000, 0 0 34px rgba(216,168,58,.55), 0 0 12px rgba(0,0,0,.9); }
#menu .tagline { text-shadow: 0 2px 6px #000; }
#menu #menu-profile { text-shadow: 0 2px 6px #000; }
#menu .btn { filter: drop-shadow(0 4px 0 rgba(0,0,0,.5)); }

.seal {
  width: 88px; height: 88px; border-radius: 0;
  display: grid; place-items: center; image-rendering: pixelated;
  background: #b4262b;
  color: #ffeccd; font-size: 50px; font-weight: 700;
  box-shadow: 0 0 0 4px #7d1418, 0 0 0 8px #2a1016, 0 8px 0 8px rgba(0,0,0,.35);
  animation: seal-in .8s steps(6);
}
@keyframes seal-in { from { transform: scale(.6) rotate(-12deg); opacity: 0 } }
@media (max-width: 560px) { .logo { font-size: 27px; } }
@media (max-height: 620px) {
  .screen { gap: 8px; }
  .seal { width: 54px; height: 54px; font-size: 27px; box-shadow: 0 0 0 3px #7d1418, 0 0 0 6px #2a1016; }
  .logo { font-size: 27px; }
  .tagline { font-size: 9px; margin: -2px 0 4px; }
}
.logo {
  margin: 0; font-size: 36px; letter-spacing: .18em;
  font-weight: 700; color: var(--paper);
  text-shadow: 0 2px 0 #000, 0 0 26px rgba(216,168,58,.35);
}
.tagline { margin: -2px 0 10px; color: var(--gold); letter-spacing: .2em; font-size: 18px; text-transform: uppercase; }
.menu-buttons { display: flex; flex-direction: column; gap: 10px; width: min(320px, 78vw); }

.btn {
  appearance: none; background: none; border-radius: 0;
  image-rendering: pixelated;
  border-style: solid; border-width: 9px;
  border-image-source: url('assets/ui/theme/button_normal.png');
  border-image-slice: 3 fill; border-image-repeat: stretch;
  color: #2a1c08; padding: 6px 14px; font-size: 18px; font-weight: 700;
  letter-spacing: .04em; cursor: pointer;
  text-shadow: 0 1px 0 rgba(255,240,200,.45);
}
.btn:hover { border-image-source: url('assets/ui/theme/button_hover.png'); }
.btn:active { border-image-source: url('assets/ui/theme/button_pressed.png'); color: #f2e2c0; text-shadow: 0 1px 0 rgba(0,0,0,.6); }
.btn:disabled { border-image-source: url('assets/ui/theme/button_disabled.png'); color: #8b8598; text-shadow: none; cursor: default; }
.btn-primary { color: #fff2e0; text-shadow: 0 1px 0 rgba(0,0,0,.65);
  border-image-source: url('assets/ui/theme/button_red_normal.png'); }
.btn-primary:hover { border-image-source: url('assets/ui/theme/button_red_hover.png'); }
.btn-primary:active { border-image-source: url('assets/ui/theme/button_red_pressed.png'); }
.btn-primary:disabled { border-image-source: url('assets/ui/theme/button_red_disabled.png'); }
.btn-jade { color: #04231a; text-shadow: 0 1px 0 rgba(190,255,230,.4);
  border-image-source: url('assets/ui/theme/button_jade_normal.png'); }
.btn-jade:hover { border-image-source: url('assets/ui/theme/button_jade_hover.png'); }
.btn-jade:active { border-image-source: url('assets/ui/theme/button_jade_pressed.png'); color: #d8fff0; }
.btn-jade:disabled { border-image-source: url('assets/ui/theme/button_jade_disabled.png'); }
.btn.small { padding: 3px 9px; font-size: 18px; border-width: 7px; }
@media (pointer: coarse) { .btn.small { min-height: 44px; } }

.bar-outer { width: min(320px, 70vw); height: 10px; background: #100d18; border-radius: 0; overflow: hidden; box-shadow: 0 0 0 2px #3a2f45; }
.bar-inner { height: 100%; width: 0; background: linear-gradient(90deg, var(--blood), var(--gold)); transition: width .2s; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
/* Слоты панели умений — это div, поэтому их нужно перечислить явно,
   иначе на десктопе зелье, умения и рывок не нажимаются. */
#hud button, #hud .stick, #hud .slot, #hud .act { pointer-events: auto; }

.hud-top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; padding: 8px 10px; gap: 8px; }
.hud-left {
  /* min-width: 0 обязателен: без него блок с полосками не даёт себя сжать,
     и на узком экране правый столбец уезжает за край. */
  min-width: 0; flex: 0 1 auto;
  display: flex; align-items: center; gap: 7px; padding: 2px 6px 2px 2px;
  image-rendering: pixelated; border-style: solid; border-width: 12px;
  border-image-source: url('assets/ui/theme/nine_path_bg.png');
  border-image-slice: 4; border-image-repeat: repeat;
  background: rgba(16,13,24,.9);
}
/* Портрет — лицо героя из его же спрайта (tools/make_portraits.py), а не
   иероглиф: при смене облика меняется и портрет. Источник 14×14, коробка
   42 px — ровно втрое, иначе пиксели плывут. */
.portrait {
  width: 42px; height: 42px; border-radius: 0; flex: 0 0 auto;
  background: #191320 center / 42px 42px no-repeat;
  image-rendering: pixelated;
  box-shadow: 0 0 0 2px var(--gold-dim);
}
.bars { display: flex; flex-direction: column; gap: 4px; flex: 1 1 auto; min-width: 88px; width: min(186px, 36vw); }
.bar { position: relative; height: 12px; background: #100d18; box-shadow: 0 0 0 2px #2a2136; border-radius: 0; overflow: hidden; }
.bar .fill { height: 100%; width: 100%; transition: width .18s; }
.bar.hp .fill { background: linear-gradient(90deg, #8b1a1f, #d8353d); }
.bar.ki .fill { background: linear-gradient(90deg, #1d5b80, #4aa3d8); }
.bar.xp { height: 12px; }
.bar.xp .fill { background: linear-gradient(90deg, #7a5c14, var(--gold)); }
.bar span { position: absolute; inset: 0; font-size: 9px; line-height: 13px; text-align: center; color: #fff; font-weight: 700; text-shadow: 1px 1px 0 #000; }
.lvl-badge { min-width: 24px; height: 24px; padding: 0 4px; border-radius: 0; display: grid; place-items: center; background: #2a1f34; box-shadow: 0 0 0 2px var(--gold-dim); color: var(--gold); font-weight: 700; font-size: 18px; }

.hud-right { display: flex; flex-direction: column; gap: 3px; align-items: flex-end; flex: 0 0 auto; }
/* Рамка у чипа тоньше, чем у кнопок: четыре счётчика с рамкой в 9 px
   занимали почти треть экрана по высоте. */
.currency {
  display: flex; align-items: center; gap: 5px; padding: 0 4px 0 2px;
  font-size: 18px; line-height: 20px; font-weight: 700; min-width: 78px;
  justify-content: flex-end;
  image-rendering: pixelated; border-style: solid; border-width: 6px;
  border-image-source: url('assets/ui/theme/nine_path_bg.png');
  border-image-slice: 2; border-image-repeat: repeat;
  background: rgba(16,13,24,.9);
}
.currency.premium { border-color: var(--jade); color: #b7f0da; }
.ico { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.ico.gold { background: linear-gradient(160deg, #ffd76a, #a97c14); }
.ico.shard { background: linear-gradient(160deg, #a9e6d2, #2c8a6c); clip-path: polygon(50% 0,100% 50%,50% 100%,0 50%); border-radius: 0; }
.ico.soul { background: linear-gradient(160deg, #cbb0ff, #6f4bb0); border-radius: 50%; }
.ico.jade { background: linear-gradient(160deg, #7ff0c6, #168f68); clip-path: polygon(50% 0,100% 38%,82% 100%,18% 100%,0 38%); border-radius: 0; }

/* Баннер зоны и полоса босса живут в свободной полосе между колонкой
   полосок слева и колонкой валют справа, а не по центру всего экрана:
   на узком экране центрированный блок наезжал на обе колонки. */
.zone-banner {
  position: absolute; top: 158px; left: 52px; right: 96px; max-width: 430px; margin: 0 auto;
  font-size: 18px; letter-spacing: .22em; color: var(--paper); text-transform: uppercase;
  text-shadow: 0 2px 6px #000; opacity: 0; transition: opacity .5s;
  text-align: center;
}
.zone-banner.show { opacity: 1; }
.zone-banner small { display: block; font-size: 18px; letter-spacing: .1em; color: var(--gold); text-transform: none; }

.boss-bar { position: absolute; top: 90px; left: 52px; right: 96px; max-width: 430px; margin: 0 auto; }
.boss-name {
  text-align: center; font-size: 18px; letter-spacing: .14em; color: #ffcfcf;
  text-shadow: 0 2px 4px #000; margin-bottom: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
@media (max-width: 560px) { .boss-name { font-size: 9px; letter-spacing: .1em; } }
.boss-track { height: 12px; background: #180f16; border: 1px solid #6d1519; border-radius: 7px; overflow: hidden; }
.boss-track > div { height: 100%; width: 100%; background: linear-gradient(90deg, #6d1519, #e0453f, #ffa06a); transition: width .2s; }

/* Кнопки живут в том же столбце, что и счётчики валют. Раньше столбец кнопок
   был абсолютным с фиксированным отступом сверху, и стоило чипам валют
   подрасти — кнопки заезжали прямо на них. */
.hud-buttons { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.ic-btn {
  position: relative;
  width: 44px; height: 44px; border-radius: 0; padding: 0; flex: 0 0 auto;
  image-rendering: pixelated; border-style: solid; border-width: 9px;
  border-image-source: url('assets/ui/theme/nine_path_bg.png');
  border-image-slice: 3; border-image-repeat: repeat;
  background: rgba(16,13,24,.92);
  color: var(--paper); font-size: 17px; line-height: 1; cursor: pointer;
  display: grid; place-items: center; overflow: visible;
}
@media (max-height: 660px) {
  /* Низкий экран: счётчики встают в два столбца, кнопки жмутся. */
  .hud-right { display: grid; grid-template-columns: repeat(2, auto); gap: 3px;
               justify-items: end; justify-content: end; }
  .hud-buttons { grid-column: 1 / -1; margin-top: 6px; gap: 6px; }
  .ic-btn { width: 38px; height: 38px; border-width: 8px; font-size: 15px; }
}
@media (max-height: 660px) and (min-width: 560px) {
  /* Телефон в альбоме: столбец из пяти кнопок в такую высоту не влезает и
     упирается в пад, поэтому кнопки ложатся в строку. Правый блок при этом
     становится широким, и полоса босса с баннером уходят под него. */
  .hud-buttons { flex-direction: row; }
  .boss-bar, .zone-banner { top: 128px; right: 12px; left: 48px; }
}
@media (max-height: 420px) {
  /* Совсем низкий экран: под подсказку остаётся только полка слева
     между полосками героя и полосой босса. */
  .interact-hint, body.touch .interact-hint {
    top: 84px; bottom: auto; left: 12px; right: auto; transform: none;
    max-width: min(320px, 46vw); text-align: left; padding: 4px 8px;
  }
}
.ic-btn:hover { border-image-source: url('assets/ui/theme/nine_path_focus.png'); border-image-slice: 2; color: var(--gold); }
.ic-btn.badge::after { content: ''; position: absolute; top: -3px; right: -3px; width: 9px; height: 9px; border-radius: 50%; background: var(--blood); box-shadow: 0 0 0 2px rgba(11,9,16,.9); }

/* панель скиллов (десктоп) */
/* Семь слотов в ряд шире узкого окна, поэтому ряд умеет переноситься,
   а на маленькой ширине слоты ужимаются. */
.skillbar {
  position: absolute; bottom: calc(12px + var(--safe-b)); left: 50%; transform: translateX(-50%);
  display: flex; flex-wrap: wrap; justify-content: center; gap: 12px;
  /* Абсолютный блок ужимается по содержимому и при переносе выбирает ширину
     уже одной строки, поэтому ширину задаём явно — перенос включается только
     когда ряд правда не влезает. */
  width: max-content; max-width: calc(100vw - 16px);
}
/* Слот с рамкой в 9 px занимает по факту 64 px, поэтому семь штук перестают
   помещаться в ряд уже около 620 px — там и ужимаем. */
@media (max-width: 620px) {
  .skillbar { gap: 6px; }
  .slot { width: 38px; height: 38px; border-width: 7px; font-size: 15px; }
}
.slot {
  position: relative; width: 46px; height: 46px; border-radius: 0; flex: 0 0 auto;
  image-rendering: pixelated; border-style: solid; border-width: 9px;
  border-image-source: url('assets/ui/theme/nine_path_bg.png');
  border-image-slice: 3; border-image-repeat: repeat;
  background: rgba(16,13,24,.92);
  display: grid; place-items: center; font-size: 18px; color: var(--paper);
  pointer-events: auto; cursor: pointer;
}
.slot.ready { border-image-source: url('assets/ui/theme/nine_path_focus.png'); border-image-slice: 2; }
.slot .key { position: absolute; bottom: 0; right: 2px; font-size: 9px; color: var(--muted); }
.slot .cd-mask { position: absolute; inset: -6px; background: rgba(4,3,7,.72); transform-origin: bottom; }
.slot.locked { opacity: .35; }

/* ---------- всплывашка действий над предметом ---------- */
/* Стоит поверх панели и прижата к самому слоту: до «Надеть» больше не нужно
   прокручивать список до конца. */
.item-pop {
  position: fixed; z-index: 80; width: min(320px, calc(100vw - 16px));
  image-rendering: pixelated; border-style: solid; border-width: 12px;
  border-image-source: url('assets/ui/theme/nine_path_panel.png');
  border-image-slice: 4; border-image-repeat: repeat;
  background: #14111d;
  box-shadow: 0 8px 0 rgba(0,0,0,.45);
}
.item-pop .card { margin: 0 !important; box-shadow: none; background: none; padding: 0; }
.item-pop .row { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 9px; }

/* Карточка подписки на сообщество стоит первой в «Бесплатно», поэтому
   выделена нефритовой рамкой. */
.group-card { box-shadow: 0 0 0 2px var(--jade); }
.group-card .row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- боковая лавка за голоса / ОКи ---------- */
/* Вход в премиум-лавку вынесен на левый край отдельной вкладкой: из общей
   кнопки «Лавка» в столбце иконок было не видно, что покупка идёт за голоса
   ВКонтакте (или за ОКи в Одноклассниках). */
.votes-tab {
  position: absolute; left: 6px; top: 50%; transform: translateY(-50%);
  writing-mode: vertical-rl;              /* закладка вдоль левого края */
  display: flex; align-items: center; gap: 6px;
  padding: 6px 0; width: 34px;
  image-rendering: pixelated; border-style: solid; border-width: 8px;
  border-image-source: url('assets/ui/theme/button_normal.png');
  border-image-slice: 3; border-image-repeat: repeat;
  background: rgba(38,26,10,.94);
  color: var(--gold); font-size: 18px; font-weight: 700; letter-spacing: .1em;
  text-shadow: 1px 1px 0 #000; white-space: nowrap; cursor: pointer;
}
.votes-tab:hover { border-image-source: url('assets/ui/theme/button_hover.png'); color: #fff2cd; }
.votes-tab:active { transform: translateY(-50%) translateX(1px); }
.votes-tab .ico { width: 14px; height: 14px; }
@media (max-height: 660px) { .votes-tab { width: 30px; border-width: 7px; font-size: 9px; } }

/* ---------- сенсорное управление ---------- */
#touch-ui { position: absolute; inset: 0; z-index: 22; }
.stick {
  position: absolute; left: 20px; bottom: calc(24px + var(--safe-b));
  width: 122px; height: 122px; border-radius: 50%;
  background: rgba(20,15,28,.34); border: 1px solid rgba(216,168,58,.22);
  touch-action: none;
}
.knob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: rgba(216,168,58,.34); border: 1px solid rgba(232,221,196,.4); }
/* Пад разложен дугой вокруг удара. Раньше он был шире 250 px и на экране
   в 375 px левый край дуги наезжал прямо на стик, а соседние кнопки
   перекрывали друг друга. Теперь дуга умещается правее стика. */
.action-pad { position: absolute; right: 12px; bottom: calc(16px + var(--safe-b)); width: 210px; height: 196px; }
.act {
  position: absolute; border-radius: 50%; border: 1px solid #4a3a5c;
  background: rgba(22,16,30,.8); color: var(--paper); font-size: 20px;
  display: grid; place-items: center; pointer-events: auto; cursor: pointer;
}
.act .cd { position: absolute; inset: 0; border-radius: 50%; background: rgba(0,0,0,.6); transform: scaleY(0); transform-origin: bottom; }
.act-attack { width: 76px; height: 76px; right: 4px; bottom: 4px; background: rgba(140,26,32,.82); border-color: #d8555c; font-size: 28px; }
.act-dash { width: 52px; height: 52px; right: 86px; bottom: 8px; }
.act-potion { width: 44px; height: 44px; right: 144px; bottom: 16px; background: rgba(28,90,66,.82); border-color: var(--jade); font-size: 13px; font-weight: 700; }
.act-skill { width: 44px; height: 44px; font-size: 16px; }
.act[data-act="skill1"] { right: 6px;   bottom: 92px; }
.act[data-act="skill2"] { right: 56px;  bottom: 104px; }
.act[data-act="skill3"] { right: 108px; bottom: 112px; }
.act[data-act="skill4"] { right: 158px; bottom: 96px; }
.act[data-act="skill5"] { right: 6px;   bottom: 148px; }
@media (max-width: 380px), (max-height: 600px) {
  .action-pad { transform: scale(.88); transform-origin: 100% 100%; }
  .stick { width: 108px; height: 108px; }
  .knob { width: 46px; height: 46px; margin: -23px 0 0 -23px; }
}

/* ---------- всплывашки ---------- */
.toast-host { position: absolute; left: 50%; top: 120px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 5px; align-items: center; }
.toast {
  background: #14111d; box-shadow: 0 0 0 2px #3d3049, inset 4px 0 0 var(--gold);
  padding: 7px 13px 7px 16px; border-radius: 0; font-size: 18px; animation: toast-in .25s steps(4);
  max-width: 78vw; text-align: center;
}
.toast.good { box-shadow: 0 0 0 2px #3d3049, inset 4px 0 0 var(--jade); }
.toast.bad { box-shadow: 0 0 0 2px #3d3049, inset 4px 0 0 var(--blood); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px) } }

.interact-hint {
  position: absolute; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%);
  background: #14111d; box-shadow: 0 0 0 2px var(--gold-dim); border-radius: 0;
  padding: 7px 12px; font-size: 18px; color: var(--paper);
  max-width: calc(100vw - 24px); text-align: center;
}
/* На телефоне низ экрана занят стиком и падом: панель умений там лишняя
   (её кнопки уже есть на паде), а подсказка поднимается над ними. */
body.touch .skillbar { display: none; }
@media (max-width: 560px) {
  /* Портрет: низ занят целиком, подсказку поднимаем. В альбоме между стиком
     и падом есть свободная середина, там она остаётся внизу. */
  body.touch .interact-hint { bottom: calc(238px + var(--safe-b)); }
}
.interact-hint b { color: var(--gold); }

/* ---------- панели ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: rgba(6,4,10,.78); padding: 10px;
}
.panel {
  width: min(760px, 100%); max-height: 92%; display: flex; flex-direction: column;
  image-rendering: pixelated;
  border-style: solid; border-width: 15px;
  border-image-source: url('assets/ui/theme/nine_path_panel.png');
  border-image-slice: 5; border-image-repeat: repeat;
  border-radius: 0; background: #14111d;
  filter: drop-shadow(0 12px 24px rgba(0,0,0,.55));
}
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 10px; border-bottom: 2px solid rgba(200,156,54,.35); }
.panel-head h2 { margin: 0; font-size: 18px; letter-spacing: .06em; color: #f2d489; font-weight: 700; text-shadow: 1px 1px 0 #000; }
.close { background: none; border: none; color: var(--muted); font-size: 19px; cursor: pointer; padding: 0 4px; }
.close:hover { color: var(--blood); }
.panel-body { padding: 12px 4px 6px; color: var(--txt); overflow-y: auto; overscroll-behavior: contain; }

.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tab {
  padding: 3px 10px; border-radius: 0; color: var(--muted); font-size: 18px; cursor: pointer;
  image-rendering: pixelated; border-style: solid; border-width: 7px;
  border-image-source: url('assets/ui/theme/button_disabled.png');
  border-image-slice: 3 fill; border-image-repeat: stretch;
}
.tab.active { color: #2a1c08; border-image-source: url('assets/ui/theme/button_normal.png'); text-shadow: 0 1px 0 rgba(255,240,200,.4); }

.grid-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 7px; }
.islot {
  position: relative; aspect-ratio: 1; border-radius: 0;
  image-rendering: pixelated; border-style: solid; border-width: 9px;
  border-image-source: url('assets/ui/theme/inventory_cell.png');
  border-image-slice: 3; border-image-repeat: repeat;
  background: #171220;
  display: grid; place-items: center; cursor: pointer;
  font-size: 22px;
}
.islot:hover { border-image-source: url('assets/ui/theme/nine_path_focus.png'); border-image-slice: 2; }
.islot.empty { color: #2f2740; font-size: 15px; cursor: default; }
.islot.empty:hover { border-image-source: url('assets/ui/theme/inventory_cell.png'); border-image-slice: 3; }
.islot .lv { position: absolute; bottom: 0; right: 2px; font-size: 9px; color: var(--gold); }
.islot .up { position: absolute; top: 0; left: 2px; font-size: 9px; color: var(--jade); font-weight: 700; }
.islot.equipped::after { content: 'E'; position: absolute; top: 1px; right: 3px; font-size: 8px; color: var(--jade); }

.equip-layout { display: grid; grid-template-columns: 1fr 1.25fr; gap: 14px; }
@media (max-width: 620px) { .equip-layout { grid-template-columns: 1fr; } }
.equip-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.eslot {
  position: relative; aspect-ratio: 1; border-radius: 0;
  image-rendering: pixelated; border-style: solid; border-width: 9px;
  border-image-source: url('assets/ui/theme/inventory_cell.png');
  border-image-slice: 3; border-image-repeat: repeat;
  background: #15111d;
  display: grid; place-items: center; cursor: pointer; font-size: 20px;
}
.eslot .tag { position: absolute; bottom: 0; left: 0; right: 0; text-align: center; font-size: 9px; color: var(--muted); }

.statlist { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 18px; }
.statlist .k { color: var(--muted); }
.statlist .v { color: var(--paper); font-weight: 600; text-align: right; }

.card { padding: 4px 6px 8px; margin-bottom: 10px; }
.card, .talent, .zone-card, .shop-card {
  image-rendering: pixelated; border-radius: 0;
  border-style: solid; border-width: 12px;
  border-image-source: url('assets/ui/theme/nine_path_bg.png');
  border-image-slice: 4; border-image-repeat: repeat;
  background: #1c1728;
}
.card h4 { margin: 0 0 5px; font-size: 18px; color: var(--paper); }
.card p { margin: 0 0 7px; font-size: 18px; color: #cfc4ad; line-height: 1.5; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.price { font-weight: 700; color: var(--gold); white-space: nowrap; }
.price.jade { color: var(--jade); }

.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 10px; }
.shop-card { position: relative; background: linear-gradient(180deg, #1e1729, #14101c); border: 1px solid #362a45; border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 7px; }
.shop-card.hot { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(216,168,58,.2), 0 8px 24px rgba(216,168,58,.12); }
.shop-card .ribbon { position: absolute; top: 8px; right: -6px; background: var(--blood); color: #fff; font-size: 10px; padding: 2px 9px; border-radius: 3px; letter-spacing: .06em; }
.shop-card .title { font-size: 18px; font-weight: 700; }
/* min-height: 0 обязателен: без него текст описания не даёт себя сжать и
   вылезает поверх картинки соседнего блока, а хвост фразы просто обрезается. */
.shop-card .desc {
  font-size: 18px; color: var(--muted); line-height: 1.5;
  flex: 1 1 auto; min-height: 0; overflow: hidden;
}
/* Кнопка всегда прижата к низу карточки, поэтому в ряду они на одной линии,
   какой бы длины ни было описание. */
.shop-card > .btn { margin-top: auto; }

/* ---------- карточка облика ---------- */
.skin-card .skin-face {
  height: 76px; display: grid; place-items: center; flex: 0 0 auto;
  background: #120e19; border-radius: 7px;
}
.skin-card .face { display: block; image-rendering: pixelated; }
.skin-card .desc {
  /* три строки максимум — иначе карточки в ряду разной высоты */
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3;
}
.shop-card .amount { font-size: 27px; font-weight: 700; color: var(--jade); }

.zone-card { display: flex; gap: 12px; align-items: center; padding: 11px 13px; border-radius: 10px; border: 1px solid #302640; background: #171220; margin-bottom: 8px; cursor: pointer; transition: .12s; }
.zone-card:hover { border-color: var(--gold); transform: translateX(3px); }
.zone-card.locked { opacity: .45; cursor: not-allowed; }
.zone-card.locked:hover { transform: none; border-color: #302640; }
.zone-glyph { width: 44px; height: 44px; border-radius: 9px; display: grid; place-items: center; font-size: 22px; flex: 0 0 auto; }
.zone-info { flex: 1; min-width: 0; }
.zone-info h4 { margin: 0 0 2px; font-size: 18px; }
.zone-info p { margin: 0; font-size: 18px; color: var(--muted); }
.zone-meta { font-size: 18px; color: var(--gold); white-space: nowrap; }

.talent { display: flex; gap: 10px; align-items: center; padding: 9px 11px; border: 1px solid #302640; border-radius: 9px; background: #171220; margin-bottom: 7px; }
.talent .tg { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: #241b30; color: var(--soul); font-size: 17px; }
.talent .tinfo { flex: 1; min-width: 0; }
.talent .tinfo b { font-size: 18px; }
.talent .tinfo div { font-size: 18px; color: #cfc4ad; line-height: 1.5; }
.rank { font-size: 18px; color: var(--gold); }

.tooltip {
  position: absolute; z-index: 90; max-width: 270px; pointer-events: none;
  background: #0b0912; box-shadow: 0 0 0 2px var(--gold-dim), 0 10px 24px rgba(0,0,0,.6);
  border-radius: 0; padding: 10px 12px; font-size: 18px; line-height: 1.6;
}
.tooltip h5 { margin: 0 0 3px; font-size: 18px; }
.tooltip .sub { color: var(--muted); font-size: 18px; margin-bottom: 6px; }
.tooltip .aff { color: var(--jade); }
.tooltip .base { color: var(--paper); }
.tooltip .cmp-up { color: #6ede9e; }
.tooltip .cmp-down { color: #e07070; }

.r-common { color: var(--r-common) } .r-uncommon { color: var(--r-uncommon) }
.r-rare { color: var(--r-rare) } .r-epic { color: var(--r-epic) }
.r-legend { color: var(--r-legend) } .r-myth { color: var(--r-myth) }
.b-common { border-color: var(--r-common) } .b-uncommon { border-color: var(--r-uncommon) }
.b-rare { border-color: var(--r-rare) } .b-epic { border-color: var(--r-epic) }
.b-legend { border-color: var(--r-legend); box-shadow: 0 0 10px rgba(224,139,42,.25) }
.b-myth { border-color: var(--r-myth); box-shadow: 0 0 12px rgba(224,69,63,.3) }

.result-hero { text-align: center; padding: 6px 0 14px; }
.result-hero .big { font-size: 27px; font-weight: 700; letter-spacing: .1em; }
.result-hero .big.win { color: var(--gold); }
.result-hero .big.lose { color: var(--blood); }
.rewards { display: flex; justify-content: center; gap: 18px; margin: 10px 0 16px; flex-wrap: wrap; }
.rw { text-align: center; }
.rw .n { font-size: 27px; font-weight: 700; }
.rw .l { font-size: 9px; color: var(--muted); letter-spacing: .04em; }

.footer-note { font-size: 9px; color: #5d5568; text-align: center; margin-top: 12px; line-height: 1.6; }
