/*
 * Компоновка профиля зависит не только от ширины окна, но и от оболочки.
 * VK desktop живёт в ограниченной высоте iframe, VK mobile — внутри одного
 * app-viewport, обычный мобильный браузер — в естественном потоке страницы.
 */

.detail-scrim,
.detail-close {
  display: none;
}

/* VK Mini App: настольная оболочка. Все основные области помещались в iframe,
   а прокрутка оставалась внутри сумки и правой карточки. */
html[data-client-surface="vk-desktop"],
html[data-client-surface="web"],
html[data-client-surface="vk-desktop"] body,
html[data-client-surface="web"] body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
}

html[data-client-surface="vk-desktop"] .reference-app,
html[data-client-surface="web"] .reference-app {
  display: flex;
  width: 100%;
  max-width: none;
  height: 100dvh;
  min-height: 0;
  flex-direction: column;
  padding: calc(8px + var(--hf-safe-top)) max(8px, var(--hf-safe-right)) calc(8px + var(--hf-safe-bottom)) max(8px, var(--hf-safe-left));
}

html[data-client-surface="vk-desktop"] .reference-header,
html[data-client-surface="web"] .reference-header,
html[data-client-surface="vk-desktop"] .profile-status,
html[data-client-surface="web"] .profile-status {
  flex: 0 0 auto;
}

html[data-client-surface="vk-desktop"] .profile-status,
html[data-client-surface="web"] .profile-status {
  margin-bottom: 6px;
  padding-block: 7px;
}

html[data-client-surface="vk-desktop"] .header-frame,
html[data-client-surface="web"] .header-frame {
  grid-template-columns: minmax(180px, 220px) minmax(272px, 1fr) minmax(230px, 350px);
  min-height: 96px;
}

html[data-client-surface="vk-desktop"] .profile-summary,
html[data-client-surface="web"] .profile-summary {
  min-height: 96px;
  padding: 8px 10px;
}

html[data-client-surface="vk-desktop"] .portrait-medallion,
html[data-client-surface="web"] .portrait-medallion {
  width: 82px;
  height: 82px;
}

html[data-client-surface="vk-desktop"] .portrait-medallion img,
html[data-client-surface="web"] .portrait-medallion img {
  width: 74px;
  height: 74px;
}

html[data-client-surface="vk-desktop"] .reference-tabs,
html[data-client-surface="web"] .reference-tabs,
html[data-client-surface="vk-desktop"] .resource-strip,
html[data-client-surface="web"] .resource-strip {
  padding-block: 8px;
}

html[data-client-surface="vk-desktop"] .reference-tab,
html[data-client-surface="web"] .reference-tab {
  gap: 5px;
  padding-block: 5px;
}

html[data-client-surface="vk-desktop"] .reference-tab svg,
html[data-client-surface="web"] .reference-tab svg {
  width: 23px;
  height: 23px;
}

html[data-client-surface="vk-desktop"] .reference-main,
html[data-client-surface="web"] .reference-main {
  grid-template-columns: 230px minmax(0, 1fr) minmax(250px, 290px);
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  margin-top: 7px;
}

html[data-client-surface="vk-desktop"] .equipment-rail,
html[data-client-surface="web"] .equipment-rail,
html[data-client-surface="vk-desktop"] .detail-panel,
html[data-client-surface="web"] .detail-panel {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

html[data-client-surface="vk-desktop"] .gear-grid,
html[data-client-surface="web"] .gear-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 8px 0 6px;
}

html[data-client-surface="vk-desktop"] .gear-slot,
html[data-client-surface="web"] .gear-slot {
  min-height: 64px;
  gap: 3px;
  padding: 4px 2px;
}

