:root {
  --panel-w: 320px;
  --bg: #1c1f24;
  --bg-soft: #262b32;
  --fg: #e8eaed;
  --fg-dim: #9aa3ad;
  --accent: #e07b39;
  --warn: #c62828;
  --ok: #2e7d32;
  --border: #363c45;
  /* Estados de la población en los gráficos del panel. Mismos tonos que las
     figuras del mapa, un paso más oscuros para el fondo del panel: validados
     con el validador de paletas (banda de luminosidad, croma, separación para
     daltonismo y contraste ≥ 3:1 contra --bg). «Sin alertar» es el gris de
     contexto, fuera de la paleta categórica. */
  --st-normal: #64748b;
  --st-alert: #d97706;
  --st-evacuating: #2563eb;
  --st-safe: #16a34a;
  --st-trapped: #8b5cf6;
  --st-affected: #ef4444;
  --grid: #2c323a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
}

#app { display: flex; height: 100vh; position: relative; }
#map { flex: 1; height: 100%; background: #0f1114; }
/* Aviso de que el mapa no partió: centrado en el lugar del mapa (ahí lo lleva el visor al fallar). */
#map.failed { position: relative; }
.map-failure { position: absolute; inset: 0; z-index: 1002; width: min(380px, calc(100% - 32px)); height: fit-content;
  margin: auto; padding: 16px 18px; border: 1px solid #8a4a4a; border-radius: 10px; background: rgba(28, 31, 36, .97);
  color: var(--fg); font-size: 13px; line-height: 1.45; text-align: center; }
.map-failure[hidden] { display: none; }
.map-failure strong { display: block; margin-bottom: 6px; color: #ffb4b4; font-size: 15px; }
.map-failure p { margin: 0; }

/* ---------------- Panel lateral ---------------- */

#panel {
  width: var(--panel-w);
  flex: 0 0 var(--panel-w);
  background: var(--bg);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px;
  font-size: 13px;
}

#panel h1 { font-size: 16px; margin: 0; letter-spacing: .2px; }
#panel h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
  margin: 20px 0 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 5px;
}
.subtitle { margin: 2px 0 10px; color: var(--fg-dim); font-size: 12px; }

.warning {
  background: rgba(198, 40, 40, .14);
  border-left: 3px solid var(--warn);
  padding: 8px 10px;
  margin: 0 0 14px;
  font-size: 11px;
  line-height: 1.45;
  color: #f0c9c9;
}

