* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --water:   #0b2331;
  --ink:     #e9e2d4;
  --ink-dim: #8d8577;

  /* 1 / zoom — anything multiplied by this holds a constant on-screen size */
  --k: 1;
}

html, body { height: 100%; }

/* Author display rules (grid/flex) outrank the UA rule behind the `hidden`
   attribute, so anything toggled with `hidden` needs this or it never hides. */
[hidden] { display: none !important; }

body {
  background: var(--water);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  overflow: hidden;
}

/* dragging and double-clicking the map must never select the labels */
body, #map, #map * {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#map ::selection      { background: transparent; }
#map ::-moz-selection { background: transparent; }

.frame {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(1500px 1100px at 44% 46%, #123c50 0%, #0d2836 40%, #0b2331 70%, #071823 100%);
}

#map {
  width: 100%; height: 100%; display: block; cursor: grab; touch-action: none;
  /* Confine painting to this element so the browser never has to consider
     anything outside it, and promote it to its own compositor layer so a
     zoom re-raster does not drag the rest of the page through it. */
  contain: strict;
  will-change: transform;
}

/* At deep zoom the document is scaled tens of thousands of times. Chrome
   cannot tile a raster that large on the GPU and falls back to CPU
   rasterisation — a multi-hundred-millisecond freeze, exactly at the moment
   new geometry appears. Dropping antialiasing on the heavy layers cuts that
   raster cost enormously and is invisible at this magnification. */
.detail-4 #world { shape-rendering: optimizeSpeed; }
.detail-4 .hold-build,
.detail-4 .sol-layer,
.detail-4 .battle-layer { shape-rendering: geometricPrecision; }
#map.dragging { cursor: grabbing; }

/* ── land ───────────────────────────────────────────────────── */

/* every country shares this fill — the map is one continuous landmass
   and only the border lines separate them */
