:root {
  color-scheme: dark;
  --bg: #080c11;
  --panel: #101720;
  --panel-2: #151f2a;
  --line: #2b3948;
  --text: #e8edf3;
  --muted: #8e9baa;
  --gold: #d6aa4b;
  --gold-soft: #7f642f;
  --free: #26313d;
}

* { box-sizing: border-box; }
html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
}
button, input { font: inherit; }
button, .button-link {
  border: 1px solid #3a4857;
  background: #18222d;
  color: var(--text);
  border-radius: 5px;
  padding: 8px 11px;
  cursor: pointer;
  text-decoration: none;
}
button:hover, .button-link:hover { border-color: var(--gold-soft); background: #202d3a; }
.hidden { display: none !important; }

#app { height: 100%; display: grid; grid-template-rows: 58px 1fr; }
.topbar {
  display: grid;
  grid-template-columns: 220px minmax(240px, 560px) auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 8px 14px;
  background: #0d131a;
  border-bottom: 1px solid #293542;
  z-index: 1000;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--gold);
  color: var(--gold);
  font-weight: 700;
  clip-path: polygon(25% 0, 75% 0, 100% 25%, 100% 75%, 75% 100%, 25% 100%, 0 75%, 0 25%);
}
.brand strong { display: block; font-size: 15px; letter-spacing: .03em; }
.brand small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.search-wrap { position: relative; }
.search-wrap input {
  width: 100%;
  height: 40px;
  border: 1px solid #354453;
  border-radius: 5px;
  background: #0b1219;
  color: var(--text);
  padding: 0 13px;
  outline: none;
}
.search-wrap input:focus { border-color: var(--gold-soft); }
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: min(520px, 70vh);
  overflow: auto;
  background: #101820;
  border: 1px solid #334251;
  z-index: 1200;
  box-shadow: 0 12px 30px rgba(0,0,0,.42);
}
.search-result {
  width: 100%;
  display: block;
  text-align: left;
  border: 0;
  border-bottom: 1px solid #25313d;
  border-radius: 0;
  background: transparent;
  padding: 9px 11px;
}
.search-result small { display: block; color: var(--muted); margin-top: 3px; }
.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.status { font-size: 12px; padding: 6px 9px; border: 1px solid; border-radius: 4px; }
.status-wait { color: #c0a668; border-color: #665632; }
.status-ok { color: #78c89d; border-color: #315d46; }
.status-error { color: #db7b7b; border-color: #683939; }

.workspace { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 370px; }
.map-shell { position: relative; min-width: 0; overflow: hidden; background: #0b1117; }
#terrain-map { position: absolute; inset: 0; z-index: 1; background: #0b1117; }
#map-canvas { position: absolute; inset: 0; z-index: 410; pointer-events: none; }
.leaflet-container { background: #0b1117; font-family: inherit; }
.leaflet-tile-pane { filter: saturate(.84) brightness(.76) contrast(1.08); }
.leaflet-marker-pane { z-index: 620; }
.leaflet-tooltip-pane { z-index: 650; }
.leaflet-tooltip.geo-object-tooltip {
  background: rgba(10,15,21,.95);
  color: var(--text);
  border: 1px solid #455565;
  border-radius: 4px;
  box-shadow: 0 7px 20px rgba(0,0,0,.45);
  padding: 7px 9px;
}
.leaflet-tooltip.geo-object-tooltip::before { display: none; }
.object-icon { filter: drop-shadow(0 2px 2px rgba(0,0,0,.85)); }
.object-icon.disabled { opacity: .58; filter: grayscale(.55) drop-shadow(0 2px 2px rgba(0,0,0,.85)); }

.hover-card {
  position: absolute;
  z-index: 800;
  min-width: 160px;
  max-width: 260px;
  pointer-events: none;
  background: rgba(11,16,22,.95);
  border: 1px solid #40505f;
  border-left: 3px solid var(--gold);
  padding: 8px 10px;
  box-shadow: 0 8px 20px rgba(0,0,0,.42);
}
.hover-card strong { display: block; font-size: 13px; }
.hover-card small { display: block; color: var(--muted); margin-top: 3px; }
.map-controls { position: absolute; z-index: 800; top: 13px; left: 13px; display: grid; gap: 5px; }
.map-controls button { width: 38px; height: 38px; padding: 0; font-size: 21px; background: rgba(17,25,34,.94); }
.legend {
  position: absolute;
  z-index: 800;
  left: 13px;
  bottom: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 7px 10px;
  background: rgba(12,18,25,.9);
  border: 1px solid #344250;
  color: #b4bec8;
  font-size: 11px;
}
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 13px; height: 9px; display: inline-block; border: 1px solid #73808c; }
.legend img { width: 18px; height: 18px; object-fit: contain; }
.legend-owned { background: #526f9e; }
.legend-free { background: #26313d; }
.legend-control { background: repeating-linear-gradient(135deg,#82343d 0 3px,#31518a 3px 6px); }
.map-metrics {
  position: absolute;
  z-index: 800;
  right: 12px;
  bottom: 12px;
  padding: 6px 9px;
  color: #aeb9c4;
  background: rgba(11,17,23,.88);
  border: 1px solid #344250;
  font-size: 11px;
}

.sidebar { min-width: 0; overflow: auto; background: var(--panel); border-left: 1px solid #2b3744; }
.tabs { display: grid; grid-template-columns: repeat(6, 1fr); border-bottom: 1px solid #2b3744; }
.tab { border: 0; border-radius: 0; border-right: 1px solid #2b3744; padding: 11px 4px; background: #101720; color: #97a3af; }
.tab:last-child { border-right: 0; }
.tab.active { color: var(--gold); background: #17212b; box-shadow: inset 0 -2px 0 var(--gold); }
.tab-panel { display: none; padding: 15px; }
.tab-panel.active { display: block; }
.section-title { color: #c8d0d8; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 12px; }
.metrics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.metric { padding: 10px; border: 1px solid #2f3d4b; background: #131c25; }
.metric span { display: block; color: var(--muted); font-size: 11px; }
.metric strong { display: block; margin-top: 5px; font-size: 19px; color: #e3e8ed; }
.selection-card { border: 1px solid #32404d; background: #121a23; min-height: 130px; padding: 12px; }
.empty-state { color: var(--muted); font-size: 12px; line-height: 1.5; }
.card-title { display: flex; align-items: center; gap: 7px; font-size: 16px; font-weight: 600; }
.card-subtitle { margin: 4px 0 12px; color: var(--muted); font-size: 11px; }
.card-row { display: grid; grid-template-columns: 112px 1fr; gap: 8px; padding: 7px 0; border-top: 1px solid #26323e; font-size: 12px; }
.card-row > span { color: var(--muted); }
.card-row small { color: #d99575; }
.card-color { width: 10px; height: 10px; display: inline-block; margin-right: 5px; border: 1px solid rgba(255,255,255,.35); }
.card-object-icon { width: 34px; height: 34px; object-fit: contain; margin-right: 3px; filter: drop-shadow(0 2px 2px rgba(0,0,0,.7)); }
.country-list { display: grid; gap: 6px; }
.country-item {
  width: 100%;
  display: grid;
  grid-template-columns: 11px 1fr auto;
  align-items: center;
  gap: 9px;
  text-align: left;
  padding: 9px;
}
.country-item .swatch { width: 11px; height: 32px; border: 1px solid rgba(255,255,255,.25); }
.country-item strong { display: block; font-size: 13px; }
.country-item small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.country-item .count { color: var(--gold); font-size: 12px; }
.switch-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #26323e; font-size: 12px; }
.switch-row input { accent-color: var(--gold); }
.opacity-row { margin-top: 14px; }
.opacity-row label { display: block; color: var(--muted); font-size: 11px; margin-bottom: 8px; }
.opacity-row input { width: 100%; accent-color: var(--gold); }
.layer-note { margin-top: 15px; padding: 10px; border-left: 2px solid var(--gold-soft); background: #141e28; color: var(--muted); font-size: 11px; line-height: 1.55; }

@media (max-width: 920px) {
  .topbar { grid-template-columns: 180px 1fr auto auto; }
  .top-actions .status, .top-actions .button-link { display: none; }
  .workspace { grid-template-columns: 1fr 330px; }
}
@media (max-width: 720px) {
  #app { grid-template-rows: auto 1fr; }
  .topbar { grid-template-columns: 1fr auto; gap: 8px; }
  .brand { display: none; }
  .workspace { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) 260px; }
  .sidebar { border-left: 0; border-top: 1px solid #2b3744; }
  .legend { max-width: calc(100% - 26px); }
}


/* === MAP REBUILD M3: war map === */
:root {
  --war-red: #ff4054;
  --war-blue: #4aa3ff;
  --war-gold: #f2c85b;
  --war-cyan: #35d3e6;
  --war-violet: #b77aff;
  --war-dark: #0b0d12;
}

.map-mode-switch {
  display: grid;
  grid-template-columns: repeat(5, auto);
  border: 1px solid #344250;
  border-radius: 6px;
  overflow: hidden;
  background: #0a1118;
}
.mode-button {
  border: 0;
  border-right: 1px solid #344250;
  border-radius: 0;
  padding: 8px 10px;
  color: #8f9ba7;
  background: transparent;
  font-size: 12px;
}
.mode-button:last-child { border-right: 0; }
.mode-button.active {
  color: #f1d37d;
  background: linear-gradient(180deg, #27313b, #18212b);
  box-shadow: inset 0 -2px 0 var(--gold);
}
body.mode-war .leaflet-tile-pane { filter: saturate(.62) brightness(.50) contrast(1.22); }
body.mode-terrain .leaflet-tile-pane { filter: none; }
body.mode-war .map-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 405;
  pointer-events: none;
  background:
    linear-gradient(rgba(215,181,91,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(215,181,91,.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mix-blend-mode: screen;
}

body.nuclear-winter-active .leaflet-tile-pane {
  filter: saturate(.35) brightness(.55) contrast(1.16) grayscale(.28);
}
body.nuclear-winter-recovery .leaflet-tile-pane {
  filter: saturate(.62) brightness(.76) contrast(1.08) grayscale(.12);
}
body.nuclear-winter-active .map-shell::before,
body.nuclear-winter-recovery .map-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 404;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(72,82,92,.20), rgba(153,166,178,.08) 45%, rgba(16,22,29,.18));
}
body.nuclear-winter-recovery .map-shell::before {
  background: linear-gradient(180deg, rgba(97,110,121,.10), rgba(151,163,174,.04) 52%, rgba(16,22,29,.08));
}

.nuclear-winter-banner {
  position: absolute;
  z-index: 825;
  top: 13px;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 430px;
  max-width: min(760px, calc(100% - 170px));
  padding: 9px 14px;
  border: 1px solid #737c85;
  border-left: 3px solid #d7ba69;
  background: linear-gradient(180deg, rgba(20,26,33,.97), rgba(8,12,17,.95));
  box-shadow: 0 10px 28px rgba(0,0,0,.38);
}
.nuclear-winter-symbol {
  color: #e5c76d;
  font-size: 26px;
  line-height: 1;
}
.nuclear-winter-copy { display: grid; min-width: 0; gap: 1px; }
.nuclear-winter-copy > span {
  color: #e5c76d;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
}
.nuclear-winter-copy strong {
  color: #f0f3f5;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nuclear-winter-copy small { color: #aeb7bf; font-size: 11px; }
.nuclear-winter-timer {
  min-width: 80px;
  color: #d8e0e5;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
body.nuclear-winter-recovery .nuclear-winter-banner {
  border-left-color: #7fa9b9;
}
body.nuclear-winter-recovery .nuclear-winter-symbol,
body.nuclear-winter-recovery .nuclear-winter-copy > span { color: #91b8c6; }

body.nuclear-winter-active .war-hud,
body.nuclear-winter-recovery .war-hud { top: 82px; }

.war-hud {
  position: absolute;
  z-index: 820;
  top: 13px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 300px;
  max-width: min(600px, calc(100% - 160px));
  padding: 9px 18px 10px;
  text-align: center;
  background: linear-gradient(180deg, rgba(19,25,33,.96), rgba(9,13,18,.93));
  border: 1px solid #59616a;
  border-top: 2px solid var(--war-gold);
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
  clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%, 0 10px);
}
.war-hud-kicker { display: block; color: #c9a84f; font-size: 9px; letter-spacing: .2em; }
.war-hud strong { display: block; margin-top: 2px; font-size: 14px; }
.war-hud small { display: block; margin-top: 3px; color: #9ba6b2; font-size: 10px; }

.event-toast {
  position: absolute;
  z-index: 900;
  top: 82px;
  left: 50%;
  transform: translateX(-50%);
  width: min(430px, calc(100% - 40px));
  padding: 10px 13px;
  background: rgba(12,18,24,.97);
  border: 1px solid #566474;
  border-left: 4px solid var(--war-gold);
  box-shadow: 0 12px 30px rgba(0,0,0,.45);
  animation: event-in .2s ease-out;
}
.event-toast strong { display: block; font-size: 12px; }
.event-toast small { display: block; margin-top: 3px; color: var(--muted); }
.event-toast.severity-critical { border-left-color: var(--war-red); }
.event-toast.severity-success { border-left-color: #54ce8c; }
.event-toast.severity-warning { border-left-color: var(--war-gold); }
@keyframes event-in { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

.legend-war { border-color: #5a4d31; background: rgba(9,13,18,.94); }
.legend-war i { width: 26px; height: 10px; border: 0; }
.legend-front { background: linear-gradient(180deg, transparent 35%, var(--war-red) 35% 65%, transparent 65%); }
.legend-defence { background: repeating-linear-gradient(90deg, var(--war-gold) 0 3px, transparent 3px 7px); border-bottom: 2px solid var(--war-gold) !important; }
.legend-offensive { background: linear-gradient(90deg, var(--war-red), transparent); clip-path: polygon(0 35%, 70% 35%, 70% 0, 100% 50%, 70% 100%, 70% 65%, 0 65%); }
.legend-counter { background: linear-gradient(90deg, var(--war-cyan), transparent); clip-path: polygon(0 35%, 70% 35%, 70% 0, 100% 50%, 70% 100%, 70% 65%, 0 65%); }
.legend-player { border-radius: 50% !important; background: #dfe8ef; box-shadow: 0 0 0 2px #4aa3ff; }
.legend-unit { background: transparent; border: 2px solid var(--war-red) !important; position: relative; }
.legend-unit::after { content: "×"; position: absolute; inset: -4px 0 0; color: var(--war-red); font-weight: 800; }
.legend-unstable { background: repeating-linear-gradient(135deg, rgba(242,200,91,.95) 0 3px, rgba(255,64,84,.35) 3px 6px); }

.section-title-spaced { margin-top: 21px; }
.metric-war { border-color: #473c2b; background: linear-gradient(180deg, #191b20, #151a20); }
.metric-war strong { color: #f0c866; }

.war-list, .event-list { display: grid; gap: 8px; }
.war-card {
  border: 1px solid #344351;
  background: #121a23;
  overflow: hidden;
}
.war-card.hot { border-color: #79404b; box-shadow: inset 3px 0 0 var(--war-red); }
.war-card-head {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  text-align: left;
  border: 0;
  border-radius: 0;
  background: linear-gradient(180deg, #17212b, #121a22);
  padding: 10px;
}
.war-card-head strong { display: block; font-size: 13px; }
.war-card-head small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.war-count { color: var(--gold); font-size: 11px; }
.war-card-body { padding: 8px 10px 10px; }
.side-line { display: flex; gap: 6px; align-items: center; font-size: 11px; color: #b7c0c9; margin-bottom: 5px; }
.side-dot { width: 8px; height: 8px; border: 1px solid rgba(255,255,255,.45); }
.operation-item, .sector-item {
  width: 100%;
  display: grid;
  grid-template-columns: 8px 1fr auto;
  align-items: center;
  gap: 8px;
  text-align: left;
  padding: 7px 0;
  border: 0;
  border-top: 1px solid #26323e;
  border-radius: 0;
  background: transparent;
}
.operation-item:hover, .sector-item:hover { background: rgba(255,255,255,.025); }
.operation-marker { width: 8px; height: 28px; background: var(--war-red); }
.operation-marker.counter { background: var(--war-cyan); }
.operation-marker.defence { background: var(--war-gold); }
.operation-item strong, .sector-item strong { display: block; font-size: 11px; }
.operation-item small, .sector-item small { display: block; color: var(--muted); margin-top: 2px; font-size: 9px; }
.progress-mini { width: 48px; height: 4px; background: #252f39; overflow: hidden; }
.progress-mini i { display: block; height: 100%; background: var(--war-red); }

.event-entry {
  position: relative;
  padding: 9px 9px 9px 14px;
  background: #121a22;
  border: 1px solid #2e3a46;
}
.event-entry::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: #697786; }
.event-entry.severity-critical::before { background: var(--war-red); }
.event-entry.severity-warning::before { background: var(--war-gold); }
.event-entry.severity-success::before { background: #54ce8c; }
.event-entry strong { display: block; font-size: 11px; }
.event-entry small { display: block; color: var(--muted); font-size: 9px; margin-top: 3px; }
.event-time { float: right; color: #6f7b87; font-size: 9px; }

/* Leaflet tactical point symbols */
.leaflet-tactical-pane { z-index: 640; }
.tactical-hq-wrap, .troop-symbol-wrap { background: transparent; border: 0; }
.tactical-hq {
  --progress: 0deg;
  --state-color: var(--war-gold);
  position: relative;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--state-color) var(--progress), rgba(12,16,21,.86) 0);
  filter: drop-shadow(0 4px 4px rgba(0,0,0,.75));
}
.tactical-hq::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: #0e151c;
  border: 1px solid rgba(255,255,255,.28);
}
.tactical-hq img { position: relative; z-index: 2; width: 34px; height: 34px; object-fit: contain; }
.tactical-hq .hq-counts {
  position: absolute;
  z-index: 3;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 2px 5px;
  font-size: 9px;
  background: #0a1016;
  border: 1px solid #4a5662;
  color: #d8dee5;
}
.tactical-hq.state-CAPTURING { --state-color: var(--war-red); animation: hq-pulse 1.15s ease-in-out infinite; }
.tactical-hq.state-CONTESTED { --state-color: var(--war-violet); animation: hq-pulse 1.65s ease-in-out infinite; }
.tactical-hq.state-DEFENDED { --state-color: var(--war-blue); }
.tactical-hq.state-CAPTURED { --state-color: #54ce8c; }
.tactical-hq.state-REPELLED { --state-color: var(--war-blue); }
@keyframes hq-pulse { 50% { filter: drop-shadow(0 0 11px var(--state-color)); } }

.troop-symbol {
  --unit-color: var(--war-blue);
  position: relative;
  min-width: 48px;
  height: 34px;
  display: grid;
  place-items: center;
  background: rgba(8,12,17,.88);
  border: 3px solid var(--unit-color);
  box-shadow: 0 4px 9px rgba(0,0,0,.7), inset 0 0 0 1px rgba(255,255,255,.12);
}
.troop-symbol.hostile { transform: rotate(45deg); width: 38px; min-width: 38px; height: 38px; }
.troop-symbol::before, .troop-symbol::after {
  content: "";
  position: absolute;
  width: 76%;
  height: 2px;
  background: var(--unit-color);
}
.troop-symbol::before { transform: rotate(32deg); }
.troop-symbol::after { transform: rotate(-32deg); }
.troop-symbol .unit-count {
  position: absolute;
  z-index: 2;
  right: -8px;
  top: -10px;
  min-width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #0c1218;
  border: 2px solid var(--unit-color);
  color: #f4f6f8;
  font-size: 9px;
  font-weight: 700;
  transform: none;
}
.troop-symbol.hostile .unit-count { transform: rotate(-45deg); }
.unit-heading {
  position: absolute;
  left: 50%;
  top: -19px;
  width: 2px;
  height: 14px;
  background: var(--unit-color);
  transform-origin: 50% 36px;
}
.unit-heading::after {
  content: "";
  position: absolute;
  left: -3px;
  top: -2px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 6px solid var(--unit-color);
}

.atlas-player-wrap { background: transparent; border: 0; overflow: visible !important; }
.atlas-player {
  --player-color: #8f9aa5;
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, #f5f8fb 0 18%, #9ba8b4 19% 36%, #202a33 37% 100%);
  border: 3px solid var(--player-color);
  box-shadow: 0 3px 10px rgba(0,0,0,.75), 0 0 0 1px rgba(255,255,255,.3);
  color: #fff;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: -.04em;
}
.atlas-player.at-war { box-shadow: 0 3px 10px rgba(0,0,0,.75), 0 0 0 2px rgba(255,64,84,.42); }
.player-initials { position: relative; z-index: 2; text-shadow: 0 1px 2px #000; }
.player-direction {
  position: absolute;
  left: 50%;
  top: -13px;
  width: 2px;
  height: 12px;
  background: var(--player-color);
  transform-origin: 50% 28px;
}
.player-direction::before {
  content: "";
  position: absolute;
  left: -4px;
  top: -4px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 7px solid var(--player-color);
}
.player-map-name {
  position: absolute;
  left: 50%;
  top: calc(100% + 5px);
  transform: translateX(-50%);
  padding: 2px 5px;
  white-space: nowrap;
  background: rgba(7,11,15,.88);
  border: 1px solid #46535f;
  color: #eef3f7;
  font-size: 9px;
  font-weight: 650;
  text-shadow: 0 1px 2px #000;
}
.unit-echelon {
  position: absolute;
  left: 50%;
  top: -13px;
  transform: translateX(-50%);
  color: var(--unit-color);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 1px;
  white-space: nowrap;
}
.troop-symbol.hostile .unit-echelon { transform: translateX(-50%) rotate(-45deg); top: -17px; }
.unit-map-name {
  position: absolute;
  left: 50%;
  top: calc(100% + 7px);
  transform: translateX(-50%);
  min-width: 120px;
  white-space: nowrap;
  text-align: center;
  color: #f0f3f5;
  font-size: 9px;
  font-weight: 700;
  text-shadow: 0 1px 3px #000, 0 0 5px #000;
}
.troop-symbol.hostile .unit-map-name { transform: translateX(-50%) rotate(-45deg); top: 45px; }

.leaflet-tooltip.geo-tactical-tooltip {
  background: rgba(8,12,17,.97);
  color: var(--text);
  border: 1px solid #5b6671;
  border-radius: 3px;
  box-shadow: 0 8px 22px rgba(0,0,0,.5);
  padding: 8px 10px;
}
.leaflet-tooltip.geo-tactical-tooltip::before { display: none; }

.card-progress { margin: 8px 0; height: 8px; background: #26313c; border: 1px solid #3a4651; overflow: hidden; }
.card-progress i { display: block; height: 100%; background: linear-gradient(90deg, #b92335, #ff5265); }
.card-badge { display: inline-block; padding: 3px 6px; margin: 0 4px 4px 0; border: 1px solid #465361; color: #c7d0d8; font-size: 9px; }
.card-badge.hot { border-color: #8a4250; color: #ff7887; }
.card-badge.gold { border-color: #776035; color: #e4c66e; }
.card-badge.cyan { border-color: #27717a; color: #64d8e5; }

@media (max-width: 1120px) {
  .map-mode-switch { display: none; }
  .topbar { grid-template-columns: 190px 1fr 1fr; }
}
@media (max-width: 920px) {
  .war-hud { min-width: 240px; }
  .tabs { grid-template-columns: repeat(5, minmax(52px,1fr)); }
  .tab { font-size: 10px; }
}


/* === MAP REBUILD M4: state atlas / flags / context menu === */
.legend-diplomacy { border-color: #455566; background: rgba(9,14,20,.94); }
.legend-diplomacy i { width: 18px; height: 10px; border: 1px solid rgba(255,255,255,.25); }
.legend-self { background: #4c78ad; }
.legend-ally { background: #3e9168; }
.legend-pact { background: #b98b3f; }
.legend-enemy { background: #a83f4d; }
.legend-neutral { background: #4b535c; }
body.mode-diplomacy .leaflet-tile-pane { filter: saturate(.66) brightness(.58) contrast(1.16); }

.map-context {
  position: absolute;
  z-index: 960;
  min-width: 228px;
  max-width: 290px;
  padding: 11px;
  color: var(--text);
  background: rgba(10,15,21,.98);
  border: 1px solid #5c6976;
  border-top: 2px solid var(--gold);
  box-shadow: 0 14px 34px rgba(0,0,0,.55);
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
}
.map-context-title { color: var(--gold); font-size: 10px; text-transform: uppercase; letter-spacing: .12em; }
.map-context strong { display: block; margin-top: 5px; font-size: 14px; }
.map-context small { display: block; margin-top: 4px; color: var(--muted); line-height: 1.35; }
.map-context-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 10px; }
.map-context-actions button { padding: 7px 6px; font-size: 10px; }
.map-context-actions button:last-child { grid-column: 1 / -1; }

.country-item { grid-template-columns: 48px 1fr auto; }
.country-item .country-list-flag {
  width: 46px;
  max-height: 31px;
  object-fit: contain;
  border: 1px solid rgba(255,255,255,.25);
  background: #111820;
  box-shadow: 0 2px 5px rgba(0,0,0,.5);
}
.country-item .country-list-fallback {
  width: 46px;
  height: 29px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
}

.country-card-header {
  position: relative;
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  align-items: center;
  margin: -12px -12px 0;
  padding: 14px 12px 13px;
  background: linear-gradient(135deg, rgba(35,47,59,.98), rgba(14,21,29,.98));
  border-bottom: 1px solid #3c4956;
  overflow: hidden;
}
.country-card-header::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 45%, rgba(255,255,255,.035));
  pointer-events: none;
}
.country-card-flag {
  width: 90px;
  max-height: 60px;
  object-fit: contain;
  background: #0c1218;
  border: 1px solid rgba(255,255,255,.3);
  box-shadow: 0 5px 14px rgba(0,0,0,.45);
}
.country-card-flag-fallback {
  width: 90px;
  height: 54px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  letter-spacing: .12em;
  border: 1px solid rgba(255,255,255,.3);
}
.country-card-header h2 { margin: 0; font-size: 18px; line-height: 1.15; }
.country-card-header p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.country-card-status { display: inline-block; margin-top: 6px; padding: 3px 6px; border: 1px solid #566370; color: #c6d0da; font-size: 9px; text-transform: uppercase; letter-spacing: .09em; }
.country-card-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 11px 0; }
.country-card-tab { padding: 7px 4px; font-size: 10px; }
.country-card-tab.active { color: var(--gold); border-color: #806c38; background: #202a34; }
.country-card-section { display: grid; gap: 0; }
.country-card-description { margin-top: 9px; padding: 10px; border-left: 2px solid var(--gold); background: #151f29; color: #c4ccd4; font-size: 11px; line-height: 1.55; }
.country-card-motto { margin: 9px 0 0; color: #d8be75; font-size: 12px; font-style: italic; text-align: center; }
.country-card-empty { padding: 12px; color: var(--muted); font-size: 11px; text-align: center; }
.country-card-object-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.country-card-object { padding: 8px; background: #151e27; border: 1px solid #2d3945; font-size: 10px; }
.country-card-object strong { display: block; font-size: 14px; color: #e3e8ed; }

.diplomacy-list { display: grid; gap: 7px; margin-top: 10px; }
.diplomacy-item { width: 100%; padding: 9px; text-align: left; border: 1px solid #34414e; background: #141d26; }
.diplomacy-item strong { display: block; font-size: 12px; }
.diplomacy-item small { display: block; margin-top: 3px; color: var(--muted); }
.diplomacy-item.alliance { border-left: 3px solid #4da06f; }
.diplomacy-item.non-aggression-pact { border-left: 3px solid #c09748; }
.diplomacy-item.military-agreement { border-left: 3px solid #58a5bd; }
.diplomacy-item.enemy { border-left: 3px solid #be4c5a; }

.clip-toast {
  position: absolute;
  z-index: 980;
  right: 13px;
  top: 13px;
  padding: 8px 10px;
  background: rgba(11,18,24,.96);
  border: 1px solid #4d6b5b;
  color: #8bd1a6;
  font-size: 11px;
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
}

@media (max-width: 1100px) {
  .map-mode-switch { grid-template-columns: repeat(2, auto); }
  .mode-button:nth-child(2) { border-right: 0; }
  .tabs { grid-template-columns: repeat(3, 1fr); }
}


.country-chip-flag {
  width: 22px;
  height: 14px;
  margin-right: 6px;
  vertical-align: -2px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,.28);
  box-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.inline-country-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: #d6c17e;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.inline-country-link:hover { color: #fff0b0; text-decoration: underline; }

.country-event-item { width: 100%; padding: 8px 9px; text-align: left; border: 1px solid #34414e; background: #141d26; }
.country-event-item span { display: block; color: #8f9aa5; font-size: 9px; }
.country-event-item strong { display: block; margin-top: 2px; font-size: 11px; }
.country-event-item small { display: block; margin-top: 3px; color: var(--muted); line-height: 1.35; }


/* REBUILD-3 R1: conflict resolution cards */
.resolution-section { margin-top: 12px; padding-top: 8px; border-top: 1px solid #303b46; }
.resolution-section h4 { margin: 0 0 7px; color: #d9c58e; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.resolution-goal { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 7px 8px; margin: 4px 0; border: 1px solid #394550; background: rgba(13,18,24,.65); font-size: 11px; }
.resolution-goal span small { display: block; margin-top: 2px; color: var(--muted); }
.resolution-goal b { color: #d9c58e; font-size: 9px; text-transform: uppercase; }
.resolution-goal.done { border-color: #38664e; }
.resolution-goal.done b { color: #70c991; }
.resolution-goal.failed { border-color: #6b343d; }
.resolution-goal.failed b { color: #e46f7d; }
.capitulation-block { padding: 7px 8px; margin: 5px 0; border-left: 3px solid #536273; background: rgba(16,22,29,.7); }
.capitulation-block > div:first-child { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; }
.capitulation-block > small { display: block; color: var(--muted); font-size: 9px; line-height: 1.45; }
.capitulation-block.eligible { border-left-color: #d49a45; }
.capitulation-block.capitulated { border-left-color: #d4525f; }
.capitulation-block.capitulated .card-progress i { background: linear-gradient(90deg,#8f2230,#e65a68); }
.resolution-state { margin: 9px 0; padding: 8px 10px; border: 1px solid #826a39; background: rgba(92,71,28,.16); }
.resolution-state.peace { border-color: #3f6b58; background: rgba(30,83,60,.15); }
.resolution-state strong, .resolution-state span, .resolution-state small { display: block; }
.resolution-state strong { color: #e5ce8d; font-size: 11px; }
.resolution-state.peace strong { color: #79c89d; }
.resolution-state span { margin-top: 3px; font-size: 11px; }
.resolution-state small { margin-top: 3px; color: var(--muted); font-size: 9px; }


/* IDEOLOGY-CORE-1: political profile */
.ideology-chip { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.ideology-chip i { width: 11px; height: 11px; flex: 0 0 11px; border: 1px solid rgba(255,255,255,.32); box-shadow: 0 0 0 1px rgba(0,0,0,.35); }
.ideology-description { margin: 8px 0 10px; padding: 8px 9px; border-left: 3px solid #70634a; background: rgba(32,29,24,.55); color: var(--muted); font-size: 10px; line-height: 1.45; }

.ideology-modifiers { margin: 8px 0 10px; padding: 8px 9px; border: 1px solid #3a4651; background: rgba(15,22,29,.62); }
.ideology-modifiers > div { margin-bottom: 6px; color: #c6b77f; font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
.ideology-modifiers section { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 5px; }
.ideology-modifier { padding: 5px 4px; text-align: center; border: 1px solid #38434d; background: #151d25; }
.ideology-modifier small, .ideology-modifier b { display: block; }
.ideology-modifier small { color: var(--muted); font-size: 8px; }
.ideology-modifier b { margin-top: 2px; font-size: 11px; }
.ideology-modifier.positive b { color: #72c793; }
.ideology-modifier.negative b { color: #df7580; }
.ideology-modifier.neutral b { color: #a5afb8; }

/* POLITICS-CORE-1 */
.politics-party-list { margin-top: 10px; display: grid; gap: 6px; }
.politics-party-list h4 { margin: 0 0 2px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.politics-party-row { border: 1px solid #303d49; border-left: 3px solid #808080; background: #141d26; padding: 7px 8px; display: grid; grid-template-columns: auto 1fr; gap: 2px 7px; }
.politics-party-row strong { font-size: 12px; }
.politics-party-row span { font-size: 12px; }
.politics-party-row small { grid-column: 1 / -1; color: var(--muted); }
.politics-party-row small b { color: #76b88a; font-weight: 600; }

/* REBUILD-3 R2A REVOLUTION-CORE-1 */
.revolution-point-wrap { background: transparent !important; border: 0 !important; }
.revolution-point {
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid #ff5968;
  background: rgba(68, 6, 13, .9);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(0,0,0,.55), 0 0 18px rgba(239,42,61,.65);
  font-size: 20px;
  font-weight: 800;
  text-shadow: 0 2px 3px rgba(0,0,0,.9);
  overflow: visible;
}
.revolution-point > span { position: relative; z-index: 2; line-height: 1; }
.revolution-point > i {
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: -7px;
  height: 3px;
  border: 1px solid rgba(0,0,0,.75);
  background: linear-gradient(90deg, #e73649 var(--rev-progress), #315579 var(--rev-progress));
}
.revolution-point.controller-government { border-color: #55a7ff; background: rgba(16,42,70,.92); box-shadow: 0 0 0 3px rgba(0,0,0,.55), 0 0 15px rgba(55,137,224,.55); }
.revolution-point.controller-revolutionaries { border-color: #ff4b5f; background: rgba(80,5,13,.94); }
.revolution-point.locked { filter: grayscale(.75); opacity: .7; }
.revolution-point.revolution-hq { border-radius: 8px; transform: rotate(45deg); }
.revolution-point.revolution-hq > span { transform: rotate(-45deg); }
.revolution-point.capital-pulse::before,
.revolution-point.capital-pulse::after {
  content: '';
  position: absolute;
  inset: -6px;
  border: 2px solid rgba(255,43,64,.8);
  border-radius: 50%;
  animation: revolution-capital-pulse 1.7s ease-out infinite;
}
.revolution-point.capital-pulse::after { animation-delay: .85s; }
@keyframes revolution-capital-pulse {
  0% { transform: scale(.78); opacity: .9; }
  100% { transform: scale(1.7); opacity: 0; }
}
.revolution-tooltip { border-color: #8d2633 !important; }


/* ECONOMY-LOGISTICS-CORE-1 */
.legend-economy { border-color: #476657; background: rgba(9,14,18,.95); }
.legend-economy i { width: 22px; height: 10px; border: 1px solid rgba(255,255,255,.22); }
.legend-dev-0 { background: #343a40; }
.legend-dev-2 { background: #777447; }
.legend-dev-3 { background: #4d775d; }
.legend-dev-5 { background: #437399; }
.legend-logistics-stable { background: linear-gradient(180deg, transparent 35%, #52c98b 35% 65%, transparent 65%); border: 0 !important; }
.legend-logistics-limited { background: repeating-linear-gradient(90deg, #d4ae53 0 5px, transparent 5px 9px); border: 0 !important; }

.mode-economy .map-shell { background: #0e1517; }
.mode-economy .map-metrics { border-color: rgba(82,201,139,.35); }

.economy-balance {
  margin: 8px 0 10px;
  padding: 9px 10px;
  border: 1px solid #3b4b48;
  background: rgba(18,30,29,.82);
}
.economy-balance span,
.economy-balance strong,
.economy-balance small { display: block; }
.economy-balance span { color: var(--muted); font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
.economy-balance strong { margin-top: 3px; font-size: 18px; }
.economy-balance small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.economy-balance.positive { border-left: 3px solid #52c98b; }
.economy-balance.positive strong,
.value-positive { color: #72d49d; }
.economy-balance.negative { border-left: 3px solid #d35f68; }
.economy-balance.negative strong,
.value-negative { color: #e17881; }

.economy-province-status {
  margin: 9px 0;
  padding: 8px 9px;
  border-left: 3px solid #65717b;
  background: rgba(18,25,31,.78);
}
.economy-province-status strong,
.economy-province-status small { display: block; }
.economy-province-status strong { font-size: 12px; }
.economy-province-status small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.economy-province-status.level-0 { border-left-color: #555d65; }
.economy-province-status.level-1 { border-left-color: #8a794b; }
.economy-province-status.level-2 { border-left-color: #999654; }
.economy-province-status.level-3 { border-left-color: #5e9a72; }
.economy-province-status.level-4 { border-left-color: #50a29b; }
.economy-province-status.level-5 { border-left-color: #568fbd; }

.market-products-title {
  margin: 14px 0 7px;
  color: #d4b45c;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.market-offer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 9px;
  margin: 4px 0;
  border: 1px solid rgba(125, 145, 158, .22);
  background: rgba(12, 20, 26, .72);
}
.market-offer-row > div:last-child { text-align: right; color: #e6d29a; }
.market-offer-row strong { display: block; color: #dce5e9; font-size: 12px; }
.market-offer-row small { display: block; color: #82919a; margin-top: 2px; font-size: 10px; }
.sez-badge {
  margin: 8px 0;
  padding: 7px 9px;
  border: 1px solid rgba(67, 178, 155, .5);
  background: rgba(32, 112, 97, .16);
  color: #7dd6c2;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.empty-state.compact { padding: 10px 0; font-size: 11px; }


/* NEWS-AUTOMATION-1: world chronicle */
.chronicle-heading { margin: 16px 0 7px; color: #8996a4; font-size: 9px; letter-spacing: .13em; text-transform: uppercase; }
.calendar-list, .news-list { display: grid; gap: 7px; }
.calendar-entry { padding: 8px 9px; border-left: 3px solid #d4ae53; background: linear-gradient(90deg,rgba(212,174,83,.11),rgba(17,24,31,.82)); }
.calendar-entry.category-war { border-left-color: #d65a63; }
.calendar-entry.category-politics { border-left-color: #679de0; }
.calendar-entry span, .calendar-entry strong, .calendar-entry small { display: block; }
.calendar-entry span { color: #a9b3bd; font-size: 9px; }
.calendar-entry strong { margin-top: 2px; color: #e6eaf0; font-size: 11px; }
.calendar-entry small { margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.35; }
.news-entry { --news-accent:#d7ba69; position: relative; overflow: hidden; padding: 9px 11px 10px; border: 1px solid #35414c; border-left: 3px solid var(--news-accent); background: linear-gradient(105deg,rgba(18,25,33,.98),rgba(22,30,39,.86)); }
.news-entry::after { content:""; position:absolute; inset:0; pointer-events:none; background:linear-gradient(110deg,color-mix(in srgb,var(--news-accent) 10%,transparent),transparent 42%); }
.news-entry > * { position: relative; z-index: 1; }
.news-entry > div { display:flex; align-items:center; gap:6px; }
.news-entry > div b { color:var(--news-accent); font-size:9px; letter-spacing:.08em; }
.news-entry > div span { color:#8d98a4; font-size:8px; }
.news-entry > div time { margin-left:auto; color:#707b87; font-size:8px; }
.news-entry > strong { display:block; margin-top:5px; color:#eef1f4; font-size:11px; }
.news-entry > small { display:block; margin-top:4px; color:#aab3bd; font-size:9px; line-height:1.4; }
.news-entry > i { position:absolute; right:8px; bottom:5px; color:var(--news-accent); font-style:normal; opacity:.72; }
.news-entry.importance-critical { box-shadow: inset 0 0 24px rgba(160,42,52,.12); }

/* === GEOATLAS-HANDBOOK-1 / ATLAS-CLOSE-1 R1 === */
.tabs { grid-template-columns: repeat(7, 1fr); }
.knowledge-button { border-color: #4c4939; color: #e5d39b; background: #191c1c; }
.knowledge-button:hover { border-color: #b49349; background: #28271f; }
.rules-button { border-color: #5c343a; color: #e8a9ae; background: #21171b; }
.rules-button:hover { border-color: #a44b56; background: #321d23; }
.help-intro {
  padding: 13px;
  border: 1px solid #3b4650;
  border-left: 3px solid var(--gold);
  background: linear-gradient(120deg, rgba(214,170,75,.11), rgba(18,26,35,.92));
}
.help-intro strong, .help-intro span { display: block; }
.help-intro strong { color: #ead79c; font-size: 14px; }
.help-intro span { margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.help-section-list { display: grid; gap: 7px; margin: 12px 0; }
.help-section-card {
  width: 100%;
  display: grid;
  grid-template-columns: 34px minmax(0,1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 9px 10px;
  text-align: left;
  background: #131c25;
  border-color: #303d49;
}
.help-section-icon {
  width: 32px; height: 32px; display: grid; place-items: center;
  border: 1px solid #52606d; background: #0e151c; color: var(--gold); font-weight: 700;
}
.help-section-card strong, .help-section-card small { display: block; }
.help-section-card strong { font-size: 12px; }
.help-section-card small { margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.35; }
.help-section-card b { color: #9ba8b5; font-size: 10px; }
.help-primary-button { width: 100%; border-color: #80662f; background: #282317; color: #f0d890; }
.context-help {
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid #2c3844;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.context-help span { color: var(--muted); font-size: 10px; line-height: 1.35; }
.context-help button { padding: 6px 8px; color: #e5d39b; border-color: #605436; background: #201d17; font-size: 10px; white-space: nowrap; }

.documentation-center {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  grid-template-rows: 60px 58px minmax(0,1fr);
  background:
    radial-gradient(circle at 16% 0%, rgba(82,108,132,.12), transparent 34%),
    #090e14;
  color: var(--text);
}
.documentation-header {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 9px 16px;
  border-bottom: 1px solid #303c48;
  background: rgba(12,18,25,.98);
}
.documentation-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.documentation-mark {
  width: 38px; height: 38px; display: grid; place-items: center;
  color: var(--gold); border: 1px solid var(--gold); font-weight: 800;
  clip-path: polygon(25% 0,75% 0,100% 25%,100% 75%,75% 100%,25% 100%,0 75%,0 25%);
}
.documentation-brand small, .documentation-brand strong { display: block; }
.documentation-brand small { color: #7f8b97; font-size: 8px; letter-spacing: .16em; }
.documentation-brand strong { margin-top: 2px; font-size: 15px; letter-spacing: .04em; }
.documentation-header-actions { display: flex; gap: 8px; }
.documentation-close { border-color: #684047; color: #efb7bc; }
.documentation-toolbar {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(260px, 430px);
  gap: 14px;
  align-items: center;
  padding: 9px 16px;
  border-bottom: 1px solid #2d3945;
  background: #0f161e;
}
.documentation-section-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; }
.documentation-section-tab {
  flex: 0 0 auto;
  border-radius: 4px;
  padding: 8px 11px;
  color: #a8b3be;
  background: #151e27;
}
.documentation-section-tab.active { color: #f0d78f; border-color: #92743a; background: #292418; box-shadow: inset 0 -2px 0 #d6aa4b; }
.documentation-search-wrap { position: relative; min-width: 0; }
.documentation-search-wrap input {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid #3b4957; border-radius: 5px;
  background: #0a1016; color: var(--text); outline: none;
}
.documentation-search-wrap input:focus { border-color: #8e733d; }
.documentation-search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  max-height: min(520px,70vh); overflow: auto;
  border: 1px solid #3c4854; background: #111923;
  box-shadow: 0 16px 40px rgba(0,0,0,.5); z-index: 10;
}
.documentation-search-result { width: 100%; text-align: left; border: 0; border-bottom: 1px solid #2a3540; border-radius: 0; background: transparent; padding: 10px 11px; }
.documentation-search-result strong, .documentation-search-result small { display: block; }
.documentation-search-result strong { font-size: 12px; }
.documentation-search-result small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.documentation-workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 270px minmax(0,1fr) 230px;
}
.documentation-navigation, .documentation-outline-shell { min-height: 0; overflow: auto; background: #0e151d; }
.documentation-navigation { border-right: 1px solid #2c3742; }
.documentation-navigation-heading { padding: 16px 14px 12px; border-bottom: 1px solid #28333e; }
.documentation-navigation-heading strong, .documentation-navigation-heading small { display: block; }
.documentation-navigation-heading strong { color: #e2d098; font-size: 13px; }
.documentation-navigation-heading small { margin-top: 5px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.documentation-document-list { padding: 8px; display: grid; gap: 4px; }
.documentation-document-button { width: 100%; text-align: left; padding: 9px 10px; border: 1px solid transparent; background: transparent; }
.documentation-document-button:hover { background: #18212b; border-color: #34414e; }
.documentation-document-button.active { border-color: #6e5a32; background: linear-gradient(90deg,rgba(214,170,75,.13),rgba(23,31,40,.94)); }
.documentation-document-button strong, .documentation-document-button small { display: block; }
.documentation-document-button strong { font-size: 11px; }
.documentation-document-button small { margin-top: 4px; color: var(--muted); font-size: 8px; line-height: 1.4; }
.documentation-article-shell { min-width: 0; min-height: 0; overflow: auto; position: relative; background: #0b1118; }
.documentation-loading { padding: 40px; color: var(--muted); text-align: center; }
.documentation-article { max-width: 900px; margin: 0 auto; padding: 38px 46px 90px; line-height: 1.68; color: #ced6df; }
.documentation-article h1 { margin: 0 0 8px; color: #f0f2f5; font-size: 31px; line-height: 1.2; letter-spacing: -.02em; }
.documentation-article h2 { margin: 36px 0 12px; padding-bottom: 8px; border-bottom: 1px solid #33404c; color: #e5d19a; font-size: 20px; line-height: 1.3; }
.documentation-article h3 { margin: 27px 0 10px; color: #dce3ea; font-size: 16px; }
.documentation-article h4 { margin: 22px 0 8px; color: #bdc7d1; font-size: 13px; }
.documentation-article p { margin: 10px 0; }
.documentation-article ul, .documentation-article ol { margin: 12px 0; padding-left: 24px; }
.documentation-article li { margin: 6px 0; }
.documentation-article strong { color: #eef1f4; }
.documentation-article em { color: #b9c4ce; }
.documentation-article code { padding: 2px 5px; border: 1px solid #3a4651; border-radius: 3px; background: #111a23; color: #e8c97b; font-family: "JetBrains Mono", "Consolas", monospace; font-size: .9em; }
.documentation-article a { color: #84b9e7; text-decoration: none; border-bottom: 1px dotted #527b9e; }
.documentation-article a:hover { color: #b6d8f5; }
.documentation-article img { display: block; max-width: 100%; height: auto; margin: 18px auto; border: 1px solid #3b4651; background: #111820; }
.documentation-article table { width: 100%; margin: 16px 0; border-collapse: collapse; font-size: 12px; }
.documentation-article th, .documentation-article td { padding: 9px 10px; border: 1px solid #36424d; text-align: left; vertical-align: top; }
.documentation-article th { background: #18222c; color: #e1cf96; }
.documentation-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; color: #83909c; font-size: 10px; }
.documentation-meta span { padding: 4px 7px; border: 1px solid #34414c; background: #121a23; }
.documentation-callout { margin: 16px 0; padding: 12px 14px; border: 1px solid #3d4b58; border-left: 4px solid #6e91ad; background: #121d27; }
.documentation-callout strong { display: block; margin-bottom: 5px; color: #b8d4e9; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.documentation-callout.note { border-left-color: #6e91ad; }
.documentation-callout.tip { border-left-color: #54a77a; background: #101f1a; }
.documentation-callout.tip strong { color: #8dd5aa; }
.documentation-callout.warning { border-left-color: #d5a649; background: #241e12; }
.documentation-callout.warning strong { color: #e5c36f; }
.documentation-callout.important { border-left-color: #c55b67; background: #26161a; }
.documentation-callout.important strong { color: #e7929c; }
.documentation-anchor { color: inherit !important; border: 0 !important; }
.documentation-outline-shell { border-left: 1px solid #2c3742; padding: 16px 12px; }
.documentation-outline-title { margin-bottom: 10px; color: #8895a2; font-size: 9px; text-transform: uppercase; letter-spacing: .12em; }
.documentation-outline { display: grid; gap: 2px; }
.documentation-outline a { display: block; padding: 6px 7px; border-left: 2px solid transparent; color: #8996a3; text-decoration: none; font-size: 10px; line-height: 1.35; }
.documentation-outline a.level-3 { padding-left: 16px; font-size: 9px; }
.documentation-outline a:hover, .documentation-outline a.active { color: #e0ce95; border-left-color: #b18d43; background: rgba(214,170,75,.06); }
.documentation-footer {
  position: sticky; bottom: 0;
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center;
  padding: 11px 16px; border-top: 1px solid #303b46;
  background: rgba(12,18,25,.96); backdrop-filter: blur(8px);
}
.documentation-footer > div { text-align: center; }
.documentation-footer span, .documentation-footer small { display: block; }
.documentation-footer span { color: #b6c0c9; font-size: 9px; }
.documentation-footer small { margin-top: 2px; color: #6f7c88; font-size: 8px; }
.documentation-footer button:last-child { justify-self: end; }
.documentation-footer button:disabled { opacity: .35; cursor: default; }
.atlas-notice {
  position: fixed; z-index: 8000; right: 18px; bottom: 18px;
  max-width: 340px; padding: 10px 13px;
  border: 1px solid #75602f; border-left: 3px solid var(--gold);
  background: rgba(20,25,29,.97); color: #e4e9ed; box-shadow: 0 12px 32px rgba(0,0,0,.5); font-size: 11px;
}
body.documentation-open #app { visibility: hidden; }

@media (max-width: 1220px) {
  .top-actions .knowledge-button { padding: 8px; font-size: 0; }
  .top-actions .knowledge-button::before { font-size: 14px; }
  #open-handbook::before { content: "?"; }
  #open-rules::before { content: "§"; }
  .documentation-workspace { grid-template-columns: 245px minmax(0,1fr); }
  .documentation-outline-shell { display: none; }
}
@media (max-width: 860px) {
  .documentation-center { grid-template-rows: 56px auto minmax(0,1fr); }
  .documentation-toolbar { grid-template-columns: 1fr; gap: 8px; padding: 8px 10px; }
  .documentation-workspace { grid-template-columns: 220px minmax(0,1fr); }
  .documentation-article { padding: 28px 28px 90px; }
  .documentation-header { padding: 8px 10px; }
  .documentation-header-actions button { padding: 7px 9px; }
}
@media (max-width: 640px) {
  .documentation-center { grid-template-rows: 54px auto minmax(0,1fr); }
  .documentation-brand small { display: none; }
  .documentation-brand strong { font-size: 13px; }
  #documentation-copy-link { display: none; }
  .documentation-close { font-size: 0; }
  .documentation-close::before { content: "Карта"; font-size: 12px; }
  .documentation-workspace { grid-template-columns: 1fr; }
  .documentation-navigation { display: none; }
  .documentation-article { padding: 24px 18px 86px; }
  .documentation-article h1 { font-size: 25px; }
  .documentation-article h2 { font-size: 18px; }
  .documentation-footer { grid-template-columns: 1fr 1fr; }
  .documentation-footer > div { display: none; }
  .documentation-section-tabs { padding-bottom: 2px; }
}

/* VOICE-FOUNDATION-1 */
.voice-foundation-card {
  margin: 12px 0 14px;
  padding: 14px;
  border: 1px solid rgba(105, 157, 204, .42);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(13, 31, 47, .96), rgba(16, 24, 35, .96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035);
}
.voice-foundation-heading {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  align-items: center;
}
.voice-foundation-heading div { display: grid; gap: 2px; }
.voice-foundation-heading strong { color: #f2f6fa; font-size: 15px; }
.voice-foundation-heading small { color: #91a4b5; font-size: 11px; }
.voice-foundation-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(94, 175, 225, .5);
  border-radius: 10px;
  color: #82c9f3;
  background: rgba(41, 101, 139, .24);
  font-weight: 800;
}
.voice-foundation-status {
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.voice-foundation-status.status-ok { color: #a8efc2; background: rgba(40, 130, 76, .22); border: 1px solid rgba(82, 190, 119, .36); }
.voice-foundation-status.status-wait { color: #f1d696; background: rgba(144, 103, 35, .22); border: 1px solid rgba(205, 158, 71, .36); }
.voice-foundation-status.status-error { color: #f0aaaa; background: rgba(135, 47, 47, .22); border: 1px solid rgba(199, 83, 83, .36); }
.voice-foundation-card > p { margin: 12px 0; color: #b5c1cc; line-height: 1.45; font-size: 12px; }
.voice-foundation-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.voice-foundation-facts div { padding: 8px; border-radius: 8px; background: rgba(5, 14, 22, .48); border: 1px solid rgba(255, 255, 255, .05); display: grid; gap: 3px; }
.voice-foundation-facts span { color: #7f93a5; font-size: 10px; }
.voice-foundation-facts strong { color: #e5eef5; font-size: 11px; }
.voice-client-version { margin-top: 9px; color: #8fa4b5; font-size: 10px; }
.voice-foundation-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 11px; }
.voice-foundation-actions button,
.voice-foundation-actions a {
  min-height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid rgba(99, 165, 207, .34);
  color: #dcecf6;
  background: rgba(35, 85, 116, .23);
  text-decoration: none;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}
.voice-foundation-actions button:hover,
.voice-foundation-actions a:hover { background: rgba(47, 111, 150, .35); border-color: rgba(111, 188, 235, .55); }
@media (max-width: 700px) {
  .voice-foundation-facts { grid-template-columns: 1fr; }
  .voice-foundation-actions { grid-template-columns: 1fr; }
}

/* STATE-DIPLOMACY-ATLAS-REBUILD-1 */
.legend-dependency { background: #745b94; }
.country-card-leader { display: grid; grid-template-columns: auto 1fr; gap: 6px; margin-top: 6px; font-size: 10px; }
.country-card-leader span { color: var(--muted); }
.country-card-leader strong { color: #eef2f5; font-weight: 650; }
.country-card-badges { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 7px; }
.country-card-badges .country-card-status { margin-top: 0; }
.country-bloc-badge { display: inline-block; padding: 3px 6px; border: 1px solid #52708c; color: #dce4eb; background: rgba(7,12,17,.42); font-size: 9px; font-weight: 700; letter-spacing: .05em; }
.country-chip-fallback { display: inline-grid; place-items: center; width: 22px; height: 14px; margin-right: 6px; vertical-align: -2px; border: 1px solid rgba(255,255,255,.28); color: #fff; font-size: 7px; }
.diplomacy-section-title { margin: 10px 0 6px; color: #d8c27c; font-size: 10px; text-transform: uppercase; letter-spacing: .09em; }
.bloc-card { margin: 0 0 7px; padding: 9px; border: 1px solid #34414e; border-left: 4px solid #52708c; background: #141d26; }
.bloc-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.bloc-card header strong { display: block; font-size: 12px; }
.bloc-card header small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.bloc-card header b { color: #e0c978; font-size: 10px; }
.bloc-leader { margin-top: 7px; color: var(--muted); font-size: 10px; }
.bloc-leader-button { margin-top: 6px; padding: 4px 0; border: 0; background: transparent; color: #d8c27c; font-size: 10px; text-align: left; }
.bloc-members { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.bloc-member { display: inline-flex; align-items: center; min-width: 0; padding: 4px 6px; border: 1px solid #354352; background: #111820; color: #cad2da; font-size: 9px; }
.bloc-member.current { border-color: #88713a; color: #f0d783; }
.diplomacy-item.dependency { border-left: 3px solid #745b94; }
.war-call-card { display: grid; gap: 3px; padding: 8px; border: 1px solid #604f31; background: #1b1c1c; }
.war-call-card strong { color: #e5c879; font-size: 11px; }
.war-call-card span { color: var(--muted); font-size: 10px; }
.parliament-empty { margin: 8px 0; padding: 10px; color: var(--muted); border: 1px solid #303c48; text-align: center; font-size: 10px; }
.parliament-card { margin: 9px 0; padding: 9px; border: 1px solid #34414e; background: #101820; }
.parliament-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.parliament-card-head strong { display: block; font-size: 12px; }
.parliament-card-head small { display: block; margin-top: 2px; color: var(--muted); font-size: 8px; }
.parliament-card-head > span { color: #d6bd72; font-size: 9px; text-align: right; }
.parliament-hemicycle { position: relative; height: 136px; margin-top: 6px; overflow: hidden; }
.parliament-seat { position: absolute; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; border: 1px solid rgba(255,255,255,.32); box-shadow: 0 1px 2px rgba(0,0,0,.8); }
.parliament-seat.coalition { outline: 1px solid #f0d37a; outline-offset: 1px; }
.parliament-majority { position: absolute; left: 50%; bottom: 2px; transform: translateX(-50%); color: #8e9baa; font-size: 8px; white-space: nowrap; font-weight: 500; }
.politics-party-list { margin-top: 8px; }
.politics-party-list h4 { margin: 0 0 6px; color: #d9c58e; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.politics-party-row { display: grid; grid-template-columns: 44px 1fr; gap: 5px; padding: 7px 7px 7px 9px; margin: 4px 0; border: 1px solid #303c48; border-left: 4px solid #808080; background: #141d26; }
.politics-party-row strong { font-size: 10px; color: #e7ebef; }
.politics-party-row span { font-size: 10px; color: #c5cdd5; }
.politics-party-row small { grid-column: 1 / -1; color: var(--muted); font-size: 8px; line-height: 1.35; }
.politics-party-row small b { color: #e2c979; font-weight: 650; }

@media (max-width: 760px) {
  .nuclear-winter-banner {
    top: 8px;
    min-width: 0;
    width: calc(100% - 18px);
    max-width: none;
    grid-template-columns: auto minmax(0, 1fr);
  }
  .nuclear-winter-timer { display: none; }
  .nuclear-winter-copy small { display: none; }
}

/* INTERACTIVE-CLAIMS-1 */
.claims-panel{position:absolute;z-index:900;right:18px;top:18px;width:min(390px,calc(100% - 36px));padding:14px;background:rgba(15,20,25,.96);border:1px solid rgba(190,205,218,.22);border-radius:8px;color:#edf2f6;box-shadow:0 8px 28px rgba(0,0,0,.35)}
.claims-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}.claims-head button{font-size:20px;min-width:34px}.claims-panel p{font-size:13px;color:#aeb8c2;line-height:1.4}.claims-panel input{box-sizing:border-box;width:100%;margin:5px 0;padding:9px 10px;background:#111820;border:1px solid #394651;border-radius:5px;color:#fff}.claims-panel button{margin:4px 4px 4px 0;padding:8px 11px}.claims-identity{font-weight:700;margin-bottom:8px}.claims-status{margin-top:9px;font-size:12px;color:#aeb8c2}.claims-status.error{color:#e38b8b}.claims-actions{display:flex;flex-wrap:wrap;gap:4px}

/* ET-6.2: independent international organizations directory */
.tabs { grid-template-columns: repeat(8, minmax(0, 1fr)); }
.tab { font-size: 10px; }
.org-directory-controls { display:flex; gap:6px; margin: 8px 0 10px; }
.org-directory-controls input { min-width:0; flex:1; width:0; background:#101820; border:1px solid #344557; border-radius:4px; padding:8px; color:#e0e7ed; font:inherit; font-size:11px; }
.org-directory-controls button { background:#253343; border:1px solid #485a6a; color:#e2ebf2; padding:7px; border-radius:4px; cursor:pointer; font-size:10px; }
.org-directory-count { color:#a3b0ba; font-size:11px; margin-bottom:9px; }
.org-directory-list { display:grid; gap:9px; }
.org-directory-card { background:#121c26; border:1px solid #344254; border-radius:5px; padding:11px; }
.org-directory-heading { display:flex; align-items:center; gap:11px; min-width:0; }
.org-emblem { width:56px; height:56px; flex:none; background:#1a2835; border:1px solid #556070; border-radius:6px; display:grid; place-items:center; overflow:hidden; }
.org-emblem img { width:100%; height:100%; object-fit:contain; }
.org-emblem-placeholder { display:grid; place-items:center; width:100%; height:100%; font-size:29px; color:#caab64; }
.org-directory-heading-copy { display:flex; flex-direction:column; gap:5px; min-width:0; }
.org-directory-heading-copy strong { font-size:13px; color:#f2f5f8; overflow-wrap:anywhere; }
.org-directory-heading-copy small { color:#d8bb78; font-size:10px; }
.org-directory-description { font-size:11px; color:#c0ccd6; line-height:1.5; margin:10px 0 9px; overflow-wrap:anywhere; white-space:pre-wrap; }
.org-directory-meta { display:flex; flex-direction:column; gap:5px; color:#8e9fab; font-size:10px; overflow-wrap:anywhere; }
@media (max-width: 1100px) { .tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 570px) { .tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ET-6.2 F2: Emblem diagnostics and public direct-image link. */
.org-emblem img { display:block; font-size:0; color:transparent; }
.org-emblem-direct-link { display:inline-block; margin-top:8px; color:#9dbfe4; text-decoration:underline; font-size:10px; overflow-wrap:anywhere; }
.org-emblem-unavailable .org-emblem { border-color:#9c7d46; }

/* ET-8 adaptive specializations: compact, nonintrusive sidebar */
.et8-status {padding:9px 10px;margin:8px 0 10px;background:rgba(73,99,117,.12);border:1px solid rgba(149,171,190,.2);border-radius:7px;font-size:12px;line-height:1.5;color:#b6c9d7}
.et8-filters {display:grid;grid-template-columns:1fr;gap:6px;margin:8px 0}
.et8-filters select {width:100%;background:#182532;border:1px solid #42596b;color:#e8f0f6;padding:7px 9px;border-radius:6px;font:inherit;font-size:12px}
.et8-legend{display:grid;grid-template-columns:1fr 1fr;gap:5px;margin:10px 0}
.et8-legend-item{display:flex;align-items:center;gap:6px;font-size:11px;min-width:0;color:#ccdae3}
.et8-legend-item i,.et8-profile-dot{display:inline-block;flex:none;width:11px;height:11px;border:1px solid #a5bbcc;border-radius:3px}
.et8-legend-item span{overflow-wrap:anywhere}.et8-legend small{grid-column:1/-1;color:#9cb3c3;line-height:1.4}
.et8-count{font-size:11px;color:#9ab2c3;padding:7px 0}
.et8-province{display:flex;gap:9px;align-items:center;width:100%;padding:9px 8px;margin:3px 0;background:rgba(38,57,72,.45);border:1px solid rgba(127,158,182,.17);border-radius:6px;text-align:left;color:#e8edf2;cursor:pointer}
.et8-province:hover{border-color:#8db2c5;background:rgba(56,81,100,.6)}.et8-province>span:nth-child(2){display:flex;flex:1;flex-direction:column;gap:3px;min-width:0}.et8-province strong{font-size:12px}.et8-province small{font-size:10px;color:#afc4d4}.et8-province b{font-size:12px;color:#dcbf83}
.et8-detail-heading{margin:10px 0;padding:9px;border-left:4px solid #778899;background:rgba(48,69,83,.55);display:flex;flex-direction:column;gap:4px;font-size:12px}.et8-detail-heading span{color:#aec4d4;font-size:11px}
.et8-detail-objects{margin-top:8px;font-size:11px;color:#d2dce5}.et8-detail-objects small{display:block;color:#a9c2d4;margin-bottom:4px}.et8-detail-objects div{padding:4px;border-bottom:1px solid rgba(120,150,170,.2)}

/* ET-8.1 R3 — specializations are a sublayer of EXISTING economy map, not a new tab */
.et8-economic-controls{display:none;margin:1px 0 14px;padding:10px;background:#111d27;border:1px solid #344958;border-radius:6px}
.mode-economy #tab-summary .et8-economic-controls{display:block}
.mode-economy #tab-summary .metrics-grid{display:none}
.et8-economic-controls .section-title{margin-bottom:8px}
.et8-overlay-switch{display:grid;grid-template-columns:1fr 1fr;gap:5px;margin:0 0 11px}
.et8-overlay-switch button{font-size:12px;padding:9px 5px;background:#172330;border:1px solid #385065}
.et8-overlay-switch button.active{background:#273b4a;border-color:#81b5bf;color:#effbff;box-shadow:inset 0 -2px 0 #76b4c4}
.mode-economy .et8-economic-controls + .selection-card{margin-top:12px}
.legend-specialization-sample{background:linear-gradient(90deg,#d97732 0 24%,#2d8fbe 24% 50%,#67a44a 50% 75%,#5d80c4 75%)!important}

/* Keep original eight sidebar navigation entries */
.tabs{grid-template-columns:repeat(8,minmax(0,1fr))}
@media(max-width:1100px){.tabs{grid-template-columns:repeat(4,minmax(0,1fr))}}

.mode-economy #tab-summary > .section-title{display:none}
/* ET-8.3 R1: production-backed economy analytics */
.et83-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px;margin:8px 0}
.et83-periods{display:flex;gap:4px}.et83-periods button,.et83-rank{border:1px solid rgba(142,167,185,.25);border-radius:6px;background:rgba(20,32,43,.9);color:#dbe7ed;padding:7px;cursor:pointer}.et83-periods .active,.et83-rank.active{border-color:#7bb5c7;background:rgba(56,106,132,.35)}
.et83-note,.et83-update{color:#9aafbd;font-size:12px;line-height:1.5}.et83-list-title{font-weight:650;color:#e4edf4;margin:15px 0 8px}
.et83-rankings{max-height:290px;overflow:auto;display:flex;flex-direction:column;gap:4px}.et83-rank{display:flex;justify-content:space-between;gap:6px;text-align:left}.et83-rank b{white-space:nowrap}
.et83-metrics{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;margin:10px 0}.et83-metrics>div{background:rgba(78,103,121,.14);border:1px solid rgba(142,167,185,.12);border-radius:7px;padding:10px 8px;min-width:0}.et83-metrics small{display:block;color:#9aafbd;font-size:11px}.et83-metrics strong{display:block;color:#e5f0f5;font-size:18px;margin-top:4px;overflow-wrap:anywhere}
.et83-subgrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;font-size:12px;color:#b9cbd7}.et83-subgrid b{color:#e2ecf4}.et83-chart{display:block;max-width:100%;margin:8px 0;background:rgba(10,20,29,.25);border-radius:6px;max-height:200px}.et83-history{display:grid;gap:5px}.et83-history>div{font-size:12px;display:flex;flex-direction:column;border-bottom:1px solid rgba(142,167,185,.15);padding:4px 0}.et83-history small{color:#9bb0be}
.et83-country-inline{border-top:1px solid rgba(142,167,185,.2);padding-top:9px;margin-top:12px}

.et83-rank-filter{font-size:12px;color:#a3bac7;display:flex;gap:8px;align-items:center;flex-wrap:wrap}.et83-rank-filter select{background:#16222d;border:1px solid rgba(142,167,185,.3);border-radius:5px;color:#dbe7ed;padding:6px;max-width:100%}.et83-sectors{display:grid;gap:9px;margin:7px 0}.et83-sector>div:first-child{display:flex;justify-content:space-between;color:#b9cbd7;font-size:12px;margin-bottom:4px}.et83-sector-track{height:6px;background:rgba(142,167,185,.17);border-radius:20px;overflow:hidden}.et83-sector-track>span{height:100%;display:block;background:#7bb5c7;border-radius:20px}


/* === ET-8.3 R1-F1 UI polish === */

.tab-text{position:absolute !important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.tabs{display:grid;grid-template-columns:repeat(9,1fr);gap:0;border-bottom:1px solid #2b3744;background:linear-gradient(180deg,#111924,#0f1720)}
.tab{position:relative;min-height:54px;padding:0;background:transparent;border:0;border-right:1px solid #22303d;color:#94a6b4;display:grid;place-items:center}
.tab:last-child{border-right:0}
.tab::before{content:'';width:22px;height:22px;display:block;background-repeat:no-repeat;background-position:center;background-size:contain;opacity:.78;filter:grayscale(.08) drop-shadow(0 1px 1px rgba(0,0,0,.35))}
.tab:hover{background:#15202b;color:#d8e4ec}
.tab:hover::before{opacity:1}
.tab.active{background:linear-gradient(180deg,#182532,#13202c);color:var(--gold);box-shadow:inset 0 -3px 0 var(--gold)}
.tab.active::before{opacity:1;filter:drop-shadow(0 0 6px rgba(214,170,75,.18))}
.tab[data-tab="summary"]::before{background-image:url('/assets/icons/objects/32/city.png')}
.tab[data-tab="countries"]::before{background-image:url('/assets/icons/objects/32/capital.png')}
.tab[data-tab="et83"]::before{background-image:url('/assets/icons/objects/32/central_bank.png')}
.tab[data-tab="organizations"]::before{background-image:url('/assets/icons/objects/32/meeting.png')}
.tab[data-tab="diplomacy"]::before{background-image:url('/assets/icons/objects/32/logic.png')}
.tab[data-tab="wars"]::before{background-image:url('/assets/icons/objects/32/arta.png')}
.tab[data-tab="events"]::before{background-image:url('/assets/icons/objects/32/event.png')}
.tab[data-tab="layers"]::before{background-image:url('/assets/icons/objects/32/radar.png')}
.tab[data-tab="help"]::before{background-image:url('/assets/icons/objects/32/science.png')}

.et83-shell{display:grid;gap:12px}
.et83-head{display:flex;flex-wrap:wrap;align-items:flex-start;justify-content:space-between;gap:10px;margin:0}
.et83-head>div:first-child{display:grid;gap:4px}
.et83-head strong{font-size:31px;line-height:1.05;color:#eef6fb;letter-spacing:-.02em}
.et83-update{display:block;color:#8fa2b0;font-size:11px}
.et83-periods{display:flex;gap:6px;background:rgba(16,28,38,.88);padding:4px;border:1px solid rgba(122,143,158,.16);border-radius:10px}
.et83-periods button,.et83-rank{border:1px solid rgba(142,167,185,.15);border-radius:9px;background:rgba(20,32,43,.9);color:#dbe7ed;padding:8px 10px;cursor:pointer}
.et83-periods .active,.et83-rank.active{border-color:#5db5c8;background:linear-gradient(180deg,rgba(49,93,112,.6),rgba(26,50,62,.82));box-shadow:0 0 0 1px rgba(111,182,203,.08) inset}
.et83-note{color:#9db0be;font-size:12px;line-height:1.55;padding:11px 12px;border:1px solid rgba(82,107,123,.16);background:linear-gradient(180deg,rgba(16,26,35,.85),rgba(12,20,28,.92));border-radius:10px;margin:0}
.et83-rank-filter{font-size:12px;color:#a9bfcb;display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.et83-rank-filter select{background:#16222d;border:1px solid rgba(142,167,185,.24);border-radius:8px;color:#dbe7ed;padding:7px 10px;max-width:100%}
.et83-main-grid{display:grid;grid-template-columns:320px 1fr;gap:12px;align-items:start}
.et83-panel{background:linear-gradient(180deg,rgba(17,26,35,.96),rgba(13,20,27,.98));border:1px solid rgba(55,72,86,.85);border-radius:14px;padding:14px;box-shadow:0 14px 30px rgba(0,0,0,.16)}
.et83-panel-rankings{position:sticky;top:10px}
.et83-list-title{font-weight:700;color:#ecf4f9;margin:0 0 10px;font-size:15px}
.et83-rankings{max-height:none;overflow:auto;display:flex;flex-direction:column;gap:7px}
.et83-rank{text-align:left;padding:10px;display:grid;gap:8px;position:relative;overflow:hidden}
.et83-rank-top{display:flex;justify-content:space-between;gap:8px;align-items:center}
.et83-rank-name{display:flex;align-items:center;gap:9px;min-width:0;font-size:13px;color:#e4eef5}
.et83-rank-name i{display:inline-grid;place-items:center;width:24px;height:24px;border-radius:50%;font-style:normal;font-size:11px;background:rgba(214,170,75,.16);color:#f3d78a;border:1px solid rgba(214,170,75,.28);flex:0 0 auto}
.et83-rank-top b{white-space:nowrap;color:#edf6fb}
.et83-rank-bar{height:6px;border-radius:999px;background:rgba(111,133,148,.14);overflow:hidden}
.et83-rank-bar span{display:block;height:100%;border-radius:999px;background:linear-gradient(90deg,#4a97b5,#7cd1e5)}
.et83-hero{display:flex;justify-content:space-between;gap:12px;align-items:stretch;padding:14px;border:1px solid rgba(88,124,142,.2);background:radial-gradient(circle at top right,rgba(70,131,155,.18),transparent 38%),linear-gradient(180deg,rgba(18,29,39,.96),rgba(13,21,28,.96));border-radius:14px;margin-bottom:12px}
.et83-hero-kicker{font-size:11px;text-transform:uppercase;letter-spacing:.14em;color:#8fa8b8}
.et83-hero h3{margin:4px 0 9px;font-size:26px;line-height:1.05;color:#f1f7fb}
.et83-hero-meta{display:flex;flex-wrap:wrap;gap:8px}
.et83-hero-meta span,.et83-badge{display:inline-flex;align-items:center;gap:4px;padding:6px 8px;border-radius:999px;background:rgba(124,148,164,.08);border:1px solid rgba(124,148,164,.14);font-size:12px;color:#bdd0dc}
.et83-badge.good{color:#9de0b7;border-color:rgba(83,165,106,.4);background:rgba(43,86,55,.28)}
.et83-badge.warn{color:#f0c17e;border-color:rgba(180,130,68,.4);background:rgba(90,56,22,.28)}
.et83-badge.neutral{color:#b8c8d3}
.et83-hero-value{margin-left:auto;min-width:180px;display:grid;align-content:center;justify-items:end;padding-left:10px;border-left:1px solid rgba(98,121,136,.2)}
.et83-hero-value small{font-size:11px;color:#9bb1bf;text-transform:uppercase;letter-spacing:.08em}
.et83-hero-value strong{font-size:34px;line-height:1;color:#f4fafc}
.et83-metrics{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px;margin:8px 0 12px}
.et83-metrics.compact{grid-template-columns:repeat(2,minmax(0,1fr))}
.et83-metric-card{background:linear-gradient(180deg,rgba(22,33,43,.95),rgba(17,27,35,.97));border:1px solid rgba(92,111,125,.16);border-radius:12px;padding:12px 11px;min-width:0;position:relative;overflow:hidden}
.et83-metric-card::after{content:'';position:absolute;inset:auto 0 0 0;height:2px;background:transparent}
.et83-metric-card.accent-gdp::after{background:linear-gradient(90deg,#5db5c8,#7fd9cf)}
.et83-metric-card.accent-industrial::after{background:linear-gradient(90deg,#c29b54,#e2c07a)}
.et83-metric-card.accent-military::after{background:linear-gradient(90deg,#ba6565,#e4a08c)}
.et83-metric-card small{display:block;color:#a0b2be;font-size:11px}
.et83-metric-card strong{display:block;color:#edf6fb;font-size:23px;margin-top:5px;overflow-wrap:anywhere;line-height:1.05}
.et83-metric-card span{display:block;color:#7f93a2;font-size:11px;margin-top:8px}
.et83-subgrid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;font-size:12px;color:#b9cbd7}
.et83-subgrid span{display:grid;gap:4px;padding:10px;border-radius:10px;background:rgba(255,255,255,.02);border:1px solid rgba(76,97,112,.1)}
.et83-subgrid label{color:#91a5b3;font-size:11px}
.et83-subgrid b{color:#e2ecf4;font-size:15px}
.et83-detail-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.et83-chart-wrap{padding:10px;border-radius:12px;background:linear-gradient(180deg,rgba(14,23,31,.8),rgba(10,18,24,.9));border:1px solid rgba(80,104,119,.13)}
.et83-chart{display:block;max-width:100%;max-height:210px;color:#9cb3c2}
.et83-history{display:grid;gap:7px}.et83-history>div{font-size:12px;display:flex;flex-direction:column;border:1px solid rgba(91,109,121,.14);background:rgba(18,28,37,.62);border-radius:10px;padding:8px 10px}.et83-history small{color:#9bb0be;margin-bottom:4px}.et83-history b{color:#edf6fb}
.et83-country-inline{border-top:1px solid rgba(142,167,185,.16);padding-top:12px;margin-top:12px}
.et83-sectors{display:grid;gap:10px;margin:7px 0}.et83-sector-head{display:flex;justify-content:space-between;color:#d0dde6;font-size:12px;margin-bottom:5px}.et83-sector-track{height:9px;background:rgba(142,167,185,.12);border-radius:999px;overflow:hidden}.et83-sector-track>span{height:100%;display:block;background:linear-gradient(90deg,#7bb5c7,#8ddbc9);border-radius:999px}.et83-sector.rank-2 .et83-sector-track>span{background:linear-gradient(90deg,#d4aa63,#e9ca8a)}.et83-sector.rank-3 .et83-sector-track>span{background:linear-gradient(90deg,#c17b67,#e6a38e)}

@media (max-width: 1180px){.et83-main-grid{grid-template-columns:1fr}.et83-panel-rankings{position:static}.et83-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.et83-subgrid{grid-template-columns:repeat(2,minmax(0,1fr))}.tabs{grid-template-columns:repeat(9,1fr)}}
@media (max-width: 860px){.et83-hero{flex-direction:column}.et83-hero-value{border-left:0;border-top:1px solid rgba(98,121,136,.2);padding-left:0;padding-top:10px;justify-items:start}.et83-detail-grid{grid-template-columns:1fr}.tabs{grid-template-columns:repeat(5,1fr)}.tab{min-height:48px}}
@media (max-width: 560px){.et83-metrics,.et83-subgrid{grid-template-columns:1fr}.tabs{grid-template-columns:repeat(5,1fr)}}



/* === ET-8.3 R1-F3 — wide usable drawer / real embedded SVG icons === */
.workspace{position:relative;grid-template-columns:minmax(0,1fr)!important;grid-template-rows:minmax(0,1fr)!important;min-height:0}
.map-shell{min-height:0;min-width:0}
.sidebar{
  --et83-rail:60px;
  position:absolute;top:0;right:0;bottom:0;z-index:940;
  width:min(1040px,calc(100vw - 28px));max-width:none;min-width:0;
  display:grid;grid-template-columns:var(--et83-rail) minmax(0,1fr);grid-template-rows:minmax(0,1fr);
  overflow:hidden;box-sizing:border-box;
  border-left:1px solid #344655;border-top:0;
  background:#0b121a;box-shadow:-9px 0 30px rgba(0,0,0,.3);
  transform:translateX(calc(100% - var(--et83-rail)));
  transition:transform .22s ease,box-shadow .22s ease;
}
.sidebar.expanded{transform:translateX(0);box-shadow:-25px 0 55px rgba(0,0,0,.43)}
.sidebar-toggle{
  position:absolute;top:8px;left:8px;z-index:3;width:44px;height:40px;padding:0;
  border-radius:9px;background:#14212d;border:1px solid #455668;
  display:grid;place-items:center;
}
.sidebar-toggle::before{
  content:'';display:block;width:12px;height:12px;
  border-right:2px solid #e4bd64;border-bottom:2px solid #e4bd64;
  transform:rotate(135deg) translate(-1px,-1px);transition:transform .18s;
}
.sidebar.expanded .sidebar-toggle::before{transform:rotate(-45deg) translate(-1px,-1px)}
.tabs{
  grid-column:1;grid-row:1;display:grid!important;grid-template-columns:1fr!important;
  grid-auto-rows:50px;align-content:start;gap:0;padding:57px 0 0;
  min-width:0;min-height:0;overflow-y:auto;overflow-x:hidden;
  border:0;border-right:1px solid #314252;
  background:#101a24;
}
.tabs .tab{
  display:flex;align-items:center;justify-content:center;min-height:50px;height:50px;
  padding:0;position:relative;color:#a7bac9;
  border:0;border-bottom:1px solid #283643;border-radius:0;
  background:transparent;box-shadow:none;
}
.tabs .tab::before{content:none!important;background:none!important}
.tabs .tab::after{content:'';position:absolute;top:9px;bottom:9px;left:0;width:3px;border-radius:0 3px 3px 0;background:transparent}
.tabs .tab:hover{background:#202e3a;color:#eef3f5}
.tabs .tab.active{background:linear-gradient(90deg,#253746,#1a2935);color:#eac66e;box-shadow:none}
.tabs .tab.active::after{background:#e4b950}
.tabs .tab .ui-tab-icon{display:block!important;position:static!important;flex:0 0 24px;width:24px;height:24px;overflow:visible;opacity:1;stroke:currentColor;fill:none;filter:none!important}
.tabs .tab:hover .ui-tab-icon{stroke:#fff}
.tabs .tab-text{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.sidebar .tab-panel{
  grid-column:2;grid-row:1;min-width:0;min-height:0;max-width:100%;
  overflow-x:hidden;overflow-y:auto;
  padding:18px 18px 26px;background:linear-gradient(180deg,#0d1620,#0a131b);
  box-sizing:border-box;
}
.sidebar .tab-panel.active{display:block;}
#tab-et83{container-type:inline-size;container-name:economy-panel}
#tab-et83 *,#tab-et83 *::before,#tab-et83 *::after{box-sizing:border-box}
#et83-dashboard,#et83-dashboard .et83-shell,#et83-dashboard .et83-main-grid,#et83-dashboard .et83-panel{min-width:0;max-width:100%}
#et83-dashboard .et83-shell{gap:12px}
#et83-dashboard .et83-head strong{font-size:25px;line-height:1.1;letter-spacing:-.01em}
#et83-dashboard .et83-note{overflow-wrap:anywhere}
#et83-dashboard .et83-main-grid{
  display:grid;grid-template-columns:minmax(245px,280px) minmax(0,1fr);
  gap:12px;align-items:start;
}
#et83-dashboard .et83-panel{padding:12px;border-radius:12px}
#et83-dashboard .et83-panel-rankings{position:static}
#et83-dashboard .et83-rankings{overflow-y:visible;max-height:none}
#et83-dashboard .et83-rank{padding:8px 10px;gap:5px}
#et83-dashboard .et83-rank-name{font-size:12px}
#et83-dashboard .et83-rank-name i{width:22px;height:22px;flex:0 0 22px}
#et83-dashboard .et83-rank-bar{height:5px}
#et83-dashboard .et83-hero{padding:11px 12px;gap:9px;margin-bottom:10px}
#et83-dashboard .et83-hero h3{font-size:19px;line-height:1.13;margin:5px 0 8px;overflow-wrap:anywhere}
#et83-dashboard .et83-hero-value{min-width:125px}
#et83-dashboard .et83-hero-value strong{font-size:25px}
#et83-dashboard .et83-hero-meta{gap:5px}
#et83-dashboard .et83-hero-meta span{font-size:11px;padding:4px 6px}
#et83-dashboard .et83-metrics{grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;margin:7px 0 10px}
#et83-dashboard .et83-metric-card{padding:9px 10px;border-radius:8px;min-height:80px}
#et83-dashboard .et83-metric-card strong{font-size:19px;margin-top:4px}
#et83-dashboard .et83-metric-card span{margin-top:5px;line-height:1.3}
#et83-dashboard .et83-subgrid{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
#et83-dashboard .et83-subgrid span{padding:7px 8px;gap:3px}
#et83-dashboard .et83-subgrid b{font-size:14px}
#et83-dashboard .et83-detail-grid{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px}
#et83-dashboard .et83-chart-wrap{padding:6px}
#et83-dashboard .et83-history>div{padding:6px 8px}
#et83-dashboard .et83-panel-detail>.et83-note{margin-top:8px}
@container economy-panel (max-width:780px){
  #et83-dashboard .et83-main-grid{grid-template-columns:minmax(0,1fr)}
  #et83-dashboard .et83-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}
  #et83-dashboard .et83-subgrid{grid-template-columns:repeat(2,minmax(0,1fr))}
  #et83-dashboard .et83-detail-grid{grid-template-columns:minmax(0,1fr)}
}
@container economy-panel (max-width:445px){
  #et83-dashboard .et83-head strong{font-size:20px}
  #et83-dashboard .et83-hero{display:block}
  #et83-dashboard .et83-hero-value{margin:8px 0 0;justify-items:start;border-left:0;border-top:1px solid rgba(98,121,136,.2);padding:8px 0 0}
  #et83-dashboard .et83-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:720px){
  .workspace{grid-template-columns:minmax(0,1fr)!important;grid-template-rows:minmax(0,1fr)!important}
  .sidebar{--et83-rail:54px;width:min(100vw,calc(100vw - 4px));grid-template-columns:var(--et83-rail) minmax(0,1fr)}
  .sidebar-toggle{width:40px;left:6px}
  .sidebar .tab-panel{padding:12px 10px 24px}
  .tabs{grid-auto-rows:46px;padding-top:55px}
  .tabs .tab{height:46px;min-height:46px}
}
@media(prefers-reduced-motion:reduce){.sidebar{transition:none}.sidebar-toggle::before{transition:none}}
