/* 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(--cyan); color: #04222b; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.nav-badge.is-alert { background: var(--red); color: #1a0710; animation: mil-pulse 1.4s ease-in-out infinite; }
@keyframes mil-pulse { 50% { box-shadow: 0 0 0 5px rgba(255, 107, 135, .0), 0 0 0 0 rgba(255, 107, 135, .5); transform: scale(1.12); } }
.more-list { display: grid; gap: 8px; padding-bottom: 6px; }
.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; }

/* ---------------------------------------------------------------- social (alliance, messages, rankings): .soc- */
.soc-page { gap: 10px; }
.soc-body, .soc-content, .soc-listbox { display: grid; gap: 10px; align-content: start; min-width: 0; }
.soc-card .card-head { margin-bottom: 8px; }
.soc-card > .detail-desc { margin-bottom: 10px; }
.soc-card .field { margin-top: 10px; }
.soc-head-actions { display: flex; align-items: center; gap: 4px; }
.soc-stack { grid-auto-flow: row; grid-auto-columns: auto; }
.soc-title { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; min-width: 0; }
.soc-name { font-size: 20px; font-weight: 700; overflow-wrap: anywhere; }
.soc-head .bar { --c: var(--cyan); height: 6px; margin-top: 4px; }
.soc-tag { font-family: var(--mono); color: var(--cyan); flex: none; }
.soc-role-leader { color: #2b2204; background: var(--amber); border-color: var(--amber); font-weight: 650; }
.soc-role-diplomat { color: var(--violet); border-color: color-mix(in srgb, var(--violet) 60%, var(--line2)); }
.soc-role-officer { color: var(--cyan); border-color: color-mix(in srgb, var(--cyan) 55%, var(--line2)); }
.soc-state-war { color: var(--red); border-color: #7a2a3f; background: #2d1019; }
.soc-state-nap { color: var(--cyan); border-color: color-mix(in srgb, var(--cyan) 55%, var(--line2)); }
.soc-state-confed { color: var(--green); border-color: #1a6a4f; background: #0e2b23; }
.soc-state-same { color: var(--amber); }

.soc-tabs { margin-bottom: 0; }
.soc-tabs .seg-btn { min-width: 0; padding: 0 4px; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.soc-tabs4 .seg-btn { font-size: 13px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.soc-tabn { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #1a0710; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.soc-subtabs { display: flex; gap: 8px; flex-wrap: wrap; }
.soc-subtabs .chip-btn { flex: 1; }
.soc-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.soc-list { display: grid; gap: 8px; min-width: 0; }
.soc-item { display: flex; align-items: center; gap: 8px; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; min-height: 56px; flex-wrap: wrap; min-width: 0; }
.soc-item > .row-main { min-width: 0; flex: 1 1 140px; }
.soc-item .row-sub { white-space: normal; overflow-wrap: anywhere; }
.soc-item .form-error { flex-basis: 100%; margin: 4px 0 0; }
.soc-actions { display: flex; gap: 8px; flex: none; }
.soc-invite .soc-actions { margin-left: auto; }
.soc-member .row-title b { overflow-wrap: anywhere; }
.soc-member .row-sub { white-space: normal; }
.soc-wrap { white-space: normal !important; }
.soc-req { margin: 2px 0 8px; }
.soc-hint { padding: 0 2px; }
.soc-inline { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.soc-err { display: grid; gap: 8px; justify-items: start; }

.soc-text { width: 100%; min-height: 76px; max-height: 40vh; padding: 10px 12px; border-radius: 12px; background: #080e1c; border: 1px solid var(--line2); color: var(--text); font-size: 16px; line-height: 1.35; resize: vertical; font-family: var(--font); }
.soc-text:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; border-color: var(--cyan); }
.soc-composer { display: grid; gap: 8px; }
.soc-composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.soc-addnote { display: grid; gap: 8px; margin-top: 10px; }
.soc-count { font-size: 12px; color: var(--dimmer); }
.soc-count.over { color: var(--red); font-weight: 700; }
.soc-rate { color: var(--amber); background: #2b2204; border: 1px solid #6b5a1f; border-radius: 10px; padding: 8px 12px; font-size: 14px; }
.soc-text-out, .soc-msg-body { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; font-size: 15px; line-height: 1.4; }
.soc-note .soc-text-out { margin-bottom: 2px; }

.soc-msgrow { display: flex; align-items: center; gap: 2px; }
.soc-msgrow .soc-msg { flex: 1; min-width: 0; align-items: flex-start; }
.soc-msg.unread { border-color: var(--cyan); background: #0c1f33; }
.soc-msg .when { margin-top: 2px; }
.soc-preview { color: var(--dim); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; white-space: normal; }
.soc-feed { align-items: flex-start; }
.soc-feed.unread { border-color: var(--cyan); background: #0c1f33; }
.soc-feed .row-title { align-items: center; }
.soc-feed .when { margin-left: auto; }

.soc-thread-head { display: flex; align-items: center; gap: 6px; }
.soc-thread-name { flex: 1; min-width: 0; font-size: 18px; overflow-wrap: anywhere; }
.soc-thread { display: grid; gap: 8px; }
.soc-bubble { max-width: 86%; padding: 8px 12px 6px; border-radius: 14px; background: var(--panel2); border: 1px solid var(--line); justify-self: start; min-width: 0; }
.soc-bubble.out { justify-self: end; background: #11304a; border-color: #1f5b86; }
.soc-bubble.unread { border-color: var(--cyan); }
.soc-bubble-meta { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: 2px; color: var(--dimmer); }
.soc-del { width: 32px; height: 32px; display: inline-grid; place-items: center; background: none; border: 0; color: var(--dimmer); border-radius: 8px; }
.soc-del svg.ic { width: 14px; height: 14px; }
.soc-reply { position: sticky; bottom: 0; background: var(--bg); border-top: 1px solid var(--line); padding: 8px 0 calc(8px + 0px); margin-top: 4px; }

.soc-dip { display: grid; gap: 10px; }
.soc-rel .row-sub { white-space: normal; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.soc-eta { color: var(--amber); }
.soc-moves { display: grid; gap: 8px; }
.soc-move { min-height: 64px; }

.soc-yourank { display: flex; align-items: center; gap: 12px; border-color: var(--cyan); background: #0c1f33; padding: 10px 12px; }
.soc-yr-n { font-size: 24px; font-weight: 700; color: var(--cyan); min-width: 2.4ch; }
.soc-ranklist { display: grid; gap: 6px; list-style: none; padding: 0; margin: 0; }
.soc-rank { 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: 54px; text-align: left; }
.soc-rank.you { border-color: var(--cyan); background: #0c1f33; box-shadow: 0 0 0 1px rgba(77, 227, 255, .3); }
.soc-rk { color: var(--dimmer); min-width: 3.2ch; font-size: 14px; }
.soc-rank .row-sub { white-space: normal; overflow-wrap: anywhere; }
.soc-val { font-size: 16px; color: var(--text); flex: none; }
@media (max-width: 380px) { .soc-tabs .seg-btn { font-size: 13px; } .soc-bubble { max-width: 94%; } }

@media (prefers-reduced-motion: reduce) { .sheet, .backdrop, .toast, .bar i { transition: none; } }

/* ---------------------------------------------------------------- military + expansion (prefix mil-, send-, rep-) */
.row-sub.wrap { white-space: normal; overflow: visible; }
.head-actions { display: flex; align-items: center; gap: 6px; }
.mil-sections { display: grid; gap: 12px; }
.mil-list { display: grid; gap: 8px; }
.mil-row { display: flex; align-items: center; gap: 10px; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; min-height: 58px; }
.mil-row.current { border-color: var(--cyan); }
.mil-row.out.type-return { opacity: .8; }
.mil-row .row-main { min-width: 0; }
.mil-row .lv { color: var(--dim); font-size: 13px; }
.mil-when { display: grid; justify-items: end; gap: 1px; flex: none; text-align: right; }
.mil-when small { color: var(--dimmer); font-size: 11px; }
.mil-cd { font-size: 15px; }
.mil-cd.big { font-size: 19px; color: var(--red); }
.mil-bar { margin-top: 5px; --c: var(--cyan); }
.mil-group { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; display: grid; gap: 4px; }
.row-ic.bad { background: #3a1620; color: var(--red); }
.warn-card { border-color: #7a2a3f; background: rgba(48, 14, 24, .9); }
.warn-card .card-head h2 { color: #ffc4d0; }
.mil-banner { display: flex; align-items: center; gap: 10px; }
.mil-banner .row-main { flex: 1; min-width: 0; }
.mil-banner b { color: #ffd0da; }
.mil-banner .mil-cd { color: var(--red); }
.mil-banner:not([hidden]) .row-ic { animation: mil-pulse-ic 1.4s ease-in-out infinite; }
@keyframes mil-pulse-ic { 50% { box-shadow: 0 0 0 6px rgba(255, 107, 135, .18); } }
.mil-recall { margin-top: 8px; width: max-content; }
.mil-recall .mil-cd { font-size: 13px; }
.mil-row .arrow { display: inline-flex; vertical-align: middle; margin: 0 4px; color: var(--dimmer); }
.mil-row .arrow svg.ic { width: 14px; height: 14px; }
.mil-end { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.mil-coord { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; color: var(--cyan); padding: 2px 4px; min-height: 28px; font-size: 12px; text-decoration: underline; text-underline-offset: 2px; }
.mil-coord svg.ic { width: 13px; height: 13px; }
.pop-top { max-width: 1100px; margin: 0 auto; padding: 4px 12px 0; display: grid; gap: 8px; }
.row-btn.locked { opacity: .6; }
.card.inner { background: var(--panel2); }
.stepper { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto; gap: 6px; align-items: center; }
.stepper .btn { min-width: 46px; padding: 0 8px; }
input.mil-num { width: 100%; min-height: 46px; padding: 0 10px; border-radius: 12px; background: #080e1c; border: 1px solid var(--line2); color: var(--text); font-size: 16px; text-align: center; font-family: var(--mono); -moz-appearance: textfield; }
input.mil-num::-webkit-outer-spin-button, input.mil-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.send { gap: 14px; }
.send-sec { display: grid; gap: 8px; }
.send-sec:empty { display: none; }
.send-coords { display: grid; grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.send-target { background: var(--panel2); border-radius: 12px; padding: 10px 12px; display: grid; gap: 4px; }
.wrap-seg { grid-auto-flow: row; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.wrap-seg .seg-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 8px; font-size: 14px; }
.seg-btn:disabled { opacity: .4; cursor: not-allowed; }
.send-why { display: grid; gap: 2px; }
.mil-pick { background: var(--panel2); border-radius: 12px; padding: 8px 10px; display: grid; gap: 6px; }
.pick-ctl { display: grid; grid-template-columns: auto minmax(60px, 1fr) auto 64px auto; gap: 6px; align-items: center; }
.pick-ctl .btn.small { min-width: 40px; padding: 0 8px; }
.pick-ctl input.mil-num { min-height: 40px; padding: 0 4px; }
.pick-ctl input[type="range"] { width: 100%; min-height: 40px; accent-color: var(--cyan); }
.send-preview { background: var(--panel2); border-radius: 12px; padding: 4px 12px; }
.send-warn { display: grid; gap: 8px; }
.warn-check { display: flex; gap: 10px; align-items: flex-start; background: #2a210a; border: 1px solid #6b5a1f; border-radius: 12px; padding: 10px 12px; color: var(--amber); font-size: 14px; }
.warn-check input { width: 22px; height: 22px; flex: none; margin-top: 2px; accent-color: var(--amber); }
select { width: 100%; }

.alert.rep.tone-good .row-ic { color: var(--green); }
.alert.rep.tone-bad .row-ic { color: var(--red); }
.alert.rep.tone-warn .row-ic { color: var(--amber); }
.rep-detail { gap: 12px; }
.rep-verdict { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 12px; font-size: 18px; }
.rep-verdict.victory { background: #0e2b23; color: var(--green); border: 1px solid #1a6a4f; }
.rep-verdict.defeat { background: #2d1019; color: #ffc4d0; border: 1px solid #7a2a3f; }
.rep-sec { display: grid; gap: 6px; }
.rep-party { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px; }
.mil-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.mil-table th { text-align: right; font-weight: 500; color: var(--dimmer); font-size: 12px; padding: 2px 6px; }
.mil-table td { padding: 5px 6px; border-top: 1px solid var(--line); }
.mil-table td:not(:first-child) { text-align: right; }
.rep-group { display: grid; gap: 4px; margin-bottom: 8px; }
.rep-buildings { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 12px; font-size: 14px; }
.rep-buildings li { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); padding: 3px 0; }
.rep-raw { white-space: pre-wrap; font-size: 12px; color: var(--dim); }

.hud-town { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; color: var(--cyan); }
.hud-town select { min-height: 36px; font-size: 14px; padding: 0 10px; width: auto; max-width: 100%; flex: 0 1 280px; }
.hud-town svg.ic { width: 18px; height: 18px; }
.lg.mv-out { height: 0; width: 14px; border-top: 2px dashed var(--cyan); }
.lg.mv-in { height: 0; width: 14px; border-top: 2px dashed var(--red); }
@media (orientation: landscape) and (max-height: 520px) { .hud-town select { min-height: 30px; } }
@media (prefers-reduced-motion: reduce) { .nav-badge.is-alert, .mil-banner .row-ic { animation: none; } }
.units-head { max-width: 1100px; margin: 0 auto; padding: 4px 12px 0; }
.send-foot { position: sticky; bottom: -1px; z-index: 2; display: grid; gap: 8px; padding: 10px 0 2px; margin-top: 4px; background: linear-gradient(180deg, rgba(12, 19, 34, 0), var(--panel) 22%); }
.send-foot .form-error { margin-bottom: 0; }
.row-btn.mil-train { flex-wrap: wrap; row-gap: 6px; }
.mil-train .costs { flex-basis: 100%; gap: 6px; padding-left: 48px; }
.mil-train .cost { padding: 3px 8px; }
.mil-train .cost svg.ic { width: 15px; height: 15px; }
.mil-train .pill { max-width: none; }

/* ---------------------------------------------------------------- Internet exchange (trd-), end game (wld-), ended world */
.trd-page, .wld-page { gap: 10px; }
.trd-tabs .seg-btn { min-width: 0; padding: 0 4px; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trd-body { display: grid; gap: 12px; align-content: start; min-width: 0; }
.trd-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 10px; }
.trd-filters .field:nth-child(3) { grid-column: 1 / -1; }
.trd-reach { margin: 0 0 10px; }
.trd-list { gap: 8px; }
.trd-offer { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 8px 10px; align-items: start; }
.trd-offer .row-main { gap: 6px; }
.trd-offer .row-sub { white-space: normal; overflow-wrap: anywhere; }
.trd-offer > .btn { grid-column: 1 / -1; min-height: 44px; }
.trd-terms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; }
.trd-term { display: grid; gap: 3px; min-width: 0; align-content: start; }
.trd-lbl { font-size: 11px; color: var(--dimmer); text-transform: uppercase; letter-spacing: .08em; }
.trd-terms .cost { width: max-content; max-width: 100%; }
.trd-chips { margin-bottom: 2px; }
.trd-need { display: grid; gap: 10px; }
.trd-need .card-head { margin-bottom: 0; }
.trd-pops { display: grid; gap: 8px; }
.trd-pop { display: flex; align-items: flex-start; gap: 10px; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-height: 56px; }
.trd-pop:has(input:checked) { border-color: var(--cyan); background: #0c1f33; }
.trd-pop.off { opacity: .65; }
.trd-pop input { width: 22px; height: 22px; flex: none; margin-top: 2px; accent-color: var(--cyan); }
.trd-form .field { margin-bottom: 8px; }
.trd-form .sub { margin-top: 10px; }
.trd-form .field-hint, .trd-form > .dimmer { display: block; margin-top: 2px; }
.trd-page .card .detail-desc { margin-bottom: 8px; }
.trd-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.trd-pair select, .trd-pair input.mil-num { min-height: 46px; }
.trd-pair .btn.small { min-height: 46px; }
.trd-msgs { display: grid; gap: 4px; margin-top: 8px; }
.trd-msgs:empty { display: none; }
.trd-note { display: grid; gap: 4px; margin-top: 4px; }
.trd-links .mil-row { align-items: flex-start; }
.trd-links .bar { margin-top: 6px; --c: var(--cyan); }
.trd-empty { display: grid; gap: 8px; }

.wld-banner { display: flex; gap: 14px; align-items: center; border-color: var(--line2); }
.wld-banner .row-main { gap: 6px; }
.wld-banner h2 { font-size: 18px; line-height: 1.25; text-transform: none; letter-spacing: 0; color: var(--text); overflow-wrap: anywhere; }
.wld-trophy { width: 52px; height: 52px; flex: none; display: grid; place-items: center; border-radius: 16px; background: var(--panel3); color: var(--cyan); }
.wld-trophy svg.ic { width: 30px; height: 30px; }
.wld-banner.open { border-color: color-mix(in srgb, var(--cyan) 55%, var(--line2)); }
.wld-banner.won, .wld-banner.ended { border-color: #6b5a1f; background: rgba(43, 34, 8, .55); }
.wld-banner.won .wld-trophy, .wld-banner.ended .wld-trophy { color: var(--amber); background: #3a2d08; }
.wld-count { font-size: 26px; color: var(--cyan); line-height: 1.1; }
.wld-cd { font-variant-numeric: tabular-nums; }
.wld-bar { height: 8px; margin-top: 4px; --c: var(--dim); }
.wld-bar.mine { --c: var(--cyan); } .wld-bar.rival { --c: var(--amber); } .wld-bar.incumbent { --c: var(--violet); } .wld-bar.build { --c: var(--amber); height: 6px; }
.wld-sub { margin-top: 4px; }
.wld-sites { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .wld-sites { grid-template-columns: repeat(2, minmax(0, 1fr)); } .wld-page { max-width: 980px; } }
.wld-site { display: grid; gap: 8px; align-content: start; }
.wld-site.mine { border-color: color-mix(in srgb, var(--cyan) 65%, var(--line)); background: rgba(10, 30, 50, .85); }
.wld-site.rival { border-color: #6b5a1f; }
.wld-site.flash { animation: wld-flash 1.6s ease-out 1; }
@keyframes wld-flash { 0% { box-shadow: 0 0 0 3px var(--amber); } 100% { box-shadow: 0 0 0 0 transparent; } }
.wld-site-head { display: flex; align-items: center; gap: 10px; }
.wld-site-head .row-main { min-width: 0; }
.wld-site .row-sub { white-space: normal; }
.wld-holder { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wld-level { display: grid; gap: 2px; }
.wld-building { display: grid; gap: 2px; }
.wld-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.wld-how { padding-left: 20px; display: grid; gap: 6px; color: var(--dim); font-size: 14px; }
.wld-sec { display: grid; gap: 8px; margin-top: 6px; }
.wld-manage .costs { margin: 2px 0; }
.wld-results { display: grid; gap: 8px; }
.wld-results .card-head { margin-bottom: 0; }
.wld-ranks { display: grid; gap: 6px; }
.wld-rank { display: flex; align-items: center; gap: 10px; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; min-height: 52px; }
.wld-rank .row-main { min-width: 0; }
.wld-rank .row-sub { white-space: normal; overflow-wrap: anywhere; }
.wld-rank.you { border-color: var(--cyan); background: #0c1f33; }
.wld-rank.win { border-color: #6b5a1f; background: rgba(43, 34, 8, .55); }
.wld-rank.win svg.ic { color: var(--amber); }
.wld-ended-card { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; border-color: #6b5a1f; background: rgba(43, 34, 8, .6); }
.wld-ended-card .row-main { flex: 1 1 200px; min-width: 0; }
.wld-ended-card > .btn { flex: none; }
.wld-ended-card .row-ic { color: var(--amber); }
.lg.backbone { background: #2b2208; border: 2px solid #f5c542; transform: rotate(45deg) scale(.85); }

.ended-pill { margin-left: auto; background: #2b2208; color: var(--amber); border: 1px solid #6b5a1f; cursor: pointer; min-height: 30px; }
html[data-ended] #app { box-shadow: inset 0 3px 0 #6b5a1f; }
button[data-ended-lock] { cursor: not-allowed; }

.rep-tabs { margin-bottom: 0; }
.rep-tabs .seg-btn { min-height: 42px; font-size: 14px; }
.rep-verdict.neutral { background: var(--panel2); color: var(--dim); border: 1px solid var(--line2); }
.rep-share { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
