* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: system-ui, sans-serif;
  background: #0c0f14;
  color: #e8edf2;
  -webkit-tap-highlight-color: transparent;
}

/* Меньше «резинки» и сдвигов контента под шапкой Mini App после внутренних tg-ссылок (шаринг). */
body.telegram-webapp {
  overscroll-behavior-y: none;
}

/*
 * Фон «арена»: тусклый зал, лёгкий свет сверху (факелы), холодный блик у «пола» боя.
 * Включается, когда открыт экран боя (#battle не .hidden), включая пост-игру.
 */
body:has(#battle:not(.hidden)) {
  background-color: #07090e;
  background-image:
    radial-gradient(ellipse 92% 65% at 50% 46%, rgba(38, 48, 68, 0.58) 0%, transparent 62%),
    radial-gradient(ellipse 105% 50% at 50% 118%, rgba(14, 20, 32, 0.92) 0%, transparent 52%),
    radial-gradient(ellipse 85% 45% at 50% 0%, rgba(95, 72, 48, 0.16) 0%, transparent 48%),
    radial-gradient(ellipse 50% 38% at 10% 92%, rgba(70, 110, 150, 0.09) 0%, transparent 55%),
    radial-gradient(ellipse 50% 38% at 90% 92%, rgba(130, 75, 85, 0.08) 0%, transparent 55%),
    repeating-linear-gradient(
      -16deg,
      transparent,
      transparent 5px,
      rgba(255, 255, 255, 0.016) 5px,
      rgba(255, 255, 255, 0.016) 6px
    ),
    linear-gradient(168deg, #141b26 0%, #0d1119 40%, #080b10 100%);
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, repeat, no-repeat;
}

/* Во время drag на телефоне блокируем скролл */
body.is-dragging {
  overscroll-behavior: none;
  touch-action: none;
}

.attack-arrow {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 2100;
  opacity: 0;
  transition: opacity 80ms linear;
}

/* Прицел соперника (ещё не отпустил атаку): под вашей стрелой, приглушённый */
.attack-arrow--peer-aim {
  z-index: 2085;
}

.attack-arrow--peer-aim.show {
  opacity: 0.88;
}

.attack-arrow--peer-aim path.trail-shadow,
.attack-arrow--peer-aim path.trail-bright {
  stroke-dasharray: 11 7;
  stroke-linecap: round;
}

.attack-arrow.show {
  opacity: 1;
}

.attack-arrow--orc .trail-bright {
  filter: drop-shadow(0 0 6px rgba(255, 110, 60, 0.55));
}

.attack-arrow--elf .trail-bright {
  filter: drop-shadow(0 0 5px rgba(100, 210, 255, 0.5));
}

/* Кривая трасса прицела (атака / магия) */
.spell-trail {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 2095;
  opacity: 0;
  transition: opacity 80ms linear;
}

.spell-trail.show {
  opacity: 1;
}

.spell-trail .trail-shadow {
  filter: blur(0.3px);
}

.spell-trail .trail-bright {
  filter: drop-shadow(0 0 4px rgba(120, 200, 255, 0.45));
}

/* Прицел заклинания соперника — иная палитра, чем у атаки и своей магии */
.spell-trail--peer-aim {
  z-index: 2082;
}

.spell-trail--peer-aim.show {
  opacity: 0.9;
}

.spell-trail--peer-aim .trail-shadow {
  filter: blur(0.35px);
}

.spell-trail--peer-aim .trail-bright {
  filter: drop-shadow(0 0 5px rgba(200, 140, 255, 0.55));
}

.spell-trail--peer-aim path.trail-shadow,
.spell-trail--peer-aim path.trail-bright {
  stroke-dasharray: 11 7;
  stroke-linecap: round;
}

/* Вспышка при «попадании» (отпускание на цели) */
.fx-impact {
  position: fixed;
  left: var(--x, 0);
  top: var(--y, 0);
  width: 96px;
  height: 96px;
  margin-left: -48px;
  margin-top: -48px;
  pointer-events: none;
  z-index: 2150;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 230, 180, 0.55) 0%,
    rgba(255, 140, 90, 0.22) 42%,
    transparent 72%
  );
  opacity: 0;
  transform: scale(0.55);
  animation: fx-impact 240ms ease-out forwards;
}

.fx-impact--spell {
  background: radial-gradient(
    circle,
    rgba(160, 220, 255, 0.5) 0%,
    rgba(100, 140, 255, 0.2) 45%,
    transparent 72%
  );
}

@keyframes fx-impact {
  0% {
    opacity: 0;
    transform: scale(0.45);
  }
  40% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.18);
  }
}

.fx-float {
  position: fixed;
  left: 0;
  top: 0;
  transform: translate(-9999px, -9999px);
  pointer-events: none;
  z-index: 2200;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  text-shadow:
    0 2px 0 rgba(0, 0, 0, 0.55),
    0 10px 18px rgba(0, 0, 0, 0.35);
  opacity: 0;
  animation: fx-float 680ms ease-out forwards;
}

.fx-float.dmg {
  color: #ff7b7b;
}

.fx-float.heal {
  color: #7ddea0;
}

@keyframes fx-float {
  0% {
    opacity: 0;
    transform: translate(var(--x), var(--y)) scale(0.9);
    filter: blur(0.2px);
  }
  20% {
    opacity: 1;
    transform: translate(var(--x), calc(var(--y) - 10px)) scale(1.05);
  }
  100% {
    opacity: 0;
    transform: translate(var(--x), calc(var(--y) - 34px)) scale(1);
  }
}

.fx-hit {
  animation: fx-hit 240ms ease-out;
}

@keyframes fx-hit {
  0% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-2px);
  }
  55% {
    transform: translateX(2px);
  }
  100% {
    transform: translateX(0);
  }
}

/* Preview near hovered target while aiming */
.fx-preview {
  position: fixed;
  left: 0;
  top: 0;
  transform: translate(-9999px, -9999px);
  pointer-events: none;
  z-index: 2250;
  padding: 0.18rem 0.35rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(232, 237, 242, 0.9);
  font-size: 0.72rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.35);
}

.fx-preview.danger {
  border-color: rgba(255, 120, 120, 0.35);
  color: rgba(255, 170, 170, 0.95);
}

/* Draw / play animations */
.fx-draw-card {
  position: fixed;
  left: 0;
  top: 0;
  width: 46px;
  height: 64px;
  border-radius: 10px;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.14), transparent 40%),
    linear-gradient(145deg, rgba(80, 140, 200, 0.35), rgba(10, 16, 24, 0.92));
  background-size: cover;
  background-position: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 18px 32px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  z-index: 48000;
  opacity: 0;
  transform: translate(var(--x1), var(--y1)) scale(0.82) rotate(-6deg);
  transition: transform 360ms cubic-bezier(0.22, 1, 0.36, 1), opacity 180ms ease-out;
}

.fx-draw-card.show {
  opacity: 1;
  transform: translate(var(--x2), var(--y2)) scale(1.05) rotate(4deg);
}

.meta-pile-stack.meta-pile-stack--draw-nudge {
  animation: deck-pile-draw-nudge 220ms ease-out;
  transform-origin: 50% 80%;
}

@keyframes deck-pile-draw-nudge {
  0% {
    transform: scale(1);
  }
  38% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
  }
}

.hand .card.card--draw-enter {
  animation: card-draw-enter-pulse 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes card-draw-enter-pulse {
  0% {
    filter: brightness(1.28) saturate(1.1);
  }
  100% {
    filter: brightness(1) saturate(1);
  }
}

/* Полная рука: карта с колоды сгорает (не попадает в руку) */
.fx-hand-burn-card {
  position: fixed;
  left: 0;
  top: 0;
  width: 50px;
  height: 69px;
  border-radius: 10px;
  border: 1px solid rgba(255, 200, 160, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 16px 32px rgba(0, 0, 0, 0.5);
  background-color: #140c0a;
  pointer-events: none;
  z-index: 48500;
  transform: translate(var(--hx1), var(--hy1)) scale(0.84) rotate(-5deg);
  opacity: 1;
  will-change: transform, filter, opacity;
}

.hand-burn-reveal {
  position: fixed;
  inset: 0;
  z-index: 26050;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms ease;
}

.hand-burn-reveal.show {
  opacity: 1;
}

.hand-burn-reveal.burnout {
  opacity: 0;
}

.hand-burn-reveal__panel {
  width: min(18rem, 86vw);
  padding: 0.8rem 0.9rem 0.95rem;
  border-radius: 18px;
  border: 1px solid rgba(110, 130, 160, 0.35);
  background: linear-gradient(165deg, rgba(18, 22, 30, 0.92) 0%, rgba(10, 12, 18, 0.95) 100%);
  box-shadow: 0 16px 46px rgba(0, 0, 0, 0.45);
  text-align: center;
}

.hand-burn-reveal__title {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 170, 120, 0.92);
  margin-bottom: 0.6rem;
}

.hand-burn-reveal__card {
  width: min(10.5rem, 62vw);
  aspect-ratio: 3 / 4;
  margin: 0 auto 0.55rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.08), transparent 50%);
  position: relative;
  overflow: hidden;
}

.hand-burn-reveal__card::before {
  content: '';
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.10), transparent 55%),
    radial-gradient(circle at 65% 18%, rgba(255, 255, 255, 0.08), transparent 58%),
    radial-gradient(circle at 50% 85%, rgba(255, 120, 70, 0.18), transparent 62%);
  opacity: 0;
  transform: scale(1.02);
  transition: opacity 160ms ease;
  pointer-events: none;
}

.hand-burn-reveal__card::after {
  content: '';
  position: absolute;
  left: -20%;
  right: -20%;
  bottom: -25%;
  height: 70%;
  background:
    radial-gradient(closest-side at 20% 90%, rgba(255, 210, 120, 0.55), transparent 60%),
    radial-gradient(closest-side at 55% 95%, rgba(255, 140, 80, 0.60), transparent 62%),
    radial-gradient(closest-side at 85% 90%, rgba(255, 90, 60, 0.50), transparent 62%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.0), rgba(0, 0, 0, 0.22));
  filter: blur(1px);
  opacity: 0;
  transform: translateY(18px) scale(1.02);
  pointer-events: none;
}

.hand-burn-reveal.show .hand-burn-reveal__card::before {
  opacity: 1;
}

.hand-burn-reveal.show .hand-burn-reveal__card::after {
  opacity: 1;
  animation: hand-burn-reveal-flame 900ms ease-in-out infinite;
}

.hand-burn-reveal.burnout .hand-burn-reveal__card {
  animation: hand-burn-reveal-burnout 1000ms ease forwards;
}

.hand-burn-reveal.burnout .hand-burn-reveal__card::after {
  animation: hand-burn-reveal-flame 320ms ease-in-out infinite;
}

@keyframes hand-burn-reveal-burnout {
  0% {
    transform: scale(1);
    filter: brightness(1) saturate(1);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
    opacity: 1;
  }
  40% {
    transform: scale(1.03);
    filter: brightness(1.25) saturate(1.2);
    box-shadow:
      inset 0 0 16px rgba(255, 140, 60, 0.35),
      0 0 34px rgba(255, 100, 40, 0.35);
    opacity: 1;
  }
  100% {
    transform: scale(0.92);
    filter: brightness(0.65) saturate(0.6) blur(0.6px);
    box-shadow:
      inset 0 0 18px rgba(255, 140, 60, 0.18),
      0 0 0 rgba(0, 0, 0, 0);
    opacity: 0;
  }
}

@keyframes hand-burn-reveal-flame {
  0% {
    transform: translateY(18px) scale(1.02);
    filter: blur(1px);
  }
  50% {
    transform: translateY(8px) scale(1.03);
    filter: blur(1.6px);
  }
  100% {
    transform: translateY(18px) scale(1.02);
    filter: blur(1px);
  }
}

.hand-burn-reveal__name {
  font-size: 0.95rem;
  font-weight: 850;
  color: rgba(240, 245, 255, 0.96);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fx-hand-burn-card.fx-hand-burn-card--run {
  animation: fx-hand-burn-flight-ash 0.95s cubic-bezier(0.25, 0.85, 0.32, 1) forwards;
}

@keyframes fx-hand-burn-flight-ash {
  0% {
    transform: translate(var(--hx1), var(--hy1)) scale(0.84) rotate(-5deg);
    filter: brightness(1) saturate(1);
    opacity: 1;
  }
  36% {
    transform: translate(var(--hx2), var(--hy2)) scale(1.02) rotate(2deg);
    filter: brightness(1) saturate(1);
    opacity: 1;
  }
  52% {
    filter: brightness(1.4) saturate(1.2);
    box-shadow:
      inset 0 0 12px rgba(255, 140, 60, 0.45),
      0 0 32px rgba(255, 100, 40, 0.55);
  }
  100% {
    transform: translate(var(--hx2), var(--hy2)) scale(0.32) rotate(14deg);
    filter: brightness(0.2) blur(4px);
    opacity: 0;
    box-shadow: none;
  }
}

.hand .card.card--played {
  animation: card-played 180ms ease-in forwards;
}

@keyframes card-played {
  to {
    opacity: 0;
    transform: scale(0.9);
    filter: brightness(1.1);
  }
}
.wrap {
  max-width: 520px;
  margin: 0 auto;
  padding: max(0.95rem, env(safe-area-inset-top, 0px)) max(0.8rem, env(safe-area-inset-right, 0px))
    max(0.8rem, env(safe-area-inset-bottom, 0px)) max(0.8rem, env(safe-area-inset-left, 0px));
}

.head {
  margin-bottom: 1rem;
}

/* Глобальный индикатор рейтингового поиска (виден на любых экранах, кроме боя). */
.rated-search-banner {
  position: fixed;
  z-index: 5200;
  left: max(0.8rem, env(safe-area-inset-left, 0px));
  right: max(0.8rem, env(safe-area-inset-right, 0px));
  top: max(0.55rem, env(safe-area-inset-top, 0px));
  max-width: 520px;
  margin: 0 auto;
  padding: 0.38rem 0.5rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  background: rgba(22, 18, 14, 0.92);
  border: 1px solid rgba(255, 190, 120, 0.25);
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.rated-search-banner.hidden {
  display: none !important;
}

.rated-search-banner__ico {
  flex-shrink: 0;
  width: 1.15rem;
  height: 1.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.92rem;
  opacity: 0.9;
  filter: grayscale(0.1);
}

.rated-search-banner__txt {
  font-size: 0.72rem;
  line-height: 1.2;
  font-weight: 650;
  color: #f0e6dc;
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.rated-search-banner__bar {
  flex: 1;
  min-width: 3.6rem;
  height: 0.22rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 210, 150, 0.12);
  overflow: hidden;
  position: relative;
}

.rated-search-banner__bar.hidden {
  display: none !important;
}

.rated-search-banner__bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 32%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 210, 120, 0) 0%, rgba(255, 210, 120, 0.95) 50%, rgba(255, 210, 120, 0) 100%);
  transform: translateX(-40%);
  will-change: transform;
}

.rated-search-banner__btn {
  flex-shrink: 0;
  border: 1px solid rgba(255, 200, 140, 0.28);
  background: rgba(255, 255, 255, 0.06);
  color: #ffe2b6;
  font-weight: 750;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font: inherit;
  cursor: pointer;
}

.rated-search-banner__btn:active {
  transform: scale(0.98);
}

body.game-active .rated-search-banner {
  display: none !important;
}

/* Учебные подсказки в бою */
.tutorial-coach {
  position: fixed;
  z-index: 5300;
  left: max(0.8rem, env(safe-area-inset-left, 0px));
  right: max(0.8rem, env(safe-area-inset-right, 0px));
  bottom: max(0.85rem, env(safe-area-inset-bottom, 0px));
  max-width: 520px;
  margin: 0 auto;
}

/* Положение подсказки: шаг задаёт класс на #tutorialCoach */
.tutorial-coach--bottom {
  top: auto;
  bottom: max(0.85rem, env(safe-area-inset-bottom, 0px));
}

.tutorial-coach--top {
  top: max(0.45rem, env(safe-area-inset-top, 0px));
  bottom: auto;
}

.tutorial-coach--center {
  top: 50%;
  bottom: auto;
  left: 50%;
  right: auto;
  transform: translate(-50%, -50%);
  margin: 0;
  width: min(92vw, 520px);
  max-width: min(92vw, 520px);
}

.tutorial-coach.hidden {
  display: none !important;
}

.tutorial-coach__panel {
  background: rgba(10, 12, 16, 0.92);
  border: 1px solid rgba(140, 190, 255, 0.22);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  border-radius: 14px;
  padding: 0.55rem 0.6rem 0.6rem;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.tutorial-coach__head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}

.tutorial-coach__title {
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(200, 210, 225, 0.75);
}

.tutorial-coach__text {
  color: #e8eef5;
  font-size: 0.86rem;
  line-height: 1.35;
  font-weight: 650;
}

@keyframes tutorial-highlight-pulse {
  0%,
  100% {
    outline-color: rgba(255, 220, 130, 0.95);
    box-shadow: 0 0 0 5px rgba(255, 200, 90, 0.2);
  }
  50% {
    outline-color: rgba(255, 200, 90, 0.35);
    box-shadow: 0 0 0 2px rgba(255, 200, 90, 0.06);
  }
}

.tutorial-highlight {
  outline: 2px solid rgba(255, 215, 120, 0.75);
  outline-offset: 3px;
  border-radius: 12px;
  box-shadow: 0 0 0 6px rgba(255, 215, 120, 0.08);
  animation: tutorial-highlight-pulse 1.05s ease-in-out infinite;
}

body.game-active .head {
  display: none;
}

body.game-active .wrap {
  padding-top: max(0.4rem, env(safe-area-inset-top, 0px));
}

/* Бой на весь экран по высоте: соперник сверху, арена по центру, герой+рука снизу (без «пустого пола» под рукой) */
body.game-active:has(#battle:not(.hidden)) .wrap {
  min-height: 100dvh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

body.game-active:has(#battle:not(.hidden)) #battle:not(.hidden) {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
}

body.game-active:has(#battle:not(.hidden)) #playArea.play-area:not(.hidden) {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  position: relative;
  isolation: isolate;
}

/* Фоновая сцена за доской: мягкий свет + текстура, без картинок */
body.game-active:has(#battle:not(.hidden)) #playArea.play-area:not(.hidden)::before {
  content: '';
  position: absolute;
  inset: -1.2rem -0.6rem;
  pointer-events: none;
  z-index: 0;
  opacity: 1;
  background:
    radial-gradient(ellipse 120% 70% at 50% 12%, rgba(255, 220, 160, 0.07) 0%, transparent 58%),
    radial-gradient(ellipse 110% 75% at 50% 55%, rgba(140, 190, 255, 0.055) 0%, transparent 62%),
    radial-gradient(ellipse 70% 55% at 18% 68%, rgba(120, 255, 205, 0.045) 0%, transparent 62%),
    radial-gradient(ellipse 70% 55% at 82% 68%, rgba(255, 155, 120, 0.04) 0%, transparent 62%),
    radial-gradient(ellipse 120% 90% at 50% 120%, rgba(0, 0, 0, 0.45) 0%, transparent 58%),
    repeating-linear-gradient(
      -18deg,
      rgba(255, 255, 255, 0.012),
      rgba(255, 255, 255, 0.012) 5px,
      rgba(0, 0, 0, 0) 5px,
      rgba(0, 0, 0, 0) 10px
    );
  filter: saturate(1.05) contrast(1.04);
}

/* Контент поверх фона сцены */
body.game-active:has(#battle:not(.hidden)) #playArea.play-area:not(.hidden) > * {
  position: relative;
  z-index: 1;
}

/* Растягиваемые «пружины» сверху/снизу от арены — делят свободную высоту поровну */
.battle-fill-gap {
  flex: 1 1 0;
  min-height: 0;
  pointer-events: none;
}

body.game-active:has(#battle:not(.hidden)) .board-arena {
  flex-shrink: 0;
}

/* В бою прячем центральный текст хода; история — в панели над маной */
body.game-active .turn-bar {
  display: none;
}

body.game-active .battle-top-strip {
  margin-bottom: 0;
}

.head-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.25rem 0 0.15rem;
}