html[data-client-surface="vk-desktop"] .inventory-board,
html[data-client-surface="web"] .inventory-board {
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

html[data-client-surface="vk-desktop"] .inventory-grid,
html[data-client-surface="web"] .inventory-grid {
  grid-template-columns: repeat(auto-fill, var(--inventory-cell-width));
  height: 100%;
  min-height: 0;
  max-height: none;
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
}

html[data-client-surface="vk-desktop"] .detail-stage,
html[data-client-surface="web"] .detail-stage {
  min-height: clamp(180px, 24vh, 210px);
}

html[data-client-surface="vk-desktop"] .detail-art,
html[data-client-surface="web"] .detail-art {
  width: min(150px, 58%);
}

/* В мобильном VK дерево открывалось внутри той же оболочки, а не уводило
   пользователя на отдельную вкладку сайта. Оверлей не анимировался намеренно:
   переход оставался мгновенным и не конфликтовал с навигацией VK. */
.reference-app.is-skill-tree-route-hidden {
  visibility: hidden;
  pointer-events: none;
}

.navia-embedded-skill-tree {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  border: 0;
  background: var(--hf-bg);
}

html[data-client-surface="vk-desktop"] .reference-main {
  grid-template-columns: 230px minmax(0, 1fr) minmax(230px, 270px);
}

html[data-client-surface="vk-desktop"] .equipment-rail {
  padding-top: 10px;
}

html[data-client-surface="vk-desktop"] .equipment-heading {
  display: none;
}

html[data-client-surface="vk-desktop"] .rail-borderline {
  margin-top: -8px;
}

html[data-client-surface="vk-desktop"] .detail-stage {
  min-height: clamp(155px, 24vh, 190px);
}

html[data-client-surface="vk-desktop"] .detail-art {
  width: min(136px, 56%);
}

/* На ПК правая карточка занимала только место своего содержимого.
   Освободившаяся ширина оставалась сетке, поэтому дополнительные слоты были
   видны без уменьшения фиксированного размера предметов. */
html[data-client-surface="vk-desktop"] .detail-panel,
html[data-client-surface="web"] .detail-panel {
  align-self: start;
  box-sizing: border-box;
  height: fit-content;
  max-height: 100%;
  padding: 10px 10px 12px;
}

html[data-client-surface="vk-desktop"] .detail-panel > *,
html[data-client-surface="web"] .detail-panel > * {
  min-width: 0;
  max-width: 100%;
}

html[data-client-surface="vk-desktop"] .detail-stage,
html[data-client-surface="web"] .detail-stage {
  min-width: 0;
  padding: 9px;
}

html[data-client-surface="vk-desktop"] .detail-nameplate,
html[data-client-surface="web"] .detail-nameplate {
  right: 8px;
  bottom: 8px;
  left: 8px;
  grid-template-columns: 20px minmax(0, 1fr);
  column-gap: 6px;
  padding: 7px 8px 0;
}

html[data-client-surface="vk-desktop"] .detail-nameplate h2,
html[data-client-surface="web"] .detail-nameplate h2 {
  display: -webkit-box;
  min-width: 0;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

html[data-client-surface="vk-desktop"] .detail-nameplate p,
html[data-client-surface="web"] .detail-nameplate p {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

html[data-client-surface="vk-desktop"] .detail-borderline,
html[data-client-surface="web"] .detail-borderline {
  width: min(calc(100% - 12px), 270px);
  height: auto;
  flex: 0 0 auto;
  margin: -3px auto -4px;
}

html[data-client-surface="vk-desktop"] .detail-description,
html[data-client-surface="web"] .detail-description {
  min-height: 0;
  margin: 0;
  padding: 8px 10px 7px;
  overflow-wrap: anywhere;
}

html[data-client-surface="vk-desktop"] .detail-quantity,
html[data-client-surface="web"] .detail-quantity {
  min-width: 0;
  margin-top: 0;
  padding: 8px 10px 0;
}

html[data-client-surface="vk-desktop"] .detail-quantity > *,
html[data-client-surface="web"] .detail-quantity > * {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* В настольной версии VK Mini App инвентарь оставался квадратным, как на
   телефоне: фиксированный трек сохранял размер слота, а лишние строки
   прокручивались внутри сетки вместо сжатия карточек. */
html[data-client-surface="vk-desktop"] .inventory-grid {
  --inventory-cell-width: 80px;
  --inventory-cell-height: 80px;
  grid-template-columns: repeat(auto-fill, var(--inventory-cell-width));
  grid-auto-rows: var(--inventory-cell-height);
  justify-content: center;
  gap: 6px;
  padding: 4px 6px 14px;
}

html[data-client-surface="vk-desktop"] .item-card-slot {
  --square-frame-image: url("./derived-assets/ui/gear-slot-common.png");
  position: relative;
  width: var(--inventory-cell-width);
  min-width: var(--inventory-cell-width);
  min-height: var(--inventory-cell-height);
  height: var(--inventory-cell-height);
  aspect-ratio: 1;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  background-image: none;
  box-shadow: none;
  transform-origin: center;
  transition: none;
}

/* Рамка живёт отдельным прозрачным слоем: масштабируется только PNG, а
   положение самой ячейки и её область наведения остаются неподвижными. */
html[data-client-surface="vk-desktop"] .item-card-slot::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  content: "";
  background-image: var(--square-frame-image);
  background-position: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  border: 0;
  clip-path: none;
  transform-origin: center;
  transition: transform .18s ease, filter .18s ease;
}

html[data-client-surface="vk-desktop"] .item-card-slot::after {
  display: none;
  content: none;
}

html[data-client-surface="vk-desktop"] .item-card-slot[data-rarity="common"] {
  --square-frame-image: url("./derived-assets/ui/gear-slot-common.png");
}

html[data-client-surface="vk-desktop"] .item-card-slot[data-rarity="uncommon"] {
  --square-frame-image: url("./derived-assets/ui/gear-slot-uncommon.png");
}

html[data-client-surface="vk-desktop"] .item-card-slot[data-rarity="rare"] {
  --square-frame-image: url("./derived-assets/ui/gear-slot-rare.png");
}

html[data-client-surface="vk-desktop"] .item-card-slot[data-rarity="epic"] {
  --square-frame-image: url("./derived-assets/ui/gear-slot-epic.png");
}

html[data-client-surface="vk-desktop"] .item-card-slot[data-rarity="special"],
html[data-client-surface="vk-desktop"] .item-card-slot[data-rarity="legendary"] {
  --square-frame-image: url("./derived-assets/ui/gear-slot-special.png");
}

html[data-client-surface="vk-desktop"] .item-card-slot.is-empty {
  --square-frame-image: url("./derived-assets/ui/gear-slot-common.png");
  opacity: .42;
}

html[data-client-surface="vk-desktop"] .item-card-slot.is-locked {
  --square-frame-image: url("./derived-assets/ui/gear-slot-locked.png");
  opacity: .5;
}

html[data-client-surface="vk-desktop"] .item-card-slot:hover,
html[data-client-surface="vk-desktop"] .item-card-slot[aria-selected="true"] {
  background-color: transparent;
  box-shadow: none;
  filter: none;
  transform: none;
  z-index: 4;
}

html[data-client-surface="vk-desktop"] .item-card-slot:hover::before,
html[data-client-surface="vk-desktop"] .item-card-slot[aria-selected="true"]::before {
  transform: scale(1.025);
  filter: drop-shadow(0 0 5px rgba(240, 200, 121, .78));
}

html[data-client-surface="vk-desktop"] .item-card-slot.is-empty:hover,
html[data-client-surface="vk-desktop"] .item-card-slot.is-empty-rarity:hover,
html[data-client-surface="vk-desktop"] .item-card-slot.is-locked:hover,
html[data-client-surface="vk-desktop"] .item-card-slot.is-locked-card:hover {
  background-color: transparent;
  box-shadow: none;
  filter: none;
  transform: none;
  z-index: 4;
}

html[data-client-surface="vk-desktop"] .item-card-slot.is-empty:hover::before,
html[data-client-surface="vk-desktop"] .item-card-slot.is-empty-rarity:hover::before,
html[data-client-surface="vk-desktop"] .item-card-slot.is-locked:hover::before,
html[data-client-surface="vk-desktop"] .item-card-slot.is-locked-card:hover::before {
  transform: scale(1.025);
  filter: drop-shadow(0 0 4px rgba(240, 200, 121, .42));
}

html[data-client-surface="vk-desktop"] .item-card-slot .item-card-frame,
html[data-client-surface="vk-desktop"] .item-card-slot .item-card-label-region {
  display: none !important;
}

html[data-client-surface="vk-desktop"] .item-card-slot .item-card-art-region {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

html[data-client-surface="vk-desktop"] .item-card-slot .slot-art {
  display: flex;
  width: 66%;
  height: 66%;
  align-items: center;
  justify-content: center;
}

html[data-client-surface="vk-desktop"] .item-card-slot .slot-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

html[data-client-surface="vk-desktop"] .item-card-slot .item-card-count-region {
  position: absolute;
  right: 3px;
  bottom: 3px;
  z-index: 3;
}

html[data-client-surface="vk-desktop"] .item-card-slot .slot-quantity {
  position: static;
  min-width: auto;
  padding: 1px 4px;
  border: 1px solid rgba(211, 170, 100, .7);
  border-radius: 3px;
  color: var(--hf-ink);
  background: rgba(8, 10, 9, .92);
  font: 700 9px/1 var(--hf-mono);
}

html[data-client-surface="vk-desktop"] .item-card-slot .rarity-icon {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 3;
  width: 14px;
  height: 14px;
}

/* В настольном VK карточка перестраивалась независимо от ширины iframe:
   оболочка VK могла масштабировать приложение и сообщать ему больше CSS-пикселей,
   чем оставалось на экране. Постоянный контракт не зависел от этого масштаба. */
html[data-client-surface="vk-desktop"] .header-frame {
  grid-template-columns: minmax(170px, 200px) minmax(230px, 1fr) minmax(200px, 280px);
  min-height: 90px;
}

html[data-client-surface="vk-desktop"] .reference-main {
  grid-template-columns: 210px minmax(0, 1fr) 200px;
  grid-template-rows: none;
  gap: 6px;
}

html[data-client-surface="vk-desktop"] .equipment-rail {
  grid-column: 1;
  border-right: 1px solid var(--hf-line);
  border-bottom: 0;
  padding: 8px 6px;
}

html[data-client-surface="vk-desktop"] .inventory-board {
  grid-column: 2;
}

html[data-client-surface="vk-desktop"] .gear-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  padding: 6px 0 4px;
}

html[data-client-surface="vk-desktop"] .gear-slot {
  min-height: 56px;
}

/* Резная кайма не нависает над ячейками */
html[data-client-surface="vk-desktop"] .inventory-borderline,
html[data-client-surface="web"] .inventory-borderline {
  width: min(calc(100% - 20px), 340px);
  height: 24px;
  margin: 2px auto 6px;
  object-fit: contain;
}

html[data-client-surface="vk-desktop"] .inventory-grid {
  gap: 6px;
  padding: 4px 6px 14px;
}

html[data-client-surface="vk-desktop"] .detail-panel {
  grid-column: 3;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: 10px 10px 12px;
  background: linear-gradient(160deg, rgba(147, 96, 36, .11), transparent 37%), var(--hf-wood);
  border: 1px solid var(--hf-line);
}

html[data-client-surface="vk-desktop"] .detail-stage {
  flex: 0 0 auto;
  min-height: 140px;
  padding: 8px;
  display: grid;
  grid-template-rows: auto auto;
  place-items: center;
  gap: 6px;
}

html[data-client-surface="vk-desktop"] .detail-art {
  width: 88px;
  height: 88px;
  justify-self: center;
}

html[data-client-surface="vk-desktop"] .detail-nameplate {
  position: static;
  width: 100%;
  justify-self: stretch;
  grid-template-columns: 18px minmax(0, 1fr);
  column-gap: 5px;
  align-items: start;
  padding: 6px 4px 0;
  background: none;
}

html[data-client-surface="vk-desktop"] .detail-nameplate h2 {
  font-size: 15px;
  line-height: 1.15;
  text-align: center;
}

html[data-client-surface="vk-desktop"] .detail-nameplate p {
  font-size: 10px;
  letter-spacing: .08em;
  color: var(--hf-gold);
  text-align: center;
}

html[data-client-surface="vk-desktop"] .rarity-mark {
  width: 18px;
  min-height: 28px;
}

html[data-client-surface="vk-desktop"] .detail-rarity-icon {
  width: 16px;
  height: 27px;
}

html[data-client-surface="vk-desktop"] .detail-borderline {
  width: calc(100% - 8px);
  height: 22px;
  margin: 0 auto;
  object-fit: contain;
}

html[data-client-surface="vk-desktop"] .detail-description {
  flex: 1 1 auto;
  font-size: 12px;
  line-height: 1.4;
  padding: 8px 4px 6px;
  color: var(--hf-ink);
  overflow-y: auto;
}

html[data-client-surface="vk-desktop"] .detail-quantity {
  flex: 0 0 auto;
  font-size: 12px;
  padding: 8px 4px 0;
  border-top: 1px solid rgba(210, 168, 97, .25);
}

/* Общая мобильная информационная архитектура: один раздел за раз, нижняя
   навигация и отдельная карточка предмета вместо трёх сжатых колонок. */
html[data-client-surface="vk-mobile"] .reference-app,
html[data-client-surface="mobile-web"] .reference-app {
  width: 100%;
  max-width: none;
  padding-right: 0;
  padding-left: 0;
  padding-bottom: calc(64px + var(--hf-safe-bottom));
}

html[data-client-surface="vk-mobile"] .reference-frame,
html[data-client-surface="mobile-web"] .reference-frame {
  border-right: 0;
  border-left: 0;
}

html[data-client-surface="vk-mobile"] .header-frame,
html[data-client-surface="mobile-web"] .header-frame {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
}

html[data-client-surface="vk-mobile"] .profile-summary,
html[data-client-surface="mobile-web"] .profile-summary {
  min-height: 82px;
  padding: 8px 14px;
  border-right: 0;
  border-bottom: 1px solid var(--hf-line);
}

html[data-client-surface="vk-mobile"] .portrait-medallion,
html[data-client-surface="mobile-web"] .portrait-medallion {
  width: 66px;
  height: 66px;
}

html[data-client-surface="vk-mobile"] .portrait-medallion img,
html[data-client-surface="mobile-web"] .portrait-medallion img {
  width: 60px;
  height: 60px;
}

html[data-client-surface="vk-mobile"] .profile-meters,
html[data-client-surface="mobile-web"] .profile-meters {
  max-width: none;
  gap: 7px;
}

html[data-client-surface="vk-mobile"] .reference-tabs,
html[data-client-surface="mobile-web"] .reference-tabs {
  display: none;
}

html[data-client-surface="vk-mobile"] .resource-strip,
html[data-client-surface="mobile-web"] .resource-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-height: 48px;
  gap: 5px;
  padding: 6px 8px;
}

html[data-client-surface="vk-mobile"] .resource-cell,
html[data-client-surface="mobile-web"] .resource-cell {
  display: flex;
  min-height: 36px;
  justify-content: center;
  gap: 6px;
  padding: 5px;
}

html[data-client-surface="vk-mobile"] .resource-icon,
html[data-client-surface="mobile-web"] .resource-icon {
  width: 18px;
  height: auto;
  font-size: 19px;
  line-height: 1;
  text-align: center;
}

html[data-client-surface="vk-mobile"] .reference-main,
html[data-client-surface="mobile-web"] .reference-main {
  display: block;
  width: 100%;
  min-height: 0;
  margin-top: 6px;
  overflow: visible;
}

html[data-client-surface="vk-mobile"] .equipment-rail,
html[data-client-surface="vk-mobile"] .inventory-board,
html[data-client-surface="mobile-web"] .equipment-rail,
html[data-client-surface="mobile-web"] .inventory-board {
  width: 100%;
  border-right: 0;
  border-left: 0;
}

html[data-client-surface="vk-mobile"] .reference-app[data-active-view="inventory"] .equipment-rail,
html[data-client-surface="mobile-web"] .reference-app[data-active-view="inventory"] .equipment-rail,
html[data-client-surface="vk-mobile"] .reference-app[data-active-view="profile"] .inventory-board,
html[data-client-surface="mobile-web"] .reference-app[data-active-view="profile"] .inventory-board,
html[data-client-surface="vk-mobile"] .reference-app[data-active-view="equipment"] .inventory-board,
html[data-client-surface="mobile-web"] .reference-app[data-active-view="equipment"] .inventory-board {
  display: none;
}

html[data-client-surface="vk-mobile"] .equipment-rail,
html[data-client-surface="mobile-web"] .equipment-rail {
  padding: 16px 12px 20px;
}

html[data-client-surface="vk-mobile"] .character-stats,
html[data-client-surface="mobile-web"] .character-stats {
  padding-inline: 2px;
}

html[data-client-surface="vk-mobile"] .gear-grid,
html[data-client-surface="mobile-web"] .gear-grid {
  grid-template-columns: repeat(3, minmax(0, 104px));
  justify-content: center;
  gap: 8px;
  padding: 10px 4px 0;
}

html[data-client-surface="vk-mobile"] .gear-slot,
html[data-client-surface="mobile-web"] .gear-slot {
  min-height: 0;
  aspect-ratio: 1;
}

html[data-client-surface="vk-mobile"] .category-tabs,
html[data-client-surface="mobile-web"] .category-tabs {
  min-height: 50px;
  padding: 5px 8px 0;
  overflow-x: auto;
  scrollbar-width: none;
}

html[data-client-surface="vk-mobile"] .category-tab,
html[data-client-surface="mobile-web"] .category-tab {
  min-width: 48px;
  min-height: 44px;
  flex: 1 0 48px;
}

html[data-client-surface="vk-mobile"] .category-next,
html[data-client-surface="mobile-web"] .category-next {
  min-width: 44px;
  min-height: 44px;
  flex-basis: 44px;
}

html[data-client-surface="vk-mobile"] .inventory-heading,
html[data-client-surface="mobile-web"] .inventory-heading {
  align-items: center;
  flex-direction: row;
  padding: 10px 13px 11px;
}

html[data-client-surface="vk-mobile"] .inventory-grid,
html[data-client-surface="mobile-web"] .inventory-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: auto;
  grid-auto-flow: row;
  align-items: start;
  justify-content: stretch;
  gap: 8px;
  padding: 8px 8px 16px;
}

html[data-client-surface="vk-mobile"] .item-card-slot,
html[data-client-surface="mobile-web"] .item-card-slot {
  --square-frame-image: url("./derived-assets/ui/gear-slot-common.png");
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: auto;
  aspect-ratio: auto;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  background-image: none;
  box-shadow: none;
  transform-origin: center;
  transition: none;
}

html[data-client-surface="vk-mobile"] .stat-value-control,
html[data-client-surface="mobile-web"] .stat-value-control {
  gap: 6px;
  overflow: visible;
}

html[data-client-surface="vk-mobile"] .attribute-upgrade,
html[data-client-surface="mobile-web"] .attribute-upgrade {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  font-size: 18px;
}

@media (hover: none), (pointer: coarse) {
  html[data-client-surface="vk-mobile"] .item-card-slot:hover::before,
  html[data-client-surface="vk-mobile"] .item-card-slot[aria-selected="true"]::before,
  html[data-client-surface="mobile-web"] .item-card-slot:hover::before,
  html[data-client-surface="mobile-web"] .item-card-slot[aria-selected="true"]::before,
  html[data-client-surface="vk-mobile"] .item-card-slot:hover .item-card-visual,
  html[data-client-surface="vk-mobile"] .item-card-slot[aria-selected="true"] .item-card-visual,
  html[data-client-surface="mobile-web"] .item-card-slot:hover .item-card-visual,
  html[data-client-surface="mobile-web"] .item-card-slot[aria-selected="true"] .item-card-visual {
    transform: none;
  }
}

/* На мобильных поверхностях масштабируется только слой PNG-рамки. */
html[data-client-surface="vk-mobile"] .item-card-slot::before,
html[data-client-surface="mobile-web"] .item-card-slot::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  content: "";
  background-image: var(--square-frame-image);
  background-position: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  border: 0;
  clip-path: none;
  transform-origin: center;
  transition: transform .18s ease, filter .18s ease;
}