.land { fill: #2c3d22; }
/* The backdrop must read unmistakably as ground. At #2c3d22 under the shadow
   wash it was almost exactly as dark as the ocean, so every seam between two
   countries looked like a hole even though land was underneath it. */
.continent { fill: #40542f; }

.zone      { stroke: none; }
.z-amazon  { fill: #1f4420; }
.z-shield  { fill: #244a27; }
.z-llanos  { fill: #5a6631; }
.z-carib   { fill: #6b6a3d; }
.z-andes   { fill: #4a4a2c; }
.z-pacific { fill: #1b4526; }

.forest-patch { fill: #17361a; opacity: .5; }

.ridge-shadow { fill: none; stroke: #1d1a0e; stroke-linecap: round; stroke-linejoin: round; opacity: .55; }
.ridge-body   { fill: none; stroke: #6a6140; stroke-linecap: round; stroke-linejoin: round; }
.ridge-crest  { fill: none; stroke: #a8996d; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
.peak         { fill: #ccbd91; opacity: .72; }
.peak-shadow  { fill: #241f12; opacity: .5; }

.river { fill: none; stroke: #55a0bb; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }

/* land stays continuous; everything outside Colombia just sits in shadow.
   Kept light — heavier than this and the neighbours read as muddy water. */
.outside-wash { fill: rgba(6, 16, 20, .16); }

/* ── borders ────────────────────────────────────────────────── */

.border {
  fill: none;
  stroke: rgba(206, 224, 190, .3);
  stroke-width: 1.1;
  stroke-dasharray: 5 2.5;
}
.border-co {
  stroke: rgba(226, 238, 206, .85);
  stroke-width: 1.8;
  stroke-dasharray: none;
}

.dept       { fill: transparent; stroke: rgba(233, 226, 212, .15); stroke-width: .5; cursor: pointer; }
.dept:hover { fill: rgba(233, 226, 212, .09); stroke: rgba(233, 226, 212, .6); }

/* ── operations overlay ─────────────────────────────────────── */

/* a stain on the terrain, not a light source — no screen blend */
.coca-glow { fill: url(#heat); }
.coca-core { fill: #8f3220; }

.urban-halo { fill: url(#urbanGlow); }
.urban      { fill: #7b7b74; opacity: .72; }
.urban-core { fill: #a8a69c; opacity: .82; }

/* roads out of each city, and the faint highway net between them */
.city-road { fill: none; stroke: #8f8d83; opacity: .42; stroke-linecap: round; }
.highway   { fill: none; stroke: #97948a; opacity: .3; stroke-width: .9;
             stroke-linecap: round; stroke-linejoin: round; }

/* Hidden layers use display:none, not opacity — an invisible layer still
   costs paint time every frame, and there are thousands of these.
   City blocks show in a BAND only. Past detail-4 you are down at your own
   compound, and leaving 4,000 blocks rendered at 500×+ scale is what made
   zooming in grind to a halt. */
.city-detail { display: none; }
/* Street grids only exist in a narrow, deep band. Between zoom 8 and 60 you
   cannot read a city block anyway, but 34 clip-paths and thousands of rects
   still cost real paint time — that band was the mid-zoom stutter. */
.detail-3 .city-detail { display: none; }
.detail-3b .city-detail { display: block; }
.detail-4 .city-detail { display: none; }

/* Once you are down at the compound the entire country is still being
   painted — landmasses, terrain zones, borders, sprawl, forest — every one
   scaled to thousands of times its size, almost all off screen. None of it
   is visible from your yard, so none of it may cost anything. */
/* display, NOT visibility. A visibility:hidden element still sits in the
   raster tree, so the country was still being rasterised at 60x–40000x scale
   — that is the second-long freeze. display:none removes it from
   rasterisation entirely. The relayout that costs is ~49 ms against a
   ~1000 ms raster stall, and `contain: strict` on #map keeps it local. */
.detail-4 .land,
.detail-4 .zone,
.detail-4 .coast-halo,
.detail-4 .outside-wash,
.detail-4 .border,
.detail-4 .dept,
.detail-4 .forest-patch,
.detail-4 .graticule,
.detail-4 .city,
.detail-4 .roads,
.detail-4 .urban,
.detail-4 .urban-halo,
.detail-4 .urban-core,
.detail-4 .coca-glow,
.detail-4 .coca-core,
.detail-4 .route,
.detail-4 .ai-pin,
.detail-4 #labels { display: none; }

/* the compound floats on plain ground colour instead of dark sea */
.detail-4 .frame { background: #2c3d22; }
.city-block      { fill: #8b8880; opacity: .55; }
.city-block.tall { fill: #a5a29a; opacity: .7; }

.city-dot         { fill: #f4ecd8; stroke: #14170f; stroke-width: .5; }
.city-dot.port    { fill: #8fd4ea; stroke: #0e242d; }
.city-dot.foreign { fill: #b9c3b0; stroke: #14170f; stroke-width: .4; opacity: .8; }

/* ── map type ───────────────────────────────────────────────── */

/* Labels live inside the zoom transform, so every size is multiplied by
   --k (= 1 / zoom). That keeps text at a constant on-screen size no matter
   how far in you go — essential now the zoom runs to 10000×. */

text { pointer-events: none; }

.sea-label {
  fill: #6fa8c2; font-size: calc(15px * var(--k)); letter-spacing: .4em;
  text-anchor: middle; opacity: .45; font-weight: 300;
}

.country-label {
  fill: #9fb0a4; font-size: calc(11px * var(--k)); letter-spacing: .3em;
  text-anchor: middle; opacity: .6; font-weight: 500;
  paint-order: stroke; stroke: rgba(6, 14, 12, .6); stroke-width: calc(2.4px * var(--k));
}
.country-label.co {
  fill: #f0e8d2; font-size: calc(15px * var(--k)); opacity: .92;
  stroke: rgba(6, 14, 12, .75); stroke-width: calc(3px * var(--k));
}

.city-label {
  fill: #f6efdd; font-size: calc(6.2px * var(--k)); letter-spacing: .04em;
  text-anchor: middle;
  paint-order: stroke; stroke: rgba(6, 12, 8, .9); stroke-width: calc(2.2px * var(--k));
}
.city-label.foreign { fill: #a9b5a2; font-size: calc(5.6px * var(--k)); opacity: .85; }

.dept-label {
  fill: #ddd4c0; font-size: calc(6.4px * var(--k)); letter-spacing: .05em;
  text-anchor: middle; opacity: 0; transition: opacity .25s ease;
  paint-order: stroke; stroke: rgba(6, 12, 8, .88); stroke-width: calc(2.2px * var(--k));
}
.detail-on .dept-label { opacity: .92; }

.coca-label {
  fill: #c9836e; font-size: calc(5.2px * var(--k)); letter-spacing: .16em;
  text-anchor: middle; opacity: 0; transition: opacity .25s ease;
  paint-order: stroke; stroke: rgba(20, 8, 5, .85); stroke-width: calc(1.9px * var(--k));
}
.detail-on .coca-label { opacity: .85; }

.river-label {
  fill: #86c8de; font-size: calc(5px * var(--k)); letter-spacing: .13em;
  text-transform: uppercase; opacity: 0; transition: opacity .25s ease;
  paint-order: stroke; stroke: rgba(4, 16, 22, .85); stroke-width: calc(1.7px * var(--k));
}
.detail-2 .river-label { opacity: .9; }

/* ── top bar ────────────────────────────────────────────────── */

.topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 56px;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  padding: 0 20px;
  background: rgba(7, 17, 23, .9);
  border-bottom: 1px solid rgba(233, 226, 212, .12);
  box-shadow: 0 2px 14px rgba(0, 0, 0, .35);
  z-index: 10;
}

/* left / centre / right groups — new slots drop into any of them */
.topbar-group {
  display: flex;
  align-items: center;
  gap: 26px;
  flex: 1 1 0;
}
#barCentre { justify-content: center; }
#barRight  { justify-content: flex-end; }

/* one readout in the bar: small key above, figure below */
.slot {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  white-space: nowrap;
}
#barRight .slot { align-items: flex-end; }

.slot-key {
  font-size: 8.5px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: rgba(141, 133, 119, .95);
}

.slot-val {
  display: flex;
  align-items: baseline;
  gap: 3px;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  color: #ece5d5;
  line-height: 1;
}

.slot-sym {
  font-size: 12.5px;
  color: rgba(236, 229, 213, .5);
}

/* ── buttons ────────────────────────────────────────────────── */

.bar-btn {
  align-self: center;
  padding: 8px 16px;
  font: inherit;
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #e4dccb;
  background: rgba(233, 226, 212, .07);
  border: 1px solid rgba(233, 226, 212, .2);
  border-radius: 3px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.bar-btn:hover  { background: rgba(233, 226, 212, .13); border-color: rgba(233, 226, 212, .38); }
.bar-btn:active { background: rgba(233, 226, 212, .18); }
.bar-btn.founded {
  color: #cfe0b8;
  border-color: rgba(207, 224, 184, .34);
  background: rgba(120, 160, 100, .1);
}

.solid-btn, .ghost-btn {
  padding: 9px 18px;
  font: inherit;
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  border-radius: 3px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.solid-btn {
  color: #0d1a12;
  background: #cfe0b8;
  border: 1px solid #cfe0b8;
}
.solid-btn:hover    { background: #dcecc6; }
.solid-btn:disabled { opacity: .4; cursor: not-allowed; }
.ghost-btn {
  color: #b9b2a3;
  background: transparent;
  border: 1px solid rgba(233, 226, 212, .22);
}
.ghost-btn:hover { color: #e4dccb; border-color: rgba(233, 226, 212, .45); }

/* ── login gate & admin ─────────────────────────────────────── */

.gate {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center;
  background: #061119;
}
.gate-card {
  width: min(410px, calc(100vw - 40px));
  padding: 30px 30px 24px;
  background: #0d1c24;
  border: 1px solid rgba(233, 226, 212, .14);
  border-radius: 5px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}
.gate-card.wide { width: min(560px, calc(100vw - 40px)); }
.gate-title { margin-top: 7px; font-size: 25px; font-weight: 500; color: #efe7d6; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .1em; }

.admin-list { margin-top: 18px; max-height: 46vh; overflow-y: auto; }
.admin-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 11px; margin-bottom: 6px;
  background: rgba(233, 226, 212, .04);
  border: 1px solid rgba(233, 226, 212, .09);
  border-radius: 3px;
}
.admin-tok {
  flex: 1; font-family: ui-monospace, Consolas, monospace;
  font-size: 14px; letter-spacing: .12em; color: #efe7d6;
}
.admin-who { font-size: 11px; color: #857e6e; white-space: nowrap; }
.admin-who.free { color: #a7cf8c; }

/* ── modal ──────────────────────────────────────────────────── */

.modal-wrap {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(4, 10, 14, .68);
}

.modal {
  width: min(400px, calc(100vw - 48px));
  padding: 26px 28px 22px;
  background: #0d1c24;
  border: 1px solid rgba(233, 226, 212, .14);
  border-radius: 5px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
}

.modal-key {
  font-size: 8.5px;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: rgba(141, 133, 119, .95);
}
.modal-title {
  margin-top: 7px;
  font-size: 21px;
  font-weight: 500;
  letter-spacing: .01em;
  color: #efe7d6;
}
.modal-body {
  margin-top: 9px;
  font-size: 13px;
  line-height: 1.5;
  color: #9a9382;
}

.field { display: block; margin-top: 20px; }
.field-key {
  display: block;
  margin-bottom: 6px;
  font-size: 8.5px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: rgba(141, 133, 119, .95);
}
.field-input {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: 15px;
  color: #efe7d6;
  background: rgba(0, 0, 0, .3);
  border: 1px solid rgba(233, 226, 212, .18);
  border-radius: 3px;
  outline: none;
  transition: border-color .15s ease;
}
.field-input::placeholder { color: rgba(141, 133, 119, .55); }
.field-input:focus        { border-color: rgba(207, 224, 184, .6); }

.field-err {
  margin-top: 7px;
  font-size: 11.5px;
  color: #d98f7a;
}

.modal-note {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(233, 226, 212, .1);
  font-size: 12px;
  line-height: 1.5;
  color: #857e6e;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 18px;
}

/* ── placement prompt ───────────────────────────────────────── */

.placebar {
  position: absolute;
  top: 74px; left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 12px 10px 18px;
  background: rgba(9, 21, 28, .93);
  border: 1px solid rgba(207, 224, 184, .3);
  border-radius: 4px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .4);
}
.placebar-txt {
  font-size: 12px;
  letter-spacing: .04em;
  color: #dcd4c2;
}

#map.placing { cursor: crosshair; }

/* ── holdings on the map ────────────────────────────────────── */

.holding { cursor: pointer; }

/* ground, from treeline in to the yard */
.hold-scrub { fill: #24401f; opacity: .85; }
.hold-plot  { fill: #55603068; }
.hold-dirt  { fill: #6b5b3c; opacity: .55; }
.hold-track { fill: none; stroke: #7d6b47; opacity: .75; stroke-linecap: round; }

/* ── the territory grid ─────────────────────────────────────── */

/* Fields, not tiles. Overlapping organic patches merge into one holding
   with a ragged natural edge — no squares, no corners, no perfect circle. */
.field-owned { fill: #4d5a2e; opacity: .5; }
.field-open  { fill: #2a3324; opacity: .45; cursor: pointer; }
.field-rival { fill: var(--rival, #c9614a); opacity: .17; cursor: pointer; }
.field-open:hover, .field-rival:hover { opacity: .36; }
.field-open.contested, .field-rival.contested { opacity: .42; }

/* a wandering fenceline round what you hold */
.hold-edge-glow { fill: none; stroke: #cfe0b8; opacity: .13;
                  stroke-width: calc(3.6px * var(--k)); stroke-linecap: round; }
.hold-edge      { fill: none; stroke: #cfe0b8; opacity: .78;
                  stroke-width: calc(1.3px * var(--k)); stroke-linecap: round; }

/* dashed strokes on huge scaled paths are very expensive to rasterise */
.route-land .route-line, .route-sea .route-line, .route-air .route-line,
.border { stroke-dasharray: none; }
.detail-2 .route-land .route-line { stroke-dasharray: calc(6px * var(--k)) calc(4px * var(--k)); }
.detail-2 .route-sea  .route-line { stroke-dasharray: calc(3px * var(--k)) calc(4px * var(--k)); }
.detail-2 .route-air  .route-line { stroke-dasharray: calc(11px * var(--k)) calc(6px * var(--k)); }
.detail-2 .border { stroke-dasharray: 5 2.5; }

/* ── firefights ─────────────────────────────────────────────── */

/* located rival compounds */
.ai-halo  { fill: rgba(201, 97, 74, .2);  r: calc(8px * var(--k)); }
.ai-dot   { fill: #c9614a; stroke: #1c0f0b; r: calc(3px * var(--k));
            stroke-width: calc(.8px * var(--k)); }
.ai-label { fill: #e2a08d; text-anchor: middle; font-size: calc(6px * var(--k));
            letter-spacing: .08em; opacity: 0; transition: opacity .25s ease;
            paint-order: stroke; stroke: rgba(20, 8, 5, .88); stroke-width: calc(2.2px * var(--k)); }
.detail-on .ai-label { opacity: .95; }

.enemy-torso { fill: #7a4038; }
.enemy-head  { fill: #a8785c; }
.tracer      { stroke: #ffd98a; opacity: .85; stroke-linecap: round; }
.battle-layer { display: none; }
.detail-4 .battle-layer { display: block; }

.tree        { fill: #1d3a19; }
.tree-shadow { fill: rgba(0, 0, 0, .35); }

/* coca under cultivation — tilled beds with dashed rows reading as bushes */
.coca-soil { fill: #6d5836; opacity: .9; }
.coca-row  { stroke: #4f7a35; stroke-linecap: round; opacity: .95; }

/* buildings — pitched roof read as two slopes with a ridge */
.bld-shadow    { fill: rgba(0, 0, 0, .38); }
.bld-wall      { fill: #4a4034; }
.bld-roof-far  { fill: #8d7a55; }
.bld-roof-near { fill: #6d5d40; }
.bld-ridge     { stroke: #a89573; }
.bld-seam      { stroke: rgba(0, 0, 0, .22); }
.bld-outline   { fill: none; stroke: rgba(0, 0, 0, .45); stroke-width: .00018; }

.bld-tin      .bld-roof-far  { fill: #96654a; }
.bld-tin      .bld-roof-near { fill: #714b36; }
.bld-tin      .bld-ridge     { stroke: #b07f5e; }

.bld-metal    .bld-roof-far  { fill: #7d8790; }
.bld-metal    .bld-roof-near { fill: #5d666e; }
.bld-metal    .bld-ridge     { stroke: #9aa4ae; }

.bld-tile     .bld-roof-far  { fill: #9c5f43; }
.bld-tile     .bld-roof-near { fill: #7a4831; }
.bld-tile     .bld-ridge     { stroke: #b8785a; }

.bld-concrete .bld-roof-flat { fill: #6f6f68; }
.bld-concrete .bld-vent      { fill: #4a4a44; }

/* parked vehicles */
.veh-shadow { fill: rgba(0, 0, 0, .38); }
.veh-body   { fill: #4b5240; }
.veh-cab    { fill: #5f6650; }
.veh-wing   { fill: #7b8272; }
.veh-tail   { fill: #7b8272; }
.veh-gun    { fill: #2a2a26; }

.airstrip      { fill: #6a5b41; opacity: .8; }
.airstrip-mark { stroke: #cbbd93; opacity: .55; }

/* screen-constant pin, for when the plot is too small to see */
.hold-pin {
  fill: rgba(207, 224, 184, .18);
  stroke: #cfe0b8;
  r: calc(7px * var(--k));
  stroke-width: calc(1.3px * var(--k));
}
.hold-pin-dot { fill: #cfe0b8; r: calc(2px * var(--k)); }
.holding:hover .hold-pin { fill: rgba(207, 224, 184, .38); }

.hold-label {
  fill: #dfe7cc; letter-spacing: .08em; text-anchor: middle;
  font-size: calc(7px * var(--k));
  paint-order: stroke; stroke: rgba(6, 12, 8, .9); stroke-width: calc(2.2px * var(--k));
}

/* footprints only make sense once you're deep in */
/* The compound is the other half of the switch — hundreds of nodes coming in
   at the exact moment the country goes out. visibility keeps them laid out. */
.hold-build { visibility: hidden; }
.detail-4 .hold-build { visibility: visible; }
.detail-4 .hold-pin, .detail-4 .hold-pin-dot { visibility: hidden; }

.holding.sel .hold-plot { stroke-width: .8; opacity: .72; }

/* ── smuggling corridor ─────────────────────────────────────── */

/* one lane per vehicle class, each its own colour */
.route-land { --lane: #d8925a; }
.route-sea  { --lane: #5aa8c8; }
.route-air  { --lane: #b48ed0; }

.route-line {
  fill: none;
  stroke: var(--lane);
  opacity: .28;
  stroke-width: calc(1.5px * var(--k));
  stroke-linecap: round;
}
.route-land .route-line { stroke-dasharray: calc(6px * var(--k)) calc(4px * var(--k)); }
.route-sea  .route-line { stroke-dasharray: calc(3px * var(--k)) calc(4px * var(--k)); }
.route-air  .route-line { stroke-dasharray: calc(11px * var(--k)) calc(6px * var(--k)); }
.route.active .route-line { opacity: .8; }

.route-end {
  fill: color-mix(in srgb, var(--lane) 25%, transparent);
  stroke: var(--lane);
  r: calc(3.6px * var(--k));
  stroke-width: calc(1.1px * var(--k));
  opacity: .8;
}
.route-end-label {
  fill: var(--lane); text-anchor: middle;
  font-size: calc(5.4px * var(--k)); letter-spacing: .18em;
  paint-order: stroke; stroke: rgba(6, 12, 8, .85); stroke-width: calc(2px * var(--k));
  opacity: 0; transition: opacity .25s ease;
}
.detail-on .route-end-label { opacity: .85; }

.ship-land { --lane: #d8925a; }
.ship-sea  { --lane: #5aa8c8; }
.ship-air  { --lane: #b48ed0; }
.ship-halo { fill: color-mix(in srgb, var(--lane) 28%, transparent); r: calc(7px * var(--k)); }
.ship-dot  { fill: var(--lane); stroke: #14100a; r: calc(2.6px * var(--k)); stroke-width: calc(.8px * var(--k)); }

/* ── soldiers on the ground ─────────────────────────────────── */

/* A man is about a metre across, so at compound zoom he'd be a fraction of a
   pixel. Show a constant-size marker from detail-4, and swap to the real
   figure once you're deep enough for it to mean something. */
.sol-layer { visibility: hidden; }
.detail-4 .sol-layer { visibility: visible; }

.sol-marker      { fill: #cfe0b8; stroke: #16200f; r: calc(2.6px * var(--k));
                   stroke-width: calc(.8px * var(--k)); }
.sol-marker-ring { fill: none; stroke: rgba(207, 224, 184, .5);
                   r: calc(5.2px * var(--k)); stroke-width: calc(.7px * var(--k)); }
.soldier .figure { visibility: hidden; }
.detail-5 .soldier .figure     { visibility: visible; }
.detail-5 .sol-marker,
.detail-5 .sol-marker-ring     { display: none; }

.sol-shadow { fill: rgba(0, 0, 0, .42); }
.sol-leg    { fill: #4c5238; }
.sol-torso  { fill: #6e7550; }
.sol-arm    { fill: #5d6544; }
.sol-head   { fill: #b0855c; }
.sol-cap    { fill: #3f4630; }
.sol-gun    { fill: #23241f; }
.sol-mag    { fill: #2f312a; }

/* ── cartel panel ───────────────────────────────────────────── */

.cpanel {
  position: absolute;
  top: 56px; right: 0; bottom: 0;
  z-index: 30;
  width: 340px;
  display: flex;
  flex-direction: column;
  background: rgba(8, 19, 25, .96);
  border-left: 1px solid rgba(233, 226, 212, .13);
  box-shadow: -8px 0 30px rgba(0, 0, 0, .4);
}

.cp-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid rgba(233, 226, 212, .09);
}
.cp-key {
  font-size: 8.5px; letter-spacing: .24em; text-transform: uppercase;
  color: rgba(207, 224, 184, .8);
}
.cp-name { margin-top: 5px; font-size: 19px; font-weight: 500; color: #efe7d6; }
.cp-x {
  width: 24px; height: 24px; flex: none;
  font: inherit; font-size: 18px; line-height: 1;
  color: rgba(141, 133, 119, .9);
  background: none; border: none; border-radius: 3px; cursor: pointer;
}
.cp-x:hover { color: #e4dccb; background: rgba(233, 226, 212, .09); }

.cp-tabs {
  display: flex;
  padding: 0 12px;
  border-bottom: 1px solid rgba(233, 226, 212, .09);
}
.cp-tab {
  flex: 1;
  padding: 11px 4px 10px;
  font: inherit; font-size: 9.5px; letter-spacing: .13em; text-transform: uppercase;
  color: rgba(141, 133, 119, .95);
  background: none; border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.cp-tab:hover { color: #d7cfbe; }
.cp-tab.is-on { color: #efe7d6; border-bottom-color: #cfe0b8; }

.cp-body { flex: 1; overflow-y: auto; padding: 16px 20px 22px; }
.cp-body::-webkit-scrollbar { width: 8px; }
.cp-body::-webkit-scrollbar-thumb { background: rgba(233, 226, 212, .14); border-radius: 4px; }

/* ledger */
.ledger { display: grid; gap: 1px; background: rgba(233, 226, 212, .08); border-radius: 3px; overflow: hidden; }
.ledger-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 11px 13px; background: #0c1c24;
}
.ledger-row dt {
  font-size: 8.5px; letter-spacing: .2em; text-transform: uppercase;
  color: rgba(141, 133, 119, .95);
}
.ledger-row dd { font-size: 14px; font-variant-numeric: tabular-nums; color: #ddd5c4; }
.ledger-row.net dd { font-size: 16px; }
.pos { color: #a7cf8c !important; }
.neg { color: #d98f7a !important; }

.cp-sub {
  margin: 20px 0 9px;
  font-size: 8.5px; letter-spacing: .22em; text-transform: uppercase;
  color: rgba(141, 133, 119, .95);
}
.cp-note {
  margin-top: 12px; font-size: 12px; line-height: 1.5; color: #857e6e;
}
.cp-empty {
  padding: 22px 16px; text-align: center;
  font-size: 12.5px; line-height: 1.55; color: #857e6e;
  border: 1px dashed rgba(233, 226, 212, .14); border-radius: 4px;
}

/* buyable / listed item */
.item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px;
  margin-bottom: 7px;
  background: rgba(233, 226, 212, .04);
  border: 1px solid rgba(233, 226, 212, .09);
  border-radius: 3px;
}
.item.clickable { cursor: pointer; transition: background .13s ease, border-color .13s ease; }
.item.clickable:hover { background: rgba(233, 226, 212, .08); border-color: rgba(233, 226, 212, .22); }

.item.stacked { display: block; }
.item-top { display: flex; align-items: center; gap: 12px; }

.loadrow {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px; padding-top: 9px;
  border-top: 1px solid rgba(233, 226, 212, .08);
}
.loadval {
  font-size: 10.5px; color: #b7af9d; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.loadslider {
  flex: 1; height: 3px; -webkit-appearance: none; appearance: none;
  background: rgba(233, 226, 212, .16); border-radius: 2px; outline: none; cursor: pointer;
}
.loadslider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 13px; height: 13px; border-radius: 50%;
  background: #cfe0b8; border: none; cursor: pointer;
}
.loadslider::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%;
  background: #cfe0b8; border: none; cursor: pointer;
}

.item-main { flex: 1; min-width: 0; }
.item-name { font-size: 13px; color: #e8e0cf; }
.item-meta {
  margin-top: 3px; font-size: 10.5px; color: #857e6e;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.item-cost {
  font-size: 12.5px; font-variant-numeric: tabular-nums; color: #c9c1af;
  white-space: nowrap;
}

.buy-btn {
  flex: none;
  padding: 7px 12px;
  font: inherit; font-size: 9.5px; letter-spacing: .13em; text-transform: uppercase;
  color: #0d1a12; background: #cfe0b8;
  border: 1px solid #cfe0b8; border-radius: 3px; cursor: pointer;
  transition: background .13s ease;
}
.buy-btn:hover:not(:disabled) { background: #dcecc6; }
.buy-btn:disabled { opacity: .32; cursor: not-allowed; }

.sell-btn {
  flex: none;
  padding: 7px 11px;
  font: inherit; font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase;
  color: #c2b6a4; background: transparent;
  border: 1px solid rgba(233, 226, 212, .2); border-radius: 3px; cursor: pointer;
  white-space: nowrap;
  transition: color .13s ease, border-color .13s ease;
}
.sell-btn:hover { color: #e8e0cf; border-color: rgba(233, 226, 212, .42); }

.count {
  margin-left: 7px;
  font-size: 10.5px;
  color: rgba(207, 224, 184, .95);
}

#stockVal.full { color: #d98f7a; }
#billVal.unpayable { color: #d98f7a; }
#billClock { color: rgba(207, 224, 184, .95); font-variant-numeric: tabular-nums; }

.run-bar {
  margin-top: 6px; height: 3px; border-radius: 2px;
  background: rgba(233, 226, 212, .14); overflow: hidden;
}
.run-bar i { display: block; height: 100%; background: #f2c579; }

.item-meta.pos { color: #a7cf8c; }
.item-meta.neg { color: #d98f7a; }
.cp-note.neg   { color: #d98f7a; }

.tag {
  display: inline-block;
  padding: 2px 6px; margin-right: 5px;
  font-size: 8.5px; letter-spacing: .14em; text-transform: uppercase;
  color: rgba(207, 224, 184, .9);
  background: rgba(207, 224, 184, .1);
  border-radius: 2px;
}

.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: 14px;
  padding: 0; font: inherit; font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: rgba(141, 133, 119, .95);
  background: none; border: none; cursor: pointer;
}
.back-link:hover { color: #e4dccb; }

.opt-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.opt {
  padding: 8px 11px;
  font: inherit; font-size: 11px;
  color: #c9c1af;
  background: rgba(233, 226, 212, .04);
  border: 1px solid rgba(233, 226, 212, .12);
  border-radius: 3px; cursor: pointer;
  transition: border-color .13s ease, color .13s ease;
}
.opt:hover:not(:disabled) { color: #e8e0cf; border-color: rgba(233, 226, 212, .3); }
.opt.is-on { color: #0d1a12; background: #cfe0b8; border-color: #cfe0b8; }
.opt:disabled { opacity: .34; cursor: not-allowed; }
.opt small { display: block; margin-top: 2px; font-size: 9px; opacity: .7; }

.movebar { border-color: rgba(207, 224, 184, .3); }

/* the convoy between two sites */
.convoy-line { fill: none; stroke: #cfe0b8; opacity: .4;
               stroke-width: calc(1.4px * var(--k));
               stroke-dasharray: calc(6px * var(--k)) calc(5px * var(--k)); }
.convoy-dot  { fill: #cfe0b8; stroke: #16200f; r: calc(2.4px * var(--k));
               stroke-width: calc(.7px * var(--k)); }
.convoy-halo { fill: rgba(207, 224, 184, .22); r: calc(6.5px * var(--k)); }

/* ── inspector ──────────────────────────────────────────────── */

.inspector {
  position: absolute;
  left: 20px; bottom: 20px;
  z-index: 20;
  width: 268px;
  padding: 18px 20px 16px;
  background: rgba(9, 21, 28, .92);
  border: 1px solid rgba(233, 226, 212, .13);
  border-radius: 4px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .4);
}
.inspector-x {
  position: absolute;
  top: 8px; right: 9px;
  width: 22px; height: 22px;
  font: inherit; font-size: 17px; line-height: 1;
  color: rgba(141, 133, 119, .9);
  background: none; border: none; border-radius: 3px;
  cursor: pointer;
}
.inspector-x:hover { color: #e4dccb; background: rgba(233, 226, 212, .09); }

.ins-type {
  font-size: 8.5px; letter-spacing: .24em; text-transform: uppercase;
  color: rgba(207, 224, 184, .85);
}
.ins-name {
  margin-top: 5px;
  font-size: 18px; font-weight: 500; color: #efe7d6;
}
.ins-rows { margin-top: 15px; display: grid; gap: 8px; }
.ins-rows > div {
  display: flex; justify-content: space-between; align-items: baseline; gap: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(233, 226, 212, .07);
}
.ins-rows > div:last-child { border-bottom: none; padding-bottom: 0; }
.ins-rows dt {
  font-size: 8.5px; letter-spacing: .2em; text-transform: uppercase;
  color: rgba(141, 133, 119, .95);
}
.ins-rows dd {
  font-size: 12.5px; color: #ddd5c4; text-align: right;
  font-variant-numeric: tabular-nums;
}

.relocate-btn {
  width: 100%; margin-top: 15px; padding: 9px;
  font: inherit; font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  color: #b9b2a3; background: transparent;
  border: 1px solid rgba(233, 226, 212, .22); border-radius: 3px; cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.relocate-btn:hover { color: #e4dccb; border-color: rgba(233, 226, 212, .45); }
.relocate-btn.armed {
  color: #ffd9c9; border-color: rgba(217, 143, 122, .7);
  background: rgba(217, 143, 122, .12);
}
.relocate-btn:disabled { opacity: .35; cursor: not-allowed; }

.relocate-note {
  margin-top: 9px; font-size: 11px; line-height: 1.5; color: #a08a7e;
}

/* ── hud ────────────────────────────────────────────────────── */

.hud { position: absolute; pointer-events: none; user-select: none; }
.hud-tl { top: 20px; left: 24px; }
.hud-bl { bottom: 20px; left: 24px; }
.hud-br { bottom: 20px; right: 24px; text-align: right; }

.hud-tl, .hud-bl, .hud-br {
  background: rgba(8, 20, 26, .62);
  padding: 11px 14px;
  border-radius: 3px;
  box-shadow: 0 1px 10px rgba(0, 0, 0, .3);
}

.title { font-size: 16px; letter-spacing: .3em; text-transform: uppercase; color: #efe6d2; }
.sub   { margin-top: 4px; font-size: 9.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-dim); }

.legend-row {
  display: flex; align-items: center; gap: 8px; margin-top: 5px;
  font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-dim);
}
.legend-row:first-child { margin-top: 0; }
.swatch { width: 12px; height: 8px; border-radius: 1.5px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }

.scalewrap { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-bottom: 8px; }
.scaletxt  { font-size: 9.5px; letter-spacing: .1em; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.scalebar  { height: 5px; width: 110px; border: 1px solid rgba(233, 226, 212, .42); border-top: none; transition: width .12s linear; }

.zoomrow  { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.zoomval  { font-size: 10px; letter-spacing: .08em; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.zoombar  { width: 100px; height: 3px; background: rgba(233, 226, 212, .14); border-radius: 2px; overflow: hidden; }
.zoombar i { display: block; height: 100%; width: 0%; background: #9fc4d4; border-radius: 2px; }

.tip { margin-top: 7px; font-size: 8.5px; letter-spacing: .11em; text-transform: uppercase; color: rgba(141, 133, 119, .7); }
