/* Dustline interface skin. */

:root,
:root[data-theme="light"] {
  /* classic 3D palette */
  --w9-face: #d4d0c8;
  --w9-hl: #ffffff;
  --w9-light: #dfdfdf;
  --w9-shadow: #808080;
  --w9-dark: #404040;
  --w9-title-a: #000080;
  --w9-title-b: #1084d0;
  --w9-title-txt: #ffffff;
  --w9-field: #ffffff;
  --w9-text: #000000;
  --w9-desktop: #008080;

  /* the four tokens the site uses everywhere but never defines */
  --gz-surface: #d4d0c8;
  --gz-surface-raised: #d4d0c8;
  --gz-ink: #000000;
  --gz-ink-muted: #404040;

  /* site tokens remapped to the 16 colour VGA palette */
  --gz-paper: #d4d0c8;
  --gz-graphite: #000000;
  --gz-rule: #808080;
  --gz-ochre: #000080;
  --gz-field: #ffffff;
  --gz-field-2: #d4d0c8;
  --gz-neutral: #808080;
  --gz-confirm: #008000;
  --gz-alert: #800000;

  --background: #d4d0c8;
  --surface: #d4d0c8;
  --surface-raised: #ffffff;
  --foreground: #000000;
  --muted: #000000;
  --muted-2: #404040;
  --border: #808080;
  --border-subtle: #808080;
  --accent: #000080;
  --accent-foreground: #ffffff;
  --radius-surface: 0px;
  --radius-control: 0px;

  /* actors: pure VGA hues so they stay apart on a grey basemap */
  --actor-state: #000080;
  --actor-iswap: #800000;
  --actor-jas: #808000;
  --actor-bandit: #800080;
  --actor-jnim: #008080;
  --actor-lakurawa: #ff0000;
  --actor-foreign: #404040;
  --actor-state-military: #000080;
  --actor-bandit-group: #800080;
  --actor-issp: #ff0000;
  --actor-other: #404040;

  --category-acquisition: #808000;
  --category-breakthrough: #008080;
  --category-setback: #800000;
  --category-partnership: #000080;

  --font-display: Tahoma, "MS Sans Serif", "Microsoft Sans Serif", sans-serif;
  --font-ui: Tahoma, "MS Sans Serif", "Microsoft Sans Serif", sans-serif;
  --font-ui-narrow: Tahoma, "MS Sans Serif", "Microsoft Sans Serif", sans-serif;
  --font-mono: "Courier New", "Lucida Console", monospace;
}

/* dark mode becomes the old High Contrast Black scheme */
:root[data-theme="dark"] {
  --w9-face: #000000;
  --w9-hl: #808080;
  --w9-light: #404040;
  --w9-shadow: #808080;
  --w9-dark: #ffffff;
  --w9-field: #000000;
  --w9-text: #ffffff;

  --gz-surface: #000000;
  --gz-surface-raised: #000000;
  --gz-ink: #ffffff;
  --gz-ink-muted: #c0c0c0;
  --gz-paper: #000000;
  --gz-graphite: #ffffff;
  --gz-rule: #ffffff;
  --gz-ochre: #00ffff;
  --background: #000000;
  --surface: #000000;
  --surface-raised: #000000;
  --foreground: #ffffff;
  --muted: #ffffff;
  --muted-2: #c0c0c0;
  --border: #ffffff;
  --border-subtle: #808080;
  --accent: #00ffff;
  --accent-foreground: #000000;

  --actor-state: #0000ff;
  --actor-iswap: #ff0000;
  --actor-jas: #ffff00;
  --actor-bandit: #ff00ff;
  --actor-jnim: #00ffff;
  --actor-lakurawa: #ff8000;
  --actor-foreign: #c0c0c0;
}

