/* Базовая палитра и экраны. Средневековье: камень, пергамент, потемневшее золото. */
:root {
  --stone-950: #0d0b09;
  --stone-900: #12100e;
  --stone-800: #1b1815;
  --stone-700: #262119;
  --stone-600: #3a3226;
  --parchment: #e8dcc0;
  --parchment-dim: #b6a682;
  --gold: #c8a44a;
  --gold-bright: #f0cf7a;
  --blood: #8b2f2f;
  --blood-bright: #c14b45;
  --witch: #8f6bd0;
  --necro: #4fa08b;
  --knight: #c8a44a;
  --ok: #6fae5a;
  --mana: #3f7fd0;
  --mana-bright: #6fb3f5;

  --radius: 10px;
  --shadow-deep: 0 18px 40px rgba(0, 0, 0, .55);
  --font-title: 'Palatino Linotype', 'Book Antiqua', Georgia, serif;
  --font-body: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  background:
    radial-gradient(1200px 700px at 50% -10%, #241f18 0%, transparent 60%),
    linear-gradient(180deg, var(--stone-900) 0%, var(--stone-950) 100%);
  color: var(--parchment);
  font-family: var(--font-body);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* ───────────────────────────── экраны ───────────────────────────── */

.screen {
  position: fixed;
  inset: 0;
  display: none;
  overflow: auto;
}

.screen--active { display: block; }

/* ───────────────────────────── кнопки ───────────────────────────── */

.btn {
  font-family: var(--font-title);
  font-size: 16px;
  letter-spacing: .04em;
  color: var(--parchment);
  background: linear-gradient(180deg, var(--stone-700), var(--stone-800));
  border: 1px solid var(--stone-600);
  border-radius: var(--radius);
  padding: 11px 22px;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}

.btn:hover:not(:disabled) {
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(200, 164, 74, .22);
  transform: translateY(-1px);
}

.btn:disabled { opacity: .4; cursor: default; }

.btn--major {
  background: linear-gradient(180deg, #6a5527, #40331a);
  border-color: var(--gold);
  color: var(--gold-bright);
  font-size: 19px;
  padding: 14px 34px;
}

.btn--ghost { background: transparent; }
.btn--small { font-size: 14px; padding: 8px 14px; }

.btn--turn {
  background: linear-gradient(180deg, #6a5527, #3a2e17);
  border-color: var(--gold);
  color: var(--gold-bright);
  font-size: 17px;
  min-width: 150px;
  box-shadow: 0 0 24px rgba(200, 164, 74, .14);
}

.btn--turn.is-waiting {
  opacity: .45;
  color: var(--parchment-dim);
  border-color: var(--stone-600);
  box-shadow: none;
  cursor: default;
}

/* ─────────────────────────── главное меню ───────────────────────── */

.menu {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 24px 60px;
  text-align: center;
}

.menu__title {
  font-family: var(--font-title);
  font-size: clamp(38px, 7vw, 64px);
  margin: 0 0 8px;
  letter-spacing: .08em;
  color: var(--gold-bright);
  text-shadow: 0 0 30px rgba(200, 164, 74, .3), 0 4px 0 #000;
}

.menu__subtitle {
  margin: 0 0 34px;
  color: var(--parchment-dim);
  font-style: italic;
}

.menu__block { margin-bottom: 26px; }

.menu__label {
  font-family: var(--font-title);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--parchment-dim);
  margin: 0 0 12px;
}

.choice {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.choice__btn {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--parchment-dim);
  background: var(--stone-800);
  border: 1px solid var(--stone-600);
  border-radius: 999px;
  padding: 9px 20px;
  cursor: pointer;
  transition: all .14s ease;
}

.choice__btn:hover { color: var(--parchment); border-color: var(--parchment-dim); }

.choice__btn--on {
  color: var(--stone-900);
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  border-color: var(--gold-bright);
  font-weight: 600;
}

.heroes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.hero-card {
  position: relative;
  text-align: left;
  padding: 16px 16px 14px;
  background: linear-gradient(180deg, var(--stone-700), var(--stone-800));
  border: 1px solid var(--stone-600);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .16s ease;
  color: inherit;
  font: inherit;
}

.hero-card:hover { transform: translateY(-3px); border-color: var(--parchment-dim); }

.hero-card--on {
  border-color: var(--pick, var(--gold));
  box-shadow: 0 0 0 1px var(--pick, var(--gold)), 0 0 26px -6px var(--pick, var(--gold));
}

.hero-card__sigil { font-size: 30px; line-height: 1; margin-bottom: 8px; }

.hero-card__name {
  font-family: var(--font-title);
  font-size: 19px;
  color: var(--pick, var(--gold));
  margin-bottom: 2px;
}

.hero-card__title {
  font-size: 12px;
  color: var(--parchment-dim);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 9px;
}

.hero-card__blurb { font-size: 13px; line-height: 1.45; color: #cbbf9f; }

.hero-card__power {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--stone-600);
  font-size: 12px;
  color: var(--parchment-dim);
}

.hero-card__power b { color: var(--parchment); font-weight: 600; }

.menu__footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 26px;
}

.menu__record { font-size: 13px; color: var(--parchment-dim); }

/* ─────────────────────────── замена карт ────────────────────────── */

.mulligan {
  max-width: 900px;
  margin: 0 auto;
  padding: 50px 24px;
  text-align: center;
}

.mulligan__title {
  font-family: var(--font-title);
  font-size: 34px;
  color: var(--gold-bright);
  margin: 0 0 6px;
}

.mulligan__hint { color: var(--parchment-dim); margin: 0 0 28px; }

.mulligan__hand {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 32px;
  min-height: 250px;
}

.mulligan__hand .card { cursor: pointer; }

.mulligan__hand .card.is-tossed {
  opacity: .45;
  transform: translateY(10px) rotate(-3deg);
  filter: grayscale(.7);
}

/* ────────────────────────── перекрытия ──────────────────────────── */

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(8, 7, 6, .93);
  backdrop-filter: blur(10px);
  z-index: 60;
}

.overlay[hidden] { display: none; }

.overlay__card {
  max-width: 460px;
  padding: 34px 40px;
  text-align: center;
  background: linear-gradient(180deg, var(--stone-700), var(--stone-900));
  border: 1px solid var(--gold);
  border-radius: 14px;
  box-shadow: var(--shadow-deep);
}

.overlay__card h2 {
  font-family: var(--font-title);
  font-size: 30px;
  color: var(--gold-bright);
  margin: 0 0 10px;
}

.overlay__card p { color: var(--parchment-dim); margin: 0 0 22px; line-height: 1.5; }

.overlay__buttons { display: flex; gap: 12px; justify-content: center; }

/* ───────────────────────────── собрание ─────────────────────────── */

.collection { padding: 24px; max-width: 1400px; margin: 0 auto; }

.collection__bar {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.collection__bar h2 {
  font-family: var(--font-title);
  color: var(--gold-bright);
  margin: 0;
  flex: 1 1 auto;
}

.collection__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 18px;
  padding-bottom: 40px;
}

/* ───────────────────────────── подсказка ────────────────────────── */

.tooltip {
  position: fixed;
  z-index: 200;
  pointer-events: none;
  max-width: 260px;
  padding: 10px 13px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--parchment);
  background: rgba(12, 10, 8, .97);
  border: 1px solid var(--gold);
  border-radius: 8px;
  box-shadow: var(--shadow-deep);
}