.head-account {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 0.12rem 0 0.1rem;
}

.head-account__aside {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.18rem;
  flex-shrink: 0;
}

.head-account__news {
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(18, 22, 30, 0.55);
  color: rgba(225, 235, 248, 0.92);
  border-radius: 12px;
  padding: 0.38rem 0.55rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
}

.head-account__news:hover {
  background: rgba(26, 32, 44, 0.62);
  border-color: rgba(255, 255, 255, 0.16);
}

.head-account__news:active {
  transform: translateY(1px);
}

.head-account__avatar {
  width: 3.4rem;
  height: 3.4rem;
  flex-shrink: 0;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(155deg, #2f3b52 0%, #182131 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
}

.head-account__avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.head-account__avatar-fallback {
  font-size: 1.15rem;
  font-weight: 800;
  color: #eef4fb;
}

.head-account__avatar.hero-avatar--photo .head-account__avatar-fallback {
  display: none;
}

/* Награда за недельную цель: золотистая рамка (data-avatar-frame из профиля). */
.head-account__avatar[data-avatar-frame='weekly-glow'] {
  border: 1px solid rgba(255, 220, 170, 0.55);
  box-shadow: 0 0 14px rgba(255, 185, 70, 0.25), 0 6px 20px rgba(0, 0, 0, 0.28);
  position: relative;
}

.head-account__avatar[data-avatar-frame='weekly-glow']::after {
  content: '♛';
  position: absolute;
  top: 0.12rem;
  right: 0.12rem;
  z-index: 60;
  width: 1.2rem;
  height: 1.2rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #1f1406;
  background: linear-gradient(180deg, #ffd76a 0%, #e09018 100%);
  border: 1px solid rgba(255, 230, 160, 0.55);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.35);
  font-size: 0.82rem;
  line-height: 1;
}

.head-account__text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.16rem;
}

.head-account__name {
  font-size: 1.05rem;
  font-weight: 800;
  color: #f2f6fa;
  line-height: 1.2;
}

.head-account__meta {
  font-size: 0.8rem;
  color: #8b9bab;
  line-height: 1.3;
}

.head-account__stats-line {
  display: flex;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 0.28rem 0.45rem;
  font-size: 0.72rem;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}

.head-account__stats-line.hidden {
  display: none !important;
}

.head-account__stats-season {
  color: #7a8b9c;
  font-weight: 600;
  margin-right: 0.05rem;
}

.head-account__stats-win-group,
.head-account__stats-loss-group {
  display: inline-flex;
  align-items: baseline;
  gap: 0.22rem;
  white-space: nowrap;
}

.head-account__stats-win-group {
  color: #8be28a;
}

.head-account__stats-wins {
  font-weight: 800;
}

.head-account__stats-wins-tail {
  font-weight: 700;
  letter-spacing: 0.01em;
}

.head-account__stats-sep {
  color: #5a6674;
  font-weight: 600;
  margin: 0 0.02rem;
}

.head-account__stats-loss-group {
  color: #f0a0b4;
}

.head-account__stats-losses {
  font-weight: 800;
}

.head-account__stats-losses-tail {
  font-weight: 700;
  letter-spacing: 0.01em;
}

.head-account__rating-tile {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.28rem;
  padding: 0.28rem 0.45rem 0.28rem 0.4rem;
  border-radius: 10px;
  /* База до 1600 Elo: приглушённый блок — выше порогов заметный контраст. */
  background: linear-gradient(145deg, rgba(28, 30, 36, 0.96) 0%, rgba(16, 18, 24, 0.99) 100%);
  border: 1px solid rgba(120, 110, 90, 0.35);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  max-width: 100%;
  box-sizing: border-box;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

/* Elo ≥ 1600 — тёплое «настоящее» золото, жирная рамка. */
.head-account__rating-tile--elo-plus {
  border: 2px solid rgba(255, 175, 55, 0.75);
  box-shadow:
    0 0 0 1px rgba(40, 32, 18, 0.9),
    0 0 24px rgba(255, 160, 40, 0.35),
    0 4px 14px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 220, 160, 0.18);
  background: linear-gradient(145deg, rgba(58, 42, 14, 0.98) 0%, rgba(28, 20, 10, 0.99) 100%);
}