/* --------------------------------------------------------------------------
   1. de-modernise: no rounding, no shadows, no blur, no motion, one font
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  border-radius: 0 !important;
  box-shadow: none !important;
  text-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  transition: none !important;
  animation: none !important;
  letter-spacing: normal !important;
  font-family: Tahoma, "MS Sans Serif", "Microsoft Sans Serif", sans-serif !important;
}

[class*="font-mono"],
[class*="tabular"],
code, kbd, pre, samp {
  font-family: "Courier New", "Lucida Console", monospace !important;
}

html { background: var(--w9-face); }

body {
  background: var(--w9-face) !important;
  color: var(--w9-text) !important;
  font-size: 11px !important;
  line-height: 1.45 !important;
  height: 100vh !important;
  min-height: 0 !important;
  padding-bottom: 28px !important;
  box-sizing: border-box !important;
  overflow: auto !important;
}

h1, h2, h3, h4, h5, h6,
[class*="font-display"] {
  font-weight: 700 !important;
  color: var(--w9-text) !important;
}
h1 { font-size: 20px !important; }
h2 { font-size: 15px !important; }
h3 { font-size: 13px !important; }

a { color: #0000ee; }
a:visited { color: #551a8b; }
:root[data-theme="dark"] a { color: #00ffff; }

/* --------------------------------------------------------------------------
   2. 3D chrome: every ruled box becomes a raised panel
   -------------------------------------------------------------------------- */
[class*="border-[var(--gz-rule)]"],
[class*="border-border"],
.border {
  border: 2px outset var(--w9-face) !important;
  background-color: var(--w9-face);
}

[class*="bg-[var(--gz-surface)]"],
[class*="bg-surface"] {
  background-color: var(--w9-face) !important;
  color: var(--w9-text) !important;
}

/* raised bits that are not headers: plain grey face */
[class*="bg-[var(--gz-surface-raised)]"] {
  background-color: var(--w9-face) !important;
  color: var(--w9-text) !important;
}

/* only a ruled-off header row becomes a title bar */
[class*="border-b"][class*="bg-[var(--gz-surface-raised)]"] {
  background: linear-gradient(90deg, var(--w9-title-a), var(--w9-title-b)) !important;
  color: var(--w9-title-txt) !important;
  border: 0 !important;
  padding: 2px 5px !important;
  min-height: 18px;
}
[class*="border-b"][class*="bg-[var(--gz-surface-raised)]"] * {
  color: var(--w9-title-txt) !important;
  font-weight: 700 !important;
}

/* selected list rows: pressed, not painted */
[class*="border-l-[var(--gz-ochre)]"],
[class*="border-l-2"][class*="bg-[var(--gz-surface-raised)]"] {
  border: 2px inset var(--w9-face) !important;
  background-color: var(--w9-light) !important;
  color: var(--w9-text) !important;
  font-weight: 700 !important;
}

/* --------------------------------------------------------------------------
   3. controls
   -------------------------------------------------------------------------- */
button,
[role="button"],
.maplibregl-ctrl button {
  background: var(--w9-face) !important;
  color: var(--w9-text) !important;
  border: 2px outset var(--w9-face) !important;
  padding: 1px 6px !important;
  font-size: 11px !important;
  min-height: 18px;
  cursor: default !important;
}
button:active,
[role="button"]:active,
button[aria-pressed="true"],
button[data-state="active"] {
  border-style: inset !important;
}
button:focus-visible { outline: 1px dotted var(--w9-text) !important; outline-offset: -4px; }

input, select, textarea {
  background: var(--w9-field) !important;
  color: var(--w9-text) !important;
  border: 2px inset var(--w9-face) !important;
  font-size: 11px !important;
  padding: 1px 3px !important;
}
input[type="checkbox"], input[type="radio"] {
  accent-color: var(--w9-title-a);
  width: 13px; height: 13px;
  border: 0 !important;
}
input[type="range"] { accent-color: var(--w9-title-a); }

