:root {
  --ink: #15273a;
  --ink-2: #3b5164;
  --ink-3: #6a7f90;
  --paper: rgba(244, 248, 247, 0.95);
  --paper-solid: #f4f8f7;
  --paper-2: #e3ecea;
  --line: #c3d2d0;
  --brass: #9c6a12;
  --brass-2: #d9a441;
  --sea: #2c85ad;
  --good: #2b8a55;
  --warn: #b97c06;
  --bad: #bf3a2b;
  --info: #3b6db4;
  --ui: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --cond: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --side: 372px;
  --board: 148px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #3d9cc6; color: var(--ink); font: 14px/1.4 var(--ui); }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, [tabindex]:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--brass-2); outline-offset: 2px; }
#stage { position: fixed; inset: 0; }
#stage canvas { display: block; }
#labels { position: fixed; inset: 0; pointer-events: none; }
.num { font-variant-numeric: tabular-nums; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 22px rgba(12, 40, 60, 0.18); }
.cap { font: 600 11px/1.2 var(--cond); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }

/* top: treasury + life bars */
#top { position: fixed; top: 12px; left: 12px; right: calc(var(--side) + 24px); display: flex; gap: 10px; align-items: stretch; pointer-events: none; }
#top > * { pointer-events: auto; }
#treasury { padding: 10px 14px 10px; min-width: 268px; }
#treasury .big { font: 700 34px/1 var(--cond); letter-spacing: -0.01em; }
#treasury .big small { font: 600 16px var(--cond); color: var(--ink-2); margin-left: 4px; }
#treasury .row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; color: var(--ink-2); font-size: 12.5px; }
.up { color: var(--good); } .down { color: var(--bad); }
#bars { padding: 8px 12px; display: grid; grid-template-columns: repeat(5, minmax(108px, 1fr)); gap: 6px 12px; flex: 1; align-content: center; }
.bar .name { display: flex; justify-content: space-between; gap: 6px; font: 600 12.5px/1.2 var(--cond); letter-spacing: 0.02em; }
.bar .track { height: 9px; border-radius: 5px; background: var(--paper-2); border: 1px solid var(--line); overflow: hidden; margin: 3px 0 2px; }
.bar .fill { height: 100%; border-radius: 4px; transition: width 0.8s ease; }
.bar .meta { font-size: 11px; line-height: 1.25; color: var(--ink-3); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bar.fast .fill { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }
#clock { padding: 8px 12px; min-width: 150px; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
#clock .bell { font: 600 15px/1.1 var(--cond); }
#clock .live { font-size: 11.5px; color: var(--ink-3); display: flex; align-items: center; gap: 5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); display: inline-block; }
.dot.stale { background: var(--warn); } .dot.dead { background: var(--bad); }

/* side panel */
#side { position: fixed; top: 12px; right: 12px; bottom: 12px; width: var(--side); display: flex; flex-direction: column; overflow: hidden; }
#tabs { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--line); background: var(--paper-2); }
#tabs button { flex: 1 1 auto; border: 0; background: none; padding: 9px 4px 8px; font: 600 13px var(--cond); letter-spacing: 0.04em; color: var(--ink-2); border-bottom: 3px solid transparent; }
#tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--brass-2); background: var(--paper-solid); }
#tabs .badge { display: inline-block; min-width: 17px; padding: 0 4px; margin-left: 3px; border-radius: 9px; background: var(--ink); color: #fff; font-size: 11px; line-height: 17px; }
#tabs .badge.hot { background: var(--bad); }
#pane { flex: 1; overflow-y: auto; padding: 10px 12px 14px; }
#pane h3 { margin: 4px 0 8px; font: 700 17px/1.2 var(--cond); }
#pane h4 { margin: 12px 0 6px; font: 700 14px/1.2 var(--cond); }
#pane p.lead { margin: 0 0 10px; color: var(--ink-2); font-size: 13px; }
.filters { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 8px; }
.insp-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
button.textbtn { border: 0; background: none; padding: 0; color: var(--info); font: inherit; text-decoration: underline; cursor: pointer; }
.card { border: 1px solid var(--line); border-radius: 5px; background: #fff; padding: 9px 10px; margin-bottom: 8px; }
button.card { display: block; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.card.bad { border-color: var(--bad); background: #f8e3df; }
.card.bad .t { color: var(--bad); }
button:disabled { opacity: 0.55; cursor: not-allowed; }
.card .t { font-weight: 600; line-height: 1.3; }
.card .m { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.card .why { font-size: 12.5px; color: var(--ink-2); margin-top: 5px; }
.card .rec { font-size: 12.5px; margin-top: 6px; padding: 6px 8px; background: #fbf4e4; border-left: 3px solid var(--brass-2); border-radius: 3px; }
.card .opts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.card .opts button, .btn { border: 1px solid var(--ink-2); background: #fff; border-radius: 4px; padding: 4px 9px; font: 600 12.5px var(--cond); letter-spacing: 0.02em; }
.card .opts button.recommended, .btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.card .opts button:hover, .btn:hover { border-color: var(--brass-2); }
.age { display: inline-block; padding: 0 6px; border-radius: 3px; font: 600 11px/17px var(--cond); background: var(--paper-2); color: var(--ink-2); }
.age.old { background: var(--bad); color: #fff; }
.kind { display: inline-block; padding: 0 6px; border-radius: 3px; font: 600 11px/17px var(--cond); letter-spacing: 0.04em; text-transform: uppercase; margin-right: 4px; }
.kind.decision { background: #dfe9f6; color: var(--info); } .kind.law { background: #f6ecd6; color: var(--brass); }
.kind.delegation { background: #e3efe6; color: var(--good); } .kind.rule { background: #ece6f4; color: #6a4b98; }
.chron { display: grid; grid-template-columns: 44px 18px 1fr; gap: 2px 6px; font-size: 12.5px; padding: 4px 0; border-bottom: 1px dotted var(--line); align-items: start; }
button.chron { width: 100%; border: 0; border-bottom: 1px dotted var(--line); background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
button.chron:hover { background: var(--paper-2); }
button.seal { width: 100%; border: 0; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.seal.bad { background: #f8e3df; }
.seal.bad b { background: var(--bad); }
.chron time { color: var(--ink-3); font-variant-numeric: tabular-nums; font-size: 11.5px; padding-top: 1px; }
.chron i { width: 12px; height: 12px; border-radius: 50%; margin-top: 3px; display: inline-block; }
.seal { display: flex; gap: 7px; align-items: flex-start; font-size: 12.5px; padding: 5px 7px; border-radius: 4px; margin: 4px 0; }
.seal b { font: 700 11px/16px var(--cond); letter-spacing: 0.05em; text-transform: uppercase; flex: none; padding: 0 5px; border-radius: 3px; color: #fff; }
.seal.block { background: #f8e3df; } .seal.block b { background: var(--bad); }
.seal.warn { background: #fbf0d9; } .seal.warn b { background: var(--warn); }
.seal.ok { background: #e2f1e7; } .seal.ok b { background: var(--good); }
.seal.note { background: var(--paper-2); } .seal.note b { background: var(--ink-3); }
.seal.warn.bad { background: #f8e3df; }
.seal.warn.bad b { background: var(--bad); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 13px; margin: 6px 0 8px; }
.kv dt { color: var(--ink-3); } .kv dd { margin: 0; font-variant-numeric: tabular-nums; }
.est { border-bottom: 1px dashed var(--ink-3); }
code.channel { display: block; margin-top: 6px; padding: 6px 8px; background: var(--ink); color: #e9f1f0; border-radius: 4px; font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-word; }
input.search { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; font: inherit; margin-bottom: 8px; background: #fff; }
.guide { border: 1px solid var(--brass-2); background: #fffaf0; }
.guide ol { margin: 6px 0 4px 18px; padding: 0; font-size: 12.5px; }
.guide li { margin: 2px 0; }

/* market board */
#board { position: fixed; left: 12px; right: calc(var(--side) + 24px); bottom: 12px; height: var(--board); display: flex; flex-direction: column; }
#board header { display: flex; align-items: center; gap: 8px; padding: 6px 10px 4px; flex-wrap: wrap; }
#board header h2 { margin: 0; font: 700 15px var(--cond); letter-spacing: 0.03em; }
#board header .hint { font-size: 12px; color: var(--ink-3); flex: 1; min-width: 160px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 1px 9px; font: 600 12px/20px var(--cond); }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
#board select { font: 600 12px var(--cond); border: 1px solid var(--line); border-radius: 12px; padding: 1px 6px; background: #fff; height: 22px; }
#tiles { flex: 1; display: flex; gap: 7px; overflow-x: auto; overflow-y: hidden; padding: 2px 10px 10px; }
.tile { flex: none; width: 136px; border: 1px solid var(--line); border-radius: 5px; background: #fff; padding: 6px 8px; cursor: grab; user-select: none; display: flex; flex-direction: column; gap: 2px; }
.tile:hover { border-color: var(--brass-2); box-shadow: 0 2px 8px rgba(156, 106, 18, 0.18); }
.tile.armed { outline: 2px solid var(--brass-2); }
.tile > * { flex: none; }
.tile .net { font: 700 14px/1.15 var(--cond); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .reg { font: 600 11px var(--cond); letter-spacing: 0.04em; color: var(--ink-3); text-transform: uppercase; }
.tile .mk { font: 700 16px/1.1 var(--cond); }
.tile .sub { font-size: 11.5px; color: var(--ink-2); }
.tile .share { height: 4px; background: var(--paper-2); border-radius: 2px; overflow: hidden; margin-top: auto; }
.tile .share span { display: block; height: 100%; background: var(--good); }
.tile.ours .net::after { content: " ●"; color: var(--good); font-size: 10px; vertical-align: 2px; }

/* map labels */
.isl { transform: translateY(-10px); text-align: center; font: 600 12px/1.15 var(--cond); color: var(--ink); text-shadow: 0 0 3px #fff, 0 0 6px #fff; white-space: nowrap; }
.isl b { font-size: 14px; letter-spacing: 0.01em; display: block; }
.isl .money { display: inline-flex; gap: 3px; margin-top: 2px; text-shadow: none; }
.isl .money i { font-style: normal; padding: 0 5px; border-radius: 3px; font-size: 11.5px; line-height: 16px; }
.isl .money .in { background: #fff3cf; color: #7a5208; border: 1px solid #e5c56c; }
.isl .money .rent { background: #eef2f4; color: var(--ink-2); border: 1px solid var(--line); }
.isl .meta { color: var(--ink-2); font-weight: 500; }
.isl.yard b { color: var(--ink-2); }
.reglbl { font: 700 22px/1 var(--cond); letter-spacing: 0.16em; text-transform: uppercase; color: rgba(255, 255, 255, 0.92); text-shadow: 0 1px 8px rgba(10, 50, 80, 0.55); text-align: center; white-space: nowrap; }
.reglbl small { display: block; font: 600 12.5px var(--cond); letter-spacing: 0.04em; text-transform: none; margin-top: 3px; }
.dock { font: 600 11.5px/1.15 var(--cond); color: #fff; background: rgba(21, 39, 58, 0.78); padding: 2px 6px; border-radius: 3px; white-space: nowrap; text-align: center; }
.lane { font: 600 11px/1.2 var(--cond); color: var(--ink); background: rgba(255, 255, 255, 0.88); border: 1px solid var(--line); padding: 1px 5px; border-radius: 3px; white-space: nowrap; }
.lane.idle { color: var(--ink-3); background: rgba(255, 255, 255, 0.6); }
.pop { font: 700 14px var(--cond); color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; white-space: nowrap; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15); animation: popfade 5s ease forwards; }
.pop.good { border-color: var(--good); } .pop.bad { border-color: var(--bad); color: var(--bad); } .pop.gold { background: #fff3cf; border-color: #e5c56c; color: #7a5208; }
@keyframes popfade { 0% { opacity: 0; transform: translateY(6px); } 10% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }
.isl .meta, .isl .money .rent { display: none; }
.isl.on .meta, .isl.sel .meta, .isl.on .money .rent, .isl.sel .money .rent { display: block; }
.isl.on .money .rent, .isl.sel .money .rent { display: inline; }
body.far .isl:not(.on):not(.sel) .money, body.far .dock small { display: none; }
.lane.idle { display: none; } /* idle Cursor slipways carry no label (operator 11-09: too many labels) */
body.veryfar .dock { display: none; }
body.veryfar .isl, body.veryfar .reglbl small { display: none; }
body.tiny .reglbl { font-size: 13px; letter-spacing: 0.08em; }

#tip { position: fixed; pointer-events: none; z-index: 5; max-width: 300px; padding: 8px 10px; font-size: 12.5px; display: none; }
#tip .t { font: 700 15px var(--cond); }
#legend { padding: 4px 9px; font-size: 12px; display: flex; gap: 9px; align-items: center; background: var(--paper-solid); }
#legend .sw { display: inline-block; width: 11px; height: 11px; border-radius: 2px; vertical-align: -1px; margin-right: 3px; }
#banner { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 18px 22px; max-width: 420px; text-align: center; display: none; z-index: 10; }
#banner a { color: var(--info); font-weight: 600; }
.coin { position: fixed; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff4b8, #e2a92b 55%, #a16d0c); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); z-index: 6; pointer-events: none; transition: left 1.1s cubic-bezier(.5, -0.3, .7, 1), top 1.1s cubic-bezier(.3, 0, .6, 1.3), opacity 0.3s ease 1s; }
#treasury.ding { animation: ding 0.6s ease; }
@keyframes ding { 30% { box-shadow: 0 0 0 4px var(--brass-2), 0 6px 22px rgba(12, 40, 60, 0.18); } }
#mapbtns { position: fixed; right: calc(var(--side) + 24px); bottom: calc(var(--board) + 20px); display: flex; gap: 6px; align-items: stretch; flex-wrap: wrap; justify-content: flex-end; }
#mapbtns .btn { background: var(--paper-solid); }
#mapbtns .btn.primary { background: var(--ink); color: #fff; }
#sidetoggle { display: none; }
/* the drawer's own close control (operator 11-15, iPad): first row of the panel, shown only in drawer mode */
#side-close { display: none; flex: none; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-bottom: 1px solid var(--line); background: var(--paper-solid); font: 600 15px var(--cond); letter-spacing: 0.03em; color: var(--ink); }
#side-close span { font: 400 24px/1 var(--ui); }

@media (max-width: 1180px) { #bars { grid-template-columns: repeat(3, minmax(100px, 1fr)); } }
@media (max-width: 860px) {
  :root { --side: 100vw; --board: 132px; }
  #top { right: 12px; flex-wrap: wrap; }
  #bars { grid-template-columns: repeat(2, minmax(100px, 1fr)); }
  #clock { display: none; }
  #side { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 62vh; height: 62dvh; border-radius: 10px 10px 0 0; transform: translateY(105%); visibility: hidden; transition: transform 0.25s ease, visibility 0s linear 0.25s; z-index: 8; }
  body.side-open #side { transform: none; visibility: visible; transition: transform 0.25s ease; }
  #board { right: 12px; }
  #mapbtns { right: 12px; }
  #legend { display: none; }
  #sidetoggle { display: inline-block; }
  #side-close { display: flex; }
  #treasury { min-width: 0; flex: 1 1 100%; padding: 8px 12px; }
  #treasury .big { font-size: 28px; }
  #treasury .row:last-child { display: none; }
  #bars { grid-template-columns: repeat(5, 1fr); gap: 4px 8px; padding: 6px 10px; flex: 1 1 100%; }
  #bars .meta { display: none; }
  .bar .name { font-size: 11px; flex-direction: column; gap: 0; }
  #board header .hint { display: none; }
  #board header h2 { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) { .bar.fast .fill, .pop, #treasury.ding { animation: none; } .coin { transition: none; } }

/* v0.2 drill-down: find, inspector, dashboard window, latency map labels (controller repo production/aquarium/GAME.md) */
#find { position: relative; padding: 8px 10px; display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--line); background: var(--paper-solid); }
#find input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; font: inherit; background: #fff; }
#find kbd { font: 600 11px var(--cond); color: var(--ink-3); border: 1px solid var(--line); border-radius: 3px; padding: 0 5px; background: var(--paper-2); }
#hits { display: none; position: absolute; left: 0; right: 0; top: calc(100% + 4px); max-height: 60vh; overflow-y: auto; background: var(--paper-solid); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 10px 28px rgba(12, 40, 60, 0.25); z-index: 20; }
#hits .hit { display: grid; grid-template-columns: 52px 1fr; gap: 0 8px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--paper-2); background: none; padding: 6px 10px; }
#hits .hit b { font: 600 14px/1.2 var(--cond); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#hits .hit small { grid-column: 2; font-size: 11.5px; color: var(--ink-3); }
#hits .hit .k { grid-row: span 2; font: 600 10.5px/1.6 var(--cond); letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); }
#hits .hit.on, #hits .hit:hover { background: #fbf4e4; }
.opens { cursor: pointer; } .opens:hover { border-color: var(--brass-2); }
.insp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
#pane h4 { margin: 14px 0 6px; font: 700 13px/1.2 var(--cond); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
#pane a { color: var(--info); }
#pane .m a { color: inherit; text-decoration: underline; text-decoration-color: var(--line); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stats > div { border: 1px solid var(--line); border-radius: 5px; background: #fff; padding: 6px 8px; }
.stats b { display: block; font: 700 22px/1.1 var(--cond); }
.stats b small { font: 600 12px var(--cond); color: var(--ink-3); margin-left: 2px; }
.trio { display: flex; flex-wrap: wrap; gap: 0 8px; font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.trio i { font-style: normal; }
.trio i.on { color: var(--ink); font-weight: 600; }
.reading { font-size: 12.5px; margin: 8px 0 0; padding: 6px 8px; background: var(--paper-2); border-radius: 4px; color: var(--ink-2); }
.mchart { position: relative; }
.mchart svg { width: 100%; height: auto; display: block; overflow: visible; }
.mchart text { font: 11px var(--ui); fill: var(--ink-3); }
.mchart text.ct { font: 700 12px var(--cond); letter-spacing: 0.03em; fill: var(--ink); }
.mchart text.cv { font: 600 12px var(--ui); fill: var(--ink); }
.mchart .base { stroke: var(--line); } .mchart .grid { stroke: var(--paper-2); }
.mchart .xh { stroke: var(--ink-3); stroke-dasharray: 3 3; }
.ctip { display: none; position: absolute; top: 4px; width: 170px; padding: 5px 7px; font-size: 11.5px; line-height: 1.35; background: var(--ink); color: #f2f6f5; border-radius: 4px; pointer-events: none; }
details.nums { margin: 6px 0 2px; font-size: 12px; } details.nums summary { cursor: pointer; color: var(--ink-2); }
details.nums table { margin-top: 6px; }
table.lat { width: 100%; border-collapse: collapse; font-size: 12px; }
table.lat th { text-align: left; font: 600 11px var(--cond); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); border-bottom: 1px solid var(--line); padding: 3px 4px; }
table.lat td { padding: 3px 4px; border-bottom: 1px solid var(--paper-2); }
table.lat .r { text-align: right; }
table.lat tr.ours td { background: #e2f1e7; font-weight: 600; }
.strip { display: flex; flex-direction: column; gap: 3px; }
.srow { position: relative; display: grid; grid-template-columns: 1.3fr 0.9fr 0.7fr 0.8fr; gap: 6px; padding: 4px 6px 6px; border: 1px solid var(--line); border-radius: 4px; background: #fff; font-size: 12px; color: var(--ink) !important; text-decoration: none; }
.srow:hover { border-color: var(--brass-2); } .srow.on { outline: 2px solid var(--brass-2); }
.srow span:first-child { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow i { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--good); border-radius: 0 2px 0 4px; }
.nline { padding: 6px 8px; } .nline > a { font-weight: 600; word-break: break-all; }
.mbar { display: inline-block; width: 64px; height: 7px; border-radius: 4px; background: var(--paper-2); border: 1px solid var(--line); overflow: hidden; vertical-align: 0; }
.mbar i { display: block; height: 100%; }
.tile.more { cursor: pointer; align-items: center; justify-content: center; font: 600 13px var(--cond); color: var(--ink-2); }
#wide { position: fixed; left: 12px; right: calc(var(--side) + 24px); top: 120px; bottom: calc(var(--board) + 24px); display: none; flex-direction: column; z-index: 8; overflow: hidden; }
#wide.open { display: flex; }
#float { position: fixed; left: 12px; right: calc(var(--side) + 24px); top: 120px; bottom: calc(var(--board) + 24px); max-width: 1180px; display: none; flex-direction: column; z-index: 7; overflow: hidden; }
#float.open { display: flex; }
#float, #wide { background: var(--paper-solid); }
#float header { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--line); }
#float-body { flex: 1; overflow: auto; padding: 4px 20px 20px; }
#float-body h3 { font-size: 22px; }
#float-body .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#wide header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
#wide h2 { margin: 0; font: 700 18px var(--cond); } #wide p { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-2); }
#wide iframe { flex: 1; border: 0; width: 100%; background: #0b1220; }
.reglbl.post { font-size: 15px; letter-spacing: 0.08em; }
.reglbl.post.empty { color: #ffe9b8; }
.lanelbl { font: 600 12px var(--cond); color: #fff; background: rgba(21, 39, 58, 0.62); padding: 1px 6px; border-radius: 9px; white-space: nowrap; }
body.veryfar .lanelbl { font-size: 11px; }
@media (max-width: 860px) {
  #wide { left: 0; right: 0; top: 0; bottom: 0; border-radius: 0; z-index: 30; }
  #float { left: 0; right: 0; top: 0; bottom: 0; max-width: none; border-radius: 0; z-index: 30; }
  #float-body .stats { grid-template-columns: 1fr 1fr; }
  #float-close, #wide-close { min-width: 44px; min-height: 44px; }
}

/* buildings on an island: one button per node with a status icon (shape + colour, same colours as the roofs) */
.st-serving { --st: #3f9b5a; } .st-synced { --st: #9d9583; } .st-syncing { --st: #c98f12; } .st-lagging { --st: #e07b22; }
.st-down { --st: #c23b2e; } .st-fenced { --st: #4f79b8; } .st-updating, .st-starting { --st: #8e63c9; }
.sti { width: 16px; height: 16px; flex: none; display: block; }
.sti > circle:first-child { fill: var(--st, var(--ink-3)); }
.sti path { fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sti .dotc { fill: #fff; }
.stpills { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0 0 7px; font-size: 12.5px; color: var(--ink-2); }
.stpill { display: inline-flex; align-items: center; gap: 4px; }
.stpill b { color: var(--ink); }
.blds { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 5px; }
.bld { display: grid; grid-template-columns: 16px 1fr; column-gap: 7px; align-items: center; text-align: left; min-width: 0;
  border: 1px solid var(--line); border-left: 4px solid var(--st); border-radius: 5px; background: #fff; padding: 5px 7px; }
.bld:hover { box-shadow: 0 0 0 2px var(--brass-2); }
.bld .sti { grid-row: span 2; }
.bld b { font: 600 13.5px/1.2 var(--cond); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bld small { font-size: 11px; line-height: 1.2; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bld.st-down { background: #fcefed; } .bld.st-lagging { background: #fdf4ea; }
.sortchips { display: flex; gap: 5px; margin: 0 0 6px; }
.sortchips .chip { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 1px 9px; font: 600 12px var(--cond); color: var(--ink-2); }
.sortchips .chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* v0.3 traffic: region bars, network rows, flow control */
.rbar { display: flex; height: 12px; border-radius: 3px; overflow: hidden; gap: 2px; background: var(--paper-2); margin: 4px 0 6px; }
.rbar i { display: block; height: 100%; min-width: 2px; }
.rtab td { padding: 2px 4px; }
.sw2 { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }
.ntab { display: flex; flex-direction: column; gap: 3px; }
.nrow { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; text-align: left; border: 1px solid var(--line); border-radius: 4px; background: #fff; padding: 4px 6px 2px; font-size: 12.5px; }
.nrow:hover { box-shadow: 0 0 0 2px var(--brass-2); }
.nrow span:first-child { font-weight: 600; }
.nrow .rbar { grid-column: 1 / -1; height: 6px; margin: 3px 0 2px; }
.kvrow { display: flex; justify-content: space-between; font-size: 12.5px; padding: 2px 0; border-bottom: 1px dotted var(--line); }
#flowctl { display: flex; align-items: center; gap: 6px; padding: 4px 8px; }
#flowctl select { font: 600 12px var(--cond); border: 1px solid var(--line); border-radius: 12px; padding: 1px 6px; background: #fff; height: 22px; max-width: 190px; }
#flowctl .chip { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 1px 9px; font: 600 12px var(--cond); color: var(--ink-2); }
#flowctl .chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
body[data-mode="spectator"] #flowctl { display: none; }
/* v0.5 lighthouse: backend cables on the map and the proxy window */
.cablelbl { font: 600 11.5px var(--cond); color: var(--ink); background: rgba(255, 255, 255, 0.88); border: 1px solid #8a99a8; padding: 0 5px; border-radius: 8px; white-space: nowrap; pointer-events: none; }
.cablelbl.off { display: none; }
/* cable labels (incl. the lighthouse's own share) only for the flow under the pointer (operator 11-09: too many labels) */
.cablelbl:not(.on) { display: none; }
.srow.orow { grid-template-columns: 1fr 0.55fr 0.8fr 1.5fr; }
.srow.orow span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow small, .hrow small { color: var(--ink-3); font-weight: 500; }
.hbh { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; }
.hrow { display: grid; grid-template-columns: minmax(0, 1fr) auto 3.2em; align-items: center; gap: 8px; font-size: 12px; }
.hrow > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.hrow > .num { text-align: right; }
.hrow svg rect { fill: #6f8091; }
.hrow svg rect:hover { fill: var(--ink); }
.hrow svg line { stroke: var(--line); }
.nrow .hl { grid-column: 1 / -1; font-size: 11.5px; color: var(--ink-3); }
/* a down node on a serving host: a red marker that reads at any zoom */
.alarm { font: 700 11px/16px var(--cond); letter-spacing: 0.04em; text-transform: uppercase; color: #fff; background: var(--bad); border: 1.5px solid #fff; border-radius: 9px; padding: 0 6px; box-shadow: 0 0 0 3px rgba(191, 58, 43, 0.35); pointer-events: none; }
body.veryfar .alarm { font-size: 0; width: 10px; height: 10px; padding: 0; }

/* ships are node transfers (GAME.md v0.6) */
.shiplbl { font: 600 11px/1.15 var(--cond); color: #fff; background: rgba(21, 39, 58, 0.78); padding: 1px 6px; border-radius: 3px; white-space: nowrap; transform: translateY(-4px); pointer-events: none; }
.shiplbl.becalmed { background: rgba(156, 106, 18, 0.9); }
.shiplbl.docked { background: rgba(59, 109, 180, 0.88); }
.shiplbl.sunk { background: var(--bad); }
body.far .shiplbl { font-size: 10px; }
/* a pause or an overstayed fence should not become permanent (operator 11-08) */
.qmark { font: 800 15px/20px var(--cond); width: 20px; text-align: center; color: #fff; background: #c98a0a; border: 1.5px solid #fff; border-radius: 50%; box-shadow: 0 0 0 3px rgba(201, 138, 10, 0.3); pointer-events: none; }
/* a building's life cycle (GAME.md v0.8): progress bar over construction and repair */
.lifebar { display: flex; align-items: center; gap: 4px; font: 600 10.5px/14px var(--cond); color: #fff; background: rgba(21, 39, 58, 0.78); padding: 1px 5px; border-radius: 3px; white-space: nowrap; pointer-events: none; }
.lifebar i { display: block; width: 36px; height: 5px; background: rgba(255, 255, 255, 0.25); border-radius: 2px; overflow: hidden; }
.lifebar i span { display: block; height: 100%; background: #e3b341; }
.lifebar.repair i span { background: #7fb4ff; }
body.far .lifebar { font-size: 9.5px; }
/* map only (operator 11-08): every panel out of the way, one button to bring them back */
#b-panels { display: none; }
body.maponly #top, body.maponly #side, body.maponly #board, body.maponly #mapbtns, body.maponly #float, body.maponly #wide, body.maponly #sidetoggle { display: none !important; }
body.maponly #b-panels { display: block; position: fixed; right: 16px; bottom: 16px; z-index: 30; background: var(--paper-solid); }

/* ---- PR A (operator 11-09): orders over the house, facts as graphics, toast, picking, zoom levels */
.orders { display: flex; gap: 4px; padding: 4px; background: rgba(21, 39, 58, 0.82); border-radius: 18px; pointer-events: auto; transform: translateY(-50%); box-shadow: 0 4px 14px rgba(12, 40, 60, 0.3); }
.orders .ord { width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--paper-solid); display: grid; place-items: center; cursor: pointer; padding: 0; }
.orders .ord:hover, .orders .ord:focus-visible { background: var(--brass-2); outline: none; }
.ord svg { width: 18px; height: 18px; fill: none; stroke: var(--ink); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.orders .ord-retire svg, .orders-row .ord-retire svg { stroke: var(--bad); }
.orders .ord-quest { background: #fff3cf; }
.orders-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 4px; }
.orders-row .ord { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 16px; padding: 4px 10px 4px 6px; font: 600 13px var(--cond); color: var(--ink); cursor: pointer; }
.orders-row .ord:hover { border-color: var(--brass-2); background: #fff8e6; }
#toast { position: fixed; left: 50%; bottom: calc(var(--board) + 24px); transform: translate(-50%, 12px); max-width: min(560px, calc(100vw - 32px)); background: var(--ink); color: #fff; font: 500 14px/1.35 var(--ui); padding: 9px 14px; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 20; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
body.picking canvas { cursor: crosshair !important; }

.facts { display: grid; gap: 8px; margin: 8px 0 10px; }
.badge { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 0 10px; padding: 9px 12px; border-radius: 8px; border: 1px solid; }
.badge b { font: 700 16px var(--cond); letter-spacing: 0.02em; }
.badge .big { font: 700 26px/1 var(--cond); grid-row: span 2; align-self: center; }
.badge small { grid-column: 1; font: 500 12.5px/1.3 var(--ui); color: var(--ink-2); }
.badge.ok { background: #e8f5ee; border-color: #9fd0b3; } .badge.ok b, .badge.ok .big { color: var(--good); }
.badge.warn { background: #fdf4e3; border-color: #e7c27a; } .badge.warn b, .badge.warn .big { color: var(--warn); }
.badge.bad { background: #fbeceb; border-color: #e3a49c; } .badge.bad b, .badge.bad .big { color: var(--bad); }
.badge.slate { background: #eef1f4; border-color: #b9c4ce; } .badge.slate b, .badge.slate .big { color: #4b5b6a; }
.badge.info { background: #ebf1fa; border-color: #a9c0e3; } .badge.info b, .badge.info .big { color: var(--info); }
.facts .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font: 500 13px var(--ui); color: var(--ink); }
.facts .row .lbl { width: 54px; flex: none; color: var(--ink-3); font-size: 12.5px; }
.facts .row small { color: var(--ink-2); font-size: 12px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 10px; background: var(--paper-2); color: var(--ink-2); font: 600 12px/18px var(--cond); white-space: nowrap; }
.chip.warn { background: #fdf0d6; color: #8a5a00; } .chip.bad { background: #f9dedb; color: #9b2c20; } .chip.good { background: #dcf0e4; color: #1f6b41; }
.chip .ico { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; }
svg.chain { width: 102px; height: 13px; flex: none; }
.head.ok svg.chain rect { fill: var(--good); } .head.warn svg.chain rect { fill: var(--warn); } .head.bad svg.chain rect { fill: var(--bad); }
svg.chain rect.hollow { fill: none !important; stroke: var(--ink-3); stroke-width: 1.2; stroke-dasharray: 2 1.5; }
.meter { position: relative; flex: 1 1 110px; max-width: 170px; height: 8px; border-radius: 4px; background: var(--paper-2); overflow: visible; }
.meter i { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--good); }
.meter.warn i { background: var(--warn); } .meter.bad i { background: var(--bad); }
.meter u { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--ink); border-radius: 1px; }
.stack { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--paper-2); margin: 6px 0 4px; gap: 2px; }
.stack i, .stackkey i, .sw { display: inline-block; }
.stack i.rent, .stackkey i.rent, .sw.out { background: #8a99a8; } .stack i.subs, .stackkey i.subs { background: #6b5bb5; } .stack i.profit, .stackkey i.profit, .sw.in { background: var(--brass-2); }
.stackkey { display: flex; gap: 12px; flex-wrap: wrap; font: 500 12.5px var(--ui); color: var(--ink-2); }
.stackkey i, .sw { width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.rows .hrow { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 8px; align-items: center; font: 500 13px var(--ui); padding: 3px 0; }
.rows .pair { display: grid; gap: 2px; } .rows .pair i { display: block; height: 6px; border-radius: 3px; min-width: 2px; }
.rows .pair i.in { background: var(--brass-2); } .rows .pair i.out { background: #8a99a8; }

/* life bars and transfer bars on the map */
.lifebar i.unknown span { width: 40% !important; background: repeating-linear-gradient(90deg, #e3b341 0 6px, transparent 6px 10px); animation: slide 1.2s linear infinite; }
@keyframes slide { from { margin-left: -40%; } to { margin-left: 100%; } }
.lifebar em { font-style: normal; }
body.far .lifebar em, body.far .lifebar.xfer b { display: none; }
.lifebar.xfer { background: rgba(122, 84, 52, 0.9); }
.lifebar.xfer b { font-weight: 700; text-transform: lowercase; }
.lifebar.xfer i span { background: #f2d38a; }
.lifebar.xfer.stuck { background: rgba(156, 106, 18, 0.95); }
body.far .alarm { font-size: 0; width: 10px; height: 10px; padding: 0; }
.reglbl.post small { font-size: 11.5px; }

@media (max-width: 860px) {
  .orders .ord { width: 34px; height: 34px; }
}
/* a touch tablet in landscape (operator 11-15, iPad): the side panel is a drawer as on a phone, closed until something
   is picked and closed again with its own control; the map, the top bar and the board keep the full width.
   The same query is DRAWER in game.js. */
@media (min-width: 861px) and (pointer: coarse) {
  :root { --side: 0px; }
  #side { width: min(372px, calc(100vw - 24px)); z-index: 8; transform: translateX(calc(100% + 24px)); visibility: hidden; transition: transform 0.25s ease, visibility 0s linear 0.25s; }
  body.side-open #side { transform: none; visibility: visible; transition: transform 0.25s ease; }
  #sidetoggle { display: inline-block; }
  #side-close { display: flex; }
  #float, #wide { z-index: 9; }
  #float-close, #wide-close { min-width: 44px; min-height: 44px; }
}

/* day dials at the cities (operator 11-09): local time, sun or moon, traffic against the usual peak */
.dial { width: 36px; height: 36px; pointer-events: auto; cursor: help; filter: drop-shadow(0 1px 3px rgba(10, 40, 60, 0.35)); }
body.tiny .dial { width: 28px; height: 28px; }
.card.tav .branches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 6px; }
.card.tav .br { display: grid; gap: 3px; justify-items: start; }
.card.tav .br small { font: 600 11.5px var(--cond); color: var(--ink-2); }
.card.tav .br .btn { padding: 2px 10px; font-size: 12px; }
svg.odds { width: 100%; height: 30px; }
svg.odds rect { fill: #9fb6c8; } svg.odds rect.yday { fill: var(--brass-2); }

.phist { margin: 6px 0 2px; } .phist svg { width: 100%; height: 54px; display: block; }
.phist path.price { fill: none; stroke: #2b6cb0; stroke-width: 2; }
.phist rect.inc { fill: #e6c27a; } .phist text { font: 700 8px var(--cond); text-anchor: middle; }
.phist text.up { fill: var(--good); } .phist text.down { fill: var(--bad); }
.phist small { font: 500 11px var(--ui); color: var(--ink-3); }

.isl .runway { font-style: normal; font: 700 11px var(--cond); padding: 0 4px; border-radius: 3px; margin-left: 3px; text-shadow: none; }
.isl .runway.warn { background: #fdf0d6; color: #8a5a00; } .isl .runway.bad { background: var(--bad); color: #fff; }
.lifebar.stuck { background: rgba(191, 58, 43, 0.92); } .lifebar.stuck i span { background: #f6b2a8; }

ol.steps { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 2px; }
ol.steps li { display: flex; justify-content: space-between; gap: 8px; font: 500 12.5px var(--ui); padding: 2px 8px; border-left: 3px solid var(--line); }
ol.steps li.done { border-color: var(--good); color: var(--ink-2); } ol.steps li.now { border-color: var(--brass-2); background: #fff8e6; font-weight: 600; }
ol.steps li.bad { border-color: var(--bad); color: var(--bad); } ol.steps li.todo { color: var(--ink-3); }
ol.steps li small { color: var(--ink-3); white-space: nowrap; }
.card.qjob .tick { font: 500 11.5px/1.35 ui-monospace, monospace; color: var(--ink-2); background: var(--paper-2); padding: 4px 6px; border-radius: 4px; overflow-wrap: anywhere; }

/* drift (S1.3, controller repo production/arch/D-spec/S1.3-drift-map.md): the day's reconciled status of every process
   object, captain's view only. The seven fills are the spec's colour table; text on them stays in the game's ink
   (8.2:1 or better on every fill, WCAG AAA). A fill always comes with its word: a tile's label, a row's swatch title, a badge's text. */
#drift { padding: 7px 10px 8px; border-bottom: 1px solid var(--line); background: var(--paper-solid); }
#drift:empty { display: none; }
#drift .dhead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; margin-bottom: 5px; }
#drift .dhead .m { font-size: 12px; color: var(--ink-3); }
.dnm { font: 600 13px var(--cond); color: var(--ink-2); letter-spacing: 0.02em; white-space: nowrap; }
.dtiles { display: flex; gap: 4px; }
.dtile { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; padding: 3px 6px 4px; border: 1px solid rgba(21, 39, 58, 0.2); border-radius: 5px; background: var(--dc); color: var(--ink); text-align: left; }
.dtile b { font: 700 17px/1.1 var(--cond); }
.dtile span { font: 600 11px/1.2 var(--cond); letter-spacing: 0.01em; white-space: nowrap; }
.dtile:hover { border-color: var(--brass-2); box-shadow: 0 2px 8px rgba(156, 106, 18, 0.18); }
.dtile[aria-pressed="true"] { outline: 2px solid var(--brass-2); outline-offset: 1px; }
.dtriage { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 5px; margin-top: 6px; }
.dtriage .cap { margin-right: 2px; }
.dtri { display: inline-grid; grid-template-columns: auto auto; align-items: baseline; gap: 0 4px; padding: 1px 8px 3px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: 600 12px/16px var(--cond); color: var(--ink-2); }
.dtri b { color: var(--ink); }
.dtri .dstack { grid-column: 1 / -1; }
.dtri:hover { border-color: var(--brass-2); }
.dtri[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.dstack { display: flex; gap: 1px; height: 4px; border-radius: 2px; overflow: hidden; background: rgba(21, 39, 58, 0.35); }
.dstack i { display: block; min-width: 2px; }
.dstack.big { height: 10px; margin: 2px 0 5px; border-radius: 3px; }
.dsw { display: inline-block; flex: none; width: 11px; height: 11px; border-radius: 2px; background: var(--dc); border: 1px solid rgba(21, 39, 58, 0.4); vertical-align: -1px; }
#pane h3.dtitle .dsw { width: 14px; height: 14px; margin-right: 7px; }
.stackkey .dsw { margin-right: 4px; }
.dchip .dsw { width: 9px; height: 9px; }
#pane .dsrc { margin: 0 0 8px; font-size: 12px; color: var(--ink-3); }
#pane .dsrc b { color: var(--ink); font-weight: 600; }
.dfilters { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 6px; }
.dfilters select { flex: 1 1 96px; min-width: 0; max-width: 100%; height: 24px; font: 600 12px var(--cond); border: 1px solid var(--line); border-radius: 12px; padding: 1px 6px; background: #fff; }
.drows { display: flex; flex-direction: column; gap: 3px; margin-bottom: 6px; }
.drow { display: grid; grid-template-columns: 11px minmax(0, 1fr); gap: 0 7px; padding: 5px 7px; border: 1px solid var(--line); border-left: 4px solid var(--dc); border-radius: 4px; background: #fff; font-size: 12px; }
.drow .dsw { margin-top: 3px; }
.drow .did { display: block; font: 600 13px/1.25 var(--cond); overflow-wrap: anywhere; }
.drow .dm { color: var(--ink-2); line-height: 1.35; overflow-wrap: anywhere; }
.drow .dp { color: var(--ink-3); line-height: 1.35; overflow-wrap: anywhere; }
.isl .dline { display: block; margin-top: 1px; }
.isl .drift { font-style: normal; font: 700 11px/15px var(--cond); padding: 0 4px; border-radius: 3px; background: var(--dc); color: var(--ink); border: 1px solid rgba(21, 39, 58, 0.45); text-shadow: none; pointer-events: auto; cursor: pointer; }
