/* ==========================================================================
   The game table. One 100dvh grid, nothing scrolls except panels.
   Card sizes are solved in table.js from the measured box heights.
   ========================================================================== */

.table {
  --fit: 1;
  --rail: 206px;
  --side: 288px;
  --top: calc(46px * var(--fit));
  --bar-h: calc(50px * var(--fit));
  --hand-h: calc(clamp(104px, 18.5vh, 170px) * var(--fit));
  --rune-strip: 250px;
  --half-h: 120px;

  position: relative;
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr) var(--side);
  grid-template-rows: var(--top) minmax(0, 1fr);
  grid-template-areas:
    'top top top'
    'rail center side';
  gap: 6px;
  height: 100dvh;
  width: 100%;
  padding: 6px;
  overflow: hidden;
}

/* --------------------------------------------------------------- top bar -- */

.topbar {
  grid-area: top;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s3);
  padding: 0 var(--s3);
  background: linear-gradient(180deg, rgba(18, 27, 48, 0.9), rgba(9, 14, 26, 0.86));
  border: 1px solid var(--gold-line);
  border-radius: var(--r-md);
  min-width: 0;
}
.brand { display: flex; align-items: center; gap: 7px; }
.brand-mark { color: var(--gold); font-size: 15px; }
.brand-name { font-family: var(--font-display); font-size: 12px; letter-spacing: 0.2em; color: var(--gold-hi); text-transform: uppercase; }
@media (max-width: 1280px) { .brand-name { display: none; } }

.top-mid { display: flex; align-items: center; justify-content: center; gap: var(--s4); min-width: 0; }