::selection { background: #000080; color: #ffffff; }

/* --------------------------------------------------------------------------
   4. site header becomes a window title bar plus a menu bar
   -------------------------------------------------------------------------- */
header { position: relative !important; background: var(--w9-face) !important; border: 0 !important; }
header > div {
  flex-wrap: wrap !important;
  max-width: none !important;
  padding: 0 !important;
  gap: 0 !important;
}
header > div > a:first-child {
  width: 100%;
  background: linear-gradient(90deg, var(--w9-title-a), var(--w9-title-b)) !important;
  padding: 2px 4px !important;
  margin: 0 !important;
  border: 0 !important;
}
header > div > a:first-child span {
  color: #ffffff !important;
  font-size: 12px !important;
  font-weight: 700 !important;
}

/* decorative minimise / maximise / close */
header::after {
  content: "_ \25A1   \2715";
  position: absolute;
  top: 3px; right: 4px;
  z-index: 5;
  background: var(--w9-face);
  border: 2px outset var(--w9-face);
  padding: 0 4px;
  font: 700 10px Tahoma, sans-serif;
  color: #000000;
  letter-spacing: 3px !important;
  pointer-events: none;
}

header nav {
  width: 100%;
  background: var(--w9-face) !important;
  border-top: 1px solid var(--w9-hl) !important;
  border-bottom: 2px groove var(--w9-face) !important;
  padding: 1px 2px !important;
  gap: 0 !important;
}
header nav a {
  color: var(--w9-text) !important;
  padding: 2px 8px !important;
  font-size: 11px !important;
}
header nav a:hover { background: #000080 !important; color: #ffffff !important; }
header nav [class*="bg-[var(--gz-ochre)]"] { background: #000080 !important; }

/* top notice and footer become toolbars */
aside[role="region"],
footer {
  background: var(--w9-face) !important;
  color: var(--w9-text) !important;
  font-size: 11px !important;
  padding: 2px 4px !important;
}
aside[role="region"] { border-bottom: 2px groove var(--w9-face) !important; border-top: 0 !important; }
footer { border-top: 2px groove var(--w9-face) !important; }

[class*="border-[var(--gz-ochre)]"] {
  border: 2px outset var(--w9-face) !important;
  color: var(--w9-text) !important;
  background: var(--w9-face) !important;
}

/* --------------------------------------------------------------------------
   5. map furniture
   -------------------------------------------------------------------------- */
.maplibregl-ctrl-group,
.maplibregl-ctrl-attrib {
  background: var(--w9-face) !important;
  border: 2px outset var(--w9-face) !important;
  color: #000000 !important;
  font-size: 10px !important;
}
.maplibregl-ctrl-group button { border: 2px outset var(--w9-face) !important; margin: 1px; }
.maplibregl-popup-content {
  background: var(--w9-face) !important;
  border: 2px outset var(--w9-face) !important;
  color: #000000 !important;
  padding: 4px 6px !important;
}

/* the incident drawer sits above the floating stat boxes */
[class*="inset-y-0"][class*="right-0"][class*="z-40"] {
  background: var(--w9-face) !important;
  border-left: 2px outset var(--w9-face) !important;
  z-index: 60 !important;
}

/* --------------------------------------------------------------------------
   6. scrollbars
   -------------------------------------------------------------------------- */
::-webkit-scrollbar { width: 16px; height: 16px; }
::-webkit-scrollbar-track {
  background-color: #ffffff;
  background-image: repeating-conic-gradient(var(--w9-face) 0% 25%, #ffffff 0% 50%);
  background-size: 4px 4px;
}
::-webkit-scrollbar-thumb { background: var(--w9-face); border: 2px outset var(--w9-face); }
::-webkit-scrollbar-button:single-button {
  background: var(--w9-face);
  border: 2px outset var(--w9-face);
  height: 16px; width: 16px;
  display: block;
}
::-webkit-scrollbar-corner { background: var(--w9-face); }

/* --------------------------------------------------------------------------
   7. taskbar, built by win9x.js
   -------------------------------------------------------------------------- */
#w9-taskbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 28px;
  z-index: 999999;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 3px;
  background: #d4d0c8;
  border-top: 2px outset #d4d0c8;
  font: 11px Tahoma, sans-serif;
  color: #000000;
  box-sizing: border-box;
}
#w9-start {
  display: flex; align-items: center; gap: 4px;
  font-weight: 700; font-size: 11px;
  padding: 1px 6px 1px 3px;
  background: #d4d0c8;
  border: 2px outset #d4d0c8;
  cursor: default;
  color: #000000;
}
#w9-start[aria-expanded="true"] { border-style: inset; }
#w9-tasks { display: flex; gap: 3px; flex: 1; overflow: hidden; }
#w9-tasks a {
  display: block;
  max-width: 160px;
  padding: 2px 8px;
  border: 2px outset #d4d0c8;
  background: #d4d0c8;
  color: #000000 !important;
  text-decoration: none !important;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#w9-tasks a.w9-active { border-style: inset; font-weight: 700; }
#w9-tray {
  display: flex; align-items: center; gap: 6px;
  padding: 1px 8px;
  border: 2px inset #d4d0c8;
  font-size: 11px;
  color: #000000;
}
#w9-menu {
  position: fixed;
  left: 3px; bottom: 28px;
  z-index: 999999;
  width: 200px;
  background: #d4d0c8;
  border: 2px outset #d4d0c8;
  padding: 2px;
  display: none;
}
#w9-menu.w9-open { display: block; }
#w9-menu .w9-band {
  position: absolute; left: 2px; top: 2px; bottom: 2px; width: 22px;
  background: linear-gradient(0deg, #1084d0, #000080);
  overflow: hidden;
}
#w9-menu .w9-band span {
  position: absolute; bottom: 8px; left: 4px;
  transform: rotate(-90deg); transform-origin: left bottom;
  white-space: nowrap;
  color: #ffffff; font: 700 13px Tahoma, sans-serif;
}
#w9-menu ul { margin: 0 0 0 24px; padding: 0; list-style: none; }
#w9-menu a {
  display: block;
  padding: 5px 10px;
  color: #000000 !important;
  text-decoration: none !important;
  font-size: 11px;
}
#w9-menu a:hover { background: #000080; color: #ffffff !important; }
#w9-menu hr { margin: 2px 0; border: 0; border-top: 1px solid #808080; border-bottom: 1px solid #ffffff; }

