Stage 3-5 server (military, expansion, social), web client for stages 1-2, ops/deploy

Built: units/research/training, movements (scan, raid, attack, takeover, reinforce, settle, transport), deterministic
combat resolved in the event queue, reports, power/offline units, founding + conquest + incumbent sites; alliances,
roles, diplomacy (24h pact cancel via events), messages, rankings; vanilla-JS phone-first client (auth, POP, map,
alerts, settings, en/nb); systemd units, backup timer, DEPLOY.md, tools/admin.js.
Tested: npm test 96/96 (fake clock, in-memory db, a few real-HTTP tests); client checked with headless Chromium
screenshots only. NOT done: marketplace/transport trade, client screens for military/social, WebSocket push,
bots/balance, e2e suite. All unit stats and costs are unbalanced first guesses.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q2MJaQ5LXAHzGnTDgceT14
This commit is contained in:
jvanvik 2026-10-11 18:32:36 +02:00
parent b56b13880e
commit 249818a7aa
111 changed files with 17472 additions and 13 deletions

324
public/css/style.css Normal file
View file

@ -0,0 +1,324 @@
/* UPSTREAM client styles. Dark "network ops console", phone-first.
*
* Layout modes (the shell is a grid on #app):
* portrait / narrow top bar, resource bar, scrolling view, bottom nav (thumb reach)
* rail (landscape and short) OR (width >= 900): nav becomes a left rail, so landscape phones keep their height
* Safe-area insets are applied once, on #app. Every interactive target is at least 44px tall. No hover-only affordances.
*/
:root {
--bg: #070b16;
--panel: #0c1322;
--panel2: #111b30;
--panel3: #16233d;
--line: #1d2c4c;
--line2: #2a3f6b;
--text: #d3e6ff;
--dim: #9bb2d6;
--dimmer: #7790b8;
--cyan: #4de3ff;
--amber: #ffd24d;
--red: #ff6b87;
--green: #35e0a1;
--violet: #b06cff;
--fiber: #4de3ff;
--hardware: #ff9f5a;
--capital: #5be08f;
--power: #ffd24d;
--safe-t: env(safe-area-inset-top, 0px);
--safe-r: env(safe-area-inset-right, 0px);
--safe-b: env(safe-area-inset-bottom, 0px);
--safe-l: env(safe-area-inset-left, 0px);
--nav-h: 58px;
--rail-w: 76px;
--radius: 14px;
--font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.4 var(--font); overflow: hidden; overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
h1, h2, h3, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
[hidden] { display: none !important; }
b { font-weight: 650; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.dimmer { color: var(--dimmer); }
.small { font-size: 13px; }
svg.ic { width: 1.3em; height: 1.3em; flex: none; display: inline-block; vertical-align: middle; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 6px; }
button:focus:not(:focus-visible), [tabindex="-1"]:focus { outline: none; }
/* ---------------------------------------------------------------- shell */
#app {
position: fixed; inset: 0; height: 100dvh;
display: grid; grid-template-columns: minmax(0, 1fr);
grid-template-rows: auto auto minmax(0, 1fr) auto;
grid-template-areas: "top" "hud" "view" "nav";
padding: var(--safe-t) var(--safe-r) 0 var(--safe-l);
background: radial-gradient(1000px 520px at 15% -10%, #0e1d3a 0%, transparent 60%), radial-gradient(800px 460px at 100% 110%, #1a0f33 0%, transparent 55%), var(--bg);
}
#topbar { grid-area: top; display: flex; align-items: center; gap: 10px; padding: 8px 16px 6px; min-height: 44px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .08em; font-size: 15px; }
.brand-mark { width: 18px; height: 18px; background: linear-gradient(135deg, var(--cyan), #3b82f6); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); flex: none; }
.brand-mark.big { width: 40px; height: 40px; }
.netstate { margin-left: auto; font-size: 12px; padding: 4px 10px; border-radius: 999px; background: #3a1620; color: #ffb3c2; border: 1px solid #6b2236; }
.netstate.ok { background: #0f3a2c; color: #9af0cd; border-color: #1a6a4f; }
#hud { grid-area: hud; width: 100%; max-width: 1124px; justify-self: center; }
#view { grid-area: view; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
#app[data-screen="map"] #view { overflow: hidden; }
#app[data-screen="auth"] #topbar, #app[data-state="out"] #topbar { display: none; }
.screen { min-height: 100%; }
.screen-map { height: 100%; min-height: 0; position: relative; }
#nav {
grid-area: nav; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
background: rgba(9, 15, 29, .96); border-top: 1px solid var(--line);
padding-bottom: var(--safe-b);
}
.nav-btn { background: none; border: 0; min-height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--dim); font-size: 12px; position: relative; padding: 4px 2px; }
.nav-btn[aria-current="page"] { color: var(--cyan); }
.nav-btn[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--cyan); }
.nav-ic { position: relative; display: inline-flex; }
.nav-ic svg.ic { width: 24px; height: 24px; }
.nav-badge { position: absolute; top: -5px; right: -9px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--red); color: #1a0710; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.nav-lbl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (orientation: landscape) and (max-height: 520px), (min-width: 900px) {
#app {
grid-template-columns: var(--rail-w) minmax(0, 1fr);
grid-template-rows: auto auto minmax(0, 1fr);
grid-template-areas: "nav top" "nav hud" "nav view";
padding-bottom: var(--safe-b);
}
#app[data-state="out"] { grid-template-columns: minmax(0, 1fr); grid-template-areas: "view" "view" "view"; }
#nav { grid-auto-flow: row; grid-auto-columns: auto; grid-auto-rows: min-content; align-content: start; border-top: 0; border-right: 1px solid var(--line); padding: 6px 0; padding-bottom: 6px; overflow-y: auto; }
.nav-btn { min-height: 62px; }
.nav-btn[aria-current="page"]::before { top: 22%; bottom: 22%; left: 0; right: auto; width: 3px; height: auto; border-radius: 0 3px 3px 0; }
#topbar { padding-top: 4px; min-height: 36px; }
}
.boot { display: grid; place-items: center; gap: 14px; padding: 48px 16px; color: var(--dim); text-align: center; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line2); border-top-color: var(--cyan); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } * { scroll-behavior: auto !important; } }
/* ---------------------------------------------------------------- resource bar */
.hud { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 4px 12px 8px; }
.hud-chip { background: rgba(12, 19, 34, .9); border: 1px solid var(--line); border-radius: 12px; padding: 6px 8px 7px; min-width: 0; --c: var(--dim); }
.hud-chip.fiber { --c: var(--fiber); } .hud-chip.hardware { --c: var(--hardware); } .hud-chip.capital { --c: var(--capital); } .hud-chip.power { --c: var(--power); }
.hud-top { display: flex; align-items: center; gap: 4px; color: var(--c); white-space: nowrap; }
.hud-top svg.ic { width: 16px; height: 16px; }
.hud-top .val { color: var(--text); font-family: var(--mono); font-size: 15px; letter-spacing: -.02em; }
.hud-top .cap { color: var(--dimmer); font-size: 11px; font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; }
.hud-sub { font-size: 11px; color: var(--dim); font-family: var(--mono); margin: 1px 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-chip.full { border-color: #6b5a1f; }
.hud-chip.full .rate { color: var(--amber); font-weight: 700; letter-spacing: .06em; }
.hud-chip.bad { border-color: #6b2236; }
.hud-chip.bad .val, .hud-chip.empty .rate { color: var(--red); }
.hud-chip.bad .bar i, .hud-chip.empty .bar i { background: var(--red); }
.bar { height: 4px; border-radius: 2px; background: #0a1020; overflow: hidden; }
.bar i { display: block; height: 100%; width: calc(var(--p, 0) * 100%); background: var(--c, var(--cyan)); border-radius: 2px; transition: width .4s linear; }
.hud-chip.full .bar i { background: var(--amber); }
@media (max-width: 400px) { .hud { gap: 4px; padding: 4px 8px 6px; } .hud-top .cap { display: none; } .hud-top .val { font-size: 14px; } }
@media (orientation: landscape) and (max-height: 520px) { .hud { padding-bottom: 4px; } .hud-chip { padding: 4px 8px 5px; } .hud-sub { margin-bottom: 2px; } }
/* ---------------------------------------------------------------- generic parts */
.page { padding: 8px 12px 24px; display: grid; gap: 12px; max-width: 720px; margin: 0 auto; }
.pad { padding: 28px 16px; }
.card { background: rgba(12, 19, 34, .88); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.card-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; margin-bottom: 10px; }
.card-head h1, .card-head h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); font-weight: 650; display: flex; align-items: center; gap: 6px; }
.card-head h1 { font-size: 15px; color: var(--text); }
.page-head { margin-bottom: 0; }
.empty { color: var(--dimmer); font-size: 14px; text-align: center; padding: 10px 6px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.kv:last-of-type { border-bottom: 0; }
.kv .k { color: var(--dimmer); } .kv .v { text-align: right; overflow-wrap: anywhere; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; background: var(--panel3); border: 1px solid var(--line2); font-size: 12px; color: var(--dim); max-width: 100%; }
.pill svg.ic { width: 13px; height: 13px; }
.pill.accent { color: #06222b; background: var(--cyan); border-color: var(--cyan); font-weight: 650; }
.pill.green { color: #04241a; background: var(--green); border-color: var(--green); font-weight: 650; }
.pill.amber { color: #2b2204; background: var(--amber); border-color: var(--amber); font-weight: 600; }
.pill.dim { color: var(--dimmer); background: transparent; }
.pill.res-fiber { color: var(--fiber); } .pill.res-hardware { color: var(--hardware); } .pill.res-capital { color: var(--capital); } .pill.res-power { color: var(--power); }
.pill-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line2); background: var(--panel3); color: var(--text); font-weight: 600; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #2fc4e6, #1b97c0); border-color: #55d6f2; color: #03202a; }
.btn.primary:disabled { background: var(--panel3); border-color: var(--line2); color: var(--dim); }
.btn.danger { background: #3a1620; border-color: #7a2a3f; color: #ffc4d0; }
.btn.wide { width: 100%; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn-row { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; margin-top: 12px; }
.icon-btn { width: 44px; height: 44px; flex: none; display: inline-grid; place-items: center; border-radius: 12px; background: transparent; border: 1px solid transparent; color: var(--dim); }
.icon-btn:hover { background: var(--panel3); }
.linklike { background: none; border: 0; color: var(--cyan); min-height: 44px; text-decoration: underline; text-underline-offset: 3px; width: 100%; }
.chip-btn { min-width: 52px; min-height: 40px; border-radius: 999px; background: transparent; border: 1px solid var(--line2); color: var(--dim); padding: 0 14px; }
.chip-btn[aria-pressed="true"], .seg-btn[aria-pressed="true"] { background: var(--cyan); border-color: var(--cyan); color: #04222b; font-weight: 700; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg-btn { min-height: 46px; border-radius: 12px; background: var(--panel3); border: 1px solid var(--line2); color: var(--dim); }
.field { display: grid; gap: 5px; margin-bottom: 12px; }
.field-lbl { font-size: 13px; color: var(--dim); }
.field-hint { font-size: 12px; color: var(--dimmer); }
input[type="text"], input[type="password"], select { width: 100%; min-height: 48px; padding: 0 14px; border-radius: 12px; background: #080e1c; border: 1px solid var(--line2); color: var(--text); font-size: 16px; }
input:focus-visible, select:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; border-color: var(--cyan); }
.form-error { color: #ffc4d0; background: #3a1620; border: 1px solid #7a2a3f; border-radius: 10px; padding: 9px 12px; font-size: 14px; margin-bottom: 12px; }
.notice { color: var(--amber); font-size: 14px; margin-bottom: 12px; }
/* ---------------------------------------------------------------- auth */
.screen-auth { display: grid; place-items: center; padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b)); min-height: 100%; }
.auth-card { width: min(100%, 400px); display: grid; gap: 14px; }
.auth-logo { display: flex; align-items: center; gap: 14px; justify-content: center; }
.auth-name { font-size: 28px; font-weight: 750; letter-spacing: .12em; }
.auth-tag { text-align: center; color: var(--dim); }
.auth-form { background: rgba(12, 19, 34, .9); border: 1px solid var(--line); border-radius: 18px; padding: 18px 16px 8px; }
.auth-h { font-size: 20px; margin-bottom: 14px; }
.lang-switch { display: flex; justify-content: center; gap: 8px; }
/* ---------------------------------------------------------------- POP */
.cols { display: grid; gap: 12px; padding: 4px 12px 24px; max-width: 1100px; margin: 0 auto; align-items: start; }
.col { display: grid; gap: 12px; min-width: 0; }
@media (min-width: 760px) { .cols { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); } }
.pop-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -4px 0 4px; }
.town-name { font-size: 22px; font-weight: 700; overflow-wrap: anywhere; }
.town-select { font-size: 18px; font-weight: 650; }
.pop-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--dim); font-size: 13px; }
.queue { display: grid; gap: 8px; }
.q-item { display: flex; align-items: center; gap: 4px; background: var(--panel2); border: 1px solid #5a4a14; border-radius: 12px; padding-right: 2px; }
.q-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 8px 6px 8px 10px; text-align: left; min-height: 56px; }
.q-main .bar { margin-top: 6px; --c: var(--amber); }
.q-main > b { font-size: 15px; color: var(--amber); }
.row-ic { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--panel3); color: var(--cyan); }
.row-ic svg.ic { width: 22px; height: 22px; }
.row-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.row-title { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.row-title .lv { color: var(--dim); font-size: 13px; }
.row-sub { color: var(--dimmer); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.stat { background: var(--panel2); border-radius: 10px; padding: 7px 10px; display: grid; }
.stat small { color: var(--dimmer); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.stat b { font-family: var(--mono); font-size: 17px; }
.good { color: var(--green); } .bad { color: var(--red); }
.power-card .bar { height: 8px; --c: var(--power); margin: 6px 0 8px; }
.power-status { font-size: 13px; color: var(--dim); }
.power-status.warn { color: var(--amber); } .power-status.bad { color: var(--red); }
.groups { display: grid; gap: 12px; }
.group { --c: var(--cyan); }
.group.res-fiber { --c: var(--fiber); } .group.res-hardware { --c: var(--hardware); } .group.res-capital { --c: var(--capital); } .group.res-power { --c: var(--power); }
.group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--c); }
.group-head b { color: var(--text); }
.group-rate { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--c); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 8px; }
.tile { position: relative; aspect-ratio: 1; min-height: 56px; border-radius: 14px; background: var(--panel2); border: 1px solid color-mix(in srgb, var(--c) 35%, var(--line)); color: var(--c); padding: 6px; display: block; text-align: left; overflow: hidden; }
.tile.res-fiber { --c: var(--fiber); } .tile.res-hardware { --c: var(--hardware); } .tile.res-capital { --c: var(--capital); } .tile.res-power { --c: var(--power); }
.tile-ic { width: 26px; height: 26px; opacity: .95; }
.tile-lvl { position: absolute; right: 8px; bottom: 6px; font-family: var(--mono); font-size: 22px; color: var(--text); line-height: 1; }
.tile-badge { position: absolute; right: 5px; top: 5px; display: grid; place-items: center; }
.tile-badge svg.ic { width: 15px; height: 15px; }
.tile-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: transparent; }
.tile-bar i { display: block; height: 100%; width: calc(var(--p, 0) * 100%); background: var(--amber); }
.tile[data-st="ready"] { border-color: var(--green); box-shadow: 0 0 0 1px rgba(53, 224, 161, .35), 0 0 14px rgba(53, 224, 161, .18); }
.tile[data-st="ready"] .tile-badge { color: var(--green); }
.tile[data-st="queued"] { border-color: var(--amber); } .tile[data-st="queued"] .tile-badge { color: var(--amber); }
.tile[data-st="locked"] { opacity: .65; } .tile[data-st="locked"] .tile-badge { color: var(--dimmer); }
.tile[data-st="max"] { border-color: #8a7a2a; }
.rows { display: grid; gap: 8px; }
.row-btn { position: relative; width: 100%; display: flex; align-items: center; gap: 10px; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; min-height: 58px; text-align: left; overflow: hidden; }
.row-btn[data-st="ready"] { border-color: color-mix(in srgb, var(--green) 70%, var(--line)); }
.row-btn[data-st="queued"] { border-color: var(--amber); }
.row-btn[data-st="locked"] .row-ic { color: var(--dimmer); }
.row-btn .pill { flex: none; max-width: 42%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* ---------------------------------------------------------------- sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; pointer-events: none; }
.backdrop { position: absolute; inset: 0; background: rgba(2, 5, 12, .62); opacity: 0; transition: opacity .18s; pointer-events: auto; }
.sheet { position: relative; width: min(100%, 520px); max-height: min(86dvh, 720px); overflow-y: auto; background: var(--panel); border: 1px solid var(--line2); border-bottom: 0; border-radius: 20px 20px 0 0; padding: 6px 16px calc(16px + var(--safe-b)); transform: translateY(24px); opacity: 0; transition: transform .2s ease-out, opacity .2s; pointer-events: auto; box-shadow: 0 -10px 40px rgba(0, 0, 0, .5); margin: 0 var(--safe-r) 0 var(--safe-l); }
.sheet-wrap.open .backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; opacity: 1; }
.sheet-grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line2); margin: 4px auto 6px; }
.sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.sheet-title { flex: 1; font-size: 19px; min-width: 0; overflow-wrap: anywhere; }
.sheet-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--panel3); display: grid; place-items: center; color: var(--cyan); flex: none; }
.sheet-icon.res-fiber { color: var(--fiber); } .sheet-icon.res-hardware { color: var(--hardware); } .sheet-icon.res-capital { color: var(--capital); } .sheet-icon.res-power { color: var(--power); }
.sheet-icon svg.ic { width: 24px; height: 24px; }
.detail { display: grid; gap: 10px; }
.detail-desc { color: var(--dim); }
.detail-level { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.lvl-now { font-weight: 700; font-size: 17px; }
.lvl-next { display: inline-flex; align-items: center; gap: 4px; color: var(--green); font-size: 14px; }
.preview { color: var(--text); background: var(--panel2); border-radius: 10px; padding: 8px 12px; font-size: 14px; }
.sub { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--dimmer); margin-top: 2px; }
.costs { display: flex; flex-wrap: wrap; gap: 8px; }
.cost { display: inline-flex; align-items: center; gap: 6px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 10px; padding: 6px 10px; --c: var(--dim); }
.cost.fiber { --c: var(--fiber); } .cost.hardware { --c: var(--hardware); } .cost.capital { --c: var(--capital); }
.cost svg.ic { color: var(--c); width: 18px; height: 18px; }
.cost b { font-family: var(--mono); }
.cost small { color: var(--dimmer); font-size: 11px; }
.cost.short { border-color: #7a2a3f; } .cost.short b { color: var(--red); }
.meta { justify-content: flex-start; color: var(--dim); }
.reqs { display: grid; gap: 6px; }
.reqs li { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.reqs li.ok { color: var(--green); } .reqs li.miss { color: var(--red); }
.reqs small { margin-left: auto; color: var(--dimmer); }
.reason { color: var(--amber); font-size: 14px; min-height: 1.4em; }
.detail-queue { background: var(--panel2); border: 1px solid #5a4a14; border-radius: 12px; padding: 12px; display: grid; gap: 8px; }
.detail-queue .bar { --c: var(--amber); height: 6px; }
.detail-queue b { color: var(--amber); font-size: 18px; }
@media (min-width: 700px) and (min-height: 560px) {
.sheet-wrap { align-items: center; }
.sheet { border-bottom: 1px solid var(--line2); border-radius: 20px; max-height: 86dvh; padding-bottom: 16px; }
}
@media (orientation: landscape) and (max-height: 520px) {
.sheet { max-height: 94dvh; width: min(100%, 560px); }
.sheet-grab { display: none; }
}
/* ---------------------------------------------------------------- toasts */
#toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b) + 12px); display: grid; justify-items: center; gap: 8px; z-index: 80; pointer-events: none; padding: 0 16px; }
.toast { background: #12203b; border: 1px solid var(--line2); color: var(--text); padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: 480px; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); transition: opacity .25s, transform .25s; }
.toast.ok { border-color: #1a6a4f; background: #0e2b23; }
.toast.error { border-color: #7a2a3f; background: #2d1019; color: #ffd0da; }
.toast.out { opacity: 0; transform: translateY(8px); }
@media (orientation: landscape) and (max-height: 520px), (min-width: 900px) { #toasts { bottom: 14px; left: var(--rail-w); } }
/* ---------------------------------------------------------------- map */
.map-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; outline: none; user-select: none; -webkit-user-select: none; }
.map-canvas.grabbing { cursor: grabbing; }
.map-canvas:focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; }
.map-controls { position: absolute; right: 12px; bottom: 14px; display: grid; gap: 8px; z-index: 3; }
.map-btn { width: 48px; height: 48px; border-radius: 14px; background: rgba(12, 19, 34, .92); border: 1px solid var(--line2); color: var(--text); display: grid; place-items: center; box-shadow: 0 4px 14px rgba(0, 0, 0, .45); }
.map-btn svg.ic { width: 24px; height: 24px; }
.map-coords { position: absolute; left: 12px; bottom: 14px; z-index: 3; padding: 4px 10px; border-radius: 999px; background: rgba(12, 19, 34, .85); border: 1px solid var(--line); color: var(--dim); font-size: 12px; pointer-events: none; }
.map-legend { position: absolute; left: 10px; top: 8px; z-index: 3; display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 5px 10px; border-radius: 10px; background: rgba(12, 19, 34, .8); border: 1px solid var(--line); font-size: 11px; color: var(--dim); pointer-events: none; max-width: calc(100% - 20px); }
.map-legend li { display: flex; align-items: center; gap: 5px; }
.lg { width: 10px; height: 10px; display: inline-block; }
.lg.you { background: var(--cyan); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.lg.rival { background: #e08a4a; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.lg.rural { border: 2px solid var(--capital); border-radius: 50%; }
.lg.incumbent { background: #241338; border: 2px solid var(--violet); }
@media (max-height: 420px) { .map-legend { display: none; } }
/* ---------------------------------------------------------------- alerts + settings */
.alert-list { display: grid; gap: 8px; }
.alert { width: 100%; display: flex; align-items: center; gap: 10px; background: rgba(12, 19, 34, .88); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; min-height: 58px; text-align: left; }
.alert.new { border-color: var(--cyan); background: #0c1f33; }
.when { font-size: 12px; color: var(--dimmer); flex: none; }
.device-list { display: grid; gap: 8px; margin-top: 10px; }
.device { display: flex; align-items: center; gap: 10px; background: var(--panel2); border-radius: 12px; padding: 8px 10px; min-height: 56px; }
.device .row-sub { white-space: normal; }
.card .btn.wide { margin-top: 10px; }
@media (prefers-reduced-motion: reduce) { .sheet, .backdrop, .toast, .bar i { transition: none; } }