/* The dock (js/dock.js): the tab bar's buttons are small live cards, and the Factions card carries the race for the Crown as a
   ring, so the Crown bar on top is gone. On a wide screen the cards are a rail down the right side; on a phone they fold to
   buttons along the bottom. */
.top .race#race{display:none}
.tright{margin-left:auto}

/* who runs it: green dot = an agent on its own code, gold ring = a seat still on default code, hollow ring = nobody (default) */
.mini .cd{display:inline-block;flex:none;width:7px;height:7px;border-radius:50%;margin-right:5px;vertical-align:middle;font-size:0}
.mini .cd.ag{background:#5ef2a0;box-shadow:0 0 6px rgba(94,242,160,.7)}
.mini .cd.st{border:1.5px solid var(--gold);width:5px;height:5px}
.mini .cd.df{border:1.5px dashed rgba(200,214,240,.45);width:5px;height:5px}
.mini .who b{color:#a9f5cb;font-weight:600}
.mini .who .wm,.mini .who .wd{color:var(--dim)}

/* the cards */
.tabbar{align-items:stretch;gap:6px;padding:6px;border-radius:22px;background:rgba(9,14,24,.86);border:1px solid var(--gline)}
.tabbar button{height:auto;min-height:44px;flex-direction:column;align-items:stretch;justify-content:flex-start;gap:3px;padding:9px 12px 10px;border-radius:16px;background:rgba(255,255,255,.03);text-align:left}
.tabbar button>i,.tabbar button>span:not(.mini){display:none}
/* the ? card says what it opens: How to play */
.tabbar button[data-pane=guide]{flex:none;min-width:44px;padding:0 14px;gap:5px;align-items:center;justify-content:center}
.tabbar button[data-pane=guide]>i{display:block;font-size:17px;color:var(--gold)}
.tabbar button[data-pane=guide]>span{display:block;font:700 12px/1.1 var(--display);letter-spacing:.06em;color:#ffe2a0;text-align:center;white-space:nowrap}
.tabbar button[aria-pressed=true]{background:linear-gradient(180deg,rgba(255,200,87,.16),rgba(255,200,87,.04))}
.mini{display:flex;flex-direction:column;gap:4px;min-width:0;font:12px/1.3 var(--sans);color:var(--muted)}
.mini .mh{display:flex;align-items:baseline;gap:8px;white-space:nowrap;min-width:0}
.mini .mt{flex:none;font:700 12.5px/1 var(--display);letter-spacing:.08em;color:#ffe2a0}
.mini .mg{min-width:0;overflow:hidden;text-overflow:ellipsis;font:500 11px var(--mono);color:var(--dim)}
.mini .mg.won{color:var(--gold);font-weight:700}
.mini .mp{margin-left:auto;flex:none;font:500 11px var(--mono);color:#ffe2a0}
.mini .mm{font-size:11px;color:var(--dim)}
.mini .ml{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#cdd6e5}
.mini .ml .st{margin-left:6px;font:10.5px var(--mono);color:var(--dim)}
.mini .ml.dim{color:var(--dim)}
.wide .mini .ml.tk{white-space:normal;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-height:1.3;margin-bottom:3px}

/* the race: a ring of every faction's share in race order, the leader's arc in gold, other pacts' arcs in white, and the legend
   beside it (a box per pact, the leader's in gold) in as many columns as it needs */
.mini .mg.need{color:var(--gold);font-weight:600}
.mini .donut{display:flex;align-items:center;gap:14px;margin-top:3px}
.mini .ring{flex:none;width:112px;height:112px;overflow:visible}
.mini .ring .track{fill:none;stroke:rgba(160,180,220,.1);stroke-width:13}
.mini .ring .sg{fill:none;stroke-width:13}
.mini .ring .sg.cl{animation:segPulse 1s ease-in-out infinite alternate}
.mini .ring .sep{stroke:rgba(6,10,18,.6);stroke-width:.8}
.mini .ring .arc{fill:none;stroke:rgba(230,236,246,.75);stroke-width:1.5}
.mini .ring .arc.lock{stroke:rgba(230,236,246,.45);stroke-dasharray:3 2}
.mini .ring .arc.no{stroke:rgba(255,107,129,.75);stroke-dasharray:3 2}
.mini .ring .arc.lead{stroke:var(--gold);stroke-width:2.4;filter:drop-shadow(0 0 2px rgba(255,200,87,.8))}
.mini .ring text{text-anchor:middle}
.mini .ring .t1{font:500 7px var(--mono);letter-spacing:.06em;fill:var(--dim)}
.mini .ring .t2{font:600 16px var(--mono);fill:#fff}
.mini .ring .t2.claim,.mini .ring .t2.won{fill:var(--gold)}
.mini .ring .t2.claim{animation:dockClaim 1s ease-in-out infinite alternate}
@keyframes dockClaim{to{filter:drop-shadow(0 0 4px rgba(255,200,87,.9))}}
.mini .ring .t3{font:500 6.8px var(--mono);fill:#ffe2a0}
.mini .side{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px}
.mini .flist{display:block;columns:var(--cols);column-gap:10px}
.mini .bloc{display:flex;flex-direction:column;gap:2px;margin-bottom:2px;padding:0 6px;break-inside:avoid}
/* only pacts and the leader are boxed; the box takes its border out of the side padding, so every row's swatch lines up */
.mini .bloc.pact,.mini .bloc.lead{margin-bottom:3px;padding:1px 5px;border:1px solid transparent;border-radius:6px}
.mini .bloc.pact{border-color:rgba(230,236,246,.24)}
.mini .bloc.pact.lock{border-style:dashed}
.mini .bloc.pact.no{border-style:dashed;border-color:rgba(255,107,129,.6)}
.mini .bloc.lead{border-color:rgba(255,200,87,.55);background:rgba(255,200,87,.09)}
.mini .bloc .pk{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:500 10px/14px var(--mono);color:var(--dim)}
.mini .bloc.lead .pk{color:#ffe2a0}
.mini .fr{display:grid;grid-template-columns:8px minmax(0,1fr) auto auto;align-items:center;gap:6px;min-width:0;font-size:11.5px;line-height:15px;white-space:nowrap}
.mini .flist.roomy .fr{grid-template-columns:8px minmax(0,auto) minmax(0,1fr) auto}
.mini .fr .sw{width:8px;height:8px;border-radius:2px;font-size:0}
.mini .fr.cl .sw{animation:segPulse 1s ease-in-out infinite alternate}
.mini .fr .nm{overflow:hidden;text-overflow:ellipsis;color:#fff;font-weight:600}
.mini .fr .who{overflow:hidden;text-overflow:ellipsis;font-size:11px}
.mini .fr .who>.cd:only-child{margin-right:0}
.mini .fr .sh{min-width:4ch;text-align:right;font:500 11px var(--mono);color:var(--text)}
.mini .fall{padding:0 6px;font-size:10.5px;line-height:14px;color:var(--dim)}
.mini .fall s{text-decoration-color:rgba(131,144,168,.6)}

/* a wide screen: the rail, under the top bar. Factions at the top, Story taking the height that's left (the headline, the
   caster's line, the ticker), then Tech and How to play. An open panel takes the rail's place (index.html) and the cards fold
   to a row of titles under it, so the map never moves. The footer sits under the rail. */
.wide{--railw:clamp(330px,27vw,400px);--railb:calc(env(safe-area-inset-bottom) + 28px)}
.wide .tabbar{box-sizing:border-box;left:auto;right:calc(env(safe-area-inset-right) + 12px);top:calc(var(--topb) + 10px);bottom:var(--railb);width:var(--railw);transform:none;flex-direction:column;flex-wrap:nowrap}
.wide .tabbar>button{flex:none}
.wide .tabbar button[data-pane=story]{flex:1 1 0;min-height:0}
.wide .tabbar button[data-pane=guide]{flex-direction:row;height:40px;min-height:40px}
.wide .tabbar>.caster{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}   /* the Story card shows it; this copy is read aloud */
.wide.paneopen .tabbar{top:auto;flex-direction:row}
.wide.paneopen .tabbar>button{flex:1 1 0;min-width:0;height:44px;min-height:44px;padding:0 6px;justify-content:center}
.wide.paneopen .tabbar button[data-pane=guide]{flex:none;width:44px;padding:0}
.wide.paneopen .tabbar button[data-pane=guide]>span{display:none}
.wide.paneopen .tabbar button[data-pane=story] .mini{position:static;-webkit-mask-image:none;mask-image:none}
.wide.paneopen .tabbar button .mini>:not(.mh),.wide.paneopen .mini .mh .mg,.wide.paneopen .mini .mh .mp{display:none}
.wide.paneopen .tabbar button .mh{justify-content:center;padding:0}
.wide .mini .donut.stack{flex-direction:column;align-items:stretch;gap:8px}
.wide .mini .donut.stack .ring{align-self:center}
/* the rail fades in as the cards fold or unfold (opacity only: the shell measures the rail where it stands) */
.wide .tabbar{animation:dockRail .3s ease-out}
.wide.paneopen .tabbar{animation:dockFold .3s ease-out}
@keyframes dockRail{from{opacity:0}}
@keyframes dockFold{from{opacity:0}}
@media (prefers-reduced-motion:reduce){.wide .tabbar,.wide.paneopen .tabbar{animation:none}}
/* the caster in the Story card: under the headline, over the ticker */
.mcast{padding:3px 6px 1px;font-size:12.5px;line-height:1.4}

/* the Tech card: the research race, then every tech researched so far with a dot per faction that has it (the ones every faction
   has last, in grey), clipped to two lines */
.mini .tr i{display:inline-block;width:46px;height:4px;border-radius:2px;background:rgba(160,180,220,.14);overflow:hidden;vertical-align:middle;font-size:0}
.mini .tr u{display:block;height:100%}
.mini .ml.th{white-space:normal;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-height:17px;font-size:11.5px}
.mini .th .tn{margin-right:7px;white-space:nowrap}
.mini .th .tp{margin-left:4px}
.mini .th .tp i{display:inline-block;width:5px;height:5px;margin-right:1px;border-radius:50%;vertical-align:1px;font-size:0}
.mini .th .te{color:var(--dim)}

/* phones: Factions across the top of the dock, Story and Tech side by side under it */
.narrow .tabbar{flex-wrap:wrap;gap:5px;padding:5px}
.narrow .tabbar button{height:auto;padding:8px 11px 9px;font-size:12px}
.narrow .tabbar button[data-pane=factions]{flex:1 1 100%}
.narrow .tabbar button[data-pane=story],.narrow .tabbar button[data-pane=techs]{flex:1 1 0;min-width:0}
.narrow .tabbar button[data-pane=guide]{height:auto;width:62px;padding:0 4px;gap:3px}
.narrow .tabbar button[data-pane=guide]>span{font-size:10.5px;white-space:normal}
.narrow .mini .mp,.narrow .mini .ml .st,.narrow .mini .tr>b{display:none}
.narrow .mini .ml{font-size:11.5px}
.narrow .mini .ring{width:92px;height:92px}
/* an open sheet: the cards fold to their titles over its foot */
.narrow.paneopen .tabbar button .mini>:not(.mh){display:none}
.narrow.paneopen .tabbar button{padding:9px 11px}
/* short landscape phones: one row of titles beside the sheet, the headline or ticker line over them */
@media (max-height:520px) and (orientation:landscape){
  .narrow .tabbar button[data-pane=factions]{flex:1 1 0}
  .narrow .tabbar button .mini>:not(.mh){display:none}
  .narrow .tabbar button,.narrow.paneopen .tabbar button{height:40px;min-height:0;padding:0 11px;justify-content:center}
  .narrow .tabbar button[data-pane=guide]{height:40px}
}
@media (prefers-reduced-motion:reduce){.mini .ring .sg.cl,.mini .ring .t2.claim,.mini .fr.cl .sw{animation:none}}

/* the race along the top of the map, on every screen: each faction's share in race order, the Crown's line as a notch */
.rstrip{position:absolute;z-index:6;left:0;right:0;top:0;height:4px;pointer-events:none;background:rgba(160,180,220,.08)}
.rstrip:empty{display:none}
.rstrip i{position:absolute;top:0;bottom:0;box-shadow:inset -1px 0 0 rgba(6,10,18,.6);transition:left .7s,width .7s}
.rstrip b{position:absolute;top:0;bottom:-3px;width:2px;margin-left:-1px;background:var(--gold);box-shadow:0 0 6px rgba(255,200,87,.9);transition:left .7s}
/* on a phone the headline is the only card: the dock folds to buttons, with the ticker's newest line over them and the caster's
   line over that (shell.js leaves it out of the map's fit, so the world holds still while it talks) */
.narrow .tabbar>.caster:not(.idle){flex:1 1 100%;order:-3;padding:5px 9px 2px;font-size:12.5px;line-height:1.4}
.narrow.paneopen .tabbar>.caster{display:none}
.tick{display:none}
.narrow .tick:not([hidden]){display:flex;align-items:center;gap:7px;flex:1 1 100%;order:-1;min-width:0;padding:5px 9px 3px;font:12.5px/1.3 var(--sans);color:#cdd6e5}
.narrow .tick span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.narrow .tick i{flex:none;width:6px;height:6px;border-radius:50%;background:rgba(230,236,246,.75)}
.narrow .tabbar button .mini>:not(.mh){display:none}
.narrow .tabbar button[data-pane=factions]{flex:1 1 0}
.narrow .tabbar button,.narrow.paneopen .tabbar button{padding:9px 11px;justify-content:center}
.narrow .mini .mh .mg,.narrow .mini .mh .mp{display:none}

/* the headline (headline.js): the biggest story in the world, at the top of the Story card on a wide screen and over the folded
   cards on a phone. A click flies there; the rest of the Story card opens the Story panel. A new story slides in, an interrupt
   (a fall, a heist, the Crown) flashes white, the Crown's run turns it gold. */
.wide .tabbar button[data-pane=story]{position:relative}
.wide .tabbar button[data-pane=story] .mini{position:absolute;inset:9px 6px 10px;overflow:hidden;overflow:clip;-webkit-mask-image:linear-gradient(#000 calc(100% - 12px),transparent);mask-image:linear-gradient(#000 calc(100% - 12px),transparent)}
.wide .tabbar button[data-pane=story] .mh,.wide .tabbar button[data-pane=story] .mls{padding:0 6px}
.hlnow,.hlline{cursor:pointer;border:1px solid rgba(230,236,246,.14);background:rgba(255,255,255,.045);transition:border-color .2s,background .2s}
.hlnow:hover,.hlline:hover{border-color:rgba(230,236,246,.4);background:rgba(255,255,255,.07)}
.hlnow[hidden],.hlline[hidden]{display:none}
.hlnow{display:flex;flex-direction:column;gap:3px;margin:1px 0 2px;padding:6px 7px 7px;border-radius:10px}
.hlnow .nk,.hlline .nk{display:flex;align-items:center;gap:6px;min-width:0;font:600 9.5px/1.25 var(--mono);letter-spacing:.1em;text-transform:uppercase;color:#e9eef7;white-space:nowrap}
.hlnow .nk i,.hlline .nk i{flex:none;width:5px;height:5px;border-radius:50%;background:#fff;box-shadow:0 0 6px rgba(255,255,255,.9);animation:hlBeat 1.6s ease-in-out infinite}
.hlnow .nkt,.hlline .nkt{min-width:0;overflow:hidden;text-overflow:ellipsis}
.hlnow .nk em,.hlline .nk em{margin-left:auto;flex:none;font-style:normal;letter-spacing:.04em;text-transform:none;color:var(--muted)}
.hlnow .nr{display:flex;flex-direction:column;gap:1px}
.hlnow .ns{display:grid;grid-template-columns:12px minmax(0,1fr) auto;align-items:center;gap:6px;font-size:12px;line-height:16px;white-space:nowrap}
.hlnow .nm{overflow:hidden;text-overflow:ellipsis}
.hlnow .ns b,.hlline .ns b{font-weight:600}
.hlnow .ns small,.hlline .ns small{font:10.5px var(--mono);color:var(--muted)}
.hlnow .ns.more{display:block;padding-left:18px;font-size:11px;color:var(--dim)}
.hlnow .cr,.hlline .cr{flex:none;width:12px;height:14px;filter:drop-shadow(0 1px 1px rgba(0,0,0,.6))}
.hlnow .nt,.hlline .nt{display:flex;align-items:center;gap:7px;min-width:0}
.hlnow .nt:not(.ne) b{font:700 14px/1.2 var(--display);letter-spacing:.02em}
.hlnow .nt.ne{display:block;font-size:12.5px;line-height:1.3;color:#eef3fa}
.hlnow .nt.ne b,.hlline .nt.ne b{font-weight:600}
.hlnow .nbar{display:flex;height:3px;margin-top:2px;border-radius:2px;overflow:hidden;background:rgba(160,180,220,.12)}
.hlnow .nbar u,.hlline .nbar u{display:block;height:100%;transition:width .6s cubic-bezier(.2,.8,.2,1)}
.hlnow .nbar u+u,.hlline .nbar u+u{box-shadow:inset 1px 0 0 rgba(6,10,18,.8)}
.hlnow .nw{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;font-size:11px;line-height:1.35;color:#c9d3e4;text-wrap:pretty}
.hlnow[data-mode=crown],.hlline[data-mode=crown]{border-color:rgba(255,200,87,.55);background:rgba(255,200,87,.07)}
.hlnow[data-mode=crown] .nk,.hlline[data-mode=crown] .nk{color:var(--gold)}
.hlnow[data-mode=crown] .nk i,.hlline[data-mode=crown] .nk i{background:var(--gold);box-shadow:0 0 6px var(--gold)}
.hlnow[data-mode=int],.hlline[data-mode=int]{border-color:rgba(255,255,255,.45)}
.hlnow.in,.hlline.in{animation:hlIn .4s cubic-bezier(.2,.8,.2,1)}
.hlnow[data-mode=int].in,.hlline[data-mode=int].in{animation:hlFlash 1.2s ease-out}
.tabbar .intro{box-shadow:0 0 0 2px rgba(255,200,87,.55),0 0 22px rgba(255,200,87,.35)}
@keyframes hlIn{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
@keyframes hlFlash{0%{box-shadow:0 0 0 2px rgba(255,255,255,.95),0 0 30px rgba(255,255,255,.55)}100%{box-shadow:0 0 0 0 rgba(255,255,255,0)}}
@keyframes hlBeat{50%{opacity:.35}}
/* a phone: two lines over the folded cards, the sides in a row, the bar along its foot; it takes the ticker line's place */
.hlline{display:none}
.narrow .hlline:not([hidden]){position:relative;display:flex;flex-direction:column;gap:2px;flex:1 1 100%;order:-2;min-width:0;padding:6px 10px 7px;border-radius:14px;overflow:hidden;font:12.5px/1.3 var(--sans);color:#cdd6e5}
.hlline .nr{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hlline .sep{font-style:normal;margin:0 6px;color:var(--dim)}
.hlline .nt{white-space:nowrap;overflow:hidden}
.hlline .nt:not(.ne) b{overflow:hidden;text-overflow:ellipsis;font:700 13.5px/1.2 var(--display);letter-spacing:.02em}
.hlline .nt.ne{display:block;text-overflow:ellipsis}
.hlline .nbar{position:absolute;left:0;right:0;bottom:0;display:flex;height:2px;background:rgba(160,180,220,.12)}
.hlline:focus-visible{outline:2px solid var(--cyan);outline-offset:-2px}
.hl-live .tick{display:none!important}
@media (prefers-reduced-motion:reduce){.hlnow,.hlline,.hlnow .nk i,.hlline .nk i,.hlnow .nbar u,.hlline .nbar u{animation:none!important;transition:none!important}}
/* the endgame: once a contender holds 75% of the cores, who is closing in and what still stands, over the top of the map */
.endgame{position:absolute;z-index:6;top:calc(var(--raceb,56px) + 8px);left:calc(var(--insl,0px) + (100% - var(--insl,0px) - var(--insr,0px)) / 2);transform:translateX(-50%);box-sizing:border-box;width:max-content;max-width:min(620px,calc(100% - var(--insl,0px) - var(--insr,0px) - 24px));display:flex;flex-wrap:wrap;align-items:center;gap:4px 10px;padding:6px 12px;border:1px solid rgba(255,200,87,.45);border-radius:12px;background:rgba(14,18,30,.86);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);box-shadow:0 8px 24px rgba(0,0,0,.45);font:12.5px/1.35 var(--sans);color:#dfe5f0;text-align:left;cursor:pointer}
.endgame[hidden]{display:none}
.endgame:hover{border-color:rgba(255,200,87,.8)}
.endgame .egk{flex:none;font:600 9.5px/1 var(--mono);letter-spacing:.12em;text-transform:uppercase;color:var(--gold)}
.endgame .egt{min-width:0}
.endgame .egt b{font-weight:600}
.endgame .egs{display:flex;align-items:center;gap:7px;flex:1 1 100%;min-width:0;font:11.5px var(--sans);color:var(--muted)}
.endgame .egn{flex:none;white-space:nowrap}
.endgame .egm{position:relative;flex:1 1 auto;min-width:60px;height:5px;border-radius:3px;background:rgba(255,255,255,.12);overflow:hidden}
.endgame .egm u{position:absolute;left:0;top:0;bottom:0;border-radius:3px;transition:width .7s}
.endgame .egs b{font:600 11px var(--mono);color:#fff}
.endgame .egs em{font-style:normal;white-space:nowrap}
.narrow .endgame{font-size:12px;padding:5px 10px}
/* A solo target change and a running Crown claim stay visible above the map. */
.endgame.crown-status{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:7px 18px;width:480px;padding:11px 14px;border-color:rgba(255,200,87,.75);background:rgba(13,18,29,.96)}
.endgame.crown-status[hidden]{display:none}
.crown-copy{display:flex;flex-direction:column;gap:4px;min-width:0}
.crown-name{font:600 15px/1.25 var(--sans);color:#fff;overflow-wrap:anywhere}
.crown-note{font:12px/1.35 var(--sans);color:#d3dcea;text-wrap:pretty}
.crown-clock{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-width:4.5ch;color:var(--gold)}
.crown-clock b{font:600 32px/1 var(--mono);font-variant-numeric:tabular-nums;letter-spacing:-.04em}
.crown-clock>span{font:500 11px/1 var(--sans);color:#ffe2a0;white-space:nowrap}
.crown-progress{grid-column:1/-1;height:5px;border-radius:3px;background:rgba(255,200,87,.15);overflow:hidden}
.crown-progress i{display:block;height:100%;border-radius:inherit;background:var(--gold)}
.endgame[data-mode=broken]{border-color:rgba(255,107,129,.65)}
.endgame[data-mode=broken] .egk{color:#ffb0bb}
.endgame.crown-flash{animation:crownNotice 1.4s ease-out}
@keyframes crownNotice{0%{box-shadow:0 0 0 2px rgba(255,200,87,.9),0 0 28px rgba(255,200,87,.4)}100%{box-shadow:0 8px 24px rgba(0,0,0,.45)}}
.crown-announcement{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.narrow .endgame.crown-status{gap:6px 12px;padding:9px 11px}
.narrow .crown-name{font-size:13px}
.narrow .crown-note{font-size:11px}
.narrow .crown-clock b{font-size:29px}
@media(prefers-reduced-motion:reduce){.endgame.crown-flash{animation:none}}
/* the ticker: a faction's own words and a pact broken stand out */
.mini .ml.tk.say{color:#ffe9b8}.mini .ml.tk.say::before{content:"";display:inline-block;width:2px;height:.9em;margin-right:5px;vertical-align:-1px;background:rgba(255,200,87,.8)}
.mini .ml.tk.betray::before{content:"";display:inline-block;width:2px;height:.9em;margin-right:5px;vertical-align:-1px;background:var(--red)}
