/* Fogbound. Colours and fonts come from the active theme (themes/*.js) as CSS variables. */
:root {
  /* Palette tokens (D39). The theme (themes/waking.js) sets the same names; these are the defaults before it loads.
     ink = backgrounds, bone = paper and text, one accent (verdigris), blood only for wounds and danger. */
  --ink-0: #0a0d0f; --ink-1: #11171a; --ink-2: #1a2226; --line: #34423f; --line-hi: #8aa39c;
  --bone: #ece5d5; --bone-dim: #a8ada6; --bone-hi: #fff6e2;
  --accent: #5fbfa6; --accent-hi: #9fe0cc; --accent-ink: #0b1513; --accent-deep: #1f4a40;
  --blood: #e8695c; --blood-hi: #ff9a8a; --blood-deep: #7a2019;
  /* working names used across the stylesheet and scripts */
  --bg: var(--ink-0); --panel: var(--ink-1); --panel-2: var(--ink-2); --edge: var(--line); --edge-hi: var(--line-hi);
  --ink: var(--bone); --ink-dim: var(--bone-dim);
  --good: var(--accent); --bad: var(--blood); --warn: var(--blood-hi); --hp: var(--blood); --ap: var(--accent);
  --accent-2: var(--blood-deep);
  /* Type in three tiers (D39): display (large, sparing), body (rules, stats, dice; tabular figures), voice (narrator, log) */
  --theme-display: Georgia, serif; --theme-body: system-ui, sans-serif; --theme-voice: ui-monospace, Menlo, monospace;
  --font-plain: 'Atkinson Hyperlegible', system-ui, sans-serif;
  --font-display: var(--theme-display); --font-body: var(--theme-body); --font-voice: var(--theme-voice);
  --r: 10px;
  color-scheme: dark;
}
.plain-type { --font-display: var(--font-plain); --font-body: var(--font-plain); --font-voice: var(--font-plain); }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
body { overflow: hidden; overscroll-behavior: none; }
#app { position: fixed; inset: 0; overflow: auto; }
#app.in-battle { overflow: hidden; }
h1, h2, h3, h4 { font-family: var(--font-body); font-weight: 700; letter-spacing: .01em; margin: .2em 0 .5em; }
h1, h2 { font-family: var(--font-body); font-weight: 400; letter-spacing: .02em; }
h2 { font-size: 1.35rem; } h3 { font-size: 1.05rem; color: var(--accent); } h4 { font-size: .95rem; color: var(--ink-dim); margin-top: 1em; }
a { color: var(--accent); }
.hidden { display: none !important; }
.dim { color: var(--ink-dim); } .small { font-size: .82em; } .good { color: var(--good); } .bad { color: var(--bad); } .warn { color: var(--warn); }
.grow { flex: 1; } .pad { padding: 8px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .row.end { justify-content: flex-end; margin-top: 12px; }
hr { border: 0; border-top: 1px solid var(--edge); margin: 16px 0; }
code, kbd { font-family: ui-monospace, Menlo, monospace; background: #0006; border: 1px solid var(--edge); border-radius: 4px; padding: 0 5px; font-size: .9em; }
kbd { margin: 0 1px; }

/* --- controls --- */
.btn { font: inherit; font-family: var(--font-body); font-weight: 600; letter-spacing: .03em; color: var(--ink); cursor: pointer;
  background: linear-gradient(#ffffff14, #00000030), var(--panel-2); border: 1px solid var(--edge); border-radius: 7px; padding: 8px 14px;
  box-shadow: inset 0 1px 0 #ffffff14, 0 2px 6px #0008; display: inline-flex; align-items: center; gap: 6px; transition: border-color .15s, transform .08s, filter .15s; }
.btn:hover:not(:disabled) { border-color: var(--edge-hi); filter: brightness(1.15); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(#ffffff2a, #0000004d), var(--accent); color: var(--accent-ink); border-color: #00000080; text-shadow: 0 1px 0 #ffffff40; }
.btn.danger { background: linear-gradient(#ffffff14, #00000040), var(--accent-2); border-color: #000; }
.btn.small { padding: 4px 9px; font-size: .85em; }
.btn.wide { width: 100%; justify-content: center; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }
.icon-btn { background: transparent; border: 1px solid transparent; color: var(--ink-dim); cursor: pointer; border-radius: 6px; padding: 5px; display: inline-grid; place-items: center; font-size: 15px; }
.icon-btn:hover { color: var(--ink); border-color: var(--edge); background: #ffffff0d; }
.icon-btn.big { padding: 8px; }
input, select { font: inherit; color: var(--ink); background: #0008; border: 1px solid var(--edge); border-radius: 6px; padding: 8px 10px; min-width: 0; }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px #ffffff14; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
input[type=range] { padding: 0; accent-color: var(--accent); }
.field { display: flex; flex-direction: column; gap: 5px; font-size: .85em; color: var(--ink-dim); margin-bottom: 10px; }
.field input, .field select { font-size: 1.05em; }
.check { display: flex; gap: 8px; align-items: center; margin: 8px 0; cursor: pointer; }
.inline { display: inline-flex; gap: 6px; align-items: center; color: var(--ink-dim); font-size: .9em; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.ico { flex: none; }

/* --- ornate panel --- */
.panel { background: linear-gradient(180deg, #ffffff08, #00000020), var(--panel); border: 1px solid var(--edge); border-radius: var(--r);
  box-shadow: 0 0 0 1px #000, inset 0 0 0 1px #ffffff0a, 0 10px 30px #000a; position: relative; }
.panel::before { content: ''; position: absolute; inset: 3px; border: 1px solid #ffffff0d; border-radius: calc(var(--r) - 3px); pointer-events: none; }

/* --- pages --- */
.page { min-height: 100%; position: relative; padding: 24px clamp(14px, 4vw, 48px) 60px; }
.page-bg { position: fixed; inset: 0; z-index: -1; background:
  radial-gradient(ellipse at 20% 0%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 55%),
  radial-gradient(ellipse at 90% 100%, color-mix(in srgb, var(--accent-2) 22%, transparent), transparent 60%), var(--bg); }
.brand { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; }
.brand-mark { color: var(--accent); filter: drop-shadow(0 0 10px color-mix(in srgb, var(--accent) 50%, transparent)); }
.brand-name { font-family: var(--font-display); font-size: 1.45rem; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; line-height: 1;
  background: linear-gradient(var(--bone-hi), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-sub { color: var(--ink-dim); font-size: .85rem; }
.auth { max-width: 420px; margin: 6vh auto 0; display: flex; flex-direction: column; gap: 22px; }
.auth-card { padding: 22px 24px; }
.fog-signin { display: block; margin: 6px 0 4px; line-height: 1.35; text-align: left; }
.auth-or { text-align: center; margin: 8px 0 4px; }
.fog-box .row { gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.auth-form { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.auth-form .btn.primary { margin: 10px 0 8px; padding: 11px; }
.form-error { color: var(--bad); min-height: 1.2em; font-size: .9em; }
.auth-practice { text-align: center; }
.lobby-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 24px; }
.lobby { display: grid; grid-template-columns: 1fr 260px; gap: 24px; align-items: start; max-width: 1200px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; }
.game-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.game-card { display: flex; gap: 14px; align-items: center; padding: 14px 16px; cursor: pointer; transition: transform .12s, border-color .12s; }
.game-card:hover { transform: translateY(-1px); border-color: var(--edge-hi); }
.game-card.my-turn { border-color: var(--accent); box-shadow: 0 0 0 1px #000, 0 0 22px color-mix(in srgb, var(--accent) 35%, transparent); }
.gc-theme { color: var(--accent); }
.gc-main { flex: 1; min-width: 0; }
.gc-title { font-family: var(--font-body); font-weight: 700; font-size: 1.08rem; }
.gc-sub { color: var(--ink-dim); font-size: .85em; margin: 2px 0 6px; }
.gc-seats { display: flex; gap: 6px; flex-wrap: wrap; }
.seat-pill { font-size: .78em; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--team); color: var(--ink-dim); }
.seat-pill.on { color: var(--ink); } .seat-pill.turn { background: color-mix(in srgb, var(--team) 35%, transparent); color: #fff; }
.gc-side { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.gc-status { font-family: var(--font-body); font-weight: 600; font-size: .9em; }
.gc-status.hot { color: var(--accent); animation: glowPulse 1.6s infinite; }
.empty { color: var(--ink-dim); padding: 16px; border: 1px dashed var(--edge); border-radius: var(--r); font-size: .92em; }
.col-side { padding: 16px; }
.friend { display: flex; gap: 8px; align-items: center; padding: 5px 0; }
.friend span:nth-child(2) { flex: 1; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #555; flex: none; }
.dot.on { background: var(--good); box-shadow: 0 0 6px var(--good); }

/* --- modal --- */
.modal-back { position: fixed; inset: 0; background: #000b; display: grid; place-items: center; z-index: 50; opacity: 0; transition: opacity .2s; padding: 12px; backdrop-filter: blur(3px); }
.modal-back.in { opacity: 1; }
.modal { background: linear-gradient(180deg, #ffffff08, #00000020), var(--panel); border: 1px solid var(--edge-hi); border-radius: var(--r); width: min(520px, 100%); max-height: calc(100vh - 24px); display: flex; flex-direction: column;
  box-shadow: 0 0 0 1px #000, 0 20px 60px #000; transform: translateY(10px) scale(.98); transition: transform .2s; }
.modal.wide { width: min(980px, 100%); }
.modal-back.in .modal { transform: none; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px 0; }
.modal-head h2 { margin: 0; }
.modal-body { padding: 14px 18px 18px; overflow: auto; }
#toasts { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--panel-2); border: 1px solid var(--edge); border-left: 4px solid var(--accent); padding: 9px 16px; border-radius: 7px; box-shadow: 0 8px 20px #000a; opacity: 0; transform: translateY(-8px); transition: all .3s; max-width: 90vw; }
.toast.in { opacity: 1; transform: none; } .toast.warn { border-left-color: var(--warn); } .toast.error { border-left-color: var(--bad); } .toast.good { border-left-color: var(--good); }
.menu-list { display: flex; flex-direction: column; gap: 8px; }
.help h3 { margin-top: 1em; } .help p { line-height: 1.5; color: var(--ink); }
.help table { border-collapse: collapse; width: 100%; font-size: .88em; } .help td, .help th { padding: 4px 8px; border-bottom: 1px solid #ffffff12; text-align: left; }

/* --- builder / new game --- */
.builder-cols { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; margin-top: 8px; }
.wb-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.arch-card { text-align: left; font: inherit; color: var(--ink); background: linear-gradient(#ffffff0a, #0000), var(--panel-2); border: 1px solid var(--edge); border-radius: 8px; padding: 9px 10px; cursor: pointer; transition: border-color .12s, transform .1s; }
.arch-card:hover:not(.off) { border-color: var(--accent); transform: translateY(-1px); }
.arch-card.off { opacity: .4; cursor: not-allowed; }
.ac-head { display: flex; gap: 7px; align-items: center; color: var(--accent); } .ac-head b { flex: 1; color: var(--ink); font-family: var(--font-body); }
.ac-cost { background: #0007; border: 1px solid var(--edge); border-radius: 99px; padding: 0 8px; font-size: .85em; color: var(--accent); }
.ac-stats { display: flex; flex-wrap: wrap; gap: 3px 8px; font-size: .74em; color: var(--ink-dim); margin: 6px 0 4px; }
.ac-desc { font-size: .82em; } .ac-gear { font-size: .74em; color: var(--ink-dim); margin-top: 4px; }
.wb-total { margin-bottom: 8px; }
.wb-row { display: flex; gap: 8px; align-items: center; padding: 5px 0; border-bottom: 1px solid #ffffff10; color: var(--accent); }
.wb-row input { flex: 1; padding: 5px 8px; }
.wb-arch { width: 110px; color: var(--ink); font-size: .86em; display: flex; flex-direction: column; } .wb-arch small { color: var(--ink-dim); }
.ng-cols { display: grid; grid-template-columns: 1fr 380px; gap: 20px; }
.map-preview { width: 100%; background: #0006; border: 1px solid var(--edge); border-radius: 8px; }
.ng-preview { display: flex; flex-direction: column; gap: 8px; }
.seat-modes { display: flex; flex-direction: column; gap: 6px; }
.seat-mode, .wait-seat { display: flex; gap: 10px; align-items: center; }
.seat-mode select { flex: 1; }
.swatch { width: 14px; height: 14px; border-radius: 3px; background: var(--team); box-shadow: 0 0 8px var(--team); flex: none; }
.seat-mode b, .wait-seat b { width: 70px; }
.wb-chosen { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; background: #0005; border: 1px solid var(--edge); border-radius: 7px; }
.saved-list { display: flex; flex-direction: column; gap: 6px; }
.saved-row { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid #ffffff10; }
.saved-row .dim { flex: 1; }
.waiting { max-width: 640px; margin: 4vh auto; padding: 20px 22px; }
.wait-seats { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.wait-seat { padding: 10px 12px; border: 1px dashed var(--edge); border-radius: 8px; }
.wait-seat.taken { border-style: solid; border-color: color-mix(in srgb, var(--team) 60%, var(--edge)); background: color-mix(in srgb, var(--team) 8%, transparent); }
.waiting .chat-list { height: 160px; }
.back { position: fixed; top: 16px; left: 16px; }

/* --- loading --- */
.loading { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--ink-dim); text-align: center; }
.spinner { width: 16px; height: 16px; border: 2px solid #ffffff30; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
.spinner.big { width: 42px; height: 42px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes glowPulse { 50% { opacity: .55; } }

/* ============================ battle ============================ */
.battle { position: fixed; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.stage-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; outline: none; }
.label-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.hud { position: absolute; inset: 0; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud .tip, .hud .banner, .hud .dice-tray { pointer-events: none; }

/* unit tags above minis */
.unit-tag { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; will-change: transform; }
.tag-name { font-family: var(--font-body); font-size: 11px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px #000, 0 0 4px #000; white-space: nowrap; opacity: 0; transition: opacity .2s; }
.unit-tag.selected .tag-name, .unit-tag.active .tag-name, .battle:hover .unit-tag:hover .tag-name { opacity: 1; }
.tag-hp { display: flex; gap: 2px; padding: 2px 3px; background: #000a; border-radius: 4px; border: 1px solid color-mix(in srgb, var(--team) 70%, #000); }
.tag-hp i { width: 6px; height: 7px; border-radius: 1px; background: #3a3a3a; }
.tag-hp i.on { background: linear-gradient(var(--blood-hi), var(--hp)); box-shadow: 0 0 3px #f004; }
.unit-tag.spent { opacity: .55; }
.tag-status { display: flex; gap: 2px; }
.st { font-size: 9px; font-weight: 800; width: 14px; height: 14px; display: grid; place-items: center; border-radius: 50%; background: #000c; border: 1px solid #fff6; color: #fff; }
/* statuses at the figure's feet: icon and word on a bone chip, readable from any angle (it's screen-space) */
.base-marks { position: absolute; left: 0; top: 0; pointer-events: none; will-change: transform; }
.base-marks > div { display: flex; gap: 3px; transform: translateY(calc(100% + 4px)); }
.bm { display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px 1px 4px; border-radius: 99px; background: var(--bone-hi); color: var(--ink-0);
  font-family: var(--font-body); font-size: 10.5px; font-weight: 800; line-height: 15px; white-space: nowrap; border: 2px solid var(--team); box-shadow: 0 1px 4px #000c; }
.bm .ico { width: 12px; height: 12px; }
.bm-stunned { background: var(--blood-hi); color: var(--ink-0); }
.bm-alone { background: var(--ink-2); color: var(--bone); border: 1px dashed var(--bone-dim); }
.base-marks.spent { opacity: .7; }
.st-shaken { background: var(--blood-deep); } .st-braced { background: var(--ink-2); } .st-aimed { background: var(--ink-2); } .st-inspired { background: var(--accent-deep); } .st-overwatch { background: var(--accent-deep); }
.float-text { position: absolute; left: 0; top: 0; font-family: var(--font-body); font-weight: 900; font-size: 22px; color: #fff; text-shadow: 0 2px 4px #000, 0 0 10px #000; white-space: nowrap; }
.float-text.bad { color: var(--blood-hi); } .float-text.crit { color: var(--accent-hi); font-size: 30px; } .float-text.good { color: var(--accent-hi); } .float-text.dim { color: var(--bone-dim); font-size: 17px; }
.float-text.warn { color: var(--warn); font-size: 17px; } .float-text.buff { color: var(--accent-hi); font-size: 15px; } .float-text.ability { color: var(--accent); font-size: 18px; } .float-text.vp { color: var(--accent); font-size: 20px; }

/* top bar */
.topbar { position: absolute; top: 0; left: 0; right: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 10px; padding: 10px 12px; pointer-events: none;
  background: linear-gradient(#000c, #0000); }
.topbar > * { pointer-events: auto; }
.tb-left, .tb-right { display: flex; gap: 8px; align-items: center; }
.tb-right { justify-content: flex-end; }
.round-box { font-family: var(--font-body); display: flex; flex-direction: column; line-height: 1.1; }
.round-box b { font-size: 1.1rem; color: var(--accent); } .round-box span { font-size: .78rem; color: var(--ink-dim); }
.tb-center { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.tracker { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; align-items: center; }
/* activation strip (roadmap 13): round and objective pinned between the teams */
.strip-mid { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 12px; border-radius: 8px; background: color-mix(in srgb, var(--ink-0) 80%, transparent); border: 1px solid var(--line); min-width: 120px; }
.strip-mid .round-box { align-items: center; flex-direction: row; gap: 6px; }
.strip-mid .round-box b { font-size: 1rem; } .strip-mid .round-box span { font-size: .74rem; }
.tally { display: flex; gap: 8px; align-items: center; font-size: .74rem; color: var(--ink-dim); }
.tally:empty { display: none; }
.tally-name { display: inline-flex; gap: 3px; align-items: center; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tally-seat { display: inline-flex; align-items: center; } .tally-seat b { color: var(--ink); font-weight: 700; }
.trk-seat { display: flex; gap: 3px; padding: 3px 5px; border-radius: 8px; border: 1px solid transparent; position: relative; }
.trk-seat.on { border-color: var(--team); background: color-mix(in srgb, var(--team) 15%, #0008); box-shadow: 0 0 14px color-mix(in srgb, var(--team) 40%, transparent); }
.chip { position: relative; width: 34px; height: 40px; border-radius: 6px; border: 2px solid color-mix(in srgb, var(--team) 80%, #000); background: linear-gradient(color-mix(in srgb, var(--team) 40%, #000), #000);
  color: #fff; cursor: pointer; display: grid; place-items: center; padding: 0 0 6px; overflow: hidden; transition: transform .15s, filter .15s; }
.chip.art { background-color: var(--bone); background-size: cover; background-position: 50% 18%; }
.chip-pips { position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 1px; padding: 1px 2px; background: #000c; }
.chip-pips i { flex: 1; height: 4px; border-radius: 1px; background: #ffffff26; } .chip-pips i.on { background: var(--blood); }
.chip-star { position: absolute; top: 0; right: 1px; font-size: 10px; color: var(--bone-hi); text-shadow: 0 0 2px #000, 0 0 3px #000; }
.chip.next { transform: translateY(2px) scale(1.12); z-index: 1; box-shadow: 0 0 10px color-mix(in srgb, var(--team) 60%, transparent); }
.chip.active { transform: translateY(3px) scale(1.25); }
.chip.spent { filter: grayscale(.85) brightness(.5); }
.chip.dead { filter: grayscale(1) brightness(.35); }
.chip.dead::after { content: '✕'; position: absolute; inset: 0; display: grid; place-items: center; color: var(--blood); font-size: 20px; }
.chip.active { outline: 2px solid var(--ap); outline-offset: 1px; box-shadow: 0 0 10px var(--ap); }
.chip.sel { outline: 2px solid var(--accent-hi); outline-offset: 1px; }
.waver { position: absolute; right: -8px; top: -6px; background: var(--bad); color: #fff; border-radius: 50%; width: 16px; height: 16px; font-size: 11px; font-weight: 900; display: grid; place-items: center; }
.turn-status { font-family: var(--font-body); font-size: .9rem; color: var(--ink-dim); text-shadow: 0 1px 3px #000; padding: 2px 12px; border-radius: 99px; }
.turn-status.mine { color: var(--accent-ink); background: var(--accent); text-shadow: none; font-weight: 700; box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 60%, transparent); }
.score { display: flex; gap: 6px; }
.vp { display: flex; flex-direction: column; align-items: center; min-width: 50px; padding: 3px 8px 4px; border-radius: 6px; background: linear-gradient(color-mix(in srgb, var(--team) 45%, #000), #000c);
  border: 1px solid color-mix(in srgb, var(--team) 80%, #000); line-height: 1.05; }
.vp-name { font-size: .66rem; max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fffc; }
.vp b { font-family: var(--font-body); font-size: 1.25rem; }
.vp.out { opacity: .4; }
.net-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--good); box-shadow: 0 0 6px var(--good); }
.net-dot.off { background: var(--bad); box-shadow: 0 0 6px var(--bad); animation: glowPulse 1s infinite; }

/* unit card */
.unit-card { position: absolute; left: 12px; bottom: 150px; width: 270px; padding: 12px 14px; max-height: calc(100% - 300px); overflow: auto; }
.card-head { display: flex; gap: 10px; align-items: center; }
.portrait { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--team) 80%, #fff 10%), color-mix(in srgb, var(--team) 40%, #000));
  border: 2px solid var(--edge-hi); box-shadow: 0 0 0 2px #000, 0 0 14px color-mix(in srgb, var(--team) 50%, transparent); }
.card-name { font-family: var(--font-body); font-weight: 700; font-size: 1.1rem; }
.card-sub { font-size: .82em; }
.card-desc { font-size: .82em; font-style: italic; color: var(--ink-dim); margin: 8px 0; }
.card-char { font-size: .82em; color: var(--ink); margin: 8px 0 0; line-height: 1.4; } .card-char a { white-space: nowrap; }
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; margin: 6px 0; }
.stat { background: #0007; border: 1px solid var(--edge); border-radius: 5px; text-align: center; padding: 2px 0; }
.stat span { display: block; font-size: .58rem; color: var(--ink-dim); letter-spacing: .05em; } .stat b { font-family: var(--font-body); font-size: .95rem; }
.stat small { display: block; font-size: .56rem; line-height: 1.15; color: var(--ink-dim); padding: 0 2px 1px; }
.section-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--accent); margin: 8px 0 3px; }
.weapon, .ability { display: flex; gap: 6px; align-items: center; font-size: .86em; padding: 2px 0; }
.weapon span, .ability span { flex: 1; } .weapon small, .ability small { color: var(--ink-dim); }
.badges { display: flex; flex-wrap: wrap; gap: 4px; }
.badge { font-size: .74em; padding: 1px 7px; border-radius: 99px; border: 1px solid #fff4; }
.dead-note { color: var(--bad); font-family: var(--font-body); margin-top: 6px; }

/* action bar with orbs */
.actionbar { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); display: flex; align-items: flex-end; gap: 0; }
.orb { width: 104px; height: 104px; border-radius: 50%; position: relative; overflow: hidden; background: var(--ink-0); border: 3px solid var(--line);
  box-shadow: 0 0 0 2px var(--edge-hi), 0 0 0 5px #000, 0 6px 20px #000; z-index: 2; }
.orb-fill { position: absolute; left: 0; right: 0; bottom: 0; transition: height .5s cubic-bezier(.3, 1.3, .5, 1); }
.orb.hp .orb-fill { background: radial-gradient(circle at 50% 120%, var(--blood-hi), var(--hp) 45%, color-mix(in srgb, var(--blood-deep) 50%, #000)); }
.orb.ap .orb-fill { background: radial-gradient(circle at 50% 120%, var(--accent-hi), var(--ap) 45%, color-mix(in srgb, var(--accent-deep) 50%, #000)); }
.orb-glass { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle at 35% 25%, #ffffff55, #ffffff00 35%), radial-gradient(circle at 50% 50%, #0000 55%, #000a); }
.orb-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-shadow: 0 1px 3px #000, 0 0 6px #000; }
.orb-text b { font-family: var(--font-body); font-size: 1.8rem; line-height: 1; } .orb-text span { font-size: .62rem; text-transform: uppercase; letter-spacing: .1em; }
.bar-mid { display: flex; flex-direction: column; align-items: center; margin: 0 -14px 10px; padding: 8px 24px 6px; z-index: 1;
  background: linear-gradient(var(--ink-2), var(--ink-0)); border: 1px solid var(--edge-hi); border-radius: 10px; box-shadow: 0 0 0 1px #000, 0 8px 24px #000c; }
.slots { display: flex; gap: 5px; align-items: center; min-height: 64px; }
.slot { position: relative; width: 62px; height: 62px; border-radius: 8px; cursor: pointer; color: var(--ink); font: inherit;
  background: linear-gradient(#ffffff12, #0000 50%), radial-gradient(circle at 50% 30%, var(--ink-2), var(--ink-0)); border: 1px solid var(--edge);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; transition: transform .08s, border-color .12s, box-shadow .12s; }
.slot:hover:not(.off) { border-color: var(--accent); box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 45%, transparent); transform: translateY(-2px); }
.slot.on { border-color: var(--accent); box-shadow: inset 0 0 12px color-mix(in srgb, var(--accent) 50%, transparent), 0 0 10px color-mix(in srgb, var(--accent) 40%, transparent); color: var(--accent); }
.slot.off { opacity: .38; cursor: not-allowed; }
.slot .key { position: absolute; top: 2px; left: 4px; font-size: 10px; color: var(--ink-dim); }
.slot .cost { position: absolute; top: 1px; right: 4px; font-size: 8px; color: var(--ap); letter-spacing: -1px; }
.slot-label { font-size: 9.5px; line-height: 1.05; text-align: center; max-width: 58px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.slot.end { color: var(--good); } .slot.undo { color: var(--accent-hi); }
.slot-sep { width: 1px; height: 46px; background: var(--edge); margin: 0 4px; }
.bar-hint { font-size: .74rem; color: var(--ink-dim); min-height: 1.1em; margin-top: 3px; }

/* deploy tray */
.deploy-tray { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); padding: 10px 14px; max-width: calc(100% - 24px); display: flex; flex-direction: column; gap: 8px; }
.tray-head { display: flex; justify-content: space-between; gap: 12px; font-family: var(--font-body); }
.tray-cards { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.tray-card { width: 86px; flex: none; padding: 7px 5px; border-radius: 8px; text-align: center; cursor: grab; touch-action: none;
  background: linear-gradient(color-mix(in srgb, var(--team) 35%, #000), #000); border: 1px solid color-mix(in srgb, var(--team) 70%, #000); color: #fff; }
.tray-card:hover { border-color: #fff; } .tray-card.sel { outline: 2px solid var(--accent-hi); }
.tray-card.placed { opacity: .45; }
.tc-name { font-size: .78em; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-sub { font-size: .66em; color: #fffa; }
.deploy-tray .row { justify-content: flex-end; }

/* side panel */
.side { position: absolute; right: 12px; top: 92px; bottom: 140px; width: 300px; display: flex; flex-direction: column; padding: 0; transition: transform .25s; }
.side.collapsed .tab-body { display: none; }
.side.collapsed { bottom: auto; height: auto; }   /* folded: just its tab row, in place, like the other panels */
.side.collapsed .tabs { border-bottom: 0; padding-bottom: 6px; }
.tabs { display: flex; gap: 2px; padding: 6px 6px 0; border-bottom: 1px solid var(--edge); }
.tab { font: inherit; font-size: .8em; color: var(--ink-dim); background: none; border: 0; border-bottom: 2px solid transparent; padding: 6px 8px; cursor: pointer; display: flex; gap: 5px; align-items: center; }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); }
.tab.ping { color: #fff; animation: glowPulse 1s infinite; }
.collapse { margin-left: auto; }
.tab-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.log { font-family: var(--font-voice); }
.log, .chat-list, .players { flex: 1; overflow: auto; padding: 8px 10px; font-size: .84em; line-height: 1.4; }
.log-row { padding: 3px 0; border-bottom: 1px solid #ffffff08; }
.log-row.round { color: var(--accent); font-family: var(--font-body); border-top: 1px solid var(--edge); margin-top: 6px; padding-top: 6px; }
.log-row.big { font-size: 1.05em; } .log-row.dim { color: var(--ink-dim); } .log-row.sys { color: var(--ink-dim); font-style: italic; }
.log-row.warn { color: var(--warn); } .log-row.good { color: var(--accent-hi); }
.chat-row { padding: 3px 0; } .chat-row b { color: var(--accent); } .chat-row.mine b { color: var(--accent-hi); }
.chat-input { margin: 6px; }
.chat-echo { color: var(--accent-hi); }
.player-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 4px; border-bottom: 1px solid #ffffff10; border-left: 3px solid var(--team); padding-left: 8px; }
.player-row .dim { width: 100%; font-size: .9em; }
.tag { font-size: .7em; padding: 0 6px; border: 1px solid var(--edge); border-radius: 99px; color: var(--ink-dim); }

/* dice tray */
.dice-tray { position: absolute; right: 324px; bottom: 140px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.dice-roll { background: #000c; border: 1px solid var(--edge); border-radius: 10px; padding: 7px 10px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  animation: trayIn .25s ease-out; transition: opacity .6s; }
.dice-roll.fade { opacity: 0; }
.dice-roll.ok { border-color: var(--good); } .dice-roll.no { border-color: var(--bad); } .dice-roll.crit { border-color: var(--accent-hi); box-shadow: 0 0 16px color-mix(in srgb, var(--accent-hi) 50%, transparent); }
.dr-label { font-size: .7em; color: var(--ink-dim); text-transform: uppercase; letter-spacing: .1em; }
.dr-dice { display: flex; gap: 6px; }
.die { width: 34px; height: 34px; border-radius: 7px; background: linear-gradient(145deg, var(--bone-hi), var(--bone-dim)); box-shadow: inset 0 -3px 0 #0003, 0 3px 6px #000a; padding: 4px;
  animation: roll .55s cubic-bezier(.3, 1.4, .6, 1) both; }
[data-theme=modern] .die { background: linear-gradient(145deg, #2b3133, #121516); }
[data-theme=modern] .pips i.on { background: var(--accent); }
.pips { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); width: 100%; height: 100%; }
.pips i { width: 6px; height: 6px; border-radius: 50%; place-self: center; }
.pips i.on { background: var(--accent-ink); }
.dr-sum { font-family: var(--font-body); font-size: .95em; } .dr-sum b { font-size: 1.2em; }
.dice-roll.ok .dr-sum b { color: var(--good); } .dice-roll.no .dr-sum b { color: var(--bad); }
@keyframes roll { 0% { transform: translateY(-30px) rotate(-200deg) scale(.6); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes trayIn { from { transform: translateX(20px); opacity: 0; } }

/* banner */
.banner { position: absolute; left: 0; right: 0; top: 30%; text-align: center; opacity: 0; }
.banner.show { animation: banner 2.2s ease-out forwards; }
.b-main { font-family: var(--font-display); font-weight: 900; font-size: clamp(2rem, 6vw, 4rem); letter-spacing: .08em; text-transform: uppercase;
  background: linear-gradient(var(--bone-hi), var(--accent) 60%, color-mix(in srgb, var(--accent) 50%, #000)); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 10px #000) drop-shadow(0 0 30px color-mix(in srgb, var(--accent) 40%, transparent)); }
.b-sub { font-family: var(--font-body); color: var(--ink); text-shadow: 0 2px 6px #000; letter-spacing: .2em; text-transform: uppercase; font-size: .9rem; }
.banner::before { content: ''; position: absolute; left: 10%; right: 10%; top: 50%; height: 120px; transform: translateY(-50%); z-index: -1;
  background: radial-gradient(ellipse at center, #000b, #0000 70%); }
@keyframes banner { 0% { opacity: 0; transform: scale(1.3); } 12% { opacity: 1; transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }

/* tooltip */
.tip { position: fixed; z-index: 30; max-width: 280px; background: color-mix(in srgb, var(--ink-0) 93%, transparent); border: 1px solid var(--edge-hi); border-radius: 8px; padding: 8px 11px; font-size: .84em; line-height: 1.35;
  box-shadow: 0 8px 22px #000c; }
.tip-title { font-family: var(--font-body); font-weight: 700; margin-bottom: 2px; }
.odds { font-family: var(--font-body); font-size: 1.9rem; font-weight: 900; color: var(--c); line-height: 1; margin: 2px 0; }
.thinking { position: absolute; top: 96px; left: 50%; transform: translateX(-50%); background: #000c; padding: 4px 12px; border-radius: 99px; font-size: .8em; display: flex; gap: 8px; align-items: center; }

/* end screen */
.end-title { font-family: var(--font-display); font-weight: 900; font-size: 2.4rem; text-align: center; margin-bottom: 14px; color: var(--ink); }
.end-title.won { background: linear-gradient(var(--bone-hi), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.end-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.end-seat { border: 1px solid color-mix(in srgb, var(--team) 60%, var(--edge)); border-top: 4px solid var(--team); border-radius: 8px; padding: 10px; background: #0005; }
.end-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; font-family: var(--font-body); }
.vp-big { font-size: 1.3rem; color: var(--accent); }
.end-unit { display: flex; gap: 6px; align-items: center; font-size: .86em; padding: 2px 0; } .end-unit span { flex: 1; } .end-unit.dead { opacity: .45; text-decoration: line-through; }

/* --- small screens --- */
@media (max-width: 900px) {
  .lobby { grid-template-columns: 1fr; }
  .builder-cols, .ng-cols { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr 1fr; }
  .unit-card { display: none; }
  .side { top: auto; bottom: 120px; height: 40vh; width: min(300px, 80vw); }
  .dice-tray { right: 12px; bottom: auto; top: 110px; }
  .orb { width: 70px; height: 70px; } .orb-text b { font-size: 1.2rem; }
  .slot { width: 46px; height: 50px; } .slot-label { display: none; } .slot .ico { width: 20px; height: 20px; }
  .slots { min-height: 50px; gap: 3px; flex-wrap: wrap; justify-content: center; max-width: 62vw; }
  .bar-mid { padding: 6px 16px 4px; }
  .vp-name { font-size: 0; } .vp-name .seat-mark { font-size: .72rem; margin: 0; }   /* keep the seat mark: never colour alone */
  .topbar { grid-template-columns: auto 1fr auto; }
  .chip { width: 24px; height: 30px; } .chip .ico { width: 13px; height: 13px; } .tally-name { display: none; }
  .tracker { gap: 6px; }
}

/* ============================ rules v2 additions ============================ */
.left-stack { position: absolute; left: 12px; top: 80px; width: 280px; display: flex; flex-direction: column; gap: 8px; pointer-events: auto; }
.obj-card { padding: 10px 12px; font-size: .86em; }
.obj-title { font-family: var(--font-body); font-size: 1.05rem; color: var(--accent); display: flex; gap: 6px; align-items: center; }
.obj-fold { margin-left: auto; width: 26px; height: 26px; font-size: 14px; flex: none; }
.obj-card.folded > :not(.obj-title):not(.obj-prog):not(.obj-done) { display: none; }
.obj-card.folded .obj-prog { margin-top: 4px; }
.obj-text { margin: 4px 0 6px; }
/* D60: a scenario's steps, and its story when you choose it */
.obj-steps { margin: 0 0 8px; padding-left: 1.3em; font-size: .92em; }
.obj-steps li { margin: 2px 0; }
.obj-next { margin: 0 0 8px; font-size: .92em; }
/* D67: the fog's round track on the objective card: this round marked in words (▸), past rounds dimmed */
.fog-track { margin: 4px 0 0; padding-left: 1.1em; }
.fog-card { margin: 2px 0 6px; padding-left: 1.3em; font-size: .92em; }
/* D69: co-op scenarios and their difficulty in the quick-battle picker */
.obj-options.coop { margin-top: 6px; align-items: center; }
.coop-level { margin: 8px 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.coop-level .dim { flex-basis: 100%; }
.new-game.coop .ng-nocoop { display: none; }
.fog-track li.past { color: var(--bone-dim); }
.fog-track li.now { font-weight: 600; }
.fog-track li.now::marker { content: '▸ '; }
.obj-story { font-family: var(--font-voice); font-style: italic; color: var(--ink-dim); margin: 4px 0 6px; }
.obj-prog { display: flex; flex-direction: column; gap: 2px; }
.prog { border-left: 3px solid var(--team); padding-left: 6px; }
.obj-foot { font-size: .78em; margin-top: 6px; }
.obj-done { margin-top: 6px; color: var(--accent); font-weight: 700; animation: glowPulse 1.2s infinite; }
.omen-card { background: linear-gradient(color-mix(in srgb, var(--accent-deep) 93%, transparent), color-mix(in srgb, var(--ink-1) 93%, transparent)); border: 1px solid color-mix(in srgb, var(--accent-hi) 50%, transparent); border-radius: 10px; padding: 8px 12px; box-shadow: 0 0 20px color-mix(in srgb, var(--accent-hi) 19%, transparent); }
.omen-name { font-family: var(--font-body); color: var(--accent-hi); display: flex; gap: 6px; align-items: center; }
.omen-desc { font-size: .84em; margin-top: 2px; }
.unit-card { left: auto; right: 324px; bottom: 150px; top: auto; }
/* desktop: the figure card sits in the left column under the objective, scrolling if the column runs out */
.left-stack { bottom: 150px; pointer-events: none; }
.left-stack > * { pointer-events: auto; }
.left-stack .unit-card { position: relative; left: auto; right: auto; top: auto; bottom: auto; width: auto; max-height: none; min-height: 0; flex: 0 1 auto; zoom: 1; }
.left-stack .obj-card, .left-stack .omen-card { flex: none; }
.card-head .obj-fold { margin-left: auto; align-self: flex-start; }
.unit-card.folded > :not(.card-head):not(.stats) { display: none; }
.stats.four { grid-template-columns: repeat(4, 1fr); }
.ability.used { opacity: .5; }
.badge.skill { border-color: var(--accent); color: var(--accent); }
.st-ready { background: var(--accent-deep); } .st-hymn { background: var(--accent-deep); } .st-carry { background: var(--ink-2); }
.chip.waiting { opacity: .55; border-style: dashed; }
.slot.devote { color: var(--accent-hi); } .slot.devote.on { box-shadow: 0 0 14px color-mix(in srgb, var(--accent-hi) 50%, transparent); border-color: var(--accent-hi); }
/* opposed dice */
.dice-roll.opposed { padding: 8px 12px; }
.dr-vs { display: flex; align-items: center; gap: 10px; }
.dr-side { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 6px; border-radius: 8px; border: 1px solid transparent; }
.dr-side.won { border-color: var(--team); box-shadow: 0 0 12px color-mix(in srgb, var(--team) 50%, transparent); }
.dr-who { font-size: .7em; color: var(--team); max-width: 90px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.die.six { box-shadow: 0 0 12px var(--accent-hi), inset 0 -3px 0 #0003; } .die.one { box-shadow: 0 0 12px var(--blood), inset 0 -3px 0 #0003; }
.vs { font-family: var(--font-body); color: var(--ink-dim); }
.dr-verdict { font-family: var(--font-body); font-size: 1.05rem; }
.dice-roll.ok .dr-verdict { color: var(--good); } .dice-roll.no .dr-verdict { color: var(--ink-dim); } .dice-roll.crit .dr-verdict { color: var(--accent-hi); }
.die { background: linear-gradient(145deg, var(--bone-hi), var(--bone)); }
.score-table { width: 100%; border-collapse: collapse; margin: 6px 0 12px; }
.score-table td, .score-table th { padding: 5px 10px; border-bottom: 1px solid #ffffff14; text-align: center; }
.score-table td:first-child { text-align: left; color: var(--ink-dim); }
.score-table .total td { font-size: 1.15em; border-top: 1px solid var(--edge); }
.feedback { border-top: 1px solid var(--edge); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.ledger-line { font-style: italic; color: var(--accent); }
/* lobby */
.hero { padding: 16px 18px; margin-bottom: 18px; }
.hero h2 { margin-bottom: 4px; }
.chip-btn { font: inherit; font-size: .86em; color: var(--ink); background: var(--panel-2); border: 1px solid var(--edge); border-radius: 99px; padding: 5px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.chip-btn.on { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 30%, transparent); }
.chip-btn:disabled { opacity: .5; cursor: default; }
.chip-btn small { color: var(--ink-dim); }
.obj-options { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.obj-detail { background: #0005; border: 1px solid var(--edge); border-radius: 8px; padding: 8px 10px; font-size: .9em; }
.whys { margin-top: 6px; font-size: .9em; display: flex; flex-direction: column; gap: 2px; }
.seg { display: inline-flex; border: 1px solid var(--edge); border-radius: 8px; overflow: hidden; }
.seg-btn { font: inherit; color: var(--ink-dim); background: var(--panel-2); border: 0; padding: 7px 12px; cursor: pointer; }
.seg-btn.on { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
/* builder */
.builder2 { display: flex; flex-direction: column; gap: 8px; }
.step { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.step-n { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; font-size: .85em; }
.step-title { font-family: var(--font-body); font-size: 1.1rem; }
.supply-left { margin-left: auto; font-family: var(--font-body); color: var(--accent); } .supply-left.bad { color: var(--bad); }
.ally-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.ally-card { text-align: left; font: inherit; color: var(--ink); background: var(--panel-2); border: 1px solid var(--edge); border-radius: 10px; padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.ally-card .ico { color: var(--accent); }
.ally-card small { color: var(--ink-dim); font-size: .82em; }
.ally-card.on { border-color: var(--accent); box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 35%, transparent); }
.fig-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.fig-card { background: var(--panel-2); border: 1px solid var(--edge); border-radius: 10px; padding: 9px 11px; cursor: pointer; font-size: .84em; display: flex; flex-direction: column; gap: 3px; }
.fig-card.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.fig-card.off { opacity: .45; }
.fc-head { display: flex; gap: 6px; align-items: center; color: var(--accent); } .fc-head b { color: var(--ink); font-family: var(--font-body); font-size: 1.05em; flex: 1; }
.fc-stats { color: var(--ink-dim); } .fc-weapon { color: var(--ink-dim); font-style: italic; }
.star { background: none; border: 1px solid var(--edge); border-radius: 50%; width: 26px; height: 26px; color: var(--ink-dim); cursor: pointer; }
.star.on { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.fc-char { align-self: flex-start; margin-top: 4px; font: inherit; font-size: .92em; color: var(--accent); background: none; border: 1px dashed var(--edge); border-radius: 99px; padding: 2px 10px; cursor: pointer; }
.fc-char:hover:not(:disabled) { border-color: var(--accent); } .fc-char.on { border-style: solid; border-color: var(--accent); color: var(--ink); font-weight: 600; } .fc-char:disabled { cursor: not-allowed; }
.sf-char { font-size: .82em; color: var(--ink-dim); margin-top: 5px; line-height: 1.4; } .sf-char .link { font-size: 1em; } .sf-char .link.small { margin-left: 8px; }
.supply-figs { display: flex; flex-direction: column; gap: 8px; }
.supply-fig { background: #0004; border: 1px solid var(--edge); border-radius: 8px; padding: 8px 10px; }
.sf-head { display: flex; gap: 8px; align-items: center; } .sf-head input { flex: 1; padding: 4px 8px; }
.sf-buys { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.buy { font: inherit; font-size: .78em; color: var(--ink); background: var(--panel-2); border: 1px solid var(--edge); border-radius: 99px; padding: 3px 9px; cursor: pointer; }
.buy.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.buy.gambit { border-style: dashed; } .buy.off { opacity: .35; cursor: not-allowed; }
/* campaign */
.campaign { max-width: 820px; margin: 3vh auto; padding: 20px 24px; }
.track { display: flex; align-items: center; gap: 10px; margin: 10px 0; flex-wrap: wrap; font-family: var(--font-body); }
.track-bar { display: flex; gap: 4px; }
.track-bar i { width: 22px; height: 12px; border-radius: 3px; background: #ffffff18; border: 1px solid var(--edge); }
.track-bar i.on { background: linear-gradient(90deg, var(--accent-deep), var(--accent-hi)); }
.track-bar i.now { box-shadow: 0 0 10px var(--accent-hi); }
.bands { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 14px; }
.band-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; border-left: 3px solid var(--team); padding-left: 8px; }
.spoils { margin-left: auto; font-family: var(--font-body); color: var(--accent); }
.chapter-list { padding-left: 22px; display: flex; flex-direction: column; gap: 4px; }
.chapter-list.big li { padding: 6px 4px; border-bottom: 1px solid #ffffff10; }
.chapter-list li.now { color: var(--accent); }
.chapter-list li.done { opacity: .85; }
.next-chapter { padding: 14px 16px; margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.ending { margin-top: 16px; font-size: 1.05em; }
@media (max-width: 900px) { .left-stack { width: 200px; top: 70px; font-size: .9em; } .unit-card { display: none; } }

/* --- the guide (ui/guide.js) --- */
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-dim); }
.btn.ghost:hover:not(:disabled) { color: var(--ink); border-color: var(--edge); }
.auth-practice + .auth-practice { margin-top: 6px; }
.coach { position: absolute; left: 50%; top: 146px; transform: translateX(-50%); width: min(500px, calc(100% - 24px)); padding: 10px 14px 10px;
  border: 1px solid var(--accent); box-shadow: 0 0 0 1px #000, 0 8px 28px #000c, 0 0 18px color-mix(in srgb, var(--accent) 25%, transparent); z-index: 5; }
.coach.lesson { border-color: var(--accent-hi); box-shadow: 0 0 0 1px #000, 0 8px 28px #000c, 0 0 18px color-mix(in srgb, var(--accent-hi) 25%, transparent); }
.coach-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.coach-head b { font-family: var(--font-body); font-size: 1.05rem; }
.coach-who { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); white-space: nowrap; }
.coach.lesson .coach-who { color: var(--accent-hi); }
.coach-text { font-size: .9rem; line-height: 1.42; }
.coach-row { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 8px; }
.coach-row .dim { margin-right: auto; order: -1; }
.coach.shake { animation: coach-shake .35s; }
@keyframes coach-shake { 25% { transform: translateX(calc(-50% - 6px)); } 75% { transform: translateX(calc(-50% + 6px)); } }
/* wide screens: the guide heads the right column; the side panel starts under it (Guide.layout) */
.coach.docked { left: auto; right: 12px; top: 92px; transform: none; width: 300px; max-height: calc(100% - 92px - 140px - 150px); overflow: auto; }
.coach-head .obj-fold { margin-left: auto; align-self: center; }
.coach.folded .coach-text { display: none; }
.coach.folded .coach-row { margin-top: 4px; }
.coach.docked.shake { animation: coach-shake-docked .35s; }
@keyframes coach-shake-docked { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.slot.coach-lit { border-color: var(--bone-hi) !important; color: var(--bone-hi); animation: coach-glow 1.1s ease-in-out infinite alternate; }
@keyframes coach-glow { from { box-shadow: 0 0 4px color-mix(in srgb, var(--bone-hi) 40%, transparent); } to { box-shadow: 0 0 18px var(--bone-hi), inset 0 0 10px color-mix(in srgb, var(--bone-hi) 33%, transparent); } }
@media (max-width: 900px) { .coach { top: 118px; font-size: .9em; } }

.gb h2 { margin-top: 4px; }
.gb-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 6px; }
.gb-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--edge); }
.gb-dots i.on { background: var(--accent); }
.gb-vis { display: grid; place-items: center; min-height: 110px; margin: 6px 0 12px; padding: 12px; background: #0004; border: 1px solid var(--edge); border-radius: 8px; }
.gb-text { line-height: 1.5; }
.gb-steps { margin: 0; padding-left: 1.3em; } .gb-steps li { margin: 4px 0; }
.gb-why { margin: 6px 0; padding-left: 1.2em; } .gb-why li { margin: 3px 0; }
.gb-duel { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: center; }
.gb-duel > div { display: flex; gap: 8px; }
.gb-duel > b { font-family: var(--font-body); color: var(--ink-dim); }
.gb-fig { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 62px; color: var(--team); }
.gb-fig svg { padding: 8px; box-sizing: content-box; border-radius: 50%; border: 2px solid var(--team); background: #0006; }
.gb-fig small { font-size: .68rem; color: var(--ink-dim); text-align: center; line-height: 1.1; }
.gb-turns { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; }
.gb-turns span { padding: 6px 10px; border-radius: 6px; border: 2px solid var(--team); color: var(--team); font-weight: 600; font-size: .85rem; }
.gb-turns i { color: var(--ink-dim); font-style: normal; }
.gb-roll { display: flex; align-items: center; gap: 18px; justify-content: center; flex-wrap: wrap; }
.gb-roll > div { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.gb-roll small { color: var(--ink-dim); } .gb-roll .vs { color: var(--ink-dim); }
.gb-die { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 8px; background: var(--bone); color: var(--accent-ink); font-weight: 700; font-size: 1.4rem; box-shadow: inset 0 -3px 0 #0003; }
.gb-cap { margin: 8px 0 0; text-align: center; }
.gb-points { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: 100%; }
.gb-points span { display: flex; flex-direction: column; align-items: center; text-align: center; font-size: .85rem; gap: 2px; }
.gb-points b { font-family: var(--font-body); font-size: 1.5rem; color: var(--accent); }
.gb-points small { color: var(--ink-dim); font-size: .72rem; }
@media (max-width: 520px) { .gb-points { grid-template-columns: repeat(2, 1fr); } }
.gb-lamp { color: var(--accent); }

.tour { position: fixed; inset: 0; z-index: 60; }
.tour-hole { position: fixed; border-radius: 10px; box-shadow: 0 0 0 9999px #000b; border: 2px solid var(--accent); transition: all .25s; pointer-events: none; }
.tour-hole.none { border-color: transparent; box-shadow: 0 0 0 9999px #0008; }
.tour-card { position: fixed; padding: 12px 14px; border: 1px solid var(--accent); }
.tour-card h3 { margin: 2px 0 6px; }
.tour-text { font-size: .9rem; line-height: 1.45; }
.coach-pin { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 3; }
.coach-pin span { display: block; color: var(--bone-hi); font-size: 26px; line-height: 1; text-shadow: 0 0 8px #000, 0 0 14px color-mix(in srgb, var(--bone-hi) 67%, transparent); animation: coach-bob .9s ease-in-out infinite alternate; }
@keyframes coach-bob { from { transform: translateY(-6px); } to { transform: translateY(2px); } }

/* seat marks: shape + colour, never colour alone */
.seat-mark { color: var(--team, currentColor); font-size: .9em; line-height: 1; margin-right: .3em; display: inline-block; text-shadow: 0 0 2px #000, 0 1px 1px #000; font-family: system-ui, sans-serif; }
.swatch { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 4px; box-shadow: none; }
.swatch .seat-mark { color: #111; text-shadow: none; margin: 0; font-size: 12px; }
.tag-row { display: flex; align-items: center; gap: 3px; }
.tag-row .seat-mark { font-size: 11px; margin: 0; }
.trk-mark { display: grid; place-items: center; width: 14px; }
.trk-mark .seat-mark { margin: 0; font-size: 13px; }
.vp-name .seat-mark { font-size: .9em; }
.portrait.art { background-color: var(--bone); background-size: cover; background-position: 50% 20%; background-repeat: no-repeat; }

/* ---- quick wins from the UI research (Nov 2026) ---- */
/* odds panel */
.odds-row { display: flex; align-items: center; gap: 10px; }
.odds-word { display: flex; flex-direction: column; font-family: var(--font-body); font-weight: 700; line-height: 1.15; }
.odds-bar { height: 5px; background: #ffffff1a; border-radius: 3px; margin: 4px 0 6px; overflow: hidden; }
.odds-bar i { display: block; height: 100%; background: var(--c); }
.odds-side { display: flex; justify-content: space-between; gap: 10px; }
.odds-side > span:first-child { color: var(--ink-dim); }
.odds-side .mod { color: var(--good); }
.win-line { margin: 2px 0 4px; }
.odds-how { margin-top: 6px; padding-top: 5px; border-top: 1px solid var(--edge); line-height: 1.35; }
.odds-how .mod { color: var(--good); }
ul.obj-foot { list-style: none; margin: 8px 0 0; padding: 6px 0 0; border-top: 1px solid var(--edge); font-size: .9em; }
ul.obj-foot li { display: flex; justify-content: space-between; gap: 8px; padding: 1px 0; color: var(--ink-dim); }
ul.obj-foot li b { color: var(--accent); font-family: var(--font-body); }
.confirm-line { margin-top: 6px; padding-top: 5px; border-top: 1px solid var(--edge); font-weight: 700; color: var(--accent-hi); }

/* a 6 and a 1 look and feel different from every other roll */
.die.six { background: linear-gradient(145deg, var(--accent-hi), var(--accent)); box-shadow: 0 0 18px var(--accent-hi), inset 0 -3px 0 #0003; animation: roll .45s ease-out both, dieStamp .5s .45s ease-out both; }
.die.one { background: linear-gradient(145deg, var(--blood-deep), color-mix(in srgb, var(--blood-deep) 40%, #000)); box-shadow: 0 0 14px var(--blood), inset 0 -3px 0 #0006; }
.die.one .pips i.on { background: var(--blood-hi); }
.dice-roll.crit { animation: trayIn .25s ease-out both, critPop .6s .3s ease-out both; }
.dice-roll.crit .dr-verdict { font-size: 1.25em; letter-spacing: .08em; text-transform: uppercase; }
.dice-roll.fumble { border-color: var(--blood); }
.dice-roll.fumble .dr-verdict { color: var(--blood-hi); text-transform: uppercase; letter-spacing: .08em; }
.dice-roll.saved .dr-verdict { color: var(--accent-hi); }
@keyframes dieStamp { 0% { transform: scale(1.5) rotate(-8deg); } 60% { transform: scale(.94); } 100% { transform: none; } }
@keyframes critPop { 0% { transform: scale(1); } 30% { transform: scale(1.12); } 100% { transform: none; } }

/* the narrator: one line under the banner */
.narrator { position: absolute; left: 50%; top: calc(30% + 96px); transform: translateX(-50%); max-width: min(560px, 90vw); text-align: center; pointer-events: none;
  font-family: var(--font-voice); font-style: italic; font-size: 1.15rem; color: var(--ink); text-shadow: 0 2px 6px #000; opacity: 0;
  padding: 6px 48px; background: linear-gradient(90deg, transparent, #000b 18%, #000b 82%, transparent); }
.narrator.show { animation: narr 4.2s ease-out forwards; }
@keyframes narr { 0% { opacity: 0; } 10% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
.log-row.narr { color: var(--ink-dim); }

/* settings menu */
.menu-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; margin-top: 6px; }
.menu-grid select, .menu-grid input { width: 100%; min-width: 0; }
@media (max-width: 520px) { .menu-grid { grid-template-columns: 1fr; } }

/* text size: scale the battle panels and dialogs, not the 3D board */
.topbar, .left-stack, .unit-card, .actionbar, .side, .cam-pad, .dice-tray, .banner, .narrator, .coach, .deploy-tray, .modal, .toast { zoom: var(--ui-scale, 1); }
.modal { max-height: calc((100vh - 24px) / var(--ui-scale, 1)); }
.tip { font-size: calc(.84em * var(--ui-scale, 1)); max-width: calc(280px * var(--ui-scale, 1)); }   /* positioned in screen pixels, so sized rather than zoomed */

/* reduced motion: no tumbling, shaking or pulsing; things still appear and fade */
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
.reduce-motion .banner.show { animation: fadeHold 2.2s linear forwards !important; }
.reduce-motion .narrator.show { animation: fadeHold 4.2s linear forwards !important; }
@keyframes fadeHold { 0%, 85% { opacity: 1; } 100% { opacity: 0; } }
/* dice in the middle, just above the action bar: the roll is the moment everyone watches (and the unit card sits on the right) */
.dice-tray { right: auto; left: 50%; transform: translateX(-50%); bottom: 132px; align-items: center; z-index: 5; }
.dice-tray .dice-roll:not(:last-child) { display: none; }   /* newest roll only */

/* finished battles in the lobby: a stamp says the result in words and shape, scores per seat */
.result-card { padding: 10px 16px; }
.rc-stamp { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 76px; padding: 6px 8px; border: 2px solid var(--edge-hi); border-radius: 6px;
  font-family: var(--font-body); font-weight: 900; text-transform: uppercase; letter-spacing: .06em; font-size: .78rem; transform: rotate(-4deg); text-align: center; }
.result-card.won .rc-stamp { border-color: var(--accent); color: var(--accent); border-style: double; border-width: 4px; }
.result-card.lost .rc-stamp { color: var(--ink-dim); border-style: dashed; }
.result-card.draw .rc-stamp { color: var(--ink); }
.rc-scores { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .86em; margin-top: 4px; }
.rc-score { border-left: 3px solid var(--team); padding-left: 6px; color: var(--ink-dim); }
.rc-score b { color: var(--ink); }
.rc-score.top b { color: var(--accent); }
.result-card .gc-side { display: flex; flex-direction: row; align-items: center; gap: 6px; }

/* Strike or Drive back, beside the enemy you aimed at */
.chooser { position: fixed; z-index: 31; display: flex; gap: 6px; padding: 6px; background: color-mix(in srgb, var(--ink-0) 93%, transparent); border: 1px solid var(--edge-hi); border-radius: 9px; box-shadow: 0 8px 20px #000a; font-size: calc(1em * var(--ui-scale, 1)); }
.chooser .btn small { color: inherit; opacity: .75; margin-left: 3px; }
.drive-line { margin-top: 4px; }

/* campaign: each figure's marks toward a free skill (D34) */
.band-figs { display: flex; flex-wrap: wrap; gap: 4px 14px; width: 100%; margin: 4px 0 2px 26px; font-size: .88em; }
.band-fig { display: inline-flex; align-items: center; gap: 6px; }
.marks { display: inline-flex; gap: 3px; }
.marks i { width: 9px; height: 9px; border: 1.5px solid var(--ink-dim); transform: rotate(45deg); }
.marks i.on { background: var(--accent); border-color: var(--accent); }

/* secret missions */
.obj-missions { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--edge); display: flex; flex-direction: column; gap: 3px; font-size: .92em; }
.mission-row { border-left: 3px solid var(--team); padding-left: 6px; display: flex; gap: 6px; align-items: baseline; }
.mission-row.done b { color: var(--accent); }
.mission-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.mission-card { display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 14px; background: var(--panel-2); border: 1px solid var(--edge-hi); border-radius: var(--r); color: var(--ink); cursor: pointer; font: inherit; }
.mission-card:hover { border-color: var(--accent); }
.mission-card b { font-family: var(--font-body); font-size: 1.1rem; color: var(--accent); }
.mission-card small { color: var(--ink-dim); }
@media (max-width: 520px) { .mission-cards { grid-template-columns: 1fr; } }

/* outcome preview: health a winning attack would take blinks as a ghost */
.tag-hp i.on.ghost { background: #fff; animation: ghostPip .8s ease-in-out infinite alternate; }
@keyframes ghostPip { from { opacity: 1; } to { opacity: .25; } }
.reduce-motion .tag-hp i.on.ghost { animation: none; background: repeating-linear-gradient(45deg, #fff 0 2px, var(--blood-hi) 2px 4px); }

/* impact stack (roadmap 12): a brief bone-white flash on heavy hits */
.impact-flash { position: absolute; inset: 0; pointer-events: none; background: var(--bone-hi); opacity: 0; animation: impactFlash .32s ease-out; }
@keyframes impactFlash { 0% { opacity: var(--a, .2); } 100% { opacity: 0; } }

/* keyword mini-demos (roadmap 14): ui/demos.js. One 2.8 s loop; reduced motion shows a still frame with an arrow. */
.demo { display: block; width: 180px; height: 96px; margin: 6px 0 2px; }
.demo .dh { fill: color-mix(in srgb, var(--ink-2) 70%, var(--line)); stroke: var(--line-hi); stroke-width: 1; stroke-opacity: .5; }
.demo .dh.goal { fill: color-mix(in srgb, var(--accent) 30%, var(--ink-2)); }
.demo .dh.wood { fill: color-mix(in srgb, var(--accent-deep) 70%, var(--ink-2)); }
.demo .dtree { fill: color-mix(in srgb, var(--accent) 55%, var(--ink-0)); }
.demo .dc { fill: var(--c); stroke: #000; stroke-width: 1.5; }
.demo .dm { fill: #000; font: 900 11px system-ui, sans-serif; text-anchor: middle; }
.demo .dl { fill: var(--bone); font: 700 10px var(--font-body); text-anchor: middle; } .demo .dl.blood { fill: var(--blood-hi); } .demo .dl.accent { fill: var(--accent-hi); } .demo .dl.dim { fill: var(--bone-dim); font-weight: 400; }
.demo .da { stroke: var(--bone); stroke-width: 1.5; stroke-dasharray: 3 2; fill: none; } .demo .dah { fill: var(--bone); }
.demo .da.still { display: none; } .reduce-motion .demo .da.still { display: inline; }
.demo .dshot { stroke: var(--accent-hi); stroke-width: 1.5; stroke-dasharray: 4 3; }
.demo .dstep { fill: color-mix(in srgb, var(--ink-2) 70%, var(--line)); stroke: var(--line-hi); stroke-opacity: .5; }
.demo g, .demo text { animation: 2.8s ease-in-out infinite both; }
.demo .d-move-walk { animation-name: dMoveWalk; } .demo .d-move-hurt { animation-name: dHurt; } .demo .d-move-dmg { animation-name: dPop; }
.demo .d-push-lunge { animation-name: dLunge; } .demo .d-push-slide { animation-name: dSlide; }
.demo .d-ready-walk { animation-name: dReadyWalk; } .demo .d-ready-strike { animation-name: dReadyStrike; } .demo .d-ready-first { animation-name: dPop; }
.demo .d-cover-shield { animation-name: dPop; } .demo .dshot { animation: dShot 2.8s linear infinite; }
.demo .d-climb { animation-name: dClimb; } .demo .d-climb-a { animation-name: dPopA; } .demo .d-climb-b { animation-name: dPop; }
@keyframes dMoveWalk { 0%, 8% { transform: none; } 45% { transform: translateX(68px); } 53% { transform: translateX(80px); } 62%, 92% { transform: translateX(68px); opacity: 1; } 97% { opacity: 0; } 100% { transform: none; opacity: 0; } }
@keyframes dHurt { 0%, 53% { transform: none; } 56% { transform: translateX(4px); } 59% { transform: translateX(-3px); } 62%, 100% { transform: none; } }
@keyframes dPop { 0%, 50% { opacity: 0; transform: translateY(4px); } 58%, 88% { opacity: 1; transform: none; } 96%, 100% { opacity: 0; } }
@keyframes dPopA { 0%, 18% { opacity: 0; } 28%, 88% { opacity: 1; } 96%, 100% { opacity: 0; } }
@keyframes dLunge { 0%, 25% { transform: none; } 35% { transform: translateX(12px); } 45%, 100% { transform: none; } }
@keyframes dSlide { 0%, 34% { transform: none; } 50%, 90% { transform: translateX(34px); opacity: 1; } 96% { opacity: 0; } 100% { transform: none; opacity: 0; } }
@keyframes dReadyWalk { 0%, 8% { transform: none; opacity: 1; } 45% { transform: translateX(-102px); } 55% { transform: translateX(-96px); } 60%, 92% { transform: translateX(-102px); opacity: 1; } 97%, 100% { transform: none; opacity: 0; } }
@keyframes dReadyStrike { 0%, 46% { transform: none; } 52% { transform: translateX(10px); } 60%, 100% { transform: none; } }
@keyframes dShot { 0%, 30% { stroke-dashoffset: 40; opacity: 0; } 35% { opacity: 1; } 60% { stroke-dashoffset: 0; } 90%, 100% { opacity: 0; } }
@keyframes dClimb { 0%, 10% { transform: none; } 30% { transform: translate(58px, -18px); } 50% { transform: translate(58px, -18px); } 72%, 92% { transform: translate(114px, -54px); opacity: 1; } 97%, 100% { transform: none; opacity: 0; } }
.reduce-motion .demo g, .reduce-motion .demo text, .reduce-motion .demo .dshot { animation: none !important; }
.demo-fig { margin: 8px 0 14px; display: grid; grid-template-columns: 180px 1fr; gap: 14px; align-items: center; }
.demo-fig figcaption { font-size: .92em; line-height: 1.4; }
@media (max-width: 560px) { .demo-fig { grid-template-columns: 1fr; } }

/* phones (roadmap 16): root .phone = touch screen with a short side under 600px. Fewer panels, bigger targets,
   the figure card as a bottom sheet, attacks confirmed in a thumb-zone bar. Tablets keep the full layout. */
.phone .unit-card { display: none; }
.phone .unit-card.sheet:not(.hidden) { display: block; position: fixed; left: 0; right: 0; top: auto; bottom: 0; width: auto; max-height: 62vh; z-index: 32;
  border-radius: 16px 16px 0 0; padding: 4px 16px calc(14px + env(safe-area-inset-bottom)); animation: sheetUp .2s ease-out; }
@keyframes sheetUp { from { transform: translateY(40%); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-handle { display: block; width: 100%; height: 26px; background: none; border: 0; cursor: pointer; padding: 0; }
.sheet-handle i { display: block; width: 44px; height: 5px; border-radius: 3px; background: var(--bone-dim); margin: 8px auto; }
.phone .chooser.thumb { left: 8px; right: 8px; top: auto; bottom: calc(8px + env(safe-area-inset-bottom)); padding: 8px; gap: 8px; border-radius: 14px; }
.chooser.thumb .btn { flex: 1; justify-content: center; min-height: 54px; font-size: 1.05rem; }
.chooser.thumb .btn:last-child:not(:first-child) { flex: 0 0 auto; }
.phone .left-stack { top: 66px; width: min(220px, 56vw); }
.phone .obj-card > :not(.obj-title):not(.obj-done):not(.obj-twist) { display: none; }
.phone .obj-card.open > * { display: revert; }
.phone .obj-card { padding: 6px 10px; cursor: pointer; }
.phone .omen-card .omen-desc { display: none; }
.phone .slot { width: 52px; height: 52px; }
.phone .chip { width: 28px; height: 34px; }
.phone .score .vp { min-width: 38px; padding: 2px 6px; }
.phone .narrator { font-size: 1rem; top: auto; bottom: 150px; }
/* phones: one-line top strip and a full-width action bar with a scrolling row of big slots */
.phone .topbar { grid-template-columns: auto 1fr auto; padding: 6px 6px; gap: 4px; }
.phone .tb-right .icon-btn { display: none; }
.phone .tracker { flex-wrap: nowrap; gap: 4px; }
.phone .trk-mark, .phone .tally, .phone .strip-mid .round-box span { display: none; }
.phone .trk-seat { padding: 2px; gap: 2px; }
.phone .chip { width: 24px; height: 30px; }
.phone .chip.active { transform: translateY(2px) scale(1.15); }
.phone .strip-mid { min-width: 0; padding: 2px 6px; }
.phone .turn-status { font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 92vw; }
.phone .actionbar { left: 0; right: 0; transform: none; bottom: env(safe-area-inset-bottom); padding: 0 4px 4px; align-items: center; }
.phone .orb { width: 54px; height: 54px; flex: none; border-width: 2px; } .phone .orb-text b { font-size: 1.1rem; } .phone .orb-text span { display: none; }
.phone .bar-mid { flex: 1; min-width: 0; margin: 0 -6px; padding: 6px 10px; }
.phone .slots { flex-wrap: nowrap; overflow-x: auto; max-width: none; width: 100%; justify-content: flex-start; scrollbar-width: none; min-height: 54px; }
.phone .slot { width: 50px; height: 50px; flex: none; }
.phone .bar-hint { display: none; }
.phone .tip { max-width: calc(100vw - 16px); }
.phone .side.collapsed { transform: none; width: 44px; height: auto; overflow: hidden; }
.phone .side.collapsed .tab, .phone .side.collapsed .tab-body { display: none; }
.phone .side.collapsed .tabs { border-bottom: 0; padding: 4px; }

/* aftermath (roadmap 17) */
.aftermath .end-title { margin-bottom: 4px; }
.af-score { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.af-why { text-align: center; max-width: 560px; margin: 10px auto 8px; line-height: 1.45; }
.af-points { max-width: 520px; margin: 0 auto 12px; }
.af-points-title { text-align: center; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-dim); }
.af-beat { font-family: var(--font-voice); text-align: center; font-size: 1.05rem; margin: 6px auto 14px; max-width: 520px; color: var(--bone); }
.af-band { margin: 8px 0; }
.af-who { font-weight: 700; color: var(--team); margin-bottom: 4px; }
.af-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.af-card { background: var(--ink-2); border: 1px solid var(--line); border-top: 3px solid var(--team); border-radius: 10px; padding: 10px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 3px; animation: afIn .45s ease-out both; }
@keyframes afIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.af-card.fell .af-portrait { filter: grayscale(.9) brightness(.6); }
.af-card.lost { border-color: var(--blood-deep); }
.af-portrait { width: 72px; height: 72px; border-radius: 50%; background-color: var(--bone); background-size: cover; background-position: 50% 20%; border: 2px solid var(--team); }
.af-name { font-weight: 700; }
.af-fate { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 4px; font-size: .92em; }
.af-die { animation: roll .5s ease-out both, dieStamp .4s ease-out both; }
.af-marks { font-size: .8em; color: var(--ink-dim); display: flex; align-items: center; gap: 3px; margin-top: 2px; }
.af-marks i { width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--accent); display: inline-block; }
.af-marks i.on { background: var(--accent); }
.af-marks i.new { animation: markFill .6s .9s ease-out both; }
@keyframes markFill { from { background: transparent; transform: scale(.6); } 60% { transform: scale(1.4); } to { background: var(--accent); transform: none; } }
.af-spoils { text-align: right; margin-top: 6px; font-weight: 700; color: var(--accent); }
.af-details summary { cursor: pointer; color: var(--ink-dim); margin: 10px 0 6px; }
b.accent { color: var(--accent); }
.scar { color: var(--blood-hi); font-style: italic; }

/* sea chart (roadmap 18) */
.sea-chart { margin: 14px 0 6px; }
.sea-chart svg { width: 100%; height: auto; display: block; border-radius: 10px; border: 1px solid var(--line); }
.sc-sea { fill: color-mix(in srgb, var(--accent-deep) 45%, var(--ink-0)); }
.sc-wave { fill: none; stroke: var(--accent); stroke-opacity: .12; stroke-width: 1; }
.sc-land { fill: color-mix(in srgb, var(--bone-dim) 18%, var(--ink-1)); stroke: var(--bone-dim); stroke-opacity: .4; }
.sc-city { fill: var(--ink-0); stroke: var(--accent-hi); stroke-opacity: .5; }
.sc-place { fill: var(--bone-dim); font: italic 11px var(--font-voice); }
.sc-route { fill: none; stroke: var(--bone); stroke-opacity: .55; stroke-width: 1.5; stroke-dasharray: 5 4; }
.sc-fork { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-opacity: .6; stroke-dasharray: 3 3; } .sc-fork.on { stroke-opacity: 1; stroke-dasharray: none; stroke-width: 2.5; }
.sc-opt { fill: var(--accent); font: 600 10px var(--font-body); } .sc-opt.on { fill: var(--accent-hi); font-weight: 800; }
.sc-port { cursor: pointer; outline: none; }
.sc-dot { stroke: var(--bone); stroke-width: 1.5; }
.sc-port.sel .sc-dot, .sc-port:focus-visible .sc-dot { stroke: var(--accent-hi); stroke-width: 3; }
.sc-glow { fill: none; stroke: var(--accent-hi); stroke-width: 2; animation: scGlow 1.6s ease-in-out infinite alternate; }
@keyframes scGlow { from { stroke-opacity: .25; } to { stroke-opacity: .9; } }
.sc-mark { fill: #000; font: 900 12px system-ui, sans-serif; text-anchor: middle; } .sc-port:not(.done) .sc-mark { fill: var(--bone); font-weight: 700; }
.sc-name { fill: var(--bone); font: 600 10.5px var(--font-body); text-anchor: middle; paint-order: stroke; stroke: var(--ink-0); stroke-width: 3px; }
.sc-unlock { fill: var(--accent-hi); font: 700 9.5px var(--font-body); text-anchor: middle; paint-order: stroke; stroke: var(--ink-0); stroke-width: 3px; }
.sc-caption { padding: 8px 2px 0; }
.harbour-title { margin-top: 18px; }

/* loud spreads (roadmap 19): low-frequency screens get the zine treatment; the battle HUD stays quiet */
#app.scene-in { animation: sceneIn .45s ease-out; }
@keyframes sceneIn { from { opacity: 0; } to { opacity: 1; } }
.title-spread { text-align: center; }
.title-spread svg { width: 100%; max-width: 420px; height: auto; display: block; margin: 0 auto -6px; }
.ts-sea, .ts-wave { fill: none; stroke: var(--bone-dim); stroke-width: 1.2; } .ts-wave { stroke-opacity: .5; }
.ts-crag { fill: var(--ink-1); stroke: var(--bone-dim); stroke-width: 1.2; }
.ts-light { fill: var(--bone); stroke: var(--ink-0); stroke-width: 1; }
.ts-beam { fill: var(--bone-hi); opacity: .14; animation: tsBeam 5s ease-in-out infinite alternate; transform-origin: 38px 34px; }
@keyframes tsBeam { from { transform: rotate(-6deg); } to { transform: rotate(5deg); } }
.ts-city { fill: var(--ink-0); stroke: var(--accent); stroke-width: 1.2; }
.ts-moon { fill: none; stroke: var(--bone-dim); stroke-width: 1.2; }
.ts-name { font-family: var(--font-display); font-size: clamp(1.7rem, 6vw, 2.5rem); line-height: 1.05; letter-spacing: .05em; text-transform: uppercase; color: var(--bone); }
.ts-sub { font-family: var(--font-body); font-size: clamp(.9rem, 2.6vw, 1.15rem); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-top: 8px; }
.ts-tag { font-family: var(--font-voice); color: var(--bone-dim); margin-top: 6px; }

.omen-reveal { position: absolute; inset: 0; z-index: 40; display: flex; gap: 18px; align-items: center; justify-content: center; flex-wrap: wrap; padding: 20px;
  background: radial-gradient(ellipse at center, color-mix(in srgb, var(--ink-0) 55%, transparent), color-mix(in srgb, var(--ink-0) 85%, transparent)); cursor: pointer; animation: sceneIn .25s ease-out; }
.omen-reveal.out { opacity: 0; transition: opacity .25s; }
.omen-spread { width: min(340px, 86vw); background: var(--bone); color: var(--ink-0); border-radius: 6px; padding: 18px 22px 14px; text-align: center;
  box-shadow: 0 0 0 4px var(--ink-0), 0 0 0 5px var(--bone-dim), 0 24px 60px #000c; animation: omenFlip .6s cubic-bezier(.2, .9, .3, 1.2) both; }
@keyframes omenFlip { from { transform: perspective(800px) rotateY(90deg) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
.os-kicker { font: 700 .72rem var(--font-body); letter-spacing: .18em; text-transform: uppercase; }
.os-rule { border-top: 3px double var(--ink-0); margin: 8px 0; }
.os-name { font-family: var(--font-display); font-size: 2.4rem; line-height: 1.05; }
.os-desc { font-family: var(--font-body); font-size: 1.02rem; line-height: 1.4; }
.os-foot { font: italic .72rem var(--font-voice); opacity: .6; margin-top: 10px; }
.reduce-motion .omen-spread { animation: sceneIn .2s ease-out both; }

.broadside { background: var(--bone); color: var(--ink-0); border-radius: 4px; padding: 12px 18px 10px; text-align: center; margin-bottom: 10px;
  box-shadow: inset 0 0 0 2px var(--ink-0), inset 0 0 0 4px var(--bone); }
.bs-kicker { font: 700 .7rem var(--font-body); letter-spacing: .2em; text-transform: uppercase; }
.bs-rule { border-top: 3px double var(--ink-0); margin: 6px 0; }
.bs-word { font-family: var(--font-display); font-size: clamp(2.6rem, 9vw, 4.2rem); line-height: 1; text-transform: uppercase; letter-spacing: .04em; }
.broadside.won .bs-word { color: var(--accent-deep); } .broadside.lost .bs-word { color: var(--blood-deep); }
.bs-sub { font-family: var(--font-voice); font-size: .95rem; margin-bottom: 4px; }
.broadside .af-score { margin: 4px 0 0; font-weight: 700; }
.broadside .af-score span { color: var(--ink-0) !important; }
.broadside .seat-mark { text-shadow: none; }
.push-card { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 16px; margin-top: 14px; border-color: var(--accent); }

/* replay scrubber */
.battle.replaying .actionbar, .battle.replaying .unit-card, .battle.replaying .deploy-tray { display: none !important; }
.replay-bar { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; align-items: center; gap: 6px; padding: 8px 12px;
  width: min(820px, calc(100% - 24px)); flex-wrap: wrap; justify-content: center; zoom: var(--ui-scale, 1); }
.rp-title { font-family: var(--font-display); font-size: 1.15rem; color: var(--accent); margin-right: 4px; }
.rp-slider { flex: 1; min-width: 140px; }
.rp-where { font-size: .82em; color: var(--ink-dim); min-width: 150px; }
.rp-play { min-width: 92px; justify-content: center; }
.phone .replay-bar { bottom: env(safe-area-inset-bottom); width: 100%; border-radius: 14px 14px 0 0; }
.obj-twist { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); font-size: .86em; } .obj-twist b { color: var(--accent); }

/* ---- playtest survey (D43): the deckbuilder's shape, in Fogbound's ink and bone ---- */
.survey { border-top: 1px solid var(--edge); padding-top: 10px; margin-top: 6px; }
.survey > summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.survey > summary::-webkit-details-marker { display: none; }
.survey > summary b { font-family: var(--font-display); font-size: 1.25em; font-weight: normal; }
.survey > summary::before { content: '▸'; color: var(--accent); } .survey[open] > summary::before { content: '▾'; }
.sv-body { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.sv-qt { margin-bottom: 6px; }
.sv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sv-chip { font: inherit; color: var(--ink); background: var(--panel-2); border: 1px solid var(--edge); border-radius: 999px; padding: 7px 14px; min-height: 36px; cursor: pointer; }
.sv-chip:hover { border-color: var(--edge-hi); }
.sv-chip[aria-pressed=true] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.sv-chip[aria-pressed=true]::before { content: '✓ '; }
.sv-chip:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }
.sv-chips.scale .sv-chip { min-width: 46px; text-align: center; }
.sv-ends { display: flex; justify-content: space-between; max-width: 280px; margin-top: 3px; }
.sv-progress { display: flex; align-items: center; gap: 10px; }
.sv-bar { flex: 0 0 140px; height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
.sv-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s; }
.sv-sub { font-family: var(--font-display); font-size: 1.1em; margin-top: 4px; }
.sv-word { display: flex; flex-direction: column; gap: 4px; }
.sv-word textarea, .sv-word input { font: inherit; color: var(--ink); background: #0008; border: 1px solid var(--edge); border-radius: 6px; padding: 8px 10px; resize: vertical; }
.sv-word textarea:focus { outline: none; border-color: var(--accent); }
.sv-about { display: flex; flex-direction: column; gap: 12px; border-top: 1px dashed var(--edge); padding-top: 10px; }
.phone .sv-chip { min-height: 44px; }
.sv-admin-main { max-width: 980px; margin: 0 auto; padding: 0 16px 40px; }
.sv-admin { display: flex; flex-direction: column; gap: 12px; }
.sv-tally-head { margin-bottom: 10px; }
.sv-tally-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px 22px; }
.sv-tq-q { margin-bottom: 4px; }
.sv-tq-row { display: grid; grid-template-columns: 9em 1fr 2em; align-items: center; gap: 8px; font-size: .9em; }
.sv-tq-bar { height: 8px; background: var(--panel-2); border-radius: 4px; overflow: hidden; }
.sv-tq-bar i { display: block; height: 100%; background: var(--accent); }
.sv-tq-n { text-align: right; }
.sv-row { display: flex; flex-direction: column; gap: 6px; }
.sv-row-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sv-row-head .grow { flex: 1; }
.sv-row-ans { display: flex; flex-wrap: wrap; gap: 6px; }
.sv-pill { border: 1px solid var(--edge); border-radius: 999px; padding: 2px 10px; font-size: .9em; }
.sv-row-word { margin: 0; font-family: var(--font-voice); }

/* ---- band builder help (D43) ---- */
.builder-note { border: 1px solid var(--accent-hi); border-radius: var(--r); padding: 10px 12px; background: color-mix(in srgb, var(--accent-deep) 35%, var(--panel)); }
.builder-note .coach-who { color: var(--accent-hi); font-size: .85em; text-transform: uppercase; letter-spacing: .06em; display: flex; align-items: center; gap: 4px; }
.builder-note p { margin: 6px 0; }
/* the builder's guide: the same coach look, kept in view while you scroll its step; the step it talks about is ringed */
.builder-guide { position: sticky; top: 0; z-index: 3; border: 1px solid var(--accent-hi); border-radius: var(--r); padding: 10px 12px; background: color-mix(in srgb, var(--accent-deep) 45%, var(--panel)); box-shadow: 0 6px 18px rgb(0 0 0 / .45); }
.builder-guide .coach-who { color: var(--accent-hi); font-size: .85em; text-transform: uppercase; letter-spacing: .06em; display: flex; align-items: center; gap: 4px; }
.builder-guide .bg-title { display: block; margin-top: 4px; }
.builder-guide p { margin: 6px 0; }
.step.guide-on { outline: 2px solid var(--accent-hi); outline-offset: 4px; border-radius: var(--r); }
.gear-key { margin: 2px 0 6px; }
.sf-kind { font-size: .8em; text-transform: uppercase; letter-spacing: .05em; color: var(--bone-dim); min-width: 4.2em; align-self: center; }
.sf-has { font-size: .85em; margin-top: 4px; display: grid; gap: 2px; }
.sf-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: .85em; color: var(--bone-dim); }
.sf-stats b { color: var(--ink); }
.sf-stats .up b { color: var(--accent); }
.sf-stats .preview { outline: 1px dashed var(--accent); outline-offset: 2px; border-radius: 4px; }
.ally-card.ready .rb-head { display: flex; align-items: center; gap: 6px; }
.ally-card.ready .rb-figs { color: var(--ink); opacity: .85; }

/* camera pad: the board's turn, tilt, zoom and home as buttons, each naming its mouse and key shortcut */
.cam-pad { position: absolute; left: 12px; bottom: 12px; display: grid; grid-template-columns: repeat(3, 36px); gap: 4px; padding: 6px; }
.cam-pad button { width: 36px; height: 36px; display: grid; place-items: center; font: 700 17px/1 var(--font-body); color: var(--ink); background: var(--ink-1); border: 1px solid var(--edge); border-radius: 8px; cursor: pointer; }
.cam-pad button:hover, .cam-pad button:focus-visible { border-color: var(--accent); color: var(--accent-hi); }
.cam-pad .cam-label { grid-column: 1 / -1; text-align: center; font-size: .7rem; color: var(--ink-dim); letter-spacing: .06em; text-transform: uppercase; }
.phone .cam-pad { display: none; }
@media (max-width: 900px) { .cam-pad { bottom: 120px; } }
@media (max-width: 900px) { .side.collapsed { bottom: 120px; } }   /* narrow: the folded row stays where the panel's foot was */