/* Elo ≥ 1800 — другая палитра: золото + фиолет/лёд, сильное свечение. */
.head-account__rating-tile--elo-elite {
  border: 2px solid transparent;
  background:
    linear-gradient(145deg, rgba(36, 22, 52, 0.97) 0%, rgba(18, 14, 28, 0.99) 55%, rgba(42, 32, 12, 0.95) 100%) padding-box,
    linear-gradient(120deg, #a78bfa, #38bdf8, #fbbf24) border-box;
  box-shadow:
    0 0 0 1px rgba(20, 16, 40, 0.95),
    0 0 32px rgba(167, 139, 250, 0.45),
    0 0 48px rgba(56, 189, 248, 0.22),
    0 4px 16px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.head-account__rating-tile.hidden {
  display: none !important;
}

.head-account__rating-tile__glyph {
  flex-shrink: 0;
  width: 1.48rem;
  height: 1.48rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  line-height: 1;
  color: rgba(30, 28, 24, 0.88);
  background: linear-gradient(165deg, #c8b89a 0%, #8a7a62 100%);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.head-account__rating-tile--elo-plus .head-account__rating-tile__glyph {
  color: #1a1206;
  background: linear-gradient(165deg, #ffe8a8 0%, #e89820 55%, #c07010 100%);
  border: 1px solid rgba(255, 220, 140, 0.65);
  box-shadow: 0 0 14px rgba(255, 170, 40, 0.55);
}

.head-account__rating-tile--elo-elite .head-account__rating-tile__glyph {
  color: #f8fafc;
  background: linear-gradient(145deg, #7c3aed 0%, #2563eb 50%, #d97706 100%);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow:
    0 0 18px rgba(167, 139, 250, 0.7),
    0 0 28px rgba(56, 189, 248, 0.35);
}

.head-account__rating-tile__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.06rem;
}

.head-account__rating-tile__headline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.28rem;
}

.head-account__rating-tile__eyebrow {
  font-size: 0.52rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(180, 190, 205, 0.75);
}

.head-account__rating-tile--elo-plus .head-account__rating-tile__eyebrow {
  color: rgba(255, 220, 170, 0.88);
}

.head-account__rating-tile--elo-elite .head-account__rating-tile__eyebrow {
  color: rgba(226, 232, 240, 0.9);
}

.head-account__rating-tile__tier {
  font-size: 0.5rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.14rem 0.34rem;
  border-radius: 5px;
  line-height: 1.1;
}

.head-account__rating-tile__tier.hidden {
  display: none !important;
}

.head-account__rating-tile__tier--plus {
  color: #1f1406;
  background: linear-gradient(180deg, #ffd76a 0%, #e09018 100%);
  border: 1px solid rgba(255, 230, 160, 0.55);
  box-shadow: 0 0 10px rgba(255, 160, 40, 0.35);
}

.head-account__rating-tile__tier--elite {
  color: #f1f5f9;
  background: linear-gradient(120deg, #6d28d9 0%, #0d9488 50%, #b45309 100%);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.55);
}

.head-account__rating-tile__num-row {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 0.35rem;
  font-variant-numeric: tabular-nums;
}

.head-account__rating-tile__value {
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: #e2e8f0;
  text-shadow: none;
}

.head-account__rating-tile--elo-plus .head-account__rating-tile__value {
  color: #fff8e8;
  text-shadow: 0 0 14px rgba(255, 185, 60, 0.55);
}

.head-account__rating-tile--elo-elite .head-account__rating-tile__value {
  color: #fffef6;
  text-shadow:
    0 0 12px rgba(255, 255, 255, 0.35),
    0 0 22px rgba(167, 139, 250, 0.55),
    0 0 28px rgba(56, 189, 248, 0.35);
}

.head-account__rating-tile__suffix {
  font-size: 0.62rem;
  font-weight: 750;
  color: rgba(148, 163, 184, 0.75);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.head-account__rating-tile--elo-plus .head-account__rating-tile__suffix {
  color: rgba(255, 215, 150, 0.65);
}

.head-account__rating-tile--elo-elite .head-account__rating-tile__suffix {
  color: rgba(186, 230, 253, 0.75);
}

.head-account__rating-tile__sub {
  flex-shrink: 0;
  max-width: 38%;
  font-size: 0.58rem;
  font-weight: 650;
  line-height: 1.2;
  color: rgba(200, 210, 225, 0.72);
  text-align: right;
  white-space: nowrap;
}

.head-account__rating-tile__sub.hidden {
  display: none !important;
}

.head-account__rating-tile--empty .head-account__rating-tile__value {
  color: rgba(255, 247, 228, 0.45);
  text-shadow: none;
}

.head-account__rating-tile--empty .head-account__rating-tile__glyph {
  opacity: 0.55;
  filter: grayscale(0.35);
}

@media (max-width: 380px) {
  .head-account__rating-tile {
    flex-wrap: wrap;
  }

  .head-account__rating-tile__sub {
    flex: 1 1 100%;
    max-width: none;
    text-align: left;
    padding-left: 1.95rem;
    white-space: normal;
  }
}

.head-account__battle-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: #bfe99a;
  line-height: 1.25;
  letter-spacing: 0.02em;
}

.head-account__battle-title.hidden {
  display: none !important;
}

.conn--head {
  padding: 0.28rem 0.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.7rem;
  white-space: nowrap;
}

.head-weekly-badge {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7ee787;
  border: 1px solid rgba(126, 231, 135, 0.45);
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
  line-height: 1.2;
  white-space: nowrap;
}

.head-weekly-badge.hidden {
  display: none !important;
}

.weekly-goal-strip {
  border-radius: 14px;
  padding: 0.55rem 0.75rem 0.6rem;
  background: rgba(30, 58, 95, 0.35);
  border: 1px solid rgba(120, 170, 240, 0.22);
}

.weekly-goal-strip.hidden {
  display: none !important;
}

.weekly-goal-strip__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.weekly-goal-strip__title {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9ec8ff;
}

.weekly-goal-strip__counts {
  font-size: 0.85rem;
  font-weight: 800;
  color: #e8f1ff;
  font-variant-numeric: tabular-nums;
}

.weekly-goal-strip__track {
  height: 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.weekly-goal-strip__fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #5ab0ff 0%, #7ee787 100%);
  transition: width 0.35s ease;
}

.weekly-goal-strip__hint {
  margin: 0.32rem 0 0;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #8b9bab;
}

.weekly-goal-toast {
  position: fixed;
  z-index: 200;
  left: 50%;
  bottom: max(1.1rem, env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(120%);
  max-width: min(92vw, 22rem);
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  background: rgba(18, 24, 32, 0.94);
  border: 1px solid rgba(126, 184, 255, 0.35);
  color: #e8f1ff;
  font-size: 0.82rem;
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition:
    transform 0.35s ease,
    opacity 0.35s ease;
  pointer-events: none;
}

.weekly-goal-toast.weekly-goal-toast--show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.head-brand__badge {
  flex-shrink: 0;
  width: 2.7rem;
  height: 2.7rem;
  border-radius: 12px;
  background: linear-gradient(155deg, #40c4ff 0%, #2aabee 45%, #208dbf 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 4px 18px rgba(42, 171, 238, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.head-brand__plane {
  display: block;
  margin-left: 1px;
  margin-top: -1px;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.18));
}

.head-brand__text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.head-brand__title {
  font-size: 1.06rem;
  font-weight: 750;
  letter-spacing: 0.015em;
  color: #f2f6fa;
  line-height: 1.2;
}

.head-brand__status {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  font-size: 0.78rem;
  color: #8b9bab;
}

.head-brand__dot {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: #5c6775;
  box-shadow: 0 0 0 2px rgba(92, 103, 117, 0.28);
  flex-shrink: 0;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

@media (prefers-reduced-motion: reduce) {
  .head-brand__dot {
    transition: none;
  }
}

.head-brand__status:has(.conn.ok) .head-brand__dot {
  background: #52d88a;
  box-shadow: 0 0 0 2px rgba(82, 216, 138, 0.25);
}

.head-brand__status:has(.conn.bad) .head-brand__dot {
  background: #ff7a7a;
  box-shadow: 0 0 0 2px rgba(255, 122, 122, 0.22);
}

.head-brand__status .conn {
  font-size: inherit;
  margin: 0;
  color: inherit;
}

.head-brand__status:has(.conn.ok) .conn {
  color: #7ddea0;
}

.head-brand__status:has(.conn.bad) .conn {
  color: #ff9e9e;
}

.sub {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
}
.sub a {
  color: #7eb8ff;
}
.btn-compact {
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
}
.hint-muted {
  color: #6a7684;
  font-size: 0.78rem;
  margin-top: 0.35rem;
}
.conn {
  margin: 0;
  font-size: 0.85rem;
  color: #8b9bab;
}
.conn.ok {
  color: #6bcf7f;
}
.conn.bad {
  color: #f0a0a0;
}
.panel .row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0;
  flex-wrap: wrap;
}
button {
  padding: 0.5rem 0.9rem;
  border: none;
  border-radius: 8px;
  background: #3d7eff;
  color: #fff;
  font-weight: 500;
  cursor: pointer;
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.hint {
  font-size: 0.8rem;
  color: #8b9bab;
  word-break: break-all;
  min-height: 1.2em;
}
.battle.hidden {
  display: none;
}

/* Сообщения конца игры и др. (в бою скрыт) */
.battle-top-strip {
  margin-bottom: 0.4rem;
}

.battle-hud-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.4rem;
  flex-wrap: nowrap;
}

.battle-hud-bar .turn-bar {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 46%;
  margin-right: 0;
}

.battle-top-log {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
}

/* Лог последних ходов в шапке боя (между строкой хода и настройками) */
.battle-top-log .action-log.action-log--hud {
  width: 100%;
  max-width: none;
  margin: 0;
  flex: 1 1 auto;
  flex-direction: column-reverse;
  max-height: 2.75rem;
  min-height: 2rem;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  gap: 0.1rem;
  padding: 0.16rem 0.3rem;
  font-size: 0.64rem;
  line-height: 1.1;
  border-radius: 9px;
  background: rgba(10, 14, 20, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.battle-top-log .action-log.action-log--hud .action-log-line {
  gap: 0.24rem;
}

.battle-top-log .action-log.action-log--hud .action-log-dot {
  width: 0.42rem;
  height: 0.42rem;
}

.battle-top-log .action-log.action-log--hud .action-log-ico {
  width: 0.75rem;
  font-size: 0.58rem;
}

.battle-settings-trigger {
  flex-shrink: 0;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  margin: 0;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(165deg, rgba(38, 46, 58, 0.92) 0%, rgba(18, 22, 30, 0.96) 100%);
  color: #c5d4e3;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 4px 12px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.battle-settings-trigger:active {
  transform: scale(0.96);
}

.battle-settings-trigger__ico {
  font-size: 1.15rem;
  line-height: 1;
  display: block;
  opacity: 0.9;
}

.battle-reconnect-banner {
  margin: 0 0 0.4rem;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-size: 0.72rem;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #f0e6dc;
  background: rgba(22, 18, 14, 0.88);
  border: 1px solid rgba(255, 190, 120, 0.28);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.battle-reconnect-banner__ico {
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
  background: center/contain no-repeat;
  opacity: 0.92;
}

.battle-reconnect-banner--offline .battle-reconnect-banner__ico {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23e8a050'%3E%3Cpath d='M1 9l2 2c4.97-4.97 13.03-4.97 18 0l2-2C16.93 2.93 7.08 2.93 1 9zm8 8l3 3 3-3c-1.65-1.66-4.34-1.66-6 0zm-4-4l2 2c2.76-2.76 7.24-2.76 10 0l2-2C15.14 9.14 8.87 9.14 5 13z'/%3E%3C/svg%3E");
}

.battle-reconnect-banner--sync .battle-reconnect-banner__ico {
  transform-origin: center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%237eb8ff'%3E%3Cpath d='M12 6V3L8 7l4 4V8c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 9.74A7.89 7.89 0 004 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z'/%3E%3C/svg%3E");
  animation: battle-reconnect-spin 0.85s linear infinite;
}

.battle-reconnect-banner--peer-afk {
  border-color: rgba(255, 160, 90, 0.45);
  background: rgba(48, 28, 18, 0.92);
}

.battle-reconnect-banner--peer-afk .battle-reconnect-banner__ico {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23f0a060'%3E%3Cpath d='M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z'/%3E%3C/svg%3E");
  animation: none;
}

.battle-reconnect-banner--peer-afk .battle-reconnect-banner__txt {
  white-space: normal;
  text-align: center;
  max-width: min(100%, 22rem);
}

@keyframes battle-reconnect-spin {
  to {
    transform: rotate(360deg);
  }
}

.battle-reconnect-banner__txt {
  white-space: nowrap;
  color: #c5b8a8;
  font-weight: 600;
}

.battle-reconnect-banner.hidden {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .battle-reconnect-banner--sync .battle-reconnect-banner__ico {
    animation: none;
  }
}

.lobby-resume-card {
  margin-bottom: 1rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(110, 170, 255, 0.35);
  background: linear-gradient(165deg, rgba(28, 40, 58, 0.95) 0%, rgba(14, 20, 32, 0.98) 100%);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.lobby-resume-card.hidden {
  display: none !important;
}

.lobby-resume-card__row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.lobby-resume-card__ico {
  flex-shrink: 0;
  color: #7eb8ff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lobby-resume-card__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.lobby-resume-card__title {
  font-size: 0.88rem;
  font-weight: 750;
  color: #e8edf2;
  letter-spacing: 0.02em;
}

.lobby-resume-card__code {
  font-size: 0.78rem;
  color: #8b9bab;
}

.lobby-resume-card__code strong {
  color: #ffd78a;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.lobby-resume-card__countdown {
  margin-top: 0.2rem;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.35;
  color: #e8a060;
  letter-spacing: 0.01em;
}

.lobby-resume-card__countdown.hidden {
  display: none !important;
}

.lobby-resume-card__btn {
  flex-shrink: 0;
  padding: 0.45rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 650;
  border-radius: 10px;
  margin: 0;
}

.lobby-resume-card__dismiss {
  margin: 0.55rem 0 0;
  padding: 0;
  width: 100%;
  font-size: 0.72rem;
  font-weight: 500;
  color: #6a7a8c;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

.lobby-resume-card__dismiss:active {
  color: #9aacbc;
}

.play-area.play-area--reconnect .hero-row,
.play-area.play-area--reconnect .board-arena,
.play-area.play-area--reconnect .hand-wrap,
.play-area.play-area--reconnect .battle-top-strip {
  opacity: 0.88;
  pointer-events: none;
}

.battle-settings-modal {
  position: fixed;
  inset: 0;
  z-index: 4700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
    max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}

.battle-settings-modal.hidden {
  display: none !important;
}

.rating-info-modal {
  position: fixed;
  inset: 0;
  z-index: 4690;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
    max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}

.rating-info-modal.hidden {
  display: none !important;
}

.rating-info-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 10, 0.72);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.rating-info-modal__panel {
  position: relative;
  z-index: 1;
  width: min(340px, 100%);
  padding: 1rem 1rem 1.05rem;
  border-radius: 14px;
  background: linear-gradient(165deg, rgba(28, 34, 44, 0.98) 0%, rgba(12, 16, 22, 0.99) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
  text-align: left;
}

.rating-info-modal__hero-elo {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  margin: 0.15rem 0 0.75rem;
  padding: 0.55rem 0.65rem;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 205, 110, 0.13) 0%, rgba(255, 205, 110, 0.06) 100%);
  border: 1px solid rgba(255, 210, 130, 0.22);
}

.rating-info-modal__hero-elo.hidden {
  display: none !important;
}

.rating-info-modal__hero-elo__label {
  font-size: 0.78rem;
  color: rgba(255, 220, 170, 0.85);
  font-weight: 700;
}

.rating-info-modal__hero-elo__value {
  font-variant-numeric: tabular-nums;
  font-size: 1.22rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: rgba(255, 246, 235, 0.98);
  text-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
  margin-left: auto;
}

.rating-info-modal__hero-elo__tier {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 850;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 210, 130, 0.32);
  background: rgba(255, 210, 130, 0.12);
  color: rgba(255, 235, 200, 0.95);
}

.rating-info-modal__hero-elo__tier.hidden {
  display: none !important;
}

.rating-info-modal__next-tier {
  margin: 0 0 0.85rem;
  padding: 0.6rem 0.65rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.rating-info-modal__next-tier.hidden {
  display: none !important;
}

.rating-info-modal__next-tier__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.45rem;
}

.rating-info-modal__next-tier__label {
  font-size: 0.8rem;
  font-weight: 700;
  color: rgba(230, 240, 255, 0.88);
}

.rating-info-modal__next-tier__value {
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  font-weight: 850;
  color: rgba(255, 235, 200, 0.95);
}

.rating-info-modal__next-tier__bar {
  height: 0.32rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.rating-info-modal__next-tier__bar-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(120, 205, 255, 0.9) 0%, rgba(255, 210, 130, 0.95) 100%);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.rating-info-modal__next-tier__sub {
  margin-top: 0.45rem;
  font-size: 0.78rem;
  color: rgba(170, 190, 210, 0.92);
  font-variant-numeric: tabular-nums;
}

.rating-info-modal__title {
  margin: 0 0 0.6rem;
  font-size: 1.05rem;
  font-weight: 750;
  color: #e8edf2;
}

.rating-info-modal__text {
  margin: 0 0 0.95rem;
  white-space: pre-line;
  font-size: 0.86rem;
  line-height: 1.35;
  color: #c5d4e3;
}

.rating-info-modal__done {
  width: 100%;
}

.head-account__rating-tile {
  cursor: pointer;
}

.battle-settings-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 10, 0.72);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.battle-settings-modal__panel {
  position: relative;
  z-index: 1;
  width: min(300px, 100%);
  padding: 1rem 1rem 1.1rem;
  border-radius: 14px;
  background: linear-gradient(165deg, rgba(28, 34, 44, 0.98) 0%, rgba(12, 16, 22, 0.99) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
  text-align: left;
}

.battle-settings-modal__title {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
  font-weight: 750;
  color: #e8edf2;
}

.battle-settings-modal__row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
  font-size: 0.88rem;
  color: #c5d4e3;
  cursor: pointer;
}

.battle-settings-modal__row--volume {
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
  cursor: default;
}

.battle-settings-modal__label {
  font-size: 0.82rem;
  color: #9aacbc;
}

.battle-settings-modal__row input[type='range'] {
  width: 100%;
  accent-color: #5c9dff;
}

.battle-settings-modal__surrender {
  width: 100%;
  margin-top: 0.85rem;
  min-height: 2.65rem;
  font-size: 0.88rem;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-weight: 600;
}

.battle-settings-modal__surrender:disabled {
  cursor: not-allowed;
}

.battle-settings-modal__done {
  width: 100%;
  margin-top: 0.55rem;
  margin-bottom: 0;
}

@media (prefers-reduced-motion: reduce) {
  .battle-settings-trigger:active {
    transform: none;
  }

  .battle-settings-modal__backdrop {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
#lobby.hidden {
  display: none;
}

.loadout-screen.hidden {
  display: none !important;
}

#loadoutHub,
#lobbyMain,
#matchHistoryScreen,
#leaderboardScreen {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#loadoutHub.loadout-hub {
  gap: 0;
}

.loadout-hub__scroll {
  display: flex;
  flex-direction: column;
  gap: 0.52rem;
  padding-bottom: 5.75rem;
}

.loadout-hub-play-footer {
  position: fixed;
  z-index: 40;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.55rem max(0.8rem, env(safe-area-inset-left)) max(0.65rem, env(safe-area-inset-bottom))
    max(0.8rem, env(safe-area-inset-right));
  background: linear-gradient(180deg, transparent, rgba(10, 13, 18, 0.88) 22%, rgba(10, 13, 18, 0.98) 100%);
  pointer-events: none;
}

.loadout-hub-play-footer__inner {
  max-width: 520px;
  margin: 0 auto;
  pointer-events: auto;
}

.loadout-hero-card--selectable {
  position: relative;
  border: 1px solid rgba(90, 140, 210, 0.35);
}

button.loadout-hero-card--selectable {
  width: 100%;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

button.loadout-hero-card--selectable:focus-visible {
  outline: 2px solid rgba(126, 184, 255, 0.65);
  outline-offset: 2px;
}

.loadout-hero-card__chevron {
  flex-shrink: 0;
  align-self: center;
  margin-left: 0.25rem;
  font-size: 1.65rem;
  font-weight: 300;
  line-height: 1;
  opacity: 0.42;
}

.loadout-hub-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
  margin: 0.12rem 0 0;
}

.loadout-hub-links__sep {
  color: #5a6674;
  font-weight: 600;
  user-select: none;
}

.match-history-screen {
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 0.55rem;
}

.match-history-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 0.04rem 1.25rem;
}

.match-history-list {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
}

.match-history-empty {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: #7a8b9c;
  text-align: center;
  padding: 0.5rem 0.35rem;
}

.match-history-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.48rem 0.55rem;
  border-radius: 12px;
  background: linear-gradient(165deg, rgba(22, 28, 38, 0.96) 0%, rgba(12, 16, 22, 0.98) 100%);
  border: 1px solid rgba(88, 108, 138, 0.28);
  box-sizing: border-box;
}

.match-history-row--win {
  border-color: rgba(90, 170, 120, 0.38);
}

.match-history-row--loss {
  border-color: rgba(160, 90, 110, 0.32);
}

.match-history-row--rated {
  box-shadow:
    inset 4px 0 0 0 rgba(245, 200, 90, 0.95),
    0 0 0 1px rgba(220, 175, 70, 0.22);
  background: linear-gradient(165deg, rgba(32, 28, 16, 0.98) 0%, rgba(18, 14, 8, 0.99) 100%);
}

.match-history-row--rated.match-history-row--win {
  border-color: rgba(130, 175, 95, 0.55);
}

.match-history-row--rated.match-history-row--loss {
  border-color: rgba(195, 115, 105, 0.48);
}

.match-history-row__avatar {
  flex-shrink: 0;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(8, 12, 18, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.match-history-row__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.match-history-row__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.match-history-row__title {
  font-size: 0.86rem;
  font-weight: 750;
  color: #dce6f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.match-history-row__aside {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 0.28rem;
  min-width: 4.6rem;
}

.match-history-row__mode-pill {
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.16rem 0.36rem;
  border-radius: 6px;
  line-height: 1.2;
  white-space: nowrap;
}

.match-history-row__mode-pill--rated {
  color: #1a1408;
  background: linear-gradient(180deg, #f0d060 0%, #c9a028 100%);
  border: 1px solid rgba(255, 230, 150, 0.45);
  box-shadow: 0 0 10px rgba(240, 190, 60, 0.25);
}

.match-history-row__mode-pill--casual {
  color: #9aaec0;
  background: rgba(55, 68, 88, 0.45);
  border: 1px solid rgba(120, 140, 165, 0.28);
}

.match-history-row__meta {
  font-size: 0.68rem;
  color: #7a8b9c;
  line-height: 1.35;
}

.match-history-row__badge {
  flex-shrink: 0;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.2rem 0.38rem;
  border-radius: 7px;
  line-height: 1;
}

.match-history-row__badge--win {
  color: #8be28a;
  background: rgba(80, 160, 100, 0.18);
}

.match-history-row__badge--loss {
  color: #f0a0b4;
  background: rgba(160, 80, 100, 0.2);
}

.leaderboard-screen {
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 0.55rem;
}

.leaderboard-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 0.04rem 1.25rem;
}

.leaderboard-elo-hint {
  margin: 0 0 0.35rem;
  padding: 0.45rem 0.55rem;
  font-size: 0.72rem;
  line-height: 1.45;
  color: #9aaec0;
  background: rgba(18, 24, 34, 0.75);
  border: 1px solid rgba(88, 108, 138, 0.22);
  border-radius: 10px;
}

.leaderboard-elo-hint strong {
  color: #e8c878;
  font-weight: 800;
}

.leaderboard-viewer {
  margin: 0 0 0.42rem;
  padding: 0.48rem 0.55rem;
  font-size: 0.78rem;
  line-height: 1.4;
  font-weight: 650;
  color: #e8eef5;
  background: linear-gradient(145deg, rgba(32, 28, 16, 0.96) 0%, rgba(16, 14, 10, 0.99) 100%);
  border: 1px solid rgba(220, 175, 70, 0.38);
  border-radius: 11px;
  box-shadow: inset 3px 0 0 0 rgba(218, 175, 72, 0.75);
}

.leaderboard-viewer.hidden {
  display: none !important;
}

.leaderboard-viewer__line {
  margin: 0 0 0.32rem;
  line-height: 1.45;
}

.leaderboard-viewer__sub {
  margin: 0;
  font-size: 0.66rem;
  font-weight: 600;
  color: rgba(200, 210, 225, 0.72);
  line-height: 1.35;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
}

.leaderboard-empty {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: #7a8b9c;
  text-align: center;
  padding: 0.5rem 0.35rem;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 0.48rem;
  padding: 0.42rem 0.5rem;
  border-radius: 12px;
  background: linear-gradient(165deg, rgba(22, 28, 38, 0.96) 0%, rgba(12, 16, 22, 0.98) 100%);
  border: 1px solid rgba(100, 118, 145, 0.55);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.35),
    0 2px 10px rgba(0, 0, 0, 0.28);
  box-sizing: border-box;
}

.leaderboard-row--you {
  border-color: rgba(220, 175, 80, 0.55);
  border-width: 2px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.35),
    inset 3px 0 0 0 rgba(218, 175, 72, 0.65),
    0 0 14px rgba(255, 190, 70, 0.12);
}

/* Совпадает с порогами в профиле: Elo ≥ 1600 */
.leaderboard-row--elo-plus {
  border: 2px solid rgba(255, 165, 50, 0.88);
  background: linear-gradient(165deg, rgba(36, 28, 16, 0.97) 0%, rgba(14, 16, 22, 0.99) 100%);
  box-shadow:
    0 0 0 1px rgba(20, 14, 8, 0.9),
    0 0 18px rgba(255, 150, 40, 0.22),
    0 2px 12px rgba(0, 0, 0, 0.32);
}

.leaderboard-row--you.leaderboard-row--elo-plus {
  box-shadow:
    0 0 0 1px rgba(20, 14, 8, 0.9),
    inset 3px 0 0 0 rgba(255, 200, 100, 0.55),
    0 0 20px rgba(255, 150, 40, 0.25),
    0 2px 12px rgba(0, 0, 0, 0.32);
}

/* Elo ≥ 1800 */
.leaderboard-row--elo-elite {
  border: 2px solid rgba(167, 139, 250, 0.9);
  background: linear-gradient(165deg, rgba(30, 22, 48, 0.98) 0%, rgba(12, 14, 24, 0.99) 100%);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.45),
    0 0 22px rgba(167, 139, 250, 0.35),
    0 0 36px rgba(56, 189, 248, 0.15),
    0 2px 14px rgba(0, 0, 0, 0.35);
}

.leaderboard-row--you.leaderboard-row--elo-elite {
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.45),
    inset 3px 0 0 0 rgba(250, 220, 150, 0.45),
    0 0 26px rgba(167, 139, 250, 0.42),
    0 0 40px rgba(56, 189, 248, 0.18),
    0 2px 14px rgba(0, 0, 0, 0.35);
}

.leaderboard-row__rank {
  flex-shrink: 0;
  min-width: 1.85rem;
  font-size: 0.78rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #7a8b9c;
  text-align: right;
}

.leaderboard-row--you .leaderboard-row__rank {
  color: #e8c878;
}

.leaderboard-row__avatar {
  flex-shrink: 0;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(8, 12, 18, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.leaderboard-row__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.leaderboard-row__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
}

.leaderboard-row__name {
  font-size: 0.84rem;
  font-weight: 750;
  color: #dce6f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leaderboard-row__meta {
  font-size: 0.65rem;
  color: #7a8b9c;
}

.leaderboard-row__elo {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #f0d878;
  letter-spacing: 0.02em;
}

.leaderboard-row--you .leaderboard-row__elo {
  color: #fff2c8;
}

.leaderboard-row--elo-plus .leaderboard-row__elo {
  color: #ffd98a;
  text-shadow: 0 0 10px rgba(255, 170, 50, 0.35);
}

.leaderboard-row--elo-elite .leaderboard-row__elo {
  color: #fef3c7;
  text-shadow:
    0 0 10px rgba(167, 139, 250, 0.45),
    0 0 14px rgba(56, 189, 248, 0.25);
}

.loadout-deck-strip-label {
  margin: 0;
  padding: 0.08rem 0 0.32rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8eb8ff;
}

.loadout-deck-strip {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0 0 0.15rem;
  margin: 0;
  -webkit-overflow-scrolling: touch;
}

.loadout-deck-hero-hint {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  line-height: 1.38;
  opacity: 0.88;
}

.hero-card.hero-card--future {
  opacity: 0.52;
  pointer-events: none;
  cursor: not-allowed;
  border-style: dashed;
  border-color: rgba(110, 130, 155, 0.35);
  background: linear-gradient(165deg, rgba(16, 20, 28, 0.75) 0%, rgba(8, 10, 14, 0.82) 100%);
}

.hero-card--future .hero-card__race {
  color: #7a8a9c;
  text-transform: none;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.hero-card.hero-card--deck-chip {
  position: relative;
  box-sizing: border-box;
  flex: 0 0 auto;
  width: 7.65rem;
  min-width: 7.65rem;
  max-width: 7.65rem;
  min-height: 6.15rem;
  margin: 0;
  padding: 0.55rem 0.65rem 1.42rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
}

.hero-card--deck-chip .hero-card__name {
  font-size: 0.9rem;
  line-height: 1.22;
}

.hero-card--deck-chip .hero-card__race {
  margin-bottom: 0;
  margin-top: 0.18rem;
  font-size: 0.68rem;
  line-height: 1.25;
}

.hero-card--deck-chip .hero-card__deck-desc {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  width: 100%;
  margin-top: 0.32rem;
  font-size: 0.66rem;
  font-weight: 500;
  line-height: 1.32;
  color: #8f9eb0;
  text-transform: none;
  letter-spacing: 0.01em;
}

.hero-card.hero-card--deck-chip-nonplayable {
  border-style: dashed;
  border-color: rgba(200, 130, 90, 0.45);
}

.hero-card--deck-chip .hero-card__deck-nonplayable {
  display: block;
  align-self: stretch;
  text-align: center;
  margin-top: 0.26rem;
  padding: 0.14rem 0.28rem;
  border-radius: 7px;
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #f5c4a2;
  background: rgba(140, 72, 48, 0.35);
  border: 1px solid rgba(230, 150, 100, 0.38);
}

.hero-card--deck-chip-nonplayable.is-active {
  border-color: rgba(230, 150, 100, 0.55);
}

.hero-card__archetype {
  display: block;
  margin-top: 0.18rem;
  font-size: 0.76rem;
  font-weight: 650;
  line-height: 1.35;
  color: #a8b8cc;
  letter-spacing: 0.02em;
}

.loadout-hero {
  padding: 0.95rem 1rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(90, 120, 160, 0.28);
  background: linear-gradient(165deg, rgba(19, 26, 38, 0.98) 0%, rgba(9, 13, 19, 0.99) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 8px 24px rgba(0, 0, 0, 0.22);
}

.loadout-hero__eyebrow {
  display: inline-block;
  margin-bottom: 0.35rem;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7eb8ff;
}

.loadout-hero__title,
.loadout-step-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  color: #f1f5fb;
}

.loadout-step-lead {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.42;
  color: #96a7ba;
}

.loadout-step-lead--tight {
  margin-top: 0.02rem;
}

.loadout-customize-hero-grid {
  margin-bottom: 0.15rem;
}

.loadout-hub-actions.row {
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: stretch;
}

.loadout-hub-actions .loadout-primary-action {
  flex: 1 1 60%;
  min-width: 10rem;
}

.loadout-hub-actions__secondary {
  flex: 1 1 32%;
  min-width: 7rem;
}

.loadout-hub-actions--single .loadout-primary-action {
  flex: 1 1 100%;
  width: 100%;
}

.lobby-modes-head {
  margin-bottom: 0.15rem;
}

.lobby-modes-head--bar {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 0 0 1rem;
  padding: 0.85rem 0.95rem 0.95rem;
  border-radius: 16px;
  border: 1px solid rgba(88, 118, 168, 0.32);
  background: linear-gradient(165deg, rgba(24, 32, 48, 0.95) 0%, rgba(12, 16, 24, 0.98) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045), 0 8px 28px rgba(0, 0, 0, 0.2);
}

.lobby-modes-head__back {
  margin-top: 0.12rem;
}

.lobby-modes-head__back.loadout-step-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.18rem;
  padding: 0.48rem 0.72rem 0.48rem 0.5rem;
  min-height: 2.75rem;
  border-radius: 12px;
  font: inherit;
  color: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.lobby-modes-head__back-arrow {
  display: block;
  font-size: 1.95rem;
  font-weight: 200;
  line-height: 1;
  margin: -0.08em 0 0 -0.04em;
  opacity: 0.94;
}

.lobby-modes-head__back-label {
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.lobby-modes-head__text {
  min-width: 0;
  flex: 1;
}

.lobby-modes-head__eyebrow {
  margin: 0 0 0.2rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #7eb8ff;
}

.lobby-modes-head__title {
  margin: 0 0 0.25rem;
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.2;
  color: #f1f5fb;
}

.lobby-modes-head__lead {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.4;
  color: #96a7ba;
}

.loadout-hint--tight {
  margin-top: 0.5rem;
  font-size: 0.78rem;
  opacity: 0.85;
}

.loadout-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
  margin-bottom: 0;
}

.loadout-hero-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.95rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(72, 88, 112, 0.42);
  background: linear-gradient(165deg, rgba(22, 28, 38, 0.98) 0%, rgba(10, 14, 20, 0.99) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 6px 20px rgba(0, 0, 0, 0.22);
}

.loadout-hero-card__icon-wrap,
.lobby-selection-current__icon-wrap {
  width: 4.25rem;
  height: 4.25rem;
  flex-shrink: 0;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.14), rgba(14, 18, 26, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.loadout-hero-card__icon,
.lobby-selection-current__icon {
  width: 3.15rem;
  height: 3.15rem;
  display: block;
}

.loadout-hero-card__body,
.lobby-selection-current__text {
  min-width: 0;
  flex: 1;
}

.loadout-summary-card,
.hero-card,
.deck-card {
  padding: 0.9rem 0.95rem;
  border-radius: 14px;
  border: 1px solid rgba(72, 88, 112, 0.42);
  background: linear-gradient(165deg, rgba(22, 28, 38, 0.98) 0%, rgba(10, 14, 20, 0.99) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 6px 20px rgba(0, 0, 0, 0.22);
}

.loadout-summary-card__label,
.deck-card__eyebrow,
.hero-card__race {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8eb8ff;
}

.loadout-summary-card__title,
.deck-card__name,
.hero-card__name {
  display: block;
  font-size: 1rem;
  font-weight: 750;
  color: #edf2f8;
}

.loadout-summary-card__meta,
.deck-card__text,
.hero-card__text {
  display: block;
  margin-top: 0.28rem;
  font-size: 0.82rem;
  line-height: 1.42;
  color: #8f9eb0;
}

.loadout-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 0;
}

.loadout-actions--mobile {
  margin-bottom: 0;
}

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

.loadout-hint {
  min-height: 1.2rem;
  margin-bottom: 0.25rem;
}

.loadout-hint.hidden {
  display: none !important;
}

.match-history-empty.hidden {
  display: none !important;
}

.leaderboard-empty.hidden {
  display: none !important;
}

.loadout-primary-action {
  width: 100%;
  min-height: 3.1rem;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 14px;
}

body.hero-theme-orc .loadout-hero,
body.hero-theme-orc .loadout-hero-card,
body.hero-theme-orc .lobby-block--selection {
  border-color: rgba(191, 117, 58, 0.35);
}

body.hero-theme-orc .loadout-primary-action {
  background: linear-gradient(180deg, #c96d2d 0%, #99451d 100%);
}

body.hero-theme-orc .loadout-summary-card__label,
body.hero-theme-orc .loadout-hero__eyebrow {
  color: #f0b171;
}

body.hero-theme-elf .loadout-hero,
body.hero-theme-elf .loadout-hero-card,
body.hero-theme-elf .lobby-block--selection {
  border-color: rgba(88, 166, 141, 0.35);
}

body.hero-theme-elf .loadout-primary-action {
  background: linear-gradient(180deg, #2ea57f 0%, #1f6f58 100%);
}

body.hero-theme-elf .loadout-summary-card__label,
body.hero-theme-elf .loadout-hero__eyebrow {
  color: #7fddb9;
}

.loadout-step-head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.loadout-step-back {
  flex-shrink: 0;
  padding: 0.45rem 0.7rem;
  background: rgba(61, 126, 255, 0.12);
  color: #c9d8eb;
  border: 1px solid rgba(126, 184, 255, 0.18);
}

.hero-grid,
.deck-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
}

.hero-grid--lobby {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 0;
}

.lobby-selection-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0;
}

.lobby-selection-current {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lobby-selection-row__btn {
  flex-shrink: 0;
  min-height: 2.5rem;
}

.lobby-block__lead--compact {
  margin-bottom: 0;
}

.loadout-summary--compact {
  margin-bottom: 0;
}

.hero-card,
.deck-card {
  width: 100%;
  text-align: left;
}

.hero-card--placeholder {
  cursor: default;
}

.hero-card__icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  margin-bottom: 0.7rem;
  border-radius: 14px;
  background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.14), rgba(14, 18, 26, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.hero-card__icon {
  width: 3rem;
  height: 3rem;
  display: block;
}

.hero-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 4600;
}

.hero-picker-modal.hidden {
  display: none !important;
}

.hero-picker-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 10, 0.62);
}

.hero-picker-modal__sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.95rem 0.9rem max(1rem, env(safe-area-inset-bottom));
  border-radius: 18px 18px 0 0;
  background: linear-gradient(180deg, rgba(20, 26, 36, 0.99) 0%, rgba(10, 14, 20, 1) 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 -18px 40px rgba(0, 0, 0, 0.4);
  max-height: min(88dvh, 34rem);
  display: flex;
  flex-direction: column;
}

.hero-picker-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.hero-picker-modal__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: #eef4fb;
}

.hero-picker-modal__lead {
  margin: 0.32rem 0 0;
  font-size: 0.8rem;
  line-height: 1.4;
  color: #91a2b4;
}

.hero-picker-modal__close {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #d7e3ef;
  font-size: 1.2rem;
  line-height: 1;
}

.hero-picker-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.hero-card.is-active,
.deck-card.is-active,
.hero-card:focus-visible,
.deck-card:focus-visible {
  border-color: rgba(126, 184, 255, 0.58);
  box-shadow: 0 0 0 2px rgba(126, 184, 255, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 6px 20px rgba(0, 0, 0, 0.22);
}

.hero-card.is-active::after,
.deck-card.is-active::after {
  content: 'Выбрано';
  display: inline-flex;
  margin-top: 0.7rem;
  padding: 0.18rem 0.48rem;
  border-radius: 999px;
  background: rgba(82, 216, 138, 0.16);
  color: #8be2aa;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* Полоска колод: фиксированная высота карточек — бейдж не сдвигает сетку. */
.hero-card.hero-card--deck-chip.is-active::after {
  position: absolute;
  left: 50%;
  bottom: 0.42rem;
  transform: translateX(-50%);
  margin-top: 0;
}

/* Сильнее, чем body.lobby-host-waiting #lobby { display:flex } — иначе лобби не скрывается при старте боя. */
body.lobby-host-waiting #lobby.hidden {
  display: none !important;
}

.lobby-modes {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 0;
}

.lobby-modes.lobby-modes--locked .lobby-block {
  opacity: 0.28;
  filter: grayscale(0.25);
  pointer-events: none;
}

.lobby-tutorial-gate {
  border-radius: 16px;
  padding: 0.75rem 0.75rem 0.7rem;
  background: linear-gradient(165deg, rgba(22, 28, 38, 0.96) 0%, rgba(12, 16, 22, 0.98) 100%);
  border: 1px solid rgba(140, 190, 255, 0.18);
  box-shadow: 0 6px 26px rgba(0, 0, 0, 0.32);
}

.lobby-tutorial-gate.hidden {
  display: none !important;
}

.lobby-tutorial-gate__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.16rem 0.45rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #cfe5ff;
  border: 1px solid rgba(126, 184, 255, 0.35);
  background: rgba(126, 184, 255, 0.1);
}

.lobby-tutorial-gate__title {
  margin: 0.55rem 0 0.2rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: #f2f6fa;
}

.lobby-tutorial-gate__lead {
  margin: 0 0 0.65rem;
  color: #9aaec0;
  font-size: 0.82rem;
  line-height: 1.45;
}

.lobby-tutorial-gate__lead strong {
  color: #e8c878;
  font-weight: 850;
}

.lobby-tutorial-gate__cta {
  width: 100%;
  min-height: 2.75rem;
  border-radius: 14px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  color: #1b1306;
  background: linear-gradient(180deg, #ffd76a 0%, #e09018 100%);
  border: 1px solid rgba(255, 230, 160, 0.55);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  cursor: pointer;
}

.lobby-tutorial-gate__cta:active {
  transform: scale(0.99);
}

.lobby-block {
  padding: 1rem 1.05rem 1.05rem;
  border-radius: 16px;
  border: 1px solid rgba(72, 88, 112, 0.42);
  background: linear-gradient(165deg, rgba(22, 28, 38, 0.98) 0%, rgba(10, 14, 20, 0.99) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 8px 26px rgba(0, 0, 0, 0.26);
}

.lobby-block--friends {
  border-color: rgba(100, 150, 220, 0.38);
  background: linear-gradient(168deg, rgba(26, 36, 52, 0.98) 0%, rgba(12, 17, 26, 0.99) 100%);
}

.lobby-block__top {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.lobby-block__symbol {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: #9ec8ff;
  background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.12), rgba(20, 28, 42, 0.92));
  border: 1px solid rgba(120, 170, 230, 0.28);
}

.lobby-block__top-text {
  min-width: 0;
  flex: 1;
}

.lobby-block--ranked {
  border-style: solid;
  border-color: rgba(120, 170, 230, 0.42);
  background: linear-gradient(165deg, rgba(18, 26, 40, 0.94) 0%, rgba(10, 14, 22, 0.99) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.045),
    0 10px 30px rgba(0, 0, 0, 0.28),
    0 0 0 1px rgba(120, 175, 240, 0.07);
  opacity: 1;
}

.lobby-ranked-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
}

.lobby-ranked-head__titles {
  min-width: 0;
  flex: 1;
}

.lobby-block__badge-soon {
  flex-shrink: 0;
  margin-top: 0.1rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #c9b8f0;
  background: rgba(120, 90, 180, 0.22);
  border: 1px solid rgba(160, 130, 210, 0.35);
}

.lobby-block__badge {
  flex-shrink: 0;
  margin-top: 0.1rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid rgba(140, 190, 245, 0.35);
}

.lobby-block__badge--live {
  color: rgba(220, 245, 255, 0.96);
  background: linear-gradient(180deg, rgba(60, 150, 255, 0.22) 0%, rgba(80, 210, 255, 0.12) 100%);
  box-shadow: 0 8px 18px rgba(40, 120, 220, 0.16);
}

.lobby-block__lead--ranked-tagline {
  margin: 0.15rem 0 0;
  font-size: 0.74rem;
  line-height: 1.35;
  color: #7d8c9c;
}

.lobby-block__lead--ranked-body {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  line-height: 1.45;
}

.lobby-block__title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: 0.02em;
  color: #e8edf2;
}

.lobby-block--friends .lobby-block__title {
  margin: 0 0 0.25rem;
  font-size: 1.08rem;
}

.lobby-block__lead {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #9aacbc;
}

.lobby-block__lead strong {
  color: #d8e4f2;
  font-weight: 600;
}

.lobby-block__lead--muted {
  color: #7d8e9e;
}

.lobby-block__lead--tight {
  margin-bottom: 0.5rem;
}

.lobby-block__lead--friends {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.42;
  color: #9eb0c4;
}

.lobby-friends-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.lobby-friends-create {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  min-height: 2.85rem;
  padding: 0.55rem 1rem;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 12px;
  background: linear-gradient(180deg, #4a8cff 0%, #2d6ae8 100%);
  box-shadow: 0 4px 16px rgba(45, 106, 232, 0.35);
}

.lobby-friends-create:active {
  transform: scale(0.99);
}

.lobby-friends-toolbar .lobby-join-row {
  margin-top: 0;
  max-width: none;
  width: 100%;
  align-items: stretch;
}

.lobby-join-row--friends {
  max-width: none;
}

.lobby-friends-toolbar .lobby-join-row__input {
  flex: 1 1 auto;
  max-width: none;
  min-height: 2.5rem;
  padding: 0.4rem 0.55rem;
  font-size: 0.88rem;
}

.lobby-friends-toolbar .lobby-join-row__btn {
  align-self: stretch;
  min-height: 2.5rem;
  min-width: 5.5rem;
  padding: 0.4rem 0.85rem;
  font-size: 0.88rem;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}

.lobby-block--friends .lobby-join-hint {
  margin: 0.35rem 0 0;
  max-width: 100%;
  font-size: 0.74rem;
  line-height: 1.3;
}

.lobby-join-row {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
  margin-top: 0.35rem;
  max-width: 13.5rem;
}

.lobby-join-row__input {
  flex: 1 1 6.5rem;
  min-width: 0;
  max-width: 9.5rem;
  box-sizing: border-box;
  padding: 0.38rem 0.45rem;
  border: 1px solid rgba(72, 88, 112, 0.65);
  border-radius: 8px;
  background: rgba(10, 14, 20, 0.95);
  color: #e8edf2;
  font-family: ui-monospace, 'Cascadia Code', 'SF Mono', Menlo, monospace;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-align: center;
  text-transform: uppercase;
}

.lobby-join-row__input::placeholder {
  color: #5a6a7a;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: none;
}

.lobby-join-row__btn {
  flex: 0 0 auto;
  align-self: stretch;
  padding: 0.38rem 0.75rem;
  font-size: 0.86rem;
  font-weight: 600;
  border-radius: 8px;
}

.lobby-join-hint {
  margin: 0.3rem 0 0;
  max-width: 13.5rem;
  min-height: 1.15em;
  font-size: 0.76rem;
}

.lobby-join-hint:empty {
  display: none;
}

.lobby-lobby-hint {
  margin: 0.5rem 0 0;
  padding: 0 0.08rem;
}

.lobby-lobby-hint:empty {
  display: none;
}

.lobby-wait-hint {
  margin: 0.7rem 0 0;
  text-align: center;
  font-size: 0.78rem;
}

.lobby-wait-hint:empty {
  display: none;
}

.lobby-block--ranked .btn-ranked {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  min-height: 2.5rem;
  padding: 0.45rem 1rem;
  font-size: 0.88rem;
  font-weight: 800;
  border-radius: 10px;
  border: 1px solid rgba(120, 175, 240, 0.5);
  background: linear-gradient(180deg, rgba(80, 155, 255, 0.92) 0%, rgba(40, 110, 220, 0.92) 100%);
  color: rgba(245, 250, 255, 0.98);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.28);
  box-shadow: 0 10px 24px rgba(25, 85, 175, 0.24);
  cursor: pointer;
}

.lobby-block--ranked button.btn-ranked:disabled {
  opacity: 0.72;
  cursor: not-allowed;
  filter: grayscale(0.08);
}

/* Экран хоста: комната создана, ждём друга */
body.lobby-host-waiting .wrap {
  min-height: 100dvh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.lobby-host-waiting #lobby {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#lobby.lobby--waiting-host {
  min-height: min(64dvh, 22rem);
}

.lobby-wait-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  padding: 0.35rem 0 0.75rem;
  margin: 0;
}