/* --------------------------------------------------------------------------
   8. red risk zones (risk.js): list section in the map panel, and pop-ups
   -------------------------------------------------------------------------- */
#w9-risk-list {
  margin-top: 6px;
  padding: 4px 6px 6px;
  border-top: 2px groove #d4d0c8;
  font: 11px Tahoma, sans-serif;
  color: #000;
}
#w9-risk-list .w9-risk-head {
  margin: 0 -6px 4px;
  padding: 2px 6px;
  background: linear-gradient(90deg, #800000, #d00000);
  color: #fff;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 1px !important;
}
#w9-risk-list .w9-risk-row { display: flex; align-items: center; gap: 5px; padding: 1px 0; cursor: default; }
#w9-risk-list .w9-risk-row input { accent-color: #b00000; margin: 0; }
#w9-risk-list .w9-risk-legend { display: flex; align-items: center; gap: 4px; margin: 4px 0; font-size: 10px; }
#w9-risk-list .w9-risk-legend i,
#w9-risk-list .w9-risk-item i { display: inline-block; width: 9px; height: 9px; border: 1px solid #000; flex: none; }
#w9-risk-list .w9-risk-items {
  max-height: 230px;
  overflow-y: auto;
  background: #fff;
  border: 2px inset #d4d0c8;
}
#w9-risk-list .w9-risk-item {
  display: flex !important;
  align-items: center;
  gap: 5px;
  width: 100%;
  min-height: 0 !important;
  padding: 2px 4px !important;
  border: 0 !important;
  background: #fff !important;
  text-align: left;
  font-size: 11px !important;
}
#w9-risk-list .w9-risk-item:hover { background: #800000 !important; color: #fff !important; }
#w9-risk-list .w9-risk-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#w9-risk-list .w9-risk-n { font-family: "Courier New", monospace !important; font-size: 10px; opacity: .75; }
#w9-risk-list .w9-risk-foot { margin-top: 4px; font-size: 10px; }
#w9-risk-list .w9-risk-foot a { color: #0000ee; }

