:root { --vh: 1vh; }
/* A tablet's or phone's browser counts 100vh as its height without its own
   bars: everything sized by the height uses the visible height (dvh). */
@supports (height: 1dvh) { :root { --vh: 1dvh; } }
:root {
  color-scheme: dark;
  --bg: #16274a;
  --bg-deep: #101d3a;
  --panel: #13234399;
  --line: #8fb2ee55;
  --line-soft: #8fb2ee26;
  --line-strong: #a9c6ff;
  --text: #e3ebff;
  --muted: #8ea3cc;
  --dim: #5f7299;
  --me: #49d6a6;
  --opp: #ff6f86;
  --accent: #5b8cff;
  --gold: #ffd27a;
  --cw: clamp(40px, calc(6.6 * var(--vh)), 104px);
  --ch: calc(var(--cw) * 1.396);
  --side: clamp(290px, 22vw, 410px);
  --track: clamp(44px, 3.6vw, 64px);
  --label: "Barlow Condensed", "Arial Narrow", Inter, sans-serif;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-weight: 300;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
@media (min-width: 1101px) { html { overflow: clip; } }
body {
  margin: 0;
  overflow: clip;
  background:
    linear-gradient(#ffffff08 1px, transparent 1px) 0 0 / 120px 120px,
    linear-gradient(90deg, #ffffff08 1px, transparent 1px) 0 0 / 120px 120px,
    linear-gradient(#ffffff04 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, #ffffff04 1px, transparent 1px) 0 0 / 24px 24px,
    radial-gradient(ellipse at 50% 40%, #1d3361 0, var(--bg) 55%, var(--bg-deep) 100%);
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: #a8c2f5; text-decoration: none; }
a:hover { color: white; }
[hidden] { display: none !important; }
.hidden { display: none !important; }

/* Thin outline with corner brackets, the Rift Atlas panel look. */
.frame {
  --b: var(--line-strong);
  border: 1px solid var(--line);
  background:
    linear-gradient(var(--b), var(--b)) left top / 12px 1px no-repeat,
    linear-gradient(var(--b), var(--b)) left top / 1px 12px no-repeat,
    linear-gradient(var(--b), var(--b)) right top / 12px 1px no-repeat,
    linear-gradient(var(--b), var(--b)) right top / 1px 12px no-repeat,
    linear-gradient(var(--b), var(--b)) left bottom / 12px 1px no-repeat,
    linear-gradient(var(--b), var(--b)) left bottom / 1px 12px no-repeat,
    linear-gradient(var(--b), var(--b)) right bottom / 12px 1px no-repeat,
    linear-gradient(var(--b), var(--b)) right bottom / 1px 12px no-repeat;
}
.side-label, .zone-label, .eyebrow, .pile-label {
  font-family: var(--label);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}
.side-label b, .zone-label b { color: var(--text); font-weight: 600; }

/* ---------------------------------------------------------------- layout */
.app { height: calc(100 * var(--vh)); overflow: clip; display: grid; grid-template-columns: minmax(0, 1fr) var(--side); }
.table {
  position: relative;
  min-width: 0;
  height: calc(100 * var(--vh));
  padding: 0 8px;
  display: grid;
  grid-template-columns: var(--track) minmax(0, 1fr) var(--track);
  grid-template-rows: calc(var(--ch) * .58) calc(var(--ch) + 30px) minmax(0, 1fr) calc(var(--ch) + 30px) calc(var(--ch) * 1.24);
  gap: 6px 8px;
  overflow: clip;
}
.row { grid-column: 2; min-width: 0; display: flex; gap: 10px; align-items: stretch; }
.opp-top { grid-row: 1; align-items: flex-start; }
.opp-main { grid-row: 2; }
.fields { grid-column: 2; grid-row: 3; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.me-main { grid-row: 4; }
.me-bottom { grid-row: 5; align-items: flex-end; }
.track-opp { grid-column: 3; grid-row: 1 / 4; }
.track-me { grid-column: 1; grid-row: 3 / 6; }
.table-empty { position: absolute; inset: 0; display: grid; place-content: center; color: var(--muted); }

/* ------------------------------------------------------------------ cards */
.card {
  position: relative;
  flex: none;
  width: var(--cw);
  height: calc(var(--cw) * 1.396);
  border-radius: calc(var(--cw) * .07);
  background: #0c152b;
  box-shadow: 0 2px 6px #0008, 0 0 0 1px #000a;
  overflow: visible;
  outline: none;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s;
}
.card > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; pointer-events: none; user-select: none; }
.card .face {
  position: absolute; inset: 0; padding: 4px; overflow: hidden; border-radius: inherit;
  display: flex; flex-direction: column; justify-content: center; gap: 2px; text-align: center;
  background: linear-gradient(160deg, #2b3f6c, #142343); border: 1px solid #6f8fd0;
  font-size: max(8px, calc(var(--cw) * .13)); line-height: 1.15;
}
.face strong { font-weight: 600; overflow-wrap: anywhere; }
.face small { color: var(--muted); font-family: var(--label); letter-spacing: .1em; text-transform: uppercase; font-size: .85em; }
.face .f-cost { position: absolute; top: 3px; left: 4px; font-family: var(--label); font-weight: 700; color: var(--gold); }
.face .f-might { position: absolute; bottom: 3px; right: 5px; font-family: var(--label); font-weight: 700; }
.face.k-spell { background: linear-gradient(160deg, #503a7a, #21183e); border-color: #a68ae0; }
.face.k-gear { background: linear-gradient(160deg, #6b5a2b, #2c2410); border-color: #d7b665; }
.face.k-legend { background: linear-gradient(160deg, #7a3946, #2e1219); border-color: #e48b9a; }
.face.k-battlefield { background: linear-gradient(160deg, #2c5a54, #0f2522); border-color: #6fc7b5; }
.face.k-rune { background: linear-gradient(160deg, #4c5f87, #1a2440); }
.card[data-inst], .pile-trash { cursor: pointer; }
.card:focus-visible { box-shadow: 0 0 0 2px var(--line-strong), 0 4px 14px #000a; }
.card.can-act { box-shadow: 0 0 0 2px var(--me), 0 0 14px #49d6a688; }
.card.pick { box-shadow: 0 0 0 2px var(--gold), 0 0 16px #ffd27aaa; animation: pulse 1.4s ease-in-out infinite; }
.card.selected { box-shadow: 0 0 0 3px #7fb0ff, 0 0 18px #7fb0ffcc; }
.card.targeted { box-shadow: 0 0 0 2px var(--opp), 0 0 18px #ff6f86aa; }
.card.ref-hl { box-shadow: 0 0 0 3px #7fd1ff, 0 0 20px #7fd1ffbb; }
.card.can-act:hover, .card.pick:hover { transform: translateY(-3px); }
@keyframes pulse { 50% { box-shadow: 0 0 0 2px var(--gold), 0 0 4px #ffd27a55; } }
.card.mini { --cw: clamp(30px, calc(4.4 * var(--vh)), 64px); }
.card-label {
  position: absolute; left: 50%; bottom: 8%; transform: translateX(-50%); z-index: 2;
  padding: 1px 5px; border: 1px solid #a9c6ffaa; border-radius: 3px; background: #0e1c3ae6;
  font-family: var(--label); font-size: 10px; font-weight: 600; letter-spacing: .12em; white-space: nowrap; color: #cfe0ff;
}
.badge {
  position: absolute; z-index: 3; min-width: 20px; height: 20px; padding: 0 5px;
  display: grid; place-content: center; border-radius: 10px;
  font-family: var(--label); font-weight: 700; font-size: 14px; line-height: 1;
  border: 1px solid #000; box-shadow: 0 1px 3px #000a;
}
.badge.might { right: -6px; bottom: -6px; background: #e9eefc; color: #13213f; }
.badge.might.up { background: var(--me); }
.badge.might.down { background: #ffb36b; }
.badge.damage { right: -6px; top: -6px; background: #e0344f; color: white; }
.badge.buff { left: -6px; bottom: -6px; background: #3e9a6f; color: white; }
.badge.cost { left: -6px; top: -6px; width: 22px; height: 22px; border-radius: 50%; background: #f4f6ff; color: #13213f; }
.pips { position: absolute; left: -5px; top: 18px; z-index: 3; display: grid; gap: 2px; }
.pip { min-width: 16px; height: 16px; padding: 0 3px; display: inline-grid; place-content: center; border-radius: 8px; border: 1px solid #000; font-family: var(--label); font-weight: 700; font-size: 11px; color: #0d1426; background: #c3cde4; }
.pip.d-fury { background: #ff6b5b; } .pip.d-calm { background: #6fd39b; } .pip.d-mind { background: #6aaeff; }
.pip.d-body { background: #ffa54f; } .pip.d-chaos { background: #b98aff; } .pip.d-order { background: #ffd95c; }
.pip.any { background: linear-gradient(135deg, #ff6b5b, #ffd95c, #6aaeff, #b98aff); }
.tags {
  position: absolute; left: 50%; top: -9px; transform: translateX(-50%); z-index: 4; pointer-events: none;
  padding: 0 5px; border-radius: 3px; background: #0d1a35f0; border: 1px solid var(--line);
  font-family: var(--label); font-size: 10px; letter-spacing: .1em; white-space: nowrap; color: var(--gold);
}
.card.stunned > img { filter: saturate(.3) brightness(.8); }
/* Empowered (owner, 18/11: "on voit mal si une carte est empower"): a radiant
   ring that breathes, and the tag above the card. */
.card.empowered::after {
  content: ""; position: absolute; inset: -3px; z-index: 2; border-radius: calc(var(--cw) * .09); pointer-events: none;
  box-shadow: 0 0 0 2px #bdf3ff, 0 0 calc(var(--cw) * .18) #5fd3ff, inset 0 0 calc(var(--cw) * .12) #5fd3ff88;
  animation: empowered-glow 2.2s ease-in-out infinite;
}
@keyframes empowered-glow { 50% { box-shadow: 0 0 0 2px #e6fbff, 0 0 calc(var(--cw) * .3) #8fe3ff, inset 0 0 calc(var(--cw) * .18) #8fe3ffaa; } }
@media (prefers-reduced-motion: reduce) { .card.empowered::after { animation: none; } }
.empowered-tag { color: #bdf3ff; text-shadow: 0 0 6px #5fd3ff; }
/* A legend's tag on the side away from its zone label (below the card on your
   side, above it on the bot's, whose label sits below). */
.ident .tags { top: auto; bottom: -9px; }
.opp-main .ident .tags { top: -9px; bottom: auto; }

/* Card back. */
.card.back { background: linear-gradient(145deg, #1b6f73, #0f4049); border: 1px solid #5ec2bd; }
.back-art { position: absolute; inset: 5%; border: 1px solid #8fe0d966; border-radius: 4px; display: grid; place-content: center; background: radial-gradient(circle, #8fe0d922 0, transparent 60%), repeating-linear-gradient(45deg, #ffffff07 0 6px, transparent 6px 12px); }
.back-art span { font-family: var(--label); font-weight: 700; font-size: max(8px, calc(var(--cw) * .15)); line-height: 1; letter-spacing: .08em; text-align: center; color: #bff2ec; transform: rotate(-90deg); }
.empty-slot { display: grid; place-content: center; background: transparent; border: 1px dashed var(--line); box-shadow: none; color: var(--dim); font-size: 10px; text-align: center; }
.empty-slot span { padding: 2px; font-size: 9px; line-height: 1.2; }

/* Slots: an exhausted card is turned 90°. */
.slot { position: relative; flex: none; display: grid; place-items: center; width: var(--cw); height: calc(var(--cw) * 1.396); transition: width .2s; }
.slot.tapped { width: calc(var(--cw) * 1.396); }
.slot.tapped > .card { transform: rotate(90deg); filter: brightness(.72) saturate(.75); }
.slot.tapped > .card.can-act:hover { transform: rotate(90deg) scale(1.04); }
.slot.geared { margin-top: 10px; }
.attached { position: absolute; z-index: 0; top: calc(-12px - var(--i) * 10px); left: calc(50% - var(--cw) * .2 + var(--i) * 6px); }
.attached .card { --cw: clamp(28px, calc(4.2 * var(--vh)), 60px); }
/* An attached gear that is the decision's target comes above its unit, whose card
   otherwise covers all of it but a sliver. */
.slot > .attached:has(> .card.pick) { z-index: 2; }
.slot > .card:not(.mini) { z-index: 1; }
.chip {
  position: absolute; z-index: 5; left: calc(100% + 6px); top: 50%; transform: translateY(-50%);
  padding: 6px 10px; border: 1px solid #8ae9c3; border-radius: 3px; background: #145c48; color: #eafff6;
  font-size: 12px; font-weight: 500; white-space: nowrap; box-shadow: 0 4px 16px #000a;
}
.chip:hover { background: #1b7a5f; }
/* A unit's prompt sits on top of its own card, not beside it, where it read as
   the neighbour's when units stand in a row. */
.slot > .chip { left: 50%; top: 4px; bottom: auto; transform: translateX(-50%); padding: 4px 6px; font-size: 11px; white-space: normal; text-align: center; width: max-content; max-width: calc(var(--cw) + 8px); }
.chips { position: absolute; z-index: 6; left: 50%; bottom: 10px; transform: translateX(-50%); display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 95%; }
.chips .chip { position: static; transform: none; }
.chip.go { border-color: #a9c6ff; background: #2a4f9e; }

/* ------------------------------------------------------------------ rows */
.piles { flex: none; display: flex; gap: 10px; align-items: flex-end; }
.piles.right { margin-left: auto; }
.pile { position: relative; display: grid; justify-items: center; gap: 2px; }
.pile-label { font-size: 10px; }
.step-chosen { margin: 4px 0 0; font-size: 12px; line-height: 1.5; color: var(--text); }
/* The target picker (owner, 18/11: Singularity on two units): one tile per target, tapped on and off. */
.step-ask { margin: 0; display: grid; gap: 2px; }
.step-ask strong { font-weight: 600; font-size: 13px; }
.step-ask small { color: var(--muted); font-size: 11px; }
.step-targets { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.step-target {
  position: relative; display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 5px 8px 5px 5px;
  border: 1px solid var(--line); border-radius: 4px; background: #0a1429; text-align: left; color: var(--text);
}
.step-target .thumb { flex: none; width: 32px; height: 44px; }
.step-target > span:not(.thumb) { min-width: 0; display: grid; gap: 1px; }
.step-target strong { font-weight: 500; font-size: 12px; line-height: 1.25; overflow-wrap: anywhere; }
.step-target small { color: var(--muted); font-size: 10.5px; line-height: 1.25; }
.step-target:hover:not(:disabled) { border-color: #8ae9c3; }
.step-target.chosen { border-color: #49d6a6; background: #49d6a622; box-shadow: inset 0 0 0 1px #49d6a6; }
.step-target.chosen::after { content: "✓"; position: absolute; top: 3px; right: 6px; font-weight: 700; font-size: 13px; color: #49d6a6; }
.step-target:disabled { opacity: .35; cursor: default; }
.step-rank { position: absolute; left: 2px; top: 2px; min-width: 16px; padding: 0 3px; border-radius: 8px; background: #49d6a6; color: #04241a; font-size: 11px; text-align: center; }
/* The picker's bottom, always in view: the targets chosen, the button that plays them, other payments. */
.popover .pop-body { flex: 1 1 auto; min-height: 0; }
.step-foot { flex: none; display: grid; gap: 6px; padding: 8px 10px 10px; border-top: 1px solid var(--line-strong); background: #0c1832; border-radius: 0 0 4px 4px; }
.step-picks { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.step-picks .side-label { margin-right: 2px; }
.step-none { color: var(--muted); font-size: 12px; }
.step-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 2px 6px 2px 8px; border: 1px solid #49d6a6; border-radius: 13px; background: #49d6a61f; color: var(--text); font-size: 12px; }
.step-chip span { color: #8ae9c3; font-size: 11px; }
.step-chip:hover span { color: white; }
.step-play {
  display: grid; justify-items: center; gap: 1px; min-height: 46px; padding: 6px 10px; border: 1px solid #8fb2ff; border-radius: 4px;
  background: linear-gradient(180deg, #4f7fe8, #2f5cc4); color: white; text-align: center;
}
.step-play strong { font-weight: 600; font-size: 15px; }
.step-play small { font-size: 11px; opacity: .85; }
.step-play:hover:not(:disabled) { background: linear-gradient(180deg, #6290f5, #3d6bd4); }
.step-play:disabled { background: #ffffff0a; border-color: var(--line); color: var(--muted); cursor: default; }
.step-alts { display: grid; gap: 4px; max-height: calc(16 * var(--vh)); overflow: auto; }
.pop-body .step-every { justify-self: start; font-size: 11px; }
.pile-banished { font-size: 10px; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
.opp-main .pile .pile-banished { order: 3; }
.pile .count {
  position: absolute; right: -8px; top: 12px; z-index: 3; min-width: 28px; padding: 2px 5px;
  border: 1px solid #a9c6ff88; border-radius: 4px; background: #0e1a33; text-align: center;
  font-family: var(--label); font-weight: 700; font-size: 17px; color: white;
}
.pile-trash.can-act .card { box-shadow: 0 0 0 2px var(--me), 0 0 14px #49d6a688; }
.opp-main .pile .pile-label { order: 2; }
.opp-main .piles { align-items: flex-start; }
.opp-hand { flex: 1; min-width: 0; display: flex; justify-content: center; align-items: flex-start; }
.opp-hand .card { margin: 0 calc(var(--cw) * -.2); transform: translateY(calc(var(--cw) * 1.396 * -.42)); }
.plate {
  flex: none; min-width: 150px; max-width: 220px; align-self: center; padding: 8px 12px;
  display: grid; gap: 2px; border: 1px solid var(--line); border-radius: 3px; background: #0f1d3acc;
}
.plate .who { font-family: var(--label); font-size: 11px; letter-spacing: .16em; color: var(--muted); }
.plate strong { font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plate .stats { font-size: 12px; color: var(--muted); }
.plate .stats b { color: white; font-family: var(--label); font-size: 16px; }
.plate.mine { border-left: 3px solid var(--me); }
.plate.theirs { border-left: 3px solid var(--opp); }
.plate.acting { box-shadow: 0 0 0 1px var(--line-strong), 0 0 18px #5b8cff55; }
.opp-top .plate { display: flex; align-items: baseline; gap: 10px; max-width: none; margin-top: 6px; padding: 6px 12px; }
.plate.acting .who::after { content: " · À JOUER"; color: var(--gold); }
:root[lang="en"] .plate.acting .who::after { content: " · TO ACT"; }

.idents { flex: none; display: flex; gap: 8px; align-items: flex-end; }
.ident { display: grid; justify-items: center; gap: 3px; }
.ident .zone-label { font-size: 10px; }
.opp-main .ident .zone-label { order: 2; }
.lane { position: relative; min-width: 0; padding: 4px 8px; display: flex; flex-direction: column; gap: 3px; }
.lane.base { flex: 1.3; }
.lane.runes { flex: 1; }
.opp-main .lane { flex-direction: column-reverse; }
.lane .zone-label { font-size: 10px; }
.lane-cards { flex: 1; min-height: 0; display: flex; align-items: center; gap: 8px; overflow-x: auto; overflow-y: visible; padding: 10px 6px; scrollbar-width: thin; }
.runes .lane-cards { gap: 0; padding-left: 10px; }
.rune-slot { --cw: clamp(32px, calc(5.2 * var(--vh)), 84px); margin-left: calc(var(--cw) * -.32); }
.rune-slot.tapped > .card { filter: brightness(.5) saturate(.5); }
.card.rune { cursor: default; }
.card.rune.usable { cursor: pointer; }
.card.rune.usable:hover { box-shadow: 0 0 0 2px var(--me); transform: translateY(-3px); }
.lane-empty { color: var(--dim); font-size: 12px; }
.lane.drop, .field.drop { --b: #a9c6ff; border-color: #7fb0ff; box-shadow: inset 0 0 40px #5b8cff33; }

.pool { display: grid; gap: 1px; padding: 0 0 6px; font-size: 13px; }
.pool > div { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.pool b { min-width: 14px; font-family: var(--label); font-size: 16px; color: white; }
.pool .zone-label { font-size: 10px; }

.hand { flex: 1; min-width: 0; height: 100%; display: flex; justify-content: center; align-items: flex-end; padding: 0 20px; }
.hand-slot { position: relative; flex: none; margin: 0 var(--hand-gap, calc(var(--cw) * -.12)); transform: translateY(calc(var(--a) * var(--a) * 2px + 6%)) rotate(calc(var(--o) * 2.6deg)); transform-origin: 50% 120%; transition: transform .15s; }
.hand-slot:hover, .hand-slot:focus-within { z-index: 10; transform: translateY(-14%) scale(1.12); }
.hand-card { --cw: clamp(48px, calc(8.8 * var(--vh)), 128px); }
.hand-card.mull-pick { box-shadow: 0 0 0 1px #a9c6ff88; }
.hand-card.mull-out { filter: grayscale(.8) brightness(.6); box-shadow: 0 0 0 3px var(--opp); }
/* Over a fanned hand the chips stay upright and as wide as their card, so that
   neighbours' chips do not cover each other. */
/* A hand card's own decision (discard it...) is written at the top of the card, which
   stays in view while the hand hangs below the window's edge. */
.hand-slot.decide .card-label { top: 10%; bottom: auto; max-width: 92%; white-space: normal; text-align: center; line-height: 1.25;
  border-color: #8ae9c3; background: #145c48f2; color: #eafff6; letter-spacing: .06em; }
.hand-slot .chip { left: 50%; top: -12px; transform: translate(-50%, -100%) rotate(calc(var(--o) * -2.6deg)); padding: 4px 6px; font-size: 11px; white-space: normal; text-align: center; width: max-content; max-width: calc(var(--cw) + 12px); }

/* ------------------------------------------------------------ battlefields */
.field { --cw: clamp(44px, calc(9.2 * var(--vh)), 140px); position: relative; min-height: 0; padding: 6px; display: grid; grid-template-rows: 1fr auto 1fr; gap: 4px; background-color: #ffffff04; }
.field.ctrl-me { --b: var(--me); border-color: #49d6a666; }
.field.ctrl-opp { --b: var(--opp); border-color: #ff6f8666; }
.field.contested { box-shadow: inset 0 0 50px #ffd27a22, 0 0 0 1px #ffd27a77; }
.field-side { min-height: 0; display: flex; flex-wrap: wrap; justify-content: center; align-content: safe center; gap: 10px 14px; padding: 8px 4px; overflow: auto; scrollbar-width: thin; }
.field-side.crowded { --cw: clamp(36px, calc(6.4 * var(--vh)), 100px); gap: 8px 10px; }
.field-mid { position: relative; display: flex; align-items: center; justify-content: center; gap: 12px; }
.card.bf-card { width: calc(var(--cw) * 1.9); height: calc(var(--cw) * 1.36); }
.field-info { display: grid; gap: 3px; max-width: 42%; font-size: 12px; color: var(--muted); }
.field-info strong { color: var(--text); font-weight: 500; font-size: 14px; }
.might-sum { font-variant-numeric: tabular-nums; }
.might-sum b { font-size: 14px; font-weight: 600; }
.might-sum b.me { color: var(--me); } .might-sum b.opp { color: var(--opp); }
.flag { justify-self: start; padding: 1px 6px; border-radius: 3px; font-family: var(--label); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.flag.me { background: #49d6a633; color: var(--me); }
.flag.opp { background: #ff6f8633; color: var(--opp); }
.flag.fight { background: #ffd27a33; color: var(--gold); animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: .55; } }
.field-mid .chip { left: auto; right: 0; }

/* ------------------------------------------------------------ score tracks */
.track { position: relative; min-height: 0; margin: 10px 0; }
.track svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.track polyline { fill: none; stroke: #8fb2ee44; stroke-width: 2; }
.track .pt {
  position: absolute; transform: translate(-50%, -50%);
  width: clamp(22px, calc(3.4 * var(--vh)), 36px); height: clamp(22px, calc(3.4 * var(--vh)), 36px);
  display: grid; place-content: center; border-radius: 50%;
  border: 1px solid #8fb2ee55; background: #182c55; color: #9db3dd;
  font-family: var(--label); font-weight: 700; font-size: clamp(13px, calc(1.9 * var(--vh)), 20px);
}
.track .pt.past { background: #20396c; color: #cfe0ff; }
.track-me .pt.now { background: #0f3b33; border: 2px solid var(--me); color: white; box-shadow: 0 0 0 4px #49d6a633, 0 0 16px #49d6a688; }
.track-opp .pt.now { background: #45142a; border: 2px solid var(--opp); color: white; box-shadow: 0 0 0 4px #ff6f8633, 0 0 16px #ff6f8688; }

/* ----------------------------------------------------------------- sidebar */
.side {
  height: calc(100 * var(--vh)); min-height: 0; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px;
  border-left: 1px solid var(--line); background: #0f1c37e6; overflow: hidden;
}
.side-head { display: grid; gap: 4px; padding-bottom: 8px; border-bottom: 1px solid var(--line-soft); }
.turn-line { display: flex; justify-content: space-between; align-items: baseline; }
.turn-line strong { font-family: var(--label); font-size: 22px; font-weight: 700; letter-spacing: .04em; }
.turn-line span { font-size: 13px; }
.turn-line .mine { color: var(--me); } .turn-line .theirs { color: var(--opp); }
.phase-line { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: #c5d4f5; }
.phase-line small { color: var(--muted); white-space: nowrap; }
.side-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tool {
  padding: 5px 10px; border: 1px solid var(--line); border-radius: 3px; background: #ffffff08;
  font-family: var(--label); font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: #c9d8f8;
}
.tool:hover { border-color: var(--line-strong); background: #ffffff12; }
.tool b { color: white; }
.prompt-buttons .tool small { font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-size: 11px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--muted); }
.tool.danger { color: #ffb0bd; border-color: #ff6f8655; }
.log { flex: 1 1 0; min-height: 90px; overflow-y: auto; display: grid; align-content: start; gap: 2px; scrollbar-width: thin; }
.log-row {
  display: grid; grid-template-columns: 16px 36px auto 1fr auto; align-items: center; gap: 6px;
  padding: 4px 6px; border: 1px solid var(--line-soft); border-left-width: 2px; background: #ffffff05; font-size: 12px;
}
.log-row.mine { border-left-color: var(--me); }
.log-row.bot { border-left-color: var(--opp); }
.log-icon { text-align: center; color: var(--muted); font-size: 11px; }
.log-time { font-variant-numeric: tabular-nums; color: var(--dim); font-size: 11px; }
.log-text { min-width: 0; line-height: 1.3; }
.log-text b { font-weight: 600; }
.log-text small { display: block; color: var(--muted); font-size: 11px; }
.log-row em { font-style: normal; color: var(--dim); font-size: 10px; white-space: nowrap; }
.log-sep { margin: 4px 0; text-align: center; font-family: var(--label); font-size: 11px; letter-spacing: .2em; color: var(--muted); border-bottom: 1px solid var(--line-soft); }
/* The journal (owner, 18/11: clearer): turns as headers, the actions that
   change something, their outcomes under them; passes and the rest behind
   "Details"; the whole history large behind "Expand". */
.log-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.log-tools { display: flex; gap: 4px; }
.tool.small { min-height: 22px; padding: 0 7px; font-size: 10px; }
.tool.small.on { border-color: var(--me); color: white; }
.log-turn {
  position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: baseline;
  margin: 6px 0 2px; padding: 3px 8px; border-radius: 3px; background: #13234a; border: 1px solid var(--line-soft);
  font-family: var(--label); font-size: 11px; letter-spacing: .16em; color: var(--muted);
}
.log-turn b { font-weight: 700; letter-spacing: .14em; }
.log-turn.mine { border-left: 3px solid var(--me); } .log-turn.mine b { color: var(--me); }
.log-turn.bot { border-left: 3px solid var(--opp); } .log-turn.bot b { color: var(--opp); }
.log-row { grid-template-columns: 16px auto 1fr; }
.log-row.note { grid-template-columns: 16px 1fr; }
.log-row .thumb.none { width: 0; }
.log-row.quiet { opacity: .62; font-size: 11px; padding-top: 2px; padding-bottom: 2px; }
.log-row.bare { display: block; padding: 2px 6px 2px 28px; border-left-color: transparent; background: none; border-color: transparent; }
.log-out { margin: 3px 0 0; padding: 0; list-style: none; display: grid; gap: 1px; }
.log-out .out { display: flex; gap: 6px; align-items: baseline; font-size: 11.5px; line-height: 1.3; color: #c9d6f2; }
.log-out .out-icon { flex: none; width: 14px; text-align: center; color: var(--muted); }
.log-out .out.points { color: var(--gold); } .log-out .out.points .out-icon { color: var(--gold); }
.log-out .out.points b { font-weight: 700; }
.log-out .out.killed .out-icon, .log-out .out.countered .out-icon { color: #ff8b9c; }
.log-out .out.damage .out-icon { color: #ffb36b; }
.log-out .out.resolved .out-icon { color: var(--me); }
.log-out .out.empowered .out-icon { color: #8fe3ff; }
.log-out .out.drew, .log-out .out.xp { color: var(--muted); }
.log.log-large { flex: 1 1 auto; min-height: 0; max-height: none; padding: 8px 12px 14px; font-size: 13px; }
.log.log-large .log-row { font-size: 13px; }
.log-panel { height: calc(86 * var(--vh)); }
.thumb { display: inline-block; width: 18px; height: 25px; flex: none; border-radius: 2px; overflow: hidden; background: #2b3f6c; vertical-align: middle; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.state-box { display: grid; gap: 6px; }
.state-box:empty { display: none; }
.box { padding: 8px; border: 1px solid var(--line); border-radius: 3px; background: #ffffff06; font-size: 12px; }
.box p { margin: 4px 0 0; color: #c5d4f5; display: flex; align-items: center; gap: 6px; }
.box-head { display: flex; justify-content: space-between; gap: 6px; font-family: var(--label); letter-spacing: .14em; font-size: 12px; font-weight: 600; }
.box-head small { color: var(--muted); letter-spacing: .04em; font-family: Inter, sans-serif; font-weight: 400; text-align: right; }
.box.chain { border-color: #a68ae0aa; background: #2a1f5233; }
.box.showdown { border-color: #ffd27a99; background: #ffd27a12; }
.box.pending { border-color: #ffd27aaa; }
.box.moving { border-color: #7fb0ff; }
.box.moving .tool { margin-top: 6px; }
.box.moving #start-group { border-color: #7fb0ff; color: #cfe0ff; }
.pop-body .group-move { display: block; width: 100%; margin-bottom: 8px; border-color: #7fb0ff; color: #cfe0ff; }
.box ol { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; max-height: calc(18 * var(--vh)); overflow: auto; }
.box li { display: flex; gap: 8px; align-items: center; padding: 3px; border-left: 2px solid var(--me); }
.box li.bot { border-left-color: var(--opp); }
.box li span { display: grid; }
.box li small { color: var(--muted); }
.primary { display: grid; gap: 6px; }
.primary:empty { display: none; }
.big {
  position: relative; min-height: 44px; padding: 8px 14px; border: 1px solid #9cbcff; border-radius: 3px;
  background: linear-gradient(180deg, #4f7fe6, #3560c4); color: white; font-weight: 600; font-size: 15px; letter-spacing: .02em;
  box-shadow: inset 0 1px 0 #ffffff33, 0 4px 14px #0007;
}
.big:hover:not(:disabled) { background: linear-gradient(180deg, #6290f5, #3d6bd4); }
.big:disabled { opacity: .45; cursor: not-allowed; }
.big.secondary { min-height: 36px; background: #ffffff0d; border-color: var(--line); font-size: 14px; font-weight: 500; }
.big.go { padding-right: 76px; line-height: 1.25; }
.big kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); padding: 1px 5px; border: 1px solid #ffffff55; border-radius: 3px; font: 500 10px Inter, sans-serif; opacity: .7; }
.hint { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.others { display: grid; gap: 4px; min-height: 0; }
.others:empty { display: none; }
.others-list { max-height: calc(24 * var(--vh)); overflow: auto; display: grid; gap: 4px; scrollbar-width: thin; }
.act {
  width: 100%; padding: 6px 8px; display: flex; align-items: center; gap: 8px; text-align: left;
  border: 1px solid var(--line-soft); border-radius: 3px; background: #ffffff07;
}
.act:hover { border-color: #8ae9c3; background: #49d6a614; }
.act-thumbs { display: flex; gap: 2px; flex: none; }
.act-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.act-text strong { font-weight: 500; font-size: 13px; }
.act-text small { color: var(--muted); font-size: 11px; line-height: 1.3; }
.pay { flex: none; max-width: 40%; padding: 1px 6px; border-radius: 3px; background: #ffd27a1a; color: var(--gold); font-size: 10px; text-align: right; }
.preview { flex: 0 1 auto; display: flex; flex-direction: column; gap: 6px; min-height: 0; overflow: hidden; }
body.deciding .preview-card { width: min(100%, calc(calc(18 * var(--vh)) / 1.396)); }
body.deciding .preview-text p { display: none; }
.preview-hint { margin: 0; color: var(--dim); font-size: 12px; text-align: center; }
.preview-card { position: relative; align-self: center; width: min(100%, calc(calc(34 * var(--vh)) / 1.396)); aspect-ratio: 744 / 1039; border-radius: 10px; overflow: hidden; box-shadow: 0 8px 24px #000a, 0 0 0 1px var(--line); }
.preview-card.landscape { width: min(100%, calc(calc(34 * var(--vh)) * 1.396)); aspect-ratio: 1039 / 744; }
.preview-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.preview-card .face { position: absolute; inset: 0; display: grid; place-content: center; padding: 10px; text-align: center; background: linear-gradient(160deg, #2b3f6c, #142343); font-size: 16px; }
.preview-card .face .f-cost, .preview-card .face .f-might { position: absolute; font-family: var(--label); font-weight: 700; font-size: 22px; }
.preview-card .face .f-cost { top: 8px; left: 10px; color: var(--gold); } .preview-card .face .f-might { bottom: 8px; right: 12px; }
.preview-text { display: grid; gap: 2px; }
.preview-text strong { font-weight: 600; font-size: 14px; }
.preview-text small { color: var(--muted); font-size: 11px; }
.preview-text p { margin: 2px 0 0; max-height: calc(9 * var(--vh)); overflow: auto; font-size: 12px; line-height: 1.4; color: #c5d4f5; white-space: pre-line; }

/* ------------------------------------------------------------- popover */
.popover {
  position: absolute; z-index: 40; width: min(360px, calc(100vw - 16px)); max-height: min(calc(70 * var(--vh)), 560px);
  display: flex; flex-direction: column; border: 1px solid var(--line-strong); border-radius: 4px;
  background: #0f1d3af7; box-shadow: 0 18px 60px #000d; backdrop-filter: blur(8px);
}
.popover header { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); }
.popover header > span:not(.thumb) { flex: 1; display: grid; }
.popover header strong { font-weight: 600; font-size: 14px; }
.popover header small { color: var(--muted); font-size: 11px; }
.popover .thumb { width: 28px; height: 39px; }
.x { width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 3px; background: none; font-size: 16px; line-height: 1; }
.drawer-panel input { margin: 8px 10px 0; min-height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 3px; background: #0a1429; }
.pop-body { padding: 8px 10px 10px; overflow: auto; display: grid; gap: 8px; }
.pop-group { display: grid; gap: 4px; }
.pop-grid { display: flex; flex-wrap: wrap; gap: 6px; }

/* ------------------------------------------------------------- overlays */
/* "Report a problem" (owner, 19/11): a note and its kind, the game saved with them. */
.report-panel { width: min(480px, calc(100vw - 32px)); max-height: calc(100 * var(--vh) - 40px); overflow: auto; display: grid; gap: 10px; padding: 14px 16px 16px; }
.report-panel header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.report-panel header strong { font-weight: 600; font-size: 16px; }
.report-kinds { margin: 0; padding: 0; border: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.report-kinds legend { width: 100%; margin-bottom: 4px; padding: 0; }
.report-kinds label { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 17px; background: #0a1429; font-size: 13px; cursor: pointer; }
.report-kinds label:has(input:checked) { border-color: #49d6a6; background: #49d6a61f; }
.report-kinds input { accent-color: #49d6a6; margin: 0; }
#report-comment { width: 100%; min-height: 110px; padding: 8px 10px; resize: vertical; border: 1px solid var(--line); border-radius: 3px; background: #0a1429; color: var(--text); font: inherit; font-size: 14px; line-height: 1.4; }
.report-error { margin: 0; color: #ff8a8a; font-size: 12px; }
.report-actions { display: flex; justify-content: flex-end; }
.overlay { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px; background: #0a1328c4; backdrop-filter: blur(4px); }
.setup {
  overflow: auto;
  background:
    linear-gradient(#ffffff08 1px, transparent 1px) 0 0 / 120px 120px,
    linear-gradient(90deg, #ffffff08 1px, transparent 1px) 0 0 / 120px 120px,
    linear-gradient(#ffffff04 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, #ffffff04 1px, transparent 1px) 0 0 / 24px 24px,
    radial-gradient(ellipse at 50% 30%, #1d3361 0, var(--bg) 60%, var(--bg-deep) 100%);
}
.setup-panel { width: min(1400px, 100%); min-width: 0; padding: 22px 24px; background-color: #0f1d3ad9; }
.setup-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 16px; }
.setup-head h1 { margin: 4px 0; font-family: var(--label); font-size: 34px; font-weight: 700; letter-spacing: .03em; }
.setup-links { display: flex; gap: 16px; font-size: 13px; }
.setup-side { display: grid; justify-items: end; gap: 10px; }
/* The FR / EN switch (setup and side tools). */
.lang-switch { display: inline-flex; }
.lang-switch .tool { min-width: 40px; padding-inline: 8px; letter-spacing: .08em; }
.lang-switch .tool:first-child { border-radius: 3px 0 0 3px; }
.lang-switch .tool + .tool { margin-left: -1px; border-radius: 0 3px 3px 0; }
.lang-switch .tool.on { position: relative; border-color: var(--me); background: #49d6a61c; color: white; }
.model-line { margin: 0; color: var(--muted); font-size: 13px; }
.setup-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; }
.deck-grid { margin-top: 8px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; max-height: calc(calc(100 * var(--vh)) - 220px); overflow: auto; padding: 2px; scrollbar-width: thin; }
.deck-tile { position: relative; padding: 0; display: grid; grid-template-rows: auto auto; border: 1px solid var(--line); border-radius: 4px; background: #0d1830; text-align: left; overflow: hidden; transition: transform .12s, border-color .12s; }
.deck-tile:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.deck-tile.on { border-color: var(--me); box-shadow: 0 0 0 2px var(--me), 0 0 20px #49d6a655; }
.deck-art { position: relative; height: 120px; overflow: hidden; background: #1a2a4f; }
.deck-art img { position: absolute; inset: 0; width: 100%; height: 160%; object-fit: cover; object-position: top; }
.deck-art .face { position: absolute; inset: 0; display: grid; place-content: center; padding: 8px; text-align: center; background: linear-gradient(160deg, #7a3946, #2e1219); font-size: 13px; }
.deck-art .face .f-cost, .deck-art .face small { display: none; }
.deck-art img.deck-champ { left: auto; right: 6px; top: auto; bottom: 6px; inset: auto 6px 6px auto; width: 42px; height: 58px; border-radius: 3px; object-position: center; box-shadow: 0 2px 8px #000c, 0 0 0 1px #ffffff55; }
.deck-art .q { position: absolute; inset: 0; display: grid; place-content: center; font-family: var(--label); font-size: 64px; color: #a9c6ff; }
.deck-copy { padding: 7px 9px 9px; display: grid; gap: 1px; }
.deck-copy strong { font-weight: 600; font-size: 13px; }
.deck-copy small { color: var(--muted); font-size: 12px; }
.deck-copy em { color: var(--dim); font-size: 11px; font-style: normal; }
.setup-options { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.seat-block { display: flex; flex-direction: column; gap: 14px; }
.seat-block[hidden] { display: none; }
.segmented { display: grid; gap: 4px; margin-top: -6px; }
.segmented button { padding: 9px 12px; border: 1px solid var(--line); border-radius: 3px; background: #ffffff06; text-align: left; }
.segmented button.on { border-color: var(--me); background: #49d6a61c; }
.opt { display: grid; gap: 6px; }
.opt select, .opt input { width: 100%; min-width: 0; min-height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 3px; background: #0a1429; }
.setup-actions { margin-top: auto; display: grid; gap: 8px; }
.ghost { min-height: 38px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 3px; background: #ffffff08; }
.ghost:hover { border-color: var(--line-strong); }
.end-panel { width: min(480px, 100%); padding: 26px; display: grid; gap: 8px; justify-items: center; text-align: center; background-color: #0f1d3af2; }
.end-panel h2 { margin: 0; font-family: var(--label); font-size: 52px; font-weight: 700; letter-spacing: .04em; }
.end-panel.won h2 { color: var(--me); } .end-panel.lost h2 { color: var(--opp); }
.end-sub, .end-meta { margin: 0; color: var(--muted); }
.end-score { display: flex; align-items: center; gap: 22px; margin: 8px 0; }
.end-score span { display: grid; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .14em; }
.end-score b { font-family: var(--label); font-size: 44px; color: white; letter-spacing: 0; }
.end-score i { color: var(--dim); font-size: 28px; font-style: normal; }
.end-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }
.drawer-panel { width: min(720px, 100%); max-height: calc(86 * var(--vh)); display: flex; flex-direction: column; background-color: #0f1d3af7; }
.drawer-panel header { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
.drawer-list { padding: 10px; overflow: auto; display: grid; gap: 4px; }
.loading { position: fixed; z-index: 50; right: calc(var(--side) + 18px); top: 14px; padding: 8px 14px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 3px; background: #0f1d3af2; font-size: 13px; }
.spinner { width: 16px; height: 16px; border: 2px solid #ffffff33; border-top-color: var(--line-strong); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; z-index: 60; left: 50%; bottom: 20px; transform: translateX(-50%); max-width: min(560px, 90vw); padding: 12px 14px; border: 1px solid var(--opp); border-radius: 3px; background: #3a1422; opacity: 0; pointer-events: none; transition: opacity .2s; }
.toast.show { opacity: 1; }

/* ----------------------------------------------------------- responsive */
@media (max-height: 820px) {
  .side { gap: 6px; padding: 8px 10px; }
  .preview-card { width: min(100%, calc(calc(30 * var(--vh)) / 1.396)); }
  .preview-text p { max-height: calc(7 * var(--vh)); }
  .big { min-height: 38px; }
}
@media (max-width: 899px), (max-width: 1100px) and (orientation: portrait) {
  body { overflow: auto; }
  .app { height: auto; overflow: visible; grid-template-columns: 1fr; }
  .table { height: auto; min-height: calc(100 * var(--vh)); }
  .side { height: auto; border-left: 0; border-top: 1px solid var(--line); }
  .log { flex: none; max-height: calc(40 * var(--vh)); }
  .preview { display: none; }
  .loading { right: 14px; }
}
@media (max-width: 700px) {
  :root { --cw: 44px; }
  .table {
    padding: 6px; gap: 8px;
    grid-template-columns: 1fr; grid-template-rows: auto auto auto auto auto;
  }
  .row, .fields { grid-column: 1; }
  .opp-top { grid-row: 1; flex-wrap: wrap; } .opp-main { grid-row: 2; } .fields { grid-row: 3; }
  .me-main { grid-row: 4; } .me-bottom { grid-row: 5; }
  .track { display: none; }
  .row { flex-wrap: wrap; }
  .opp-main, .me-main { flex-direction: column; }
  .opp-hand { order: 3; flex-basis: 100%; overflow: hidden; height: calc(var(--ch) * .5); }
  .fields { grid-template-columns: 1fr; }
  .field { min-height: 260px; }
  .me-bottom { flex-wrap: wrap; }
  .hand { order: 3; flex-basis: 100%; height: auto; align-items: flex-start; justify-content: flex-start; overflow-x: auto; padding: 14px 4px 8px; }
  .table { overflow: visible; }
  .hand-slot { transform: none; margin: 0 3px; }
  .hand-slot:hover { transform: translateY(-6%); }
  .hand-card { --cw: 64px; }
  .plate { min-width: 0; }
  .setup-body { grid-template-columns: minmax(0, 1fr); }
  .setup { padding: 8px; place-items: start center; }
  .setup-panel { padding: 14px; }
  .setup-head h1 { font-size: 26px; }
  .setup-head { flex-direction: column; }
  .setup-side { justify-items: start; }
  .deck-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); max-height: none; }
  .chip { left: 50%; top: auto; bottom: -8px; transform: translate(-50%, 100%); }
  .field { --cw: 54px; }
  .primary { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; padding: 8px 10px; border-top: 1px solid var(--line); background: #0f1d3af5; }
  .primary .hint { display: none; }
  body { padding-bottom: 70px; }
  .big kbd { display: none; }
}

/* The Chain, floating between the battlefields. */
.fields { position: relative; }
.chain-float { position: absolute; z-index: 8; left: 50%; top: 50%; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 6px; pointer-events: none; }
.chain-float .zone-label { padding: 2px 8px; border: 1px solid #a68ae0aa; border-radius: 3px; background: #1a1438ee; color: #d9cbff; }
.chain-cards { display: flex; align-items: center; }
.chain-cards .card { --cw: clamp(56px, calc(11 * var(--vh)), 150px); margin-left: calc(var(--cw) * -.55); pointer-events: auto; box-shadow: 0 10px 30px #000c, 0 0 0 2px #a68ae0; }
.chain-cards .card:first-child { margin-left: 0; }
.chain-cards .card.mine { box-shadow: 0 10px 30px #000c, 0 0 0 2px var(--me); }
.chain-cards .card.theirs { box-shadow: 0 10px 30px #000c, 0 0 0 2px var(--opp); }
.chain-cards .card:last-child { transform: translateY(-6px) scale(1.06); }

/* Rune faces without images: the domain's colour. */
.card.rune .face { border-color: #ffffff55; color: white; }
.card.rune.d-fury .face { background: linear-gradient(160deg, #e2483d, #7a1c1c); }
.card.rune.d-calm .face { background: linear-gradient(160deg, #3fae78, #154d33); }
.card.rune.d-mind .face { background: linear-gradient(160deg, #3f86e0, #173a6e); }
.card.rune.d-body .face { background: linear-gradient(160deg, #f08a2e, #7a3b0e); }
.card.rune.d-chaos .face { background: linear-gradient(160deg, #9a62e6, #3e1f6e); }
.card.rune.d-order .face { background: linear-gradient(160deg, #e8c13a, #6e5512); }
.card.rune .face small { display: none; }
.overlay.end { background: #0a132888; backdrop-filter: blur(1.5px); }
.lane-cards { padding-top: 12px; }

.seat-line { margin: 4px 0 0; font-family: var(--label); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.seat-line.mine { color: var(--me); }
.seat-line.theirs { color: var(--opp); }

/* ------------------------------------------------------- drag and drop */
.card.can-act, .card.dnd-trash, .card.selected { touch-action: none; }
body.dragging, body.dragging * { user-select: none; -webkit-user-select: none; cursor: grabbing !important; }
body.dragging .card:not(.dnd-ok):not(.dnd-src) { filter: brightness(.45) saturate(.6); }
body.dragging [data-place]:not(.dnd-ok) { box-shadow: inset 0 0 0 100vmax #05091466; }
body.dragging [data-place].dnd-ok { opacity: 1; --b: var(--gold); border-color: var(--gold); box-shadow: inset 0 0 0 2px #ffd27a88, inset 0 0 50px #ffd27a26; }
body.dragging [data-place].dnd-ok .card { filter: none; }
body.dragging [data-place].dnd-ok .card:not(.dnd-ok):not(.dnd-src) { filter: brightness(.7); }
body.dragging .card.dnd-ok { filter: none; box-shadow: 0 0 0 2px var(--gold), 0 0 18px #ffd27acc; }
body.dragging .card.dnd-src { opacity: .35; filter: none; }
body.dragging .dnd-hover.card { transform: scale(1.08); box-shadow: 0 0 0 3px #fff, 0 0 26px var(--gold); }
body.dragging [data-place].dnd-hover { box-shadow: inset 0 0 0 3px #fff, inset 0 0 70px #ffd27a44; }
body.drag-free #table { outline: 2px dashed #ffd27a99; outline-offset: -4px; }
body.drag-free #table.dnd-hover { outline-color: #fff; }
body.dragging .chip, body.dragging .chips { pointer-events: none; }
.dnd-ghost {
  position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none; will-change: transform;
  filter: drop-shadow(0 14px 24px #000c);
}
.dnd-ghost .card { box-shadow: 0 0 0 2px var(--gold), 0 0 24px #ffd27a99; }
.dnd-count {
  position: absolute; top: -10px; right: -10px; z-index: 3; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px;
  display: grid; place-items: center; background: var(--gold); color: #1b1404; font: 700 14px var(--label);
}
@keyframes dnd-shake { 20%, 60% { translate: -5px 0; } 40%, 80% { translate: 5px 0; } }
.dnd-shake { animation: dnd-shake .4s ease; box-shadow: 0 0 0 2px var(--opp), 0 0 16px #ff6f86aa !important; }

/* -------------------------------------------- rewind, reveals, choices */
.tool:disabled { opacity: .4; cursor: not-allowed; }
.tool kbd { margin-left: 4px; padding: 0 4px; border: 1px solid #ffffff44; border-radius: 3px; font: 500 10px Inter, sans-serif; letter-spacing: 0; text-transform: none; opacity: .7; }
.end-note { margin: 2px 0 0; padding: 6px 10px; border: 1px solid #ffd27a88; border-radius: 3px; background: #ffd27a14; color: var(--gold); font-size: 13px; }
.opp-hand.revealed .card.revealed { transform: translateY(calc(var(--cw) * 1.396 * -.12)); box-shadow: 0 0 0 2px var(--gold), 0 4px 14px #000a; z-index: 2; }
.opp-hand.revealed .card.revealed.pick { box-shadow: 0 0 0 2px var(--gold), 0 0 16px #ffd27aaa; }
.opp-hand.revealed .card.revealed:hover { transform: translateY(calc(var(--cw) * 1.396 * -.06)) scale(1.06); z-index: 3; }
.opp-hand.revealed .card { margin: 0 2px; }
.overlay.choice { right: var(--side); z-index: 28; padding: 16px; background: #0a1328b8; backdrop-filter: blur(2px); overflow: auto; }
.choice-panel { width: min(1100px, 100%); max-height: calc(calc(100 * var(--vh)) - 32px); overflow: auto; padding: 18px 20px; display: grid; gap: 14px; background-color: #0f1d3af2; --b: var(--gold); border-color: #ffd27a77; }
.choice-head { display: flex; align-items: flex-start; gap: 16px; }
.choice-head > div:first-child { flex: 1; min-width: 0; }
.choice-head h2 { margin: 2px 0; font-family: var(--label); font-size: 32px; font-weight: 700; letter-spacing: .03em; color: var(--gold); }
.choice-sub { margin: 0; color: var(--muted); font-size: 13px; }
.choice-source { flex: 0 1 380px; min-width: 0; display: flex; gap: 8px; align-items: flex-start; padding: 6px 8px; border: 1px solid var(--line-soft); border-radius: 3px; background: #ffffff06; }
.choice-source .thumb { width: 40px; height: 56px; flex: none; }
.choice-source span { display: grid; gap: 2px; }
.choice-source strong { font-weight: 600; font-size: 14px; }
.choice-source small { color: #c5d4f5; font-size: 12px; line-height: 1.35; }
.choice-cards { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px 14px; padding: 6px 0 4px; }
.choice-tile { display: grid; justify-items: center; gap: 8px; }
.choice-card { --cw: clamp(92px, calc(15 * var(--vh)), 170px); }
/* The mulligan (owner, 18/11): the opening hand large, each card kept or put back. */
.mull-panel { --b: var(--me); border-color: #49d6a677; }
.mull-panel .choice-head h2 { color: white; }
.mull-cards .choice-card { --cw: clamp(110px, calc(24 * var(--vh)), 210px); cursor: pointer; }
.mull-tile { display: grid; justify-items: center; gap: 6px; }
.mull-tile .mull-state { font-family: var(--label); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--me); }
.mull-tile.out .mull-state { color: var(--opp); }
.mull-card.mull-out { filter: grayscale(.8) brightness(.55); box-shadow: 0 0 0 3px var(--opp); transform: translateY(6px); }
.mull-actions { display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; }
.mull-actions .big { min-width: 260px; }
/* Who goes first, plain in the mulligan's title (owner, 18/11: "its not clear if i go first or second"). */
.mull-title { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.seat-badge { display: inline-grid; gap: 1px; padding: 6px 14px; border-radius: 4px; border: 2px solid; line-height: 1.1; }
.seat-badge b { font-family: var(--label); font-size: 22px; font-weight: 700; letter-spacing: .06em; }
.seat-badge small { font-size: 12px; color: var(--muted); }
.seat-badge.first { border-color: var(--me); background: #49d6a61f; } .seat-badge.first b { color: var(--me); }
.seat-badge.second { border-color: var(--gold); background: #ffd27a1a; } .seat-badge.second b { color: var(--gold); }
.choice-card.dim { filter: grayscale(.85) brightness(.5); cursor: default; }
.choice-tile.off .choice-note { color: var(--dim); }
.choice-note { font-family: var(--label); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.choice-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; max-width: calc(clamp(92px, calc(15 * var(--vh)), 170px) + 60px); }
.choice-buttons .chip { position: static; transform: none; white-space: normal; text-align: center; }
.choice-drop { padding: 12px; border: 1px dashed #ffd27a88; border-radius: 4px; text-align: center; color: var(--muted); font-size: 13px; }
.choice-others { display: grid; gap: 4px; }
.log-row.reveal { grid-template-columns: 16px auto 1fr; border-left: 2px solid var(--gold); background: #ffd27a10; }
.log-thumbs { display: flex; gap: 2px; flex-wrap: wrap; max-width: 140px; }
.log-thumbs .thumb { width: 18px; height: 25px; }
.i-reveal { color: var(--gold); }
@media (max-width: 899px), (max-width: 1100px) and (orientation: portrait) {
  .overlay.choice { right: 0; }
  .choice-head { flex-wrap: wrap; }
}
@media (max-width: 700px) {
  .choice-card { --cw: 84px; }
  .choice-head h2 { font-size: 24px; }
  .opp-hand.revealed { height: auto; overflow-x: auto; }
}

/* ----------------------------------------------------- board prompt */
/* The pending decision over the battlefields: a target to click, or the
   order of combat damage; the side panel no longer lists those options. */
/* It takes its own strip at the top of the battlefields' row, which the
   fields leave free while it shows: no unit hides under it. */
.prompt { grid-column: 2; grid-row: 3; align-self: start; justify-self: center; z-index: 30; width: min(1100px, 100%); pointer-events: none; }
body.prompting .fields { padding-top: var(--prompt-h, 64px); }
.prompt-bar { pointer-events: auto; display: flex; align-items: center; gap: 14px; padding: 6px 12px; background-color: #0f1d3af2; --b: var(--gold); border-color: #ffd27a77; box-shadow: 0 8px 24px #0009; }
.prompt-main { flex: 1; min-width: 0; display: grid; gap: 1px; }
.prompt-main strong { font-family: var(--label); font-size: 20px; font-weight: 700; letter-spacing: .03em; color: var(--gold); }
.prompt-main small { color: var(--muted); font-size: 12px; }
.prompt-source { flex: 0 1 340px; min-width: 0; display: flex; gap: 8px; align-items: flex-start; }
.prompt-source .thumb { width: 38px; height: 53px; flex: none; }
.prompt-source span { display: grid; gap: 2px; }
.prompt-source strong { font-weight: 600; font-size: 13px; }
.prompt-source small { color: #c5d4f5; font-size: 11px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* Many options (a choice of runes...) scroll inside the bar instead of covering the board. */
.prompt-buttons { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; max-height: calc(30 * var(--vh)); overflow-y: auto; }
/* Combat damage order (play.js renderDamagePrompt): the rules and result on
   the left, the units in their groups (Tank first, Backline last) on the
   right; stacked on narrow screens. */
.prompt-bar.dmg {
  display: grid; align-items: start; gap: 6px 16px; padding: 8px 12px 10px;
  grid-template-columns: minmax(250px, 1fr) minmax(0, max-content);
  grid-template-areas: "head groups" "foot groups";
  --dmg-cw: clamp(50px, calc(8.6 * var(--vh)), 92px);
  user-select: none; -webkit-user-select: none;
}
.dmg-head { grid-area: head; display: grid; gap: 2px; min-width: 0; }
.dmg-head .eyebrow { margin: 0; }
.dmg-head .eyebrow b { color: var(--gold); font-size: 14px; }
.dmg-head strong { font-family: var(--label); font-size: 19px; font-weight: 700; letter-spacing: .02em; line-height: 1.1; color: var(--gold); }
.dmg-head small { color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.dmg-head .dmg-how { color: #a9bbe0; }
.prompt-bar.dmg { background-color: #0f1d3a; }
@media (pointer: coarse) { .dmg-keys { display: none; } }
@media (max-height: 760px) {
  .prompt-bar.dmg { padding: 6px 10px 8px; gap: 4px 14px; }
  .dmg-head strong { font-size: 17px; }
  .dmg-head small { font-size: 11px; line-height: 1.3; }
}
.dmg-status b { font-weight: 600; color: #fff; }
.dmg-ignore { margin: 3px 0 0; padding: 3px 7px; border: 1px solid #ffb84d66; border-radius: 3px; background: #ffb84d14; color: #ffd8a0; font-size: 12px; }
.dmg-groups { grid-area: groups; margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px 22px; min-width: 0; }
.dmg-group {
  position: relative; display: grid; align-content: start; gap: 4px; min-width: calc(var(--dmg-cw) + 16px);
  padding: 4px 8px 6px; border: 1px solid var(--line-soft); border-radius: 4px; background: #ffffff05;
  transition: border-color .12s, background-color .12s;
}
.dmg-group + .dmg-group::before {
  content: "›"; position: absolute; left: -17px; top: 50%; transform: translateY(-50%);
  font: 700 22px var(--label); color: var(--muted);
}
.dmg-group.tank { border-color: #ffb84d66; background: #ffb84d0d; }
.dmg-group.back { border-color: #7fb0ff66; background: #7fb0ff0d; }
.dmg-group-label { font-family: var(--label); font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.dmg-group.tank .dmg-group-label { color: #ffc46e; }
.dmg-group.back .dmg-group-label { color: #9cc2ff; }
.dmg-group.dmg-over { border-color: var(--gold); background: #ffd27a14; }
.dmg-group.dmg-no { border-color: var(--opp); border-style: dashed; background: #ff6f8614; }
.dmg-group.dmg-no .dmg-group-label { color: var(--opp); }
.dmg-slots { display: flex; flex-wrap: wrap; gap: 12px 10px; padding: 5px 0 0 5px; min-height: calc(var(--dmg-cw) * 1.396 + 27px); }
.dmg-unit {
  position: relative; display: grid; justify-items: center; gap: 4px; padding: 0; border-radius: 6px;
  cursor: grab; touch-action: none; outline: none;
}
.dmg-unit.fixed { cursor: default; touch-action: auto; }
.dmg-unit .card { --cw: var(--dmg-cw); transition: transform .15s ease, box-shadow .15s ease, filter .15s, opacity .15s; }
.dmg-unit:not(.fixed):hover .card { transform: translateY(-3px); }
.dmg-unit:focus-visible .card { box-shadow: 0 0 0 2px #fff, 0 4px 14px #000a; }
.dmg-unit.dies .card { box-shadow: 0 0 0 2px #ff5c75, 0 0 14px #ff5c7588; }
.dmg-unit.partial .card { box-shadow: 0 0 0 2px #ffb36b, 0 0 10px #ffb36b55; }
.dmg-unit.spared .card { filter: brightness(.62) saturate(.7); }
.dmg-unit.selected .card { transform: translateY(-5px); box-shadow: 0 0 0 3px #7fb0ff, 0 0 18px #7fb0ffcc; filter: none; }
.dmg-unit.dmg-src .card { opacity: .3; filter: none; box-shadow: none; outline: 2px dashed var(--gold); outline-offset: 2px; }
.dmg-unit.tank-off .card-label { text-decoration: line-through; color: #ffd8a0; border-color: #ffb84d99; }
.dmg-rank {
  position: absolute; z-index: 4; top: -7px; left: -7px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-content: center; background: var(--gold); color: #1a1405;
  font: 700 14px var(--label); box-shadow: 0 2px 6px #000a; pointer-events: none;
}
.dmg-meter {
  position: relative; width: calc(var(--dmg-cw) + 4px); height: 18px; overflow: hidden;
  border: 1px solid #ffffff2e; border-radius: 9px; background: #0a1428;
}
.dmg-meter i { position: absolute; inset: 0 auto 0 0; width: 0; background: #ffb36b; transition: width .15s ease; }
.dmg-unit.dies .dmg-meter i { background: linear-gradient(90deg, #c92c47, #ff5c75); }
.dmg-meter b { position: relative; display: block; text-align: center; font: 700 12px/16px var(--label); letter-spacing: .04em; color: #fff; text-shadow: 0 1px 2px #000; }
.dmg-unit.spared .dmg-meter b { color: var(--muted); }
.dmg-foot { grid-area: foot; display: grid; gap: 6px; min-width: 0; align-self: end; }
.dmg-status { margin: 0; font-size: 13px; line-height: 1.35; }
.dmg-status.ok { color: #bdf3dd; }
.dmg-status.bad { color: #ffc2cc; }
.dmg-mark { display: inline-grid; place-content: center; width: 18px; height: 18px; margin-right: 2px; border-radius: 50%; font-size: 12px; font-weight: 700; vertical-align: 1px; }
.dmg-status.ok .dmg-mark { background: var(--me); color: #06281b; }
.dmg-status.bad .dmg-mark { background: var(--opp); color: #2a0610; }
.dmg-notice { margin: 0; font-size: 12px; line-height: 1.35; }
.dmg-notice:empty { display: none; }
.dmg-notice.info { color: #c5d4f5; }
.dmg-notice.bad { color: #ffb0bd; }
.dmg .prompt-buttons { justify-content: flex-start; align-items: center; flex-wrap: nowrap; max-height: none; overflow: visible; }
.dmg .prompt-buttons .big { min-height: 40px; white-space: nowrap; }
.dmg .prompt-buttons .tool { white-space: nowrap; }
body.dmg-dragging, body.dmg-dragging * { cursor: grabbing !important; }
@media (max-width: 899px), (max-width: 1100px) and (orientation: portrait) {
  .prompt-bar.dmg { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "groups" "foot"; --dmg-cw: clamp(52px, calc(8 * var(--vh)), 96px); }
  .dmg-foot { align-self: start; }
}
@media (max-width: 700px) {
  .prompt { grid-column: 1; }
  .prompt-bar.dmg { --dmg-cw: 54px; padding: 8px; }
  .dmg-groups { gap: 8px; }
  .dmg-group + .dmg-group::before { display: none; }
  .dmg .prompt-buttons .big { flex: 1 1 100%; }
}
/* While a target is chosen on the board, the other cards step back. */
body.targeting .table .card[data-inst]:not(.pick) { filter: brightness(.5) saturate(.6); }
body.targeting .table .card.pick { z-index: 2; }
@media (max-width: 899px), (max-width: 1100px) and (orientation: portrait) { .prompt { grid-row: 1; width: 100%; } .prompt-bar { flex-wrap: wrap; } }

/* ---------------------------------------------------------------- replays */
.overlay.replays { z-index: 35; }
.replay-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 3px; background: #ffffff06; color: inherit; text-align: left; cursor: pointer; }
.replay-row:hover { border-color: var(--line-strong); background: #ffffff12; }
.replay-text { flex: 1; display: grid; gap: 2px; min-width: 0; }
.replay-text i { color: var(--muted); font-style: normal; font-weight: 400; }
.replay-text small { color: var(--muted); }
.replay-row .tag { flex: none; padding: 2px 8px; border-radius: 10px; font-size: 11px; border: 1px solid var(--line); }
.replay-row .tag.won { color: #9ff0d2; border-color: #49d6a666; }
.replay-row .tag.lost { color: #ffb0bd; border-color: #ff6f8666; }
.replay-row .tag.live { color: #ffe08a; border-color: #ffd04a66; }
.replay-box { display: grid; gap: 8px; padding: 8px; border: 1px solid #ffd04a66; border-radius: 3px; background: #ffd04a0d; font-size: 12px; }
.replay-box input[type="range"] { width: 100%; accent-color: #ffd04a; }
.replay-buttons { display: flex; flex-wrap: wrap; gap: 4px; }
.replay-buttons .tool { flex: 1; min-width: 0; padding-inline: 6px; }
.replay-buttons .tool.play { color: #ffe08a; }
.replay-next { margin: 0; color: #dfe8ff; line-height: 1.4; }
.replay-next small { display: block; color: var(--muted); }
body.replaying #rewind, body.replaying #concede, body.replaying #open-all { display: none; }

/* ---------------------------------------------------------- best-of-3 */
/* The side column stays clear of the panel (owner, 18/11: the sideboard's card
   hover showed in the blurred background): its card preview reads beside it. */
.overlay.bo3 { z-index: 32; overflow: auto; align-items: start; right: var(--side); }
@media (max-width: 899px), (max-width: 1100px) and (orientation: portrait) { .overlay.bo3 { right: 0; } }
.bo3-panel { width: min(980px, 100%); margin: auto; padding: 22px 24px; display: grid; gap: 14px; background-color: #0f1d3af5; }
.bo3-panel.won .bo3-head h2 { color: var(--me); }
.bo3-panel.lost .bo3-head h2 { color: var(--opp); }
.bo3-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.bo3-head h2 { margin: 0; font-family: var(--label); font-size: 38px; font-weight: 700; letter-spacing: .03em; }
.bo3-head .end-sub { margin-top: 2px; }
.bo3-score { margin: 0; }
.bo3-decks, .bo3-notes, .bo3-swaps { margin: 0; color: var(--muted); }
.bo3-decks b { color: white; font-weight: 600; }
.bo3-notes { color: var(--line-strong); }
.bo3-games { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.bo3-games li { display: grid; gap: 1px; padding: 6px 10px; border: 1px solid var(--line); border-left: 3px solid var(--opp); border-radius: 3px; background: #ffffff06; font-size: 13px; }
.bo3-games li.won { border-left-color: var(--me); }
.bo3-games li small { color: var(--muted); font-size: 11px; }
.bf-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.bf-grid.small { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 620px; }
.bf-tile { display: grid; gap: 6px; padding: 6px; border: 1px solid var(--line); border-radius: 4px; background: #0d1830; text-align: left; transition: transform .12s, border-color .12s; }
.bf-tile:not(:disabled):hover, .bf-tile:not(:disabled):focus-visible { transform: translateY(-2px); border-color: var(--me); box-shadow: 0 0 0 2px var(--me); }
.bf-tile:disabled { cursor: default; }
.bf-tile.used { opacity: .45; }
.bf-tile > span { display: grid; font-size: 13px; }
.bf-tile small { color: var(--opp); font-size: 11px; }
.bo3 .card.bf-card { --cw: 120px; width: 100%; height: auto; aspect-ratio: 1039 / 744; }
.bf-grid.small .card.bf-card { --cw: 80px; }
.bf-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; max-width: 720px; justify-self: center; width: 100%; }
.bf-pair figure { margin: 0; display: grid; gap: 6px; }
.bf-pair figcaption { color: var(--muted); font-size: 12px; text-align: center; }
.side-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; }
.side-list { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 3px; max-height: calc(46 * var(--vh)); overflow: auto; }
.side-list li { display: grid; grid-template-columns: 22px 18px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 3px 6px; border-radius: 3px; background: #ffffff06; font-size: 13px; }
.side-list li.lane-empty { display: block; background: none; }
.side-n { font-variant-numeric: tabular-nums; color: var(--muted); text-align: right; }
.side-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-btn { width: 30px; height: 26px; border: 1px solid var(--line); border-radius: 3px; background: #ffffff08; font-size: 16px; line-height: 1; }
.side-btn:hover { border-color: var(--line-strong); }
.side-label .ok { color: var(--me); } .side-label .warn { color: var(--opp); }
.bo3-hint { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.end-match { margin: 0; font-size: 15px; }
.match-line { margin: 2px 0 0; font-family: var(--label); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--line-strong); }
.log-row.note .log-text { color: var(--line-strong); }
.toast.note { border-color: var(--line-strong); background: #10244a; }
@media (max-width: 700px) {
  .bo3-panel { padding: 14px; }
  .bo3-head h2 { font-size: 30px; }
  .bf-grid, .bf-grid.small { grid-template-columns: minmax(0, 1fr); }
  .bf-grid.small { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .side-grid { grid-template-columns: minmax(0, 1fr); }
  .side-list { max-height: none; }
}

/* ------------------------------------------------------------ tablets */
/* Stacked (portrait tablets, phones): the main buttons stay on screen in a
   bar at the bottom (play.js sets the page's bottom padding to its height). */
@media (max-width: 899px), (max-width: 1100px) and (orientation: portrait) {
  .primary { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: flex; flex-wrap: wrap; gap: 6px;
    padding: 8px max(10px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    border-top: 1px solid var(--line); background: #0f1d3a; }
  .primary .big { flex: 1 1 220px; }
  .primary .hint { display: none; }
}
/* Portrait tablets: the board fills the screen above the bottom bar (the
   journal and the rest of the side panel follow below it). */
@media (min-width: 701px) and (max-width: 1100px) and (orientation: portrait) {
  .table { height: calc(100dvh - var(--bar-height, 72px)); min-height: 560px; }
}
/* Touch screens: fingers need bigger targets, no keyboard hints, and no
   text selection or image callout when a card is held. */
@media (pointer: coarse) {
  .tool { min-height: 40px; padding-inline: 12px; }
  .chip { min-height: 32px; padding: 6px 10px; }
  .side-btn { width: 44px; height: 38px; }
  .big { min-height: 48px; }
  .big.secondary { min-height: 42px; }
  kbd, .big kbd { display: none; }
  .big.go { padding-right: 14px; }
  .attached .card { --cw: clamp(36px, calc(5 * var(--vh)), 64px); }
  .card, .thumb, .deck-tile, .bf-tile { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
  button, .card, .chip { -webkit-tap-highlight-color: transparent; }
}
/* A long press on a card: the card large, with its text. */
.overlay.zoom { z-index: 45; background: #0a1328e6; padding: 16px; overflow: auto; }
.zoom-panel { display: grid; justify-items: center; gap: 10px; max-width: min(560px, 100%); }
.zoom-card { position: relative; width: min(78vw, calc(calc(62 * var(--vh)) / 1.396), 420px); aspect-ratio: 744 / 1039; border-radius: 14px; overflow: hidden; box-shadow: 0 12px 40px #000c, 0 0 0 1px var(--line); }
.zoom-card.landscape { width: min(90vw, calc(calc(52 * var(--vh)) * 1.396), 640px); aspect-ratio: 1039 / 744; }
.zoom-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.zoom-card .face { position: absolute; inset: 0; display: grid; place-content: center; padding: 12px; text-align: center; background: linear-gradient(160deg, #2b3f6c, #142343); font-size: 18px; }
.zoom-text { display: grid; gap: 4px; text-align: center; }
.zoom-text small { color: var(--muted); }
.zoom-text p { margin: 4px 0 0; color: #dfe8ff; line-height: 1.45; text-align: left; }
.zoom-close { color: var(--muted); font-size: 13px; }

/* Touch screens, board beside the side panel or above the bottom bar: the
   hand is played with a finger, not hovered, so it shows whole cards,
   bigger, in a row of its own height. */
@media (pointer: coarse) and (min-width: 701px) {
  :root { --hand-cw: clamp(60px, calc(12 * var(--vh)), 150px); }
  .table { grid-template-rows: calc(var(--ch) * .58) calc(var(--ch) + 30px) minmax(0, 1fr) calc(var(--ch) + 30px) calc(var(--hand-cw) * 1.396 + 16px); }
  .hand-card { --cw: var(--hand-cw); }
  .hand { align-items: center; }
  .hand-slot { transform: rotate(calc(var(--o) * 1.2deg)); }
  .hand-slot:hover, .hand-slot:focus-within { transform: translateY(-6%) scale(1.06); }
}
