:root {
  --font-display: 'Chakra Petch', 'Segoe UI', sans-serif;
  --font-body: 'IBM Plex Sans', 'Segoe UI', sans-serif;
  --bg: #070b16;
  --bg2: #0a1020;
  --panel: #0e1529;
  --panel2: #131c36;
  --panel3: #1a2545;
  --line: rgba(140, 170, 255, 0.14);
  --line2: rgba(140, 170, 255, 0.28);
  --text: #e6ebf5;
  --muted: #8d98b3;
  --faint: #5b6684;
  --blue: #3d8bff;
  --blue-d: #12305f;
  --red: #ff4d5e;
  --red-d: #5a1520;
  --gold: #ffc93c;
  --good: #42d6a4;
  --bad: #ff6b6b;
  --radius: 6px;
  --t: 160ms cubic-bezier(0.16, 1, 0.3, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
body { overflow-x: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; letter-spacing: 0.02em; }
.num { font-variant-numeric: tabular-nums lining-nums; }
a { color: var(--gold); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 8px 14px; border-radius: var(--radius); border: 1px solid var(--line2); background: var(--panel2); font-family: var(--font-display); font-weight: 600; font-size: 14px; letter-spacing: 0.04em; text-transform: uppercase; transition: background var(--t), border-color var(--t), transform var(--t); }
.btn:hover:not(:disabled) { background: var(--panel3); border-color: rgba(255, 201, 60, 0.55); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; }
.btn.primary { background: var(--gold); color: #1b1404; border-color: var(--gold); }
.btn.primary:hover:not(:disabled) { background: #ffd765; }
.btn.ghost { background: transparent; }
.btn.small { min-height: 30px; padding: 4px 10px; font-size: 12px; }
.btn.on { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); color: var(--gold); }
.btn.blue { border-color: var(--blue); }
.btn.red { border-color: var(--red); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }

/* ---------- title ---------- */
.screen { min-height: 100vh; }
.title-screen { position: relative; display: grid; place-items: center; padding: 40px 20px; overflow: hidden; }
.title-bg { position: absolute; inset: 0; z-index: 0; opacity: 0.9; }
.title-inner { position: relative; z-index: 1; width: min(980px, 100%); display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: center; }
.brand-mark { display: flex; align-items: center; gap: 10px; color: var(--gold); font-family: var(--font-display); font-weight: 600; letter-spacing: 0.08em; font-size: 14px; text-transform: lowercase; }
.title-inner h1 { font-size: clamp(40px, 6vw, 72px); line-height: 0.95; margin: 18px 0 14px; font-weight: 700; text-transform: uppercase; }
.title-inner h1 span { color: var(--gold); display: block; }
.title-inner p.lede { color: var(--muted); font-size: 16px; max-width: 46ch; margin: 0 0 22px; }
.stat-strip { display: flex; gap: 22px; color: var(--muted); font-size: 13px; }
.stat-strip b { display: block; color: var(--text); font-family: var(--font-display); font-size: 22px; }
.menu { display: grid; gap: 10px; }
.menu .btn { justify-content: space-between; min-height: 56px; padding: 10px 18px; font-size: 15px; text-align: left; }
.menu .btn small { display: block; font-family: var(--font-body); text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.menu .btn.primary small { color: #4a3a0c; }
.menu .btn .k { font-size: 18px; opacity: 0.7; }
.footer-note { position: relative; z-index: 1; margin-top: 30px; color: var(--faint); font-size: 12px; text-align: center; grid-column: 1 / -1; }

/* ---------- generic page ---------- */
.page { max-width: 1240px; margin: 0 auto; padding: 22px 20px 60px; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h2 { font-size: 26px; text-transform: uppercase; }
.page-head .sub { color: var(--muted); font-size: 14px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.panel h3 { font-size: 15px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: 340px 1fr; gap: 18px; align-items: start; }
label.field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
select, input[type=text], input[type=number] { font: inherit; color: var(--text); background: var(--bg2); border: 1px solid var(--line2); border-radius: var(--radius); padding: 8px 10px; min-height: 38px; }
input[type=checkbox] { accent-color: var(--gold); width: 16px; height: 16px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 10px; }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: var(--radius); overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 7px 12px; font-size: 13px; font-family: var(--font-display); font-weight: 600; }
.seg button.on { background: var(--gold); color: #1b1404; }

/* ---------- squad select ---------- */
.roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.set-label { grid-column: 1 / -1; font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-size: 13px; margin: 8px 0 -2px; }
.ucard { position: relative; text-align: left; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; transition: border-color var(--t), background var(--t); }
.ucard:hover { border-color: var(--line2); }
.ucard.sel { border-color: var(--gold); background: #1b2138; box-shadow: 0 0 0 1px var(--gold); }
.ucard .uh { display: flex; gap: 10px; align-items: flex-start; }
.ucard .badge { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 13px; background: #0a1020; border: 2px solid var(--line2); }
.ucard .nm { font-family: var(--font-display); font-weight: 600; font-size: 15px; line-height: 1.15; }
.ucard .sb { color: var(--muted); font-size: 12px; }
.stats { display: flex; gap: 10px; margin: 8px 0 6px; font-size: 12px; color: var(--muted); }
.stats b { color: var(--text); font-family: var(--font-display); font-size: 15px; margin-left: 3px; }
.wl { font-size: 12px; color: var(--muted); }
.wl div { display: flex; justify-content: space-between; gap: 8px; }
.wl span.w { color: var(--text); }
.trait { display: inline-block; font-size: 10.5px; padding: 1px 6px; border-radius: 99px; border: 1px solid var(--line2); color: var(--muted); margin: 4px 4px 0 0; }
.pickn { position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border-radius: 50%; background: var(--gold); color: #1b1404; font-weight: 700; display: grid; place-items: center; font-size: 13px; }
.deck-list { display: grid; gap: 6px; max-height: 420px; overflow: auto; padding-right: 4px; }
.deck-item { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; padding: 6px 8px; border-radius: 6px; background: var(--bg2); border: 1px solid transparent; }
.deck-item.on { border-color: rgba(255, 201, 60, 0.4); }
.deck-item .ct { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.deck-item b { font-family: var(--font-display); font-weight: 600; }

/* ---------- game ---------- */
.game { display: grid; grid-template-rows: auto auto 1fr; height: 100vh; min-height: 620px; }
.hud { display: flex; align-items: center; gap: 14px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--bg2); min-height: 52px; }
.hud .brand-mark { font-size: 13px; }
.phase { font-family: var(--font-display); font-weight: 600; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.phase b { color: var(--text); }
.score { display: flex; align-items: center; gap: 6px; font-family: var(--font-display); font-weight: 700; }
.score .pl { display: flex; align-items: center; gap: 8px; padding: 4px 12px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); min-width: 120px; }
.score .pl .nm { font-size: 13px; font-weight: 600; color: var(--muted); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score .pl .vp { font-size: 22px; margin-left: auto; }
.score .pl.A { border-left: 3px solid var(--blue); }
.score .pl.B { border-left: 3px solid var(--red); }
.score .pl.turn { box-shadow: 0 0 0 1px var(--gold); }
.timeline { display: flex; align-items: stretch; gap: 4px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--bg); overflow-x: auto; }
.tl-slot { flex: 1 0 64px; min-height: 58px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); padding: 3px 4px 4px; display: flex; flex-direction: column; gap: 3px; }
.tl-slot .rn { font-family: var(--font-display); font-size: 11px; color: var(--faint); font-weight: 600; display: flex; justify-content: space-between; }
.tl-slot.now { border-color: var(--gold); background: #1a1a22; }
.tl-slot.now .rn { color: var(--gold); }
.tl-slot.past { opacity: 0.55; }
.tl-slot.next { flex-basis: 110px; background: var(--bg2); border-style: dashed; }
.tl-tokens { display: flex; flex-wrap: wrap; gap: 3px; }
.tl-tok { font-family: var(--font-display); font-weight: 700; font-size: 11px; padding: 1px 6px; border-radius: 99px; border: 1.5px solid; background: #0a1020; line-height: 16px; cursor: default; }
.tl-tok.A { border-color: var(--blue); color: #b9d4ff; }
.tl-tok.B { border-color: var(--red); color: #ffc2c8; }
.tl-tok.active { background: var(--gold); color: #1b1404; border-color: var(--gold); }
.tl-tok.res { border-style: dashed; opacity: 0.8; }
.main { display: grid; grid-template-columns: 1fr 370px; min-height: 0; }
.board-wrap { position: relative; min-height: 0; overflow: hidden; background: radial-gradient(1200px 600px at 50% 40%, #0c1530, var(--bg)); }
.board-wrap svg { width: 100%; height: 100%; display: block; touch-action: manipulation; }
.side { border-left: 1px solid var(--line); background: var(--bg2); overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.sec h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.sec h4 .ct { margin-left: auto; color: var(--faint); font-weight: 500; letter-spacing: 0.04em; }
.acard { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.acard.A { border-top: 3px solid var(--blue); }
.acard.B { border-top: 3px solid var(--red); }
.acard .top { display: flex; gap: 10px; align-items: center; }
.acard .nm { font-family: var(--font-display); font-weight: 700; font-size: 17px; line-height: 1.1; }
.acard .sb { color: var(--muted); font-size: 12px; }
.hpbar { height: 8px; border-radius: 99px; background: #1f2a47; overflow: hidden; margin: 10px 0 4px; }
.hpbar i { display: block; height: 100%; background: linear-gradient(90deg, #42d6a4, #8ef0c8); transition: width 300ms; }
.hpbar.low i { background: linear-gradient(90deg, #ff6b6b, #ff9a8a); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.chip { font-size: 11.5px; padding: 2px 8px; border-radius: 99px; background: var(--panel3); border: 1px solid var(--line); color: var(--text); }
.chip.st { border-color: rgba(255, 107, 107, 0.5); color: #ffb3b3; }
.chip.en { border-color: rgba(255, 201, 60, 0.5); color: var(--gold); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.actions .btn { font-size: 12.5px; min-height: 40px; }
.actions .btn .tl { font-family: var(--font-body); font-weight: 500; color: var(--muted); font-size: 11px; text-transform: none; }
.wbtn { width: 100%; text-align: left; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 9px 10px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); margin-bottom: 6px; transition: border-color var(--t), background var(--t); }
.wbtn:hover:not(:disabled) { border-color: var(--line2); background: var(--panel2); }
.wbtn.on { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.wbtn:disabled { opacity: 0.45; }
.wbtn .wn { font-family: var(--font-display); font-weight: 600; font-size: 14px; }
.wbtn .ws { font-family: var(--font-display); font-size: 12px; color: var(--muted); white-space: nowrap; }
.wbtn .ws b { color: var(--text); }
.wbtn .wt { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.wbtn .tag { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--gold); }
.hand { display: grid; gap: 6px; }
.tcard { text-align: left; border-radius: 8px; padding: 8px 10px; background: linear-gradient(160deg, #1a2140, #121a31); border: 1px solid var(--line); }
.tcard .ty { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); display: flex; justify-content: space-between; }
.tcard .ty.command { color: #8ab4ff; }
.tcard .ty.response { color: #ff9aa6; }
.tcard .ty.attack { color: var(--gold); }
.tcard b { font-family: var(--font-display); font-size: 14px; display: block; margin: 1px 0 2px; }
.tcard p { margin: 0; font-size: 12px; color: var(--muted); }
.tcard.playable { border-color: rgba(255, 201, 60, 0.45); }
.tcard.playable:hover { border-color: var(--gold); }
.tcard .why { font-size: 11px; color: var(--faint); margin-top: 3px; }
.log { font-size: 12.5px; color: var(--muted); max-height: 230px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding-right: 4px; }
.log div { padding: 2px 0 2px 8px; border-left: 2px solid transparent; }
.log .act { color: var(--text); border-left-color: var(--gold); margin-top: 6px; font-weight: 500; }
.log .roll { color: #c9d4ee; }
.log .bad { color: #ffb0b0; }
.log .good { color: #9ef0cf; }
.log .crit { color: var(--gold); }
.log .card { color: #c7b6ff; }
.log .sys { color: var(--gold); border-left-color: var(--gold); font-weight: 500; }
.hint { font-size: 13px; color: var(--muted); background: var(--panel); border: 1px dashed var(--line2); border-radius: 8px; padding: 10px; }
.wait { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; color: var(--muted); padding: 12px; }
.wait i { width: 10px; height: 10px; border-radius: 50%; background: var(--gold); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }

/* prompt + dice overlays */
.prompt { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 5; width: min(560px, calc(100% - 24px)); background: rgba(14, 21, 41, 0.96); border: 1px solid var(--gold); border-radius: 10px; padding: 12px 14px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); backdrop-filter: blur(8px); }
.prompt .who { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; font-family: var(--font-display); font-weight: 600; }
.prompt .q { font-family: var(--font-display); font-weight: 600; font-size: 16px; margin: 2px 0 8px; }
.prompt .opt { display: block; width: 100%; text-align: left; margin-bottom: 6px; padding: 8px 10px; border-radius: 8px; background: var(--panel2); border: 1px solid var(--line2); }
.prompt .opt:hover { border-color: var(--gold); }
.prompt .opt b { font-family: var(--font-display); }
.prompt .opt span { display: block; font-size: 12px; color: var(--muted); }
.dice { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 4; background: rgba(10, 16, 32, 0.94); border: 1px solid var(--line2); border-radius: 10px; padding: 10px 14px; display: none; max-width: calc(100% - 24px); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); }
.dice.show { display: block; animation: rise 240ms var(--t); }
@keyframes rise { from { transform: translate(-50%, 10px); opacity: 0; } }
.dice .dh { font-size: 12px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 10px; justify-content: space-between; }
.dice .dh b { color: var(--text); font-family: var(--font-display); }
.dice .dd { display: flex; gap: 5px; flex-wrap: wrap; }
.die { width: 32px; height: 32px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 15px; border-radius: 7px; background: #1d2747; color: var(--faint); border: 1px solid var(--line2); clip-path: polygon(50% 0, 100% 38%, 82% 100%, 18% 100%, 0 38%); animation: roll 380ms ease-out both; }
.die.hit { background: #e8edf7; color: #0b1020; }
.die.crit { background: var(--gold); color: #1b1404; }
.die.re::after { content: ''; }
@keyframes roll { 0% { transform: rotate(-180deg) scale(0.4); opacity: 0; } 100% { transform: none; opacity: 1; } }
.dice .res { margin-top: 6px; font-size: 13px; color: var(--text); }
.board-tools { position: absolute; right: 10px; bottom: 10px; z-index: 3; display: flex; gap: 6px; }
.legend { position: absolute; left: 10px; bottom: 10px; z-index: 3; font-size: 11px; color: var(--muted); background: rgba(10, 16, 32, 0.8); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; display: flex; gap: 10px; flex-wrap: wrap; max-width: 60%; }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.tip { position: fixed; z-index: 50; pointer-events: none; width: 270px; background: rgba(14, 21, 41, 0.97); border: 1px solid var(--line2); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); display: none; }
.tip b { font-family: var(--font-display); font-size: 14px; }

/* modal */
.modal-bg { position: fixed; inset: 0; z-index: 60; background: rgba(3, 6, 14, 0.72); display: grid; place-items: center; padding: 20px; backdrop-filter: blur(4px); }
.modal { width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--panel); border: 1px solid var(--line2); border-radius: 12px; padding: 22px; }
.modal h2 { font-size: 24px; text-transform: uppercase; margin-bottom: 8px; }
.modal p { color: var(--muted); }
.big-score { display: flex; gap: 14px; margin: 16px 0; }
.big-score div { flex: 1; text-align: center; padding: 12px; border-radius: 10px; background: var(--panel2); }
.big-score b { display: block; font-family: var(--font-display); font-size: 40px; }
.big-score .A { border-top: 3px solid var(--blue); }
.big-score .B { border-top: 3px solid var(--red); }

/* tutorial */
.tut { background: rgba(14, 21, 41, 0.97); border: 1px solid var(--gold); border-radius: 12px; padding: 14px 16px; box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55); }
.tut .st { font-size: 11px; color: var(--gold); text-transform: uppercase; letter-spacing: 0.1em; font-family: var(--font-display); font-weight: 600; display: flex; justify-content: space-between; }
.tut h3 { font-size: 18px; margin: 4px 0 6px; }
.tut p { margin: 0 0 10px; font-size: 14px; color: #c9d1e4; }
.tut .do { font-size: 13px; color: var(--gold); margin-bottom: 10px; }
.tut-glow { outline: 2px solid var(--gold) !important; outline-offset: 2px; animation: glow 1.2s infinite; }
@keyframes glow { 50% { outline-color: rgba(255, 201, 60, 0.25); } }

/* editor */
.tools { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tools .btn { font-size: 11.5px; min-height: 32px; padding: 4px 9px; }
.editor-board { background: radial-gradient(900px 500px at 50% 40%, #0c1530, var(--bg)); border-radius: 10px; border: 1px solid var(--line); }
.editor-board svg { width: 100%; height: auto; display: block; max-height: 62vh; }

/* rules */
.rules { columns: 2 380px; column-gap: 28px; }
.rules section { break-inside: avoid; margin-bottom: 18px; }
.rules h3 { font-size: 16px; color: var(--gold); margin-bottom: 6px; text-transform: uppercase; }
.rules p, .rules li { font-size: 14px; color: #c5cde0; margin: 0 0 6px; }
.rules ul { padding-left: 18px; margin: 0; }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.code { font-family: var(--font-display); font-size: 34px; letter-spacing: 0.25em; color: var(--gold); background: var(--bg2); border: 1px dashed var(--gold); border-radius: 10px; padding: 10px 18px; display: inline-block; }

#toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 80; background: #2a1620; border: 1px solid var(--red); color: #ffd0d5; padding: 9px 14px; border-radius: 8px; font-size: 14px; display: none; max-width: calc(100vw - 30px); }
#toast.show { display: block; }
#toast.ok { background: #102a22; border-color: var(--good); color: #c8f7e6; }

@media (max-width: 1000px) {
  .title-inner { grid-template-columns: 1fr; gap: 28px; }
  .grid2 { grid-template-columns: 1fr; }
  .game { height: auto; grid-template-rows: auto auto auto; }
  .main { grid-template-columns: 1fr; }
  .board-wrap { height: 62vh; min-height: 380px; }
  .side { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .hud { flex-wrap: wrap; gap: 8px; }
  .hud .brand-mark { display: none; }
  .score .pl { min-width: 0; padding: 4px 8px; }
  .score .pl .nm { max-width: 70px; }
  .legend { display: none; }
  .tl-slot { flex-basis: 54px; }
}
@media (max-width: 520px) {
  .hud .phase { width: 100%; order: 3; }
  .board-wrap { height: 54vh; min-height: 330px; }
  .score .pl .vp { font-size: 18px; }
}
.spin { transform-box: fill-box; transform-origin: center; animation: spin 6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pulse { animation: pulse 1s infinite; }
#board [data-k] { cursor: pointer; }
#ed [data-k] { cursor: crosshair; }
@media (max-width: 1000px) { .sq-grid { grid-template-columns: 1fr !important; } .sq-grid > .panel { position: static !important; } }
@media (prefers-reduced-motion: reduce) { .spin, .pulse, .die, .tut-glow { animation: none !important; } }

.board-scroll { position: absolute; inset: 0; overflow: hidden; }
.board-inner { position: relative; width: 100%; height: 100%; }
#board, #fxl { position: absolute; inset: 0; width: 100%; height: 100%; }
#fxl { pointer-events: none; }
@media (max-width: 1000px) {
  .board-scroll { overflow: auto; -webkit-overflow-scrolling: touch; }
  .board-inner { width: max(100%, 780px); height: 100%; min-height: 520px; }
  .board-wrap { height: 70vh; min-height: 420px; max-height: 640px; }
}

.sq-bar { display: none; }
@media (max-width: 1000px) {
  .sq-bar { display: flex; align-items: center; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 10px 14px; background: rgba(10, 16, 32, 0.97); border-top: 1px solid var(--line2); font-family: var(--font-display); font-weight: 600; }
  .page { padding-bottom: 90px; }
}

/* tabletop look */
.board-wrap { background: radial-gradient(1200px 600px at 50% 40%, #1a2030, #0a0d14); }
.march { animation: march 1.2s linear infinite; }
@keyframes march { to { stroke-dashoffset: -20; } }
@media (prefers-reduced-motion: reduce) { .march { animation: none !important; } }
.mini-portrait { display: block; flex: 0 0 auto; background: radial-gradient(circle at 50% 70%, #2a3242, #0d111a 70%); border-radius: 10px; border: 1px solid rgba(140,170,255,.25); }
.ucard .uh { align-items: center; }
