/* VERSE ARENA — клиент без сборки: только CSS и ванильный JS. */

:root {
  --bg: #0b0d14;
  --bg2: #12162170;
  --panel: #161b28;
  --line: #262d3f;
  --ink: #e8ecf5;
  --dim: #8a93a8;
  --gold: #f2c14b;
  --hp: #4ad07f;
  --ki: #f5d247;
  --res: #ef4a5a;
  --enemy: #d94a5a;
  --mine: #4aa8ff;
  /* Размер карты в магазине и на скамейке — фиксированный.
     Поле подгоняется скриптом под остаток высоты, поэтому нижний интерфейс
     задаёт пропорцию: он крупный, а арена забирает то, что осталось. */
  --card-w: 123px;
  --card-h: 179px;
  /* Размер клетки поля — его пересчитывает fitArena() под высоту окна. */
  --board-w: var(--card-w);
  --board-h: var(--card-h);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background:
    radial-gradient(1200px 600px at 50% -10%, #1b2340 0%, transparent 60%),
    radial-gradient(900px 500px at 50% 110%, #2a1430 0%, transparent 60%),
    var(--bg);
  color: var(--ink);
  font: 14px/1.45 "Segoe UI", Roboto, system-ui, sans-serif;
  overflow: hidden;
}

button {
  font: inherit;
  color: var(--ink);
  background: #1e2637;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  transition: transform .08s, background .15s, border-color .15s;
}
button:hover:not(:disabled) { background: #27324a; border-color: #3b4761; }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .4; cursor: not-allowed; }
button.big { padding: 12px 28px; font-size: 16px; font-weight: 600;
  background: linear-gradient(180deg, #3a5bd9, #2b3f9e); border-color: #4a6ae0; }
button.ghost { background: transparent; }
button.small { padding: 4px 10px; font-size: 12px; }
.hidden { display: none !important; }

/* ───────────────────────────── экраны ───────────────────────────── */
body.screen-start #hud, body.screen-start #run, body.screen-start #playback { display: none; }
body.screen-start #lobby { display: none; }
body.screen-run #start, body.screen-run #lobby { display: none; }
body.screen-lobby #start, body.screen-lobby #hud,
body.screen-lobby #run, body.screen-lobby #playback { display: none; }
/* В партии свой забег не бросают кнопкой «сдаться» — там выход из матча. */
body.mode-match #btn-next { display: none; }
/* Выбывший досматривает партию: доска и магазин видны, но уже не кликаются. */
body.spectating .shop, body.spectating .bench, body.spectating .sell-zone { opacity: .4;
  pointer-events: none; }
body.mode-battle .shop-row, body.mode-battle .bench-row { display: none; }
body.mode-battle #playback { display: flex; }
/* Панель плеера прибита к низу — арена не должна заезжать под неё. */
body.mode-battle .arena-wrap { padding-bottom: 46px; }
body.mode-battle .panel.synergies { opacity: .55; }

/* ───────────────────────────── старт ───────────────────────────── */
.start { height: 100%; display: grid; place-items: center; overflow: auto; padding: 24px; }
.start-box { max-width: 880px; text-align: center; }
.logo { font-size: 60px; letter-spacing: 6px; margin: 0; font-weight: 800; }
.logo span { color: var(--res); margin-left: 12px;
  text-shadow: 0 0 24px rgba(239,74,90,.6); }
.tagline { color: var(--dim); margin: 6px 0 26px; font-size: 16px; }
#player-name { background: #10151f; border: 1px solid var(--line); color: var(--ink);
  border-radius: 8px; padding: 10px 14px; font: inherit; text-align: center; width: 220px;
  margin-right: 10px; }
.start-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 34px;
  text-align: left; }
.start-cols h3 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase;
  letter-spacing: 1px; color: var(--dim); }
.start-cols ul, .ladder { margin: 0; padding-left: 18px; color: #c3cbdb; }
.start-cols li { margin-bottom: 6px; }
.ladder li { margin-bottom: 4px; }
.ladder .t { color: var(--dim); font-size: 12px; margin-left: 6px; }
.res { color: var(--res); } .ki { color: var(--ki); }
.leaderboard { margin-top: 26px; text-align: left; color: var(--dim); font-size: 13px; }
.leaderboard table { width: 100%; border-collapse: collapse; }
.leaderboard td { padding: 3px 6px; border-bottom: 1px solid #1c2231; }

/* ───────────────────────────── HUD ───────────────────────────── */
.hud { display: flex; justify-content: space-between; align-items: center;
  padding: 8px 14px; border-bottom: 1px solid var(--line); background: #0e121b; height: 52px; }
.hud-left, .hud-right { display: flex; gap: 10px; align-items: center; }
.brand { font-weight: 800; letter-spacing: 3px; font-size: 13px; color: #6d7896; }
.chip { display: inline-flex; align-items: baseline; gap: 6px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; }
.chip i { font-style: normal; font-size: 11px; color: var(--dim); text-transform: uppercase; }
.chip b { font-size: 16px; font-weight: 700; }
.chip em { font-style: normal; font-size: 11px; color: var(--dim); }
.chip.hp b { color: var(--hp); } .chip.gold b { color: var(--gold); }
.chip.enc { color: var(--dim); }
.chip.streak.win b, .chip.streak.win { color: var(--hp); }
.chip.streak.lose { color: var(--enemy); }

/* ───────────────────────────── раскладка ───────────────────────────── */
.run { display: grid; grid-template-columns: 232px 1fr; height: calc(100% - 52px);
  overflow: hidden; }
/* В партии справа появляется таблица стола — арена ужимается, поле пересчитается. */
body.mode-match .run { grid-template-columns: 232px 1fr 226px; }
.panel.standings { border-right: none; border-left: 1px solid var(--line); }
.panel { border-right: 1px solid var(--line); background: #0e121b; padding: 12px;
  overflow-y: auto; }
.panel h3 { margin: 0 0 8px; font-size: 11px; text-transform: uppercase;
  letter-spacing: 1.4px; color: var(--dim); }
.panel h3.mt { margin-top: 16px; }
.arena-wrap { display: flex; flex-direction: column; overflow: hidden; }

.syn { display: flex; align-items: center; gap: 8px; padding: 5px 7px; border-radius: 7px;
  margin-bottom: 4px; background: #131826; border: 1px solid transparent; cursor: help; }
.syn.on { border-color: #3d4a66; background: #182036; }
/* Набрано, но до порога не дотянули — заметнее пустой, тусклее активной. */
.syn.part { opacity: .8; border-color: #2b3350; }
.syn.off { opacity: .42; }
.syn:hover { background: #1d2540; opacity: 1; }
.syn .ic { width: 20px; text-align: center; font-size: 14px; }
.syn .nm { flex: 1; font-size: 12px; }
.syn .ct { font-weight: 700; font-size: 12px; }
.syn.on .ct { color: var(--gold); }
.special { font-size: 11px; color: var(--dim); margin-top: 10px; line-height: 1.5; }
.special b { color: var(--ink); }

/* ───────────────────────────── арена ───────────────────────────── */
.arena { position: relative; flex: 1 1 auto; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px; padding: 6px; min-height: 0;
  overflow: hidden; }
.side { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: none; }
.side-label { font-size: 10px; line-height: 1.3; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--dim); }
.side.enemy .side-label { color: var(--enemy); }
.grid { display: grid; grid-template-columns: repeat(4, var(--board-w));
  grid-auto-rows: var(--board-h); gap: 8px; }
.divider { width: 100%; max-width: 520px; height: 1px; background:
  linear-gradient(90deg, transparent, var(--line), transparent); position: relative;
  margin: 5px 0; }
.divider span { position: absolute; left: 50%; top: -9px; transform: translateX(-50%);
  background: #0b0d14; padding: 0 10px; font-size: 11px; color: var(--dim);
  font-variant-numeric: tabular-nums; }

.cell { border: 1px dashed #232b3d; border-radius: 10px; background: #0d111a80; }
.cell.hover { border-color: var(--mine); background: #16213a; }
.cell.ghost::after { content: ''; display: block; height: 100%; border-radius: 10px;
  background: repeating-linear-gradient(45deg, #ffffff08 0 6px, transparent 6px 12px); }

/* ───────────────────────────── карта ───────────────────────────── */
/* position: relative обязателен — иначе ::before/::after карты позиционируются
   относительно арены и растягиваются на всё поле.
   font-size задаёт масштаб всей вёрстки карты: внутри всё в em, иначе на мелких
   картах фиксированные пиксели съедают высоту и арт схлопывается в ноль. */
.card { position: relative; width: var(--card-w); height: var(--card-h);
  font-size: calc(var(--card-w) / 11); perspective: 800px; cursor: grab; user-select: none; }
.cell > .card { width: 100%; height: 100%; font-size: calc(var(--board-w) / 11); }
.card.dragging { opacity: .4; }
.card-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d;
  transition: transform .7s cubic-bezier(.6,.05,.3,1); }
.card.flipped .card-inner { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 10px;
  border: 1px solid var(--line); background: linear-gradient(180deg, #1a2030, #11151f);
  display: flex; flex-direction: column; overflow: hidden; }
.face.back { transform: rotateY(180deg); }

/* Шапка, имя, полоски и статы не сжимаются — свободную высоту забирает арт. */
.card .top, .card .nm, .card .bars, .card .stats { flex: none; }
.card .top { display: flex; justify-content: space-between; align-items: center;
  padding: .3em .5em; font-size: .92em; line-height: 1.3; }
.stars { color: #5d6376; letter-spacing: -.1em; }
.stars.s2 { color: var(--gold); text-shadow: 0 0 6px rgba(242,193,75,.7); }
.stars.s3 { background: linear-gradient(90deg,#ff5ea8,#ffd24a,#5ee0ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none; filter: drop-shadow(0 0 4px #ffffff60); }
.tags { display: flex; gap: .3em; color: var(--dim); }
.tags span { background: #232b3d; border-radius: .3em; padding: 0 .3em; }

.art { position: relative; flex: 1 1 auto; min-height: 2.4em; margin: 0 .4em;
  border-radius: .6em; overflow: hidden;
  background: linear-gradient(160deg, var(--c, #37405a), #10141d 85%); display: grid;
  place-items: center; }
.art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.art .ph { font-size: 3.4em; font-weight: 800; color: #ffffff30; letter-spacing: -.06em;
  line-height: 1; }
.art .cost { position: absolute; right: .3em; bottom: .2em; font-size: .92em; color: var(--gold);
  background: #0009; border-radius: .4em; padding: 0 .4em; }

.card .nm { font-size: 1.02em; font-weight: 600; padding: .2em .5em 0; line-height: 1.35;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bars { padding: 0 .5em .3em; }
/* Полоска Ki и Решимости тонкая, мышью в неё не попасть — цель по наведению
   расширяет обёртка, сама полоска остаётся прежней. */
.hit { position: relative; padding: .18em 0; cursor: help; }
.hit .bar { margin-top: 0; }
.hit[data-tip]:hover .bar { box-shadow: 0 0 0 1px #ffffff55; }
.hit[data-tip]:hover .bar.ki { box-shadow: 0 0 0 1px var(--ki), 0 0 6px #f5d24766; }
.hit[data-tip]:hover .bar.rs { box-shadow: 0 0 0 1px var(--res), 0 0 6px #ef4a5a66; }
.hit.none .bar { opacity: .35; }
.bar { position: relative; height: .62em; border-radius: .31em; background: #0c1017;
  margin-top: .2em; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 100%; transform-origin: left;
  transition: transform .18s linear; }
.bar.hp { height: .82em; }
.bar.hp > i { background: linear-gradient(90deg, #3fbf72, #6ff0a4); }
.bar.ki > i { background: linear-gradient(90deg, #b99320, var(--ki)); }
.bar.rs > i { background: linear-gradient(90deg, #a02533, var(--res)); }
.bar .val { position: absolute; right: .3em; top: -.12em; font-size: .82em; color: #fff;
  text-shadow: 0 1px 2px #000; font-variant-numeric: tabular-nums; line-height: 1; }
.stats { display: flex; justify-content: space-between; padding: .1em .4em .4em;
  font-size: .92em; line-height: 1.3; color: #aab3c6; font-variant-numeric: tabular-nums; }
.stats span { white-space: nowrap; }

/* состояния */
.card.mine .face { border-color: #2c3d5c; }
.card.enemy .face { border-color: #5c2c33; }
.card.s2 .face { border-color: var(--gold); box-shadow: 0 0 10px #f2c14b40 inset; }
.card.s3 .face { border-color: #7de3ff;
  box-shadow: 0 0 14px #7de3ff50 inset, 0 0 10px #ff5ea840; }
.card.charged .face { animation: pulse 1s infinite; }
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(239,74,90,0); }
  50% { box-shadow: 0 0 14px 2px rgba(239,74,90,.55); }
}
.card.charged::after { content: ''; position: absolute; inset: -4px; border-radius: 12px;
  pointer-events: none; background: radial-gradient(circle at 50% 100%, #ef4a5a30, transparent 60%); }
.card.casting .face { border-color: var(--ki); box-shadow: 0 0 16px #f5d24760; }
.card.transformed .face.back { border-color: #ffd34a;
  background: linear-gradient(180deg, #3a2a12, #1b1408);
  box-shadow: 0 0 22px #ffb02e55 inset; }
.card.dead { animation: die .5s forwards; pointer-events: none; }
@keyframes die {
  to { transform: translateY(26px) rotate(-6deg); opacity: .22; filter: grayscale(1); }
}
.card.resting { filter: grayscale(.8); opacity: .55; }
.card.resting::before { content: 'отдыхает'; position: absolute; z-index: 3; top: 50%;
  left: 0; right: 0; text-align: center; font-size: 1em; color: var(--gold); }
.card.hit { animation: hit .18s; }
@keyframes hit { 50% { transform: translateX(4px) scale(.97); filter: brightness(1.7); } }
.card.sepia { filter: sepia(1) contrast(1.2); transition: filter .1s; }

.card.sold { animation: sold .3s forwards; }
@keyframes sold { to { transform: scale(.5); opacity: 0; } }

/* ───────────────────────────── скамейка и магазин ─────────────────── */
.bench-row { display: flex; gap: 10px; padding: 6px 12px; align-items: center; flex: none;
  border-top: 1px solid var(--line); background: #0c1018; }
.bench { display: flex; gap: 6px; flex: 1; min-height: calc(var(--card-h) * .7);
  align-items: flex-start; }
/* transform не влияет на раскладку — лишнюю высоту и ширину снимаем отрицательными
   полями, иначе скамейка резервирует высоту полноразмерной карты. */
.bench .card { transform: scale(.7); transform-origin: left top;
  margin-right: calc(var(--card-w) * -0.3);
  margin-bottom: calc(var(--card-h) * -0.3); }
.sell-zone { width: 150px; text-align: center; font-size: 13px; color: var(--dim);
  border: 1px dashed #3a2530; border-radius: 8px; padding: 10px 6px; }
.sell-zone.hover { border-color: var(--enemy); color: var(--enemy); background: #2a141a; }

.shop-row { display: flex; gap: 12px; padding: 8px 12px; align-items: center; flex: none;
  border-top: 1px solid var(--line); background: #0a0e15; }
.shop { display: flex; gap: 8px; flex: 1; }
.shop .card { cursor: pointer; }
.shop .slot-empty { width: var(--card-w); height: var(--card-h); border-radius: 10px;
  border: 1px dashed #202737; }
/* Кнопки в две колонки: столбик из четырёх съедал высоту у поля. */
.shop-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; width: 248px; }
.act { text-align: left; display: flex; justify-content: space-between; align-items: center;
  gap: 6px; padding: 9px 12px; font-size: 13px; }
.act .cost { color: var(--gold); }
.act.wide { grid-column: 1 / -1; }
.act.fight { grid-column: 1 / -1; background: linear-gradient(180deg, #d13a4a, #8e1f2c);
  border-color: #e0505f; justify-content: center; font-weight: 800; letter-spacing: 2px;
  padding: 14px; font-size: 16px; }
.act.ghost.on { border-color: var(--ki); color: var(--ki); background: #1d2130; }

/* ───────────────────────────── бой ───────────────────────────── */
.fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none;
  overflow: visible; }
.beam { stroke-linecap: round; opacity: .95; animation: fade .28s forwards; }
@keyframes fade { to { opacity: 0; } }
.ultbeam { animation: fade .5s forwards; filter: drop-shadow(0 0 6px currentColor); }

.float { position: absolute; font-weight: 800; font-size: 13px; pointer-events: none;
  text-shadow: 0 2px 4px #000; animation: rise .8s forwards; z-index: 5; }
@keyframes rise { to { transform: translateY(-34px); opacity: 0; } }
.float.phys { color: #ffd9a0; } .float.energy { color: #9ad8ff; }
.float.true { color: #ff8fa4; } .float.heal { color: var(--hp); }
.float.crit { font-size: 18px; color: #fff06a; }
.float.miss { color: var(--dim); font-size: 11px; }

.banner { position: absolute; left: 0; right: 0; top: 42%; text-align: center;
  pointer-events: none; z-index: 8; opacity: 0; }
.banner.show { animation: bannerIn 1.4s forwards; }
@keyframes bannerIn {
  0% { opacity: 0; transform: scale(.6); }
  18% { opacity: 1; transform: scale(1.08); }
  70% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.02); }
}
.banner .big-t { font-size: 34px; font-weight: 900; letter-spacing: 3px;
  text-transform: uppercase; color: #fff;
  text-shadow: 0 0 24px var(--flash, #ffb02e), 0 0 60px var(--flash, #ffb02e); }
.banner .sub { font-size: 15px; color: #ffe6a8; letter-spacing: 2px; }

.flashwrap { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.flashwrap.fire { animation: flash .5s forwards; background: radial-gradient(
  circle at 50% 50%, var(--flash, #ffb02e55), transparent 65%); }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }

.playback { position: fixed; bottom: 0; left: 232px; right: 0; height: 46px;
  display: flex; align-items: center; gap: 6px; padding: 0 12px;
  border-top: 1px solid var(--line); background: #0c1018; }
.sp { padding: 5px 12px; font-size: 12px; }
.sp.active { border-color: var(--mine); color: var(--mine); }
.sp.skip { margin-left: 6px; }
.feed { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font-size: 12px; color: var(--dim); text-align: right; }
.feed b { color: var(--ink); }

/* ───────────────────────────── модалки ───────────────────────────── */
.modal { position: fixed; inset: 0; background: #05070ccc; display: grid;
  place-items: center; z-index: 20; backdrop-filter: blur(3px); }
.modal-box { background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 26px 34px; text-align: center; min-width: 380px; max-width: 620px; }
.modal-box h2 { margin: 0 0 8px; font-size: 28px; }
.modal-box h2.win { color: var(--hp); } .modal-box h2.lose { color: var(--enemy); }
.modal-box p { color: #c3cbdb; margin: 0 0 18px; }
.history { text-align: left; color: var(--dim); font-size: 13px; max-height: 240px;
  overflow: auto; }
.history .w { color: var(--hp); } .history .l { color: var(--enemy); }

.toast { position: fixed; top: 62px; left: 50%; transform: translateX(-50%);
  background: #2a1a22; border: 1px solid var(--enemy); color: #ffd7dc; padding: 8px 16px;
  border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 30; }
.toast.show { opacity: 1; }

.tooltip { position: fixed; z-index: 40; width: 320px; background: #10151f;
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font-size: 12px;
  color: #c9d2e4; pointer-events: none; box-shadow: 0 10px 30px #000a; }
.tooltip h4 { margin: 0 0 2px; font-size: 14px; color: var(--ink); }
.tooltip .t-row { display: flex; justify-content: space-between; gap: 10px; }
.tooltip .t-dim { color: var(--dim); }

/* Блоки подсказки: статы / ульта / трансформация — каждый со своей полосой слева,
   чтобы «что даёт форма» не сливалось с «что даёт ульта». */
.tooltip .t-sec { margin-top: 7px; padding: 6px 0 0 8px; border-left: 2px solid var(--line);
  border-top: 1px solid #1c2231; }
.tooltip .t-sec.ult { border-left-color: var(--ki); }
.tooltip .t-sec.tr { border-left-color: var(--res); }
.tooltip .t-head { display: flex; justify-content: space-between; align-items: baseline;
  gap: 10px; margin-bottom: 3px; }
.tooltip .t-head span { font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--dim); white-space: nowrap; }
.tooltip .t-sec.ult .t-head span { color: var(--ki); }
.tooltip .t-sec.tr .t-head span { color: var(--res); }
.tooltip .t-head b { font-size: 13px; color: var(--ink); text-align: right; }
.tooltip .t-line { margin: 2px 0; line-height: 1.4; }
.tooltip .t-line.warn { color: #ffc9a0; }
.tooltip .t-row em.up { font-style: normal; color: var(--hp); }
.tooltip .t-row em.down { font-style: normal; color: var(--enemy); }
.tooltip .t-hint { margin-top: 8px; padding-top: 6px; border-top: 1px dashed #232b3d;
  font-size: 11px; color: var(--dim); }

/* Лестница порогов синергии: взятые — золотом, ближайший — светлый, дальше — тускло. */
.tooltip .t-sec.tiers { padding-left: 0; border-left: none; }
.tooltip .tier { display: flex; gap: 8px; align-items: baseline; padding: 3px 0; }
.tooltip .tier + .tier { border-top: 1px solid #1a2030; }
.tooltip .tier b { flex: none; width: 19px; text-align: center; border-radius: 4px;
  background: #1b2233; color: var(--dim); font-size: 11px; line-height: 1.5; }
.tooltip .tier span { flex: 1; line-height: 1.35; }
.tooltip .tier.on b { background: var(--gold); color: #10151f; }
.tooltip .tier.on span { color: var(--ink); }
.tooltip .tier.next b { background: #33405e; color: var(--ink); }
.tooltip .tier.off { opacity: .5; }

/* ═════════════════════════ партия на восемь ═════════════════════════ */

.start-buttons { display: flex; gap: 10px; justify-content: center; margin-top: 14px; }
.gold-t { color: var(--gold); }

/* ── список открытых лобби на стартовом экране ── */
.lobby-list { margin-top: 22px; text-align: left; }
.lobby-list h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--dim); margin: 0 0 8px; }
.lobby-row { display: flex; align-items: center; gap: 12px; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px;
  background: #131826; font-size: 13px; }
.lobby-row .t-dim { flex: 1; color: var(--dim); overflow: hidden; white-space: nowrap;
  text-overflow: ellipsis; }

/* ── лобби ── */
#lobby-code { color: var(--gold); text-shadow: 0 0 24px rgba(242,193,75,.5); font-size: 40px; }
.seats { list-style: none; padding: 0; margin: 18px 0 0; display: grid;
  grid-template-columns: repeat(4, 1fr); gap: 8px; }
.seat { border: 1px solid var(--line); border-radius: 8px; padding: 10px 8px;
  background: #131826; font-size: 13px; text-align: center; }
.seat.empty { opacity: .45; border-style: dashed; }
.seat.me { border-color: var(--mine); background: #16213a; }
.seat .tag { display: block; font-size: 10px; color: var(--gold);
  text-transform: uppercase; letter-spacing: 1px; margin-top: 2px; }

/* ── чипы HUD ── */
.chip.timer b { font-variant-numeric: tabular-nums; }
.chip.timer.urgent { border-color: var(--enemy); }
.chip.timer.urgent b { color: var(--enemy); }
.chip.despair { border-color: #5c2c33; cursor: help; }
.chip.despair b { color: var(--res); }

/* ── таблица стола ── */
.stand { display: grid; grid-template-columns: 1fr 46px 44px; align-items: center; gap: 6px;
  padding: 5px 7px; border-radius: 7px; margin-bottom: 4px; background: #131826;
  border: 1px solid transparent; font-size: 12px; }
.stand .nm { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.stand .nm .bot { font-style: normal; font-size: 10px; color: var(--dim); margin-left: 4px; }
.stand .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--dim); }
.stand.me { border-color: var(--mine); background: #16213a; }
.stand.me .val { color: var(--ink); }
.stand.foe { border-color: var(--enemy); }
.stand.dead { opacity: .4; }
.stand.dead .hp-mini { visibility: hidden; }
.hp-mini { height: 6px; border-radius: 3px; background: #0c1017; overflow: hidden; }
.hp-mini > i { display: block; height: 100%; background: linear-gradient(90deg, #3fbf72, #6ff0a4); }
.stand.foe .hp-mini > i { background: linear-gradient(90deg, #a02533, var(--enemy)); }

/* ── реликвии ── */
.relic-row { display: flex; flex-direction: column; gap: 4px; }
.relic-chip { display: flex; align-items: center; gap: 6px; padding: 5px 7px; font-size: 12px;
  border: 1px solid #3a3320; border-radius: 7px; background: #1b1810; cursor: help; }
.relic-chip .ic { font-size: 14px; }

.modal-box.wide { min-width: 560px; max-width: 860px; }
.relic-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px; margin-bottom: 16px; }
.relic-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 10px;
  background: linear-gradient(180deg, #1a2030, #11151f); text-align: center;
  transition: transform .1s, border-color .15s; }
.relic-card .ic { font-size: 28px; line-height: 1.1; }
.relic-card .nm { font-weight: 600; margin: 6px 0 4px; font-size: 13px; }
.relic-card .ds { font-size: 11px; color: var(--dim); line-height: 1.4; }
.relic-card .by { margin-top: 6px; font-size: 10px; color: var(--enemy);
  text-transform: uppercase; letter-spacing: 1px; }
.relic-card.taken { opacity: .35; }
.relic-card.pickable { cursor: pointer; border-color: var(--gold); }
.relic-card.pickable:hover { transform: translateY(-3px); box-shadow: 0 8px 22px #0008; }

.relic-order { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap;
  gap: 6px; justify-content: center; font-size: 12px; }
.relic-order li { padding: 4px 9px; border-radius: 20px; background: #131826;
  border: 1px solid var(--line); color: var(--dim); }
.relic-order li.now { border-color: var(--gold); color: var(--ink); background: #1f1c10; }
.relic-order li.done { opacity: .4; }

/* ── итог партии ── */
.places { list-style: none; padding: 0; margin: 0 0 18px; text-align: left; font-size: 14px; }
.places li { display: flex; gap: 8px; align-items: baseline; padding: 6px 10px;
  border-bottom: 1px solid #1c2231; }
.places li.me { background: #16213a; border-radius: 6px; }
.places li b { color: var(--gold); min-width: 26px; }
.places .bot { font-style: normal; font-size: 11px; color: var(--dim); }

/* Поле подгоняется скриптом, здесь ужимаются только магазин и скамейка.
   Пороги подняты вместе с размером карт: нижние ряды стали выше, поэтому
   переходить на следующую ступень нужно раньше — иначе на невысоком окне
   магазин отъедает у арены больше, чем она может отдать. */
@media (max-height: 860px) { :root { --card-w: 112px; --card-h: 162px; } }
@media (max-height: 800px) { :root { --card-w: 98px;  --card-h: 143px; } }