.lobby-wait-panel.hidden {
  display: none !important;
}

#lobby.lobby--waiting-host .lobby-wait-panel:not(.hidden) {
  display: flex;
}

.lobby-wait-card {
  width: 100%;
  max-width: 22rem;
  margin: 0 auto;
  padding: 1.15rem 1.1rem 1.05rem;
  border-radius: 14px;
  border: 1px solid rgba(110, 170, 255, 0.32);
  background: linear-gradient(168deg, rgba(28, 40, 58, 0.96) 0%, rgba(12, 18, 28, 0.99) 100%);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  text-align: center;
}

.lobby-wait-card__visual {
  position: relative;
  width: 3.25rem;
  height: 3.25rem;
  margin: 0 auto 0.85rem;
}

.lobby-wait-card__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(126, 184, 255, 0.35);
  animation: lobby-wait-pulse 1.8s ease-in-out infinite;
}

.lobby-wait-card__dot {
  position: absolute;
  inset: 0.55rem;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(180, 220, 255, 0.95), rgba(70, 120, 200, 0.75));
  box-shadow: 0 0 20px rgba(100, 160, 255, 0.35);
}

@keyframes lobby-wait-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.85;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lobby-wait-card__ring {
    animation: none;
  }
}

.lobby-wait-title {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: 0.02em;
  color: #e8edf2;
}

.lobby-wait-sub {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  color: #8b9bab;
  line-height: 1.45;
}

.lobby-wait-code-block {
  padding: 0.65rem 0.75rem 0.55rem;
  border-radius: 10px;
  background: rgba(8, 12, 20, 0.65);
  border: 1px solid rgba(255, 215, 138, 0.12);
  margin-bottom: 1rem;
}

.lobby-wait-code-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6a7a8c;
  margin-bottom: 0.35rem;
}

.lobby-wait-code {
  margin: 0 0 0.5rem;
  font-family: ui-monospace, 'SF Mono', monospace;
  font-size: 1.35rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.12em;
  color: #ffd78a;
  line-height: 1.2;
  word-break: break-all;
}

.lobby-wait-copy {
  padding: 0.28rem 0.5rem;
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: #9eb8d8;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.lobby-wait-copy:active {
  color: #c8d8f0;
}

.lobby-wait-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.lobby-wait-btn-share {
  width: 100%;
  padding: 0.62rem 1rem;
  font-size: 0.88rem;
  font-weight: 650;
  border-radius: 10px;
  background: linear-gradient(180deg, #4a8cff 0%, #2d6ae0 100%);
  box-shadow: 0 4px 14px rgba(45, 106, 224, 0.35);
}

.lobby-wait-btn-share:active {
  transform: scale(0.98);
}

.lobby-wait-btn-cancel {
  width: 100%;
  padding: 0.52rem 1rem;
  font-size: 0.82rem;
  border-radius: 10px;
}

@media (min-width: 380px) {
  .lobby-wait-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .lobby-wait-btn-share {
    flex: 1 1 58%;
    min-width: 9rem;
  }
  .lobby-wait-btn-cancel {
    flex: 1 1 36%;
    min-width: 7rem;
  }
}
#lobbyMain.hidden {
  display: none;
}
.play-area.hidden {
  display: none;
}
.code {
  font-family: ui-monospace, monospace;
  font-size: 1.1rem;
  color: #ffd78a;
}
.hero-row {
  margin-bottom: 0.5rem;
}

/* Соперник: рука (веер) | герой | колода. Игрок: общение (заглушка) | герой | колода — та же сетка, без смещения */
.hero-row--triple {
  --hero-rail-w: 3.35rem;
  display: grid;
  grid-template-columns: var(--hero-rail-w) minmax(0, 1fr) var(--hero-rail-w);
  gap: 0.5rem;
  align-items: stretch;
}

.hero-row--triple > .hero-center-stack,
.hero-row--triple > .foe-hand-slot,
.hero-row--triple > .hero-side-rail,
.hero-row--triple > .hero-deck-slot {
  min-height: 5.75rem;
}

/* Левый рельс игрока под кнопку общения — ширина как у колонки руки соперника */
.hero-side-rail {
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  padding: 0.1rem 0.04rem;
}

.hero-comm-wrap {
  position: relative;
}

/* Позиция left/top выставляет JS по кнопке и clamp к viewport — иначе узкий рельс режет попап слева */
.battle-emote-popover {
  position: fixed;
  z-index: 26000;
  box-sizing: border-box;
  min-width: 9rem;
  max-width: min(11.5rem, calc(100vw - 1rem));
  padding: 0.45rem 0.5rem 0.55rem;
  border-radius: 12px;
  border: 1px solid rgba(120, 130, 170, 0.5);
  background: linear-gradient(165deg, rgba(42, 40, 56, 0.98) 0%, rgba(22, 20, 32, 0.99) 100%);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.battle-emote-popover.hidden {
  display: none !important;
}

.battle-emote-popover__title {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(200, 208, 232, 0.72);
  text-align: center;
  margin-bottom: 0.35rem;
}

.battle-emote-popover__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.28rem;
}