html[data-client-surface="vk-mobile"] .item-card-slot::after,
html[data-client-surface="mobile-web"] .item-card-slot::after {
  position: static;
  display: block;
  width: 100%;
  padding-top: 100%;
  content: "";
  visibility: hidden;
  pointer-events: none;
}

html[data-client-surface="vk-mobile"] .item-card-slot[data-rarity="common"],
html[data-client-surface="mobile-web"] .item-card-slot[data-rarity="common"] {
  --square-frame-image: url("./derived-assets/ui/gear-slot-common.png");
}

html[data-client-surface="vk-mobile"] .item-card-slot[data-rarity="uncommon"],
html[data-client-surface="mobile-web"] .item-card-slot[data-rarity="uncommon"] {
  --square-frame-image: url("./derived-assets/ui/gear-slot-uncommon.png");
}

html[data-client-surface="vk-mobile"] .item-card-slot[data-rarity="rare"],
html[data-client-surface="mobile-web"] .item-card-slot[data-rarity="rare"] {
  --square-frame-image: url("./derived-assets/ui/gear-slot-rare.png");
}

html[data-client-surface="vk-mobile"] .item-card-slot[data-rarity="epic"],
html[data-client-surface="mobile-web"] .item-card-slot[data-rarity="epic"] {
  --square-frame-image: url("./derived-assets/ui/gear-slot-epic.png");
}