.tooltip[hidden] { display: none; }
.tooltip b { color: var(--gold-bright); }

@media (max-width: 720px) {
  .menu { padding: 28px 16px 40px; }
  .heroes { grid-template-columns: 1fr; }
}

/* Карта: пергаментный прямоугольник с кристаллом маны, гербом и статами. */
.card {
  position: relative;
  width: 148px;
  height: 208px;
  flex: 0 0 auto;
  padding: 10px 10px 8px;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(255, 245, 220, .1), transparent 40%),
    linear-gradient(180deg, #3a3226 0%, #241f18 100%);
  border: 1px solid #4a3f2d;
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 240, 200, .07);
  user-select: none;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.card--knight { border-color: #6d5a2b; }
.card--witch { border-color: #5a4173; }
.card--warlock { border-color: #2f6559; }

.card--rare::after,
.card--epic::after,
.card--legendary::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 12px;
  pointer-events: none;
}

.card--rare::after { box-shadow: inset 0 0 0 1px #4f7fbf; }
.card--epic::after { box-shadow: inset 0 0 0 1px #9a5fd0; }
.card--legendary::after { box-shadow: inset 0 0 0 2px #d9a441, 0 0 22px -6px #d9a441; }

.card__cost {
  position: absolute;
  top: -8px;
  left: -8px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 700;
  color: #eaf4ff;
  background: radial-gradient(circle at 35% 30%, var(--mana-bright), #1e4c86 70%);
  border: 1px solid #8dc4ff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .6);
}

.card__art {
  height: 62px;
  display: grid;
  place-items: center;
  font-size: 34px;
  margin: 2px 0 6px;
  background: radial-gradient(ellipse at 50% 60%, rgba(255, 240, 200, .12), transparent 70%);
  border-radius: 8px;
}

.card__name {
  font-family: var(--font-title);
  font-size: 13px;
  line-height: 1.15;
  text-align: center;
  color: var(--parchment);
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card__text {
  flex: 1 1 auto;
  font-size: 10.5px;
  line-height: 1.3;
  text-align: center;
  color: #c3b795;
  padding: 3px 2px 0;
  overflow: hidden;
}

.card__tribe {
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-align: center;
  color: var(--parchment-dim);
  opacity: .75;
}

.card__stats {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 2px;
}

.stat {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 700;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .55);
}

.stat--attack {
  color: #fff1d6;
  background: radial-gradient(circle at 35% 30%, #d8b56a, #7a5a1c 70%);
  border: 1px solid #e6c87d;
}

.stat--health {
  color: #ffe9e5;
  background: radial-gradient(circle at 35% 30%, #d1584f, #6d1f1c 70%);
  border: 1px solid #e58b81;
}

.stat--durability {
  color: #e6f3ff;
  background: radial-gradient(circle at 35% 30%, #7fa9d8, #2d4d75 70%);
  border: 1px solid #a5c9ee;
}

.stat--buffed { color: #d7ffd0; box-shadow: 0 0 12px rgba(120, 220, 110, .6); }
.stat--hurt { color: #ffd0d0; }

/* карта в руке */
.hand .card {
  cursor: pointer;
  margin-inline: -13px;
  transform-origin: bottom center;
}

.hand .card:first-child { margin-left: 0; }
.hand .card:last-child { margin-right: 0; }

.hand .card:hover {
  transform: translateY(-26px) scale(1.08);
  z-index: 20;
  box-shadow: 0 18px 34px rgba(0, 0, 0, .6);
}

.card.is-playable {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold), 0 0 20px -4px var(--gold-bright), 0 6px 16px rgba(0, 0, 0, .5);
}

.card.is-selected {
  transform: translateY(-32px) scale(1.1);
  z-index: 25;
  box-shadow: 0 0 0 2px var(--gold-bright), 0 0 34px -4px var(--gold-bright);
}

.card.is-unplayable { filter: grayscale(.55) brightness(.72); }

/* рубашка карты соперника */
.card-back {
  width: 62px;
  height: 88px;
  flex: 0 0 auto;
  margin-inline: -14px;
  border-radius: 8px;
  border: 1px solid #4a3f2d;
  background:
    repeating-linear-gradient(45deg, rgba(200, 164, 74, .09) 0 6px, transparent 6px 12px),
    linear-gradient(180deg, #3b2f1f, #1d1811);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .5);
  display: grid;
  place-items: center;
  color: rgba(200, 164, 74, .5);
  font-size: 20px;
}

/* карточка в собрании */
.collection__grid .card { width: 100%; height: 232px; }

/* Стол: две половины поля, гербы героев, руки и журнал по бокам. */
.table {
  display: grid;
  grid-template-columns: 210px 1fr 190px;
  height: 100dvh;
  gap: 8px;
  padding: 8px;
}

.field {
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  min-width: 0;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(200, 164, 74, .07), transparent 65%),
    linear-gradient(180deg, #191510, #221c14 50%, #191510);
  border: 1px solid var(--stone-700);
  border-radius: 14px;
  /* Карта при наведении приподнимается над рукой — обрезать её нельзя. */
  overflow: visible;
}

.side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  min-height: 0;
}

.side--enemy { justify-content: flex-start; }
.side--own { justify-content: flex-end; }

/* ─────────────────────────── ряд героя ──────────────────────────── */

.hero-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.hero {
  position: relative;
  width: 104px;
  height: 66px;
  display: grid;
  place-items: center;
  padding: 6px;
  background: linear-gradient(180deg, var(--stone-700), var(--stone-900));
  border: 2px solid var(--tint, var(--gold));
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .5);
  cursor: default;
  transition: box-shadow .15s ease, transform .15s ease;
}

.hero__sigil { font-size: 26px; line-height: 1; }

.hero__name {
  font-family: var(--font-title);
  font-size: 11px;
  color: var(--tint, var(--gold));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 96px;
}

.hero__health {
  position: absolute;
  right: -12px;
  bottom: -10px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-family: var(--font-title);
  font-size: 17px;
  font-weight: 700;
  color: #ffe9e5;
  background: radial-gradient(circle at 35% 30%, #d1584f, #6d1f1c 70%);
  border: 1px solid #e58b81;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .6);
}

.hero__armor {
  position: absolute;
  right: -12px;
  top: -10px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: #dfe9f5;
  background: radial-gradient(circle at 35% 30%, #8fa4bd, #38485c 70%);
  border: 1px solid #b9cbe0;
  border-radius: 50%;
}

.hero__weapon {
  position: absolute;
  left: -14px;
  bottom: -10px;
  padding: 2px 7px;
  font-size: 12px;
  font-weight: 700;
  color: #fff1d6;
  background: linear-gradient(180deg, #6c5423, #3b2d13);
  border: 1px solid var(--gold);
  border-radius: 8px;
  white-space: nowrap;
}

.hero.is-attacker { box-shadow: 0 0 0 2px var(--gold-bright), 0 0 26px -4px var(--gold-bright); }
.hero.can-act { cursor: pointer; box-shadow: 0 0 0 2px var(--ok), 0 0 20px -6px var(--ok); }

/* сила героя */
.hero-power {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 22px;
  background: radial-gradient(circle at 40% 32%, var(--stone-600), var(--stone-900));
  border: 2px solid var(--stone-600);
  border-radius: 50%;
  cursor: default;
  transition: all .15s ease;
  position: relative;
}

.hero-power.is-ready {
  border-color: var(--gold);
  cursor: pointer;
  box-shadow: 0 0 18px -4px var(--gold-bright);
}

.hero-power.is-ready:hover { transform: scale(1.06); }
.hero-power.is-spent { opacity: .4; }

.hero-power__cost {
  position: absolute;
  bottom: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #eaf4ff;
  background: radial-gradient(circle at 35% 30%, var(--mana-bright), #1e4c86 70%);
  border: 1px solid #8dc4ff;
  border-radius: 50%;
}

/* колода и мана */
.deck-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  font-size: 12px;
  color: var(--parchment-dim);
  min-width: 96px;
}

.mana-bar { display: flex; gap: 3px; flex-wrap: wrap; max-width: 118px; }

.crystal {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  transform: rotate(45deg);
  background: radial-gradient(circle at 35% 30%, var(--mana-bright), #1e4c86);
  border: 1px solid #8dc4ff;
}

.crystal--spent { background: #1a1d24; border-color: #2f3a49; }

.deck-info__row { display: flex; gap: 10px; }

/* ───────────────────────────── стол ─────────────────────────────── */

.board {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 118px;
  padding: 4px;
  border-radius: 10px;
  transition: background .16s ease;
}

.board.is-drop-zone {
  background: rgba(200, 164, 74, .1);
  box-shadow: inset 0 0 0 1px rgba(200, 164, 74, .35);
}

.minion {
  position: relative;
  width: 96px;
  height: 118px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 6px 6px;
  background:
    radial-gradient(ellipse at 50% 22%, rgba(255, 240, 200, .12), transparent 62%),
    linear-gradient(180deg, #3a3226, #221c14);
  border: 2px solid #4a3f2d;
  border-radius: 10px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, .5);
  transition: transform .14s ease, box-shadow .14s ease, opacity .2s ease;
  cursor: default;
}

.minion__art { font-size: 30px; line-height: 1; margin-bottom: 4px; }

.minion__name {
  font-family: var(--font-title);
  font-size: 10.5px;
  line-height: 1.1;
  text-align: center;
  color: var(--parchment);
  overflow: hidden;
  max-height: 24px;
}

.slot {
  width: 22px;
  height: 108px;
  flex: 0 0 auto;
  border-radius: 8px;
  border: 1px dashed rgba(200, 164, 74, .45);
  background: rgba(200, 164, 74, .06);
  cursor: pointer;
  transition: all .12s ease;
}

.slot:hover {
  width: 36px;
  border-color: var(--gold-bright);
  background: rgba(200, 164, 74, .2);
}

.minion__mark {
  opacity: .9;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .8));
}

.minion__marks {
  display: flex;
  gap: 3px;
  margin-top: auto;
  font-size: 11px;
}

.minion__stats {
  position: absolute;
  bottom: -8px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 4px;
}

.minion .stat { width: 26px; height: 26px; font-size: 14px; }

.minion.can-attack {
  border-color: var(--ok);
  cursor: pointer;
  box-shadow: 0 0 0 1px var(--ok), 0 0 18px -6px var(--ok);
}

.minion.is-attacker {
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 2px var(--gold-bright), 0 0 26px -4px var(--gold-bright);
  transform: translateY(-6px);
}

.minion.is-target {
  cursor: crosshair;
  border-color: var(--blood-bright);
  box-shadow: 0 0 0 2px var(--blood-bright), 0 0 24px -4px var(--blood-bright);
}

.hero.is-target {
  cursor: crosshair;
  border-color: var(--blood-bright);
  box-shadow: 0 0 0 2px var(--blood-bright), 0 0 26px -4px var(--blood-bright);
}

.minion.is-taunt { border-color: #8d7a4a; }
.minion.is-shielded { box-shadow: 0 0 0 2px #ffe9a8, 0 0 22px -6px #ffe9a8; }
.minion.is-frozen { filter: hue-rotate(160deg) saturate(1.4) brightness(1.05); }
.minion.is-stealth { opacity: .62; border-style: dashed; }
.minion.is-asleep { opacity: .82; }

.minion.is-dying { animation: crumble .32s ease forwards; }
.minion.is-summoned { animation: appear .3s ease; }
.minion.is-hit { animation: shake .3s ease; }

@keyframes crumble {
  to { transform: scale(.6) rotate(8deg); opacity: 0; }
}

@keyframes appear {
  from { transform: translateY(14px) scale(.8); opacity: 0; }
}

@keyframes shake {
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

.float-damage {
  position: fixed;
  z-index: 150;
  font-family: var(--font-title);
  font-size: 28px;
  font-weight: 700;
  color: #ff9a8f;
  text-shadow: 0 2px 6px #000;
  pointer-events: none;
  animation: floatUp .9s ease forwards;
}

.float-damage--heal { color: #8fe07a; }

@keyframes floatUp {
  to { transform: translateY(-52px); opacity: 0; }
}

/* ───────────────────────────── руки ─────────────────────────────── */

.hand {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 190px;
  padding: 0 10px;
}

.hand--enemy { min-height: 86px; align-items: flex-start; }

/* Рука игрока: карты помельче, чтобы веер целиком помещался в экран. */
.hand--own .card { width: 130px; height: 184px; }
.hand--own .card__art { height: 50px; font-size: 28px; }
.hand--own .card__name { font-size: 12px; min-height: 26px; }
.hand--own .card__text { font-size: 10px; }

/* ──────────────────────────── середина ──────────────────────────── */

.middle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 16px;
  border-block: 1px solid rgba(200, 164, 74, .16);
  background: linear-gradient(90deg, transparent, rgba(200, 164, 74, .05), transparent);
}

.turn-banner {
  font-family: var(--font-title);
  font-size: 15px;
  letter-spacing: .1em;
  color: var(--parchment-dim);
}

.turn-banner b { color: var(--gold-bright); }

/* ──────────────────────────── боковины ──────────────────────────── */

.rail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  padding: 8px;
  background: linear-gradient(180deg, var(--stone-800), var(--stone-900));
  border: 1px solid var(--stone-700);
  border-radius: 12px;
}

.log {
  flex: 1 1 auto;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.5;
  color: var(--parchment-dim);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.log__line { padding: 3px 6px; border-radius: 5px; }
.log__line--turn { color: var(--gold); border-top: 1px solid var(--stone-700); margin-top: 4px; padding-top: 6px; }
.log__line--own { background: rgba(200, 164, 74, .07); }
.log__line--foe { background: rgba(193, 75, 69, .09); }

.hint {
  margin-top: auto;
  font-size: 12px;
  line-height: 1.45;
  color: var(--parchment-dim);
  font-style: italic;
}

@media (max-width: 1100px) {
  .table { grid-template-columns: 1fr; }
  .rail { display: none; }
}

/* Ноутбучные экраны: ужимаем ряды, чтобы веер руки не уезжал за нижний край. */
@media (max-height: 800px) {
  .hand--own .card { width: 116px; height: 162px; }
  .hand--own .card__art { height: 40px; font-size: 24px; }
  .hand { min-height: 168px; }
  .hand--enemy { min-height: 70px; }
  .minion { width: 86px; height: 106px; }
  .board { min-height: 104px; }
  .hero { height: 60px; }
}

@media (max-height: 740px) {
  .hand--own .card { width: 102px; height: 142px; padding: 8px 7px 6px; }
  .hand--own .card__art { height: 32px; font-size: 21px; margin: 0 0 3px; }
  .hand--own .card__name { font-size: 10.5px; min-height: 22px; }
  .hand--own .card__text { font-size: 9px; }
  .hand--own .card__cost { width: 28px; height: 28px; font-size: 15px; }
  .hand--own .stat { width: 24px; height: 24px; font-size: 13px; }
  .hand { min-height: 148px; }
  .hand--enemy { min-height: 58px; }
  .card-back { width: 48px; height: 66px; font-size: 15px; }
  .minion { width: 78px; height: 96px; }
  .minion__art { font-size: 24px; }
  .board { min-height: 94px; }
  .slot { height: 88px; }
  .hero { width: 92px; height: 54px; }
  .hero-power { width: 52px; height: 52px; font-size: 18px; }
  .side { gap: 4px; padding: 4px 8px; }
}

/* Экран дуэли: отряд соперника рубашками сверху, свой — открытым внизу,
   между ними арена, где сшибаются выбранные бойцы. */

.hub {
  max-width: 860px;
  margin: 0 auto;
  padding: 44px 24px 60px;
  text-align: center;
}

.hub__stats {
  display: flex;
  justify-content: center;
  gap: 22px;
  flex-wrap: wrap;
  margin: 0 0 30px;
  font-size: 14px;
  color: var(--parchment-dim);
}

.hub__stat { display: flex; align-items: center; gap: 7px; }
.hub__stat b { color: var(--gold-bright); font-weight: 600; font-size: 16px; }

.hub__actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.hub__btn {
  display: grid;
  grid-template-columns: 46px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 2px 14px;
  padding: 18px 20px;
  text-align: left;
  color: var(--parchment);
  background: linear-gradient(180deg, var(--stone-700), var(--stone-800));
  border: 1px solid var(--stone-600);
  border-radius: 12px;
  cursor: pointer;
  font: inherit;
  transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}

.hub__btn:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
  box-shadow: 0 0 24px -6px var(--gold-bright);
}

.hub__btn--major { background: linear-gradient(180deg, #4a3c1d, #2b2312); border-color: #7a6329; }
.hub__icon { grid-row: 1 / 3; font-size: 30px; text-align: center; }
.hub__label { font-family: var(--font-title); font-size: 19px; color: var(--gold-bright); }
.hub__note { font-size: 12.5px; color: var(--parchment-dim); }

/* ───────────────────────── подбор соперника ────────────────────────────── */

.matchmaking {
  max-width: 720px;
  margin: 0 auto;
  padding: 70px 24px;
  text-align: center;
}

.matchmaking__title {
  font-family: var(--font-title);
  font-size: 34px;
  color: var(--gold-bright);
  margin: 0 0 34px;
}

.matchmaking__scales {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  margin-bottom: 26px;
}

.scale {
  padding: 22px 16px;
  background: linear-gradient(180deg, var(--stone-700), var(--stone-800));
  border: 1px solid var(--stone-600);
  border-radius: 12px;
}

.scale--own { border-color: #6d5a2b; }
.scale--foe { border-color: #6b3a3a; }
.scale__name { font-family: var(--font-title); font-size: 18px; margin-bottom: 6px; }
.scale__power { font-size: 30px; font-weight: 700; color: var(--gold-bright); }
.scale__power small { display: block; font-size: 11px; color: var(--parchment-dim); font-weight: 400; letter-spacing: .1em; }

.matchmaking__spark { font-size: 34px; animation: aura-pulse 1.4s ease-in-out infinite; }
.matchmaking__hint { color: var(--parchment-dim); min-height: 42px; }
.matchmaking__buttons { display: flex; gap: 12px; justify-content: center; }

.matchmaking__difficulty {
  margin: 0 0 22px;
  padding: 16px;
  background: rgba(0, 0, 0, .25);
  border: 1px solid var(--stone-700);
  border-radius: 12px;
}

.matchmaking__label {
  display: block;
  margin-bottom: 10px;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--parchment-dim);
}

.matchmaking__note {
  margin: 10px 0 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--parchment-dim);
  min-height: 34px;
}

.matchmaking__note b { color: var(--gold-bright); font-weight: 600; }

/* ──────────────────────────── экран дуэли ──────────────────────────────── */

.duel {
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  height: 100dvh;
  padding: 8px 12px;
  gap: 6px;
}

.duel__bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(200, 164, 74, .18);
}

.duel__who { display: flex; align-items: baseline; gap: 10px; }
.duel__who--foe { justify-content: flex-end; }
.duel__name { font-family: var(--font-title); font-size: 17px; color: var(--parchment); }
.duel__power { font-size: 12px; color: var(--parchment-dim); }
.duel__round { font-family: var(--font-title); font-size: 15px; letter-spacing: .12em; color: var(--gold); }

.duel__score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 2px;
  font-size: 13px;
  color: var(--parchment-dim);
}

.duel__score span { display: inline-flex; align-items: baseline; gap: 5px; }

.duel__score b {
  font-size: 20px;
  font-family: var(--font-title);
  color: var(--gold-bright);
  min-width: 22px;
  text-align: center;
}

/* Разбивка «очки за схватки + за уцелевших»: мелко, но всегда на виду. */
.duel__score i {
  font-style: normal;
  font-size: 11px;
  color: var(--parchment-dim);
  letter-spacing: .02em;
}

.duel__score b.is-gained { animation: score-gain 1.2s ease-out; }

@keyframes score-gain {
  0%   { transform: scale(1); text-shadow: none; }
  25%  { transform: scale(1.6); text-shadow: 0 0 18px currentColor; }
  100% { transform: scale(1); text-shadow: none; }
}

.duel__score .duel__score-own b { color: #9fe08a; }
.duel__score .duel__score-foe b { color: #e8938c; }

.duel__squad {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  min-height: 128px;
  padding: 4px;
}

.duel__squad--own { min-height: 170px; }

/* карточка бойца */
.fighter {
  position: relative;
  width: 108px;
  padding: 8px 8px 10px;
  background:
    radial-gradient(ellipse at 50% 18%, rgba(255, 240, 200, .1), transparent 62%),
    linear-gradient(180deg, #3a3226, #221c14);
  border: 2px solid #4a3f2d;
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .5);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  cursor: default;
  user-select: none;
}

.fighter--small { width: 96px; }
.fighter--arena { width: 132px; padding: 10px 9px 12px; }

.fighter__art {
  height: 46px;
  display: grid;
  place-items: center;
  font-size: 32px;
  margin-bottom: 4px;
}

.fighter--arena .fighter__art { height: 58px; font-size: 40px; }

.fighter__name {
  font-family: var(--font-title);
  font-size: 11.5px;
  line-height: 1.15;
  text-align: center;
  color: var(--parchment);
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fighter--arena .fighter__name { font-size: 12.5px; min-height: 30px; margin-bottom: 4px; }

.fighter__level {
  position: absolute;
  top: -9px;
  left: -9px;
  min-width: 26px;
  height: 26px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #1c1710;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  border: 1px solid #f3dc9c;
  border-radius: 999px;
  z-index: 3;
}

.fighter__order {
  position: absolute;
  top: -9px;
  right: -9px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #12100e;
  background: linear-gradient(180deg, #9fe08a, #5fae52);
  border: 1px solid #cdf0bd;
  border-radius: 999px;
  z-index: 3;
}

.fighter__mark--kind { opacity: .85; }

.fighter__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  margin-top: 6px;
  font-size: 11px;
  text-align: center;
}

.fighter--arena .fighter__order {
  position: absolute;
  top: -9px;
  right: -9px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #12100e;
  background: linear-gradient(180deg, #9fe08a, #5fae52);
  border: 1px solid #cdf0bd;
  border-radius: 999px;
  z-index: 3;
}

.fighter__mark--kind { opacity: .85; }

.fighter__stats { font-size: 11.5px; gap: 4px; }

.fighter__stat {
  padding: 2px 0;
  border-radius: 5px;
  background: rgba(0, 0, 0, .32);
}

.fighter__stat b { display: block; font-size: 13px; font-weight: 700; }
.fighter--arena .fighter__stat b { font-size: 14px; }
.fighter__stat--attack b { color: #e8c274; }
.fighter__stat--defense b { color: #9fc0e0; }
.fighter__stat--agility b { color: #b9e3a0; }

.fighter__bar {
  position: relative;
  height: 9px;
  margin-top: 7px;
  border-radius: 5px;
  background: #2a1414;
  overflow: hidden;
  border: 1px solid #4a2a2a;
}

.fighter__bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #b4423c, #e0736a);
  transition: width .45s ease;
}

.fighter__hp {
  font-size: 11px;
  text-align: center;
  margin-top: 3px;
  color: #e6bdb6;
}

.fighter__marks {
  display: flex;
  gap: 3px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 5px;
  min-height: 15px;
  font-size: 11px;
}

.fighter--arena .fighter__marks { font-size: 12px; }

/* состояния карточки бойца */
.fighter.is-pickable {
  cursor: pointer;
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(200, 164, 74, .45), 0 6px 16px rgba(0, 0, 0, .5);
  animation: pickable-breathe 2.6s ease-in-out infinite;
}

@keyframes pickable-breathe {
  0%, 100% { box-shadow: 0 0 0 1px rgba(200, 164, 74, .4), 0 6px 16px rgba(0, 0, 0, .5); }
  50%      { box-shadow: 0 0 0 1px rgba(240, 207, 122, .8), 0 0 22px -6px var(--gold-bright), 0 6px 16px rgba(0, 0, 0, .5); }
}
.fighter.is-pickable:hover { transform: translateY(-6px); box-shadow: 0 14px 26px rgba(0, 0, 0, .55); border-color: var(--gold); }
.fighter.is-chosen { border-color: var(--gold-bright); box-shadow: 0 0 0 2px var(--gold-bright), 0 0 28px -4px var(--gold-bright); transform: translateY(-6px); }
.fighter.is-dead { opacity: .32; filter: grayscale(1); }
.fighter.is-dead .fighter__art { animation: none; }

/* рубашка чужого бойца */
.fighter-back {
  position: relative;
  width: 96px;
  height: 128px;
  border-radius: 12px;
  border: 2px solid #4a3f2d;
  background:
    repeating-linear-gradient(45deg, rgba(200, 164, 74, .1) 0 7px, transparent 7px 14px),
    linear-gradient(180deg, #3b2f1f, #1d1811);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .5);
  display: grid;
  place-items: center;
  font-size: 26px;
  color: rgba(200, 164, 74, .55);
}

.fighter-back.is-dead { opacity: .3; filter: grayscale(1); }
.fighter-back.is-picked { border-color: var(--blood-bright); box-shadow: 0 0 0 2px var(--blood-bright), 0 0 24px -6px var(--blood-bright); }

/* ───────────────────────────── арена ───────────────────────────────────── */

.arena {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(200, 164, 74, .09), transparent 68%),
    linear-gradient(180deg, #191510, #221c14 50%, #191510);
  border: 1px solid var(--stone-700);
  border-radius: 14px;
  min-height: 0;
}

.arena__side {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 200px;
  max-height: 100%;
  overflow: hidden;
}

.arena__side { align-content: center; }

/* Призванная подмога легко доводит сторону до пяти карт — ужимаем их. */
.arena__side--crowded { gap: 6px; }
.arena__side--crowded .fighter--arena { width: 104px; padding: 8px 7px 9px; }
.arena__side--crowded .fighter--arena .fighter__art { height: 42px; font-size: 30px; }
.arena__side--crowded .fighter--arena .fighter__name { font-size: 11px; min-height: 26px; }
.arena__side--crowded .fighter--arena .fighter__stats { font-size: 10px; }
.arena__side--crowded .fighter--arena .fighter__stat b { font-size: 12px; }
.arena__side--crowded .fighter--arena .fighter__hp { font-size: 10px; }

/* А с двумя призывателями бывает и семь — тогда карточки идут в два ряда. */
.arena__side--packed { gap: 5px; }
.arena__side--packed .fighter--arena { width: 86px; padding: 6px 5px 7px; }
.arena__side--packed .fighter--arena .fighter__art { height: 30px; font-size: 22px; margin-bottom: 2px; }
.arena__side--packed .fighter--arena .fighter__name { font-size: 9.5px; min-height: 22px; margin-bottom: 2px; }
.arena__side--packed .fighter--arena .fighter__stats { font-size: 9px; gap: 2px; margin-top: 3px; }
.arena__side--packed .fighter--arena .fighter__stat b { font-size: 11px; }
.arena__side--packed .fighter--arena .fighter__bar { height: 6px; margin-top: 4px; }
.arena__side--packed .fighter--arena .fighter__hp { font-size: 9px; }
.arena__side--packed .fighter--arena .fighter__marks { display: none; }
.arena__side--packed .fighter__level { width: 20px; height: 20px; min-width: 20px; font-size: 10px; top: -7px; left: -7px; }

/* Предел: два призывателя разом. Тогда от карточки остаются знак, имя и здоровье. */
.arena__side--tight .fighter--arena { width: 74px; padding: 5px 4px 6px; }
.arena__side--tight .fighter--arena .fighter__stats { display: none; }
.arena__side--tight .fighter--arena .fighter__art { height: 26px; font-size: 19px; }
.arena__side--tight .fighter--arena .fighter__name { font-size: 9px; min-height: 20px; }

.arena__side--own { justify-content: flex-end; }
.arena__side--foe { justify-content: flex-start; }

.arena__center { text-align: center; min-width: 200px; }
.arena__clash { font-size: 40px; color: var(--gold); opacity: .85; }

.arena__status {
  margin-top: 10px;
  font-family: var(--font-title);
  font-size: 15px;
  line-height: 1.4;
  color: var(--parchment);
  min-height: 44px;
}

.arena__status em { color: var(--gold-bright); font-style: normal; }

.arena__waiting {
  width: 132px;
  height: 196px;
  border-radius: 12px;
  border: 2px dashed rgba(200, 164, 74, .35);
  display: grid;
  place-items: center;
  font-size: 40px;
  color: rgba(200, 164, 74, .5);
  animation: aura-pulse 1.6s ease-in-out infinite;
}

/* ───────────────────────────── подвал ──────────────────────────────────── */

.duel__footer {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 8px;
}

.duel__send {
  min-width: 210px;
  font-family: var(--font-title);
  font-size: 16px;
}

.duel__send:disabled { opacity: .45; cursor: default; box-shadow: none; }

.duel__hint {
  font-size: 12px;
  color: var(--parchment-dim);
}

.duel__log {
  flex: 1 1 auto;
  font-size: 12.5px;
  color: var(--parchment-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ───────────────────────────── награды ─────────────────────────────────── */

.overlay__card--wide { max-width: 560px; }

.rewards {
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
  text-align: left;
}

.reward-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  background: rgba(0, 0, 0, .3);
  border: 1px solid var(--stone-600);
  border-radius: 9px;
  font-size: 14px;
}

.reward-line b { color: var(--gold-bright); }
.reward-line--level { border-color: var(--gold); background: rgba(200, 164, 74, .12); }

@media (max-height: 800px) {
  .duel__squad { min-height: 108px; }
  .duel__squad--own { min-height: 146px; }
  .fighter { width: 94px; }
  .fighter__art { height: 38px; font-size: 26px; }
  .fighter--arena { width: 116px; }
  .fighter--arena .fighter__art { height: 48px; font-size: 32px; }
  .arena__side { min-height: 170px; }
  .arena__waiting { width: 116px; height: 170px; }
  .fighter-back { width: 84px; height: 112px; }
}

/* Боевая анимация: живые изображения, следы ударов, ауры усилений. */

/* ─────────────────── «двигающиеся» изображения бойцов ─────────────────── */

.motion { display: inline-block; will-change: transform; }

.motion--fly    { animation: motion-fly 2.6s ease-in-out infinite; }
.motion--sway   { animation: motion-sway 3.1s ease-in-out infinite; }
.motion--stalk  { animation: motion-stalk 3.6s ease-in-out infinite; }
.motion--dash   { animation: motion-dash 1.9s ease-in-out infinite; }
.motion--lumber { animation: motion-lumber 3.4s ease-in-out infinite; }
.motion--float  { animation: motion-float 4s ease-in-out infinite; }

@keyframes motion-fly {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50%      { transform: translateY(-9px) rotate(4deg); }
}

@keyframes motion-sway {
  0%, 100% { transform: rotate(-5deg); }
  50%      { transform: rotate(5deg); }
}

@keyframes motion-stalk {
  0%, 100% { transform: translateX(-4px) scaleX(1); }
  45%      { transform: translateX(4px) scaleX(1.04); }
  55%      { transform: translateX(4px) scaleX(.98); }
}

@keyframes motion-dash {
  0%, 62%, 100% { transform: translateX(0); }
  70%           { transform: translateX(7px) skewX(-8deg); }
  78%           { transform: translateX(-3px) skewX(4deg); }
}

@keyframes motion-lumber {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-3px) scale(1.07); }
}

@keyframes motion-float {
  0%, 100% { transform: translateY(0); filter: drop-shadow(0 0 6px rgba(180, 220, 255, .35)); }
  50%      { transform: translateY(-7px); filter: drop-shadow(0 0 14px rgba(180, 220, 255, .7)); }
}

@media (prefers-reduced-motion: reduce) {
  .motion { animation: none !important; }
  .projectile { animation-duration: .01s !important; }
}

/* ───────────────────────── следы ударов на карте ───────────────────────── */

.scars {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

.scar {
  position: absolute;
  left: var(--x, 20%);
  top: var(--y, 30%);
  width: var(--len, 78%);
  height: 3px;
  transform: rotate(var(--angle, 24deg));
  transform-origin: left center;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 120, 100, .1) 8%,
    rgba(255, 60, 50, .92) 45%,
    rgba(140, 20, 20, .9) 72%,
    transparent 100%);
  box-shadow: 0 0 8px rgba(255, 60, 40, .55), 0 1px 0 rgba(0, 0, 0, .5);
  border-radius: 2px;
  animation: scar-cut 1.5s ease-out forwards;
}

.scar--deep { height: 5px; }

/* Порез вспыхивает, держится пару мгновений и затягивается. */
@keyframes scar-cut {
  0%   { transform: rotate(var(--angle, 24deg)) scaleX(0); opacity: 0; filter: brightness(3); }
  12%  { transform: rotate(var(--angle, 24deg)) scaleX(1); opacity: 1; filter: brightness(2.4); }
  55%  { transform: rotate(var(--angle, 24deg)) scaleX(1); opacity: .9; filter: brightness(1); }
  100% { transform: rotate(var(--angle, 24deg)) scaleX(1); opacity: 0; filter: brightness(.7); }
}

/* ───────────────── снаряды: стрелы, зелья, чары, пламя ─────────────────── */

.projectile {
  position: fixed;
  z-index: 40;
  font-size: 26px;
  line-height: 1;
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: projectile-fly .42s cubic-bezier(.35, 0, .7, 1) forwards;
  filter: drop-shadow(0 0 8px rgba(255, 220, 160, .8));
}

/* Стрела и кость летят остриём вперёд, остальное кувыркается. */
.projectile--aimed { animation-name: projectile-fly-aimed; }
.projectile--potion { animation-name: projectile-fly-spin; }
.projectile--bolt { filter: drop-shadow(0 0 12px rgba(170, 190, 255, .95)); }
.projectile--flame { filter: drop-shadow(0 0 12px rgba(255, 140, 60, .95)); }

@keyframes projectile-fly {
  0%   { transform: translate(-50%, -50%) scale(.6); opacity: 0; }
  15%  { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1); opacity: 1; }
}

@keyframes projectile-fly-aimed {
  0%   { transform: translate(-50%, -50%) rotate(var(--spin, 0deg)) scale(.6); opacity: 0; }
  15%  { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy)))
                   rotate(var(--spin, 0deg)) scale(1); opacity: 1; }
}

@keyframes projectile-fly-spin {
  0%   { transform: translate(-50%, -50%) rotate(0deg) scale(.6); opacity: 0; }
  15%  { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy)))
                   rotate(540deg) scale(1); opacity: 1; }
}

/* вспышка попадания снаряда */
.burst {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(circle at 50% 45%, rgba(255, 230, 170, .75), transparent 62%);
  animation: burst-pop .4s ease-out forwards;
}

@keyframes burst-pop {
  0%   { opacity: 0; transform: scale(.6); }
  30%  { opacity: 1; transform: scale(1.05); }
  100% { opacity: 0; transform: scale(1.2); }
}

/* Взмах, который оставляет след: белая полоса поверх карты */
.slash {
  position: absolute;
  inset: -12%;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 42%, rgba(255, 255, 255, .92) 50%, transparent 58%);
  opacity: 0;
  animation: slash-sweep .34s ease-out;
}

@keyframes slash-sweep {
  0%   { opacity: 0; transform: translateX(-40%) rotate(-6deg); }
  40%  { opacity: .95; }
  100% { opacity: 0; transform: translateX(40%) rotate(-6deg); }
}

/* ──────────────────────── ауры усилений и состояний ────────────────────── */

.aura {
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  pointer-events: none;
}

.aura--buff {
  box-shadow: 0 0 0 2px rgba(240, 207, 122, .9), 0 0 26px 2px rgba(240, 207, 122, .55);
  animation: aura-pulse 1.8s ease-in-out infinite;
}

.aura--fury {
  box-shadow: 0 0 0 2px rgba(230, 90, 60, .95), 0 0 30px 4px rgba(230, 70, 40, .6);
  animation: aura-flare 1.1s ease-in-out infinite;
}

.aura--ward {
  box-shadow: 0 0 0 2px rgba(220, 240, 255, .95), 0 0 26px 3px rgba(160, 210, 255, .65);
  animation: aura-pulse 2.4s ease-in-out infinite;
}

.aura--venom {
  box-shadow: 0 0 0 2px rgba(120, 200, 110, .9), 0 0 24px 2px rgba(90, 190, 90, .55);
  animation: aura-pulse 2.1s ease-in-out infinite;
}

.aura--heal {
  box-shadow: 0 0 0 2px rgba(140, 220, 140, .9), 0 0 24px 2px rgba(110, 210, 120, .5);
  animation: aura-pulse 2.6s ease-in-out infinite;
}

.aura--lifesteal {
  box-shadow: 0 0 0 2px rgba(200, 60, 90, .9), 0 0 24px 2px rgba(190, 40, 70, .5);
  animation: aura-pulse 2s ease-in-out infinite;
}

@keyframes aura-pulse {
  0%, 100% { opacity: .55; }
  50%      { opacity: 1; }
}

@keyframes aura-flare {
  0%, 100% { opacity: .6; transform: scale(1); }
  50%      { opacity: 1; transform: scale(1.015); }
}

/* ───────────────────────── реакции карты в бою ─────────────────────────── */

.fighter.is-striking { animation: lunge .32s ease-out; }
.fighter.is-hurt { animation: recoil .3s ease-out; }
.fighter.is-dodging { animation: dodge .34s ease-out; }
.fighter.is-falling { animation: fall .55s ease-in forwards; }
.fighter.is-entering { animation: enter .35s ease-out; }

@keyframes lunge {
  0%   { transform: translateX(0); }
  45%  { transform: translateX(var(--lunge, 16px)) scale(1.04); }
  100% { transform: translateX(0); }
}

@keyframes recoil {
  0%   { transform: translateX(0); filter: brightness(1); }
  20%  { transform: translateX(calc(var(--lunge, 16px) * -.5)); filter: brightness(2.1) saturate(.4); }
  60%  { transform: translateX(4px); filter: brightness(1.2); }
  100% { transform: translateX(0); filter: brightness(1); }
}

@keyframes dodge {
  0%, 100% { transform: translateX(0); opacity: 1; }
  50%      { transform: translateX(calc(var(--lunge, 16px) * -1.2)) skewX(8deg); opacity: .55; }
}

@keyframes fall {
  0%   { transform: rotate(0) translateY(0); opacity: 1; }
  100% { transform: rotate(14deg) translateY(38px); opacity: 0; filter: grayscale(1); }
}

@keyframes enter {
  0%   { transform: translateY(18px) scale(.9); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* всплывающие числа над бойцом */
.hit-mark {
  position: absolute;
  left: 50%;
  top: 26%;
  transform: translateX(-50%);
  font-family: var(--font-title);
  font-size: 30px;
  font-weight: 700;
  color: #ff9a8f;
  text-shadow: 0 2px 8px #000, 0 0 18px rgba(255, 60, 40, .6);
  pointer-events: none;
  animation: hit-rise 1s ease-out forwards;
  z-index: 5;
}

.hit-mark--heal { color: #9fe98a; text-shadow: 0 2px 8px #000, 0 0 18px rgba(90, 220, 90, .5); }
.hit-mark--miss { color: #cfd8e6; font-size: 20px; }
.hit-mark--venom { color: #a8e08a; font-size: 22px; }

@keyframes hit-rise {
  0%   { transform: translate(-50%, 0) scale(.6); opacity: 0; }
  25%  { transform: translate(-50%, -14px) scale(1.15); opacity: 1; }
  100% { transform: translate(-50%, -52px) scale(1); opacity: 0; }
}

/* вспышка на арене в момент сшибки */
.arena__clash.is-clashing { animation: clash-flare .5s ease-out; }

@keyframes clash-flare {
  0%   { transform: scale(.7) rotate(-12deg); opacity: .4; }
  40%  { transform: scale(1.6) rotate(6deg); opacity: 1; text-shadow: 0 0 30px rgba(255, 220, 150, .9); }
  100% { transform: scale(1) rotate(0); opacity: .85; }
}

/* Коллекция: сетка карт слева, разбор выбранной карты и прокачка справа. */

.collection { display: flex; flex-direction: column; height: 100dvh; padding: 14px 18px; }

.collection__bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.collection__bar h2 { font-family: var(--font-title); color: var(--gold-bright); margin: 0; }
.collection__purse { margin-left: auto; font-size: 14px; color: var(--parchment-dim); }
.collection__purse b { color: var(--gold-bright); }

.collection__body {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
  flex: 1 1 auto;
  min-height: 0;
}

.collection__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  grid-auto-rows: min-content;
  gap: 12px;
  overflow-y: auto;
  padding: 4px 6px 20px 4px;
  align-content: start;
}

/* плитка карты в коллекции */
.tile {
  position: relative;
  padding: 10px 8px 8px;
  background: linear-gradient(180deg, #3a3226, #221c14);
  border: 2px solid #4a3f2d;
  border-radius: 11px;
  cursor: pointer;
  text-align: center;
  transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}

.tile:hover { transform: translateY(-3px); border-color: var(--gold); }
.tile.is-selected { border-color: var(--gold-bright); box-shadow: 0 0 0 2px var(--gold-bright), 0 0 22px -6px var(--gold-bright); }
.tile.is-locked { filter: grayscale(.85) brightness(.62); }
.tile.is-locked:hover { filter: grayscale(.4) brightness(.8); }
.tile.is-squad { border-color: var(--ok); }

.tile__art { font-size: 30px; height: 42px; display: grid; place-items: center; }
.tile__name { font-family: var(--font-title); font-size: 11.5px; line-height: 1.15; min-height: 26px; color: var(--parchment); }

.tile__row {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 5px;
  font-size: 11px;
  color: var(--parchment-dim);
}

.tile__level {
  position: absolute;
  top: -8px;
  left: -8px;
  min-width: 24px;
  height: 24px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  font-size: 11.5px;
  font-weight: 700;
  color: #1c1710;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  border-radius: 999px;
}

.tile__price {
  position: absolute;
  top: -8px;
  right: -8px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  color: #ffe9a8;
  background: linear-gradient(180deg, #5a4a1f, #332a12);
  border: 1px solid var(--gold);
  border-radius: 999px;
}

.tile__squad-mark {
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 8px;
  font-size: 10px;
  letter-spacing: .08em;
  color: #0f1a0c;
  background: var(--ok);
  border-radius: 999px;
}

/* ───────────────────────── панель разбора карты ────────────────────────── */

.detail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(180deg, var(--stone-800), var(--stone-900));
  border: 1px solid var(--stone-700);
  border-radius: 12px;
  overflow-y: auto;
}

.detail__empty { margin: auto; color: var(--parchment-dim); text-align: center; font-style: italic; }

.detail__head { display: flex; align-items: center; gap: 12px; }
.detail__art { font-size: 40px; }
.detail__title { font-family: var(--font-title); font-size: 20px; color: var(--gold-bright); }
.detail__sub { font-size: 12px; color: var(--parchment-dim); }

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

.stat-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 11px;
  background: rgba(0, 0, 0, .3);
  border: 1px solid var(--stone-600);
  border-radius: 8px;
  font-size: 13px;
}

.stat-box b { font-size: 17px; font-weight: 700; }
.stat-box--attack b { color: #e8c274; }
.stat-box--defense b { color: #9fc0e0; }
.stat-box--agility b { color: #b9e3a0; }
.stat-box--health b { color: #e0837a; }
.stat-box__gain { font-size: 11px; color: var(--ok); margin-left: 6px; }

.xp-bar {
  height: 10px;
  border-radius: 5px;
  background: #1d1a14;
  border: 1px solid var(--stone-600);
  overflow: hidden;
}

.xp-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #6a5527, var(--gold-bright));
  transition: width .4s ease;
}

.detail__section-title {
  font-family: var(--font-title);
  font-size: 13px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--parchment-dim);
  margin-top: 4px;
}

.ability-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, .26);
  border: 1px solid var(--stone-600);
  border-radius: 8px;
  font-size: 12.5px;
}

.ability-row--innate { border-color: #6d5a2b; }
.ability-row__icon { font-size: 17px; }
.ability-row__name { font-weight: 600; color: var(--parchment); }
.ability-row__text { color: var(--parchment-dim); font-size: 11.5px; line-height: 1.35; }

.ability-shop { display: grid; gap: 8px; }

.ability-shop__btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  text-align: left;
  font: inherit;
  font-size: 12.5px;
  color: var(--parchment);
  background: linear-gradient(180deg, var(--stone-700), var(--stone-800));
  border: 1px solid var(--stone-600);
  border-radius: 8px;
  cursor: pointer;
}

.ability-shop__btn:hover:not(:disabled) { border-color: var(--gold); }
.ability-shop__btn:disabled { opacity: .45; cursor: default; }
.ability-shop__price { margin-left: auto; color: var(--gold-bright); font-weight: 700; }

.detail__buttons { display: grid; gap: 8px; margin-top: auto; }
.detail__note { font-size: 12px; color: var(--parchment-dim); line-height: 1.4; }
.detail__note--warn { color: #e8a09a; }

@media (max-width: 900px) {
  .collection__body { grid-template-columns: 1fr; }
  .detail { max-height: 44vh; }
}
