:root {
  --bg: #0b0d17; --bg2: #121528; --card: #171b33; --line: #2a2f55;
  --text: #e6e8f5; --muted: #8b90b8; --accent: #6d7cff; --accent2: #9aa4ff;
  --ok: #3fbf6a; --warn: #f5b041; --bad: #ef5350; --storm: #c04cff;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: radial-gradient(ellipse at top, #161a36 0%, var(--bg) 60%); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12px; }
h3 { margin: 18px 0 8px; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
input { background: var(--bg2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 10px 12px; font: inherit; width: 100%; }
input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.btn { background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 9px 14px; font: inherit; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.danger { border-color: #5a2a36; color: #ffb3b3; }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; }
.btn.on, .seg button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn:disabled { opacity: .45; cursor: default; }
.row { display: flex; gap: 8px; align-items: center; } .wrap { flex-wrap: wrap; }
.screen { min-height: 100%; }
#screen-start, #screen-lobby { display: grid; place-items: center; padding: 24px 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: 0 20px 60px #0008; }
.start-card { width: min(380px, 100%); display: grid; gap: 14px; }
.lobby-card { width: min(720px, 100%); }
.logo { margin: 0; text-align: center; letter-spacing: .22em; font-size: 26px; }
.sub { margin: -6px 0 6px; text-align: center; color: var(--muted); }
.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.seg { display: flex; gap: 6px; } .seg button { flex: 1; padding: 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); font: inherit; cursor: pointer; }
.or { text-align: center; color: var(--muted); font-size: 12px; }
.code-inp { text-transform: uppercase; letter-spacing: .3em; text-align: center; }
.lobby-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; }
.big-code { font-size: 34px; font-weight: 700; letter-spacing: .3em; }
.seats { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.seats li { display: flex; align-items: center; gap: 10px; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.seats .dot { width: 10px; height: 10px; border-radius: 50%; background: #555; flex: none; }
.seats .dot.on { background: var(--ok); }
.seats .grow { flex: 1; }
.faction-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.fac { border-radius: 10px; padding: 12px; cursor: pointer; border: 2px solid transparent; background: var(--bg2); position: relative; min-height: 96px; }
.fac .ic { font-size: 22px; } .fac .nm { font-weight: 700; margin: 4px 0 2px; } .fac .pk { font-size: 12px; color: var(--muted); }
.fac.mine { border-color: #fff; } .fac.taken { opacity: .35; cursor: not-allowed; }
.fac .bar { position: absolute; inset: 0 0 auto 0; height: 4px; border-radius: 10px 10px 0 0; }
.check { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; }
.check input { width: auto; }
#start-tools { margin-top: 16px; justify-content: space-between; }

/* Игра */
#screen-game { display: flex; flex-direction: column; height: 100dvh; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: #0d1021cc; flex-wrap: wrap; }
.brand { font-weight: 800; letter-spacing: .18em; font-size: 14px; }
.tag { background: var(--bg2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; letter-spacing: .1em; font-weight: 600; color: var(--muted); }
.round-info { color: var(--muted); font-size: 13px; }
.players-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.pchip { display: flex; gap: 8px; align-items: center; border: 2px solid var(--line); border-radius: 999px; padding: 3px 10px 3px 4px; font-size: 13px; background: var(--bg2); }
.pchip.actor { box-shadow: 0 0 0 2px #fff4, 0 0 14px var(--c); border-color: var(--c); }
.pchip.out { opacity: .4; }
.pchip .av { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--c); font-size: 12px; }
.pchip .st { color: var(--muted); }
.game-main { flex: 1; display: grid; grid-template-columns: 1fr 360px; min-height: 0; }
.board-wrap { position: relative; min-height: 0; overflow: hidden; touch-action: none; }
#board { width: 100%; height: 100%; display: block; cursor: grab; }
.zoom { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 6px; }
.zoom .btn { width: 38px; height: 38px; padding: 0; background: var(--card); }
.panel { border-left: 1px solid var(--line); background: #0f1226; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.prompt { font-weight: 600; font-size: 15px; padding: 10px 12px; border-radius: 10px; background: var(--bg2); border-left: 4px solid var(--accent); }
.prompt.wait { border-left-color: var(--muted); color: var(--muted); font-weight: 500; }
.actions { display: grid; gap: 8px; }
.tiles, .orders { display: flex; flex-wrap: wrap; gap: 6px; }
.tile-card { border: 1px solid var(--line); background: var(--bg2); border-radius: 10px; padding: 8px 10px; cursor: pointer; font-size: 13px; min-width: 96px; }
.tile-card.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.tile-card .ic { font-size: 18px; }
.otk { border: 1px solid var(--line); background: var(--bg2); color: var(--text); font: inherit; border-radius: 10px; padding: 8px 10px; cursor: pointer; font-size: 13px; display: flex; gap: 6px; align-items: center; }
.otk.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.otk .n { color: var(--muted); }
.otk:disabled { opacity: .4; cursor: default; }
.res-item { border: 1px solid var(--line); border-radius: 10px; background: var(--bg2); padding: 10px; display: grid; gap: 8px; }
.res-item.sel { border-color: var(--accent); }
.res-item .hd { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.unit-list { display: grid; gap: 4px; max-height: 220px; overflow: auto; }
.unit-list label { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.unit-list input { width: auto; }
.stepper { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.stepper .nm { flex: 1; }
.stepper button { width: 30px; height: 30px; padding: 0; }
.box { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.box summary { cursor: pointer; color: var(--muted); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.log { list-style: none; margin: 8px 0 0; padding: 0; font-size: 13px; max-height: 240px; overflow: auto; display: grid; gap: 3px; }
.log li { color: #c8cbe6; } .log li.hl { color: #fff; font-weight: 600; }
#chat-form { margin-top: 8px; }
.rules { font-size: 13px; color: #c8cbe6; } .rules p { margin: 8px 0; }
.combat { background: #1d1430; border: 1px solid #4b2f7a; border-radius: 10px; padding: 10px; font-size: 13px; }
.combat .dice { display: flex; flex-wrap: wrap; gap: 3px; margin: 3px 0; }
.die { width: 20px; height: 20px; border-radius: 4px; display: grid; place-items: center; background: #2b2f4a; font-size: 12px; font-weight: 700; }
.die.hit { background: var(--ok); color: #03170a; }
.banner { position: fixed; inset: 0; display: grid; place-items: center; background: #000a; z-index: 20; }
.banner .card { text-align: center; max-width: 420px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #3a1620; border: 1px solid var(--bad); color: #ffd6d6; padding: 10px 16px; border-radius: 10px; z-index: 30; max-width: calc(100% - 32px); }

/* SVG */
.tile.target { cursor: pointer; }
.tile.focus .tile-ok, .tile.focus .tile-focus { stroke: #e6c77a; }
.area.target .hit { fill: rgba(67,160,71,.10); stroke: #43a047; stroke-width: 2.5; cursor: pointer; }
.area.target .hit:hover { fill: rgba(67,160,71,.28); }
.area .hit:hover { fill: #ffffff10; }
.edge-pick { stroke: #c04cff55; stroke-width: 14; stroke-linecap: round; cursor: pointer; }
.edge-pick:hover { stroke: #c04cff; }
.sec { display: grid; gap: 6px; } .sec-t { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.uchip { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: 13px; background: var(--bg); }
.uchip.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.uchip .btn { padding: 0 6px; margin-left: auto; }
select { background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px; font: inherit; width: 100%; }
.dep { display: grid; gap: 6px; }
.die.attack { background: #b3342f; color: #fff; } .die.shield { background: #2f6bb3; color: #fff; } .die.morale { background: #c9a227; color: #000; }
.tile-card svg { display: block; margin: 0 auto 4px; }
.hex { stroke-width: 2; transition: filter .15s; }
.hex-g.target .hex { stroke: #fff !important; stroke-width: 4; filter: drop-shadow(0 0 8px #9aa4ff); cursor: pointer; }
.hex-g.target { cursor: pointer; }
.hex-g.focus .hex { stroke: #ffd54a !important; stroke-width: 5; }
.ghost { fill: #6d7cff14; stroke: #6d7cff; stroke-dasharray: 6 5; stroke-width: 2; cursor: pointer; }
.ghost:hover { fill: #6d7cff40; }
.svg-t { font-family: system-ui, sans-serif; fill: #e6e8f5; pointer-events: none; }
.storm { stroke: var(--storm); stroke-width: 9; stroke-linecap: round; filter: drop-shadow(0 0 6px var(--storm)); pointer-events: none; }

@media (max-width: 860px) {
  .game-main { grid-template-columns: 1fr; grid-template-rows: 55dvh auto; }
  #screen-game { height: auto; min-height: 100dvh; }
  .panel { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .players-bar { margin-left: 0; }
}

.emb { width: 100%; height: 100%; object-fit: contain; display: block; }
.fac .ic .emb { width: 40px; height: 40px; }
.pchip .av .emb { width: 18px; height: 18px; }
#board { background: radial-gradient(ellipse at 50% 40%, #121a36 0%, #070914 70%); }

/* планшет фракции и карты */
.panel { background-size: 100% auto; background-position: center top; background-repeat: no-repeat; }
.tablet { aspect-ratio: 1.74; width: 100%; border-radius: 10px; border: 1px solid #b8923f88; background-size: 100% auto; background-position: center top;
  background-repeat: no-repeat; cursor: zoom-in; box-shadow: 0 6px 20px #0008; flex: none; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.cards.mini { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
.gcard { position: relative; border-radius: 8px; overflow: hidden; border: 2px solid #3a3f66; background: #0d1020; cursor: pointer; aspect-ratio: 450 / 650;
  transition: transform .12s, border-color .12s; }
.gcard:hover { transform: translateY(-2px); border-color: #b8923f; }
.gcard.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.gcard.off { opacity: .45; }
.gcard img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gname { padding: 8px 6px; font-size: 12px; font-weight: 700; color: #f3e3b0; }
.gicons { position: absolute; left: 4px; bottom: 4px; display: flex; gap: 3px; }
.gi { font-size: 11px; font-weight: 800; padding: 1px 4px; border-radius: 6px; color: #fff; }
.gi.g { background: #b3342fdd; } .gi.s { background: #2f6bb3dd; } .gi.m { background: #c9a227dd; color: #000; }
.gcount { position: absolute; right: 4px; top: 4px; background: #000c; color: #fff; font-size: 11px; font-weight: 800; padding: 1px 5px; border-radius: 6px; }
.gbadge { position: absolute; left: 0; right: 0; top: 0; background: #000b; color: #f3e3b0; font-size: 10px; text-align: center; padding: 2px; }
.combat-head { padding: 8px 10px; border-radius: 8px; background: #3a1620cc; border: 1px solid #7a2e3a; }
.combat-round { display: grid; gap: 4px; padding: 6px; border-radius: 8px; background: #0008; }
.zoom-ov { position: fixed; inset: 0; background: #000d; z-index: 50; display: grid; place-items: center; padding: 16px; cursor: zoom-out; }
.zoom-box { max-width: min(420px, 100%); text-align: center; color: var(--text); }
.zoom-box img { width: 100%; border-radius: 12px; box-shadow: 0 10px 40px #000; }
.zoom-box p { white-space: pre-line; font-size: 14px; }
.zoom-full { max-width: 100%; max-height: 100%; border-radius: 8px; }

/* фигурки */
.fig { pointer-events: none; }
.fig-img { filter: drop-shadow(0 2px 2px rgba(0,0,0,.85)) drop-shadow(0 0 1px rgba(0,0,0,.9)); }
.oicon { display: inline-block; vertical-align: middle; object-fit: contain; }
.ohd { display: inline-flex; align-items: center; gap: 6px; }
.order-tok { pointer-events: none; }

/* значки ресурсов в полосе игроков */
.pchip .st { display: inline-flex; gap: 8px; align-items: center; }
.rstat { display: inline-flex; align-items: center; gap: 2px; color: var(--text); }
.rstat b { font-size: 12px; }
.ricon { width: 18px; height: 18px; object-fit: contain; }
.ricon.sq { border-radius: 3px; }
.pchip .av { width: 26px; height: 26px; overflow: hidden; }
.pchip .av .emb { width: 24px; height: 24px; object-fit: cover; border-radius: 50%; }
/* скорость ботов */
.speed { display: inline-flex; gap: 2px; align-items: center; margin-left: auto; }
.speed .muted { margin-right: 4px; }
.speed button { font-size: 12px; padding: 4px 8px; }
/* бой */
.cgrid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 6px; margin: 6px 0; }
.cside { border: 1px solid var(--c); border-radius: 8px; padding: 6px; background: #0006; display: grid; gap: 3px; align-content: start; }
.cside-h { display: flex; gap: 6px; align-items: center; }
.cside-h .av { width: 22px; height: 22px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--c); }
.cside-h .av .emb { width: 22px; height: 22px; object-fit: cover; }
.cunit { display: flex; gap: 4px; align-items: center; font-size: 12px; }
.cunit .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cunit.dead { opacity: .35; text-decoration: line-through; }
.upic { object-fit: contain; flex: none; }
.upic.sym { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: #000; font-weight: 900; }
.pips { display: inline-flex; gap: 2px; }
.pip { width: 8px; height: 8px; border-radius: 2px; background: #5fd08a; }
.pip.hit { background: #e0662c; }
.pip.dead { background: #333; }
.combat-round.cur { border: 1px solid #e6c77a88; }
.rgrid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 6px; }
.cside, .rhalf { min-width: 0; }
.cside-h b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cunit .muted { flex: none; }
.die { width: 22px; height: 22px; font-size: 13px; }
.rhalf { display: grid; gap: 3px; align-content: start; }
.die { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; font-size: 15px; box-shadow: inset 0 -3px 0 #0005, 0 1px 2px #000; }
.die.attack { background: #b3363f; }
.die.shield { background: #2f5fa8; }
.die.morale { background: #c9a23a; color: #000; }
.die.roll { animation: dieroll .6s ease-out both; }
@keyframes dieroll { 0% { transform: translateY(-14px) rotate(-200deg) scale(.6); opacity: 0; } 70% { transform: translateY(2px) rotate(15deg) scale(1.05); opacity: 1; } 100% { transform: none; } }
.cside { overflow: hidden; }
.cside-h { flex-wrap: wrap; }
.cunit { flex-wrap: wrap; row-gap: 1px; }
.cunit .nm { flex: 1 1 60px; }

.cunit .rt, .stepper .rt { color: #f0a24a; font-size: 11px; font-weight: 700; }
.cunit.routed { opacity: .8; }
.sfac { display: inline-flex; align-items: center; gap: 6px; }
.emb.sm { width: 22px; height: 22px; object-fit: cover; border-radius: 4px; }
.bot-fac { background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; font: inherit; font-size: 13px; }
.fac .ic img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }

/* кубики с оригинальными значками */
.die { width: 28px; height: 28px; border-radius: 6px; background: linear-gradient(145deg, #f4ead2, #cbbd98); box-shadow: inset 0 -3px 0 #0003, 0 1px 3px #000a; padding: 3px; }
.die svg { width: 100%; height: 100%; fill: currentColor; }
.die.attack { color: #9a1d24; background: linear-gradient(145deg, #f4ead2, #cbbd98); }
.die.shield { color: #1f4f96; background: linear-gradient(145deg, #f4ead2, #cbbd98); }
.die.morale { color: #8a6412; background: linear-gradient(145deg, #f4ead2, #cbbd98); }
.fi { display: inline-block; width: 15px; height: 15px; vertical-align: -3px; }
.fi svg { width: 100%; height: 100%; fill: currentColor; }
.fi.attack { color: #ff6b6b; } .fi.shield { color: #6fa8ff; } .fi.morale { color: #f0c24a; }
.icnt { display: inline-flex; align-items: center; gap: 1px; margin-right: 6px; font-weight: 700; }
.icrow { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.gi { display: inline-flex; align-items: center; gap: 1px; }
.gi .fi { color: #fff; width: 12px; height: 12px; }
.gmanual { position: absolute; top: 3px; right: 3px; font-size: 12px; background: #000a; border-radius: 6px; padding: 0 3px; }
.toks { color: #e6c77a; }
.fxnotes { margin: 4px 0 0; padding-left: 16px; font-size: 12px; color: #cfd3ee; }
.fxnotes li.man, .man { color: #f0a24a; }
.opts { display: grid; gap: 6px; margin-top: 6px; }
.opts .btn { text-align: left; }
/* на время боя панель шире, карты крупнее */
@media (min-width: 861px) { body.in-combat .game-main { grid-template-columns: 1fr minmax(480px, 44vw); } }
body.in-combat .cards.hand { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.cprev { display: grid; grid-template-columns: minmax(150px, 220px) 1fr; gap: 10px; background: #0008; border: 1px solid #b8923f66; border-radius: 10px; padding: 8px; margin: 8px 0; }
.cprev img { width: 100%; border-radius: 8px; cursor: zoom-in; }
.cprev h4 { margin: 0 0 4px; font-size: 16px; }
.cprev p { margin: 6px 0; font-size: 13px; line-height: 1.35; }
.cprev-t { display: grid; align-content: start; gap: 4px; }
@media (max-width: 700px) { .cprev { grid-template-columns: 1fr; } }

/* варп-шторм — рваный разрыв: дымка, лента из оригинала, волокна, молнии, якоря на концах */
.warp { pointer-events: auto; }
.warp-haze { fill: #5e1a9c; opacity: .26; filter: blur(6px); animation: warp-breathe 4.2s ease-in-out infinite; }
.warp-glow { fill: #9238c8; opacity: .3; filter: blur(2.5px); animation: warp-live-pulse 2.6s ease-in-out infinite; }
.warp-rim { fill: none; stroke: #f0b8ff; stroke-width: .7; stroke-opacity: .45; stroke-linejoin: round; }
.warp-fiber { fill: none; stroke: #ffd9ff; stroke-width: 1.4; stroke-linecap: round; stroke-dasharray: 46 28 14 30; opacity: .17; filter: blur(.5px); mix-blend-mode: screen; }
.warp-fiber.f0 { animation: warp-flow 3.6s linear infinite; }
.warp-fiber.f1 { animation: warp-flow 5.2s linear infinite reverse; stroke: #ff9bf0; }
.warp-fiber.f2 { animation: warp-flow 4.4s linear infinite; stroke-width: 1; }
.warp-vein { fill: none; stroke: #e9d0f7; stroke-width: 1.1; stroke-linecap: round; opacity: .32; filter: blur(.4px); mix-blend-mode: screen; animation: warp-flicker 3.1s steps(1) infinite; }
@keyframes warp-flicker { 0%, 100% { opacity: .32; } 37% { opacity: .22; } 41% { opacity: .38; } 70% { opacity: .28; } }
@keyframes warp-live-pulse { 0%, 100% { opacity: .32; } 50% { opacity: .56; } }
@keyframes warp-breathe { 0%, 100% { opacity: .2; } 50% { opacity: .34; } }
@keyframes warp-flow { to { stroke-dashoffset: -118; } }
@media (prefers-reduced-motion: reduce) { .warp-glow, .warp-haze, .warp-fiber, .warp-vein { animation: none; } .warp animate { display: none; } }
/* бегущие отряды */
.fig.routed { opacity: .6; }
.fig.routed .fig-img { filter: grayscale(.7) brightness(.85); }
/* размещение приказов: выбирается весь тайл */
body.planning .area .hit:hover { fill: transparent; }

.okt { color: #5fd08a; }
.opts .btn { white-space: normal; line-height: 1.3; }

/* контроль области — полоса цвета игрока */
.ctrl { pointer-events: none; }
/* размещение приказов: слот в центре тайла */
body.planning .area { pointer-events: none; }
body.planning .tile.target { cursor: pointer; }
/* наступление */
.src-can { fill: none; stroke: #43a047; stroke-width: 2; pointer-events: none; }
.src-sel { fill: rgba(230,199,122,.12); stroke: #e6c77a; stroke-width: 3; pointer-events: none; }


.uchip input { margin: 0 4px 0 0; pointer-events: none; }
/* развёртывание */
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 4px 0; }
.chip { border: 1px solid var(--line); background: var(--bg2); color: var(--text); border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.chip.on { border-color: #ffd54a; background: #ffd54a22; }
.chip .minus { color: #ff8a8a; font-weight: 900; padding-left: 4px; }
.deprow { border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; margin: 5px 0; }
.deprow.sel { border-color: #ffd54a; box-shadow: 0 0 0 1px #ffd54a inset; }
.deprow.off { opacity: .5; }
.deph { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.deph .nm { flex: 1; }

.storm-n { fill: #14081f; stroke: #c04cff; stroke-width: 2; pointer-events: none; }
.storm-nt { font-size: 14px; font-weight: 900; fill: #fff; pointer-events: none; }
.chips.col { flex-direction: column; align-items: stretch; }
.chips.col .chip { border-radius: 10px; text-align: left; display: flex; gap: 6px; align-items: center; }
.chip:disabled { opacity: .45; cursor: default; }
.upg { color: #ffd54a; font-size: 12px; font-weight: 700; }
.upgk { border-color: #ffd54a88; }
.scheme { display: grid; grid-template-columns: 70px 1fr; gap: 8px; align-items: start; margin: 6px 0; }
.evopt { display: grid !important; grid-template-columns: 70px 1fr; gap: 8px; align-items: center; }
.evopt img { width: 70px; border-radius: 6px; }
.stale { position: fixed; top: 0; left: 0; right: 0; z-index: 99; background: #b3363f; color: #fff; padding: 10px 14px; font-weight: 700; text-align: center; }

/* цель приказа — как в оригинале: рамка доступного тайла, остальные затемнены */
.tile-ok { fill: transparent; stroke: #43a047; stroke-width: 2.5; pointer-events: none; }
.tile.target:hover .tile-ok { fill: rgba(67,160,71,.20); }
.tile-ok.sel { stroke: #e6c77a; stroke-width: 3.5; fill: rgba(230,199,122,.12); }
body.planning .tile:not(.target) { filter: brightness(.45); }

/* стрела наступления */
.march { pointer-events: none; }
.march-shadow { fill: #000; opacity: .45; transform: translate(1.5px, 2.5px); filter: blur(1.5px); }
.march-edge { fill: none; stroke: #07080f; stroke-width: 3.2; stroke-linejoin: round; opacity: .9; }
.march-body { stroke: #b89a5a; stroke-width: .8; stroke-opacity: .75; stroke-linejoin: round; }
.march-base { stroke: #07080f; stroke-width: 1.4; }
.march-badge { fill: #10121a; stroke: #8a7444; stroke-width: 1; }
.march-n { font-size: 12px; font-weight: 800; fill: #e3d6b0; }
.march.ghost { opacity: .45; }
/* уголки доступного тайла */
.tile-corners { fill: none; stroke: #5fd08a; stroke-width: 3.5; stroke-linecap: square; pointer-events: none; }
.tile-corners.sel { stroke: #e6c77a; }
.tile-ok { stroke-opacity: .55; stroke-width: 1.5; }
.tile-ok.sel { stroke-opacity: 1; }

/* развёртывание: запланированные покупки на поле */
.fig.planned { opacity: .55; }
.fig.planned .fig-img { filter: grayscale(.3); }
/* подсветка области при наведении на строку панели */
.area.hl .hit { fill: rgba(230,199,122,.22); stroke: #e6c77a; stroke-width: 3.5; }
.area.hl.hl2 .hit { fill: rgba(230,199,122,.10); stroke-dasharray: 6 4; }
.obj-tok { filter: drop-shadow(0 1px 2px rgba(0,0,0,.8)); }
.uchip.off { opacity: .45; }
/* сдвиг варп-шторма: возможные места */
.storm-dest { cursor: pointer; }
.storm-dest-line { stroke: #c070ff; stroke-width: 6; stroke-linecap: round; stroke-dasharray: 10 8; opacity: .55; animation: storm-dest-pulse 1.6s ease-in-out infinite; }
.storm-dest-path { stroke: #c070ff; stroke-width: 1.5; stroke-dasharray: 3 5; opacity: .35; pointer-events: none; }
.storm-dest-hit { stroke: transparent; stroke-width: 22; }
.storm-dest:hover .storm-dest-line, .storm-dest.hl .storm-dest-line { opacity: 1; stroke-width: 8; stroke: #e0a0ff; }
.storm-dest.hl .storm-dest-path, .storm-dest:hover .storm-dest-path { opacity: .9; }
.warp.hl { filter: brightness(1.5); }
@keyframes storm-dest-pulse { 0%, 100% { opacity: .35; } 50% { opacity: .7; } }

/* кубики боя — как значки на боевых картах: белый символ на тёмной плашке */
.die { --die-bg: #1e2023; background: linear-gradient(160deg, #3a3d41, #1b1d20) !important; color: #f1ede2 !important; border: 1px solid #5b5e63; border-radius: 5px; padding: 3px; box-shadow: inset 0 1px 0 #ffffff1a, 0 1px 3px #000c; }
.die svg { fill: currentColor; }
.die.attack, .die.shield, .die.morale { color: #f1ede2 !important; }
/* значки внутри текста карт */
.rtext { line-height: 1.5; }
.ri { display: inline-block; width: 16px; height: 16px; vertical-align: -3px; margin: 0 1px; }
.ri svg { width: 100%; height: 100%; fill: currentColor; }
.ri.rdie { --die-bg: #1e2023; background: #26282c; color: #f1ede2; border-radius: 3px; padding: 1px; box-sizing: border-box; border: 1px solid #6a6d72; }
.ri.rtok { --die-bg: #111; background: #111; color: #f1ede2; border-radius: 50%; padding: 2px; box-sizing: border-box; }
.ri.rcube { color: #d9d2bd; }
.ri.rres { width: 18px; height: 18px; vertical-align: -4px; }
.ctext p { margin: 4px 0; font-size: 13px; }
.ctext p + p { border-top: 1px dashed #ffffff22; padding-top: 4px; font-style: italic; }

/* раунд боя — компактно */
.combat-round { gap: 6px; padding: 6px 8px; }
.rnum { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #9aa0c0; }
.rhalf { border-left: 3px solid var(--c, #666); padding-left: 6px; }
.rh-top { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 6px; align-items: start; }
.rh-top .cards.mini { display: block; }
.rh-top .cards.mini .gcard { width: 54px; min-height: 0; }
.rh-name { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rh-sum .icrow { font-size: 13px; }
.rh-dmg { font-size: 12px; }
.fxnotes { list-style: none; margin: 4px 0 0; padding: 0; font-size: 12px; color: #cfd3ee; display: grid; gap: 2px; }
.fxnotes li { padding: 1px 0 1px 8px; border-left: 2px solid #ffffff1a; line-height: 1.45; }
.fxnotes li.man { color: #f0a24a; border-left-color: #f0a24a88; }
.fxnotes.common { border-top: 1px dashed #ffffff22; padding-top: 4px; }
.icnt .ri { margin-right: 2px; }
.gi { background: transparent !important; color: #f1ede2; }
#prompt .rtext .ri { width: 18px; height: 18px; }

/* раунд боя — рассказ: кто что сыграл и что вышло */
.combat-round { display: grid; gap: 8px; padding: 8px 10px; }
.combat-round .rnum { font-size: 12px; }
.rs-side { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 10px; align-items: start; border-left: 3px solid var(--c, #666); padding-left: 8px; }
.rs-card .gcard { width: 74px; min-height: 0; }
.rs-nocard { width: 74px; height: 100px; border: 1px dashed #ffffff33; border-radius: 6px; display: grid; place-items: center; font-size: 11px; color: #8a8fb0; }
.rs-title { font-size: 14px; margin-bottom: 2px; }
.rs-body .fxnotes { font-size: 13px; }
.rs-sum { font-size: 13px; margin-top: 4px; }
.rs-loss { font-size: 13px; color: #e6c77a; border-top: 1px solid #ffffff1a; padding-top: 6px; }
.past-rounds summary { font-size: 12px; }
.past-rounds .combat-round { background: transparent; }
.cunit .rt { font-size: 10px; }

/* бой помещается в экран без прокрутки: планшет фракции скрыт, раунд — в две колонки (атакующий | защитник),
   рука — рядом с крупной выбранной картой, кнопка действия всегда видна внизу панели */
body.in-combat #tablet { display: none; }
.combat-round { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 12px; }
.combat-round > .rnum, .combat-round > .fxnotes.common, .combat-round > .rs-loss { grid-column: 1 / -1; }
.rs-side { grid-template-columns: 60px minmax(0, 1fr); gap: 8px; }
.rs-card .gcard, .rs-nocard { width: 60px; }
.rs-nocard { height: 86px; }
body.in-combat .cprev { grid-template-columns: minmax(150px, 210px) minmax(0, 1fr); margin: 4px 0; }
body.in-combat .cprev .cards.hand { grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 6px; margin-top: 4px; }
body.in-combat .cprev .cards.hand .gmanual { font-size: 11px; }
body.in-combat #actions > .btn.primary.wide { position: sticky; bottom: 0; z-index: 2; box-shadow: 0 -10px 18px #0f1226; }
@media (max-width: 700px) {
  .combat-round { grid-template-columns: minmax(0, 1fr); }
  body.in-combat .cprev { grid-template-columns: minmax(0, 1fr); }
}
/* урон распределяется прямо в строках своих отрядов; полоса подтверждения закреплена внизу панели */
.ualloc { display: inline-flex; align-items: center; gap: 4px; margin-left: 2px; }
.ualloc .btn { padding: 0 7px; min-width: 24px; height: 22px; line-height: 20px; font-size: 14px; }
.ualloc b { min-width: 12px; text-align: center; color: #f0a24a; }
body.in-combat #actions > .dmgbar { position: sticky; bottom: 0; z-index: 2; background: #0f1226; box-shadow: 0 -10px 18px #0f1226; margin: 0; }

/* значки в тексте: SVG — блок по центру своей рамки (раньше стоял на базовой линии шрифта и на Mac съезжал вниз-вправо) */
span.ri { display: inline-flex; align-items: center; justify-content: center; line-height: 0; overflow: hidden;
  vertical-align: middle; position: relative; top: -0.1em; }
/* середина значка — на середине заглавных букв и цифр: middle считается по метрикам шрифта и не зависит от того,
   как браузер вычисляет базовую линию значка (Safari иначе, чем Chrome — значки сидели ниже текста) */
span.ri svg { display: block; flex: none; width: 100%; height: 100%; }
/* увеличенная картинка (планшет фракции) целиком помещается в окно и стоит по центру */
.zoom-full { width: auto; height: auto; max-width: calc(100vw - 32px); max-height: calc(100vh - 32px); object-fit: contain; }
/* карты событий: картинку можно рассмотреть (лупа), подпись — выбрать */
.evopt { grid-template-columns: 92px 1fr; }
.evart { position: relative; display: block; cursor: zoom-in; line-height: 0; }
.evart img { width: 92px; border-radius: 6px; }
.evzoom { position: absolute; right: 3px; bottom: 3px; background: #000b; border-radius: 6px; padding: 2px 4px; font-size: 12px; line-height: 1.2; }
.evart:hover img { outline: 2px solid #e6c77a; }
.evpick { white-space: nowrap; }
/* потери за раунд — под колонкой своей стороны */
.rs-side .rs-loss { margin-top: 5px; padding-top: 4px; border-top: 1px dashed #ffffff22; font-size: 13px; color: #e6c77a; }
.rs-loss b.dead { color: #ff8a80; } .rs-loss b.rout { color: #f0a24a; }
.rs-loss.none { color: #8a8fb0; }
/* выбор боевой карты: выбранная карта крупнее (по высоте окна), кнопка «Сыграть» компактнее */
body.in-combat .cprev { grid-template-columns: minmax(170px, 280px) minmax(0, 1fr); }
body.in-combat .cprev > img { width: auto; max-width: 100%; max-height: max(300px, calc(100vh - 490px)); justify-self: start; }
body.in-combat .cprev .btn.primary.wide { width: auto; justify-self: start; padding: 8px 16px; font-size: 14px; }
/* временный жетон (на один раунд) — круг с видимой обводкой, как на картах; кубик «[?]» — контур куба, как на картах */
.ri.rtok { background: #26282c; border: 1px solid #8d9096; }
.ri.rcube svg { fill: none; }
.udice .rtext { display: inline-flex; align-items: center; gap: 2px; }
/* заголовок стороны боя — всегда две строки (имя, под ним роль): кубики обоих игроков на одном уровне */
.cside-h { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 6px; align-items: center; flex-wrap: nowrap; }
.cside-h .av { grid-row: 1 / span 2; }
.cside-h b, .cside-h .muted { grid-column: 2; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cside-h .muted { line-height: 1.1; }
/* выбранная боевая карта ещё крупнее: до 330 px в ширину, по высоте окна */
body.in-combat .cprev { grid-template-columns: minmax(180px, 330px) minmax(0, 1fr); }
body.in-combat .cprev > img { max-height: max(330px, calc(100vh - 470px)); }