.battle-emote-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.1rem;
  padding: 0.15rem;
  border-radius: 10px;
  border: 1px solid rgba(100, 110, 150, 0.35);
  background: rgba(30, 28, 44, 0.9);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition:
    background 0.12s ease,
    border-color 0.12s ease;
}

.battle-emote-btn:hover {
  border-color: rgba(160, 175, 220, 0.55);
  background: rgba(48, 46, 68, 0.95);
}

.battle-emote-float {
  position: fixed;
  z-index: 30000;
  font-size: clamp(2rem, 8vw, 2.75rem);
  line-height: 1;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.35);
  opacity: 0;
  transition:
    transform 0.38s cubic-bezier(0.2, 0.9, 0.2, 1),
    opacity 0.28s ease;
  text-shadow:
    0 2px 14px rgba(0, 0, 0, 0.65),
    0 0 20px rgba(120, 140, 255, 0.25);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.battle-emote-float.battle-emote-float--show {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

/* Локальная реакция на своём аватаре — чуть компактнее, чем у соперника */
.battle-emote-float--self {
  font-size: clamp(1.65rem, 6vw, 2.2rem);
  filter: drop-shadow(0 0 10px rgba(120, 200, 255, 0.35));
}

.btn-battle-comm {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.55rem;
  height: 2.55rem;
  margin: 0;
  padding: 0;
  border-radius: 12px;
  border: 1px solid rgba(120, 130, 170, 0.45);
  background: linear-gradient(165deg, rgba(55, 52, 72, 0.95) 0%, rgba(28, 26, 38, 0.98) 100%);
  box-shadow:
    0 2px 5px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: #c8d0e8;
  cursor: pointer;
  flex-shrink: 0;
  box-sizing: border-box;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.btn-battle-comm__ico {
  font-size: 1.12rem;
  line-height: 1;
  opacity: 0.88;
  filter: grayscale(0.12);
}

.btn-battle-comm:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-battle-comm:not(:disabled):hover {
  border-color: rgba(160, 175, 220, 0.55);
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Герой по центру колонки, под ним мана по центру */
.hero-center-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.32rem;
  min-width: 0;
}

.hero-center-stack > .hero-plate {
  width: 100%;
  max-width: min(100%, 15.5rem);
  align-self: center;
}

/* Боковой рельс под стопку карт (при необходимости в других экранах) */
.hero-hand-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.32rem;
  padding: 0.1rem 0.04rem;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.hero-hand-slot .meta-pile {
  flex: 0 0 auto;
  align-self: center;
}

/* Колонка колоды — зеркально левой */
.hero-deck-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.32rem;
  padding: 0.1rem 0.04rem;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

/* Таймер в .board-arena-timers: оверлей сверху справа, без отступа по ширине у .board-arena */
.board-arena-timers .turn-timer--compact {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  margin: auto;
  width: 100%;
  max-width: 2.65rem;
  height: 2.65rem;
  min-height: 2.65rem;
  max-height: 2.65rem;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.92rem;
}

.hero-deck-slot .meta-pile {
  flex: 0 0 auto;
  align-self: center;
}

/* В боковых рельсах не растягиваем кучу на всю ширину — иначе счёт уезжает в угол ячейки */
.hero-hand-slot .meta-pile--solo,
.hero-deck-slot .meta-pile--solo {
  width: auto;
  max-width: 100%;
}

.meta-pile--solo {
  width: 100%;
  max-width: 3rem;
}

@media (max-width: 22rem) {
  .hero-row--triple {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: auto;
    align-items: stretch;
  }

  .hero-row--triple > .foe-hand-slot,
  .hero-row--triple > .hero-side-rail {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    justify-self: center;
    min-height: 0;
  }

  .hero-row--triple > .hero-center-stack {
    grid-column: 2;
    grid-row: 1;
    min-height: 0;
  }

  .hero-row--triple > .hero-deck-slot {
    grid-column: 3;
    grid-row: 1;
    align-self: center;
    justify-self: center;
    min-height: 0;
  }

  .hero-row--triple > .hero-center-stack,
  .hero-row--triple > .foe-hand-slot,
  .hero-row--triple > .hero-side-rail,
  .hero-row--triple > .hero-deck-slot {
    min-height: 0;
  }

  .hero-row--triple.hero-row--foe-with-hand > .foe-hand-slot {
    min-height: 2.55rem;
  }
}

.hero-aside {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0.38rem;
  min-width: 0;
}

/* Слева у соперника: веер рубашек — по центру ячейки по вертикали и горизонтали */
.foe-hand-slot {
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  padding: 0.1rem 0.04rem;
}

.foe-hand-slot .foe-hand {
  flex: 0 0 auto;
  min-height: 2.55rem;
  max-height: 3.15rem;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  box-sizing: border-box;
  /* веер шире рельса — слегка ужимаем; рубашки крупнее, чем раньше */
  transform: scale(0.9);
  transform-origin: center center;
}

.foe-hand-slot .foe-hand[hidden] {
  display: none !important;
}

.hero-row--triple.hero-row--foe-with-hand .foe-hand-slot--vacant {
  width: 0;
  min-width: 0 !important;
  max-width: 0;
  padding: 0;
  margin: 0;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
}

.foe-hand__pile {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 2.75rem;
  max-height: 3.45rem;
}

.foe-hand__inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 2.75rem;
  max-height: 3.45rem;
  overflow: hidden;
  border-radius: 4px;
}

.foe-hand__count {
  position: absolute;
  left: 50%;
  right: auto;
  bottom: -0.06rem;
  transform: translateX(-50%);
  z-index: 35;
  min-width: 1.05rem;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #ffe8ee;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  line-height: 1;
  pointer-events: none;
}

.foe-hand__card {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 1.78rem;
  height: 2.32rem;
  margin-left: -0.89rem;
  border-radius: 7px;
  background-color: #120c10;
  background-image: var(
    --pile-back-image,
    linear-gradient(152deg, rgba(78, 48, 58, 0.98) 0%, rgba(36, 20, 30, 0.98) 52%, rgba(16, 10, 14, 0.99) 100%)
  );
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 1px solid rgba(150, 160, 200, 0.42);
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transform: translateX(var(--foe-tx, 0px)) rotate(var(--foe-rot, 0deg));
  transform-origin: 50% 100%;
  pointer-events: none;
}

.foe-hand-slot[data-card-backs='orc'] .foe-hand__card {
  border-color: rgba(230, 140, 95, 0.5);
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.48),
    inset 0 1px 0 rgba(255, 190, 150, 0.1);
}

.foe-hand-slot[data-card-backs='elf'] .foe-hand__card {
  border-color: rgba(130, 200, 255, 0.45);
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(200, 235, 255, 0.08);
}

.foe-hand-slot[data-card-backs='default'] .foe-hand__card {
  border-color: rgba(150, 160, 200, 0.42);
}

/* Ширина полосы маны на поле боя */
.board-mana {
  --hero-aside-panel-w: 10.45rem;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  position: relative;
  z-index: 2;
}

/* Фиксированная ширина: бэйдж «N/M» + ровно 10 кристаллов (manaMax ≤ 10) */
.board-mana .mana-tray,
.hero-aside .mana-tray {
  align-self: center;
  margin-top: 0;
  box-sizing: border-box;
  width: var(--hero-aside-panel-w, 10.45rem);
  min-width: var(--hero-aside-panel-w, 10.45rem);
  max-width: var(--hero-aside-panel-w, 10.45rem);
  flex-shrink: 0;
  min-height: 2.05rem;
  padding: 0.22rem 0.34rem 0.24rem;
  gap: 0.26rem;
}

.board-mana .mana-tray-cap,
.hero-aside .mana-tray-cap {
  width: 2.75rem;
  min-width: 2.75rem;
  max-width: 2.75rem;
  padding: 0.14rem 0.2rem;
  font-size: 0.64rem;
  flex-shrink: 0;
}

.board-mana .mana-tray-dots,
.hero-aside .mana-tray-dots {
  display: flex;
  flex: 0 0 6.2rem;
  width: 6.2rem;
  min-width: 6.2rem;
  max-width: 6.2rem;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.14rem;
}

.board-mana .mana-dot,
.hero-aside .mana-dot {
  width: 0.48rem;
  height: 0.66rem;
  flex-shrink: 0;
}

.meta-pile {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}

.meta-pile-stack {
  position: relative;
  width: 2.05rem;
  height: 2.2rem;
  flex-shrink: 0;
}

.meta-pile-backs {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.meta-pile-back {
  position: absolute;
  width: 1.42rem;
  height: 1.88rem;
  left: 0;
  top: 0.18rem;
  border-radius: 5px;
  background: linear-gradient(148deg, #352e4a 0%, #1a1f2e 55%, #121620 100%);
  border: 1px solid #5a5a78;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
}

.meta-pile-back:nth-child(2) {
  left: 0.12rem;
  top: 0.09rem;
}

.meta-pile-back:nth-child(3) {
  left: 0.24rem;
  top: 0;
}

.meta-pile-count {
  position: absolute;
  right: -0.12rem;
  bottom: -0.06rem;
  z-index: 4;
  min-width: 1.05rem;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #f0f4f8;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  line-height: 1;
}

/* В боковых рельсах героя число по центру под картинкой кучи */
.hero-hand-slot .meta-pile-count,
.hero-deck-slot .meta-pile-count {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
}

/* Крупная стопка колоды в рельсе героя; data-card-backs задаётся из JS (orc | elf | default) */
.hero-deck-slot .meta-pile-stack {
  width: 2.88rem;
  height: 3.08rem;
}

.hero-deck-slot .meta-pile-back {
  width: 2rem;
  height: 2.62rem;
  top: 0.22rem;
  border-radius: 6px;
  background-color: #0e0a0c;
  background-image: var(--pile-back-image, linear-gradient(148deg, #352e4a 0%, #1a1f2e 55%, #121620 100%));
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.hero-deck-slot .meta-pile-back:nth-child(2) {
  left: 0.17rem;
  top: 0.11rem;
}

.hero-deck-slot .meta-pile-back:nth-child(3) {
  left: 0.34rem;
  top: 0;
}

.hero-deck-slot[data-card-backs='orc'] .meta-pile-back {
  border-color: rgba(230, 140, 95, 0.5);
  box-shadow:
    0 3px 6px rgba(0, 0, 0, 0.48),
    inset 0 1px 0 rgba(255, 190, 150, 0.12);
}

.hero-deck-slot[data-card-backs='elf'] .meta-pile-back {
  border-color: rgba(130, 200, 255, 0.45);
  box-shadow:
    0 3px 6px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(200, 235, 255, 0.1);
}

.hero-deck-slot[data-card-backs='default'] .meta-pile-back {
  border-color: rgba(150, 160, 200, 0.42);
}

.hero-deck-slot .meta-pile-count {
  font-size: 0.78rem;
}

.battle-buttons-row {
  display: flex;
  flex: 1;
  gap: 0.45rem;
  min-width: 0;
}

.turn-timer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.65rem;
  padding: 0 0.45rem;
  font-size: 1.4rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: #8b9bab;
  background: linear-gradient(180deg, #1e2633 0%, #121820 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Компактный таймер у поля (.board-arena-timers); align-self не используется — позиция absolute */
.turn-timer--compact {
  align-self: stretch;
  width: 100%;
  min-width: 0;
  padding: 0.14rem 0.22rem;
  font-size: 0.88rem;
  font-weight: 800;
  border-radius: 7px;
  box-sizing: border-box;
}

/* Слот таймера не схлопывается, когда счётчик скрыт */
.turn-timer--compact.turn-timer--vacant {
  visibility: hidden;
  pointer-events: none;
}

.turn-timer.yours {
  color: #7ddea0;
  border-color: rgba(110, 200, 140, 0.35);
}

.turn-timer.foe-turn {
  color: #f8a8c8;
  border-color: rgba(248, 140, 180, 0.4);
}

.turn-timer.prelude {
  color: #97a6b6;
  border-color: rgba(255, 255, 255, 0.12);
  filter: saturate(0.35);
}

.turn-timer.timer-urgent {
  color: #ff9a7a;
  border-color: rgba(255, 140, 100, 0.45);
  animation: turn-timer-pulse 0.9s ease-in-out infinite;
}

.turn-timer.timer-urgent.yours {
  color: #ff6b6b;
}

.turn-timer.foe-turn.timer-urgent {
  color: #ffb3a0;
  border-color: rgba(255, 150, 120, 0.5);
}

/* Компактный таймер у арены: без обводки (остаётся только фон и цифры). */
.turn-timer.turn-timer--compact {
  border: none;
  box-shadow: none;
}

@keyframes turn-timer-pulse {
  50% {
    filter: brightness(1.12);
  }
}

.battle-buttons-row .btn-turn:not(.btn-turn--arena) {
  flex: 1;
  min-height: 2.75rem;
  font-size: 0.88rem;
  border-radius: 10px;
}
.hero {
  cursor: default;
}

/* Панель героя в бою: как карточка на главной (loadout-hero-card), аватар в квадрате слева */
.hero-plate {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.22rem;
  padding: 0.55rem 0.7rem 0.52rem;
  border-radius: 16px;
  border: 1px solid rgba(72, 88, 112, 0.42);
  background: linear-gradient(165deg, rgba(22, 28, 38, 0.98) 0%, rgba(10, 14, 20, 0.99) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 6px 20px rgba(0, 0, 0, 0.22);
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  position: relative;
}

.hero-plate--foe {
  border-color: rgba(110, 72, 88, 0.48);
  background: linear-gradient(165deg, rgba(30, 20, 26, 0.98) 0%, rgba(12, 8, 11, 0.99) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 140, 160, 0.05), 0 6px 20px rgba(0, 0, 0, 0.28);
}

.hero-plate--foe.hero--peer-offline {
  opacity: 0.92;
  border-color: rgba(140, 110, 60, 0.65);
}

.hero-plate--foe.hero--peer-offline .hero-name::after {
  content: ' · оффлайн';
  font-size: 0.76em;
  font-weight: 600;
  color: #d4a74a;
  letter-spacing: 0.01em;
}

.hero-plate--self {
  position: relative;
  border-color: rgba(58, 92, 128, 0.5);
  background: linear-gradient(165deg, rgba(18, 28, 42, 0.98) 0%, rgba(8, 12, 20, 0.99) 100%);
  box-shadow: inset 0 1px 0 rgba(120, 190, 255, 0.06), 0 6px 20px rgba(0, 0, 0, 0.22);
}

.hero-hand-cap {
  position: absolute;
  right: 0.42rem;
  bottom: 0.36rem;
  z-index: 6;
  pointer-events: none;
  max-width: min(10.5rem, calc(100% - 2.6rem));
  text-align: right;
  white-space: nowrap;
}

.hero-portrait {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.32rem;
  min-width: 0;
  width: 100%;
}

.hero-plate .hero-portrait {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.72rem;
}

.hero-portrait__icon-wrap {
  flex-shrink: 0;
  width: 3.85rem;
  height: 3.85rem;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.14), rgba(14, 18, 26, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.hero-plate--foe .hero-portrait__icon-wrap {
  background: radial-gradient(circle at 30% 25%, rgba(255, 200, 210, 0.14), rgba(22, 12, 18, 0.94));
  border-color: rgba(255, 160, 175, 0.14);
}

.hero-plate--self .hero-portrait__icon-wrap {
  background: radial-gradient(circle at 28% 22%, rgba(170, 205, 255, 0.16), rgba(12, 18, 30, 0.94));
  border-color: rgba(120, 170, 255, 0.12);
}

.hero-plate .hero-portrait__icon-wrap .hero-avatar-ring {
  padding: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 12px;
}

.hero-plate .hero-portrait__icon-wrap .hero-avatar {
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 11px;
  border-width: 1px;
}

.hero-plate .hero-portrait__icon-wrap .hero-avatar-img {
  border-radius: 11px;
}

.hero-portrait__main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.26rem;
}

.hero-avatar-ring {
  flex-shrink: 0;
  padding: 3px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.14) 0%,
    rgba(255, 255, 255, 0.04) 45%,
    rgba(0, 0, 0, 0.15) 100%
  );
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 4px 14px rgba(0, 0, 0, 0.35);
}

.hero-plate--foe .hero-avatar-ring {
  background: linear-gradient(
    145deg,
    rgba(255, 150, 170, 0.22) 0%,
    rgba(80, 40, 52, 0.35) 50%,
    rgba(0, 0, 0, 0.2) 100%
  );
}

.hero-plate--self .hero-avatar-ring {
  background: linear-gradient(
    145deg,
    rgba(130, 190, 255, 0.22) 0%,
    rgba(40, 70, 110, 0.35) 50%,
    rgba(0, 0, 0, 0.2) 100%
  );
}

.hero-avatar-ring[data-avatar-frame='weekly-glow'] {
  padding: 3px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.04) 45%, rgba(0, 0, 0, 0.15) 100%) !important;
  box-shadow:
    0 0 0 1px rgba(255, 210, 140, 0.25),
    0 0 14px rgba(255, 185, 80, 0.22),
    0 4px 14px rgba(0, 0, 0, 0.35) !important;
  position: relative;
}

.hero-plate .hero-portrait__icon-wrap .hero-avatar-ring[data-avatar-frame='weekly-glow'] {
  border-radius: 14px;
}

.hero-plate .hero-portrait__icon-wrap .hero-avatar-ring[data-avatar-frame='weekly-glow'] .hero-avatar-img,
.hero-plate .hero-portrait__icon-wrap .hero-avatar-ring[data-avatar-frame='weekly-glow'] .hero-avatar-fallback {
  border-radius: 11px;
}

.hero-avatar-ring[data-avatar-frame='weekly-glow']::after {
  content: '♛';
  position: absolute;
  top: 0.12rem;
  right: 0.12rem;
  z-index: 60;
  width: 1.1rem;
  height: 1.1rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #1f1406;
  background: linear-gradient(180deg, #ffd76a 0%, #e09018 100%);
  border: 1px solid rgba(255, 230, 160, 0.55);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.35);
  font-size: 0.78rem;
  line-height: 1;
  pointer-events: none;
}

.hero-foot {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 0;
  width: 100%;
}

.hero-plate .hero-foot {
  justify-content: flex-start;
}

/* Аватар в стиле Telegram: круг, под фото из WebApp.initDataUnsafe.user */
.hero-avatar {
  position: relative;
  width: 3.5rem;
  height: 3.5rem;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.22);
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.45),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.12) 0%, rgba(0, 0, 0, 0.35) 100%);
}

.hero-avatar--foe {
  border-color: rgba(255, 160, 175, 0.35);
  background: linear-gradient(160deg, rgba(90, 45, 58, 0.95) 0%, rgba(28, 14, 20, 0.98) 100%);
}

.hero-avatar--self {
  border-color: rgba(140, 190, 255, 0.38);
  background: linear-gradient(160deg, rgba(45, 75, 110, 0.95) 0%, rgba(14, 24, 40, 0.98) 100%);
}