html[data-client-surface="vk-mobile"] .item-card-slot[data-rarity="special"],
html[data-client-surface="vk-mobile"] .item-card-slot[data-rarity="legendary"],
html[data-client-surface="mobile-web"] .item-card-slot[data-rarity="special"],
html[data-client-surface="mobile-web"] .item-card-slot[data-rarity="legendary"] {
  --square-frame-image: url("./derived-assets/ui/gear-slot-special.png");
}

html[data-client-surface="vk-mobile"] .item-card-slot.is-empty,
html[data-client-surface="mobile-web"] .item-card-slot.is-empty {
  --square-frame-image: url("./derived-assets/ui/gear-slot-common.png");
  opacity: .42;
}

html[data-client-surface="vk-mobile"] .item-card-slot.is-locked,
html[data-client-surface="mobile-web"] .item-card-slot.is-locked {
  --square-frame-image: url("./derived-assets/ui/gear-slot-locked.png");
  opacity: .5;
}

html[data-client-surface="vk-mobile"] .item-card-slot[aria-selected="true"],
html[data-client-surface="mobile-web"] .item-card-slot[aria-selected="true"] {
  background-color: transparent;
  border-radius: 0;
  box-shadow: none;
  filter: none;
  transform: none;
  outline: none;
  z-index: 4;
}