.step-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-soft);
  border-radius: 6px;
}
.step-line > span:first-child {
  color: var(--fg-dim);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: .08em;
}
.big { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.badge {
  margin-left: auto;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 10px;
  background: #3a4048;
  letter-spacing: .06em;
}
.badge.running { background: var(--ok); }
.badge.paused  { background: #a1690e; }
.badge.finished { background: #4a3a6b; }

.connection-status {
  margin: 8px 0;
  padding: 7px 9px;
  border-radius: 5px;
  font-size: 11px;
  line-height: 1.4;
  background: var(--bg-soft);
  color: #ffd180;
}
.connection-status[data-state="live"] { color: #a5d6a7; }
.connection-status[data-state="polling"] { color: #90caf9; }
.connection-status[data-state="map"] { color: #8ae5d4; }
.connection-status[data-state="offline"],
.connection-status[data-state="auth"] { color: #ffb4b4; }
.control-feedback { margin: 6px 0; font-size: 11px; line-height: 1.4; color: #d7dce3; }
.control-feedback:empty { display: none; }

.cartography-mode .simulation-only { display: none !important; }
.cartography-only { display: none; }
.cartography-mode .cartography-only { display: inline-flex; }
.cartography-card[hidden], #cartography-legend[hidden] { display: none; }
.cartography-card { margin-top: 22px; }
.cartography-eyebrow { display: block; color: #8ae5d4; font-size: 10px;
  text-transform: uppercase; letter-spacing: .12em; }
#panel .cartography-card h2 { margin: 8px 0 12px; font-size: 21px;
  text-transform: none; letter-spacing: -.02em; color: #edf6f3;
  line-height: 1.25; border: 0; }
.cartography-intro { color: #bec9ca; font-size: 13px; line-height: 1.6; }
.cartography-card dl { margin: 22px 0; gap: 11px 10px; font-size: 12px; }
.cartography-scope { padding: 12px; background: #263938;
  border-left: 2px solid #78bfaf; border-radius: 3px;
  font-size: 12px; line-height: 1.6; color: #cce6e0; }
.cartography-card .note, #cartography-legend .note { color: #a5b3b9; }
.cartography-mode #stamp { border-color: #589d90; }
.cartography-mode #stamp strong { color: #a2e6d7; }
.cartography-mode .fp-simulation button { display: none; }
.cartography-mode #area-select { max-width: min(320px, 70vw); }
.cartography-simulation { margin: 17px 0 20px; }
#btn-simulate-hospicio { width: 100%; padding: 11px 14px; border: 1px solid #80d4bd;
  border-radius: 6px; background: #80d4bd; color: #142c29; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 650; }
#btn-simulate-hospicio:hover { background: #a4e4d2; }
#btn-simulate-hospicio:disabled { cursor: default; opacity: .45; }
#btn-simulate-hospicio:focus-visible { outline: 2px solid #e6f9f3; outline-offset: 3px; }
#hospicio-scenario-status { margin: 8px 0 0; color: #bbc9cb; font-size: 11px; line-height: 1.5; }
.scenario-note { margin: 10px 0 14px; padding: 9px 11px; color: #f6d3a0;
  background: #3a3026; border-left: 2px solid #ffb74d; font-size: 11px; line-height: 1.5; }
.scenario-note[hidden], #hospicio-domain-legend[hidden] { display: none; }
/* El barro no puede salir de su punto de inicio (simulation/flow_start.py). */
.flow-start-note { margin: 8px 0 10px; padding: 9px 11px; color: #f6d3a0; background: #3a2a22;
  border-left: 3px solid #ff8a50; font-size: 11.5px; line-height: 1.5; }
.flow-start-note strong { display: block; margin-bottom: 2px; color: #ffd0b0; font-size: 12px; }
.flow-start-note[hidden] { display: none; }
#chanaral-profile { color: #a2e4df; font-size: 12px; }
#chanaral-profile[hidden] { display: none; }
#measurements-2015-control { display: flex; align-items: center; gap: 6px; margin: 9px 0;
  color: var(--fg); font-size: 12px; cursor: pointer; }
#measurements-2015-control[hidden] { display: none; }
#measurements-2015-control input { accent-color: #cf85c3; margin: 0; }
.street-inspector { margin: 8px 0 12px; }
#inspect-toggle { width: 100%; text-align: left; }
#inspect-toggle[aria-expanded=true] { border-color: #69d5cc; }
#inspect-panel { margin: 6px 0 12px; padding: 10px 12px; border-left: 2px solid #69d5cc; background: var(--bg-soft); }
#inspect-panel h3 { margin: 4px 0 8px; color: var(--fg); font-size: 15px; }
#inspect-panel h4, #inspect-panel figcaption { margin: 10px 0 3px; color: #a2e4df; font-size: 12px; }
#inspect-panel dl { margin: 7px 0; }
#inspect-panel dd { font-variant-numeric: tabular-nums; }
#inspect-panel figure { margin: 10px 0 0; }
#inspect-profile { display: block; width: 100%; color: #a2e4df; }
#inspect-profile[hidden], #inspect-details[hidden], #inspect-panel[hidden] { display: none; }
#inspect-panel .note { margin: 5px 0; }
#inspect-destinations, #inspect-assigned-list { padding-left: 16px; font-size: 12px; }
.inspect-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.inspect-endpoint { display: grid; place-items: center; width: 19px; height: 19px; border-radius: 50%; background: #a4f3ec;
  color: #093932; border: 2px solid #12443f; font: bold 11px/1 sans-serif; pointer-events: none; }
.inspecting-street #map canvas { cursor: crosshair; }
.official-reference[hidden], #legend li[hidden] { display: none; }
.official-reference { margin: 12px 0; padding: 12px; border: 1px solid #456362;
  border-radius: 7px; background: #233333; font-size: 11px; }
.official-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #b8ece3; }
.official-heading button { background: #354d4b; color: #e5f7f3; border: 1px solid #5e8178;
  border-radius: 4px; padding: 4px 8px; cursor: pointer; font-size: 10px; }
.official-reference p { margin: 8px 0; line-height: 1.5; }
.official-reference label { display: block; margin-bottom: 5px; color: #d5e0dc; }
#official-point-select, #source-select, #reference-event-filter { width: 100%; min-width: 0; background: #1d282b; color: #eef6f4;
  border: 1px solid #5e8178; padding: 6px; border-radius: 4px; font-size: 11px; }
.official-note { color: #b3c6c1; font-size: 10px; }
.reference-options { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 10px 0; }
.official-reference .reference-options label { display: flex; align-items: center; gap: 5px; margin: 0; }
.reference-options input { width: auto; margin: 0; accent-color: #76c5ff; }
#reference-event-filter { margin-bottom: 2px; }
.official-popup .maplibregl-popup-content { background: #1d2a2c; color: #eaf4f1;
  border: 1px solid #71958b; padding: 16px; border-radius: 8px; font-size: 12px; }
.official-popup .maplibregl-popup-close-button { color: #eaf4f1; padding: 2px 6px; }
.official-popup p { margin: 7px 0; line-height: 1.45; }
.official-popup a { color: #98e5d8; }
.official-popup small { color: #c8d2ce; }

dl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 12px;
  margin: 0;
}
dt { color: var(--fg-dim); }
dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
dt.pending { color: #7f8791; }
/* Punto de color que enlaza cada fila del panel con su símbolo en el mapa */
.k { display: inline-block; width: 8px; height: 8px; border-radius: 50%;
     margin-right: 6px; vertical-align: middle; }

.st-normal { background: var(--st-normal); }
.st-alert { background: var(--st-alert); }
.st-evacuating { background: var(--st-evacuating); }
.st-safe { background: var(--st-safe); }
.st-trapped { background: var(--st-trapped); }
.st-affected { background: var(--st-affected); }
/* Atrapadas o afectadas: las dos marcas lado a lado, no un tercer color. */
.st-harm { background: linear-gradient(90deg, var(--st-trapped) 50%, var(--st-affected) 50%); }

/* --- Pasos del panel: 1 Escenario, 2 Herramientas, 3 Resultado ------------------ */
.step-number { display: inline-grid; place-items: center; width: 17px; height: 17px; margin-right: 3px; border-radius: 50%;
  background: var(--accent); color: #1c1f24; font-size: 10.5px; font-weight: 700; letter-spacing: 0; vertical-align: 1px; }
.scenario-section h2 { margin-top: 12px; }
.field-label { display: block; margin: 7px 0 2px; color: var(--fg-dim); font-size: 10.5px; }
.scenario-section select, .tool-options select { width: 100%; min-width: 0; padding: 5px 7px; border: 1px solid var(--border);
  border-radius: 5px; background: var(--bg-soft); color: var(--fg); font: inherit; font-size: 12px; }
.scenario-section select:focus, .tool-options select:focus { outline: 1px solid var(--accent); }
.scenario-section select:disabled, .tool-options select:disabled { opacity: .5; }
.scenario-section option:disabled { color: #6f7780; }
.results-heading { margin-top: 18px; }
.saved-tests { margin-top: 14px; }
.saved-tests .tool-button { margin-top: 5px; }
/* Con conexión normal no hay nada que decir; el mensaje aparece solo si hay un problema. */
.connection-status[data-state="live"] { display: none; }

/* --- Herramientas opcionales: una fila por herramienta, con su estado a la vista -- */
.optional-tag { color: var(--fg-dim); font-weight: 400; letter-spacing: 0; text-transform: none; }
.tool { margin-bottom: 6px; border: 1px solid var(--border); border-radius: 8px; background: rgba(255, 255, 255, .02); }
.tool.on { border-color: #8a5a35; background: rgba(224, 123, 57, .06); }
.tool-head { display: flex; align-items: center; gap: 8px; padding: 2px 8px 2px 4px; }
.tool-title { display: flex; flex: 1; align-items: center; gap: 8px; min-width: 0; padding: 6px 4px; border: 0; border-radius: 5px;
  background: none; color: var(--fg); font: inherit; text-align: left; cursor: pointer; }
.tool-title:hover { background: rgba(255, 255, 255, .05); }
.tool-title:focus-visible { outline: 2px solid var(--fg); outline-offset: 1px; }
.tool-icon { display: inline-grid; flex: none; place-items: center; width: 20px; font-size: 14px; text-align: center; }
.tool-icon-plan::before { content: ''; width: 11px; height: 11px; border: 1.5px solid #10321a; border-radius: 50%; background: #66bb6a; }
.tool-icon-arrival::before { content: ''; width: 16px; height: 9px; border-radius: 2px;
  background: linear-gradient(90deg, #a11123, #f2602a 45%, #fed976); }
.tool-name { min-width: 0; font-size: 12.5px; font-weight: 600; line-height: 1.25; }
.tool-name small { display: block; margin-top: 1px; color: var(--fg-dim); font-size: 10.5px; font-weight: 400; }
.tool.on .tool-name small { color: #f0c49c; }
.tool-head input[role="switch"] { appearance: none; -webkit-appearance: none; position: relative; flex: none;
  width: 28px; height: 16px; margin: 0; border-radius: 8px; background: #4a515b; cursor: pointer; transition: background .15s; }
.tool-head input[role="switch"]::after { content: ''; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px;
  border-radius: 50%; background: #e8eaed; transition: transform .15s; }
.tool-head input[role="switch"]:checked { background: var(--accent); }
.tool-head input[role="switch"]:checked::after { transform: translateX(12px); }
.tool-head input[role="switch"]:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.tool-head input[role="switch"]:disabled { opacity: .45; cursor: default; }
.tool-options { padding: 2px 10px 10px; }
.tool-options[hidden] { display: none; }
.tool-purpose { margin: 0 0 6px; color: var(--fg); font-size: 11.5px; line-height: 1.4; }
.tool-help { margin: 2px 0 6px; color: #f0c49c; font-size: 11px; line-height: 1.4; }
.tool-help:empty { display: none; }
.tool-options .note { margin: 7px 0 0; }
.tool-clock { margin-top: 8px; font-size: 11.5px; }
/* Lugares críticos: mismo color y letra que el ícono del mapa. */
.tool-icon-facilities::before { content: '+'; display: grid; place-items: center; width: 13px; height: 13px;
  border: 1.5px solid #14171b; border-radius: 50%; background: #fff; color: #c62828; font-size: 12px; font-weight: 700; line-height: 1; }
.facilities-key { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; margin: 6px 0; padding: 0; list-style: none; font-size: 11px; }
.facilities-key li { display: flex; align-items: center; gap: 6px; }
.facility-badge { display: inline-grid; flex: none; place-items: center; width: 15px; height: 15px; border: 1.5px solid #14171b;
  border-radius: 50%; color: #fff; font-size: 9.5px; font-style: normal; font-weight: 700; line-height: 1; }
.facility-badge.salud { color: #c62828; font-size: 12px; }
.facilities-reached { margin: 4px 0 6px; padding: 0; list-style: none; max-height: 190px; overflow-y: auto; font-size: 11px; }
.facilities-reached:empty { display: none; }
.facilities-reached li { padding: 4px 0 4px 8px; border-left: 3px solid #ff5a36; margin-bottom: 4px; }
.facilities-reached li.danger { border-left-color: #d32f2f; }
.facilities-reached b { display: block; color: var(--fg); font-weight: 600; }
.facilities-reached span { color: var(--fg-dim); }
.population-real-note { margin: 0 0 6px; color: #f0c49c; }
#evac-chart .marca { stroke: var(--fg-dim); stroke-width: 1; stroke-dasharray: 3 3; }
.tool-button { width: 100%; margin-top: 6px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 5px;
  background: var(--bg-soft); color: var(--fg); font: inherit; font-size: 12px; cursor: pointer; }
.tool-button:hover { border-color: var(--accent); }
.tool-button:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.tool-button:disabled { opacity: .5; cursor: default; }
.tool-button[hidden] { display: none; }
.start-points-list { list-style: none; margin: 0; padding: 0; }
.start-points-list li { display: grid; grid-template-columns: 22px 1fr 24px; gap: 6px; align-items: center; padding: 4px 0;
  border-bottom: 1px solid var(--grid); font-size: 11.5px; }
.start-points-list .number { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); color: #1c1f24; font-size: 11px; font-weight: 700; }
.start-points-list .place { padding: 0; border: 0; background: none; color: var(--fg); font: inherit; text-align: left;
  cursor: pointer; }
.start-points-list .place:hover { text-decoration: underline; }
.start-points-list .place small { display: block; color: #f6d3a0; font-size: 10.5px; }
.start-points-list .remove { width: 24px; height: 24px; padding: 0; border: 1px solid var(--border); border-radius: 4px;
  background: none; color: var(--fg-dim); font-size: 14px; line-height: 1; cursor: pointer; }
.start-points-list .remove:hover:not(:disabled) { color: var(--fg); border-color: var(--accent); }
.start-points-list .remove:disabled { opacity: .35; cursor: default; }
.start-point-marker { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 2px solid #fff7ea;
  border-radius: 50%; background: var(--accent); color: #1c1f24; font: 700 13px/1 -apple-system, "Segoe UI", sans-serif;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .55); cursor: grab; }
.start-point-marker:active { cursor: grabbing; }
/* Al pasar el cursor, un punto dice que se puede quitar. El marcador ya es «absolute» por MapLibre: si
   aquí fuera «relative», cada punto se correría hacia abajo el alto de los anteriores. */
.start-point-marker:not(.ghost):hover::after { content: '×'; position: absolute; top: -5px; right: -5px; display: grid;
  place-items: center; width: 14px; height: 14px; border-radius: 50%; background: #b71c1c; color: #fff; font: 700 11px/1 sans-serif; }
.map-ghost { pointer-events: none; opacity: .6; }
.map-ghost.inicio { width: 36px; height: 36px; }
.map-ghost.inicio svg { display: block; width: 100%; height: 100%; }
.map-ghost.encuentro { width: 22px; height: 22px; border: 2px solid #fff7ea; border-radius: 50%; background: #66bb6a; }
.start-point-marker.pending { opacity: .65; }
.start-point-marker.triangle { width: 36px; height: 36px; border: 0; border-radius: 0; background: none; box-shadow: none; }
.start-point-marker.triangle svg { display: block; width: 100%; height: 100%; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .5)); }
.start-points-list .number.triangle { width: 22px; height: 22px; background: none; }
.start-points-list .number.triangle svg { display: block; width: 100%; height: 100%; }
.editing-start-points .maplibregl-canvas { cursor: crosshair; }
/* Plan de evacuación */
.start-point-marker.meeting { background: #66bb6a; }
.start-point-marker.meeting.small { width: 16px; height: 16px; border-width: 1.5px; }
.start-point-marker.meeting.ghost { background: rgba(28, 31, 36, .85); color: var(--fg); border-style: dashed; font-size: 12px; cursor: pointer; }
.start-points-list .number.meeting { background: #66bb6a; }
.start-points-list .number.ghost { background: none; border: 1px dashed var(--fg-dim); color: var(--fg-dim); }
.start-points-list .number.closed { background: #8b5cf6; color: #fff; font-size: 10px; }
.start-points-list .place-text { color: var(--fg-dim); }
.plan-list { max-height: 220px; overflow-y: auto; }
.plan-modes { display: flex; gap: 0; margin-bottom: 6px; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.plan-modes button { flex: 1; padding: 5px 4px; border: 0; background: var(--bg-soft); color: var(--fg-dim); font: inherit; font-size: 11.5px; cursor: pointer; }
.plan-modes button.active { background: var(--accent); color: #1c1f24; font-weight: 600; }
.plan-modes button:focus-visible { outline: 2px solid var(--fg); outline-offset: -2px; }
.tool-button-main { border-color: var(--accent); font-weight: 600; }
.tool-button-main:disabled { border-color: var(--border); font-weight: 400; }
.plan-progress { margin-top: 8px; font-size: 11px; color: var(--fg-dim); }
.plan-progress[hidden], #plan-result[hidden], .plan-legend[hidden] { display: none; }
.plan-progress-track { height: 6px; margin-bottom: 4px; border-radius: 3px; background: var(--grid); overflow: hidden; }
.plan-progress-track i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.plan-verdict { margin-top: 10px; font-size: 12px; line-height: 1.4; }
.plan-verdict p { margin: 0 0 4px; }
.plan-warning { padding: 5px 7px; border-left: 2px solid #ffb74d; background: #3a3026; color: #f6d3a0; }
.plan-table { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: 11px; font-variant-numeric: tabular-nums; }
.plan-table th, .plan-table td { padding: 3px 2px; border-bottom: 1px solid var(--grid); text-align: right; font-weight: 400; }
.plan-table td { white-space: nowrap; }
.plan-table tr:first-child th { color: var(--fg-dim); font-size: 10px; }
.plan-table th:first-child { text-align: left; color: var(--fg-dim); }
.plan-table td:last-child { font-weight: 600; }
.plan-figure { margin: 10px 0 4px; }
.plan-figure figcaption { color: var(--fg-dim); font-size: 11px; }
.plan-key { display: flex; gap: 12px; margin: 3px 0; padding: 0; list-style: none; font-size: 10.5px; color: var(--fg); }
.plan-key i { display: inline-block; width: 14px; height: 2px; margin-right: 5px; vertical-align: middle; }
.plan-key i.area, .plan-dot.area { background: #3987e5; fill: #3987e5; }
.plan-key i.plan, .plan-dot.plan { background: #d95926; fill: #d95926; }
#plan-chart { display: block; width: 100%; height: 150px; touch-action: none; }
#plan-chart text { fill: var(--fg-dim); font-size: 9.5px; font-variant-numeric: tabular-nums; }
#plan-chart .grid { stroke: var(--grid); stroke-width: 1; }
#plan-chart .cursor { stroke: var(--fg-dim); stroke-width: 1; }
#plan-chart .plan-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
#plan-chart .plan-line.area { stroke: #3987e5; }
#plan-chart .plan-line.plan { stroke: #d95926; }
#plan-chart .plan-dot { stroke: var(--bg); stroke-width: 2; }
.plan-chart-tip { margin: 2px 0 0; font-size: 10.5px; color: var(--fg); font-variant-numeric: tabular-nums; }
.plan-chart-tip[hidden] { display: none; }
.plan-subtitle { margin: 10px 0 3px; color: var(--fg-dim); font-size: 11px; font-weight: 400; }
.plan-subtitle[hidden] { display: none; }
.plan-point-results { margin: 0; padding: 0; list-style: none; font-size: 11px; }
.plan-point-results li { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.plan-legend { margin: 2px 0 12px; padding-bottom: 10px; border-bottom: 1px solid #50483a; }
.plan-legend ul { margin-top: 5px !important; }
.plan-removed-key { background: none; border: 1px dashed var(--fg-dim); }
.plan-closed-key { height: 3px; background: #8b5cf6; }
.plan-route-key { height: 0; border-top: 2px dashed #a7f3d0; background: none; }

/* --- Indicadores principales ------------------------------------------------ */
/* ---------------- Resumen para decidir ---------------- */
/* Lo primero del resultado: cuánta gente vive donde llega el barro. Las cifras vienen del servidor. */
.decision { margin-top: 10px; padding: 10px 11px 9px; border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: 8px; background: var(--bg-soft); }
.decision[hidden], .decision [hidden] { display: none; }
#panel .decision-heading { margin: 0; color: var(--accent); font-size: 10.5px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; }
.decision-status { margin: 3px 0 0; color: var(--fg-dim); font-size: 11px; line-height: 1.4; }
.decision-status[data-tone="avanza"]::before { content: ''; display: inline-block; width: 6px; height: 6px;
  margin-right: 6px; border-radius: 50%; background: var(--accent); vertical-align: 1px;
  animation: decision-pulse 1.4s ease-in-out infinite; }
@keyframes decision-pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .decision-status[data-tone="avanza"]::before { animation: none; } }
.decision-headline { margin-top: 8px; }
.decision-headline strong { display: block; font-size: 30px; font-weight: 700; line-height: 1.05;
  letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.decision-headline span { display: block; margin-top: 2px; font-size: 13px; line-height: 1.35; }
.decision-headline small { display: block; margin-top: 3px; color: var(--fg-dim); font-size: 10.5px; line-height: 1.4; }
.decision-lines { margin: 9px 0 0; padding: 0; list-style: none; }
.decision-lines li { display: grid; grid-template-columns: 84px 1fr; gap: 9px; padding: 5px 0;
  border-top: 1px solid var(--grid); font-size: 11.5px; line-height: 1.4; }
.decision-lines b { text-align: right; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.decision-lines li.peligro b { color: #ff9b76; }
.decision-lines li.resultado { border-top-color: var(--border); }
#panel .decision-subtitle { margin: 11px 0 3px; color: var(--fg); font-size: 11px; font-weight: 600; }
.decision-table { width: 100%; border-collapse: collapse; font-size: 11px; font-variant-numeric: tabular-nums; }
.decision-table th, .decision-table td { padding: 3px 0 3px 9px; border-bottom: 1px solid var(--grid);
  text-align: right; font-weight: 400; white-space: nowrap; }
.decision-table thead th { color: var(--fg-dim); font-size: 10px; }
.decision-table th:first-child { padding-left: 0; text-align: left; white-space: normal; }
.decision .note { color: var(--fg-dim); }
.decision-table td:nth-child(3) { font-weight: 600; }
.decision-places { margin: 0; padding: 0; list-style: none; font-size: 11px; }
.decision-places li { padding: 3px 0; border-bottom: 1px solid var(--grid); line-height: 1.35; }
.decision-places strong { display: block; font-weight: 600; }
.decision-places li.danger strong { color: #ff9b76; }
.decision-places span { color: var(--fg-dim); font-size: 10.5px; }
.decision-other { margin: 9px 0 0; color: var(--fg-dim); font-size: 11px; line-height: 1.4; }
#decision-capacity-lines { margin-top: 2px; }
#decision-capacity-lines li:first-child { border-top: 0; }
/* El nombre va en el color del texto; la marca es la misma del mapa (negro con borde blanco). */
#decision-capacity-rows li.danger strong { color: var(--fg); }
#decision-capacity-rows li.danger strong::before { content: ''; display: inline-block; width: 8px; height: 8px;
  margin-right: 6px; border: 1.5px solid #fff; border-radius: 50%; background: #111; vertical-align: 0; }
.decision-actions { display: flex; gap: 6px; margin: 10px 0 2px; }
.decision-button { flex: 1; padding: 7px 6px; border: 1px solid var(--accent); border-radius: 6px;
  background: var(--accent); color: #1c1f24; font-size: 11.5px; font-weight: 600; line-height: 1.25;
  text-align: center; text-decoration: none; cursor: pointer; }
.decision-button.secondary { border-color: var(--border); background: none; color: var(--fg); }
.decision-button:hover { filter: brightness(1.08); }
.decision-button:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.decision-button[aria-disabled="true"] { opacity: .45; pointer-events: none; cursor: default; }
.decision-notes { margin: 0; padding-left: 15px; color: var(--fg-dim); font-size: 10.5px; line-height: 1.5; }
/* Repeticiones: el mismo escenario con otras semillas, y el rango que resulta. */
.decision-headline small.decision-range-line { color: var(--fg); font-weight: 600; }
.decision-repeat { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--grid); }
.decision-repeat-text { margin: 0 0 6px; color: var(--fg-dim); font-size: 11px; line-height: 1.4; }
.decision-repeat .plan-progress-track { margin-bottom: 7px; }
.decision-repeat-buttons { display: flex; gap: 6px; }
/* Contraste con un evento real: una línea bajo el titular. Ámbar si el modelo se quedó corto; gris si no hay contraste. */
.decision-contrast { margin: 7px 0 0; padding: 5px 8px; border-left: 3px solid #d9a441; background: rgba(217, 164, 65, .10);
  color: var(--fg); font-size: 11px; line-height: 1.4; }
.decision-contrast[data-tone="sin"] { border-left-color: var(--fg-dim); background: transparent; color: var(--fg-dim); }
.decision-contrast[data-tone="bien"] { border-left-color: #7fc98f; background: rgba(127, 201, 143, .10); }
/* Tabla «qué supuesto pesa más»: el supuesto es texto largo; las cifras van a la derecha y sin negrita. */
.decision-cases-table td:nth-child(3) { font-weight: 400; }
.decision-cases-table th:first-child { width: 58%; font-weight: 400; }
.decision-cases-table thead th { white-space: normal; vertical-align: bottom; }
button.decision-button { font-family: inherit; }
button.decision-button:disabled { opacity: .5; cursor: default; }
.decision-range-table td:nth-child(3) { font-weight: 400; }
.decision-range-table td:nth-child(2) { font-weight: 600; }

/* ---------------- Evacuar por sector ---------------- */
.order-quick { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0; }
.order-quick button { padding: 4px 8px; border: 1px solid var(--border); border-radius: 5px; background: var(--bg-soft);
  color: var(--fg); font: inherit; font-size: 11px; cursor: pointer; }
.order-quick button:hover { border-color: var(--fg-dim); }
.order-quick button:focus-visible, .order-apply:focus-visible { outline: 2px solid var(--fg); outline-offset: 1px; }
.order-list { max-height: 216px; margin: 0; padding: 0; overflow-y: auto; list-style: none; font-size: 11.5px;
  border: 1px solid var(--grid); border-radius: 6px; }
.order-list li + li { border-top: 1px solid var(--grid); }
.order-list label { display: flex; align-items: center; gap: 7px; padding: 5px 7px; cursor: pointer; }
.order-list label:hover { background: var(--bg-soft); }
.order-list input { flex: none; margin: 0; accent-color: var(--accent); }
.order-name { flex: 1; min-width: 0; }
.order-persons { flex: none; color: var(--fg-dim); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.order-count { margin: 7px 0 6px; font-size: 11.5px; line-height: 1.4; }
.order-apply { width: 100%; padding: 7px 8px; border: 1px solid var(--accent); border-radius: 6px;
  background: var(--accent); color: #1c1f24; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.order-apply:disabled { opacity: .45; cursor: default; }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.kpi { display: flex; flex-direction: column; gap: 2px; min-width: 0;
  padding: 9px 10px; background: var(--bg-soft); border-radius: 6px; }
.kpi-label { color: var(--fg-dim); font-size: 10.5px; line-height: 1.3; }
.kpi-label .k { margin-right: 5px; }
/* Cifras sueltas en proporcionales: las tabulares se ven sueltas en grande. */
.kpi-value { font-size: 20px; font-weight: 600; line-height: 1.2; color: var(--fg);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-sub { color: var(--fg-dim); font-size: 10.5px; }

/* --- Evacuación: barra de partes y serie temporal --------------------------- */
.evac-bar { display: flex; gap: 2px; height: 14px; margin: 4px 0 10px;
  border-radius: 4px; overflow: hidden; background: var(--bg-soft); }
.evac-bar span { display: block; min-width: 0; transition: flex-basis .25s ease; }
.evac-bar span:first-child { border-radius: 4px 0 0 4px; }
.evac-bar span:last-child { border-radius: 0 4px 4px 0; }
.evac-legend { list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.evac-legend li { display: flex; align-items: center; color: var(--fg-dim); }
.evac-legend b { margin-left: auto; color: var(--fg); font-weight: 600;
  font-variant-numeric: tabular-nums; }
.evac-chart { margin: 14px 0 0; }
.evac-chart figcaption { color: var(--fg-dim); font-size: 11px; margin-bottom: 4px; }
.evac-plot { position: relative; }
#evac-chart { display: block; width: 100%; height: 150px; overflow: visible; }
#evac-chart text { fill: var(--fg-dim); font-size: 9.5px; font-variant-numeric: tabular-nums; }
#evac-chart .grid { stroke: var(--grid); stroke-width: 1; }
#evac-chart .serie { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
#evac-chart .cursor { stroke: var(--fg-dim); stroke-width: 1; }
#evac-chart .punto { stroke: var(--bg); stroke-width: 2; }
.evac-tip { position: absolute; top: 0; z-index: 2; pointer-events: none;
  min-width: 128px; padding: 7px 9px; border-radius: 6px;
  background: #11141a; border: 1px solid var(--border); box-shadow: 0 4px 14px #0007;
  font-size: 11px; line-height: 1.5; }
.evac-tip .t { color: var(--fg-dim); margin-bottom: 2px; }
.evac-tip .fila { display: flex; align-items: center; gap: 6px; }
.evac-tip .fila i { width: 10px; height: 2px; border-radius: 1px; flex: 0 0 10px; }
.evac-tip .fila b { min-width: 30px; text-align: right; font-variant-numeric: tabular-nums; }
.evac-tip .fila span { color: var(--fg-dim); }
details.more { margin-top: 10px; }
details.more > summary, .legend-notes > summary { cursor: pointer; color: var(--fg-dim);
  font-size: 11px; list-style-position: inside; }
details.more > summary:hover, .legend-notes > summary:hover { color: var(--fg); }
details.more[open] > summary { margin-bottom: 8px; }
.evac-table { width: 100%; border-collapse: collapse; font-size: 10.5px;
  font-variant-numeric: tabular-nums; }
.evac-table th, .evac-table td { padding: 2px 3px; text-align: right; border-bottom: 1px solid var(--grid); }
.evac-table th { color: var(--fg-dim); font-weight: 500; }
.evac-table th:first-child, .evac-table td:first-child { text-align: left; }

.future { opacity: .55; }
.tag {
  font-size: 9px;
  background: #3a4048;
  color: var(--fg-dim);
  padding: 2px 6px;
  border-radius: 8px;
  letter-spacing: .04em;
  text-transform: none;
}

.clock {
  font-size: 24px;
  font-variant-numeric: tabular-nums;
  margin: 6px 0;
  letter-spacing: .04em;
}

footer { margin-top: 22px; border-top: 1px solid var(--border); padding-top: 10px; }
.note { color: #6f7780; font-size: 10.5px; line-height: 1.5; margin: 5px 0; }

/* ---------------- Controles ---------------- */

/* Abajo, centrado sobre el mapa: lo que se usa siempre. El resto vive en «Mapa». */
#dock {
  position: absolute; left: 12px; right: calc(var(--panel-w) + 12px); bottom: 14px; z-index: 1000;
  display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none;
}
#dock > * { pointer-events: auto; }
.viewer-3d .wide-view #dock { right: 12px; }
#btn-show-panel { border-color: var(--accent); font-weight: 600; }
.fp-active #dock { display: none; }

#edit-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; max-width: 100%;
  padding: 7px 8px 7px 12px; border: 1px solid var(--accent); border-radius: 8px; background: rgba(28, 31, 36, .96);
  color: var(--fg); font-size: 12px; font-weight: 500; }
#edit-bar[hidden] { display: none; }
.edit-bar-icon { display: inline-block; flex: none; width: 14px; height: 14px; }
#edit-bar[data-mode="inicio"] .edit-bar-icon { background: #5d4037; outline: 1px solid #f4f1ea; clip-path: polygon(0 0, 100% 0, 50% 100%); height: 12px; }
#edit-bar[data-mode="encuentro"] .edit-bar-icon { border-radius: 50%; background: #66bb6a; }
#edit-bar[data-mode="calles"] .edit-bar-icon { height: 4px; border-radius: 2px; background: #8b5cf6; }
#edit-bar button { padding: 4px 11px; border: 1px solid var(--border); border-radius: 5px; background: #333941; color: var(--fg);
  font: inherit; font-size: 12px; cursor: pointer; }
#edit-bar button:hover:not(:disabled) { background: #414954; }
#edit-bar button:disabled { opacity: .4; cursor: default; }
#edit-bar #edit-done { border-color: var(--accent); background: var(--accent); color: #1c1f24; font-weight: 700; }
#edit-bar button:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

#controls {
  position: relative;
  max-width: 100%;
  display: flex;
  flex-wrap: wrap;          /* en ventanas estrechas se apila en dos filas */
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 9px;
  background: rgba(28, 31, 36, .93);
  border: 1px solid var(--border);
  border-radius: 10px;
  backdrop-filter: blur(6px);
}
#player { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 5px; }
#controls #player button, #controls #btn-map-options { padding: 5px 9px; font-size: 13px; }
#controls #player #speeds button { padding: 4px 6px; font-size: 11px; }
#player button[hidden] { display: none; }
#controls #player .player-main { min-width: 96px; border-color: var(--accent); background: var(--accent); color: #1c1f24; font-weight: 700; }
#controls #player .player-main:hover:not(:disabled) { background: #eb8c4d; }
#controls #player .player-main:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.player-clock { padding: 0 4px; color: var(--fg); font-size: 13px; font-variant-numeric: tabular-nums; }
.player-clock b { font-weight: 600; }
.player-speed { display: inline-flex; align-items: center; gap: 6px; }
#speeds { gap: 2px; }
/* El paso es un dato técnico: acompaña, no compite con los indicadores. */
#panel .step-line { margin-top: 4px; padding: 0; background: none; font-size: 11px; color: var(--fg-dim); }
#panel .step-line .big { font-size: 12px; font-weight: 600; color: var(--fg-dim); }
/* El estado ya se lee en la línea de fase y en el botón principal. */
#panel .step-line .badge { display: none; }

#map-options { position: absolute; right: 0; bottom: calc(100% + 8px); width: min(390px, calc(100vw - 32px)); max-height: 70vh;
  overflow-y: auto; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: rgba(28, 31, 36, .97);
  backdrop-filter: blur(6px); }
#map-options[hidden] { display: none; }
.map-options-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-bottom: 10px; margin-bottom: 10px;
  border-bottom: 1px solid var(--border); }
.map-options-group:last-child { padding-bottom: 0; margin-bottom: 0; border-bottom: 0; }
.map-options-group h3 { flex-basis: 100%; margin: 0; color: var(--accent); font-size: 11px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; }
#map-options .speed-label { display: inline; }
#source-camera { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; max-width: 100%; }
#source-camera[hidden] { display: none; }
#source-camera select { max-width: 100%; }

#controls button {
  background: #333941;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 6px 11px;
  font-size: 14px;
  cursor: pointer;
  transition: background .12s;
}

#controls button:hover { background: #414954; }
#controls button:disabled { opacity: .35; cursor: not-allowed; }
#controls button.active { background: var(--accent); border-color: var(--accent); color: #1c1f24; }

#controls .camera-controls button { font-size: 12px; }
#controls #map-look { min-width: 135px; font-size: 11px; color: #e5f0eb;
  border-color: #60756f; background: #273a37; }
#controls #map-look:focus-visible { outline: 2px solid #9ad8d5; outline-offset: 2px; }
.camera-turns { display: inline-flex; gap: 3px; }
#controls .camera-turns button { font-size: 20px; padding: 2px 9px; line-height: 1.2; }
.camera-tilt { display: inline-flex; align-items: center; gap: 6px;
  color: #cad8d8; font-size: 11px; white-space: nowrap; }
.camera-tilt input { width: 95px; accent-color: #8bd9ca; }
.camera-tilt output { width: 28px; color: #ecf8f4; font-variant-numeric: tabular-nums; }
.camera-controls button:focus-visible, .camera-tilt input:focus-visible {
  outline: 2px solid #9ad8d5; outline-offset: 2px;
}

#controls .render-modes {
  display: flex; gap: 2px; padding: 3px;
  background: #171d23; border: 1px solid #3d4b55; border-radius: 8px;
}
#controls .render-modes button {
  border: 0; background: transparent; color: #aebcc5;
  padding: 5px 9px; font-size: 11px; font-weight: 500;
}
#controls .render-modes button:hover { background: #2b3b44; color: #e6f4f1; }
#controls .render-modes button.active {
  background: #365e6a; color: #e4f6f1; box-shadow: 0 1px 3px #0003;
}
#controls .render-modes button:focus-visible { outline: 2px solid #9ad8d5; outline-offset: 2px; }
#controls #btn-flow-vectors.active {
  background: #365e6a; border-color: #648b94; color: #fff4dc;
}
#controls #btn-flow-vectors:focus-visible {
  outline: 2px solid #9ad8d5; outline-offset: 2px;
}

.sep { width: 1px; height: 22px; background: var(--border); }
.speed-label { color: var(--fg-dim); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; }
.relief-control { display: inline-flex; align-items: center; gap: 7px;
  color: #bec9ca; font-size: 12px; white-space: nowrap; }
.relief-control input { width: 100px; }
.relief-control output { min-width: 36px; color: #e4f6f1; font-variant-numeric: tabular-nums; }
#speeds { display: flex; gap: 4px; }
#speeds button { font-size: 11px; padding: 5px 9px; }

#toast { color: var(--ok); font-size: 11px; }

/* La cámara de observador mantiene sus controles dentro del mapa, también
   cuando el panel de estadísticas pasa debajo en ventanas estrechas. */
#fp-hud { position: absolute; inset: 0; z-index: 1001; pointer-events: none; }
#fp-hud[hidden] { display: none; }
.fp-card { position: absolute; top: 80px; left: 12px; width: min(350px, calc(100% - 64px));
  padding: 12px; border: 1px solid var(--border); border-radius: 9px;
  background: rgba(28, 31, 36, .92); color: var(--fg); pointer-events: auto; font-size: 12px; }
.fp-card strong { color: #ffc58f; font-size: 14px; }
.fp-card p { margin: 7px 0; line-height: 1.45; }
#fp-status { font-variant-numeric: tabular-nums; }
.fp-note { color: #bac2cb; font-size: 10px; }
/* Indicador del lugar: figura de una persona con el nivel del barro o del agua, y su lectura. */
.fp-here { display: flex; gap: 10px; align-items: flex-end; margin: 8px 0; padding: 8px;
  border: 1px solid #47505b; border-radius: 6px; background: rgba(12, 16, 20, .55); }
.fp-here[hidden], .fp-person[hidden], #fp-street:empty { display: none; }
.fp-gauge svg { display: block; }
.fp-reading { display: grid; gap: 2px; min-width: 0; }
.fp-reading b { color: #fff; font-size: 22px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.fp-reading span { color: #e8ecef; }
.fp-reading .fp-street { color: #ffc58f; font-size: 11px; }
.fp-reading small, .fp-person small { color: #bac2cb; font-size: 10px; line-height: 1.35; }
.fp-reading .fp-consequence { color: #ffd7a8; }
.fp-consequence[hidden], #fp-person-log:empty { display: none; }
.fp-person { display: grid; gap: 2px; margin: 8px 0; padding: 7px 9px; border-left: 3px solid #ffc58f;
  border-radius: 0 6px 6px 0; background: rgba(12, 16, 20, .55); }
.fp-person b { color: #ffc58f; font-size: 11px; }
#fp-follow[aria-pressed="true"] { background: #66503e; border-color: #ffc58f; }
.fp-actions, .fp-simulation { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.fp-simulation { margin-top: 8px; }
#fp-hud button { padding: 7px 9px; border: 1px solid #59626e; border-radius: 5px;
  background: #333941; color: var(--fg); cursor: pointer; font: inherit; }
#fp-hud button:hover, #fp-hud button:active { background: #66503e; }
#fp-hud button:disabled { opacity: .4; cursor: not-allowed; }
#fp-hud button:focus-visible { outline: 2px solid #ffc58f; outline-offset: 2px; }
.fp-pad { position: absolute; right: 14px; bottom: 36px; display: grid;
  grid-template-columns: repeat(3, 44px); gap: 5px; pointer-events: auto; touch-action: none; }
#fp-hud .fp-pad button { min-height: 42px; padding: 3px; font-size: 21px;
  background: rgba(28, 31, 36, .92); user-select: none; }
#fp-hud .fp-pad button[data-fp-action^="look"] { font-size: 10px; }
.fp-selecting #legend, .fp-active #legend, .fp-active #controls,
.fp-selecting .fp-pad, .fp-selecting #fp-help, .fp-selecting .fp-note,
.fp-selecting #fp-choose, .fp-selecting .fp-simulation,
.fp-active #fp-start, .fp-active .maplibregl-ctrl-top-right { display: none; }
.fp-selecting .maplibregl-canvas { cursor: crosshair; }
.fp-active .maplibregl-canvas { cursor: grab; touch-action: none; }
.fp-active .maplibregl-canvas:active { cursor: grabbing; }
@media (max-width: 700px) {
  .fp-active #map { height: 85vh; min-height: 580px; }
  #app.fp-active { grid-template-rows: minmax(580px, 85vh) auto; }
  .fp-active #panel { grid-row: 2; }
  .fp-card { width: min(320px, calc(100% - 24px)); font-size: 11px; }
}

/* Ventanas estrechas: compactar controles y leyenda para que quepan */
@media (max-width: 1100px) {
  :root { --panel-w: 280px; }
  .speed-label { display: none; }
  #btn-save { font-size: 11px; padding: 5px 8px; }
  #legend { font-size: 10px; padding: 8px 10px; }
}

/* ---------------- Leyenda ---------------- */

#legend {
  position: absolute;
  /* Debajo del sello: así no se pisan por estrecha que sea la ventana. El sello crece con
     el reloj del SAE o la ayuda de los puntos de inicio; --stamp-bottom lo mide map3d.js. */
  top: max(58px, calc(var(--stamp-bottom, 0px) + 8px));
  left: 18px;
  max-width: 264px;
  max-height: calc(100vh - 250px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  background: rgba(28, 31, 36, .93);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  z-index: 1000;
  font-size: 11px;
  backdrop-filter: blur(6px);
}
#legend-box > summary { cursor: pointer; font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em; color: var(--fg-dim);
  list-style-position: inside; }
#legend-box > summary:hover { color: var(--fg); }
#legend-box[open] > summary { margin-bottom: 6px; }
/* Plegada, la leyenda es una pastilla que no tapa el mapa. */
#legend:has(#legend-box:not([open])) { padding: 6px 10px; }
.legend-notes { margin-top: 6px; }
.legend-notes[open] > summary { margin-bottom: 4px; }
#legend ul { list-style: none; margin: 0; padding: 0; }
#legend li { display: flex; align-items: center; gap: 7px; margin: 3px 0; }
.sw { width: 13px; height: 13px; border-radius: 2px; display: inline-block; }
.sw.dot { border-radius: 50%; width: 10px; height: 10px; }
.sw.line { height: 3px; border-radius: 2px; }
#legend li.people-key { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 12px;
  padding: 7px 0; margin: 5px 0; border-block: 1px solid var(--border); }
.people-key span { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
#legend li.dmg-key { border-top: 0; margin-top: 0; padding-top: 0; }
.dmg-key .key-title { grid-column: 1 / -1; color: var(--fg-dim); }
.sw.person { width: 12px; height: 16px; flex: 0 0 12px; border-radius: 0;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 16'%3E%3Ccircle cx='6' cy='2.4' r='2.1'/%3E%3Cpath d='M4 5h4l2 5-1.6.7L7.5 8v3l1.1 4H6.8L6 12l-.8 3H3.4l1.1-4V8l-.9 2.7L2 10z'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* Mismo glifo que el marcador real del mapa, para que la leyenda identifique */
.sw-tri { width: 13px; display: inline-block; text-align: center;
          font-size: 13px; line-height: 13px; color: var(--fg); }
/* Igual que los íconos del visor 3D: ✕ claro con borde oscuro, ▼ pardo. */
.sw-blocked { color: #f4f1ea; font-weight: 700;
  text-shadow: 0 0 2px #14171b, 0 0 2px #14171b; }
.sw-source { color: #5d4037; -webkit-text-stroke: 1px #f4f1ea; }

/* Popups de Leaflet en tema oscuro */
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--bg-soft); color: var(--fg);
}
.leaflet-container { background: #0f1114; }

/* Horizonte de la corrida y fase: una pantalla quieta no debe parecer colgada */
.of { color: var(--fg-dim); font-size: 12px; font-variant-numeric: tabular-nums; }
.phase { margin: 10px 0 0; font-size: 11px; letter-spacing: .04em;
         color: var(--accent); text-transform: uppercase; }
#btn-end { font-size: 12px; }

/* --- Sello de dato simulado sobre el mapa -----------------------------------
   Va encima del lienzo y no en el panel a propósito: una captura de pantalla
   recorta el panel lateral, y a partir de ahí la imagen circula sin decir que
   es una simulación. Es la misma exigencia que la advertencia del README, solo
   que aplicada a lo único que la gente termina compartiendo: el pixel. */
#stamp {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  z-index: 5; pointer-events: none;
  display: flex; align-items: baseline; gap: 9px;
  padding: 5px 13px; border-radius: 4px;
  background: rgba(20, 22, 26, .78);
  border: 1px solid rgba(224, 123, 57, .55);
  backdrop-filter: blur(3px);
  font-size: 10px; letter-spacing: .6px;
  max-width: calc(100% - 36px); flex-wrap: wrap; justify-content: center;
}
#stamp strong { color: #e07b39; letter-spacing: 1.1px; }
/* Dentro del sello: una captura lleva el reloj del aviso junto con la advertencia, y en una
   ventana angosta no se pisan aunque el sello ocupe varias líneas. */
#sae-chip {
  flex-basis: 100%; margin-top: 4px; padding-top: 4px; border-top: 1px solid rgba(224, 123, 57, .35);
  color: var(--fg); font-size: 12px; font-weight: 600; letter-spacing: 0; text-align: center;
  font-variant-numeric: tabular-nums;
}
#sae-chip[hidden] { display: none; }
#rain-chip { flex-basis: 100%; color: #b8c7d6; font-size: 11px; letter-spacing: .2px; text-align: center; }
#rain-chip[hidden] { display: none; }
/* Lluvia visible (ilustrativa): cielo más gris sobre el mapa y rayas que caen encima. */
.raining #map .maplibregl-canvas { filter: saturate(.8) brightness(.9) contrast(.97); }
.rain-veil { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
#stamp span { color: #b8bfc7; letter-spacing: .2px; }

/* --- Rampa de la leyenda ----------------------------------------------------
   El degradado es `plasma`: perceptualmente uniforme y DELIBERADAMENTE
   distinto de las rampas cálidas amarillo-rojo que usan los productos
   operativos de teledetección. Ver config.yaml -> visualization. */
.ramp { margin: 2px 0 8px; }
.ramp-bar {
  display: block; height: 12px; border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: linear-gradient(to right,
    #6a00a8, #9c179e, #cc4778, #ed7953, #fdb42f, #f0f921);
}
.ramp-lbl {
  display: flex; justify-content: space-between; margin-top: 3px;
  font-size: 10px; color: #d0d8e0;
}
.ramp-lbl em { font-style: normal; }
.ramp-lbl em:nth-child(2) { color: #b0bcc7; }
.columns-ramp .ramp-bar { background: linear-gradient(90deg, #e0a96d, #b5651d 12%, #8b4513 40%, #4a250b); }

.water-legend { margin: 2px 0 12px; padding-bottom: 11px; border-bottom: 1px solid #50483a; }
.water-legend[hidden], #deposit-legend[hidden], #arrival-legend[hidden] { display: none; }
.arrival-legend { margin: 2px 0 12px; padding-bottom: 11px; border-bottom: 1px solid #50483a; }
.arrival-heading { font-weight: 600; color: var(--fg); }
.arrival-heading span { display: block; margin-top: 1px; color: #b0bcc7; font-size: 10px; font-weight: 400; }
.arrival-key { list-style: none; margin: 7px 0 0; padding: 0; }
.arrival-key li { display: flex; align-items: center; gap: 7px; margin: 3px 0; color: #d0d8e0; font-size: 10.5px; }
.arrival-key i { width: 18px; height: 10px; flex: none; border-radius: 2px; border: 1px solid rgba(255, 255, 255, .28); }
.water-key {
  position: relative; height: 26px; overflow: hidden; margin: 8px 0;
  border: 1px solid #cbb99166; border-radius: 5px;
  /* Misma lectura que el mapa: agua turbia en movimiento, con vetas de espuma. */
  background:
    repeating-linear-gradient(176deg, transparent 0 6px, #e4d3b626 7px, transparent 8px 13px),
    linear-gradient(180deg, #54402d, #75583e 26%, #8b6c4c 50%, #6f5339 76%, #54402d);
}
.water-key::before, .water-key::after, .water-key span {
  content: ''; position: absolute; height: 2px; border-radius: 50%;
  background: linear-gradient(90deg, transparent, #cdb892b3, transparent);
  transform: rotate(-3deg);
}
.water-key::before { width: 100px; top: 7px; left: 18px; }
.water-key::after { width: 70px; top: 16px; right: 20px; }
.water-key span { width: 45px; top: 11px; left: 126px; }
.water-heading { color: #ede1cb; font-size: 12px; font-weight: 600; }
.water-heading span { display: block; margin-top: 3px; font-size: 10px; color: #bbaa8d; font-weight: 400; }
.water-legend p { margin: 7px 0 9px; font-size: 10px; line-height: 1.5; color: #b7afa2; }
.water-status { display: inline-flex; align-items: center; gap: 6px; font-size: 10px; color: #c9bda6; }
.water-status::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: #a39376; }
.water-status.moving::before { background: #dfc594; box-shadow: 0 0 6px #d4b98166; }

/* Niveles de daño de la Fase 8; deben coincidir con DAMAGE_COLORS de la API. */
.sw.dmg-low  { background: #ffd54f; }
.sw.dmg-med  { background: #ff9800; }
.sw.dmg-high { background: #e64a19; }
.sw.dmg-crit { background: #b71c1c; }

/* La escala gráfica de MapLibre viene clara y se pierde sobre la ortofoto. */
.maplibregl-ctrl-scale {
  background: rgba(20, 22, 26, .7); color: #e6e9ed;
  border-color: rgba(255, 255, 255, .45); font-size: 10px;
}
.maplibregl-ctrl-attrib {
  background: rgba(20, 22, 26, .7) !important;
}
.maplibregl-ctrl-attrib a { color: #9aa2ab !important; }

/* Selectores de quebrada y comportamiento en la barra de controles */
#controls select {
  background: #2b313b; color: var(--fg); max-width: 100%;
  border: 1px solid var(--border); border-radius: 6px;
  padding: 5px 8px; font-size: 12px; font-family: inherit;
}
#controls select:focus { outline: 1px solid var(--accent); }
#controls select option:disabled { color: #6f7780; }

/* El sello pertenece al mapa; centrarlo sobre toda la aplicación lo hacía
   invadir el título del panel. La vista amplia conserva sello y controles. */
@media (min-width: 701px) {
  .viewer-3d #stamp {
    left: calc((100% - var(--panel-w)) / 2);
    max-width: calc(100% - var(--panel-w) - 100px);
    width: max-content;
  }
}
.viewer-3d #app.wide-view #panel { display: none; }
.viewer-3d .wide-view #stamp { left: 50%; max-width: calc(100% - 100px); }
#btn-wide:focus-visible { outline: 2px solid #9ad8d5; outline-offset: 3px; }

#reference-details > summary { cursor: pointer; color: #c7ddd5; line-height: 1.5;
  font-size: 11px; padding: 3px 0; }
#reference-details[open] > summary { margin-bottom: 10px; }
#reference-details > summary:focus-visible { outline: 2px solid #9ad8d5; outline-offset: 3px; }

/* Las Condes has a busy satellite mosaic and many reference lines. Its
   landscape presentation uses quieter chrome; data/status colours remain. */
body.las-condes-landscape {
  --bg: #172326; --bg-soft: #203136; --border: #34484c;
  --accent: #d8a565; --fg-dim: #a3b7b7;
}
.las-condes-landscape #panel { background: linear-gradient(150deg, #1d2c30, #152024 65%); }
.las-condes-landscape #panel h1 { font-size: 18px; font-weight: 650; letter-spacing: -.3px; }
.las-condes-landscape .official-reference { background: #203431; border-color: #405c55;
  padding: 10px; border-radius: 8px; }
.las-condes-landscape #controls { background: rgba(20, 34, 38, .94);
  border-color: #4a6465; box-shadow: 0 6px 24px rgba(8, 18, 21, .28); gap: 6px; }
.las-condes-landscape #controls button { font-size: 12px; padding: 5px 9px; }
.las-condes-landscape #controls .camera-controls { gap: 6px; padding-bottom: 6px; }
.las-condes-landscape #controls #map-look { border-color: #6a8980; background: #293e37; }
.las-condes-landscape #stamp { background: rgba(19, 32, 36, .9); border-color: #5d726d; }
@media (min-width: 701px) and (max-width: 1100px) {
  body.las-condes-landscape { --panel-w: 264px; }
  .las-condes-landscape #panel { padding: 13px; }
}

/* En el panel estrecho de Codex, reservar primero una vista útil del terreno. */
@media (max-width: 700px) {
  #app {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 60vh auto auto auto;
    height: 100vh;
    overflow-y: auto;
  }
  #map { grid-row: 1; min-width: 0; height: 100%; }
  #dock { grid-row: 2; position: static; align-items: stretch; margin: 8px; }
  #controls { padding: 8px; gap: 6px; }
  #map-options { position: static; flex-basis: 100%; width: 100%; max-height: none; }
  #legend {
    grid-row: 3; position: static; max-width: none; margin: 0 8px 8px;
  }
  #legend ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 8px; }
  #legend .sw { flex-shrink: 0; }
  #panel { grid-row: 4; width: 100%; overflow: visible; border-left: 0; }
  .viewer-3d #app.wide-view { grid-template-rows: minmax(65vh, 1fr) auto auto; }
  .viewer-3d .wide-view #controls { max-width: none; }
}

/* ---------------- Ficha del agente ----------------
   Una persona o un punto de encuentro elegidos con un clic. Va sobre el mapa, junto al panel, y no en
   un globo: la persona se mueve y la ficha tiene que quedarse quieta para poder leerla. */
.agent-card { position: absolute; top: 112px; right: calc(var(--panel-w) + 14px); z-index: 1000;
  width: min(300px, calc(100% - var(--panel-w) - 28px)); max-height: calc(100vh - 210px); overflow-y: auto;
  scrollbar-width: thin; padding: 12px 14px; border: 1px solid #55606c; border-radius: 9px;
  background: rgba(28, 31, 36, .95); color: var(--fg); font-size: 12px; line-height: 1.45;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .35); backdrop-filter: blur(6px); }
.agent-card[hidden], .fp-active .agent-card, .agent-card [hidden] { display: none; }
.viewer-3d .wide-view .agent-card { right: 14px; width: min(300px, calc(100% - 28px)); }
.agent-card-head { display: flex; align-items: center; gap: 9px; }
.agent-card-icon.sw.person { width: 18px; height: 24px; flex: 0 0 18px; }
.agent-card-icon.sw.dot { width: 14px; height: 14px; flex: 0 0 14px; }
.agent-card-title { display: grid; min-width: 0; flex: 1; }
.agent-card-title small { color: var(--fg-dim); font-size: 10.5px; }
.agent-card-title strong { font-size: 15px; line-height: 1.25; font-variant-numeric: tabular-nums; }
.agent-card-close { flex: 0 0 auto; width: 26px; height: 26px; padding: 0; border: 1px solid transparent; border-radius: 5px;
  background: none; color: var(--fg-dim); font-size: 18px; line-height: 1; cursor: pointer; }
.agent-card-close:hover { color: var(--fg); border-color: var(--border); }
.agent-card-text { margin: 9px 0 0; font-size: 13px; }
.agent-card-note { margin: 6px 0 0; padding: 6px 8px; border-left: 3px solid var(--accent); border-radius: 0 5px 5px 0;
  background: rgba(224, 123, 57, .12); color: #f1d9c6; font-size: 11px; }
.agent-card-facts { margin-top: 10px; grid-template-columns: auto 1fr; gap: 4px 12px; }
.agent-card-facts:empty { display: none; }
.agent-card-facts dd { font-weight: 600; text-align: right; }
.agent-card h3 { margin: 12px 0 5px; color: var(--fg-dim); font-size: 10px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; }
.agent-card-timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.agent-card-timeline li { display: grid; grid-template-columns: 44px 1fr; gap: 8px; }
.agent-card-timeline time { color: var(--fg-dim); font-variant-numeric: tabular-nums; }
.agent-card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.agent-card-actions button { flex: 1 1 120px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 5px;
  background: var(--bg-soft); color: var(--fg); font: inherit; cursor: pointer; }
.agent-card-actions button:hover { border-color: var(--accent); }
.agent-card-actions button[aria-pressed="true"] { border-color: var(--accent); background: rgba(224, 123, 57, .2); }
.agent-card button:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.agent-card-foot { margin: 9px 0 0; color: var(--fg-dim); font-size: 10.5px; }
.agent-card-foot:empty { display: none; }
.agent-popup strong { display: block; font-size: 13px; }
.agent-popup p:first-of-type { font-size: 13px; font-weight: 600; }
/* Pantalla angosta: el mapa ocupa el 60 % de arriba y los controles van debajo. La ficha se apoya en el
   borde inferior del mapa, sin tapar los controles. */
@media (max-width: 700px) {
  .agent-card, .viewer-3d .wide-view .agent-card { top: auto; right: 8px; left: 8px; bottom: calc(40vh + 8px);
    width: auto; max-height: 36vh; }
  .agent-card-actions button { min-height: 40px; }
}

/* Estados de las personas: cada uno es un botón que las resalta en el mapa. */
.evac-legend li { min-width: 0; }
.evac-legend button, .people-key button { display: flex; align-items: center; width: 100%; min-width: 0; padding: 3px 5px;
  border: 1px solid transparent; border-radius: 5px; background: none; color: inherit; font: inherit;
  text-align: left; cursor: pointer; }
.people-key button { gap: 6px; padding: 2px 4px; white-space: nowrap; }
.evac-legend button:hover, .people-key button:hover { border-color: var(--border); color: var(--fg); }
.evac-legend button[aria-pressed="true"], .people-key button[aria-pressed="true"] {
  border-color: var(--accent); background: rgba(224, 123, 57, .16); color: var(--fg); }
.evac-legend button:focus-visible, .people-key button:focus-visible { outline: 2px solid var(--fg); outline-offset: 1px; }
.state-filter-note { margin: 6px 0 0; }
#legend li.agent-hint { display: block; margin: 0 0 6px; color: var(--fg-dim); font-size: 10.5px; line-height: 1.35; }
.flow-model-note { margin: 4px 0 2px; }
.flow-model-note:empty { display: none; }

/* Hosted admission and shared simulation lease. */
.execution-notice {
  margin: 0 0 14px;
  padding: 9px 10px;
  border: 1px solid #426c7c;
  border-left: 3px solid #8ad2dc;
  border-radius: 4px;
  background: #20363f;
  color: #e0f6fa;
  font-size: 12px;
  line-height: 1.45;
}
.execution-notice strong, .execution-notice span { display: block; }
.execution-notice strong { margin-bottom: 3px; }
#controls select:disabled { opacity: .5; cursor: not-allowed; }
.execution-notice small { display: block; margin-top: 6px; color: #bfd5dc; font-size: 10px; }

/* GeoMAS preparation: a decorative territory, with real preparation stages. */
#app[hidden], #admission-screen[hidden], .admission-actions [hidden], .viewer-loading[hidden] { display: none !important; }
.admission-screen, .viewer-loading {
  --prep-mint: #a7e8cf;
  --prep-warm: #efb28c;
  --prep-text: #f0f6f2;
  --prep-muted: #a6bdb8;
  color: var(--prep-text);
  background: radial-gradient(ellipse at 30% 35%, #163c3b88, transparent 56%),
    linear-gradient(#9de8d004 1px, transparent 1px), linear-gradient(90deg, #9de8d004 1px, transparent 1px), #081b20;
  background-size: auto, 52px 52px, 52px 52px, auto;
}
.admission-screen { min-height: 100%; display: grid; place-items: center; padding: 36px 24px; }
.admission-card { position: relative; isolation: isolate; overflow: hidden; width: min(820px, 100%); padding: 46px 48px 40px; border: 1px solid #92d4bc26; border-radius: 24px; background: linear-gradient(115deg, #153332f5 20%, #112d30d9 74%); box-shadow: 0 32px 90px #0005, inset 0 1px #ffffff06; }
.admission-card > :not(.admission-topography) { position: relative; z-index: 1; }
.admission-topography { position: absolute; width: 540px; right: -170px; top: 15px; opacity: .30; pointer-events: none; }
.admission-topography::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, #143330, transparent 65%); }
.admission-brand { display: inline-flex; align-items: center; gap: 11px; color: var(--prep-text); font-size: 28px; font-weight: 650; letter-spacing: -1px; text-decoration: none; }
.admission-brand-center { margin-left: 8px; padding-left: 16px; border-left: 1px solid #8cb8a94d; color: #9bbeb1; font-size: 9px; font-weight: 550; letter-spacing: 1.7px; }
.admission-eyebrow { margin: 44px 0 13px; color: var(--prep-mint); font-size: 10px; font-weight: 600; letter-spacing: 1.8px; text-transform: uppercase; }
.admission-card h1 { max-width: 510px; margin: 0; font-size: clamp(29px, 4vw, 40px); line-height: 1.1; font-weight: 550; letter-spacing: -1.2px; text-wrap: balance; }
.admission-status { max-width: 430px; min-height: 3.2em; margin: 21px 0 0; color: #cfddd6; font-size: 15px; line-height: 1.65; }
.admission-help { max-width: 420px; margin: 12px 0 27px; color: #91aaa2; font-size: 12px; line-height: 1.65; }
.admission-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 15px; }
.admission-actions button { min-height: 44px; padding: 10px 17px; border: 1px solid #b4ead1; border-radius: 8px; background: #b4ead1; color: #12372e; cursor: pointer; font: inherit; font-size: 13px; font-weight: 650; }
.admission-actions .admission-secondary { border-color: #729e8f; background: transparent; color: #e5efe9; }
.admission-actions button:disabled { opacity: .5; cursor: default; }
.admission-actions a { padding-block: 12px; color: #b1c8bc; font-size: 12px; text-decoration-color: #8bb29c66; text-underline-offset: 5px; }
.admission-actions a span { margin-left: 6px; color: #88c1a5; }
.admission-screen :is(a, button):focus-visible { outline: 2px solid var(--prep-mint); outline-offset: 5px; }
.admission-card noscript { color: #f1c39c; font-size: 13px; }
.viewer-loading { position: fixed; z-index: 10000; inset: 0; display: grid; place-items: center; padding: 32px; overflow-y: auto; opacity: 1; transition: opacity 180ms ease; }
.viewer-loading.is-leaving { opacity: 0; pointer-events: none; }
.viewer-loading-card { position: relative; isolation: isolate; width: min(1040px, 100%); display: grid; grid-template-columns: 1.12fr 1fr; overflow: hidden; border: 1px solid #9ddbb52b; border-radius: 26px; background: linear-gradient(125deg, #133632, #112a2b 62%, #102629); box-shadow: 0 36px 110px #0006, inset 0 1px #ffffff09; }
.viewer-loading-art { position: relative; min-width: 0; min-height: 550px; overflow: hidden; background: radial-gradient(ellipse at 45% 58%, #3e8d6330, transparent 65%); }
.viewer-loading-art::after { content: ''; position: absolute; right: 0; top: 11%; bottom: 11%; width: 1px; background: linear-gradient(transparent, #a6d8b424, transparent); }
.terrain-kicker { position: absolute; z-index: 1; display: flex; align-items: center; gap: 9px; top: 37px; left: 36px; color: #a0bdb0; font-size: 9px; font-weight: 500; letter-spacing: 1.8px; }
.terrain-kicker > span { width: 16px; height: 1px; background: #b1d9b6; }
.terrain-scene { display: block; width: 100%; overflow: visible; }
.viewer-loading-art > .terrain-scene { position: absolute; top: 50%; left: -4%; width: 108%; transform: translateY(-48%); }
.terrain-caption { position: absolute; bottom: 36px; left: 36px; right: 36px; display: flex; justify-content: space-between; align-items: center; gap: 10px; color: #6f9c8b; font-size: 8px; letter-spacing: 2px; }
.terrain-caption::before, .terrain-caption::after { content: ''; height: 3px; width: 3px; background: #8db49e66; border-radius: 50%; order: 1; }
.terrain-caption span:nth-child(1) { order: 0; }.terrain-caption span:nth-child(2) { order: 2; }.terrain-caption span:nth-child(3) { order: 4; }.terrain-caption::after { order: 3; }
.terrain-shadow { fill: #041718; opacity: .75; }
.terrain-ground { stroke: #699b8433; stroke-width: .65; }
.terrain-model { animation: geomas-terrain 7s ease-in-out infinite; }
.terrain-edge { fill: #0c2a29; stroke: #7bb38c55; stroke-width: .8; }
.terrain-surface { fill: #214c3e; stroke: #9dc5a56b; stroke-width: .9; }
.terrain-facets { fill: #d9ebc4; }
.terrain-wire { stroke: #b0dfac; stroke-opacity: .38; stroke-width: .65; stroke-linejoin: round; }
.terrain-streets { stroke: #aac6a9; stroke-opacity: .55; stroke-width: 1.1; }
.terrain-building-side { fill: #496f58; stroke: #a8c29d55; stroke-width: .5; }
.terrain-building-roof { fill: #a7bfa1; fill-opacity: .85; stroke: #cbe1b9aa; stroke-width: .55; }
.terrain-route-glow { stroke: #ffc093; stroke-width: 8; opacity: .075; stroke-linecap: round; stroke-linejoin: round; }
.terrain-route { stroke: var(--prep-warm); stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 4 7; animation: geomas-route 5s linear infinite; }
.terrain-beacon { fill: #ffd8b7; stroke: #193c31; stroke-width: 1.5; }
.terrain-pulse { fill: #ffc89d05; stroke: #e9b88c; stroke-width: .75; opacity: .6; transform-box: fill-box; transform-origin: center; animation: geomas-point 3.5s ease-out infinite; }
.viewer-loading-content { min-width: 0; padding: 46px 42px 36px; display: flex; flex-direction: column; justify-content: center; }
.viewer-loading-brand { display: flex; align-items: center; gap: 11px; font-size: 32px; line-height: 1; font-weight: 650; letter-spacing: -1.15px; }
.viewer-loading-mark { position: relative; display: inline-block; flex-shrink: 0; width: 20px; height: 20px; border: 1.2px solid #bee9c9; border-radius: 3px; transform: rotate(-30deg) skewY(8deg); background: linear-gradient(135deg, #bce6c92e, transparent); box-shadow: 4px 4px 0 -2px #14302c, 4px 4px 0 -1px #e7b08a; }
.viewer-loading-mark::after { content: ''; position: absolute; left: 3px; right: 3px; top: 8px; height: 1px; background: #b4dabb77; }
.viewer-loading-center { margin-left: auto; padding-left: 12px; color: #81a795; font-size: 8px; line-height: 1.2; font-weight: 550; letter-spacing: 1.7px; }
.viewer-loading-eyebrow { margin: 38px 0 12px; color: #b0c7b7; font-size: 9px; line-height: 1.4; font-weight: 550; letter-spacing: 1.5px; text-transform: uppercase; }
.viewer-loading h2 { margin: 0; min-height: 2.25em; color: var(--prep-text); font-size: clamp(28px, 3vw, 35px); line-height: 1.13; letter-spacing: -1.1px; font-weight: 550; text-wrap: balance; }
.viewer-loading-status { margin: 13px 0 25px; min-height: 4.8em; color: var(--prep-muted); font-size: 13px; line-height: 1.6; }
.viewer-loading-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; list-style: none; margin: 0; padding: 0; }
.viewer-loading-steps li { display: flex; flex-direction: column; align-items: flex-start; gap: 11px; min-width: 0; min-height: 84px; padding-top: 14px; border-top: 1px solid #6e9b7c33; color: #78998b; font-size: 10px; line-height: 1.5; transition: border-color 180ms ease, color 180ms ease; }
.viewer-loading-steps li > span:first-child { position: relative; display: grid; place-items: center; flex-shrink: 0; width: 22px; height: 22px; border: 1px solid #73977f55; border-radius: 50%; color: #86a58c; font-size: 8px; line-height: 1; }
.viewer-loading-steps [data-state="done"] { border-color: #a7d8af77; color: #a5c5ae; }
.viewer-loading-steps [data-state="done"] > span:first-child { border-color: #95caa37a; background: #b1d9b90b; font-size: 0; }
.viewer-loading-steps [data-state="done"] > span:first-child::after { content: '✓'; font-size: 10px; color: #b8dfbd; }
.viewer-loading-steps [data-state="active"] { border-color: #efb28c; color: #f0d9c4; }
.viewer-loading-steps [data-state="active"] > span:first-child { color: #f6c69c; border-color: #e4ac79; box-shadow: 0 0 0 4px #efb28c08; background: #efb28c0b; }
.viewer-loading-footer { display: flex; align-items: flex-start; gap: 8px; margin-top: 23px; padding-top: 17px; border-top: 1px solid #91c7a11f; color: #86a593; font-size: 10px; line-height: 1.55; }
.viewer-loading-signal { width: 4px; height: 4px; flex-shrink: 0; border-radius: 50%; margin-top: 5px; background: #add8b0; box-shadow: 0 0 7px #add8b02b; }
#app.viewer-revealed { animation: geomas-reveal 260ms ease-out both; }
@keyframes geomas-route { to { stroke-dashoffset: -88; } }
@keyframes geomas-point { 0%, 100% { opacity: .2; transform: scale(.8); } 50% { opacity: .75; transform: scale(1.18); } }
@keyframes geomas-terrain { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes geomas-reveal { from { opacity: .65; } to { opacity: 1; } }
@media (max-width: 760px) {
  .viewer-loading { padding: 20px; }
  .viewer-loading-card { width: min(440px, 100%); grid-template-columns: 1fr; border-radius: 22px; }
  .viewer-loading-art { min-height: 0; height: 205px; background: radial-gradient(ellipse at 50% 65%, #3e8d6326, transparent 65%); border-bottom: 1px solid #a6d8b414; }
  .viewer-loading-art::after { display: none; }
  .viewer-loading-art > .terrain-scene { width: 340px; max-width: 100%; left: 50%; top: 51%; transform: translate(-50%, -50%); }
  .terrain-kicker { top: 20px; left: 26px; font-size: 7px; letter-spacing: 1.5px; }
  .terrain-caption { display: none; }
  .viewer-loading-content { padding: 28px 28px 24px; }
  .viewer-loading-brand { font-size: 29px; }
  .viewer-loading-center { font-size: 7px; }
  .viewer-loading-eyebrow { margin-top: 26px; margin-bottom: 11px; }
  .viewer-loading h2 { min-height: 2.25em; font-size: 29px; line-height: 1.15; }
  .viewer-loading-status { margin-top: 12px; margin-bottom: 19px; font-size: 13px; }
  .viewer-loading-steps { gap: 10px; }
  .viewer-loading-steps li { min-height: 78px; font-size: 10px; padding-top: 12px; gap: 9px; }
  .viewer-loading-footer { margin-top: 19px; padding-top: 15px; }
  .admission-screen { padding: 20px; }
  .admission-card { padding: 30px 28px; border-radius: 20px; }
  .admission-topography { width: 440px; right: -200px; top: 20px; opacity: .19; }
  .admission-eyebrow { margin-top: 38px; }
  .admission-card h1 { font-size: 32px; }
  .admission-status { min-height: 4.8em; font-size: 14px; }
  .admission-help { margin-top: 7px; }
}
@media (max-width: 380px), (max-height: 700px) and (max-width: 760px) {
  .viewer-loading { padding: 12px; }
  .viewer-loading-card { border-radius: 19px; }
  .viewer-loading-art { height: 149px; }
  .viewer-loading-art > .terrain-scene { width: 220px; top: 53%; }
  .terrain-kicker { top: 12px; left: 24px; font-size: 6px; letter-spacing: 1.4px; }
  .viewer-loading-content { padding: 24px 23px 22px; }
  .viewer-loading-brand { font-size: 27px; gap: 10px; }
  .viewer-loading-mark { width: 18px; height: 18px; }
  .viewer-loading-eyebrow { margin-top: 23px; font-size: 8px; }
  .viewer-loading h2 { font-size: 26px; }
  .viewer-loading-status { font-size: 12px; }
  .viewer-loading-steps li { min-height: 74px; font-size: 9px; }
  .viewer-loading-footer { font-size: 9px; }
  .admission-screen { padding: 16px; }
  .admission-card { padding: 27px 23px; }
  .admission-brand { font-size: 25px; }
  .admission-brand-center { font-size: 7px; margin-left: 1px; padding-left: 11px; }
  .admission-card h1 { font-size: 29px; }
}
@media (max-height: 610px) { .viewer-loading { align-items: start; } }
@media (prefers-reduced-motion: reduce) {
  .viewer-loading, #app.viewer-revealed, .viewer-loading-steps li { transition: none; animation: none; }
  .terrain-model, .terrain-route, .terrain-pulse { animation: none; }
}
