:root {
  color-scheme: dark;
  --font: Arial, sans-serif;
  --text: 14px;
  --title: 18px;
  --background: #05070c;
  --surface: #0c1420;
  --ink: #e6edf3;
  --muted: #adb8c8;
  --accent: #cba978;
  --border: #354252;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--background); color: var(--ink); font: var(--text)/1.5 var(--font); }
button, input { font: inherit; color: inherit; }
button, a, input { touch-action: manipulation; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button { cursor: pointer; }
button:disabled { opacity: .6; cursor: default; }
a { color: var(--ink); text-underline-offset: 3px; }
h1, h2 { font-size: var(--title); margin: 0; line-height: 1.4; }
h3, h4 { font-size: var(--text); margin: 0 0 10px; }
[hidden] { display: none !important; }
#g { position: fixed; inset: 0; }
.ov { position: fixed; z-index: 5; }
#brand { top: 16px; left: 20px; max-width: calc(100vw - 140px); pointer-events: none; background: var(--background); box-shadow: 0 0 12px 10px var(--background); }
#brand h1 { font-weight: 700; }
#brand .chips { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; }
.chip { color: var(--muted); }
.chip b, .chip span { color: var(--ink); }
.search { pointer-events: auto; margin-top: 12px; width: min(320px, calc(100vw - 40px)); position: relative; }
#entity-search { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
#entity-search::placeholder { color: var(--muted); opacity: 1; }
#search-results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; max-height: 45vh; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 4px; }
#search-results button { display: block; text-align: start; border: 0; width: 100%; padding: 8px; border-radius: 3px; background: none; overflow-wrap: anywhere; }
#search-results button:hover, #search-results button[aria-selected=true] { background: #233044; }
.search-count { color: var(--muted); padding: 5px 8px; }
#load-status { color: var(--muted); margin-top: 6px; max-width: 540px; }
#load-status:empty { display: none; }
#info { top: 20px; right: 20px; }
.btn { border: 1px solid var(--border); background: var(--surface); padding: 8px 12px; border-radius: 6px; }
.btn:hover { background: #1a2637; }
.btn[aria-pressed=true] { border-color: var(--accent); color: var(--accent); }
#panel, #card, #dpanel { border: 1px solid var(--border); border-radius: 8px; background: rgba(12,20,32,.98); padding: 16px; overflow: auto; overflow-wrap: anywhere; display: none; }
#panel { top: 66px; right: 20px; width: min(370px, calc(100vw - 40px)); max-height: calc(100vh - 90px); }
#panel ul { padding-left: 20px; }
#panel li { margin-bottom: 10px; color: var(--muted); }
#panel dl { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
#panel dt { color: var(--muted); }
#panel dd { margin: 0; }
#selected-evidence { margin: 14px 0; border-bottom: 1px solid var(--border); }
#selected-evidence:empty { display: none; }
.scale { position: fixed; left: 20px; bottom: 78px; color: var(--muted); pointer-events: none; background: var(--surface); padding: 4px 8px; border: 1px solid var(--border); border-radius: 4px; }
.scale i { display: inline-block; width: 42px; height: 5px; margin: 0 6px; vertical-align: middle; background: linear-gradient(90deg,#3fb950,#d29922,#f85149); }
#cc { left: 20px; bottom: 20px; display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 40px); }
#ccline { color: var(--muted); max-width: 420px; opacity: 0; }
#ccline b { color: var(--ink); }
#dpanel { left: 20px; bottom: 68px; width: min(370px, calc(100vw - 40px)); max-height: 55vh; }
.deal { padding: 10px 8px; border-radius: 4px; cursor: pointer; }
.deal:hover { background: #233044; }
.deal .dl { color: var(--ink); }
.deal .dwhy { display: block; color: var(--muted); margin-top: 3px; }
#card { right: 20px; bottom: 20px; width: min(350px, calc(100vw - 40px)); max-height: 65vh; }
#card .nm { font-size: var(--title); font-weight: 700; }
#card .ty { color: var(--muted); margin: 2px 0 10px; }
#card .card-metrics { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin: 12px 0; }
#card .card-metrics > div { border-left: 2px solid var(--border); padding-left: 10px; min-width: 0; }
#card .card-metrics dt, #card .card-metrics span { color: var(--muted); }
#card .card-metrics span { display: block; }
#card .card-metrics dd { font-size: var(--title); margin: 2px 0; }
#card .card-notes { padding-left: 18px; margin: 10px 0; }
#card .card-notes li { margin: 6px 0; }
#card .fl { color: var(--muted); margin-top: 4px; }
#card .cps { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
#card .cpc { border: 1px solid var(--border); border-radius: 4px; background: transparent; padding: 3px 7px; text-align: start; overflow-wrap: anywhere; }
#card .cpc:hover { border-color: var(--accent); }
#card .bdg { display: inline-block; color: var(--muted); margin: 0 8px 6px 0; }
#card details { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 14px; }
#card summary { cursor: pointer; }
.facility-list { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 14px; }
.facility-list summary { cursor: pointer; }
.facility-case { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 10px; }
.facility-case p { margin: 8px 0; }
.connection { display: block; border: 0; border-bottom: 1px solid var(--border); background: transparent; width: 100%; text-align: start; padding: 8px 0; overflow-wrap: anywhere; content-visibility: auto; contain-intrinsic-size: auto 38px; }
.connection:hover { color: var(--accent); }
.scene-container .scene-tooltip { font-family: var(--font) !important; font-size: var(--text) !important; color: var(--ink) !important; background: var(--surface) !important; max-width: 320px; white-space: normal !important; overflow-wrap: anywhere; padding: 6px 8px; border-radius: 4px; }
.scene-container .scene-tooltip:empty { display: none !important; }
.scene-container .scene-loading-msg, .scene-container .scene-nav-info, .graph-info-msg { font-family: var(--font) !important; font-size: var(--text) !important; }
.graph-info-msg:empty { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 700px) {
  #brand { left: 12px; top: 12px; max-width: calc(100vw - 110px); }
  #brand .chips { gap: 2px 12px; }
  #info { right: 12px; top: 12px; }
  #panel { right: 12px; top: 58px; max-height: calc(100vh - 82px); }
  #cc { left: 12px; bottom: 12px; align-items: flex-end; flex-wrap: wrap; }
  #ccline { flex-basis: 100%; max-width: calc(100vw - 24px); }
  .scale { left: 12px; bottom: 70px; }
  #card { right: 12px; bottom: 66px; max-height: 48vh; }
  #dpanel { left: 12px; bottom: 66px; max-height: 48vh; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