/* phase strip — always visible, active phase lit */
.phase-strip { display: flex; align-items: center; gap: 0; min-width: 0; }
.phase-strip .ph {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px 3px 7px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  position: relative;
  transition: color var(--t-mid), background var(--t-mid);
  border-radius: 4px;
  white-space: nowrap;
}
.phase-strip .ph + .ph::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 50%;
  width: 6px;
  height: 1px;
  background: var(--gold-line);
  transform: translateY(-50%);
}
.phase-strip .ph-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1px solid var(--gold-line-hi);
  background: transparent;
  flex: 0 0 auto;
  transition: all var(--t-mid) var(--ease);
}
.phase-strip .ph.past { color: var(--ink-soft); }
.phase-strip .ph.past .ph-dot { background: var(--gold-dim); border-color: var(--gold-dim); }
.phase-strip .ph.on {
  color: #17110a;
  background: linear-gradient(180deg, #e0c286, #a5accf00 240%);
  background-color: var(--gold);
  font-weight: 800;
  box-shadow: 0 0 16px rgba(200, 170, 110, 0.45);
}
.phase-strip .ph.on .ph-dot { background: #17110a; border-color: #17110a; box-shadow: 0 0 0 3px rgba(23, 17, 10, 0.18); }
.phase-strip.pre { opacity: 0.45; }
@media (max-width: 1180px) { .phase-strip .ph-name { display: none; } .phase-strip .ph { padding: 3px 6px; } }

.turn-label { display: flex; align-items: baseline; gap: 6px; font-size: 12px; white-space: nowrap; }
.turn-label .tl-turn { color: var(--gold); font-weight: 700; letter-spacing: 0.06em; }
.turn-label .tl-sep { color: var(--ink-mute); }
.turn-label .tl-who { color: var(--ink-soft); }
.turn-label .tl-who.mine { color: var(--good); font-weight: 700; }

.top-right { display: flex; align-items: center; gap: 7px; }
.score {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--gold-line);
  background: rgba(6, 11, 22, 0.6);
  max-width: 150px;
}
.score.mine { border-color: var(--gold-line-hi); }
.score-name { font-size: 10px; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.1em; max-width: 74px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-num { font-size: 16px; font-weight: 800; color: var(--gold-hi); }
.score-max { font-size: 10px; color: var(--ink-mute); }

/* ------------------------------------------------------------------ rail -- */

.rail {
  grid-area: rail;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  min-width: 0;
}
.rail-rule { height: 1px; background: linear-gradient(90deg, transparent, var(--gold-line-hi), transparent); flex: 0 0 auto; }

.plate {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 9px;
  border-radius: var(--r-lg);
  border: 1px solid var(--gold-line);
  background: linear-gradient(180deg, rgba(18, 28, 50, 0.82), rgba(7, 12, 24, 0.9));
  overflow: hidden;
}
.plate.active { border-color: var(--gold-line-hi); box-shadow: 0 0 0 1px rgba(200, 170, 110, 0.2), 0 0 24px rgba(200, 170, 110, 0.12) inset; }
/* legend portrait, softly behind the plate */
.plate-portrait {
  position: absolute;
  inset: 0;
  background-image: var(--portrait);
  background-size: 150%;
  background-position: center 18%;
  opacity: 0.3;
  filter: saturate(0.85) contrast(1.05);
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.95), transparent 78%);
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.95), transparent 78%);
  pointer-events: none;
}
.plate > *:not(.plate-portrait) { position: relative; z-index: 1; }
.plate-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.plate-name { font-family: var(--font-display); font-size: 14px; color: var(--gold-hi); text-shadow: 0 1px 4px #000; }
.plate-tag { font-size: 8px; letter-spacing: 0.18em; color: var(--ink-mute); }
.plate.mine .plate-tag { color: var(--good); }

.plate-score { display: flex; align-items: center; gap: 7px; }
.ps-num { font-size: 24px; font-weight: 800; line-height: 1; color: var(--gold-hi); text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8); }
.pips-row { display: flex; gap: 3px; flex-wrap: wrap; }
.vp { width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--gold-line-hi); background: rgba(0, 0, 0, 0.4); transition: all var(--t-mid); }
.vp.on { background: radial-gradient(circle at 32% 28%, #f6e5b8, #a3792f); border-color: #f0dcae; box-shadow: 0 0 8px rgba(200, 170, 110, 0.7); }
.chip.xs { font-size: 9px; padding: 1px 6px; }

/* pool readout — big and readable */
.pool { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.pool-energy {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px 2px 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(96, 160, 235, 0.28), rgba(20, 40, 80, 0.5));
  border: 1px solid rgba(120, 180, 250, 0.5);
}
.pool-energy .bolt { font-size: 12px; filter: drop-shadow(0 0 5px rgba(120, 190, 255, 0.9)); }
.pool-energy .num { font-size: 17px; font-weight: 800; color: #dcecff; }
.plate-pool.big .pool-energy .num { font-size: 21px; }
.pool-power { display: flex; gap: 4px; flex-wrap: wrap; }
.pchip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px 1px 5px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid currentColor;
  background: rgba(0, 0, 0, 0.42);
}
.pchip i { font-style: normal; font-size: 11px; }
.pchip b { font-size: 13px; color: #fff; text-shadow: 0 1px 3px #000; }
.plate-pool.big .pchip b { font-size: 15px; }
.pchip.empty { color: var(--ink-mute); border-color: var(--gold-line); font-size: 10px; }
.dom-fury { color: var(--d-fury); }
.dom-calm { color: var(--d-calm); }
.dom-mind { color: var(--d-mind); }
.dom-body { color: var(--d-body); }
.dom-chaos { color: var(--d-chaos); }
.dom-order { color: var(--d-order); }
.pchip.dom-any { color: #fff; border-color: transparent; background-image: conic-gradient(var(--d-fury), var(--d-order), var(--d-body), var(--d-calm), var(--d-mind), var(--d-chaos), var(--d-fury)); box-shadow: inset 0 0 0 20px rgba(0, 0, 0, 0.55); }

.plate-stacks { display: flex; align-items: flex-end; gap: 7px; margin-top: auto; }
.stack { position: relative; width: var(--w); flex: 0 0 auto; }
.stack-shadow {
  position: absolute;
  left: 3px;
  top: 3px;
  width: var(--w);
  height: calc(var(--w) * var(--card-ratio));
  border-radius: calc(var(--w) * 0.055);
  background: rgba(0, 0, 0, 0.55);
  box-shadow: 5px 5px 0 -1px rgba(10, 16, 30, 0.85), 8px 8px 0 -2px rgba(6, 10, 20, 0.7);
}
.stack-empty .stack-shadow { display: none; }
.stack-empty .card { opacity: 0.22; border: 1px dashed var(--gold-line); background: none; }
.stack-count {
  position: absolute;
  right: -4px;
  top: -5px;
  min-width: 17px;
  height: 17px;
  padding: 0 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, #e6cd97, #9b7833);
  color: #17110a;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}
.stack-label { font-size: 8px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-mute); text-align: center; margin-top: 2px; }
.hand-count { display: flex; flex-direction: column; align-items: center; gap: 1px; color: var(--ink-soft); }
.hand-count .hc-icon { font-size: 15px; color: var(--gold); }
.hand-count .num { font-size: 14px; font-weight: 700; }
/* legend + champion as real cards: the two most important objects a player owns get the room */
.plate-heroes {
  --hero-w: clamp(54px, calc((100dvh - 250px) / 6.4), 82px);
  --w: var(--hero-w);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  flex: 0 0 auto;
}
.hero { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.hero-slot { width: var(--hero-w); height: calc(var(--hero-w) * var(--card-ratio)); }
.hero-slot .card { width: 100%; height: 100%; }
.hero-empty { border-radius: calc(var(--hero-w) * 0.055); border: 1px dashed var(--gold-line); opacity: 0.35; }
.hero-label { font-size: 8px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-mute); }
.hero-card.legend { box-shadow: 0 0 0 1.5px var(--gold-line-hi), 0 4px 14px rgba(0, 0, 0, 0.7); }
.hero-card.champion.playable { box-shadow: 0 0 0 2px var(--gold), 0 0 18px rgba(200, 170, 110, 0.6); }
.plate.mine .hero-card.clickable:hover { transform: translateY(-4px) scale(1.05); }
/* an object waiting for its arrival animation keeps its layout box but is not drawn yet */
.arriving, .arriving * { visibility: hidden !important; }

/* ---------------------------------------------------------------- center -- */

.center { grid-area: center; display: flex; flex-direction: column; gap: 6px; min-width: 0; min-height: 0; }

.board {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-rows: var(--half-h) minmax(0, 1fr) var(--half-h);
  gap: 6px;
}
/* Grid and flex children default to min-width:auto, which would let a crowded row
   push the whole table wider than the viewport. Nothing here may do that. */
.board > *, .center > *, .fields > *, .half > * { min-width: 0; }

.half { display: grid; grid-template-columns: var(--rune-strip) minmax(0, 1fr); gap: 6px; min-height: 0; min-width: 0; }
@media (max-width: 1200px) { .table { --rune-strip: 208px; } }

.zone {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 3px 5px 4px;
  border-radius: var(--r-md);
  border: 1px solid rgba(200, 170, 110, 0.14);
  background: linear-gradient(180deg, rgba(14, 22, 40, 0.5), rgba(6, 10, 20, 0.35));
}
.zone-label {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 8.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  line-height: 1.2;
}
.zone-label .zl-n { color: var(--gold); font-weight: 700; letter-spacing: 0; }
.half.mine .zone-label { color: rgba(200, 170, 110, 0.7); }

.unit-row { flex: 1 1 auto; min-height: 0; min-width: 0; display: flex; align-items: center; gap: 5px; }
.base-zone .unit-row { justify-content: flex-start; }
/* Too many units to show at a readable size: the row scrolls rather than shrinking further. */
.unit-row.crowded { overflow-x: auto; overflow-y: hidden; justify-content: flex-start; scrollbar-width: thin; }
.unit-row.crowded::-webkit-scrollbar { height: 5px; }
.unit-row.crowded { -webkit-mask-image: linear-gradient(90deg, #000 0 93%, transparent); mask-image: linear-gradient(90deg, #000 0 93%, transparent); }
.rune-row { flex: 1 1 auto; min-height: 0; min-width: 0; display: flex; align-items: flex-start; align-content: flex-start; flex-wrap: wrap; gap: 3px; overflow: hidden; }

/* faint dashed outlines instead of "no units" copy */
.slot-ghost, .rune-ghost {
  flex: 0 0 auto;
  width: var(--w, 46px);
  height: calc(var(--w, 46px) * var(--card-ratio));
  border: 1px dashed rgba(200, 170, 110, 0.2);
  border-radius: calc(var(--w, 46px) * 0.055);
  background: rgba(255, 255, 255, 0.012);
}
.rune-ghost { --w: 30px; }

/* fixed slot: a rotated (exhausted) card can never overlap a neighbour */
.slot { position: relative; flex: 0 0 auto; width: var(--w); height: calc(var(--w) * var(--card-ratio)); }
.slot > .rot { position: absolute; inset: 0; transition: transform var(--t-mid) var(--ease); transform-origin: center center; }
.slot.exhausted > .rot { transform: rotate(90deg) scale(0.7161); }
.slot .card { position: absolute; inset: 0; width: 100%; height: 100%; }
.slot.exhausted .card { filter: brightness(0.72) saturate(0.85); }
.slot.exhausted::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: calc(var(--w) * 0.055);
  box-shadow: inset 0 0 0 1px rgba(120, 140, 175, 0.35);
  pointer-events: none;
}
.slot.exhausted .card.clickable:hover { transform: scale(1.06); }
.viewer .droppable { outline: none; animation: none; }
.viewer .card { cursor: default; }
.unit-slot.ours .card { box-shadow: 0 0 0 1.5px rgba(87, 201, 138, 0.55), 0 3px 10px rgba(0, 0, 0, 0.6); }
.unit-slot.theirs .card { box-shadow: 0 0 0 1.5px rgba(226, 88, 74, 0.5), 0 3px 10px rgba(0, 0, 0, 0.6); }
.card.can-move { cursor: grab; }
.card.can-move::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 2px rgba(200, 170, 110, 0.75);
  animation: ready-glow 2.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes ready-glow { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
/* composing a group move: the units going are lifted in gold, the ones that could join wait with a dashed ring */
.unit-slot .card.picked { transform: translateY(-8px) scale(1.04); box-shadow: 0 0 0 3px var(--gold-hi), 0 0 24px rgba(230, 200, 130, 0.65); z-index: 5; }
.unit-slot .card.joinable { cursor: copy; }
.unit-slot .card.joinable::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 2px dashed rgba(200, 170, 110, 0.7);
  pointer-events: none;
}
.unit-slot .card.joinable:hover::before { border-color: var(--gold-hi); border-style: solid; }

.card .mark {
  position: absolute;
  top: 3%;
  right: 4%;
  width: max(12px, calc(var(--w, 60px) * 0.2));
  height: max(12px, calc(var(--w, 60px) * 0.2));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: max(8px, calc(var(--w, 60px) * 0.13));
  background: rgba(4, 8, 16, 0.85);
  border: 1px solid var(--gold-line-hi);
  color: var(--gold-hi);
  pointer-events: none;
}
.card .mark.stunned { color: #9fd0ff; border-color: #4d86c4; }
.card .mark.empowered { color: #ffd479; border-color: #d0a03e; top: 22%; }
.card .mark.token { color: #b7f0c8; border-color: #4fae74; top: 40%; }
.card .mark.flag { color: var(--warn); border-color: rgba(230, 178, 74, 0.7); top: 42%; right: auto; left: 4%; }
.card .mark.act { background: linear-gradient(180deg, #f0d9a0, #a4802f); color: #17110a; border-color: #f5e4bb; }

.bf-divider { flex: 0 0 auto; width: 1px; align-self: stretch; margin: 6% 5px; background: linear-gradient(180deg, transparent, var(--gold-line-hi), transparent); }

/* battlefields — compact: title + one unit row, art dimmed full-bleed */
.fields { flex: 1 1 auto; min-height: 0; min-width: 0; display: flex; gap: 6px; }
.bf {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: var(--r-md);
  border: 1px solid var(--gold-line);
  background: var(--navy-900);
  transition: border-color var(--t-mid), box-shadow var(--t-mid);
}
.bf-art {
  position: absolute;
  inset: 0;
  border-radius: var(--r-md);
  overflow: hidden;
  background-image: var(--bf-art);
  background-size: cover;
  background-position: center 30%;
  filter: brightness(0.34) saturate(0.78) contrast(1.06);
}
.bf-vignette {
  position: absolute;
  inset: 0;
  border-radius: var(--r-md);
  background: radial-gradient(120% 90% at 50% 40%, transparent 20%, rgba(3, 6, 14, 0.72) 100%), linear-gradient(180deg, rgba(3, 6, 14, 0.55), transparent 40%, rgba(3, 6, 14, 0.6));
}
.bf > .bf-head, .bf > .unit-row { position: relative; z-index: 1; }
.bf-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 7px;
  background: linear-gradient(180deg, rgba(4, 8, 16, 0.78), transparent);
  border-radius: var(--r-md) var(--r-md) 0 0;
  cursor: help;
}
.bf-idx { font-size: 10px; font-weight: 800; color: #17110a; background: var(--gold); border-radius: 3px; padding: 0 5px; }
.bf-name { font-family: var(--font-display); font-size: 11px; color: var(--gold-hi); text-shadow: 0 1px 4px #000; flex: 1 1 auto; min-width: 0; }
.bf-flag { font-size: 8px; letter-spacing: 0.12em; text-transform: uppercase; padding: 1px 5px; border-radius: 3px; border: 1px solid currentColor; }
.bf-flag.none { color: var(--ink-mute); }
.bf-flag.ours { color: var(--good); }
.bf-flag.theirs { color: #ff9d92; }
.bf-flag.contest { color: var(--warn); }
.bf-units { padding: 0 5px 5px; justify-content: center; }
.bf.ours { border-color: rgba(87, 201, 138, 0.5); }
.bf.theirs { border-color: rgba(226, 88, 74, 0.45); }
.bf.contested { box-shadow: inset 0 0 24px rgba(230, 178, 74, 0.2); }
.bf.showdown { border-color: var(--warn); box-shadow: 0 0 22px rgba(230, 178, 74, 0.35); }
.bf.combat { border-color: var(--bad); box-shadow: 0 0 26px rgba(226, 88, 74, 0.45); animation: combat-pulse 1.6s ease-in-out infinite; }
@keyframes combat-pulse { 0%, 100% { box-shadow: 0 0 18px rgba(226, 88, 74, 0.3); } 50% { box-shadow: 0 0 34px rgba(226, 88, 74, 0.6); } }

/* drop targets while moving a unit or choosing an entry location */
.droppable { cursor: pointer; outline: 2px dashed var(--gold); outline-offset: -3px; animation: drop-glow 1.4s ease-in-out infinite; }
.droppable:hover { outline-color: var(--gold-hi); background-color: rgba(200, 170, 110, 0.12); }
@keyframes drop-glow { 0%, 100% { outline-color: rgba(200, 170, 110, 0.45); } 50% { outline-color: rgba(240, 230, 210, 0.95); } }

.hidden-slot .card { opacity: 0.92; }
.hidden-slot::after {
  content: '?';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: calc(var(--w) * 0.42);
  color: rgba(200, 170, 110, 0.75);
  text-shadow: 0 2px 8px #000;
  pointer-events: none;
}

/* ------------------------------------------------------------ action bar -- */

.actionbar {
  flex: 0 0 auto;
  min-height: var(--bar-h);
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: 5px 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--gold-line);
  background: linear-gradient(180deg, rgba(20, 30, 54, 0.86), rgba(8, 13, 26, 0.9));
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}
.actionbar.over { border-color: var(--gold); box-shadow: 0 0 26px rgba(200, 170, 110, 0.3); }
.prompt {
  flex: 0 0 auto;
  font-size: 12.5px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 46%;
}
.prompt.yours { color: var(--gold-hi); font-weight: 600; }
.prompt.big { font-family: var(--font-display); font-size: 20px; color: var(--gold-hi); letter-spacing: 0.08em; }
.prompt.waiting { color: var(--ink-mute); }
.prompt-need { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-mute); border: 1px solid var(--gold-line); border-radius: 999px; padding: 1px 7px; }
.act-buttons { display: flex; align-items: center; gap: 7px; flex: 1 1 auto; flex-wrap: nowrap; overflow-x: auto; padding: 2px 0; scrollbar-width: thin; }
.pick-list { display: flex; gap: 5px; flex-wrap: wrap; max-width: 40%; }
.pick-list .chip { cursor: pointer; }

.spin { width: 13px; height: 13px; border-radius: 50%; border: 2px solid rgba(200, 170, 110, 0.25); border-top-color: var(--gold); animation: spin 0.9s linear infinite; display: inline-block; }
.spin.big { width: 30px; height: 30px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ hand -- */

.handzone {
  flex: 0 0 auto;
  height: var(--hand-h);
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-width: 0;
}
.fan { position: relative; width: 100%; height: 100%; }
.fan .empty-note { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.hand-card {
  position: absolute;
  bottom: 6px;
  transform: rotate(var(--rot, 0deg));
  transform-origin: bottom center;
  transition: transform var(--t-mid) var(--ease), box-shadow var(--t-mid) var(--ease), filter var(--t-mid);
  cursor: pointer;
}
.hand-card:hover { transform: translateY(-30px) rotate(0deg) scale(1.16); z-index: 200 !important; box-shadow: 0 22px 46px rgba(0, 0, 0, 0.85), 0 0 0 1px var(--gold-line-hi); }
.hand-card.playable { box-shadow: 0 0 0 2px var(--gold), 0 0 22px rgba(200, 170, 110, 0.6); }
.hand-card.picked { transform: translateY(-22px) rotate(0deg) scale(1.05); box-shadow: 0 0 0 3px var(--good), 0 0 26px rgba(87, 201, 138, 0.6); z-index: 190; }
.hand-card.targetable { box-shadow: 0 0 0 2px var(--info), 0 0 20px rgba(89, 167, 224, 0.55); }
.hand-card.blocked { cursor: not-allowed; }

/* Pointer motion moves one composited ghost; the authoritative card stays put. */
.table-root .card.drag-ready { touch-action: none; cursor: grab; }
.table-root .card.drag-ready:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 5px; }
.table-root .card.drag-origin { opacity: .3; }
.table-root.table-dragging { cursor: grabbing; user-select: none; }
.table-root .drag-candidate { outline: 2px dashed var(--gold); outline-offset: -3px; }
.table-root .drag-candidate::after {
  content: attr(data-drag-label); position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%); z-index: 10; pointer-events: none;
  background: #101c24; color: #f3efe5; border: 1px solid var(--gold);
  border-radius: 6px; padding: 7px 12px; font-size: 12px; white-space: nowrap;
}
.table-root .drag-over { outline-style: solid; outline-color: #a4f8d8; }
.table-root .drag-over::after { border-color: #a4f8d8; color: #a4f8d8; }
.table-drag-ghost.card {
  position: fixed; left: 0; top: 0; margin: 0; z-index: 1600; pointer-events: none;
  transform-origin: center; transition: none !important; animation: none !important;
  will-change: transform; box-shadow: 0 18px 35px #0009, 0 0 0 1px #cf9d72;
}
.table-drag-ghost.drop-valid { box-shadow: 0 18px 35px #0009, 0 0 0 2px #a4f8d8; }
.table-drag-hint {
  position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 1601; pointer-events: none;
  width: max-content; max-width: calc(100vw - 24px); padding: 8px 14px;
  border-radius: 7px; border: 1px solid #cf9d72; background: #080f14ee;
  color: #f3efe5; font-size: 13px; text-align: center;
}
@media (prefers-reduced-motion: reduce) {
  .table-root .card.drag-ready { transition: none; }
}
.hand-card.blocked::after {
  content: 'not scripted yet';
  position: absolute;
  left: 50%;
  bottom: 34%;
  transform: translateX(-50%);
  font-size: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(140, 30, 22, 0.92);
  color: #ffd9d3;
  border-radius: 3px;
  padding: 1px 5px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity var(--t-fast);
  pointer-events: none;
  z-index: 3;
}
.hand-card.blocked:hover::after { opacity: 1; }

.mini-fan { display: flex; align-items: flex-end; }
.mini-fan .card { margin-left: -7px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.7); }
.mini-fan .card:first-child { margin-left: 0; }

/* ------------------------------------------------------------------ side -- */

.side { grid-area: side; display: flex; flex-direction: column; gap: 6px; min-height: 0; min-width: 0; }
.statechips { display: flex; flex-wrap: wrap; gap: 5px; flex: 0 0 auto; }
.side-panel { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
/* The chain always gets its room when something is on it: the log yields, never the other way round. */
.chain-panel { flex: 0 0 auto; max-height: 46%; position: relative; z-index: 2; border-color: var(--gold-line-hi); box-shadow: 0 0 0 1px rgba(200, 170, 110, 0.12), 0 8px 24px rgba(0, 0, 0, 0.45); }
.chain-panel.collapsed { display: none; }
.chain-panel .panel-title { display: flex; align-items: center; gap: 8px; }
.log-panel { flex: 1 1 0; min-height: 72px; }
.chainbox { padding: 6px 8px 7px; display: flex; flex-direction: column; gap: 5px; }
.chain-row { display: flex; align-items: flex-end; justify-content: flex-start; gap: 8px; overflow-x: auto; overflow-y: hidden; padding: 4px 2px 2px; scrollbar-width: thin; }
.chain-card { --w: 58px; position: relative; flex: 0 0 auto; width: var(--w); display: flex; flex-direction: column; align-items: center; gap: 3px; opacity: 0.78; transition: opacity var(--t-mid), transform var(--t-mid) var(--ease); }
.chain-card .card { width: var(--w); height: calc(var(--w) * var(--card-ratio)); box-shadow: 0 0 0 1.5px var(--bad), 0 4px 12px rgba(0, 0, 0, 0.7); }
.chain-card.mine .card { box-shadow: 0 0 0 1.5px var(--good), 0 4px 12px rgba(0, 0, 0, 0.7); }
.chain-card.top { --w: 74px; opacity: 1; }
.chain-card.top .card { box-shadow: 0 0 0 2px var(--gold), 0 0 22px rgba(200, 170, 110, 0.55), 0 6px 18px rgba(0, 0, 0, 0.7); animation: chain-top 1.6s ease-in-out infinite; }
.chain-card.pending .card { filter: saturate(0.7) brightness(0.85); }
.chain-card .cc-n {
  position: absolute; left: -5px; top: -6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: linear-gradient(180deg, #e6cd97, #9b7833); color: #17110a; font-size: 9px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.7); z-index: 2;
}
.chain-card .cc-label { width: 100%; font-size: 9px; line-height: 1.15; color: var(--ink-soft); text-align: center; }
.chain-card.top .cc-label { color: var(--gold-hi); font-weight: 700; }
.chain-next { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--gold-hi); padding: 3px 6px; border-radius: 4px; background: rgba(200, 170, 110, 0.1); border: 1px solid var(--gold-line); }
.chain-next .cn-arrow { font-size: 9px; color: var(--gold); }
.chain-next .cn-text { min-width: 0; }
.prompt .chain-hint { color: var(--gold-hi); }
@keyframes chain-top {
  0%, 100% { box-shadow: 0 0 0 2px var(--gold), 0 0 14px rgba(200, 170, 110, 0.35), 0 6px 18px rgba(0, 0, 0, 0.7); }
  50% { box-shadow: 0 0 0 2px var(--gold-hi), 0 0 28px rgba(200, 170, 110, 0.75), 0 6px 18px rgba(0, 0, 0, 0.7); }
}
.log-line.warn .lx { color: #ffb4a8; font-weight: 700; }

.speeds { display: flex; gap: 3px; }
.speeds .sp.on { border-color: var(--gold); color: var(--gold-hi); background: rgba(200, 170, 110, 0.16); }
.logscroll { padding: 4px 8px 8px; font-size: 11.5px; line-height: 1.45; }
.log-line { display: flex; gap: 7px; padding: 1.5px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.03); }
.log-line .lt { color: var(--ink-mute); font-size: 10px; flex: 0 0 auto; opacity: 0.75; }
.log-line .lx { color: var(--ink-soft); min-width: 0; overflow-wrap: anywhere; }
.log-line.turn .lx { color: var(--gold-hi); font-weight: 700; }
.log-line.phase .lx { color: var(--ink-mute); font-style: italic; }
.log-line.play .lx { color: #cfe0ff; }
.log-line.attack .lx, .log-line.combat .lx { color: #ffcfa4; }
.log-line.damage .lx { color: #ff9d92; }
.log-line.death .lx { color: #e2584a; }
.log-line.score .lx { color: var(--gold); font-weight: 700; }
.log-line.rune .lx { color: #9fe0d0; }
.log-line.buff .lx { color: #b7f0c8; }
.log-line.ai .lx { color: var(--info); }

/* ---------------------------------------------------------- fx + captions -- */

.caption {
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: 0.09em;
  color: var(--gold-hi);
  background: linear-gradient(180deg, rgba(6, 10, 20, 0.9), rgba(6, 10, 20, 0.62));
  border: 1px solid var(--gold-line-hi);
  border-radius: 999px;
  padding: 7px 26px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.65), 0 0 40px rgba(200, 170, 110, 0.12);
  opacity: 0;
  transform: translateY(-10px) scale(0.96);
  transition: opacity 180ms var(--ease), transform 180ms var(--ease);
}
.caption.show { opacity: 1; transform: none; }
.caption.big { font-size: 24px; padding: 10px 34px; }
.caption.attack { border-color: var(--bad); color: #ffd3cc; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.65), 0 0 40px rgba(226, 88, 74, 0.3); }
.caption.score { border-color: var(--gold); color: #fff2cf; }
.caption.win { border-color: var(--gold); background: linear-gradient(180deg, rgba(60, 46, 18, 0.95), rgba(20, 15, 6, 0.85)); }

.fx-layer .ghost { position: absolute; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px var(--gold-line-hi); }
/* procedural sprites (sprites.js): one canvas per effect, positioned over its object */
.fx-layer canvas.sprite { position: absolute; pointer-events: none; }

/* ------------------------------------------------- the reveal: a card is played -- */

.fx-layer .ghost.reveal {
  --rift: var(--gold);
  overflow: hidden;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.9), 0 0 0 2px var(--gold-line-hi);
  transition: box-shadow 260ms var(--ease);
}
.fx-layer .ghost.reveal.lit { box-shadow: 0 30px 90px rgba(0, 0, 0, 0.9), 0 0 0 2px var(--gold-hi), 0 0 70px 6px color-mix(in srgb, var(--rift) 55%, transparent); }
.reveal-shine {
  position: absolute;
  inset: -40%;
  background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, 0.55) 48%, rgba(255, 255, 255, 0.1) 52%, transparent 60%);
  transform: translateX(-70%);
  opacity: 0;
  pointer-events: none;
}
.ghost.reveal.lit .reveal-shine { animation: reveal-shine 640ms var(--ease) forwards; }
@keyframes reveal-shine { 0% { opacity: 0; transform: translateX(-70%); } 15% { opacity: 1; } 100% { opacity: 0; transform: translateX(70%); } }
.reveal-name {
  position: absolute;
  transform: translate(-50%, 6px);
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.12em;
  color: var(--gold-hi);
  text-shadow: 0 2px 10px #000, 0 0 30px color-mix(in srgb, var(--rift, var(--gold)) 70%, transparent);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 220ms var(--ease), transform 220ms var(--ease);
  pointer-events: none;
}
.reveal-name.show { opacity: 1; transform: translate(-50%, 0); }
.reveal-name { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.reveal-who { font-family: var(--font-ui); font-size: 11px; letter-spacing: 0.08em; color: var(--ink-soft); text-shadow: 0 1px 6px #000; }

/* ------------------------------------------ showdown and combat openings -- */

.arena { position: absolute; inset: 0; pointer-events: none; z-index: 50; opacity: 0; transition: opacity 260ms var(--ease); }
.arena.go { opacity: 1; }
.arena.out { opacity: 0; }
/* The battlefield is printed landscape with its text box below the illustration: show the illustration only. */
.arena-art { position: absolute; inset: 0; background-size: 165% auto; background-position: center 22%; filter: brightness(0.5) saturate(1.1) blur(1px); transform: scale(1.06); transition: transform 1500ms var(--ease); -webkit-mask-image: radial-gradient(70% 60% at 50% 48%, #000 30%, transparent 100%); mask-image: radial-gradient(70% 60% at 50% 48%, #000 30%, transparent 100%); }
.arena.go .arena-art { transform: scale(1); }
.arena-bar { position: absolute; top: 44%; height: 12%; width: 50%; background: linear-gradient(90deg, transparent, var(--c) 40%, var(--c)); opacity: 0.55; transform: translateX(-100%); transition: transform 520ms cubic-bezier(0.2, 0.9, 0.2, 1); }
.arena-bar.left { left: 0; --c: rgba(87, 201, 138, 0.55); }
.arena-bar.right { right: 0; --c: rgba(226, 88, 74, 0.55); background: linear-gradient(270deg, transparent, var(--c) 40%, var(--c)); transform: translateX(100%); }
.arena.combat .arena-bar.left { --c: rgba(230, 178, 74, 0.6); }
.arena.go .arena-bar { transform: translateX(0); }
.arena-banner { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(0.9); text-align: center; opacity: 0; transition: transform 500ms var(--ease) 180ms, opacity 400ms var(--ease) 180ms; text-shadow: 0 3px 16px #000, 0 0 40px rgba(0, 0, 0, 0.9); }
.arena.go .arena-banner { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.arena-kind { font-family: var(--font-display); font-size: 40px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--gold-hi); }
.arena.combat .arena-kind { color: #ffd3cc; }
.arena-name { font-family: var(--font-display); font-size: 20px; letter-spacing: 0.12em; color: var(--ink); margin-top: 2px; }
.arena-focus { font-size: 12px; letter-spacing: 0.08em; color: var(--ink-soft); margin-top: 8px; }

/* ------------------------------------------------------------ table talk -- */

.emote-bar { display: flex; gap: 3px; }
.emote-bar .emote { font-size: 13px; padding: 1px 6px; }
.emote-bubble {
  position: absolute; transform: translate(-50%, 0) scale(0.6); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  background: rgba(8, 13, 26, 0.94); border: 1px solid var(--gold-line-hi); box-shadow: 0 14px 40px rgba(0, 0, 0, 0.7), 0 0 30px rgba(200, 170, 110, 0.18);
  transition: transform 420ms cubic-bezier(0.2, 1.3, 0.3, 1), opacity 300ms var(--ease);
}
.emote-bubble.go { opacity: 1; transform: translate(-50%, -40px) scale(1); }
.emote-bubble .emote-icon { font-size: 26px; }
.emote-bubble .emote-label { font-family: var(--font-display); font-size: 13px; letter-spacing: 0.1em; color: var(--gold-hi); }

/* ------------------------------------ options beside the card, decisions on the board -- */

.ctx-menu {
  position: fixed; z-index: 930; min-width: 190px; max-width: 260px; padding: 6px;
  background: rgba(8, 13, 26, 0.97); border: 1px solid var(--gold-line-hi); border-radius: var(--r-md);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.8); opacity: 0; transform: translateY(4px) scale(0.98); transition: opacity 140ms var(--ease), transform 140ms var(--ease);
}
.ctx-menu.show { opacity: 1; transform: none; }
.ctx-menu .cm-title { font-family: var(--font-display); font-size: 11px; letter-spacing: 0.14em; color: var(--gold); padding: 4px 8px 6px; border-bottom: 1px solid var(--gold-line); margin-bottom: 4px; }
.ctx-menu .cm-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: transparent; border: 0; border-radius: 6px; padding: 7px 8px; color: var(--ink); font: inherit; cursor: pointer; }
.ctx-menu .cm-item:hover, .ctx-menu .cm-item:focus-visible { background: rgba(200, 170, 110, 0.14); outline: none; }
.ctx-menu .cm-icon { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: linear-gradient(180deg, #e6cd97, #9b7833); color: #17110a; font-size: 12px; flex: 0 0 auto; }
.ctx-menu .cm-text { display: flex; flex-direction: column; min-width: 0; }
.ctx-menu .cm-label { font-weight: 600; font-size: 12px; }
.ctx-menu .cm-hint { font-size: 10px; color: var(--ink-mute); }

.decision-layer { position: absolute; inset: calc(var(--top) + 12px) calc(var(--side) + 6px) calc(var(--bar-h) + var(--hand-h) + 18px) calc(var(--rail) + 6px); z-index: 25; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.decision-layer[hidden] { display: none; }
/* target and location picks sit low, so the board above stays open for clicking */
.decision-layer.low { align-items: flex-end; }

/* ------------------------------------------------ the choice window -- */

.choice-win {
  pointer-events: auto; display: flex; flex-direction: column; width: min(900px, 100%); max-height: 100%; min-height: 0;
  background: rgba(8, 13, 26, 0.965); border: 1px solid var(--gold); border-radius: var(--r-lg);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.8), 0 0 50px rgba(200, 170, 110, 0.18); animation: modal-in 220ms var(--ease); overflow: hidden;
}
.choice-win:not(.picking) { width: min(680px, 100%); }
.choice-win.collapsed .cw-body, .choice-win.collapsed .cw-foot { display: none; }
.choice-win.collapsed { width: min(560px, 100%); }
.cw-head { display: flex; align-items: center; gap: 12px; padding: 9px 14px; border-bottom: 1px solid var(--gold-line); flex: 0 0 auto; background: linear-gradient(180deg, rgba(200, 170, 110, 0.08), transparent); }
.choice-win.collapsed .cw-head { border-bottom: 0; }
.cw-head .card { flex: 0 0 auto; }
.cw-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 auto; }
.cw-source { font-family: var(--font-display); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); }
.cw-prompt { font-size: 14px; color: var(--ink); line-height: 1.35; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cw-need { color: var(--gold-hi); border-color: var(--gold-line-hi); }
.cw-collapse { flex: 0 0 auto; }
.cw-body { min-height: 0; padding: 8px 14px 10px; display: flex; flex-direction: column; gap: 10px; }
.cw-group { display: flex; flex-direction: column; gap: 5px; }
.cw-group-label { display: flex; align-items: center; gap: 6px; font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-mute); }
.cw-group-label .cw-count { color: var(--gold); letter-spacing: 0; }
.cw-cards { display: flex; flex-wrap: wrap; gap: 8px 10px; }
.cw-item { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 92px; min-width: 0; }
.cw-name { width: 100%; font-size: 10px; line-height: 1.2; color: var(--ink-soft); text-align: center; }
.cw-buff-controls { flex-wrap: nowrap; gap: 4px; }
.cw-buff-controls .num { white-space: nowrap; }
.cw-sub { font-size: 9px; color: var(--ink-mute); letter-spacing: 0.08em; text-transform: uppercase; }
.cw-item .card { transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.cw-item .card.clickable:hover { transform: translateY(-3px) scale(1.03); }
.cw-item .card.picked { transform: none; box-shadow: 0 0 0 3px var(--good), 0 0 22px rgba(87, 201, 138, 0.6); }
.cw-item .card.picked::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: rgba(87, 201, 138, 0.14); pointer-events: none; }
.cw-opt.focus { outline: 2px solid var(--gold-hi); outline-offset: 3px; }
.cw-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 14px; border-top: 1px solid var(--gold-line); flex: 0 0 auto; }
.cw-picks { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }
.cw-picks .chip { cursor: pointer; }
.cw-buttons { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
/* modes: the full text of each mode, numbered */
.cw-modes { display: flex; flex-direction: column; gap: 6px; }
.cw-mode { display: flex; align-items: flex-start; gap: 10px; text-align: left; white-space: normal; line-height: 1.45; padding: 9px 12px; font: inherit; font-size: 13px; color: var(--ink); background: rgba(20, 30, 54, 0.7); border: 1px solid var(--gold-line); border-radius: var(--r-md); cursor: pointer; transition: border-color var(--t-fast), background var(--t-fast); }
.cw-mode:hover, .cw-mode.focus { border-color: var(--gold); background: rgba(200, 170, 110, 0.12); }
.cw-mode-n { flex: 0 0 auto; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: linear-gradient(180deg, #e6cd97, #9b7833); color: #17110a; font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.cw-mode-text { min-width: 0; }
/* may-questions: the effect text, then yes / no */
.cw-may-text { font-size: 14px; line-height: 1.5; color: var(--ink); }
.cw-card-text { font-size: 11.5px; line-height: 1.5; color: var(--ink-soft); white-space: pre-wrap; max-height: 130px; overflow: auto; padding: 8px 10px; border: 1px solid var(--gold-line); border-radius: var(--r-md); background: rgba(5, 9, 18, 0.5); }
.cw-yesno { display: flex; gap: 8px; }
/* locations: the battlefield's illustration and name */
.cw-locs { display: flex; flex-wrap: wrap; gap: 10px; }
.cw-loc { position: relative; width: 196px; height: 108px; padding: 0; border-radius: var(--r-md); border: 1px solid var(--gold-line-hi); overflow: hidden; background: var(--navy-800); cursor: pointer; transition: transform var(--t-fast) var(--ease), border-color var(--t-fast), box-shadow var(--t-fast); }
.cw-loc:hover, .cw-loc.focus { transform: translateY(-2px); border-color: var(--gold); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 18px rgba(200, 170, 110, 0.35); }
.cw-loc-art { position: absolute; inset: 0; background-size: 165% auto; background-position: center 36%; filter: brightness(0.62) saturate(1.05); transition: filter var(--t-fast); }
.cw-loc-art.base { background-size: 160%; background-position: center 18%; filter: brightness(0.5) saturate(0.85); }
.cw-loc:hover .cw-loc-art { filter: brightness(0.8); }
.cw-loc-idx { position: absolute; left: 7px; top: 6px; font-size: 10px; font-weight: 800; color: #17110a; background: var(--gold); border-radius: 3px; padding: 0 5px; }
.cw-loc-flag { position: absolute; right: 7px; top: 6px; font-size: 8px; letter-spacing: 0.12em; text-transform: uppercase; padding: 1px 5px; border-radius: 3px; border: 1px solid currentColor; background: rgba(4, 8, 16, 0.7); }
.cw-loc-flag.ours { color: var(--good); }
.cw-loc-flag.theirs { color: #ff9d92; }
.cw-loc-name { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 9px 7px; background: linear-gradient(180deg, transparent, rgba(3, 6, 14, 0.92)); font-family: var(--font-display); font-size: 12px; color: var(--gold-hi); text-align: left; text-shadow: 0 1px 4px #000; }

/* the board copies of the window's candidates */
.bf.targetable-tile { cursor: pointer; outline: 2px solid var(--info); outline-offset: -3px; box-shadow: 0 0 22px rgba(89, 167, 224, 0.4); }
.bf.targetable-tile:hover { outline-color: #9fd6ff; }
.bf.picked-tile { outline-color: var(--good); box-shadow: 0 0 24px rgba(87, 201, 138, 0.5); }
.plate.targetable { cursor: pointer; border-color: var(--info); box-shadow: 0 0 0 1px var(--info), 0 0 22px rgba(89, 167, 224, 0.35); }
.plate.targetable:hover { border-color: #9fd6ff; }
.plate.picked { border-color: var(--good); box-shadow: 0 0 0 1px var(--good), 0 0 24px rgba(87, 201, 138, 0.45); }

/* ------------------------------------------------ the board's ambient light -- */

.board { position: relative; --rift: var(--gold); }
.board.in-showdown { --rift: var(--warn); }
.board.in-combat { --rift: var(--bad); }
/* the battlefields carry the light on their frames (their backgrounds are opaque) */
.board .bf:not(.showdown):not(.combat) { box-shadow: 0 0 28px -6px color-mix(in srgb, var(--rift) 70%, transparent), inset 0 0 40px -30px color-mix(in srgb, var(--rift) 60%, transparent); transition: box-shadow 900ms var(--ease), border-color var(--t-mid); }
.rift-glow {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  border-radius: var(--r-lg);
  background:
    radial-gradient(60% 46% at 50% 50%, color-mix(in srgb, var(--rift) 22%, transparent), transparent 70%),
    linear-gradient(90deg, transparent 0%, color-mix(in srgb, var(--rift) 30%, transparent) 50%, transparent 100%) center / 100% 2px no-repeat;
  opacity: 0.9;
  transition: background 900ms var(--ease), opacity 600ms var(--ease);
}
.rift-glow.showdown { --rift: var(--warn); }
.rift-glow.combat { --rift: var(--bad); animation: rift-breathe 1.4s ease-in-out infinite; }
@keyframes rift-breathe { 0%, 100% { opacity: 0.7; } 50% { opacity: 1; } }
.board > *:not(.rift-glow) { position: relative; z-index: 1; }

/* ------------------------------------------------------------- the clash -- */

.clash {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 18px;
  pointer-events: none;
  font-family: var(--font-display);
}
.clash-side { display: flex; flex-direction: column; align-items: center; opacity: 0; transition: transform var(--d, 900ms) cubic-bezier(0.2, 1.2, 0.3, 1), opacity 200ms var(--ease); }
.clash-side.mine { transform: translateX(-160px) scale(0.6); }
.clash-side.theirs { transform: translateX(160px) scale(0.6); }
.clash.go .clash-side { opacity: 1; transform: translateX(0) scale(1); }
.clash-num { font-size: 46px; font-weight: 700; line-height: 1; color: #fff; text-shadow: 0 3px 10px #000, 0 0 26px currentColor; }
.clash-side.mine .clash-num { color: #9df0bd; }
.clash-side.theirs .clash-num { color: #ff9d92; }
.clash-who { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-soft); margin-top: 4px; }
.clash-x { font-size: 30px; color: var(--gold-hi); text-shadow: 0 0 22px var(--gold); opacity: 0; transform: scale(0.3); transition: transform 300ms cubic-bezier(0.2, 1.4, 0.3, 1) 260ms, opacity 200ms 260ms; }
.clash.go .clash-x { opacity: 1; transform: scale(1); }

/* ------------------------------------------------- the path to victory -- */

.vp { width: 10px; height: 10px; border-radius: 2px; transform: rotate(45deg); border: 1px solid rgba(200, 170, 110, 0.45); background: rgba(0, 0, 0, 0.45); transition: all var(--t-mid); }
.vp.on { --c: var(--gold); background: radial-gradient(circle at 35% 30%, #fff 0%, var(--c) 45%, color-mix(in srgb, var(--c) 55%, #000) 100%); border-color: #fff4d6; box-shadow: 0 0 9px var(--c); }
.vp.dom-fury.on { --c: var(--d-fury); } .vp.dom-calm.on { --c: var(--d-calm); } .vp.dom-mind.on { --c: var(--d-mind); }
.vp.dom-body.on { --c: var(--d-body); } .vp.dom-chaos.on { --c: var(--d-chaos); } .vp.dom-order.on { --c: var(--d-order); }
.vp.last { width: 12px; height: 12px; border-color: var(--gold); }
.vp.last:not(.on) { animation: last-socket 2.6s ease-in-out infinite; }
@keyframes last-socket { 0%, 100% { box-shadow: none; } 50% { box-shadow: 0 0 8px rgba(200, 170, 110, 0.7); } }
.float-num {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: var(--font-num);
  font-size: 22px;
  font-weight: 800;
  text-shadow: 0 2px 6px #000, 0 0 14px currentColor;
  animation: float-up 900ms var(--ease) forwards;
  pointer-events: none;
}
.float-num.dmg { color: #ff6b5c; }
.float-num.buff { color: #7ce6a0; }
.float-num.score { color: var(--gold-hi); font-family: var(--font-display); font-size: 19px; }
.float-num.xp { color: #9fd0ff; font-size: 16px; }
@keyframes float-up {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.7); }
  22% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -160%) scale(1); }
}
.burst {
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid var(--gold);
  animation: burst-out 620ms var(--ease) forwards;
  pointer-events: none;
}
.burst.hit { border-color: #ff6b5c; }
.burst.death { border-color: #ff8a7a; box-shadow: 0 0 40px rgba(255, 120, 100, 0.55); }
.burst.rune { border-color: #7fe6d4; }
.burst.spell { border-color: #9fb4ff; }
.burst.showdown, .burst.clash { border-color: var(--warn); }
.burst.control { border-color: var(--gold-hi); }
@keyframes burst-out {
  0% { opacity: 0.95; transform: translate(-50%, -50%) scale(0.25); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.9); }
}

.fx-enter { animation: fx-enter 620ms var(--ease); }
@keyframes fx-enter { 0% { filter: brightness(2.4); } 100% { filter: none; } }
.fx-hit { animation: fx-hit 420ms var(--ease); }
@keyframes fx-hit { 0%, 100% { transform: none; } 25% { transform: translateX(-4px) rotate(-2deg); } 60% { transform: translateX(4px) rotate(2deg); } }
.fx-rune { animation: fx-rune 700ms var(--ease); }
@keyframes fx-rune { 0% { filter: brightness(2.6) saturate(1.6); } 100% { filter: none; } }
.fx-tap { animation: fx-tap 380ms var(--ease); }
@keyframes fx-tap { 0%, 100% { filter: none; } 40% { filter: brightness(1.7); } }
.fx-stun { animation: fx-stun 600ms var(--ease); }
@keyframes fx-stun { 0%, 100% { filter: none; } 50% { filter: brightness(1.6) hue-rotate(180deg); } }
.fx-buff { animation: fx-rune 700ms var(--ease); }
.fx-pool { animation: fx-pool 700ms var(--ease); }
@keyframes fx-pool { 0%, 100% { transform: none; } 40% { transform: scale(1.12); } }
.fx-score { animation: fx-score 900ms var(--ease); }
@keyframes fx-score { 0%, 100% { transform: none; } 30% { transform: scale(1.35); filter: brightness(1.8); } }

/* ------------------------------------------------------------- waiting UI -- */

.wait-screen { height: 100dvh; display: flex; align-items: center; justify-content: center; padding: var(--s5); }
.wait-panel { width: min(520px, 92vw); }
.wait-spin { display: flex; justify-content: center; padding: var(--s4) 0 var(--s2); }

/* --------------------------------------------------------- narrow screens -- */

@media (max-width: 1400px) { .table { --rail: 194px; --side: 262px; } }
@media (max-width: 1180px) { .table { --rail: 176px; --side: 232px; } }
@media (max-width: 1020px) {
  .table { --side: 0px; grid-template-columns: var(--rail) minmax(0, 1fr); grid-template-areas: 'top top' 'rail center'; }
  .side { display: none; }
}
/* Keep the playable board inside a phone viewport. The full-width rune strip
   previously displaced the base outside the screen, making touch moves impossible. */
@media (max-width: 640px) {
  .table { --rail: 84px; --rune-strip: 62px; --hand-h: 112px; --top: 44px; }
  .table .topbar { grid-template-columns: minmax(0, 1fr) auto; gap: 4px; padding: 0 5px; }
  .table .brand, .table .phase-strip, .table .emote-bar { display: none; }
  .table .top-mid { justify-content: flex-start; }
  .table .turn-label { flex-direction: column; align-items: flex-start; gap: 0; font-size: 10px; white-space: normal; }
  .table .tl-sep, .table .score-name, .table .score-max { display: none; }
  .table .top-right { gap: 4px; }
  .table .score { padding: 1px 6px; }
  .table .top-right .btn { padding: 6px; min-height: 34px; font-size: 10px; }
  .table .plate { padding: 5px; gap: 4px; }
  .table .plate-name { font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .table .plate-tag { display: none; }
  .table .plate-score { gap: 4px; }
  .table .ps-num { font-size: 17px; }
  .table .pips-row { gap: 3px; }
  .table .vp, .table .vp.last { width: 6px; height: 6px; }
  .table .plate-heroes { --hero-w: 44px; flex-direction: column; align-items: center; gap: 3px; }
  .table .hero-label { font-size: 6px; }
  .table .pool { gap: 3px; }
  .table .pool-energy { padding: 0 5px; }
  .table .plate-pool.big .pool-energy .num { font-size: 14px; }
  .table .pool-power { gap: 3px; }
  .table .pchip { padding: 0 3px; gap: 2px; }
  .table .plate-pool.big .pchip b, .table .pchip i { font-size: 10px; }
  .table .plate-stacks { gap: 4px; flex-wrap: wrap; }
  .table .plate-stacks .stack, .table .plate-stacks .card { --w: 24px !important; }
  .table .plate-stacks .stack-label { font-size: 6px; letter-spacing: 0; }
  .table .hand-count { flex-direction: row; font-size: 10px; }
  .table .zone { padding: 3px; }
  .table .zone-label { gap: 3px; font-size: 7px; letter-spacing: 0.05em; }
  .table .bf-head { flex-wrap: wrap; gap: 3px; padding: 3px; }
  .table .bf-name { font-size: 9px; }
  .table .bf-flag { font-size: 6px; padding: 0 3px; }
  .table .actionbar { padding: 4px; gap: 5px; }
  .table .prompt { font-size: 10px; max-width: 38%; }
  .table .act-buttons { gap: 4px; }
  .table .act-buttons .btn { font-size: 10px; padding: 6px; min-height: 34px; }
  .table .actionbar.hiding { flex-direction: column; align-items: stretch; gap: 2px; }
  .table .actionbar.hiding .prompt { display: block; max-width: none; }
  .table .actionbar.hiding .act-buttons { flex-shrink: 0; flex-wrap: wrap; overflow: visible; }
  .table .decision-layer { left: 6px; }
  .table .cw-head, .table .cw-body, .table .cw-foot { padding: 8px; }
  .table .cw-prompt { font-size: 12px; }
  .table .cw-loc { width: min(160px, calc((100vw - 52px) / 2)); height: 90px; }
}
@media (max-height: 640px) {
  .table { --hand-h: 96px; }
  .plate-champ, .stack-label { display: none; }
}

.card .mark.buffed { top:40%; color:var(--gold-hi); border-color:var(--gold); font-size:11px; min-width:23px; }