.hero-avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.hero-avatar-img[hidden] {
  display: none !important;
}

.hero-avatar-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.08rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.02em;
  pointer-events: none;
}

.hero-avatar--photo .hero-avatar-fallback {
  display: none;
}

.hero-head {
  text-align: center;
  min-width: 0;
}

.hero-plate .hero-head {
  text-align: left;
  width: 100%;
}

.hero-battle-title {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: #c4ec9e;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-battle-title.hidden {
  display: none !important;
}

.hero-role-chip {
  margin: 0.28rem auto 0;
  padding: 0.18rem 0.42rem 0.18rem 0.26rem;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  border-radius: 999px;
  background: rgba(255, 160, 175, 0.14);
  border: 1px solid rgba(255, 160, 175, 0.2);
  color: #f5dbe3;
}

.hero-role-chip[hidden] {
  display: none !important;
}

.hero-plate .hero-role-chip {
  margin: 0.2rem 0 0;
  align-self: flex-start;
}

.hero-rated-corner {
  position: absolute;
  top: 0.5rem;
  right: 0.6rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  pointer-events: none;
}

/* В углу: статус слева, звезда рейтинга всегда справа. */
.hero-rated-corner .hero-rated-tier {
  order: 0;
}
.hero-rated-corner .hero-rated-chip {
  order: 1;
}

.hero-rated-chip,
.hero-rated-tier {
  margin: 0;
  align-self: auto;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.14rem 0.4rem;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.1;
  white-space: nowrap;
}

.hero-rated-chip[hidden],
.hero-rated-tier[hidden] {
  display: none !important;
}

