:root {
  color-scheme: dark;
  --ink:#0c1019; --panel:#182331; --line:#485666; --text:#ece5d6; --muted:#b4c0c5;
  --amber:#f4c876; --cyan:#79e8d7; --orange:#f2a17d;
  --mono:"IBM Plex Mono",ui-monospace,"Courier New",monospace;
  --sans:"Barlow Condensed","Arial Narrow",system-ui,sans-serif;
  --metal:linear-gradient(180deg,#354456 0%,#222d3d 18%,#192331 80%,#111a26);
}
* { box-sizing:border-box; }
[hidden] { display:none !important; }
body {
  margin:0; min-width:320px; font:16px/1.45 var(--sans); color:var(--text);
  background:radial-gradient(ellipse at 50% 35%,#202b3b,#0c111b 75%); min-height:100svh;
}
button,select { font:inherit; color:inherit; }
button,a,select,summary { touch-action:manipulation; }
button,a { -webkit-tap-highlight-color:transparent; }
button { cursor:pointer; }
button:disabled { cursor:default; opacity:.5; }
:focus-visible { outline:3px solid #89eee6; outline-offset:2px; }
a { color:inherit; }
.demo-shell { --gutter:clamp(4px,.8vmin,10px); margin:auto; padding:var(--gutter); }
.game-screen { overflow:clip; border:1px solid #657285; background:#111923;
  box-shadow:0 0 0 2px #0a0e15,0 14px 44px #03070c80; }
.match-bar,.command-tray,.table-tools { background:var(--metal); }
.match-bar {
  position:relative; z-index:3; display:grid; grid-template-columns:1fr auto 1fr; align-items:center;
  gap:12px; min-height:46px; padding:0 clamp(10px,1.7vw,26px);
  border-top:2px solid #73808c; border-bottom:3px ridge #495566; box-shadow:0 3px 6px #05080d99;
}
.match-brand,.match-bar nav { display:flex; align-items:center; gap:clamp(10px,1.8vw,27px); }
.wordmark,.turn-plaque,.seat-info>strong,.command-primary,#practice-resources {
  font-family:var(--mono); font-weight:900; text-transform:uppercase;
}
.wordmark { text-decoration:none; color:#ffda94; font-size:clamp(18px,2vw,30px); letter-spacing:.055em; white-space:nowrap; text-shadow:2px 2px #04080d; }
.match-brand h1 { margin:0; padding-left:14px; border-left:1px solid #657284; font:700 13px/1.15 var(--mono); text-transform:uppercase; color:#d5c7ad; }
.turn-plaque {
  display:flex; gap:10px; align-items:center; padding:5px 16px; color:#ffdb8f;
  border:1px solid #ad8c5b; border-radius:3px; box-shadow:inset 0 0 0 2px #352c24,0 0 0 2px #0e131d;
  background:linear-gradient(#3f362e,#292622); text-shadow:1px 2px #18130f;
}
.turn-plaque span { color:#dfc093; font-size:12px; }
.turn-plaque strong { font-size:clamp(14px,1.5vw,21px); line-height:1.05; letter-spacing:.015em; }
.match-bar nav { justify-self:end; gap:4px; }
.match-bar nav :is(button,a),.table-tools button,.hand-caption button {
  border:1px solid transparent; background:transparent; color:#d4d9d8; padding:0 9px;
  display:inline-grid; place-items:center; min-height:36px; font:600 14px/1 var(--sans); text-decoration:none;
}
.match-bar nav :is(button,a):hover,.table-tools button:hover,.hand-caption button:enabled:hover { background:#394453; color:#ffe4ae; }
.arena {
  isolation:isolate; position:relative; padding-top:44px;
  background:radial-gradient(ellipse at 50% 62%,#313440 0%,#19202c 52%,transparent 78%),
    repeating-linear-gradient(132deg,#ffffff03 0 1px,transparent 1px 4px),#0e1520;
}
.player-row {
  position:absolute; z-index:2; top:10px; left:clamp(6px,1vw,16px); right:clamp(6px,1vw,16px);
  display:grid; grid-template-columns:minmax(0,1fr) auto minmax(0,1fr); align-items:start; gap:8px; pointer-events:none;
}
.player-plate {
  --rim:var(--cyan); color:var(--rim); display:flex; align-items:center; gap:10px;
  width:fit-content; max-width:100%; padding:5px 14px 7px 8px; border:1px solid var(--rim);
  border-radius:3px 10px 3px 10px; box-shadow:inset 0 0 0 2px #24343e,0 2px 3px #080b12;
  background:linear-gradient(120deg,#14242d,#101820 75%);
}
.player-two { --rim:var(--orange); justify-self:end; flex-direction:row-reverse; text-align:right; border-radius:10px 3px 10px 3px; padding:5px 8px 7px 14px; background:linear-gradient(240deg,#302320,#151b24 75%); }
.hq-portrait { width:clamp(30px,4vw,57px); height:auto; image-rendering:pixelated; filter:drop-shadow(2px 2px 0 #02060b); }
.seat-info { min-width:0; }
.seat-info>strong { font-size:clamp(15px,1.6vw,23px); line-height:1; letter-spacing:.065em; }
.player-plate[data-active] .seat-info>strong::after { content:""; display:inline-block; margin-left:8px; width:7px; height:7px; border-radius:50%; background:currentColor; vertical-align:middle; }
.seat-info>span { display:block; color:#d7d4c8; font:500 13px/1.3 var(--sans); }
.hq-health { margin-top:3px; display:flex; gap:7px; align-items:center; }
.hq-health b { white-space:nowrap; font:700 13px/1.1 var(--mono); }
.hq-health i { position:relative; display:block; width:clamp(33px,5.4vw,86px); height:9px; background:#344038; border:1px solid #060b0d; }
.hq-health i::after { content:""; position:absolute; inset:0; background:repeating-linear-gradient(90deg,#a0d96e 0 7px,#344535 7px 9px); clip-path:inset(0 calc(100% - var(--hp,100%)) 0 0); }
.opponent-hand { display:flex; justify-content:center; padding:0 6px; }
.opponent-hand i { display:block; position:relative; width:23px; height:32px; margin-left:-8px; transform:skewX(-5deg);
  border:1px solid #d9aa6c; border-radius:2px; box-shadow:inset 0 0 0 2px #322822,0 2px 1px #080c13;
  background:repeating-linear-gradient(45deg,#47372e 0 2px,#73513c 2px 3px,#46342b 3px 6px); }
.opponent-hand i:first-child { margin-left:0; }
.opponent-hand i::after { content:""; position:absolute; inset:28% 26%; border:1px solid #e0ac70; transform:rotate(45deg); background:#302820; }
.board-stage { position:relative; width:100%; min-width:0; }
.board-viewport { position:absolute; inset:0; overflow:auto; scrollbar-width:none; touch-action:pan-x pan-y; overscroll-behavior-x:contain; overflow-anchor:none; }
.board-viewport::-webkit-scrollbar { display:none; }
#battlefield { display:block; width:calc(var(--board-fit-width,100%) * var(--board-zoom,1)); height:auto; margin-inline:auto; image-rendering:pixelated; cursor:pointer; touch-action:pan-x pan-y; }
.board-viewport.zoomed-in #battlefield { cursor:grab; }
.board-viewport.zoomed-in #battlefield:active { cursor:grabbing; }
#board-viewport #battlefield.repositioning { cursor:crosshair; }
.board-loading { position:absolute; top:40%; left:50%; transform:translate(-50%,-50%); color:var(--amber); background:#101823e8; padding:10px 14px; }
.hand-section { position:relative; z-index:2; }
.command-tray {
  display:grid; grid-template-columns:minmax(132px,16%) minmax(0,1fr) minmax(150px,18%);
  grid-template-areas:"purse hand commands"; align-items:center; gap:clamp(6px,1.4vw,24px); position:relative;
  padding:0 clamp(10px,1.6vw,23px); border-top:3px ridge #78828a; border-bottom:2px solid #0b101a;
  box-shadow:inset 0 1px #86919c44,inset 0 -2px #465360;
}
.resource-panel { grid-area:purse; }
#practice-resources { display:grid; gap:4px; margin:0; }
#practice-resources>div { display:flex; align-items:center; justify-content:space-between; padding:2px 9px; border:1px solid #907856; border-radius:3px;
  background:linear-gradient(90deg,#292722,#181a1f); color:#f5cc7f; box-shadow:inset 0 0 0 2px #25272b,0 1px #080d15; }
#practice-resources dt { display:flex; align-items:center; gap:8px; font-size:clamp(14px,1.25vw,19px); }
#practice-resources dd { margin:0; font-size:clamp(14px,1.4vw,21px); line-height:1.2; }
#practice-resources abbr { text-decoration:none; }
.resource-mark { display:inline-block; width:20px; height:20px; flex:none; background:transparent center / contain no-repeat; }
.value-mark { background-image:url("./assets/isometric-demo/resource-value.png"); }
.bio-mark { background-image:url("./assets/isometric-demo/resource-bio.png"); }
.art-mark { background-image:url("./assets/isometric-demo/resource-art.png"); }
.hand-dock { grid-area:hand; min-width:0; align-self:end; position:relative; margin-top:-16px; }
.hand { --card-w:clamp(92px,11.8vw,154px); --spread:min(calc(100% - var(--card-w) - 20px),var(--max-spread));
  position:relative; height:clamp(104px,14vh,137px); overflow:clip; isolation:isolate; container-type:size; }
.hand-card {
  position:absolute; left:calc(50% + var(--spread) * var(--fan-position)); top:calc(7px + var(--arc));
  width:var(--card-w); aspect-ratio:1600/2235; transform:translateX(-50%) rotate(var(--tilt)); transform-origin:50% 30%;
  padding:0; border:0; border-radius:5px; overflow:hidden; background:#1b2633; color:var(--text);
  box-shadow:0 0 0 1px #111820,2px 2px 5px #000a;
  user-select:none; -webkit-touch-callout:none; touch-action:none; cursor:grab;
}
.hand-card:hover,.hand-card:focus-visible,.hand-card[aria-expanded=true] { z-index:2; transform:translate(-50%,-4px) rotate(0deg); }
.hand-card[aria-expanded=true] { outline:2px solid #ffcc73; }
.hand-art-fallback { position:absolute; inset:3px 5px auto; text-align:left; font:700 14px/1.1 var(--sans); }
.hand-card-face { position:absolute; inset:0; display:block; width:100%; height:100%; object-fit:contain; object-position:top; pointer-events:none; }
.hand-card.landscape-card {
  --landscape-w:min(var(--card-w),62.5cqh); --face-angle:-90deg;
  width:var(--landscape-w); top:50%; overflow:visible;
  transform:translate(-50%,-50%) rotate(clamp(-8deg,var(--tilt),8deg)); transform-origin:center;
}
.hand-card[data-edge=right] { --face-angle:90deg; }
.landscape-card .hand-card-face {
  inset:50% auto auto 50%; width:calc(var(--landscape-w) * 2235 / 1600); height:var(--landscape-w);
  border-radius:inherit; object-position:center; transform:translate(-50%,-50%) rotate(var(--face-angle));
}
.landscape-card .hand-cost { top:auto; bottom:6px; left:-6px; }
.landscape-card[data-edge=right] .hand-cost { left:auto; right:-6px; }
.hand-caption { display:flex; align-items:center; justify-content:center; gap:5px; min-height:28px; color:#e7d1a5; }
.hand-caption h2,.hand-count { font:600 13px/1.2 var(--mono); margin:0; white-space:nowrap; }
.hand-caption h2 { margin-right:4px; }
.hand-caption button { font-size:23px; width:34px; min-height:28px; color:var(--amber); }
.hand-count { color:#d7c7a9; }
.command-panel { grid-area:commands; align-self:center; min-width:0; padding:6px 0; }
.command-panel .button,.selection-actions .button,.occupant-chip,.reset-button,.model-menu .button { min-height:36px; padding:6px 10px; border:1px solid #546576; border-radius:3px; background:#202e3c; color:var(--text); font:650 14px/1.18 var(--sans); }
.button:enabled:hover,.occupant-chip:enabled:hover { filter:brightness(1.23); }
.command-panel .button { width:100%; }
.command-panel .command-primary { min-height:50px; color:#ffe098; font:800 clamp(17px,1.7vw,25px)/1.15 var(--mono); text-transform:uppercase; letter-spacing:.03em;
  background:linear-gradient(#72512c,#49321e 56%,#3a291d); border:2px solid #d5aa67; border-radius:5px; text-shadow:1px 2px #301c10;
  box-shadow:inset 0 0 0 2px #342722,inset 0 0 0 3px #a77e48,0 2px 1px #0a0f17; }
.command-heading,.preview-header,.preview-navigation,.dialog-header { display:flex; align-items:center; gap:8px; }
.command-heading strong,.preview-header h3 { flex:1; color:var(--amber); font-weight:750; line-height:1.15; }
.command-heading button,.preview-close,.preview-navigation button,.dialog-close,.model-menu header button {
  background:transparent; color:var(--text); border:0; min-width:34px; min-height:34px; font-size:22px; }
#board-actions,#model-abilities,#unit-commands,.turn-controls,.action-options { display:grid; gap:3px; }
.action-options { max-height:170px; overflow:auto; }
.command-panel small,.model-menu small { display:block; margin:3px 0; font-size:13px; color:#cdcaba; line-height:1.3; }
.command-panel small:empty,.model-menu small:empty,.unavailable-action span,#action-note:empty { display:none; }
#inspect-selected,#model-inspect { color:var(--cyan); }
.hand-preview { position:absolute; z-index:5; bottom:calc(100% + 6px); left:50%; transform:translateX(-50%);
  display:grid; grid-template-columns:minmax(100px,.85fr) minmax(155px,1.15fr); gap:12px; align-items:center; width:min(460px,calc(100% - 12px));
  padding:10px; background:#111c27fa; border:2px solid #c49f6e; border-radius:5px; box-shadow:0 0 0 2px #111722,0 4px 22px #070b14bb;
  max-height:62dvh; overflow:auto; }
.hand-preview.landscape-options { width:min(350px,calc(100% - 12px)); grid-template-columns:minmax(0,1fr); }
.hand-preview.dragging-from-hand { visibility:hidden; }
.preview-art { padding:0; border:0; background:transparent; cursor:zoom-in; }
.preview-art img { width:100%; max-height:242px; object-fit:contain; display:block; }
#preview-fallback { display:block; padding:8px; max-height:185px; overflow:auto; background:#e4cfa7; color:#26221e; white-space:pre-line; text-align:left; font-size:13px; }
.preview-header h3 { margin:0; font-size:21px; }
#npk-sprite-preview { width:auto; height:74px; margin:7px 0; image-rendering:pixelated; }
.held-equipment { display:flex; flex-wrap:wrap; align-items:center; gap:6px; width:100%; margin:5px 0 9px; padding:8px; border:1px solid #667884; border-radius:6px; background:#101d29; }
.held-equipment>strong { width:100%; font-size:14px; color:#f8d18a; }
.held-equipment .held-item { display:flex; align-items:center; gap:7px; padding:6px 9px; font-size:14px; }
.held-item img { width:34px; height:29px; object-fit:contain; image-rendering:pixelated; }
.equipment-attack-detail { display:block; max-width:240px; margin-top:5px; font-size:13px; font-weight:normal; line-height:1.35; }
.equip-targets { display:flex; flex-wrap:wrap; gap:6px; margin:7px 0; }
.equip-targets>strong { width:100%; }
.preview-navigation { margin-top:5px; color:var(--muted); font:13px var(--mono); }
.preview-navigation button { border:1px solid #455565; }
.selection-actions,.deploy-spaces { display:flex; flex-wrap:wrap; gap:5px; }
.deploy-spaces strong { width:100%; color:var(--amber); }
#deployment-options { margin-top:7px; font-size:14px; }
.zone-control { width:100%; margin:0 0 3px; }
.dragged-card { position:fixed; top:0; left:0; margin:10px; z-index:50; pointer-events:none; display:grid; justify-items:center; width:95px; padding:5px; text-align:center; color:var(--amber); background:#15212e; border:1px solid var(--amber); font:600 13px var(--sans); }
.dragged-card img { max-width:55px; max-height:70px; }
.drag-source { opacity:.4; }
.model-menu { --rim:var(--cyan); position:absolute; z-index:4; width:min(214px,58vw); color:var(--amber); }
.model-menu[data-player="2"] { --rim:var(--orange); }
.model-menu:has(#space-cards:not([hidden])) { --rim:var(--amber); }
#space-cards > div { display:flex; align-items:stretch; border-bottom:1px solid #344451; }
#space-cards > div:last-child { border-bottom:0; }
#space-cards .button { min-width:0; min-height:44px; }
#space-cards .space-unit-actions { width:auto; color:var(--cyan); font-size:13px; }
#space-cards small { margin:2px 0 0; font-weight:400; }
#space-cards .button:is(:hover,:focus-visible) small { color:inherit; }
.model-menu-panel { padding:4px; background:#101b27; border:2px solid var(--rim); border-radius:5px; overflow:auto; overscroll-behavior:contain; box-shadow:0 0 0 2px #0d131a,2px 4px 6px #0006; }
.model-menu::before { content:""; position:absolute; width:10px; height:10px; transform:translate(-50%,-50%) rotate(45deg); background:var(--rim); z-index:-1; }
.model-menu[data-side=right]::before { left:0; top:var(--pointer-offset); }
.model-menu[data-side=left]::before { left:100%; top:var(--pointer-offset); }
.model-menu[data-side=above]::before { left:var(--pointer-offset); top:100%; }
.model-menu[data-side=below]::before { left:var(--pointer-offset); top:0; }
.model-menu header { display:flex; align-items:center; justify-content:space-between; padding-left:7px; border-bottom:1px solid #53616b; }
.model-menu header strong { font:700 16px/1.2 var(--sans); text-transform:uppercase; }
.model-menu .button { width:100%; text-align:left; border:0; background:transparent; color:var(--amber); }
.model-menu .button:is(:hover,:focus-visible):enabled { color:#091824; background:#a1d6dd; }
.model-menu .target-detail,.command-panel .target-detail { display:block; font-size:13px; opacity:.9; }
#target-action { font-size:14px; margin:5px; }
.table-tools { display:flex; gap:10px; align-items:center; padding:2px clamp(8px,1.5vw,20px); color:var(--muted);
  border-top:1px solid #475464; background:#121a25; }
#board-instruction { flex:1; margin:2px 0; font:500 14px/1.3 var(--sans); }
.camera-controls { display:flex; }
.table-tools .camera-controls button { min-width:34px; padding:0 5px; font:600 16px var(--mono); }
.table-tools #rotate-board { display:inline-flex; align-items:center; gap:5px; margin-right:5px; padding:0 8px; border-right:1px solid #546574; color:var(--amber); font:650 14px var(--sans); }
#rotate-board span[aria-hidden] { font:22px/1 var(--sans); }
#view-angle { min-width:3.3ch; text-align:right; font:600 12px var(--mono); }

#zoom-fit { font-size:13px; }
#open-log { border-left:1px solid #485461; }
dialog { width:min(540px,calc(100% - 20px)); max-height:calc(100dvh - 24px); overflow:auto; border:1px solid #9b8c72; border-radius:6px; padding:0; color:var(--text); background:#131e2a; box-shadow:0 14px 65px #000a; }
dialog::backdrop { background:#050a11bd; }
.dialog-header { position:sticky; top:0; z-index:1; justify-content:space-between; padding:10px 16px; border-bottom:1px solid #596370; background:var(--metal); }
.dialog-header h2 { margin:0; color:#ffdda0; font-size:24px; }
.dialog-header p,.dialog-note,.demo-limit { color:var(--muted); font-size:14px; }
.dialog-header p { margin:4px 0 0; }
.dialog-close { min-width:42px; min-height:42px; }
.eyebrow,.space-summary strong { font:700 12px var(--mono); letter-spacing:.05em; color:var(--muted); }
.settings-body,.printed-card-text,.selection-console,.space-console,.action-console,.action-log { padding:12px 18px; }
.settings-body,.landscape-controls,.model-controls { display:grid; gap:9px; }
.settings-body { gap:17px; }
.placement-rule,.setting-toggle { display:flex; align-items:center; gap:10px; }
.setting-toggle small { display:block; color:var(--muted); font-size:14px; }
.placement-rule input,.setting-toggle input { accent-color:var(--cyan); width:20px; height:20px; flex:none; }
select { width:100%; min-height:40px; color:var(--text); border:1px solid #5c6a77; background:#101923; padding:5px 10px; }
.landscape-controls label span { color:var(--amber); float:right; }
.demo-limit,.selection-summary h2,.selection-summary p,.action-note,#action-log-heading { margin:0; }
.selection-summary h2 { color:var(--amber); font-size:23px; }
.space-summary { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.occupant-list { display:flex; gap:6px; flex-wrap:wrap; margin-top:7px; }
.occupant-chip[aria-pressed=true] { border-color:var(--cyan); }
.action-console:has(.action-note:empty) { display:none; }
.action-log { border-top:1px solid #465360; }
#action-log { max-height:280px; overflow:auto; padding-left:24px; font-size:14px; }
#action-log li { padding:3px; }
.card-image-wrap { padding:12px; }
.card-image-wrap img { display:block; width:auto; max-width:100%; max-height:64dvh; margin:auto; }
.printed-card-text p { white-space:pre-line; }
.dialog-note { padding:0 18px; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
/* The HUD takes its natural height. The play surface gets the rest of the screen. */
@media (min-width:621px) {
  .game-screen {
    display:grid; min-height:calc(100svh - 2 * var(--gutter));
    grid-template-rows:auto minmax(230px,1fr) auto auto;
  }
  .arena { display:flex; flex-direction:column; }
  .board-stage { flex:1; }
}
@media (max-width:840px) {
  .match-brand { gap:8px; } .match-brand h1 { padding-left:8px; font-size:12px; }
  .player-plate { gap:5px; padding-inline:7px; }
  .command-tray { grid-template-columns:minmax(94px,15%) minmax(0,1fr) minmax(115px,17%); gap:7px; }
  .opponent-hand i { width:16px; height:23px; margin-left:-7px; }
  .hand { --card-w:clamp(88px,14vw,112px); }
}
@media (max-width:620px) {
  .demo-shell { padding:4px 2px; } .match-brand h1 { display:none; }
  .match-bar { gap:5px; min-height:41px; padding:0 5px; } .wordmark { font-size:clamp(15px,3.8vw,20px); }
  .turn-plaque { flex-direction:column; gap:2px; padding:3px 8px; }
  .turn-plaque span { font-size:11px; } .turn-plaque strong { font-size:13px; }
  .match-bar nav { gap:0; } .match-bar nav :is(button,a) { padding:0 5px; min-height:40px; }
  .arena { padding-top:0; --noon-sun-height:max(108px,30%); }
  .player-row { position:relative; inset:auto; padding:6px 4px 0; grid-template-columns:1fr 1fr; gap:2px 6px; }
  .player-plate { width:100%; gap:4px; border-radius:3px 7px; min-height:55px; }
  .seat-info>strong { font-size:15px; } .seat-info>span { font-size:12px; line-height:1.1; }
  .hq-health { gap:3px; } .hq-health b { font-size:11px; } .hq-health i { width:27px; height:6px; }
  .hq-portrait { width:26px; } .player-two { grid-area:1 / 2; }
  .scene-label { grid-column:1/-1; z-index:1; justify-self:center; height:17px; margin:1px 0 -6px; }
  .opponent-hand i { width:14px; height:19px; margin-left:-6px; }
  .board-stage { aspect-ratio:1100/640; }
  .command-tray { grid-template-columns:1fr 1fr; grid-template-areas:"hand hand" "purse commands"; align-items:center; padding:0 8px 6px; gap:2px 8px; }
  .hand-dock { margin-top:-6px; } .hand { height:110px; --card-w:clamp(104px,30vw,136px); }
  .hand-caption { border-top:1px solid #616b73; min-height:30px; }
  .hand-caption button { min-width:44px; min-height:34px; }
  #practice-resources { gap:2px; max-width:180px; }
  #practice-resources>div { padding:1px 8px; }
  #practice-resources dt,#practice-resources dd { font-size:14px; }
  .command-panel { padding:0; }
  .command-panel .button,.model-menu .button,.selection-actions .button { min-height:40px; }
  .command-panel .command-primary { min-height:47px; }
  .table-tools { flex-wrap:wrap; gap:0 8px; }
  #board-instruction { flex-basis:100%; margin:5px 0 0; }
  #open-log { margin-left:auto; } .camera-controls button,.table-tools button { min-height:42px; }
  .hand-preview { grid-template-columns:minmax(0,.8fr) minmax(0,1.2fr); gap:7px; padding:7px; max-height:55dvh; }
  .preview-header h3 { font-size:18px; }
}
@media (pointer:coarse) { .board-viewport:not(.zoomed-in) { overflow-y:hidden; } }
@media (max-height:540px) and (min-width:621px) {
  .demo-shell { --gutter:0px; } .match-bar { min-height:36px; } .arena { padding-top:28px; }
  .hand { height:79px; --card-w:94px; } .hq-portrait { width:36px; }
  .hand-caption { min-height:24px; } .opponent-hand i { height:20px; } .seat-info>span { display:none; }
}
@media(prefers-reduced-motion:reduce) { *,*::before,*::after { scroll-behavior:auto!important; } }
.readiness-line,.outline-key { font-size:14px; line-height:1.3; color:#d6dcd8; }
.readiness-line { margin:3px 3px 7px; }
.model-bonuses { margin:4px 3px 7px; color:#b5efb5; font-size:14px; line-height:1.35; }
.readiness-line::before,.outline-key span::before { content:""; display:inline-block; width:9px; height:9px; margin-right:6px; border:2px solid var(--key-color); border-radius:3px; vertical-align:baseline; }
.outline-key { position:relative; }
.outline-key summary { padding:9px 3px; cursor:pointer; }
.outline-key>div { position:absolute; z-index:6; right:0; bottom:100%; padding:10px 12px; width:250px; background:#141d28; border:1px solid #84918c; box-shadow:0 3px 12px #070b1299; }
.outline-key strong,.outline-key span { display:block; padding:2px 0; }
.outline-key strong { color:var(--amber); margin-bottom:3px; }
@media(max-width:620px) { .outline-key>div { left:0; right:auto; } }

.command-heading { justify-content:space-between; }
.selected-hp { display:block; color:#bdcfb1; font:600 13px/1.25 var(--mono); }
.selected-hp:empty { display:none; }
@media (min-width:621px) {
  /* Expanded commands rise beside the board, keeping the hand at the table edge. */
  .command-panel:has(#command-heading:not([hidden])),.command-panel:has(.restore-energy) {
    position:absolute; right:0; bottom:5px; width:100%; z-index:4;
    max-height:min(38svh,320px); overflow:auto; overscroll-behavior:contain;
    padding:7px; border:1px solid #586777; border-radius:4px;
    background:linear-gradient(#202e3c,#141e2a); box-shadow:0 3px 9px #070b1690;
  }
}

/* Later cards cover the right edge. Keep every printed cost on the exposed left edge. */
.hand-cost {
  position:absolute; left:3%; top:20%; display:grid; gap:2px; min-width:25px; padding:2px 3px;
  border:1px solid #97754e; border-radius:4px; background:#171d22; color:#fff2cd;
  box-shadow:0 1px 2px #281b1999; text-align:center; pointer-events:none;
  font:700 clamp(14px,1.05vw,17px)/1 var(--mono); font-variant-numeric:tabular-nums;
}
.hand-cost > span { display:flex; align-items:center; justify-content:space-between; gap:3px; }
.hand-cost .resource-mark { width:14px; height:14px; }

#cyclone-prompt { margin:4px 0 7px; color:#f3e5c7; font:600 14px/1.3 var(--sans); }
.hand-card.cyclone-payment { cursor:pointer; touch-action:manipulation; }
.hand-card.cyclone-payment[aria-pressed=true] { outline:3px solid var(--cyan); outline-offset:-2px; }
.hand-card.cyclone-payment[aria-pressed=true]::after {
  content:"✓"; position:absolute; left:3px; top:55px; min-width:22px; padding:2px;
  background:#17443e; border:1px solid var(--cyan); border-radius:3px; color:white; font:bold 15px/1 var(--sans);
}
.hand-card.cyclone-payment:disabled { opacity:.55; cursor:default; }
#cyclone-field { position:absolute; left:0; top:0; width:0; height:0; z-index:1; }
.cyclone-mark {
  position:absolute; transform:translate(-50%,-50%); touch-action:manipulation;
  padding:0; border:2px dashed #ffc86b; border-radius:3px; background:transparent;
  box-shadow:0 0 0 1px #18232e; cursor:pointer;
}
.cyclone-mark.zone { min-width:42px; min-height:30px; color:#ffe4aa; background:#17222eeb; font:bold 12px var(--mono); }
.cyclone-mark[aria-pressed=true],.cyclone-mark:focus-visible { border:2px solid #77eee3; }
.cyclone-mark[aria-pressed=true]::after { content:"✓"; position:absolute; right:-5px; top:-9px; padding:0 3px; border-radius:3px; background:#17443e; color:white; font:bold 14px var(--sans); }
#battlefield-period { color:var(--amber); font-size:12px; }