html[data-client-surface="vk-mobile"] .item-card-slot:hover,
html[data-client-surface="mobile-web"] .item-card-slot:hover {
  background-color: transparent;
  border-radius: 0;
  box-shadow: none;
  filter: none;
  transform: none;
  z-index: 4;
}

html[data-client-surface="vk-mobile"] .item-card-slot:hover::before,
html[data-client-surface="vk-mobile"] .item-card-slot[aria-selected="true"]::before,
html[data-client-surface="mobile-web"] .item-card-slot:hover::before,
html[data-client-surface="mobile-web"] .item-card-slot[aria-selected="true"]::before {
  transform: scale(1.025);
  filter: drop-shadow(0 0 5px rgba(240, 200, 121, .78));
}

html[data-client-surface="vk-mobile"] .item-card-slot.is-empty:hover,
html[data-client-surface="vk-mobile"] .item-card-slot.is-empty-rarity:hover,
html[data-client-surface="vk-mobile"] .item-card-slot.is-locked:hover,
html[data-client-surface="vk-mobile"] .item-card-slot.is-locked-card:hover,
html[data-client-surface="mobile-web"] .item-card-slot.is-empty:hover,
html[data-client-surface="mobile-web"] .item-card-slot.is-empty-rarity:hover,
html[data-client-surface="mobile-web"] .item-card-slot.is-locked:hover,
html[data-client-surface="mobile-web"] .item-card-slot.is-locked-card:hover {
  background-color: transparent;
  box-shadow: none;
  filter: none;
  transform: none;
  z-index: 4;
}