.hero-rated-chip--rated {
  color: #1f1406;
  background: linear-gradient(180deg, #ffd76a 0%, #e09018 100%);
  border: 1px solid rgba(255, 230, 160, 0.55);
  box-shadow: 0 0 10px rgba(255, 160, 40, 0.25);
}

.hero-rated-chip--rated {
  padding: 0.12rem 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0;
  text-transform: none;
}

.hero-rated-tier--plus {
  color: #1f1406;
  background: linear-gradient(180deg, #ffd76a 0%, #e09018 100%);
  border: 1px solid rgba(255, 230, 160, 0.55);
  box-shadow: 0 0 10px rgba(255, 160, 40, 0.35);
}

.hero-rated-tier--elite {
  color: #f1f5f9;
  background: linear-gradient(120deg, #6d28d9 0%, #0d9488 50%, #b45309 100%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.35);
}

.hero-role-chip--self {
  background: rgba(140, 190, 255, 0.14);
  border-color: rgba(140, 190, 255, 0.22);
  color: #d9ebff;
}

.hero-role-chip__icon {
  width: 0.95rem;
  height: 0.95rem;
  display: block;
  flex-shrink: 0;
}

.hero-role-chip__icon[hidden] {
  display: none !important;
}

.hero-role-chip__text {
  min-width: 0;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-name {
  display: block;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #f0f4f8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-plate .hero-name {
  font-size: 0.98rem;
  font-weight: 750;
  letter-spacing: 0.01em;
  color: #edf2f8;
  white-space: normal;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  text-overflow: ellipsis;
}

.hero-hp-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  flex: 0 0 auto;
  min-width: 2.45rem;
  justify-content: center;
  padding: 0.14rem 0.38rem 0.15rem;
  border-radius: 999px;
  background: linear-gradient(180deg, #3a1520 0%, #1c0a10 100%);
  border: 1px solid rgba(220, 80, 90, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.hero-plate--self .hero-hp-chip {
  background: linear-gradient(180deg, #152a38 0%, #0a141c 100%);
  border-color: rgba(80, 140, 200, 0.35);
}

.hero-hp-ico {
  font-size: 0.74rem;
  line-height: 1;
  opacity: 0.9;
}

.hero-hp {
  font-size: 0.94rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #ff8a8a;
  line-height: 1;
}

.hero-plate.hero--damaged .hero-hp {
  color: #ff5c5c;
}

.hero-plate.hero--danger {
  animation: hero-danger 260ms ease-out;
}

/* Пульс рамки у того, чей сейчас ход (старта хода) */
.hero-plate.hero--turn-pulse {
  z-index: 1;
}

.hero-plate--self.hero--turn-pulse {
  animation: hero-turn-ring-self 0.52s ease-in-out 2;
}

.hero-plate--foe.hero--turn-pulse {
  animation: hero-turn-ring-foe 0.52s ease-in-out 2;
}

@keyframes hero-turn-ring-self {
  0%,
  100% {
    box-shadow:
      inset 0 1px 0 rgba(120, 190, 255, 0.06),
      0 6px 20px rgba(0, 0, 0, 0.22),
      0 0 0 0 rgba(110, 200, 255, 0);
  }
  50% {
    box-shadow:
      inset 0 1px 0 rgba(120, 190, 255, 0.08),
      0 6px 22px rgba(0, 0, 0, 0.26),
      0 0 0 4px rgba(110, 200, 255, 0.38);
  }
}

@keyframes hero-turn-ring-foe {
  0%,
  100% {
    box-shadow:
      inset 0 1px 0 rgba(255, 140, 160, 0.05),
      0 6px 20px rgba(0, 0, 0, 0.28),
      0 0 0 0 rgba(255, 130, 170, 0);
  }
  50% {
    box-shadow:
      inset 0 1px 0 rgba(255, 140, 160, 0.07),
      0 6px 22px rgba(0, 0, 0, 0.3),
      0 0 0 4px rgba(255, 130, 170, 0.4);
  }
}

@keyframes hero-danger {
  0% {
    box-shadow:
      0 0 0 0 rgba(255, 80, 80, 0),
      0 10px 26px rgba(0, 0, 0, 0.35);
  }
  55% {
    box-shadow:
      0 0 0 3px rgba(255, 80, 80, 0.18),
      0 10px 26px rgba(0, 0, 0, 0.35);
  }
  100% {
    box-shadow:
      0 0 0 0 rgba(255, 80, 80, 0),
      0 10px 26px rgba(0, 0, 0, 0.35);
  }
}

.hero-shield {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.12rem 0.36rem 0.14rem;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(28, 52, 90, 0.65) 0%, rgba(10, 18, 30, 0.92) 100%);
  border: 1px solid rgba(110, 180, 255, 0.28);
  color: rgba(200, 235, 255, 0.92);
  font-size: 0.72rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

/* Иначе `display: inline-flex` выше перебивает UA `[hidden]` — чип остаётся с устаревшим числом */
.hero-shield[hidden] {
  display: none !important;
}

.hero-shield--chip {
  flex: 0 0 auto;
  padding: 0.12rem 0.34rem 0.13rem;
  font-size: 0.7rem;
}

.hero-plate--foe .hero-shield--chip {
  background: linear-gradient(180deg, rgba(52, 28, 38, 0.75) 0%, rgba(18, 10, 14, 0.92) 100%);
  border-color: rgba(220, 150, 170, 0.35);
  color: rgba(255, 220, 228, 0.95);
}

.hero-plate--self .hero-hp {
  color: #7ec8ff;
}

.hero-plate.hero--low .hero-hp {
  color: #ffb07a;
}

.hero-plate.hero--critical .hero-hp {
  color: #ff5c5c;
  animation: hero-hp-pulse 1.1s ease-in-out infinite;
}

@keyframes hero-hp-pulse {
  50% {
    opacity: 0.82;
    filter: brightness(1.15);
  }
}

.hero-plate.hero--low .hero-hp-chip {
  border-color: rgba(255, 160, 100, 0.45);
}

.hero-plate.hero--critical .hero-hp-chip {
  border-color: rgba(255, 80, 80, 0.55);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 0 12px rgba(255, 60, 60, 0.2);
}

.hero.targetable {
  cursor: pointer;
  border-color: #e6a23c !important;
  box-shadow:
    0 0 0 2px rgba(230, 162, 60, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 4px 18px rgba(0, 0, 0, 0.4) !important;
}
/* Мана: капсула как в HS — число слева, кристаллы фиксированного размера */
.mana-tray {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.4rem 0.3rem;
  min-height: 2.35rem;
  border-radius: 999px;
  background: linear-gradient(165deg, rgba(72, 82, 98, 0.55) 0%, rgba(28, 34, 44, 0.92) 45%, rgba(18, 22, 30, 0.98) 100%);
  border: 2px solid rgba(210, 218, 230, 0.38);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 2px 8px rgba(0, 0, 0, 0.35);
}

.mana-tray--foe {
  border-color: rgba(200, 140, 155, 0.35);
  background: linear-gradient(165deg, rgba(70, 48, 55, 0.6) 0%, rgba(28, 18, 22, 0.95) 100%);
}

.mana-tray-cap {
  flex-shrink: 0;
  min-width: 2.15rem;
  padding: 0.18rem 0.38rem;
  border-radius: 999px;
  background: linear-gradient(180deg, #5eb0ff 0%, #2a6ec4 55%, #1e4d8c 100%);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: center;
  line-height: 1.15;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.mana-tray--foe .mana-tray-cap {
  background: linear-gradient(180deg, #e07090 0%, #a83858 55%, #6a2038 100%);
}

.mana-tray-dots {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: center;
  gap: 0.2rem;
  flex: 1;
  min-width: 0;
}

.mana-dot {
  width: 0.52rem;
  height: 0.72rem;
  flex: 0 0 auto;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.mana-dot--full {
  background: linear-gradient(160deg, #7ec8ff 0%, #3d8ae8 40%, #2563b8 100%);
  box-shadow: 0 0 5px rgba(100, 180, 255, 0.55);
}

.mana-tray--foe .mana-dot--full {
  background: linear-gradient(160deg, #ff9ab0 0%, #d85878 45%, #a02848 100%);
  box-shadow: 0 0 5px rgba(255, 120, 150, 0.45);
}

.mana-dot--empty {
  background: linear-gradient(180deg, #343c48 0%, #1e242e 100%);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.55),
    inset 0 -1px 0 rgba(255, 255, 255, 0.05);
}
/*
 * Поле: сверху/снизу полоса маны внутри рамки + линия миньонов (.board-lane).
 */
.board {
  --board-mana-rail: 2.38rem;
  --board-slot-h: calc(6.35rem + 2px);
  --board-pad-y: 0.72rem;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  isolation: isolate;
  height: calc(var(--board-pad-y) + var(--board-mana-rail) + var(--board-slot-h) + var(--board-pad-y) * 0.55);
  min-height: calc(var(--board-pad-y) + var(--board-mana-rail) + var(--board-slot-h) + var(--board-pad-y) * 0.55);
  max-height: calc(var(--board-pad-y) + var(--board-mana-rail) + var(--board-slot-h) + var(--board-pad-y) * 0.55);
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0.28rem;
  padding: 0.42rem 0.5rem 0.38rem;
  margin-bottom: 0.28rem;
  align-items: stretch;
  justify-content: flex-start;
  border-radius: 14px;
  border: 1px solid rgba(72, 88, 112, 0.55);
  background-color: #080c12;
  background-image:
    radial-gradient(ellipse 95% 55% at 50% -5%, rgba(55, 75, 105, 0.22) 0%, transparent 58%),
    radial-gradient(ellipse 70% 40% at 80% 100%, rgba(30, 40, 58, 0.35) 0%, transparent 45%),
    radial-gradient(ellipse 60% 35% at 15% 95%, rgba(25, 35, 52, 0.3) 0%, transparent 42%),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 5px,
      rgba(255, 255, 255, 0.012) 5px,
      rgba(255, 255, 255, 0.012) 6px
    ),
    linear-gradient(168deg, #121a26 0%, #0a0e15 42%, #06080d 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.055),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35),
    0 3px 0 rgba(0, 0, 0, 0.25),
    0 8px 22px rgba(0, 0, 0, 0.38);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    filter 0.2s ease;
}

.board-mana--foe {
  padding-bottom: 0.06rem;
  margin-bottom: 0.02rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}

/* Чип «Стол» у левого края; мана — по центру всей полосы (1fr | auto | 1fr). */
.board-mana-foe-meta,
.board-mana-self-meta {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
  column-gap: 0.28rem;
}

.board-mana-foe-meta > .board-slot-cap,
.board-mana-self-meta > .board-slot-cap {
  grid-column: 1;
  justify-self: start;
  align-self: center;
}

.board-mana-tray-slot {
  grid-column: 2;
  justify-self: center;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.32rem;
  min-width: 0;
}

.mana-token-btn {
  flex-shrink: 0;
  appearance: none;
  margin: 0;
  padding: 0.14rem 0.38rem 0.16rem;
  font-size: 0.68rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  line-height: 1;
  border-radius: 999px;
  cursor: pointer;
  color: rgba(255, 248, 220, 0.96);
  border: 1px solid rgba(220, 175, 70, 0.65);
  background: linear-gradient(165deg, rgba(95, 72, 28, 0.98) 0%, rgba(42, 30, 10, 0.99) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 230, 160, 0.22),
    0 2px 0 rgba(0, 0, 0, 0.35),
    0 4px 10px rgba(0, 0, 0, 0.35);
}

.mana-token-btn:hover:not(:disabled) {
  border-color: rgba(255, 210, 120, 0.85);
  color: #fff;
}

.mana-token-btn:disabled {
  cursor: default;
  opacity: 0.42;
}

.mana-token-btn:focus-visible {
  outline: 2px solid rgba(120, 190, 255, 0.75);
  outline-offset: 2px;
}

.board-mana--self {
  padding-top: 0.06rem;
  margin-top: 0.02rem;
  border-top: 1px solid rgba(255, 255, 255, 0.055);
}

/* Лимиты: рука N/M, стол N/M */
.board-slot-cap {
  flex: 0 0 auto;
  align-self: center;
  text-align: center;
  font-size: 0.62rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  line-height: 1.2;
  padding: 0.08rem 0.35rem 0.1rem;
  border-radius: 999px;
  color: rgba(190, 205, 225, 0.78);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(120, 140, 170, 0.28);
  max-width: 100%;
}

.board-slot-cap.battle-cap--foe {
  color: rgba(210, 190, 200, 0.72);
  border-color: rgba(160, 120, 130, 0.28);
}

.battle-cap--hand {
  font-size: 0.64rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.45rem 0.12rem;
  border-radius: 999px;
  color: rgba(195, 215, 240, 0.85);
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(120, 160, 210, 0.32);
}

.battle-cap--warn {
  color: rgba(255, 210, 170, 0.95) !important;
  border-color: rgba(255, 140, 90, 0.55) !important;
  background: rgba(60, 24, 12, 0.45) !important;
  box-shadow: 0 0 12px rgba(255, 120, 60, 0.18);
}

.board-lane {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  align-content: center;
  justify-content: center;
}

/* Удержание «увеличить»: арт не обрезается рамкой поля; доска выше .board-vs (5) */
.board:has(.board-lane .minion-on-board.card--peek) {
  overflow: visible;
  z-index: 20;
}

.board::before {
  content: '';
  position: absolute;
  left: 8%;
  right: 8%;
  top: 5px;
  height: 1px;
  border-radius: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.07) 35%,
    rgba(255, 255, 255, 0.12) 50%,
    rgba(255, 255, 255, 0.07) 65%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 0;
}

.board::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 36px rgba(0, 0, 0, 0.32);
  z-index: 0;
}

.board-lane > .card {
  position: relative;
  z-index: 1;
}

.board-arena {
  position: relative;
  margin-bottom: 0.55rem;
}

/* Обратный отсчёт: верх арены, справа — поверх поля, ширину доски не сужаем */
.board-arena-timers {
  position: absolute;
  top: 0.22rem;
  right: max(0.22rem, env(safe-area-inset-right, 0px));
  z-index: 6;
  width: 2.65rem;
  height: 2.65rem;
  border-radius: 10px;
  background: transparent;
  border: none;
  box-shadow: none;
  pointer-events: none;
}

/* «Завершить ход» — оверлей у правого края, по вертикали на стыке полей (не сдвигает сетку) */
.board-arena-endturn {
  position: absolute;
  top: 50%;
  right: max(0.22rem, env(safe-area-inset-right, 0px));
  transform: translateY(-50%);
  z-index: 8;
  width: min(34vw, 3.65rem);
  pointer-events: auto;
}

.board-arena-endturn--waiting {
  width: min(36vw, 3.85rem);
}

.board-arena-endturn .battle-buttons-row--arena {
  flex: none;
  width: 100%;
  margin: 0;
  gap: 0;
}

.board-arena-endturn .btn-turn--arena {
  width: 100%;
  margin: 0;
  min-height: 4.25rem;
  padding: 0.52rem 0.32rem;
  font-size: 0.63rem;
  font-weight: 650;
  line-height: 1.22;
  letter-spacing: 0.02em;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: manual;
  color: #e9f7ef;
  text-align: center;
  border-radius: 12px;
  border: 1px solid rgba(130, 220, 170, 0.45);
  background: linear-gradient(
    168deg,
    rgba(58, 130, 96, 0.98) 0%,
    rgba(32, 88, 64, 0.99) 38%,
    rgba(22, 58, 44, 1) 100%
  );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 6px 20px rgba(0, 0, 0, 0.38),
    0 1px 0 rgba(0, 0, 0, 0.35);
  transition:
    filter 0.15s ease,
    box-shadow 0.15s ease,
    border-color 0.15s ease;
}

.board-arena-endturn .btn-turn--arena:not(:disabled):hover {
  filter: brightness(1.07);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 8px 24px rgba(20, 90, 60, 0.35),
    0 1px 0 rgba(0, 0, 0, 0.3);
}

.board-arena-endturn .btn-turn--arena:not(:disabled):active {
  filter: brightness(0.96);
  transform: translateY(1px);
}

/* Ход соперника: спокойная «плашка», без «бледного disabled» */
.board-arena-endturn .btn-turn--arena.btn-turn--waiting {
  cursor: default;
  color: #d8e2f0;
  font-weight: 600;
  letter-spacing: 0.03em;
  border-color: rgba(150, 175, 210, 0.38);
  background: linear-gradient(
    168deg,
    rgba(48, 58, 74, 0.96) 0%,
    rgba(28, 34, 46, 0.98) 45%,
    rgba(16, 20, 30, 1) 100%
  );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 5px 18px rgba(0, 0, 0, 0.36),
    inset 0 0 0 1px rgba(0, 0, 0, 0.2);
  opacity: 1;
  filter: none;
}

.board-arena-endturn .btn-turn--arena:disabled:not(.btn-turn--waiting) {
  opacity: 0.5;
  filter: saturate(0.7);
  cursor: not-allowed;
}

.board-arena:has(.minion-on-board.card--peek) {
  z-index: 90;
}

.board-arena .board--self {
  margin-bottom: 0;
}

.board-arena .board-vs {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0;
  pointer-events: none;
}

.board-vs-label {
  font-size: 0.72rem;
  font-weight: 800;
  font-style: italic;
  letter-spacing: 0.18em;
  color: rgba(195, 208, 225, 0.55);
  padding: 0.12rem 0.65rem;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(22, 30, 42, 0.95) 0%, rgba(10, 14, 20, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.board--foe {
  border-color: rgba(120, 65, 85, 0.45);
  background-image:
    radial-gradient(ellipse 90% 50% at 50% -8%, rgba(95, 40, 58, 0.32) 0%, transparent 55%),
    radial-gradient(ellipse 65% 38% at 85% 100%, rgba(55, 25, 38, 0.4) 0%, transparent 48%),
    radial-gradient(ellipse 55% 32% at 12% 92%, rgba(45, 22, 32, 0.35) 0%, transparent 40%),
    repeating-linear-gradient(
      8deg,
      transparent,
      transparent 5px,
      rgba(255, 120, 140, 0.018) 5px,
      rgba(255, 120, 140, 0.018) 6px
    ),
    linear-gradient(172deg, #1a1218 0%, #0c090c 45%, #060506 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 140, 160, 0.06),
    inset 0 -1px 0 rgba(0, 0, 0, 0.45),
    0 3px 0 rgba(0, 0, 0, 0.28),
    0 8px 22px rgba(0, 0, 0, 0.42);
}

.board--foe::before {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 120, 150, 0.12) 40%,
    rgba(255, 160, 180, 0.18) 50%,
    rgba(255, 120, 150, 0.12) 60%,
    transparent 100%
  );
}

.board--self {
  border-color: rgba(55, 110, 155, 0.48);
  background-image:
    radial-gradient(ellipse 90% 52% at 50% -6%, rgba(35, 75, 120, 0.35) 0%, transparent 56%),
    radial-gradient(ellipse 68% 40% at 18% 100%, rgba(25, 55, 90, 0.32) 0%, transparent 46%),
    radial-gradient(ellipse 60% 36% at 88% 92%, rgba(30, 60, 95, 0.28) 0%, transparent 44%),
    repeating-linear-gradient(
      6deg,
      transparent,
      transparent 5px,
      rgba(120, 190, 255, 0.02) 5px,
      rgba(120, 190, 255, 0.02) 6px
    ),
    linear-gradient(168deg, #101a28 0%, #080d14 46%, #05080e 100%);
  box-shadow:
    inset 0 1px 0 rgba(130, 190, 255, 0.08),
    inset 0 -1px 0 rgba(0, 0, 0, 0.4),
    0 3px 0 rgba(0, 0, 0, 0.25),
    0 8px 22px rgba(0, 0, 0, 0.38);
}

.board--self::before {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(120, 180, 255, 0.1) 38%,
    rgba(160, 210, 255, 0.16) 50%,
    rgba(120, 180, 255, 0.1) 62%,
    transparent 100%
  );
}

.board.board--drop-hover {
  border-color: rgba(90, 210, 140, 0.65);
  filter: saturate(1.08);
  box-shadow:
    inset 0 1px 0 rgba(140, 255, 190, 0.12),
    inset 0 0 0 2px rgba(70, 200, 120, 0.35),
    inset 0 -12px 28px rgba(20, 80, 50, 0.2),
    0 0 0 1px rgba(80, 220, 140, 0.2),
    0 8px 26px rgba(40, 140, 90, 0.22);
}

/* Залп: цель — всё поле врага */
.board--foe.targetable {
  cursor: pointer;
  border-color: #e6a23c !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 0 2px rgba(230, 162, 60, 0.38),
    0 4px 18px rgba(0, 0, 0, 0.38) !important;
}

.board--foe.aim-hover {
  border-color: #ffd78a !important;
  box-shadow:
    inset 0 0 32px rgba(255, 200, 120, 0.1),
    0 0 0 2px rgba(255, 215, 138, 0.42),
    0 6px 20px rgba(0, 0, 0, 0.4) !important;
}
.action-log {
  width: min(22rem, 90vw);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  padding: 0.28rem 0.48rem;
  border-radius: 12px;
  background: rgba(12, 16, 22, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(220, 228, 238, 0.88);
  font-size: 0.74rem;
  line-height: 1.15;
}

.action-log:empty {
  display: none;
}

.action-log .action-log-line {
  display: flex;
  align-items: center;
  gap: 0.38rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.action-log-dot {
  width: 0.52rem;
  height: 0.52rem;
  border-radius: 999px;
  flex: 0 0 auto;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.28);
}

.action-log-dot.self {
  background: #7ddea0;
}

.action-log-dot.foe {
  background: #f8a8c8;
}

.action-log-ico {
  width: 1.05rem;
  text-align: center;
  opacity: 0.88;
  flex: 0 0 auto;
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: -0.04em;
  color: rgba(200, 210, 225, 0.85);
}

.action-log-text {
  overflow: hidden;
  text-overflow: ellipsis;
}
.turn-bar {
  font-size: 1.05rem;
  padding: 0.45rem 0.5rem;
  color: #b8c5d3;
  line-height: 1.35;
  min-height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.turn-bar.yours {
  color: #6bcf7f;
  font-weight: 600;
}
.turn-bar.timer-urgent {
  color: #ff9a7a;
}
.turn-bar.timer-urgent.yours {
  color: #ff6b6b;
}
.btn-turn {
  background: #2d6a4f;
}
.btn-surrender {
  background: #5c2d2d;
  color: #f0d0d0;
  font-size: 0.85rem;
  padding: 0.45rem 0.65rem;
}
.btn-surrender:disabled {
  opacity: 0.35;
}
.hand-wrap {
  margin-top: 0.5rem;
  padding-bottom: max(0.25rem, env(safe-area-inset-bottom, 0px));
  perspective: 1180px;
  perspective-origin: 50% 100%;
}

/* Веер руки: absolute + transform из battle-client (lerp, как в демо hand-held fan) */
.hand {
  display: block;
  position: relative;
  width: 100%;
  max-width: min(100%, 38rem);
  margin: 0 auto;
  min-height: 7.75rem;
  overflow: visible;
  transform-style: preserve-3d;
}

.hand .card {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform-origin: 50% 100%;
  will-change: transform;
}
.card {
  width: 86px;
  min-height: 112px;
  padding: 0.35rem 0.4rem;
  border-radius: 8px;
  background: linear-gradient(160deg, #2a2438 0%, #1a1f2e 100%);
  border: 2px solid #4a4a6a;
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  user-select: none;
}
.card.selected {
  border-color: #ffd78a;
  box-shadow: 0 0 0 2px rgba(255, 215, 138, 0.35);
}

/* Можно сыграть (достаточно маны) */
.hand .card.card--playable {
  touch-action: none;
  border-color: rgba(110, 220, 140, 0.9);
  box-shadow:
    0 0 0 2px rgba(110, 220, 140, 0.22),
    0 10px 22px rgba(0, 0, 0, 0.45);
}

.hand .card.card--playable .cost {
  background: linear-gradient(180deg, #2ea86c 0%, #1f6d47 100%);
}
.hand .card.exhausted {
  opacity: 0.55;
}

/* На столе "exhausted" оставляем как логический флаг, но не делаем карту полупрозрачной. */
.board-lane > .minion-on-board.exhausted {
  opacity: 1;
}
.hand .card.card--dragging {
  opacity: 0.9;
  transform: scale(1.06);
  z-index: 100;
  touch-action: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
}

/* Тап: превью текста. В руке масштаб/подъём ещё в battle-client (handFanTick). */
.hand .card.card--peek {
  cursor: pointer;
  overflow: visible;
  box-shadow:
    0 0 0 2px rgba(255, 215, 138, 0.42),
    0 18px 44px rgba(0, 0, 0, 0.58);
}

.hand .card.card--peek.card--fullart {
  overflow: visible;
}

.hand .card.card--peek .card-fullart-hand-text {
  max-height: 5.75rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  font-size: 0.64rem;
  line-height: 1.22;
}

.hand .card.card--peek:not(.card--fullart) .stats {
  display: block;
  white-space: normal;
  max-height: 4.5rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  font-size: 0.62rem;
  line-height: 1.15;
  margin-top: 0.08rem;
}

/* По умолчанию (рука/стол) не показываем текст — только при просмотре в попапе. */
.hand .card:not(.card--preview) .name,
.hand .card:not(.card--preview) .stats,
.hand .card.card--fullart:not(.card--preview) .card-fullart-hand-meta {
  display: none !important;
}

.board-lane > .minion-on-board:not(.card--preview) .name {
  display: none !important;
}
.card.taunt {
  border-color: #5c7cfa;
}
.card .cost {
  align-self: flex-start;
  background: #3d7eff;
  color: #fff;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
}
.card .name {
  font-weight: 600;
  line-height: 1.15;
  flex: 1;
}
.card .stats {
  font-size: 0.72rem;
  color: #c5d0dc;
}
.minion-on-board {
  width: 68px;
  min-height: 80px;
}

.board-lane > .minion-on-board {
  padding: 0.2rem 0.26rem;
  font-size: 0.6rem;
  gap: 0.05rem;
  border-radius: 6px;
  cursor: pointer;
  transform-origin: center bottom;
  transition:
    transform 0.16s cubic-bezier(0.34, 1.2, 0.64, 1),
    box-shadow 0.16s ease,
    z-index 0s step-end;
}
.board-lane > .minion-on-board.card--peek {
  z-index: 2600;
  transform: scale(1.34);
  overflow: visible;
  box-shadow:
    0 0 0 2px rgba(255, 215, 138, 0.42),
    0 18px 44px rgba(0, 0, 0, 0.58);
  transition:
    transform 0.16s cubic-bezier(0.34, 1.2, 0.64, 1),
    box-shadow 0.16s ease,
    z-index 0s step-start;
}

.board-lane > .minion-on-board.card--peek.card--fullart {
  overflow: visible;
}

.board-lane > .minion-on-board.card--peek .card-fullart-live {
  max-height: 5.75rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  font-size: 0.64rem;
  line-height: 1.2;
}

.board-lane > .minion-on-board.card--peek:not(.card--fullart) .stats {
  display: block;
  white-space: normal;
  max-height: 4.5rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  font-size: 0.6rem;
  line-height: 1.15;
  margin-top: 0.06rem;
}
.board-lane > .minion-on-board.minion--summon,
.board-lane > .minion-on-board.minion--dying {
  transition: none;
}

.board-lane > .minion-on-board .cost {
  width: 1.05rem;
  height: 1.05rem;
  font-size: 0.62rem;
}

.board-lane > .minion-on-board .name {
  line-height: 1.05;
}

.board-lane > .minion-on-board .stats {
  font-size: 0.6rem;
}

.minion-on-board.can-attack {
  touch-action: none;
  border-color: #6bcf7f;
}
.minion-on-board.selected-att {
  border-color: #ffd78a;
  box-shadow: 0 0 0 2px rgba(255, 215, 138, 0.35);
}
.minion-on-board.targetable {
  border-color: #e6a23c;
}

.minion-on-board.battlecry-source {
  box-shadow: 0 0 0 2px rgba(120, 205, 255, 0.35);
}

/* Смерть миньона: тушим карточку; «рассыпание» даёт DOM-искры (.fx-minion-spark) */
.minion-on-board.minion--dying {
  pointer-events: none;
  z-index: 4;
  animation: minion-death 440ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes minion-death {
  0% {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: brightness(1);
  }
  35% {
    opacity: 0.9;
    transform: scale(1.03) translateY(-2px);
    filter: brightness(1.08);
  }
  100% {
    opacity: 0;
    transform: scale(0.84) translateY(6px);
    filter: brightness(0.62);
  }
}

/* Искры при смерти миньона */
.fx-minion-spark {
  position: fixed;
  left: var(--sx, 0);
  top: var(--sy, 0);
  width: 3px;
  height: 3px;
  margin: 0;
  border-radius: 1px;
  pointer-events: none;
  z-index: 2210;
  background: rgba(var(--spark-rgb), 1);
  box-shadow:
    0 0 4px rgba(var(--spark-rgb), 0.92),
    0 0 10px rgba(var(--spark-rgb), 0.32);
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  animation: minion-spark-fly 400ms cubic-bezier(0.22, 0.82, 0.3, 1) forwards;
}

.fx-minion-spark.fx-minion-spark--lg {
  width: 4px;
  height: 4px;
  border-radius: 2px;
  animation-duration: 440ms;
}

@keyframes minion-spark-fly {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  70% {
    opacity: 0.85;
  }
  100% {
    transform: translate(calc(-50% + var(--tx, 0px)), calc(-50% + var(--ty, 0px))) scale(0.25);
    opacity: 0;
  }
}

/* Aiming spell: highlight hovered target stronger */
.aim-hover {
  border-color: #ffd78a !important;
  box-shadow: 0 0 0 2px rgba(255, 215, 138, 0.35) !important;
}

/* Когда цель подсвечена — чуть “поднимаем” её, но без скачка layout */
.minion-on-board.targetable.aim-hover {
  transform: translateY(-1px);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.spell-aim {
  position: fixed;
  left: 0;
  top: 0;
  width: 32px;
  height: 32px;
  transform: translate(-9999px, -9999px);
  margin-left: -16px;
  margin-top: -16px;
  border-radius: 999px;
  border: 2px solid rgba(255, 215, 138, 0.9);
  box-shadow:
    0 0 0 3px rgba(0, 0, 0, 0.45),
    0 0 18px rgba(255, 215, 138, 0.25);
  pointer-events: none;
  z-index: 2000;
}

.spell-aim::before,
.spell-aim::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 2px;
  background: rgba(255, 215, 138, 0.95);
  transform: translate(-50%, -50%);
  border-radius: 2px;
}

.spell-aim::after {
  width: 2px;
  height: 18px;
}

.hand .card.spell-aiming {
  filter: brightness(1.08) saturate(1.05);
  box-shadow: 0 0 0 2px rgba(255, 215, 138, 0.2);
}

.minion-on-board.minion--summon {
  animation: minion-summon 0.52s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  transform-origin: center bottom;
}

@keyframes minion-summon {
  0% {
    transform: scale(0.45) translateY(18px);
    opacity: 0.25;
    filter: brightness(1.4) saturate(1.15);
  }
  55% {
    transform: scale(1.08) translateY(-6px);
    opacity: 1;
    filter: brightness(1.12);
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
    filter: none;
  }
}

/* Полноартовые карты (пока wolf) */
.card.card--fullart {
  padding: 0;
  overflow: hidden;
  border-radius: 10px;
  border: 2px solid #4a5568;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  position: relative;
}
/* Важно: .card.card--fullart ниже задаёт position:relative — для руки нужен absolute (веер + transform из JS) */
.hand .card.card--fullart {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform-origin: 50% 100%;
  width: 108px;
  min-height: 0;
}

/* Полноарт: общий интерактив (data-art задаётся в battle-client для любой карты с артом) */
.hand .card.card--fullart[data-art] {
  transition:
    box-shadow 0.22s ease,
    filter 0.22s ease;
}

.hand .card.card--fullart[data-art]:hover {
  filter: brightness(1.08) contrast(1.04) saturate(1.06);
}

.hand .card.card--fullart[data-art]:active {
  filter: brightness(0.96) saturate(0.95);
}
.hand .card.card--fullart[data-art] .card-fullart-img {
  transition: filter 0.28s ease;
}
.hand .card.card--fullart[data-art]:hover .card-fullart-img {
  filter: brightness(1.08) contrast(1.06) saturate(1.08);
}
.hand .card.card--fullart.card--playable[data-art] {
  animation: card-fullart-playable-pulse 2.6s ease-in-out infinite;
}
.hand .card.card--fullart.card--dragging[data-art],
.hand .card.card--fullart.spell-aiming[data-art] {
  animation: none !important;
}
@keyframes card-fullart-playable-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 2px rgba(110, 200, 140, 0.24), 0 4px 18px rgba(0, 0, 0, 0.52);
  }
  50% {
    box-shadow:
      0 0 0 2px rgba(130, 210, 155, 0.48),
      0 0 26px rgba(90, 165, 200, 0.2),
      0 8px 24px rgba(0, 0, 0, 0.55);
  }
}
@media (prefers-reduced-motion: reduce) {
  .hand .card.card--fullart[data-art] {
    transition: none;
    animation: none !important;
  }
}
.minion-on-board.card--fullart {
  width: 74px;
  min-height: 0;
}

.board-lane > .minion-on-board.card--fullart .card-fullart-live {
  font-size: 0.62rem;
  padding: 0.12rem 0.18rem;
}

.board-lane > .minion-on-board.card--fullart .card-fullart-badge {
  top: 3px;
  right: 3px;
  width: 1rem;
  height: 1rem;
  font-size: 0.58rem;
}
.card-fullart-frame {
  position: relative;
  line-height: 0;
  background: #0a0d12;
}
.card-fullart-img {
  width: 100%;
  height: auto;
  display: block;
  vertical-align: top;
}
.card-fullart-live {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.2rem 0.25rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.88));
  color: #f0f4f8;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  text-shadow: 0 1px 2px #000;
}
.card-fullart-hand-meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.38rem 0.45rem 0.42rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.92));
  color: #f0f4f8;
  text-align: center;
  line-height: 1.15;
}

.card-fullart-hand-name {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 2px #000;
}

.card-fullart-hand-text {
  margin-top: 0.12rem;
  font-size: 0.62rem;
  color: rgba(235, 241, 248, 0.88);
  text-shadow: 0 1px 2px #000;
}
.card-fullart-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 1;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: #5c7cfa;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
.card-fullart-badge--lifesteal {
  background: #b83280;
}
.card-fullart-badge--charge {
  background: #2ea86c;
}
.card-fullart-badge--aura {
  min-width: 1.35rem;
  width: auto;
  padding: 0 0.24rem;
  border-radius: 999px;
  background: #d97706;
}
.card-fullart-badge--shield {
  min-width: 1.35rem;
  width: auto;
  padding: 0 0.24rem;
  border-radius: 999px;
  background: #3b5bdb;
}
.card.card--fullart.taunt {
  border-color: #6b8cff;
  box-shadow: 0 0 0 1px rgba(108, 140, 255, 0.35), 0 4px 14px rgba(0, 0, 0, 0.45);
}

/* fullart идёт ниже базовых .selected / .selected-att и перетирал рамку — восстанавливаем состояния */
.hand .card.card--fullart.selected {
  border-color: #ffd78a;
  box-shadow: 0 0 0 2px rgba(255, 215, 138, 0.35), 0 4px 14px rgba(0, 0, 0, 0.45);
}

.minion-on-board.card--fullart.can-attack {
  border-color: #6bcf7f;
}

.minion-on-board.card--fullart.targetable {
  border-color: #e6a23c;
  box-shadow: 0 0 0 2px rgba(230, 162, 60, 0.35), 0 4px 14px rgba(0, 0, 0, 0.45);
}

.minion-on-board.card--fullart.selected-att {
  border-color: #ffd78a;
  box-shadow: 0 0 0 2px rgba(255, 215, 138, 0.35), 0 4px 14px rgba(0, 0, 0, 0.45);
}
.btn-secondary {
  margin-top: 0.75rem;
  background: #3a4553;
  color: #e8edf2;
}

body.game-ended {
  overflow: hidden;
  touch-action: none;
}

.game-end-modal {
  position: fixed;
  inset: 0;
  z-index: 4800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
    max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}

.game-end-modal.hidden {
  display: none !important;
}

.game-end-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 10, 0.78);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.game-end-modal__panel {
  position: relative;
  z-index: 1;
  width: min(360px, 100%);
  padding: 1.15rem 1.1rem 1.25rem;
  border-radius: 16px;
  background: linear-gradient(165deg, rgba(28, 34, 44, 0.98) 0%, rgba(12, 16, 22, 0.99) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.game-end-modal--win .game-end-modal__panel {
  border-color: rgba(110, 200, 140, 0.35);
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(0, 0, 0, 0.35),
    0 0 28px rgba(90, 180, 120, 0.12);
}

.game-end-modal--lose .game-end-modal__panel {
  border-color: rgba(220, 100, 100, 0.35);
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(0, 0, 0, 0.35),
    0 0 28px rgba(200, 80, 80, 0.1);
}

.game-end-modal__title {
  margin: 0 0 0.45rem;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #e8edf2;
  line-height: 1.2;
}

.game-end-modal--win .game-end-modal__title {
  color: #8ee4ac;
}

.game-end-modal--lose .game-end-modal__title {
  color: #ffabab;
}

.game-end-modal__detail {
  margin: 0 0 0.85rem;
  font-size: 0.86rem;
  line-height: 1.4;
  color: #9aacbc;
}

.game-end-modal__detail:empty {
  display: none;
}

.game-end-modal__log.action-log {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  max-height: 10rem;
  overflow-x: hidden;
  overflow-y: auto;
  text-align: left;
  -webkit-overflow-scrolling: touch;
}

.game-end-modal__actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.game-end-modal__actions .game-end-modal__cta {
  margin-top: 0;
  width: 100%;
}

.game-end-modal__cta {
  width: 100%;
  margin-top: 1rem;
  margin-bottom: 0;
  padding: 0.55rem 1rem;
  font-weight: 600;
}

.game-end-modal__actions .game-end-modal__cta--rematch {
  margin-top: 0;
}

.rematch-invite-modal {
  position: fixed;
  inset: 0;
  z-index: 4900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
    max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}

.rematch-invite-modal.hidden {
  display: none !important;
}

.rematch-invite-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 10, 0.68);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.rematch-invite-modal__panel {
  position: relative;
  z-index: 1;
  width: min(320px, 100%);
  padding: 1.1rem 1rem 1.15rem;
  border-radius: 14px;
  background: linear-gradient(165deg, rgba(32, 40, 54, 0.99) 0%, rgba(14, 18, 28, 0.99) 100%);
  border: 1px solid rgba(120, 170, 255, 0.32);
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.48);
  text-align: center;
}

.rematch-invite-modal__title {
  margin: 0 0 0.45rem;
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #e8edf2;
}

.rematch-invite-modal__text {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #9aacbc;
}

.rematch-invite-modal__actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.rematch-invite-modal__btn {
  width: 100%;
  padding: 0.52rem 0.9rem;
  font-weight: 600;
}

.card-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
    max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  background: transparent;
}

.card-preview-modal.hidden {
  display: none !important;
}

.card-preview-modal__stage {
  width: 100%;
  display: grid;
  place-items: center;
  padding-top: 0;
}

.card-preview-modal__stage .card {
  transform: scale(2.15);
  transform-origin: center center;
  filter: drop-shadow(0 26px 60px rgba(0, 0, 0, 0.55));
}

.card-preview-modal__stage .card * {
  pointer-events: none;
}

/* Превью: текст аккуратнее (не огромный), читабельные интервалы. */
.card-preview-modal__stage .card.card--preview .name {
  font-size: clamp(0.38rem, 1.2vw, 0.52rem);
  line-height: 1.12;
  letter-spacing: 0.01em;
  text-align: center;
  max-width: 92%;
  margin-left: auto;
  margin-right: auto;
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  text-shadow:
    0 1px 1px rgba(0, 0, 0, 0.55),
    0 0 10px rgba(0, 0, 0, 0.35);
}

.card-preview-modal__stage .card.card--preview .stats {
  font-size: clamp(0.34rem, 1.1vw, 0.46rem);
  line-height: 1.15;
  text-shadow:
    0 1px 1px rgba(0, 0, 0, 0.55),
    0 0 10px rgba(0, 0, 0, 0.28);
}

.card-preview-modal__stage .card.card--preview.card--fullart .card-fullart-hand-name {
  font-size: clamp(0.38rem, 1.2vw, 0.5rem);
  line-height: 1.12;
  text-align: center;
  max-width: 92%;
  margin-left: auto;
  margin-right: auto;
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  text-shadow:
    0 1px 1px rgba(0, 0, 0, 0.55),
    0 0 10px rgba(0, 0, 0, 0.35);
}

.card-preview-modal__stage .card.card--preview.card--fullart .card-fullart-hand-text {
  font-size: clamp(0.34rem, 1.05vw, 0.44rem);
  line-height: 1.18;
  max-height: none;
  text-shadow:
    0 1px 1px rgba(0, 0, 0, 0.55),
    0 0 10px rgba(0, 0, 0, 0.28);
}

@media (prefers-reduced-motion: reduce) {
  .game-end-modal__backdrop {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .board-lane > .minion-on-board,
  .board-lane > .minion-on-board.card--peek {
    transition: none;
  }
}

/* Промежуточный экран при восстановлении сессии / рефреше в бою — скрывает мигание «Режимы». */
.app-boot-splash {
  position: fixed;
  inset: 0;
  z-index: 4500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
  background: radial-gradient(ellipse 85% 70% at 50% 42%, rgba(55, 78, 118, 0.35) 0%, transparent 58%),
    radial-gradient(ellipse 100% 55% at 50% 100%, rgba(12, 16, 24, 0.92) 0%, transparent 52%), #0a0d12;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.app-boot-splash.hidden {
  display: none !important;
}

.app-boot-splash__inner {
  text-align: center;
  max-width: 18rem;
}

.app-boot-splash__logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.45));
  animation: app-boot-splash-logo 1.35s ease-in-out infinite;
}

.app-boot-splash__logo-img {
  display: block;
  width: 5.5rem;
  height: auto;
  max-height: 6.25rem;
}

@keyframes app-boot-splash-logo {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.92;
  }
  50% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-boot-splash__logo {
    animation: none;
  }
}

.app-boot-splash__title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #e8f0fc;
}

.app-boot-splash__sub {
  margin: 0.55rem 0 0;
  font-size: 0.8rem;
  color: #8a9bad;
}

.telegram-gate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: radial-gradient(ellipse at center, #151b24 0%, #0a0d12 70%);
}

.telegram-gate.hidden {
  display: none !important;
}

.telegram-gate__panel {
  max-width: 22rem;
  padding: 1.35rem 1.25rem;
  border-radius: 14px;
  border: 1px solid rgba(100, 170, 255, 0.28);
  background: linear-gradient(165deg, #1a2432 0%, #0e141c 100%);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.telegram-gate__title {
  margin: 0 0 0.65rem;
  font-size: 1.1rem;
  font-weight: 800;
  color: #e8f0fc;
}

.telegram-gate__text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: #97a6b6;
}

.beta-gate {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: radial-gradient(ellipse at 30% 20%, rgba(90, 50, 140, 0.35) 0%, transparent 55%),
    radial-gradient(ellipse at center, #151b24 0%, #0a0d12 72%);
}

.beta-gate.hidden {
  display: none !important;
}

.beta-gate__panel {
  max-width: 24rem;
  padding: 1.45rem 1.35rem;
  border-radius: 16px;
  border: 1px solid rgba(180, 130, 255, 0.35);
  background: linear-gradient(168deg, #1e1830 0%, #0e121c 100%);
  box-shadow: 0 14px 48px rgba(0, 0, 0, 0.55);
}

.beta-gate__badge {
  margin: 0 0 0.5rem;
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #e8d8ff;
  background: rgba(140, 90, 220, 0.35);
  border: 1px solid rgba(200, 160, 255, 0.4);
}

.beta-gate__title {
  margin: 0 0 0.75rem;
  font-size: 1.2rem;
  font-weight: 800;
  color: #f2ecff;
  line-height: 1.25;
}

.beta-gate__text {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #a8b0c4;
}

.beta-gate__build {
  margin: 0 0 1.1rem;
  font-size: 0.82rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #c4b8e0;
}

.beta-gate__actions {
  margin-bottom: 0.85rem;
}

.beta-gate__cta {
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #120818;
  cursor: pointer;
  background: linear-gradient(180deg, #e4c8ff 0%, #b98cf0 100%);
  box-shadow: 0 4px 18px rgba(120, 70, 200, 0.45);
}

.beta-gate__cta:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.beta-gate__status {
  margin: 0 0 0.65rem;
  min-height: 1.35em;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #c8e6d0;
}

.beta-gate__hint {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.4;
  color: #6d7588;
}

@media (prefers-reduced-motion: reduce) {
  .hero-plate.hero--critical .hero-hp {
    animation: none;
  }
  .minion-on-board.minion--summon {
    animation: none;
  }
  .turn-timer.timer-urgent {
    animation: none;
  }
}

/*
 * Компактная арена: меньше вертикальные отступы, чуть ниже герои/лог/таймер,
 * плотнее поля и мини-карты на столе и в руке (только экран боя).
 */
body:has(#battle:not(.hidden)) .wrap {
  padding-left: max(0.55rem, env(safe-area-inset-left, 0px));
  padding-right: max(0.55rem, env(safe-area-inset-right, 0px));
}

#battle:not(.hidden) .battle-top-strip {
  margin-bottom: 0.2rem;
}

#battle:not(.hidden) .battle-reconnect-banner {
  margin-bottom: 0.26rem;
  padding: 0.2rem 0.45rem;
  font-size: 0.66rem;
}

#battle:not(.hidden) .battle-hud-bar .turn-bar {
  min-height: 2rem;
  font-size: 0.88rem;
  padding: 0.26rem 0.38rem;
  line-height: 1.22;
}

#battle:not(.hidden) .battle-settings-trigger {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 8px;
}

#battle:not(.hidden) .battle-settings-trigger__ico {
  font-size: 1rem;
}

#battle:not(.hidden) .hero-row {
  margin-bottom: 0.26rem;
}

#battle:not(.hidden) .hero-row--triple {
  --hero-rail-w: 3.2rem;
  gap: 0.36rem;
}

#battle:not(.hidden) .foe-hand-slot .foe-hand {
  transform: scale(0.92);
  min-height: 2.75rem;
  max-height: 3.35rem;
}

#battle:not(.hidden) .foe-hand__card {
  width: 1.92rem;
  height: 2.48rem;
  margin-left: -0.96rem;
  border-radius: 8px;
}