.w9-risk-pop { font: 11px/1.45 Tahoma, sans-serif; color: #000; }
.w9-risk-pop .w9-risk-title {
  margin: -4px -6px 5px;
  padding: 3px 22px 3px 6px;
  background: linear-gradient(90deg, #800000, #d00000);
  color: #fff;
  font-weight: 700;
}
.w9-risk-pop .w9-risk-meta { margin-bottom: 4px; font-size: 10px; }
.w9-risk-pop p { margin: 4px 0; }
.w9-risk-pop .w9-risk-caveat { padding: 4px 5px; background: #fff; border: 2px inset #d4d0c8; font-size: 10px; }
.w9-risk-pop ul { margin: 4px 0 0; padding-left: 14px; font-size: 10px; }
.w9-risk-pop a { color: #0000ee; }
.maplibregl-popup-close-button { color: #fff !important; background: transparent !important; border: 0 !important; min-height: 0 !important; padding: 0 5px !important; font-size: 14px !important; }

/* --------------------------------------------------------------------------
   9. cleaner red zones: grouped list, area labels, coordinates
   -------------------------------------------------------------------------- */
#w9-risk-list .w9-risk-head-blue { background: linear-gradient(90deg, #000080, #1084d0); margin-top: 8px; }
#w9-risk-list .w9-risk-group { margin: 3px 0; }
#w9-risk-list .w9-risk-group-head { display: flex; align-items: center; gap: 4px; }
#w9-risk-list .w9-risk-group-head input { accent-color: #b00000; margin: 0; }
#w9-risk-list .w9-risk-fold {
  flex: 1;
  text-align: left;
  min-height: 0 !important;
  padding: 1px 3px !important;
  border: 0 !important;
  background: transparent !important;
  font-size: 11px !important;
  font-weight: 700;
}
#w9-risk-list .w9-risk-fold span { font-weight: 400; opacity: .7; }
#w9-risk-list .w9-risk-items { max-height: 190px; margin: 2px 0 4px 17px; }
#w9-risk-list .w9-risk-name small {
  display: block;
  font-family: "Courier New", monospace !important;
  font-size: 9px;
  opacity: .65;
}
#w9-risk-list .w9-risk-item { align-items: flex-start; }
#w9-risk-list .w9-risk-item i { margin-top: 2px; }

.w9-zone-label {
  padding: 1px 5px;
  background: rgba(255, 255, 255, .88);
  border: 1px solid #9a0000;
  color: #7a0000;
  font: 700 10px Tahoma, sans-serif;
  white-space: nowrap;
  pointer-events: auto;
  cursor: pointer;
}
.w9-zone-label-2 { border-color: #d00000; color: #a00000; font-weight: 400; }

#w9-coords {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 5;
  padding: 1px 6px;
  background: #d4d0c8;
  border: 2px inset #d4d0c8;
  font: 10px "Courier New", monospace;
  color: #000;
  pointer-events: none;
}

.w9-risk-pop .w9-risk-title-blue { background: linear-gradient(90deg, #000080, #1084d0); }
.w9-risk-pop .w9-coord {
  margin: 3px 0 5px;
  padding: 3px 5px;
  background: #fff;
  border: 2px inset #d4d0c8;
  font-size: 10px;
}
.w9-risk-pop .w9-coord-dec { font-family: "Courier New", monospace; color: #404040; }
.w9-risk-pop .w9-copy {
  min-height: 0 !important;
  padding: 0 5px !important;
  font-size: 9px !important;
  margin-left: 4px;
}

/* coordinate readout moved clear of the timeline window; pop-up block tidied */
#w9-coords { left: 50%; bottom: 10px; transform: translateX(-50%); }
.w9-risk-pop .w9-coord-head { font-weight: 700; margin-bottom: 1px; }
.w9-risk-pop .w9-coord-head span { font-weight: 400; color: #404040; }
.w9-risk-pop .w9-coord-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.w9-risk-pop .w9-coord-dms { font-family: "Courier New", monospace; }

/* ACLED layer: year control and figures table */
#w9-risk-list .w9-risk-year { display: flex; align-items: center; gap: 4px; margin: 3px 0 2px; font-size: 10px; }
#w9-risk-list .w9-risk-year span { min-width: 78px; }
#w9-risk-list .w9-risk-year input[type="range"] { flex: 1; min-width: 60px; accent-color: #9a0000; }
#w9-risk-list .w9-copy, .w9-risk-pop .w9-copy { min-height: 0 !important; padding: 0 5px !important; font-size: 9px !important; }
.w9-risk-pop .w9-risk-table { width: 100%; border-collapse: collapse; margin: 3px 0; font-size: 10px; }
.w9-risk-pop .w9-risk-table td { padding: 1px 3px; border-bottom: 1px solid #e0ddd6; }
.w9-risk-pop .w9-risk-table td + td { text-align: right; font-family: "Courier New", monospace; }

/* map tools: route check launcher, offline basemap switch */
#w9-tools { display: flex; flex-direction: column; gap: 3px; margin-top: 6px !important; background: transparent !important; border: 0 !important; }
#w9-tools button { min-width: 92px; font-size: 11px !important; }
#w9-bm-note {
  position: absolute; right: 8px; bottom: 26px; z-index: 5; display: none;
  padding: 1px 5px; background: rgba(212, 208, 200, .92); border: 1px solid #808080;
  font: 9px Tahoma, sans-serif; color: #404040; pointer-events: none;
}
.w9-bm-label { font: 10px Tahoma, sans-serif; color: #303030; white-space: nowrap; pointer-events: none;
  text-shadow: 0 0 2px #fff, 0 0 2px #fff !important; }
.w9-bm-label::before { content: ''; display: inline-block; width: 4px; height: 4px; margin-right: 3px; background: #303030; vertical-align: middle; }
.w9-bm-label-foreign { color: #707070; }

/* route check window */
#w9-route {
  position: fixed; top: 110px; right: 64px; z-index: 3000; width: 340px; max-height: calc(100vh - 170px);
  font: 11px Tahoma, sans-serif; color: #000;
}
#w9-route .w9-route-body { padding: 6px; overflow-y: auto; }
#w9-route .w9-route-row { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
#w9-route .w9-route-row label { width: 34px; }
#w9-route .w9-route-btns { display: flex; gap: 4px; margin: 6px 0; }
#w9-route .w9-route-sum { margin-bottom: 3px; }
#w9-route .w9-route-bar { display: flex; height: 11px; margin: 3px 0 5px; border: 2px inset #d4d0c8; background: #fff; }
#w9-route .w9-route-bar i { display: block; height: 100%; }
#w9-route .w9-route-lgas ul { margin: 2px 0 0; padding: 0; list-style: none; max-height: 150px; overflow-y: auto; background: #fff; border: 2px inset #d4d0c8; }
#w9-route .w9-route-lgas li { display: flex; align-items: center; gap: 5px; padding: 1px 4px; }
#w9-route .w9-route-lgas li i { width: 8px; height: 8px; border: 1px solid #000; flex: none; }
#w9-route .w9-route-lgas li span { margin-left: auto; font-family: "Courier New", monospace; font-size: 10px; }
#w9-route .w9-route-areas { margin-bottom: 4px; }
#w9-route .w9-route-note { font-size: 10px; color: #404040; }
#w9-route .w9-route-caveat { margin-top: 6px; padding: 4px 5px; font-size: 9px; background: #fff; border: 2px inset #d4d0c8; }
#w9-route .w9-route-legend { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; font-size: 10px; }
#w9-route .w9-route-key { display: inline-block; width: 22px; height: 0; border-top: 3px dashed #800000; }
#w9-route .w9-route-key-safe { border-top: 3px solid #000080; }
.w9-route-pin {
  padding: 0 4px; background: #000080; color: #fff; border: 2px solid #fff;
  font: 700 11px Tahoma, sans-serif; box-shadow: none;
}
#w9-route { right: 112px; }