html[data-client-surface="vk-mobile"] .item-card-slot.is-empty:hover::before,
html[data-client-surface="vk-mobile"] .item-card-slot.is-empty-rarity:hover::before,
html[data-client-surface="vk-mobile"] .item-card-slot.is-locked:hover::before,
html[data-client-surface="vk-mobile"] .item-card-slot.is-locked-card:hover::before,
html[data-client-surface="mobile-web"] .item-card-slot.is-empty:hover::before,
html[data-client-surface="mobile-web"] .item-card-slot.is-empty-rarity:hover::before,
html[data-client-surface="mobile-web"] .item-card-slot.is-locked:hover::before,
html[data-client-surface="mobile-web"] .item-card-slot.is-locked-card:hover::before {
  transform: scale(1.025);
  filter: drop-shadow(0 0 4px rgba(240, 200, 121, .42));
}

html[data-client-surface="vk-mobile"] .item-card-slot .item-card-frame,
html[data-client-surface="mobile-web"] .item-card-slot .item-card-frame {
  display: none !important;
}

html[data-client-surface="vk-mobile"] .item-card-slot .item-card-label-region,
html[data-client-surface="mobile-web"] .item-card-slot .item-card-label-region {
  display: none !important;
}

html[data-client-surface="vk-mobile"] .item-card-slot .item-card-art-region,
html[data-client-surface="mobile-web"] .item-card-slot .item-card-art-region {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

html[data-client-surface="vk-mobile"] .item-card-slot .slot-art,
html[data-client-surface="mobile-web"] .item-card-slot .slot-art {
  display: flex;
  width: 66%;
  height: 66%;
  align-items: center;
  justify-content: center;
}

html[data-client-surface="vk-mobile"] .item-card-slot .slot-art img,
html[data-client-surface="mobile-web"] .item-card-slot .slot-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

html[data-client-surface="vk-mobile"] .item-card-slot .slot-art-monogram,
html[data-client-surface="mobile-web"] .item-card-slot .slot-art-monogram {
  font: 700 18px/1 var(--hf-serif);
  color: var(--hf-gold-bright);
  opacity: .85;
  text-shadow: 0 0 8px rgba(229, 171, 71, .5);
}

html[data-client-surface="vk-mobile"] .item-card-slot .item-card-count-region,
html[data-client-surface="mobile-web"] .item-card-slot .item-card-count-region {
  position: absolute;
  right: 3px;
  bottom: 3px;
  z-index: 3;
}

html[data-client-surface="vk-mobile"] .item-card-slot .slot-quantity,
html[data-client-surface="mobile-web"] .item-card-slot .slot-quantity {
  position: static;
  min-width: auto;
  padding: 1px 4px;
  border: 1px solid rgba(211, 170, 100, .7);
  border-radius: 3px;
  color: var(--hf-ink);
  background: rgba(8, 10, 9, .92);
  font: 700 9px/1 var(--hf-mono);
}

html[data-client-surface="vk-mobile"] .item-card-slot .rarity-icon,
html[data-client-surface="mobile-web"] .item-card-slot .rarity-icon {
  position: absolute;
  top: 3px;
  left: 3px;
  z-index: 3;
  width: 12px;
  height: 12px;
}

html[data-client-surface="vk-mobile"] .inventory-borderline,
html[data-client-surface="mobile-web"] .inventory-borderline {
  width: min(calc(100% - 24px), 340px);
  height: 24px;
  margin: 2px auto 8px;
  object-fit: contain;
}

html[data-client-surface="vk-mobile"] .inventory-footer,
html[data-client-surface="mobile-web"] .inventory-footer {
  padding-inline: 12px;
}

html[data-client-surface="vk-mobile"] .mobile-reference-nav,
html[data-client-surface="mobile-web"] .mobile-reference-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  min-height: calc(58px + var(--hf-safe-bottom));
  padding-bottom: var(--hf-safe-bottom);
  border-top: 1px solid var(--hf-line);
  background: rgba(10, 13, 12, .97);
  box-shadow: 0 -10px 25px rgba(0, 0, 0, .42);
  backdrop-filter: blur(12px);
}

