:root {
  --table: #15242a;
  --table-2: #1c3036;
  --felt: #20383f;
  --line: #34515a;
  --ink: #eef0ea;
  --ink-dim: #9fb3b6;
  --brass: #f2b33d;
  --me: #e8654f;
  --opp: #5fb6dc;
  --attack: #c8463b;
  --defense: #3a76b8;
  --versatile: #7b56b0;
  --scheme: #e8901a; /* приём — жёлто-оранжевый, как флажок на картах */
  --paper: #f3efe3;
  --paper-ink: #22201b;
  --radius-card: 10px;
  --display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --body: 'Source Sans 3', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--table) radial-gradient(ellipse at 40% 30%, var(--felt), var(--table) 70%) no-repeat fixed;
  color: var(--ink);
  font: 15px/1.45 var(--body);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; margin: 0; letter-spacing: 0.01em; }

.btn {
  background: var(--table-2); border: 1px solid var(--line); border-radius: 6px;
  padding: 7px 12px; color: var(--ink);
}
.btn:hover { border-color: var(--ink-dim); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.primary { background: var(--brass); border-color: var(--brass); color: #1a1406; font-weight: 700; }
.btn.small { padding: 4px 9px; font-size: 13px; }

/* ---------------- лобби ---------------- */
.lobby { max-width: 1060px; margin: 0 auto; padding: 32px 20px 60px; }
.lobby-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.lobby-head h1 { font-size: 46px; line-height: 1; }
.lobby-head p { color: var(--ink-dim); margin: 0; }
.lobby section { margin-bottom: 26px; }
.lobby h2 { font-size: 24px; margin-bottom: 10px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field span { color: var(--ink-dim); font-size: 13px; }
.field input, .field select, textarea {
  background: var(--table); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; min-width: 200px;
}
.field select {
  appearance: none; -webkit-appearance: none; padding-right: 34px; max-width: 100%; text-overflow: ellipsis; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%239fb3b6' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 12px 8px;
}
.field select:hover { border-color: var(--ink-dim); }
.field select option { background: var(--table); color: var(--ink); }
.row.bottom { align-items: flex-end; }
.row.bottom .btn { padding-top: 8px; padding-bottom: 8px; }
.field { min-width: 0; max-width: 100%; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { background: transparent; border: 0; padding: 8px 14px; color: var(--ink-dim); }
.seg button[aria-pressed='true'] { background: var(--brass); color: #1a1406; font-weight: 700; }

.hero-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.hero-tile {
  text-align: left; background: var(--table-2); border: 2px solid var(--line); border-radius: 8px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.hero-tile[aria-pressed='true'] { border-color: var(--brass); box-shadow: 0 0 0 3px rgba(242, 179, 61, 0.2); }
.hero-tile .hn { font-family: var(--display); font-size: 22px; font-weight: 700; line-height: 1.1; }
.hero-tile .hs { color: var(--ink-dim); font-size: 13px; }
.hero-tile .warn { color: var(--brass); font-size: 12px; }
.hero-pick { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; height: 640px; }
.hero-pick .hero-grid { overflow-y: auto; align-content: start; min-height: 0; padding: 4px; }
/* тонкий тёмный скроллбар: стандартные свойства (Firefox, Chrome 121+, Safari 18.2+), ::-webkit-scrollbar — для старых Chrome/Safari */
.hero-pick .hero-grid { scrollbar-width: thin; scrollbar-color: #0f1d21 transparent; }
.hero-pick .hero-grid::-webkit-scrollbar { width: 6px; }
.hero-pick .hero-grid::-webkit-scrollbar-track { background: transparent; }
.hero-pick .hero-grid::-webkit-scrollbar-thumb { background: #0f1d21; border-radius: 3px; }
.hero-pick .hero-grid::-webkit-scrollbar-thumb:hover { background: #0a1417; }
.hero-detail {
  display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow: hidden; padding: 16px;
  background: var(--table-2); border: 1px solid var(--line); border-radius: 8px; color: var(--ink-dim); font-size: 14px;
}
.hero-detail.empty { justify-content: center; text-align: center; }
.hero-detail .hd-name { font-size: 36px; line-height: 1; text-transform: uppercase; color: var(--ink); }
.hero-detail .hd-set { font-size: 13px; margin-top: -6px; }
.hero-detail .warn { color: var(--brass); font-size: 12px; }
.hero-detail .hd-stats { margin: 0; display: flex; flex-direction: column; gap: 3px; padding: 8px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.hero-detail .st { display: flex; gap: 10px; }
.hero-detail dt { flex: 0 0 84px; font-size: 13px; }
.hero-detail dd { margin: 0; color: var(--ink); font-weight: 600; }
.hero-detail .hd-ability { flex: 1; min-height: 0; overflow-y: auto; }
.hero-detail .hd-ability p, .ab-list { margin: 0 0 6px; }
.ab-list { padding-left: 18px; }
.hero-detail button { align-self: flex-start; }

/* ---------------- игра ---------------- */
.game { display: grid; grid-template-columns: 1fr 380px; grid-template-rows: auto auto 1fr auto auto; height: 100vh; }
.topbar {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; padding: 8px 14px;
  border-bottom: 1px solid var(--line); background: rgba(0, 0, 0, 0.2); flex-wrap: wrap;
}
.topbar .title { font-family: var(--display); font-size: 22px; font-weight: 700; }
.topbar .turn { color: var(--ink-dim); }
.topbar .spacer { flex: 1; }
.dots { display: inline-flex; gap: 4px; vertical-align: middle; }
.dots i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--brass); display: inline-block; }
.dots i.on { background: var(--brass); }

.board-wrap { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 8px; min-height: 0; }
.board { width: 100%; height: 100%; max-height: 100%; }
.board .edge { stroke: #4c6c74; stroke-width: 5; stroke-linecap: round; }
.board .space-bg { fill: #2a464d; }
.board .space-num { fill: #b9c7c6; font: 600 13px var(--body); text-anchor: middle; pointer-events: none; }
.board .space.target circle.space-bg { fill: #6b5418; }
.board .space.target { cursor: pointer; }
.board .space.target .ring-hl { stroke: var(--brass); stroke-width: 4; fill: none; animation: pulse 1.1s ease-in-out infinite alternate; }
@keyframes pulse { from { stroke-opacity: 1; } to { stroke-opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .board .space.target .ring-hl { animation: none; } }
.fog circle { fill: rgba(215, 230, 236, 0.32); stroke: rgba(235, 245, 248, 0.55); stroke-width: 1.5; }
.token { cursor: default; }
.token.target { cursor: pointer; }
.token .disc { stroke: #0e1a1e; stroke-width: 3; }
.token.target .disc { stroke: var(--brass); stroke-width: 4; }
.token.in-combat .disc { stroke: #fff; stroke-width: 4; }
.token text { font-family: var(--display); font-weight: 800; text-anchor: middle; pointer-events: none; }
.token .tl { fill: #fff; font-size: 17px; }
.token.sidekick .tl { font-size: 11.5px; }
.token.sidekick .disc { stroke-width: 2; opacity: 0.92; }
.token .hp { fill: #fff; font-size: 12px; }
.token .halo { fill: none; stroke-width: 3; opacity: 0.85; }
.token .crown { fill: #f2c94c; stroke: #0e1a1e; stroke-width: 1.5; stroke-linejoin: round; }
.token .rim { fill: none; }
.token .num { fill: #fff; font-size: 10px; }
.token.target .rim { stroke: var(--brass); }
.token.in-combat .rim { stroke: #fff; }
.token .hp-bg { fill: #0e1a1e; }

.side { border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; overflow: auto; background: rgba(0, 0, 0, 0.15); grid-row: 2 / 6; grid-column: 2; }
.side > * { padding: 10px 14px; }
/* Плашки игроков — полосы над полем (соперник) и под ним (вы), как места за столом */
.pl { grid-column: 1; display: flex; align-items: center; gap: 8px 18px; flex-wrap: wrap; padding: 6px 14px; background: rgba(0, 0, 0, 0.18); }
.pl.opp { grid-row: 2; border-bottom: 1px solid var(--line); box-shadow: inset 4px 0 0 var(--opp); }
.pl.me { grid-row: 4; border-top: 1px solid var(--line); box-shadow: inset 4px 0 0 var(--me); }
.pl .fighters { margin-top: 0; }
.pl .pn { color: var(--ink-dim); font-size: 14px; }
.board-wrap { grid-row: 3; grid-column: 1; }
.pl-head { display: flex; align-items: baseline; gap: 8px; }
.pl-head .who { font-family: var(--display); font-size: 21px; font-weight: 700; }
.pl.me .who { color: var(--me); }
.pl.opp .who { color: var(--opp); }
.pl-meta { color: var(--ink-dim); font-size: 13px; display: flex; gap: 10px; flex-wrap: wrap; }
.pl-meta button { background: none; border: 0; padding: 0; color: var(--ink-dim); text-decoration: underline dotted; }
.pl-res { font-size: 13px; color: var(--brass); }
.fighters { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; font-size: 13px; }
.fighters .f { background: var(--table); border-radius: 4px; padding: 1px 7px; }
.fighters .f.dead { text-decoration: line-through; opacity: 0.5; }

.decision { border-bottom: 1px solid var(--line); background: rgba(242, 179, 61, 0.07); }
.decision.waiting { background: transparent; color: var(--ink-dim); }
.decision .prompt { font-weight: 700; margin-bottom: 8px; }
.decision .manual-text { background: var(--paper); color: var(--paper-ink); padding: 8px 10px; border-radius: 6px; margin-bottom: 8px; font-size: 14px; }
.opts { display: flex; flex-direction: column; gap: 5px; max-height: 34vh; overflow: auto; }
.opts button { text-align: left; background: var(--table-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; }
.opts button:hover { border-color: var(--brass); }
.opts button.minor { color: var(--ink-dim); }

.combat { border-bottom: 1px solid var(--line); }
.combat .vs { display: flex; align-items: center; gap: 8px; justify-content: center; }
.combat .vs .x { font-family: var(--display); font-size: 26px; color: var(--ink-dim); }

.log { flex: 1; overflow: auto; min-height: 120px; font-size: 13px; color: var(--ink-dim); }
.log div { padding: 1px 0; }
.log .turn { color: var(--ink); font-weight: 700; margin-top: 6px; }
.log .priv { color: var(--brass); }

.hand-wrap { grid-column: 1 / 2; grid-row: 5; border-top: 1px solid var(--line); padding: 8px 12px; overflow-x: auto; background: rgba(0, 0, 0, 0.2); }
.hand { display: flex; gap: 8px; min-height: 150px; align-items: stretch; padding-top: 10px; }
.hand .empty { color: var(--ink-dim); align-self: center; }

/* ---------------- карта (игральная) ---------------- */
.card {
  position: relative; width: 148px; min-height: 150px; flex: 0 0 auto;
  background: var(--paper); color: var(--paper-ink); border-radius: var(--radius-card);
  border: 3px solid var(--c, #777); padding: 26px 8px 22px; font-size: 11.5px; line-height: 1.3; text-align: left;
  display: flex; flex-direction: column; justify-content: flex-start;
}
.card.attack { --c: var(--attack); }
.card.defense { --c: var(--defense); }
.card.versatile { --c: var(--versatile); }
.card.scheme { --c: var(--scheme); }
.card .val {
  position: absolute; top: -3px; left: -3px; width: 34px; height: 34px; border-radius: var(--radius-card) 0 10px 0;
  background: var(--c); color: #fff; font: 800 24px/34px var(--display); text-align: center;
}
.card .val.vs { background: linear-gradient(135deg, var(--attack) 50%, var(--defense) 50%); }
.card .nm { font-family: var(--display); font-weight: 700; font-size: 15px; line-height: 1.05; margin: -20px 0 4px 34px; min-height: 30px; }
.card .who { font-size: 10.5px; color: #6a6355; margin-bottom: 3px; }
.card .tx b { font-weight: 700; }
.card .bst {
  position: absolute; bottom: 4px; right: 6px; font: 700 13px var(--display); color: #6a6355;
}
.card .sym { position: absolute; bottom: 3px; left: 6px; font-size: 14px; }
.card .man { position: absolute; top: 3px; right: 5px; font-size: 10px; color: #a33; }
.card.back { background: repeating-linear-gradient(45deg, #2d4a52, #2d4a52 6px, #26404a 6px, #26404a 12px); border-color: #4c6c74; min-height: 150px; }
button.card { cursor: default; }
button.card.playable { cursor: pointer; box-shadow: 0 0 0 3px #fff4cf, 0 0 16px rgba(255, 244, 207, 0.55); transform: translateY(-6px); }
button.card.playable:hover { transform: translateY(-10px); }
.card.mini { width: 120px; min-height: 120px; font-size: 10.5px; }

/* ---------------- модалка, тост ---------------- */
.modal { position: fixed; inset: 0; background: rgba(5, 10, 12, 0.7); display: flex; align-items: center; justify-content: center; z-index: 20; padding: 16px; }
.modal[hidden] { display: none; }
.modal-box { background: var(--table-2); border: 1px solid var(--line); border-radius: 10px; max-width: 860px; width: 100%; max-height: 88vh; overflow: hidden; display: flex; flex-direction: column; position: relative; }
.modal-body { overflow-y: auto; min-height: 0; padding: 20px 22px; }
.modal-body > h2:first-child { position: sticky; top: -20px; z-index: 1; background: var(--table-2); margin: -20px -22px 10px; padding: 20px 52px 8px 22px; }
.modal-close { position: absolute; top: 8px; right: 10px; z-index: 2; background: none; border: 0; font-size: 26px; color: var(--ink-dim); }
.modal h2 { font-size: 26px; margin-bottom: 10px; }
.cards-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.md { max-width: 75ch; }
.md h1, .md h2, .md h3 { margin: 14px 0 6px; font-size: 21px; }
.md p, .md li { color: var(--ink); }
.analysis-item { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 14px; }
.analysis-item .q { color: var(--ink-dim); font-size: 13px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #3a1d1a; border: 1px solid var(--me); padding: 8px 14px; border-radius: 6px; z-index: 30; max-width: 90vw; }
.toast[hidden] { display: none; }
.winner { font-family: var(--display); font-size: 30px; font-weight: 800; color: var(--brass); }
.thinking { color: var(--opp); }
.deck-row { display: grid; grid-template-columns: 2.4fr 0.4fr 1fr 5fr; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.deck-row .t { font-weight: 700; }
.share { background: var(--table); border: 1px dashed var(--line); padding: 10px 12px; border-radius: 6px; word-break: break-all; }

@media (max-width: 900px) {
  .hero-pick { grid-template-columns: 1fr; height: auto; }
  .hero-pick .hero-grid { max-height: 320px; }
  .hero-detail { min-height: 380px; }
  .game { grid-template-columns: 1fr; grid-template-rows: auto auto auto auto auto auto; height: auto; }
  .pl { padding: 6px 10px; gap: 4px 12px; }
  .side { border-left: 0; border-top: 1px solid var(--line); }
  .hand-wrap { grid-column: 1; grid-row: 5; }
  .side { grid-row: 6; grid-column: 1; overflow: visible; }
  .board-wrap { height: auto; overflow-x: auto; justify-content: flex-start; }
  .board { min-width: 720px; }
  .side .combat { order: -2; }
  .side .decision { order: -1; }
  .log { max-height: 40vh; }
  .card { width: 128px; }
  .deck-row { grid-template-columns: 1fr 1fr; }
}

/* ---------------- подсказка ---------------- */
.prompt-row { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.prompt-row .prompt { flex: 1; }
.hint-btn { flex: none; border-color: var(--brass); color: var(--brass); }
.hint-box { background: rgba(242, 179, 61, 0.12); border-left: 3px solid var(--brass); padding: 7px 10px; border-radius: 4px; margin: 0 0 8px; font-size: 14px; }
.opts button.advised { border-color: var(--brass); box-shadow: inset 0 0 0 1px var(--brass); }
.check { display: inline-flex; gap: 8px; align-items: center; color: var(--ink); }

/* ---------------- карты в логе ---------------- */
.card-ref { color: var(--ink); text-decoration: underline dotted var(--ink-dim); text-underline-offset: 2px; cursor: help; }
.card-ref:hover, .card-ref:focus-visible { color: var(--brass); }
.card-tip { position: fixed; z-index: 40; display: flex; gap: 8px; pointer-events: none; filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.5)); }
.card-tip[hidden] { display: none; }
.card-tip .tip-hero { font: 700 13px var(--display); color: var(--ink); background: var(--table-2); border-radius: 4px; padding: 1px 6px; margin-bottom: 4px; display: inline-block; }
.card-tip .card { width: 170px; font-size: 12px; }

.board .passage circle { fill: #3d2a55; stroke: #c9a8f0; stroke-width: 1.5; }
.board .passage text { fill: #e6d6fa; font: 700 11px var(--body); text-anchor: middle; pointer-events: none; }

/* ---------------- последний бой ---------------- */
.combat.last { background: rgba(255, 255, 255, 0.03); }
.lc-head { display: flex; justify-content: space-between; align-items: center; color: var(--ink-dim); font-size: 13px; margin-bottom: 4px; }
.lc-close { background: none; border: 0; color: var(--ink-dim); font-size: 22px; line-height: 1; padding: 0 4px; }
.lc-close:hover { color: var(--ink); }
.lc-result { text-align: center; margin-top: 8px; font-weight: 700; }
.lc-boosts { text-align: center; color: var(--ink-dim); font-size: 13px; margin-top: 2px; }

/* ---------------- рука соперника ---------------- */
.reveal-box {
  position: fixed; z-index: 25; left: 16px; top: 64px; max-width: min(760px, calc(100vw - 32px));
  background: var(--table-2); border: 1px solid var(--brass); border-radius: 10px; padding: 10px 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
.reveal-box[hidden] { display: none; }
.reveal-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 8px; }
.reveal-head span { color: var(--ink-dim); font-size: 13px; flex: 1; }
.reveal-cards { display: flex; gap: 8px; flex-wrap: wrap; }
.reveal-note { color: var(--ink-dim); font-size: 12px; margin-top: 6px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brass); text-decoration: underline dotted; font-size: 12px; }

/* ---------------- карточка бойца ---------------- */
.fighters button.f { border: 0; color: var(--ink); font: inherit; cursor: pointer; }
.fighters button.f:hover { outline: 1px solid var(--ink-dim); }
.token.info { cursor: pointer; }
.fi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin: 10px 0 14px; }
.fi-grid div { background: var(--table); border-radius: 6px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.fi-grid span { color: var(--ink-dim); font-size: 12px; }

/* Летящая в сброс карта */
.fly-card { position: fixed; z-index: 60; pointer-events: none; transform-origin: center; }
.fly-card .card { width: 100%; height: 100%; margin: 0; box-shadow: 0 10px 24px rgba(0,0,0,.5); }
.pl-meta [data-discard] { display: inline-block; }

.back-btn { margin-top: 8px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.decision.waiting .back-btn { margin: 0 0 8px; }

/* Реванш */
.rematch { margin: 10px 0 12px; }
.rematch.offer { background: rgba(242, 179, 61, 0.12); border-left: 3px solid var(--brass); padding: 8px 10px; border-radius: 4px; }
.rematch.waiting { color: var(--ink-dim); }
.rematch-note { font-size: 12px; color: var(--ink-dim); margin-top: 4px; }

/* Подсказка по особым клеткам поля */
.space-tip { position: fixed; z-index: 55; max-width: 300px; background: #0f1d21; border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 12px; font-size: 13px; line-height: 1.4; box-shadow: 0 8px 22px rgba(0,0,0,.45); pointer-events: none; }
.space-tip .sp-head { font-family: var(--display); font-weight: 700; font-size: 17px; margin-bottom: 4px; }
.space-tip .sp-line + .sp-line { margin-top: 5px; }
.space-tip .zdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin: 0 4px 0 2px; vertical-align: 0; }
.board .space.special { cursor: help; }
.board .space.special.target { cursor: pointer; }

/* Сколько таких карт ещё в колоде — ярлычок над картой в руке */
.card .dk { position: absolute; top: -21px; right: 6px; background: #0f1d21; color: var(--ink); border: 1px solid var(--line);
  border-radius: 9px; padding: 0 7px; font: 600 11px/18px var(--body); white-space: nowrap; }
.card .dk.none { color: var(--ink-dim); }
.hand { padding-top: 22px; }

/* Часы */
.timer-note { color: var(--ink-dim); font-size: 13px; margin: 6px 0 0; }
.clock { font-variant-numeric: tabular-nums; color: var(--ink-dim); padding: 0 6px; border-radius: 4px; }
.clock.running { color: var(--ink); background: rgba(255, 255, 255, 0.08); font-weight: 700; }
.clock.low { color: #ffb04a; }
.clock.low.running { animation: clock-pulse 1s ease-in-out infinite alternate; }
.clock.out { color: #ff6b5e; font-weight: 700; }
@keyframes clock-pulse { from { opacity: 1; } to { opacity: 0.55; } }
@media (prefers-reduced-motion: reduce) { .clock.low.running { animation: none; } }

/* Длинные названия карт (русское издание) переносятся, а не обрезаются */
.card .nm { hyphens: auto; -webkit-hyphens: auto; overflow-wrap: anywhere; }
.card .nm.long { font-size: 13px; }
.card .nm.xlong { font-size: 11.5px; }
.card.mini .nm.long { font-size: 10.5px; }
.card.mini .nm.xlong { font-size: 9.5px; }

/* Значки ингредиентов Вещих сестёр */
.ing { display: inline-block; width: 1.25em; height: 1.25em; vertical-align: -0.28em; }
.ing svg { width: 100%; height: 100%; display: block; }
.card .sym .ing { width: 20px; height: 20px; vertical-align: -4px; }
/* на тёмном фоне — светлая подложка, чтобы фиолетовая мышь и красная лапка не терялись */
.pl-res .ing, .log .ing, .decision .ing, .modal .ing:not(.card .ing) { background: #efe8d6; border-radius: 50%; padding: 1px; box-sizing: content-box; }

/* количество таких карт в колоде героя */
.card .qt { position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%); font-size: 10.5px; color: #6c6457; font-weight: 600; }
/* действия соперника в его ход */
.dots.opp i { border-color: var(--opp); }
.dots.opp i.on { background: var(--opp); }
/* боец, который сейчас перемещается */
.token .move-ring { fill: none; stroke: var(--brass); stroke-width: 3; stroke-dasharray: 6 5; animation: spin 3s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes spin { to { transform: rotate(360deg); } }
/* наведение на атаку: атакующий и цель */
.token.hl-atk .disc { stroke: #f2c94c; stroke-width: 6; }
.token.hl-tgt .disc { stroke: #ff5a4f; stroke-width: 6; }
.token.hl-atk .rim, .token.hl-tgt .rim { stroke-width: 6; }
.token.hl-atk .rim { stroke: #f2c94c; }
.token.hl-tgt .rim { stroke: #ff5a4f; }
/* термины с подсказкой (несчастья Пандоры, чары Титании) — в логе и в панели игрока */
.term { border-bottom: 1px dotted currentColor; cursor: help; }
.term:focus { outline: none; }
@media (prefers-reduced-motion: reduce) { .token .move-ring { animation: none; } }
.card.mini .qt { display: none; }
.board .space.hl-atk > circle:not(.space-bg):not(.ring-hl) { stroke: #f2c94c; }
.board .space.hl-tgt > circle:not(.space-bg):not(.ring-hl) { stroke: #ff5a4f; }
.board .space.hl-atk { filter: drop-shadow(0 0 6px #f2c94c) drop-shadow(0 0 11px #f2c94c); }
.board .space.hl-tgt { filter: drop-shadow(0 0 6px #ff5a4f) drop-shadow(0 0 11px #ff5a4f); }

/* поиск героя по первым буквам */
.hero-tile.dim { opacity: .28; }
.hero-tile.match { outline: 2px solid var(--brass); outline-offset: 1px; }
.hero-search { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 70; background: #0f1d21; color: var(--ink);
  border: 1px solid var(--brass); border-radius: 999px; padding: 6px 16px; font-size: 15px; box-shadow: 0 6px 18px rgba(0,0,0,.45); white-space: nowrap; }
.hero-search b { color: var(--brass); }
.hero-search .hs-hint { color: var(--ink-dim); font-size: 13px; margin-left: 12px; padding-left: 12px; border-left: 1px solid var(--line); }
.hero-search kbd { font: 600 11px var(--body); color: var(--ink); background: var(--table-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; }
@media (max-width: 640px) { .hero-search .hs-hint { display: none; } }

/* выбор карт в панели решения (приёмы, сброс, колода, рука соперника) */
.decision .pick-cards { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; max-height: 360px; overflow-y: auto; padding: 2px; }
.decision .pick-cards .card { cursor: pointer; }
/* колода: кончается / пуста */
.deck-cnt { background: none; border: 0; color: inherit; font: inherit; padding: 0; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
span.deck-cnt { cursor: default; text-decoration: none; }
.deck-cnt.deck-low { color: #f2b33d; }
.deck-cnt.deck-empty { color: #ff6b5f; font-weight: 700; }
.tipped { position: relative; }
.tipped:hover::after, .tipped:focus::after { content: attr(data-tip); position: absolute; left: 0; top: calc(100% + 6px); z-index: 60; width: max-content; max-width: 280px;
  background: #0f1d21; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 13px; line-height: 1.35;
  box-shadow: 0 6px 18px rgba(0,0,0,.45); white-space: normal; font-weight: 400; text-align: left; }
.deck-view .card .dk { position: static; display: inline-block; margin-top: 4px; }
/* подсказка по бойцу */
.space-tip .sp-head small { font-weight: 400; color: var(--ink-dim); margin-left: 6px; font-size: 14px; }
.space-tip .sp-sep { height: 1px; background: var(--line); margin: 7px 0; }
/* всплывающие изменения здоровья */
.hp-float { font-family: var(--display); font-weight: 800; font-size: 20px; text-anchor: middle; pointer-events: none; paint-order: stroke; stroke: #0e1a1e; stroke-width: 4px; }
.hp-float.dmg { fill: #ff5a4f; }
.hp-float.heal { fill: #4fd88a; }

/* дополнительное условие карты выполнено */
.card.cond-on { box-shadow: 0 0 0 2px #3ecf8e, 0 0 14px 2px rgba(62,207,142,.55); }
.card.cond-on.playable { box-shadow: 0 0 0 2px #3ecf8e, 0 0 16px 3px rgba(62,207,142,.6), 0 0 22px 4px rgba(242,201,76,.35); }
.card .cnd { position: absolute; top: -21px; left: 6px; width: 19px; height: 19px; font-size: 12px; font-weight: 700; color: #fff; background: #1f9d63; border-radius: 50%; text-align: center; line-height: 19px; }
.card.mini .cnd { display: none; }

/* окно бойца: «×N» и остаток в колоде у мини-карт */
.fi-cards .card.mini .qt { display: block; left: 8px; transform: none; }
.fi-cards { row-gap: 30px; padding-top: 22px; }
.fi-cards .card .dk { font-size: 10.5px; }

/* страница «Участники» */
.member-row { display: grid; grid-template-columns: 160px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.member-row .share { margin: 0; font-size: 13px; word-break: break-all; }
@media (max-width: 720px) { .member-row { grid-template-columns: 1fr; } }

/* ---------------- предпросмотр поля (лобби, приглашение) ---------------- */
.lobby section.setup { display: grid; grid-template-columns: minmax(0, 1fr) 264px; gap: 24px; align-items: start; }
.setup-fields { min-width: 0; }
.map-preview { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.mp-frame {
  position: relative; display: block; width: 100%; aspect-ratio: 1040 / 700; padding: 0; overflow: hidden; cursor: zoom-in;
  border: 1px solid var(--line); border-radius: 12px;
  background: radial-gradient(ellipse at 45% 35%, #24414a, #122026 75%);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.38), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.mp-frame:hover, .mp-frame:focus-visible { border-color: rgba(242, 179, 61, 0.7); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45), 0 0 0 3px rgba(242, 179, 61, 0.14); transform: translateY(-1px); }
.mp-layer { position: absolute; inset: 0; padding: 8px; opacity: 0; transition: opacity 0.3s ease; }
.mp-layer.on { opacity: 1; }
.mp-layer.mp-wait { background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.05) 50%, transparent 70%) -100% 0 / 200% 100%; animation: mp-shimmer 1.2s linear infinite; }
@keyframes mp-shimmer { to { background-position: 100% 0; } }
.map-svg.mini { width: 100%; height: 100%; display: block; pointer-events: none; }
.map-svg.mini .edge { stroke: #4c6c74; stroke-width: 9; stroke-linecap: round; }
.map-svg.mini .space-bg { fill: #2a464d; }
.map-svg.mini .passage circle { fill: #3d2a55; stroke: #c9a8f0; stroke-width: 3; }
.map-svg.mini .passage text { display: none; }
.map-svg .start-mark { pointer-events: none; }
.map-svg .start-mark text { fill: #fff; font-family: var(--display); font-weight: 700; text-anchor: middle; paint-order: stroke; stroke: rgba(0, 0, 0, 0.35); stroke-width: 2px; }
.mp-zoom {
  position: absolute; right: 8px; bottom: 8px; font-size: 12px; color: var(--ink); background: rgba(15, 29, 33, 0.85);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; opacity: 0; transform: translateY(3px); transition: opacity 0.2s, transform 0.2s;
}
.mp-frame:hover .mp-zoom, .mp-frame:focus-visible .mp-zoom { opacity: 1; transform: none; }
.map-preview figcaption { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--ink-dim); padding: 0 2px; }
.mp-cap { display: flex; flex-direction: column; gap: 1px; }
.mp-cap b { color: var(--ink); font-family: var(--display); font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-cap span { white-space: nowrap; }
.mp-legend { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-top: 3px; }
.mp-legend i {
  font-style: normal; display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  color: #fff; font: 700 12px var(--display); box-shadow: 0 0 0 2px #0e1a1e;
}
.mp-legend i:not(:first-child) { margin-left: 8px; }
.modal-box.wide { max-width: min(1180px, 96vw); }
.mp-big-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; padding-right: 30px; }
.mp-big-head h2 { margin: 0; }
.mp-sub { color: var(--ink-dim); }
.mp-big { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: radial-gradient(ellipse at 45% 35%, #24414a, #122026 75%); }
.mp-big .board { display: block; width: 100%; height: auto; max-height: 72vh; }
.mp-big-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--ink-dim); font-size: 13px; margin: 10px 2px 0; }
@media (max-width: 760px) {
  .lobby section.setup { grid-template-columns: minmax(0, 1fr); }
  .map-preview { max-width: 520px; }
}
@media (prefers-reduced-motion: reduce) { .mp-layer, .mp-frame, .mp-zoom { transition: none; } .mp-layer.mp-wait { animation: none; } }
.setup #name { width: 210px; min-width: 0; }
.setup #map { width: 260px; min-width: 0; }

/* ---------------- масштаб поля ---------------- */
.board-wrap { touch-action: none; user-select: none; -webkit-user-select: none; }
.board-wrap.panning, .board-wrap.panning * { cursor: grabbing !important; }
.zoom-ctl {
  position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; overflow: hidden; z-index: 2;
  background: rgba(15, 29, 33, 0.88); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.zoom-ctl button { width: 34px; height: 32px; border: 0; background: transparent; color: var(--ink); font: 600 18px/1 var(--body); }
.zoom-ctl button + button { border-top: 1px solid var(--line); }
.zoom-ctl button:hover:not(:disabled) { background: rgba(242, 179, 61, 0.15); color: var(--brass); }
.zoom-ctl button:disabled { color: var(--ink-dim); opacity: 0.45; cursor: default; }

/* значок тумана на клетке; переносимый туман пульсирует */
.fog-badge circle { fill: #1d3a44; stroke: #cfe4ea; stroke-width: 1.5; }
.fog-badge path { fill: #e8f3f6; }
.fog-badge.moving circle { stroke: var(--brass); stroke-width: 3; animation: fog-pulse 1.1s ease-in-out infinite alternate; }
@keyframes fog-pulse { from { stroke-opacity: 1; } to { stroke-opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .fog-badge.moving circle { animation: none; } }

/* код приглашения */
.invite-code { font: 600 16px/1.4 ui-monospace, 'SF Mono', Menlo, monospace; letter-spacing: .02em; color: var(--brass); user-select: all; }
.join-field input { width: 340px; font-family: ui-monospace, 'SF Mono', Menlo, monospace; }
.join-inline { margin: 22px 0; }
.join-inline h2 { font-size: 22px; margin-bottom: 8px; }

/* ступени на картах Цири и Теслы */
.card .tier, .deck-row .tier { display: block; margin-top: 2px; padding: 0 3px; border-radius: 3px; }
.card .tier.on { background: rgba(242, 179, 61, 0.32); box-shadow: inset 2px 0 0 #c98a12; }
.card .tier.off { opacity: 0.45; }

/* просмотр завершённой партии */
.replay-bar {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 3; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: center;
  background: rgba(15, 29, 33, 0.92); border: 1px solid var(--brass); border-radius: 12px; padding: 6px 10px; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45); max-width: calc(100% - 20px);
}
.replay-bar button { min-width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 7px; background: var(--table-2); color: var(--ink); font: 600 15px/1 var(--body); }
.replay-bar button:hover:not(:disabled) { border-color: var(--brass); color: var(--brass); }
.replay-bar button:disabled { opacity: 0.35; cursor: default; }
.replay-bar .rp-label { font: 600 14px var(--body); color: var(--ink); padding: 0 8px; white-space: nowrap; }
.replay-bar .rp-range { flex: 1 0 100%; accent-color: var(--brass); margin: 2px 0 0; }
.replay-bar .rp-exit { border-color: transparent; background: transparent; color: var(--ink-dim); margin-left: 6px; }
.replay-info .rp-hint { font-size: 12px; color: var(--ink-dim); }
.log [data-li] { cursor: pointer; border-radius: 4px; }
.log [data-li]:hover { background: rgba(242, 179, 61, 0.12); }
.decision .replay-open { margin-top: 8px; }

/* особые связи поля */
.one-way path { fill: #f07a2e; stroke: #3a1a08; stroke-width: 1.5; }
.high-ground rect { fill: #1d1406; stroke: #f2b33d; stroke-width: 1.5; }
.high-ground path { fill: none; stroke: #f2b33d; stroke-width: 2; }
.high-ground text { fill: #f2b33d; font: 700 12px var(--body); text-anchor: middle; }

/* дальность атаки при наведении на бойца */
.board.ranging .space .space-bg { transition: fill 0.15s; }
.board.ranging.mine .space.in-range .space-bg { fill: #6b5418; stroke: #f2c94c; stroke-width: 3; stroke-dasharray: 6 4; }
.board.ranging.theirs .space.in-range .space-bg { fill: #6a2a24; stroke: #ff7a6f; stroke-width: 3; stroke-dasharray: 6 4; }
.board.ranging .token.reachable { filter: drop-shadow(0 0 4px #ff5a4f) drop-shadow(0 0 8px #ff5a4f); }
.board.ranging.theirs .token.reachable { filter: drop-shadow(0 0 4px #f2c94c) drop-shadow(0 0 8px #f2c94c); }

/* сворачиваемый лог */
.side > .log-head { display: flex; justify-content: space-between; align-items: center; padding-top: 8px; padding-bottom: 0; font-size: 12px; color: var(--ink-dim); text-transform: uppercase; letter-spacing: 0.04em; border-top: 1px solid var(--line); }
.log-head .link-btn { text-transform: none; letter-spacing: 0; }
.log.collapsed { flex: 0 0 auto; min-height: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log.collapsed div { overflow: hidden; text-overflow: ellipsis; }
.card .lck { position: absolute; top: -21px; left: 28px; width: 19px; height: 19px; font-size: 11px; background: #3d2a55; border-radius: 50%; text-align: center; line-height: 19px; }

/* свой выпадающий список полей */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.mp-pick { position: relative; width: 300px; max-width: 100%; }
.mp-list { min-width: 300px; }
.mp-btn {
  display: flex; align-items: baseline; gap: 8px; width: 100%; text-align: left; cursor: pointer;
  background: var(--table); border: 1px solid var(--line); border-radius: 6px; padding: 8px 34px 8px 10px; position: relative;
}
.mp-btn:hover, .mp-btn[aria-expanded="true"] { border-color: var(--ink-dim); }
.mp-cur { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-sub { color: var(--ink-dim); font-size: 12px; white-space: nowrap; margin-left: auto; }
.mp-caret { position: absolute; right: 12px; top: 50%; width: 12px; height: 8px; margin-top: -4px; transition: transform 0.15s;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%239fb3b6' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / 12px 8px; }
.mp-btn[aria-expanded="true"] .mp-caret { transform: rotate(180deg); }
.mp-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none;
  background: #10201f; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
  max-height: min(380px, 60vh); overflow-y: auto; scrollbar-width: thin; scrollbar-color: #0b1517 transparent;
}
.mp-list li { display: flex; align-items: baseline; gap: 8px; padding: 7px 10px; border-radius: 7px; cursor: pointer; outline: none; }
.mp-list li small { margin-left: auto; color: var(--ink-dim); font-size: 12px; white-space: nowrap; }
.mp-list li:hover, .mp-list li:focus { background: rgba(242, 179, 61, 0.14); }
.mp-list li[aria-selected="true"] { color: var(--brass); font-weight: 600; }
.mp-list li[aria-selected="true"]::before { content: '✓'; margin-right: -2px; }
@media (max-width: 640px) { .mp-pick { width: 100%; } }
.spect-badge { font-size: 13px; color: var(--brass); border: 1px solid rgba(242, 179, 61, 0.5); border-radius: 999px; padding: 1px 9px; }
.spect-hand { display: flex; align-items: center; padding: 10px 14px; font-size: 13px; }
