/* Layout idea: an operations table. Map on the left, orders on the right, stacking to one column on a phone. Single dark theme by choice. */
:root {
  color-scheme: dark;
  --sea: #13202c; --panel: #0e1821; --raised: #18252f; --line: #2c4052;
  --ink: #e9eff4; --muted: #93a6b7; --accent: #f0a93b; --danger: #ea6a5e; --ok: #74c08a;
  --na: #cdbb62; --sa: #c8552b; --eu: #96b6ea; --af: #7c5741; --as: #2f6d6c; --au: #5e5080;
  --display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--panel); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.45; }
h1, h2, h3 { font-family: var(--display); letter-spacing: .04em; text-transform: uppercase; margin: 0; text-wrap: balance; }
h1 { font-size: 26px; font-weight: 800; }
h2 { font-size: 20px; font-weight: 800; color: var(--accent); }
h3 { font-size: 15px; font-weight: 600; color: var(--muted); }
p { margin: 0; }
.top { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.status { color: var(--muted); font-size: 13px; }
.status b { color: var(--ink); font-weight: 600; }
.layout { display: block; padding: 16px; transition: padding-right .3s ease; }
.boardcol, .panel { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.boardscroll { overflow-x: auto; background: var(--sea); border: 1px solid var(--line); border-radius: 6px; }
#map { display: block; width: 100%; min-width: 760px; height: auto; }
#map text { font-family: var(--body); pointer-events: none; }
.terr { cursor: pointer; }
.terr .lbl { font-size: 8.5px; fill: #f4f7fa; font-weight: 500; paint-order: stroke; stroke: rgba(8, 14, 20, .75); stroke-width: 2.2px; }
.terr .edge { stroke: #0b141c; stroke-width: 1.6; fill: none; stroke-linecap: round; }
.terr.sel .edge { stroke: var(--accent); stroke-width: 3; }
.terr.opt .edge { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 4 3; }
.terr:focus-visible .edge { stroke: #fff; stroke-width: 3; }
.terr:focus { outline: none; }
.tok text { font-size: 11px; font-weight: 600; text-anchor: middle; }
.sealine { stroke: #5d7f9c; stroke-width: 1.3; stroke-dasharray: 3 4; fill: none; }
.mark { font-size: 7.5px; font-weight: 600; text-anchor: middle; }
.box { background: var(--raised); border: 1px solid var(--line); border-radius: 6px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.muted { color: var(--muted); font-size: 13px; }
.err { color: var(--danger); font-weight: 500; }
button { font: inherit; font-weight: 600; color: var(--ink); background: #23384a; border: 1px solid #3c566d; border-radius: 5px; padding: 8px 12px; min-height: 40px; cursor: pointer; }
button:hover { background: #2c465c; }
button.primary { background: var(--accent); border-color: var(--accent); color: #1b1203; }
button.primary:hover { filter: brightness(1.08); }
button.on { outline: 2px solid var(--accent); outline-offset: 1px; }
button:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
input, select, textarea { font: inherit; color: var(--ink); background: #0b141c; border: 1px solid #3c566d; border-radius: 5px; padding: 8px 10px; min-height: 40px; max-width: 100%; }
input[type=number] { width: 84px; }
textarea { width: 100%; min-height: 70px; font-size: 12px; }
label { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.players { display: flex; flex-direction: column; gap: 6px; }
.pl { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 5px; border: 1px solid transparent; }
.pl.turn { border-color: var(--accent); background: rgba(240, 169, 59, .08); }
.pl.out { opacity: .5; }
.pl .nm { font-weight: 600; overflow-wrap: anywhere; }
.pl .st { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.pl .st b { color: var(--accent); }
.emb { width: 26px; height: 26px; border-radius: 5px; display: grid; place-items: center; }
.emb svg { width: 18px; height: 18px; }
.cards { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.card { background: var(--raised); border: 1px solid var(--line); border-radius: 5px; padding: 6px 9px; min-width: 96px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; text-align: left; min-height: 0; font-weight: 500; }
.card small { color: var(--muted); font-size: 11px; font-weight: 400; }
.card .coins { color: var(--accent); letter-spacing: 1px; }
.cardgroup { display: flex; flex-direction: column; gap: 6px; }
.cardgroup > .row { align-items: stretch; }
.dice { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.die { width: 38px; height: 38px; min-height: 0; padding: 0; border-radius: 7px; display: grid; place-items: center; font-family: var(--display); font-size: 24px; font-weight: 800; }
.die.a { background: #10161d; color: #fff; border: 1px solid #55697b; }
.die.d { background: #b93a30; color: #fff; border: 1px solid #e0786f; }
.die.lock { box-shadow: 0 0 0 2px var(--accent); }
.log { font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; max-height: 190px; overflow-y: auto; padding: 0 2px; }
.log div:last-child { color: var(--ink); }
details { border-top: 1px solid var(--line); padding-top: 8px; }
summary { cursor: pointer; font-family: var(--display); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; color: var(--muted); }
details > div { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; font-size: 13px; }
.opt2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 420px) { .opt2 { grid-template-columns: 1fr; } }
.opt2 button { text-align: left; font-weight: 400; font-size: 13px; display: flex; flex-direction: column; gap: 3px; }
.opt2 button b { font-weight: 600; font-size: 14px; }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.tag.hot { border-color: var(--accent); color: var(--accent); }
@media (prefers-reduced-motion: no-preference) { button { transition: background .12s; } }
.card:disabled { opacity: 1; cursor: default; }
:root { --isl: #6d7f4a; }
.sealine.new { stroke: var(--accent); }
button.mini { min-height: 30px; padding: 3px 9px; font-size: 12.5px; margin-left: 8px; }
.code { font-family: var(--display); font-size: 22px; letter-spacing: .12em; color: var(--accent); }
.pl .sheet { grid-column: 1 / -1; border-top: 0; padding-top: 0; }
.sheet summary { font-size: 12.5px; }
.sheet > div { font-size: 12.5px; color: var(--muted); }
.sheet b { color: var(--ink); }
select { min-width: 0; }
.fart { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 5px; border: 1px solid var(--line); }
.hero { position: relative; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #05080c; }
.hero img { display: block; width: 100%; height: auto; }
.herotitle { position: absolute; left: 0; right: 0; top: 9%; text-align: center; font-family: var(--display); font-weight: 800; font-size: clamp(28px, 6.5vw, 76px); letter-spacing: .08em; text-transform: uppercase; color: #f3e6cf; text-shadow: 0 2px 18px rgba(0, 0, 0, .8); }
[hidden] { display: none !important; }
.terr .tint { opacity: .66; }
.sealine { stroke: #a9cbe3; opacity: .8; }
.sealine.new { stroke: var(--accent); opacity: 1; }
.terr .edge { stroke: #0a1118; stroke-width: 1.8; }
/* Real-outline map */
#map { min-width: 940px; }
.bord { fill: none; stroke: #070d13; stroke-width: 2.6px; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.terr path { vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.terr .tint { opacity: .68; stroke-width: 1px; }
.terr .hl { fill: none; stroke: var(--accent); stroke-width: 3px; }
.terr.opt .hl { stroke-width: 2px; stroke-dasharray: 5 4; }
.terr:focus-visible .tint { stroke: #fff; stroke-width: 2.5px; opacity: 1; }
.tk { cursor: pointer; }
.tk .lbl { font-size: 7.2px; fill: #f6f8fa; font-weight: 500; paint-order: stroke; stroke: rgba(6, 11, 16, .8); stroke-width: 2px; }
.tk .tok text { font-size: 9.5px; font-weight: 600; text-anchor: middle; }
.tk .mark { font-size: 6.5px; }
.bord { stroke-width: 3.6px; }
.terr .tint { stroke-width: .5px; }
.credit { font-size: 11.5px; color: var(--muted); }
.bord { stroke-width: 2px; }
.terr .tint { opacity: .7; }
.plate { pointer-events: none; }
.plate .pn { font-family: var(--display); font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; fill: #f3f6f8; }
.plate .pb { font-size: 7px; fill: #c5d1db; }
.pile { position: relative; width: 66px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); text-align: center; }
.pile img { width: 66px; aspect-ratio: 5 / 7; object-fit: cover; border-radius: 5px; border: 1px solid #0a1118; box-shadow: 2px 2px 0 #0a1118, 4px 4px 0 rgba(10, 17, 24, .6); }
.pile b { position: absolute; top: 30px; left: 0; right: 0; font-family: var(--display); font-size: 24px; color: #fff; text-shadow: 0 1px 6px #000; }
.pile.coin { justify-content: flex-end; }
.pile.coin b { position: static; width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: #1b1203; text-shadow: none; display: grid; place-items: center; border: 2px solid #7a4d08; }
.backthumb { width: 34px; aspect-ratio: 5 / 7; object-fit: cover; border-radius: 3px; border: 1px solid #0a1118; }
.card { min-width: 112px; }
.card .mini { width: 100%; height: 58px; background: #0e1821; border-radius: 4px; padding: 4px; box-sizing: border-box; }
.card .mini path { vector-effect: non-scaling-stroke; stroke-width: 1px; }
.card .mini.coinface { display: grid; place-items: center; color: var(--accent); font-size: 30px; line-height: 1; }
.ic { width: 14px; height: 14px; vertical-align: -2px; margin-right: 2px; }
.ic.big { width: 19px; height: 19px; vertical-align: -4px; }
.ic.off { opacity: .22; filter: grayscale(1); }
.card .mini.coincard { object-fit: contain; padding: 2px; }
.pile.p-coin b { left: 12px; right: 12px; top: 31px; background: rgba(10, 17, 24, .82); border-radius: 99px; line-height: 1.25; }
.gcard { border: 2px solid var(--accent); border-radius: 10px; background: #131f29; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.gcard.event { border-color: #e0736a; }
.gcard p { font-size: 14px; }
.gkind { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.gcard.event .gkind { color: #e0736a; }
.gtop { min-height: 76px; border-radius: 6px; background: #0b141c center 18% / cover; border: 1px solid #0a1118; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px; }
.gtop img { width: 50px; height: 50px; }
.gtop span { font-family: var(--display); font-weight: 800; font-size: 17px; letter-spacing: .05em; text-transform: uppercase; color: #e9eff4; margin-left: 6px; }
.gtitle { font-family: var(--display); font-weight: 800; font-size: 24px; letter-spacing: .03em; text-transform: uppercase; line-height: 1.05; overflow-wrap: anywhere; }
.note { background: rgba(240, 169, 59, .12); border: 1px solid rgba(240, 169, 59, .55); border-radius: 6px; padding: 8px 10px; font-size: 13px; line-height: 1.4; color: #f3dcae; }
.s-red { --sc: #b3352c; --sd: #6f1d17; --sp: #fbeceb; --si: #3a100d; }
.s-yellow { --sc: #d6a419; --sd: #8a6608; --sp: #fdf5d8; --si: #3b2c02; }
.s-brown { --sc: #8b5a34; --sd: #55341a; --sp: #f5e9de; --si: #2f1c0c; }
.s-blue { --sc: #2c6db3; --sd: #173f6b; --sp: #e6f0fb; --si: #0c2440; }
.s-green { --sc: #3c8d49; --sd: #1f5429; --sp: #e7f5e9; --si: #0e2c14; }
.s-tag, .s-fixed { --sc: #5b6b7a; --sd: #36424d; --sp: #e9eef2; --si: #17212a; }
.fpill { display: inline-flex; align-items: center; gap: 5px; margin-left: 8px; padding: 2px 8px 2px 6px; border-radius: 99px; background: var(--sc); color: #fff; font: 600 11px/1.5 inherit; letter-spacing: .06em; text-transform: uppercase; vertical-align: middle; white-space: nowrap; }
.fpill.s-yellow { color: #2a1f00; }
.fpill svg { width: 13px; height: 13px; flex: none; }
.decal { border-radius: 8px; background: var(--sc); padding: 3px; box-shadow: 0 2px 0 var(--sd); }
.dhead { display: flex; align-items: center; gap: 9px; padding: 6px 9px 7px; color: #fff; }
.dhead svg { width: 26px; height: 26px; flex: none; }
.dhead span { font-family: var(--display); font-weight: 800; font-size: 17px; letter-spacing: .06em; text-transform: uppercase; line-height: 1.1; }
.dhead small { display: block; font: 500 12px/1.3 system-ui, sans-serif; letter-spacing: 0; text-transform: none; opacity: .92; margin-top: 2px; }
.dbody { background: var(--sp); color: var(--si); border-radius: 6px; border: 2px dashed var(--sc); padding: 9px 11px; font-size: 13px; line-height: 1.4; }
.dbody b { display: block; font-family: var(--display); font-weight: 800; font-size: 17px; letter-spacing: .04em; text-transform: uppercase; }
.dbody em { display: block; margin-top: 6px; font-style: normal; font-weight: 600; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--sd); }
button.dopt { border-left: 5px solid var(--sc); }
.sheet > .fboard { display: flex; flex-direction: column; gap: 7px; padding: 10px; margin-top: 6px; border-radius: 9px; border: 2px solid var(--fc); background: #0c151d; color: var(--ink); font-size: 13px; }
.fbhead { display: flex; align-items: center; gap: 9px; padding-bottom: 7px; border-bottom: 2px solid var(--fc); }
.fbhead span { font-family: var(--display); font-weight: 800; font-size: 21px; letter-spacing: .05em; text-transform: uppercase; color: var(--fc); line-height: 1.05; }
.slot { display: flex; flex-direction: column; gap: 2px; border-radius: 6px; background: var(--sp); color: var(--si); border-left: 9px solid var(--sc); padding: 7px 10px 8px; line-height: 1.4; }
.slot .slab { align-self: flex-start; background: var(--sc); color: #fff; border-radius: 3px; padding: 1px 7px; font-size: 10.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; margin-bottom: 2px; }
.slot.s-yellow .slab { color: #2a1f00; }
.sheet .slot b { color: var(--si); font-family: var(--display); font-weight: 800; font-size: 17px; letter-spacing: .04em; text-transform: uppercase; }
.slot em { font-style: normal; font-weight: 600; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--sd); margin-top: 2px; }
.slot.empty { background: transparent; color: var(--muted); border: 2px dashed var(--sc); border-left-width: 9px; border-left-style: solid; flex-direction: row; align-items: center; gap: 10px; padding: 6px 10px; }
.slot.empty .slab { margin: 0; }
.fbhead .nslot { margin-left: auto; flex: none; width: 46px; height: 26px; border: 2px dotted #7d8b98; border-radius: 4px; }
.fbhead .nslot.on { width: auto; height: auto; border: 2px solid #f2c230; background: #f2c230; color: #1c1500; padding: 3px 8px; font: 700 10.5px/1.3 system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.card .coins { display: flex; gap: 2px; align-items: center; margin-top: 2px; letter-spacing: 0; }
.card .coins .ic { margin: 0; vertical-align: 0; flex: none; }
.cspot { width: 14px; height: 14px; box-sizing: border-box; border: 1.5px dotted #8a99a8; border-radius: 50%; flex: none; }
.card.coinonly { padding: 0; min-width: 0; align-self: center; overflow: hidden; background: none; }
.card.coinonly img { display: block; height: 138px; width: auto; aspect-ratio: 360 / 504; }
.ic.mk { width: 24px; height: 24px; vertical-align: -7px; margin-right: 6px; }
.legend { display: flex; flex-direction: row; flex-wrap: wrap; align-items: stretch; gap: 10px; }
.lg { background: #101b24; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px 10px; display: flex; flex-direction: column; gap: 6px; box-sizing: border-box; min-width: 0; }
.lg.wide { flex: 1 1 100%; }
.lg.t1 { flex: 2.2 1 620px; }
.lg.t2 { flex: 1 1 330px; }
.lg h3 { font-size: 15px; color: var(--accent); }
.lg small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.lgs { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 7px 14px; }
.lgs > span { display: flex; align-items: center; gap: 4px; font-size: 13px; line-height: 1.25; }
.lgs > span > span { display: flex; flex-direction: column; }
.lgs .ic.mk { width: 30px; height: 30px; flex: none; vertical-align: 0; }
.lg table { border-collapse: collapse; width: 100%; font-size: 12.5px; font-variant-numeric: tabular-nums; display: block; overflow-x: auto; }
.lg th { text-align: left; font-weight: 500; color: var(--muted); padding: 3px 8px 3px 0; white-space: nowrap; }
.lg td { text-align: center; padding: 3px 5px; border-left: 1px solid var(--line); white-space: nowrap; }
.lg td b { color: var(--ink); font-size: 14px; }
.lg.t1 { flex: 1 1 620px; }
.lg.t2 { flex: 0 1 auto; }
.lg table { font-size: 12px; }
.lg td { padding: 3px 3px; }
.lg.t1 td { min-width: 0; }
.lgs { grid-template-columns: repeat(auto-fit, minmax(225px, 1fr)); }
.top { position: relative; z-index: 31; background: var(--panel); }
.reftoggle { margin-left: auto; align-self: center; min-height: 36px; padding: 6px 16px; border: 1px solid var(--accent); border-radius: 6px; background: transparent; color: var(--accent); font-weight: 600; font-size: 14px; cursor: pointer; }
.reftoggle[aria-expanded="true"] { background: var(--accent); color: #1c1500; }
.reftoggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.reftoggle[hidden] { display: none; }
.refdrawer { position: fixed; left: 0; right: 0; top: 0; z-index: 30; max-height: 85vh; overflow-y: auto; background: #0b141c; border-bottom: 2px solid var(--accent); box-shadow: 0 14px 30px rgba(0,0,0,.55); transform: translateY(-105%); visibility: hidden; transition: transform .32s ease, visibility 0s linear .32s; }
.refdrawer.open { transform: translateY(0); visibility: visible; transition: transform .32s ease, visibility 0s; }
.refinner { max-width: 1600px; margin: 0 auto; padding: 70px 16px 16px; }
.refhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.refhead h2 { font-size: 20px; }
.refclose { min-height: 36px; padding: 6px 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--raised); color: var(--ink); font-size: 14px; cursor: pointer; }
@media (prefers-reduced-motion: reduce) { .refdrawer, .refdrawer.open { transition: none; } }

/* side drawer: orders, factions, world record */
.sidedrawer { position: fixed; top: 0; right: 0; bottom: 0; width: 400px; max-width: 92vw; z-index: 25; transform: translateX(100%); transition: transform .3s ease; }
.sidedrawer.open { transform: translateX(0); }
.sidedrawer > .panel { height: 100%; overflow-y: auto; box-sizing: border-box; padding: 74px 14px 20px; background: #0b141c; border-left: 2px solid var(--line); box-shadow: -12px 0 28px rgba(0,0,0,.5); }
.sidetab { position: absolute; left: -46px; top: 50%; transform: translateY(-50%); width: 46px; min-height: 150px; padding: 12px 0; writing-mode: vertical-rl; text-orientation: mixed; border: 1px solid var(--line); border-right: 0; border-radius: 8px 0 0 8px; background: var(--raised); color: var(--ink); font-weight: 600; font-size: 14px; letter-spacing: .04em; cursor: pointer; }
.sidetab.alert { background: var(--accent); color: #1c1500; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(240,169,59,.25); }
.sidetab:focus-visible, .sbtoggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (min-width: 1500px) { body:has(.sidedrawer.open) .layout { padding-right: 416px; } }
@media (prefers-reduced-motion: reduce) { .sidedrawer, .layout { transition: none; } }
/* sideboard */
.sbwrap { display: flex; flex-direction: column; gap: 10px; }
.sbwrap[hidden] { display: none; }
.sbtoggle { align-self: flex-start; min-height: 38px; padding: 7px 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--raised); color: var(--ink); font-weight: 600; font-size: 14px; cursor: pointer; }
.sbtoggle[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.sideboard { display: flex; flex-wrap: wrap; gap: 12px; padding: 14px; border-radius: 10px; background: #1a2026 url(art/land.jpg) center / 600px; background-blend-mode: multiply; border: 1px solid var(--line); box-shadow: inset 0 0 0 2px rgba(0,0,0,.3); }
.sideboard[hidden] { display: none; }
.sbsec { background: rgba(11,20,28,.86); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; flex: 1 1 320px; min-width: 0; }
.sbsec h3 { font-size: 14px; color: var(--accent); }
.sbpiles { display: flex; flex-wrap: wrap; gap: 14px 18px; }
.sbpile { display: flex; gap: 10px; align-items: center; flex: 1 1 210px; }
.sbpile > span { display: flex; flex-direction: column; gap: 2px; font-size: 13px; line-height: 1.3; }
.sbpile small { color: var(--muted); font-size: 12px; }
.sbpile .pile { width: 58px; flex: none; }
.sbpile .pile img { width: 58px; }
.sbpile .pile b { top: 25px; }
.sbface .card { min-width: 150px; padding: 9px 12px; font-size: 14px; }
.sbface .card .mini, .sbface .card svg { width: 64px; height: 50px; }
.sbtable { flex-direction: row; flex-wrap: wrap; gap: 14px; flex-basis: 100%; }
.sbtable > div { flex: 1 1 300px; max-width: 420px; display: flex; flex-direction: column; gap: 6px; }
.sbsup { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; }
.sbsup > span { display: inline-flex; align-items: center; gap: 5px; }
.sbsup b { font-size: 16px; color: var(--ink); }
.pc { display: flex; align-items: center; gap: 7px; }
.pc b { min-width: 18px; text-align: right; font-size: 15px; }
.pc .ic.mk { margin: 0; }
.pcgap { width: 24px; flex: none; }

/* sideboard as a process board */
.sbboard { flex: 1 1 100%; display: flex; flex-direction: column; gap: 6px; background: rgba(11,20,28,.86); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.sbrow { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.sbslot { width: 158px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.sbname { font-family: var(--display); font-weight: 800; font-size: 17px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink); }
.sbslot small { color: var(--muted); font-size: 11.5px; line-height: 1.3; }
.sbslot .pile { width: 96px; } .sbslot .pile img { width: 96px; } .sbslot .pile b { top: 46px; font-size: 28px; }
.sblock { width: 96px; aspect-ratio: 5 / 7; border: 2px dashed var(--line); border-radius: 7px; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.sblock.blue { border: 3px solid #2c6db3; color: #8fbbe8; background: rgba(44,109,179,.08); }
.sblock.green { border: 3px solid #3c8d49; color: #93d29d; background: rgba(60,141,73,.08); }
.sblock.blue span, .sblock.green span { font-family: var(--display); font-weight: 800; font-size: 18px; letter-spacing: .06em; text-transform: uppercase; }
.sbdisc { position: relative; } .sbdisc .card { opacity: .85; } .sbdisc > b { position: absolute; top: -8px; right: -8px; background: var(--raised); border: 1px solid var(--line); border-radius: 99px; padding: 1px 8px; font-size: 13px; }
.sbslot .card { width: 150px; min-width: 0; box-sizing: border-box; }
.sbarrows { display: flex; justify-content: space-between; padding: 0 70px; font-size: 22px; color: var(--accent); line-height: 1; }
.sbarrow { align-self: center; font-size: 26px; color: var(--accent); margin-top: 20px; }
.sbhelp { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
/* condensed sideboard */
.sbboard { flex: 0 1 auto; align-self: flex-start; padding: 12px 14px; gap: 4px; }
.sbrow { width: 760px; max-width: 100%; justify-content: space-between; gap: 0; }
.sbslot { width: 136px; gap: 4px; }
.sbname { font-size: 14px; }
.sbslot small { font-size: 11px; }
.sbslot .pile, .sbslot .pile img, .sblock { width: 78px; }
.sbslot .pile b { top: 36px; font-size: 22px; }
.sblock.blue span, .sblock.green span { font-size: 14px; }
.sbslot .card { width: 136px; padding: 6px 8px; font-size: 13px; }
.sbslot .card .mini, .sbslot .card svg { width: 54px; height: 42px; }
.sbarrows { width: 760px; max-width: 100%; padding: 0 59px; box-sizing: border-box; font-size: 18px; }
.sbarrow { font-size: 20px; margin-top: 14px; }
.sbhelp { font-size: 12px; margin-top: 2px; max-width: 760px; }
.alloc { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 8px; }
.alloc .row { align-items: center; gap: 8px; }
.alloc button { min-width: 36px; min-height: 32px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.fren input { min-height: 34px; padding: 4px 8px; font-size: 15px; font-weight: 600; width: 230px; }
/* turn summary beside the sideboard */
.sbmain { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 12px; align-items: stretch; }
.sbturn { flex: 0 1 360px; background: rgba(11,20,28,.86); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 7px; }
.sbturn h3 { font-size: 14px; color: var(--accent); }
.tstep { display: flex; gap: 10px; align-items: flex-start; padding: 6px 8px; border-radius: 7px; border: 1px solid transparent; }
.tstep > span:last-child { display: flex; flex-direction: column; gap: 1px; }
.tstep b { font-family: var(--display); font-weight: 800; font-size: 15px; letter-spacing: .05em; text-transform: uppercase; color: var(--ink); }
.tstep small { font-size: 12px; line-height: 1.35; color: var(--muted); }
.tnum { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-weight: 700; font-size: 13px; color: var(--muted); margin-top: 1px; }
.tstep.now { border-color: var(--accent); background: rgba(240,169,59,.10); }
.tstep.now .tnum { border-color: var(--accent); background: var(--accent); color: #1c1500; }
.tstep.now small { color: var(--ink); }
/* sideboard and turn summary share one height */
.sbmain > .sbboard { align-self: stretch; justify-content: space-between; }
.sbmain > .sbturn { align-self: stretch; justify-content: space-between; gap: 4px; padding: 10px 12px; }
.tstep { padding: 4px 8px; }
.tstep small { font-size: 11.5px; line-height: 1.3; }

.gcard.curse { border-color: #9b6bd6; max-width: 300px; }
.gcard.curse .gkind { color: #c9a6ff; }
.gtop.curseart { background: radial-gradient(circle at 50% 50%, #3a2152, #120a1b 75%); }
.gtop.curseart svg { width: 92px; height: 58px; }
.cursename { display: flex; align-items: baseline; gap: 8px; }
.cursename span { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted, #8fa3b3); }
.cursename b { flex: 1; border-bottom: 2px dotted #9b6bd6; min-height: 28px; padding: 0 4px; }
.cursename b.ink { font-family: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive; font-size: 21px; font-weight: 400; color: #e9dcff; transform: rotate(-2deg); }
.cursewho { font-size: 12px; margin-top: -4px; }
.cursegrid { display: flex; flex-wrap: wrap; gap: 10px; }
.cursegrid .gcard { width: 240px; }
.curseink input { min-width: 180px; }

.gcard.blessed { border-color: #d9b44a; }
.gcard.blessed .gkind { color: #f0cf6b; }
.gcard.blessed .gtop.curseart { background: radial-gradient(circle at 50% 45%, #5a4a1e, #15120a 75%); }
.gcard.blessed .gtop.curseart svg { width: 120px; height: 60px; }
.gcard.blessed .cursename b { border-bottom-color: #d9b44a; }
.gcard.blessed .cursename b.ink { color: #fff1c4; }
.gtitle.bt { margin-bottom: -4px; }
.blist { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 0; font-size: 14px; }
.blist dt { font-weight: 700; color: #f0cf6b; }
.blist dd { margin: 0; }
.bnote, .bfoot { font-size: 13px !important; font-style: italic; background: rgba(217,180,74,.12); border-radius: 4px; padding: 4px 6px; }
.bopts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bopts button { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 2px; }
.bopts button span { font-size: 13px; font-weight: 400; }
/* keep the turn summary beside the sideboard on smaller screens too */
.sbmain { flex-wrap: nowrap; }
.sbmain > .sbboard { flex: 1 1 auto; min-width: 0; overflow-x: auto; }
.sbmain > .sbturn { flex: 0 1 340px; min-width: 230px; }
.sbmain { min-width: 0; }
@media (max-width: 1200px) {
  .sbrow, .sbarrows { width: 620px; }
  .sbarrows { padding: 0 48px; }
  .sbslot { width: 112px; }
  .sbslot .pile, .sbslot .pile img, .sblock { width: 64px; }
  .sbslot .pile b { top: 28px; font-size: 19px; }
  .sbslot .card { width: 112px; padding: 5px 6px; font-size: 12px; }
  .sbslot .card .mini, .sbslot .card svg { width: 44px; height: 34px; }
  .sbarrow { font-size: 16px; }
  .sblock.blue span, .sblock.green span { font-size: 12px; }
}

/* reference drawer: the two tables share the row evenly */
.lg.t1, .lg.t2 { flex: 1 1 420px; }
.lg .tw { overflow-x: auto; }
.lg table { display: table; width: 100%; }
.lg td { min-width: 26px; }
/* World record under the sideboard, running tally in the drawer */
.record { margin-top: 4px; }
.record > .box { margin: 0; }
.panel .log { max-height: 320px; }
.lg.t1 { flex: 1.45 1 520px; }
.lg.t1 td { padding: 3px 2px; font-size: 11.5px; }
.lg.t1 th { padding-right: 6px; }
@media (max-width: 1500px) { .lg.t1 td { font-size: 10.5px; padding: 3px 1px; } .lg.t1 td b { font-size: 12.5px; } }

/* factions beside the sideboard, turn summary in the drawer */
.sbmain > .sbfac { flex: 0 1 380px; min-width: 260px; display: flex; }
.sbfac > .box { flex: 1; margin: 0; background: rgba(11,20,28,.86); }
.tgbox .sbturn { background: none; border: 0; padding: 0; }
/* World record as one dropdown holding its own dropdowns */
.rec > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.rec > summary::-webkit-details-marker { display: none; }
.rec > summary::before { content: '▸'; color: var(--accent); font-size: 16px; transition: transform .15s; }
.rec[open] > summary::before { transform: rotate(90deg); }
.rec > summary h3 { margin: 0; }
.recin { margin-top: 8px; padding-left: 14px; border-left: 2px solid var(--line); }
/* the factions list matches the sideboard's height and scrolls inside if a faction board is opened */
.sbmain > .sbfac { position: relative; align-self: stretch; }
.sbfac > .box { position: absolute; inset: 0; overflow-y: auto; }

/* hand: like cards stack, and the stack fans out on hover or keyboard focus */
.handstacks { gap: 18px; align-items: flex-start; }
.hstack { position: relative; display: flex; align-items: stretch; padding: 4px 4px 4px 0; border-radius: 8px; }
.hstack .card { flex: none; transition: margin-left .18s ease; box-shadow: -3px 0 6px rgba(0,0,0,.45); }
.hs-terr .card { width: 124px; min-width: 0; }
.hs-terr .card + .card { margin-left: -100px; }
.hs-coin .card + .card { margin-left: -80px; }
.hstack:hover .card + .card, .hstack:focus-within .card + .card { margin-left: 8px; }
.hcount { position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px; padding: 0 5px; box-sizing: border-box; border-radius: 11px; background: var(--accent); color: #1c1500; font-weight: 700; font-size: 12px; display: grid; place-items: center; transition: opacity .15s; pointer-events: none; z-index: 2; }
.hstack:hover .hcount, .hstack:focus-within .hcount { opacity: 0; }
.hstack .card.on { position: relative; z-index: 1; }
.log div:last-child { font-weight: 600; }

/* dice pickers */
.dicepick { display: flex; align-items: center; gap: 10px; margin: 4px 0 8px; }
.dieb { width: 52px; height: 52px; padding: 0; border: 0; background: none; border-radius: 12px; cursor: pointer; opacity: .35; transition: opacity .12s, transform .12s; }
.dieb svg { width: 100%; height: 100%; display: block; }
.dieb.on { opacity: 1; transform: translateY(-2px); }
.dieb:hover:not(:disabled) { opacity: .8; }
.dieb.on:hover { opacity: 1; }
.dieb:disabled { opacity: .12; cursor: not-allowed; }
.dieb:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.dbody.atk { fill: #15191e; stroke: #5d6873; stroke-width: 3; }
.dbody.def { fill: #c62828; stroke: #ff8a80; stroke-width: 3; }
.dbody.atk + .dpip, .dieb.atk .dpip { fill: #f2f2f2; }
.dieb.def .dpip { fill: #fff; }
.dcount { font-weight: 700; color: var(--muted); font-size: 14px; }

/* dice drawn like the uploaded art: square, flat; black with white pips attack, red with black pips defend */
.dbody.atk { fill: #000; stroke: none; }
.dbody.def { fill: #e02020; stroke: none; }
.dieb.atk .dpip, .die.a .dpip { fill: #fff; }
.dieb.def .dpip, .die.d .dpip { fill: #000; }
.dieb svg rect, .die svg rect { rx: 4; }
.dieb.on { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.die { width: 44px; height: 44px; padding: 0; background: none !important; border: 0 !important; position: relative; }
.die svg { width: 100%; height: 100%; display: block; }
.die.lock { box-shadow: none; outline: 3px solid var(--accent); outline-offset: 2px; }
.die.rolling { animation: tumble .22s linear infinite; }
@keyframes tumble { 0% { transform: rotate(0) translateY(0); } 25% { transform: rotate(12deg) translateY(-3px); } 50% { transform: rotate(0) translateY(0); } 75% { transform: rotate(-12deg) translateY(-3px); } 100% { transform: rotate(0); } }
.dmod { position: absolute; right: -8px; top: -8px; min-width: 20px; height: 20px; border-radius: 10px; background: var(--accent); color: #1c1500; font-size: 12px; display: grid; place-items: center; }
@media (prefers-reduced-motion: reduce) { .die.rolling { animation: none; } }
.dieb { border: 0 !important; background: none !important; box-shadow: none !important; min-height: 0; }

/* map pieces as dots: hover to enlarge, click for a close-up */
.mkdots { cursor: zoom-in; transform-box: fill-box; transform-origin: center; transition: transform .15s ease; }
.mkdots circle { stroke: #0b141c; stroke-width: .7; }
.mkdots .mkhit { fill: rgba(6, 11, 16, .55); }
.mkdots:hover, .mkdots:focus { transform: scale(2.1); outline: none; }
.mkdots:focus-visible .mkhit { stroke: var(--accent); stroke-width: .6; }
.mktip { position: absolute; transform: translateX(-50%); z-index: 60; pointer-events: none; background: rgba(11, 20, 28, .96); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; display: flex; flex-direction: column; gap: 4px; box-shadow: 0 6px 18px rgba(0,0,0,.5); }
.mkrow { display: flex; align-items: center; gap: 8px; font-size: 13px; white-space: nowrap; }
.mkrow img { width: 30px; height: 30px; }
.mkbox { position: fixed; inset: 0; z-index: 80; background: rgba(3, 7, 11, .72); display: grid; place-items: center; padding: 20px; }
.mkbox[hidden] { display: none; }
.mkcard { position: relative; width: min(560px, 94vw); max-height: 92vh; overflow: auto; background: var(--panel, #13202b); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; box-shadow: 0 18px 50px rgba(0,0,0,.6); animation: mkpop .16s ease-out; }
@keyframes mkpop { from { transform: scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }
.mkcard h3 { margin: 0 0 8px; }
.mkx { position: absolute; top: 8px; right: 10px; width: 34px; height: 34px; min-height: 0; padding: 0; font-size: 22px; line-height: 1; }
.mksvg { width: 100%; height: 300px; display: block; background: url(art/ocean.jpg) center / cover; border-radius: 8px; }
.mktint { opacity: .5; }
.mkedge { stroke: #060b10; stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.mklist { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.mklist li { display: flex; gap: 10px; align-items: center; }
.mklist img { width: 40px; height: 40px; flex: none; }
@media (prefers-reduced-motion: reduce) { .mkdots, .mkcard { transition: none; animation: none; } }

.mkdots circle.mkring { stroke: #ff3b3b; stroke-width: .9; }
.mkdots .mkslash { stroke: #000; stroke-width: .75; stroke-linecap: round; }

.mkrow svg { width: 34px; height: 34px; flex: none; }
.mklist svg { width: 46px; height: 46px; flex: none; }

.mkhold { margin: -2px 0 10px; }
.mkchip { display: inline-block; min-width: 22px; padding: 0 6px; border-radius: 5px; font-weight: 700; text-align: center; border: 1px solid #0b141c; }
.mkhq { font-size: 16px; }

.mktok { width: 46px; height: 32px; flex: none; }
.mkempty { display: grid; place-items: center; border-radius: 7px; border: 1px dashed var(--line); color: var(--muted); font-weight: 700; }
.mkact { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.mkact h4 { margin: 0 0 6px; }
.mkact .row.wrap { flex-wrap: wrap; }
.mkact button.on { outline: 2px solid var(--accent); }
.mksvg { height: 240px; }

.mkvs { color: var(--accent); font-size: .8em; text-transform: none; margin: 0 4px; }
.mkcols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 12px; }
.mkcols h4 { margin: 0 0 6px; font-size: 14px; }
.mkcols .mklist { margin: 0; }
.mktwo { width: min(720px, 96vw); }
.mksvg { height: 280px; }
@media (max-width: 640px) { .mkcols { grid-template-columns: 1fr; } }
.mktwo .mksvg { height: 360px; }

/* close-up laid out wide, so it fits without scrolling: map beside the lists, controls beside the dice */
.mkcard { width: min(1000px, 96vw); max-height: 94vh; padding: 14px 16px; }
.mktwo { width: min(1000px, 96vw); }
.mktop { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.mktop .mksvg, .mktwo .mksvg { height: 300px; }
.mkside { display: grid; gap: 10px; max-height: 300px; overflow: auto; }
.mkside h4 { margin: 0 0 4px; font-size: 14px; }
.mkside .mklist { margin: 0; gap: 6px; }
.mkside .mklist img, .mkside .mklist svg { width: 38px; height: 38px; }
.mkside .mktok { width: 40px; height: 28px; }
.mkgrid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.mkctl > p:first-of-type { margin-top: 0; }
.mkroll { background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.mkroll p { margin: 2px 0 6px; }
.mkact .dicepick { margin: 2px 0 6px; }
.mkact p { margin: 4px 0; }
@media (max-width: 760px) { .mktop, .mkgrid { grid-template-columns: 1fr; } .mkside { max-height: none; } }

/* enemy neighbours around your territory in the close-up */
.mkfoe { opacity: .78; }
.mkfoe .mktint { opacity: .25; }
.mkfoe.pick { cursor: pointer; }
.mkfoe.pick:hover { opacity: 1; }
.mkfoe.pick:hover .mkedge { stroke: #f0a93b; stroke-width: 2.5; }
.mkfname { fill: #f6f8fa; font-weight: 600; paint-order: stroke; stroke: rgba(6,11,16,.85); stroke-width: 2px; pointer-events: none; }
.mkfoetok { pointer-events: none; }
.mkedge.mkmine { stroke: #f0a93b; stroke-width: 2.6; }
.mkcard.still { animation: none; }

.tchip { display: inline-flex; align-items: center; gap: 2px; height: 34px; padding: 0 8px 0 3px; border-radius: 8px; border: 1.5px solid #0b141c; flex: none; min-width: 56px; box-sizing: border-box; }
.tchip img { height: 30px; width: 24px; object-fit: contain; }
.tchip b { font-size: 18px; flex: 1; text-align: center; }
.tchip { overflow: hidden; } .tchip img { height: 28px; }
/* the list's general icon size must not stretch the soldier inside a troop chip */
.mklist .tchip, .mkside .mklist .tchip { height: 40px; width: auto; min-width: 64px; padding: 0 9px 0 5px; }
.mklist .tchip img, .mkside .mklist .tchip img { height: 32px !important; width: 26px !important; object-fit: contain; }
.mklist .mkhqstar, .mkside .mklist .mkhqstar { width: 52px !important; height: 52px !important; flex: none; }
.mklist .mkhqstar, .mkside .mklist .mkhqstar { width: 60px !important; height: 60px !important; }
.plate .pb { fill: #f3f6f8; paint-order: stroke; stroke: rgba(0,0,0,.45); stroke-width: 1.2px; }
.plate .pn { paint-order: stroke; stroke: rgba(0,0,0,.5); stroke-width: 1.6px; }

/* light continents get dark lettering */
.tk .lbl.c-na { fill: #14110a; stroke: rgba(255, 248, 214, .75); }
.plate.p-na .pn, .plate.p-na .pb { fill: #14110a; stroke: rgba(255, 248, 214, .55); }
.tk .lbl.c-eu { fill: #0b1426; stroke: rgba(228, 238, 255, .75); }
.plate.p-eu .pn, .plate.p-eu .pb { fill: #0b1426; stroke: rgba(228, 238, 255, .55); }