html[data-client-surface="vk-mobile"] .mobile-reference-nav button,
html[data-client-surface="vk-mobile"] .mobile-reference-nav a,
html[data-client-surface="mobile-web"] .mobile-reference-nav button,
html[data-client-surface="mobile-web"] .mobile-reference-nav a {
  display: grid;
  min-width: 0;
  min-height: 52px;
  place-items: center;
  align-content: center;
  gap: 4px;
  border: 0;
  color: var(--hf-muted);
  background: transparent;
  cursor: pointer;
  text-decoration: none;
}

html[data-client-surface="vk-mobile"] .mobile-reference-nav .is-active,
html[data-client-surface="mobile-web"] .mobile-reference-nav .is-active {
  color: var(--hf-gold-bright);
  background: linear-gradient(180deg, rgba(151, 101, 41, .08), rgba(151, 101, 41, .22));
}

html[data-client-surface="vk-mobile"] .mobile-reference-nav svg,
html[data-client-surface="mobile-web"] .mobile-reference-nav svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

html[data-client-surface="vk-mobile"] .mobile-reference-nav span,
html[data-client-surface="mobile-web"] .mobile-reference-nav span {
  font: 700 8px/1 var(--hf-mono);
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* Карточка выбранного предмета становилась управляемым нижним листом, а не
   третьей узкой колонкой. */
html[data-client-surface="vk-mobile"] .detail-scrim,
html[data-client-surface="mobile-web"] .detail-scrim {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: block;
  border: 0;
  background: rgba(3, 4, 4, .72);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity .18s ease;
}

html[data-client-surface="vk-mobile"] .detail-panel,
html[data-client-surface="mobile-web"] .detail-panel {
  position: fixed;
  right: 8px;
  bottom: calc(58px + var(--hf-safe-bottom));
  left: 8px;
  z-index: 71;
  display: flex;
  width: auto;
  max-height: min(78dvh, 680px);
  padding: 12px 12px 16px;
  border: 1px solid var(--hf-gold-soft);
  overflow-x: hidden;
  overflow-y: auto;
  box-shadow: 0 -20px 55px rgba(0, 0, 0, .65);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transform: translateY(calc(100% + 72px));
  transition: transform .24s cubic-bezier(.2, .75, .2, 1), opacity .18s ease, visibility 0s linear .24s;
}

html[data-client-surface="vk-mobile"] .reference-app[data-detail-open="true"] .detail-scrim,
html[data-client-surface="mobile-web"] .reference-app[data-detail-open="true"] .detail-scrim {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

html[data-client-surface="vk-mobile"] .reference-app[data-detail-open="true"] .detail-panel,
html[data-client-surface="mobile-web"] .reference-app[data-detail-open="true"] .detail-panel {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transform: translateY(0);
  transition-delay: 0s;
}

html[data-client-surface="vk-mobile"] .detail-close,
html[data-client-surface="mobile-web"] .detail-close {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  margin: 0 0 -38px auto;
  place-items: center;
  border: 1px solid var(--hf-gold-soft);
  border-radius: 50%;
  color: var(--hf-gold-bright);
  background: rgba(13, 16, 15, .95);
  font: 25px/1 var(--hf-serif);
  cursor: pointer;
}

html[data-client-surface="vk-mobile"] .detail-stage,
html[data-client-surface="mobile-web"] .detail-stage {
  min-height: clamp(230px, 42dvh, 340px);
}

html[data-client-surface="vk-mobile"] .detail-art,
html[data-client-surface="mobile-web"] .detail-art {
  width: min(190px, 58vw);
}

/* VK Mini App: мобильная оболочка. Высоту занимал ровно один app-viewport,
   поэтому прокручивался активный раздел, а не весь iframe. */
html[data-client-surface="vk-mobile"],
html[data-client-surface="vk-mobile"] body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}

html[data-client-surface="vk-mobile"] .reference-app {
  display: flex;
  height: 100dvh;
  min-height: 0;
  flex-direction: column;
  padding-top: var(--hf-safe-top);
}

html[data-client-surface="vk-mobile"] .reference-header,
html[data-client-surface="vk-mobile"] .profile-status {
  flex: 0 0 auto;
}

html[data-client-surface="vk-mobile"] .profile-status {
  margin: 0;
  border-right: 0;
  border-left: 0;
}

html[data-client-surface="vk-mobile"] .reference-main {
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

html[data-client-surface="vk-mobile"] .equipment-rail,
html[data-client-surface="vk-mobile"] .inventory-board {
  height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

html[data-client-surface="vk-mobile"] .inventory-board {
  display: flex;
}

html[data-client-surface="vk-mobile"] .inventory-grid {
  height: auto;
  min-height: 0;
  max-height: none;
  flex: 1 1 auto;
  overflow-y: auto;
}

/* Обычный мобильный браузер сохранял естественную прокрутку страницы: адресная
   строка могла менять высоту viewport, не обрезая нижние предметы. */
html[data-client-surface="mobile-web"] body {
  overflow-x: hidden;
  overflow-y: auto;
}

html[data-client-surface="mobile-web"] .inventory-grid {
  height: auto;
  min-height: 0;
  max-height: none;
  overflow: visible;
}

@media (max-width: 360px) {
  html[data-client-surface="vk-mobile"] .profile-summary,
  html[data-client-surface="mobile-web"] .profile-summary {
    padding-inline: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-client-surface="vk-mobile"] .detail-panel,
  html[data-client-surface="mobile-web"] .detail-panel,
  html[data-client-surface="vk-mobile"] .detail-scrim,
  html[data-client-surface="mobile-web"] .detail-scrim {
    transition: none;
  }
}
