:root {
  --on-primary: #fff;
  --success-bg: #eaf4ed; --warning-bg: #faf0df; --danger-bg: #fbedef;
  --map-bg: #edf0f4; --map-surface: #f5f6f8; --overlay: rgba(255,255,255,.97);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --gray-50: #20242a; --gray-100: #30353d; --gray-200: #3a4049; --gray-300: #555c67;
  --gray-400: #89919e; --gray-500: #b0b4bc; --gray-600: #c2c6ce;
  --gray-700: #d8dbe1; --gray-800: #e7e9ed; --gray-900: #f4f5f7;
  --blue-500: #81b4ff; --blue-600: #a6cbff; --light-blue: #253751;
  --green-700: #8dd8a7; --yellow-700: #ebc07c; --red-700: #f594a1;
  --bg: #191c21; --surface: #24282e; --on-primary: #152238;
  --success-bg: #263d30; --warning-bg: #403729; --danger-bg: #442c33;
  --map-bg: #1a1d22; --map-surface: #202328; --overlay: rgba(30,32,36,.97);
}
html { background: var(--bg); }
input,select,textarea { color: var(--text); }
option { background: var(--surface); color: var(--text); }
#theme-toggle { flex: 0 0 44px; font-size: 24px; line-height: 1; }
#toast { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.leaflet-container { background: var(--map-bg); color: var(--text); }
.leaflet-bar a,.leaflet-bar a:hover,.leaflet-popup-content-wrapper,.leaflet-popup-tip,.leaflet-tooltip {
  background: var(--surface); color: var(--text); border-color: var(--border);
}
.leaflet-container a.leaflet-popup-close-button { color: var(--text); }
.leaflet-control-attribution { background: var(--surface); color: var(--text); }
.wos-map-tooltip { background: var(--surface); border-color: var(--border); color: var(--text); }
.wos-map-tooltip strong { color: var(--text); }
.wos-map-tooltip span { color: var(--muted); }
.placement-city small,.placement-building small { color: var(--text); -webkit-text-stroke-color: var(--map-surface); text-shadow: none; }
.placement-name-tooltip { background: var(--surface); color: var(--text); border-color: var(--border); }
.placement-name-tooltip.leaflet-tooltip-top::before { border-top-color: var(--border); }
.placement-coordinate { background: var(--overlay); color: var(--muted); }
.alliance-chart svg line { stroke: var(--primary); }
.alliance-chart svg circle { fill: var(--primary); }
@media(max-width:760px) { .page-header { gap: 8px; } .top-actions { gap: 2px; } }

/* Color transitions would briefly mix palettes during a mode switch. */
:root .nav,:root .button,:root .section-link,:root .icon-btn { transition: none; }