#battle:not(.hidden) .foe-hand__pile,
#battle:not(.hidden) .foe-hand__inner {
  min-height: 2.85rem;
  max-height: 3.5rem;
}

#battle:not(.hidden) .foe-hand__count {
  font-size: 0.78rem;
  bottom: -0.04rem;
}

#battle:not(.hidden) .hero-row--triple > .hero-center-stack,
#battle:not(.hidden) .hero-row--triple > .foe-hand-slot,
#battle:not(.hidden) .hero-row--triple > .hero-side-rail,
#battle:not(.hidden) .hero-row--triple > .hero-deck-slot {
  min-height: 4.45rem;
}

#battle:not(.hidden) .btn-battle-comm {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 10px;
}

#battle:not(.hidden) .btn-battle-comm__ico {
  font-size: 1.02rem;
}

#battle:not(.hidden) .hero-deck-slot .meta-pile-stack {
  width: 2.62rem;
  height: 2.85rem;
}

#battle:not(.hidden) .hero-deck-slot .meta-pile-back {
  width: 1.82rem;
  height: 2.42rem;
  top: 0.2rem;
}

#battle:not(.hidden) .hero-deck-slot .meta-pile-back:nth-child(2) {
  left: 0.15rem;
  top: 0.1rem;
}

#battle:not(.hidden) .hero-deck-slot .meta-pile-back:nth-child(3) {
  left: 0.3rem;
  top: 0;
}

#battle:not(.hidden) .hero-plate {
  gap: 0.12rem;
  padding: 0.38rem 0.45rem 0.34rem;
  border-radius: 12px;
}

#battle:not(.hidden) .hero-plate .hero-portrait {
  gap: 0.52rem;
}

#battle:not(.hidden) .hero-portrait__icon-wrap {
  width: 3.35rem;
  height: 3.35rem;
  border-radius: 12px;
}

#battle:not(.hidden) .hero-plate .hero-portrait__icon-wrap .hero-avatar {
  width: 2.72rem;
  height: 2.72rem;
  border-radius: 9px;
}

#battle:not(.hidden) .hero-plate .hero-portrait__icon-wrap .hero-avatar-img {
  border-radius: 9px;
}

#battle:not(.hidden) .hero-avatar-fallback {
  font-size: 0.88rem;
}

#battle:not(.hidden) .hero-plate .hero-name {
  font-size: 0.82rem;
}

#battle:not(.hidden) .hero-plate .hero-role-chip {
  margin: 0.12rem 0 0;
  align-self: flex-start;
  padding: 0.08rem 0.22rem 0.08rem 0.14rem;
}

#battle:not(.hidden) .hero-role-chip__text {
  font-size: 0.58rem;
}

#battle:not(.hidden) .hero-hp-chip {
  padding: 0.08rem 0.28rem 0.1rem;
}

#battle:not(.hidden) .hero-hp {
  font-size: 0.8rem;
}

#battle:not(.hidden) .hero-hand-cap {
  right: 0.32rem;
  bottom: 0.26rem;
  max-width: min(9.2rem, calc(100% - 2rem));
}

#battle:not(.hidden) .board-arena-timers .turn-timer--compact {
  height: 2.45rem;
  min-height: 2.45rem;
  max-height: 2.45rem;
  max-width: 2.45rem;
  font-size: 0.72rem;
  padding: 0.05rem 0.08rem;
}

#battle:not(.hidden) .board-arena-timers {
  width: 2.45rem;
  height: 2.45rem;
}

#battle:not(.hidden) .battle-top-log .action-log.action-log--hud {
  max-height: 2.45rem;
  min-height: 1.75rem;
  font-size: 0.6rem;
  padding: 0.12rem 0.26rem;
}

#battle:not(.hidden) .board-mana .mana-tray {
  min-height: 1.85rem;
  padding: 0.14rem 0.26rem 0.16rem;
}

#battle:not(.hidden) .mana-token-btn {
  padding: 0.1rem 0.3rem 0.12rem;
  font-size: 0.62rem;
}

#battle:not(.hidden) .board-arena {
  margin-bottom: 0.22rem;
}

#battle:not(.hidden) .board {
  /* мана внутри рамки + слот миньонов */
  --board-mana-rail: 2.05rem;
  --board-slot-h: calc(5.95rem + 2px);
  --board-pad-y: 0.42rem;
  gap: 0.22rem;
  padding: 0.3rem 0.34rem 0.26rem;
  margin-bottom: 0.1rem;
  border-radius: 10px;
}

#battle:not(.hidden) .minion-on-board {
  width: 60px;
  min-height: 72px;
}

#battle:not(.hidden) .minion-on-board.card--fullart {
  width: 66px;
}

#battle:not(.hidden) .board-lane > .minion-on-board {
  padding: 0.14rem 0.18rem;
  font-size: 0.55rem;
}

#battle:not(.hidden) .board-lane > .minion-on-board .cost {
  width: 0.98rem;
  height: 0.98rem;
  font-size: 0.58rem;
}

#battle:not(.hidden) .board-lane > .minion-on-board .stats {
  font-size: 0.56rem;
}

#battle:not(.hidden) .board-arena-endturn {
  width: min(32vw, 3.45rem);
}

#battle:not(.hidden) .board-arena-endturn--waiting {
  width: min(34vw, 3.65rem);
}

#battle:not(.hidden) .board-arena-endturn .btn-turn--arena {
  min-height: 3.85rem;
  padding: 0.42rem 0.28rem;
  font-size: 0.6rem;
  border-radius: 10px;
}

#battle:not(.hidden) .btn-surrender {
  font-size: 0.8rem;
  padding: 0.38rem 0.55rem;
}

#battle:not(.hidden) .hand-wrap {
  margin-top: 0.12rem;
  flex-shrink: 0;
}

body.game-active:has(#battle:not(.hidden)) #battle:not(.hidden) .hero-row {
  flex-shrink: 0;
}

body.game-active:has(#battle:not(.hidden)) #battle:not(.hidden) .battle-top-strip,
body.game-active:has(#battle:not(.hidden)) #battle:not(.hidden) .battle-reconnect-banner {
  flex-shrink: 0;
}

#battle:not(.hidden) .hand {
  min-height: 7.1rem;
  max-width: min(100%, 34rem);
}

#battle:not(.hidden) .card {
  width: 78px;
  min-height: 100px;
  padding: 0.26rem 0.32rem;
  font-size: 0.64rem;
}

#battle:not(.hidden) .hand .card.card--fullart {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform-origin: 50% 100%;
  width: 94px;
}

#battle:not(.hidden) .card .cost {
  width: 1.2rem;
  height: 1.2rem;
  font-size: 0.66rem;
}

#battle:not(.hidden) .card .stats {
  font-size: 0.66rem;
}

/* Онбординг: первый визит и «Как играть?» */
.loadout-onboarding-link {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 0.35rem 0 0;
  padding: 0.25rem 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: #7eb8ff;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
  opacity: 0.92;
}

.loadout-onboarding-link:active {
  opacity: 1;
}

body.onboarding-active,
body.tutorial-battle-outro-active {
  overflow: hidden;
}

.tutorial-battle-outro.onboarding {
  z-index: 5600;
}

.onboarding {
  position: fixed;
  inset: 0;
  z-index: 4650;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.onboarding.hidden {
  display: none !important;
}

.onboarding__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 14, 0.72);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.onboarding__sheet {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: min(88dvh, 32rem);
  display: flex;
  flex-direction: column;
  padding: 1rem 1rem max(1rem, env(safe-area-inset-bottom));
  border-radius: 20px 20px 0 0;
  background: linear-gradient(180deg, rgba(26, 34, 48, 0.99) 0%, rgba(10, 14, 20, 1) 100%);
  border: 1px solid rgba(120, 160, 220, 0.22);
  border-bottom: none;
  box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.45);
}

.onboarding__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.onboarding__step {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8eb8ff;
}

.onboarding__skip {
  flex-shrink: 0;
  padding: 0.28rem 0.55rem;
  margin: 0;
  border: none;
  border-radius: 8px;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  color: #a8b8cc;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.onboarding__title {
  margin: 0 0 0.6rem;
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.25;
  color: #f1f5fb;
}

.onboarding__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  margin-bottom: 0.75rem;
  font-size: 0.86rem;
  line-height: 1.48;
  color: #b4c2d4;
}

.onboarding__p {
  margin: 0 0 0.65rem;
}

.onboarding__p:last-child {
  margin-bottom: 0;
}

.onboarding__p strong {
  color: #e8f0fc;
  font-weight: 650;
}

.onboarding__dots {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.onboarding__dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.onboarding__dot.is-active {
  background: #5a9cff;
  transform: scale(1.15);
}

.onboarding__nav {
  display: flex;
  gap: 0.55rem;
  align-items: stretch;
}

.onboarding__nav-back {
  flex: 0 1 auto;
  min-width: 5.5rem;
}

.onboarding__nav-next {
  flex: 1 1 auto;
  min-height: 2.65rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 12px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(180deg, #4a8cff 0%, #2d6ae8 100%);
}

.onboarding__nav-next:active {
  transform: scale(0.99);
}

@media (prefers-reduced-motion: reduce) {
  .onboarding__nav-next:active {
    transform: none;
  }
}
