:root {
  --sf-bg: #f5f9ff;
  --sf-bg-2: #e8f1fb;
  --sf-panel: #ffffff;
  --sf-panel-soft: #f4f8ff;
  --sf-stroke: #d8e3f0;
  --sf-text: #112640;
  --sf-muted: #60758d;
  --sf-accent: #2a7fff;
  --sf-accent-2: #79b2ff;
  --sf-cta: #f28b52;
  --sf-success: #17b26a;
  --sf-warning: #f79009;
  --sf-danger: #f04438;
  --sf-shadow: 0 16px 34px rgba(19, 52, 86, 0.12);
  --sf-radius: 24px;
  --sf-radius-sm: 16px;
  --sf-maxw: 1280px;
  --sf-ui-font: "Sora", "Nunito Sans", "Segoe UI", Arial, sans-serif;
  --widget-pad: 18px;
  --left-panel-w: min(340px, 28vw);
  --side-panel-w: min(380px, 30vw);
  --ink: var(--sf-text);
  --muted: var(--sf-muted);
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: rgba(255, 255, 255, 0.97);
  --line: rgba(42, 82, 124, 0.14);
  --navy: #17314b;
  --teal: #1f8d7a;
  --amber: var(--sf-cta);
  --red: var(--sf-danger);
  --cream: var(--sf-panel-soft);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100vh;
  padding: 12px;
  font-family: var(--sf-ui-font);
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 20%, rgba(42, 127, 255, 0.14), transparent 28%),
    radial-gradient(circle at 85% 30%, rgba(242, 139, 82, 0.14), transparent 26%),
    linear-gradient(180deg, var(--sf-bg) 0%, var(--sf-bg-2) 100%);
  overflow-x: hidden;
  overflow-y: auto;
}

button,
input {
  font: inherit;
}

code {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.92em;
}

.hidden {
  display: none !important;
}

[hidden] {
  display: none !important;
}

.app-shell {
  width: min(var(--sf-maxw), 100%);
  margin: 0 auto;
}

.map-stage {
  position: relative;
  width: 100%;
  height: min(900px, calc(100vh - 24px));
  min-height: 760px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 248, 255, 0.94)),
    var(--sf-panel);
  box-shadow: 0 24px 70px rgba(19, 52, 86, 0.16);
  isolation: isolate;
}

.map-stage::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 96px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0));
  z-index: 2;
}

.map-svg {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  background: #f8fbff;
  cursor: grab;
  touch-action: none;
}

.map-svg.is-dragging {
  cursor: grabbing;
}

.river-outer,
.river-inner,
.river-branch {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.river-outer {
  stroke: rgba(132, 223, 238, 0.62);
  stroke-width: 42;
}

.river-inner {
  stroke: rgba(93, 201, 223, 0.88);
  stroke-width: 24;
}

.river-branch {
  stroke: rgba(132, 223, 238, 0.76);
  stroke-width: 14;
}

.hud {
  position: absolute;
  z-index: 4;
}

.top-hud {
  top: var(--widget-pad);
  left: var(--widget-pad);
  right: auto;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 20px;
}

.map-title-hud {
  top: var(--widget-pad);
  right: calc(var(--widget-pad) + var(--side-panel-w) + 12px);
  width: 320px;
  padding: 13px 16px 15px;
  border: 1px solid var(--line);
  border-radius: var(--sf-radius-sm);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
  box-shadow: var(--sf-shadow);
}

.map-title-hud h2 {
  margin: 4px 0 0;
  font-size: 1.18rem;
  line-height: 1.08;
  white-space: nowrap;
}

.top-left-stack {
  width: var(--left-panel-w);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: auto;
  gap: 8px;
}

.title-stack {
  max-width: 100%;
  padding: 17px 18px 18px;
  border: 1px solid var(--line);
  border-radius: var(--sf-radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 248, 255, 0.92));
  backdrop-filter: blur(18px);
  box-shadow: var(--sf-shadow);
}

.eyebrow,
.panel-kicker {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  color: var(--muted);
}

.title-stack h1 {
  margin: 6px 0 10px;
  font-size: 1.95rem;
  line-height: 1.06;
  letter-spacing: 0;
}

.title-subline {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.chip {
  padding: 8px 10px 8px 12px;
  border-radius: 15px;
  background: rgba(42, 127, 255, 0.08);
  border: 1px solid rgba(42, 127, 255, 0.12);
  color: var(--navy);
  font-size: 0.86rem;
}

.chip-link {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  text-decoration: none;
  font-weight: 700;
  border-color: rgba(42, 127, 255, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(240, 247, 255, 0.94)),
    rgba(232, 242, 255, 0.96);
  box-shadow: 0 12px 24px rgba(42, 127, 255, 0.12);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.chip-link > span:first-child {
  white-space: nowrap;
}

.chip-link:hover {
  transform: translateY(-2px);
  border-color: rgba(42, 127, 255, 0.34);
  background: linear-gradient(180deg, rgba(220, 235, 255, 0.98), rgba(241, 248, 255, 0.94));
  box-shadow: 0 16px 28px rgba(42, 127, 255, 0.16);
}

.chip-link-cue {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(42, 127, 255, 0.18), rgba(121, 178, 255, 0.18));
  color: #1d66c8;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.panel,
.bottom-hud {
  border: 1px solid var(--line);
  border-radius: var(--sf-radius-sm);
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--sf-shadow);
}

.metric-label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.side-hud {
  top: var(--widget-pad);
  right: var(--widget-pad);
  bottom: var(--widget-pad);
  width: var(--side-panel-w);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 10px;
  overflow: visible;
  padding-right: 0;
}

.panel {
  padding: 16px 18px;
}

.selected-panel {
  flex: 0 0 auto;
  width: 100%;
  align-self: stretch;
  margin-top: 0;
  margin-bottom: 0;
}

.plan-panel {
  flex: 0 0 auto;
  width: 100%;
  align-self: stretch;
  margin-top: 0;
  padding: 14px 16px;
}

.plan-copy {
  margin: 0 0 12px;
  color: #304050;
  font-size: 0.95rem;
  line-height: 1.4;
}

.plan-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--sf-accent), #1f67d4);
  color: white;
  text-decoration: none;
  font-size: 0.94rem;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 14px 28px rgba(42, 127, 255, 0.20);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.plan-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 30px rgba(42, 127, 255, 0.24);
}

.about-panel {
  flex: 0 0 auto;
  width: 100%;
  align-self: stretch;
  padding: 14px 16px;
  border-color: rgba(42, 127, 255, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(240, 247, 255, 0.92)),
    var(--panel);
}

.about-panel h3 {
  margin: 4px 0 8px;
  line-height: 1.12;
}

.about-copy {
  margin: 0;
  color: #304050;
  font-size: 0.92rem;
  line-height: 1.38;
}

.about-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
}

.about-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid rgba(42, 127, 255, 0.14);
  background: rgba(42, 127, 255, 0.08);
  color: #1d66c8;
  font-size: 0.73rem;
  font-weight: 800;
  white-space: nowrap;
}

.legend-panel {
  flex: 0 0 auto;
  padding: 14px 16px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-header h2,
.panel-header h3 {
  margin: 4px 0 0;
  line-height: 1.08;
}

.selected-area-dropdown {
  position: relative;
  margin-top: 6px;
}

.selected-area-trigger::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 16px;
  width: 12px;
  height: 12px;
  border-right: 2px solid #0f5f58;
  border-bottom: 2px solid #0f5f58;
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
  opacity: 0.9;
  transition: transform 180ms ease;
}

.selected-area-dropdown.open .selected-area-trigger::after {
  transform: translateY(-35%) rotate(225deg);
}

.selected-area-trigger {
  position: relative;
  display: block;
  min-width: 240px;
  width: 100%;
  padding: 11px 48px 11px 16px;
  border: 1px solid rgba(19, 123, 114, 0.16);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 250, 248, 0.94));
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.15;
  text-align: left;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), 0 10px 22px rgba(19, 123, 114, 0.08);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.selected-area-trigger:hover,
.selected-area-trigger:focus,
.selected-area-dropdown.open .selected-area-trigger {
  border-color: rgba(19, 123, 114, 0.34);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 0 0 4px rgba(19, 123, 114, 0.10), 0 14px 26px rgba(19, 123, 114, 0.12);
}

.selected-area-trigger:focus,
.selected-area-dropdown.open .selected-area-trigger {
  transform: translateY(-1px);
}

.selected-area-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  z-index: 8;
  display: none;
  max-height: 280px;
  padding: 8px;
  overflow-y: auto;
  border: 1px solid rgba(19, 123, 114, 0.16);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(252, 254, 253, 0.98), rgba(242, 249, 247, 0.98));
  box-shadow: 0 22px 36px rgba(17, 30, 43, 0.16);
  backdrop-filter: blur(14px);
}

.selected-area-dropdown.open .selected-area-menu {
  display: grid;
  gap: 6px;
}

.selected-area-option {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.selected-area-option:hover,
.selected-area-option:focus {
  border-color: rgba(19, 123, 114, 0.18);
  background: rgba(255, 255, 255, 0.94);
  color: #0f5f58;
  outline: none;
  transform: translateY(-1px);
}

.selected-area-option.active {
  border-color: rgba(19, 123, 114, 0.24);
  background: linear-gradient(180deg, rgba(220, 244, 240, 0.96), rgba(240, 249, 247, 0.92));
  color: #0f5f58;
  box-shadow: 0 10px 18px rgba(19, 123, 114, 0.12);
}

.panel-header.tight {
  margin-bottom: 8px;
}

.score-pill {
  min-width: 74px;
  padding: 10px 12px;
  border-radius: 14px;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, var(--amber), var(--red));
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.metric {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(18, 50, 74, 0.06);
  font-size: 0.9rem;
}

.metric .metric-label {
  display: block;
  font-size: 0.72rem;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric strong {
  display: block;
  min-width: 0;
  margin-top: 0;
  font-size: 0.9rem;
  line-height: 1.28;
  color: #17314b;
}

.posture-card {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid rgba(18, 50, 74, 0.08);
}

.posture-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  padding: 0;
  border-radius: 0;
  border: 0;
  background: transparent;
  align-self: stretch;
}

.posture-vehicle-image {
  display: block;
  width: 100%;
  height: 58px;
  object-fit: contain;
  object-position: center center;
}

.posture-copy {
  min-width: 0;
}

.posture-copy .metric-label {
  display: block;
  white-space: nowrap;
}

.posture-card strong {
  display: block;
  margin-top: 2px;
  font-size: 0.86rem;
  line-height: 1.15;
  white-space: normal;
  overflow-wrap: anywhere;
  color: #0f5f58;
}

.risk-bar-shell {
  margin-top: 14px;
}

.risk-bar-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.92rem;
}

.risk-bar-track {
  height: 10px;
  background: rgba(18, 50, 74, 0.09);
  border-radius: 999px;
  overflow: hidden;
}

.risk-bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #2f9a78, #d58b2c, #c24c3d);
  transition: width 220ms ease;
}

.selected-chart-shell {
  margin-top: 14px;
  padding: 13px 13px 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(245, 250, 249, 0.92), rgba(255, 255, 255, 0.82));
  border: 1px solid rgba(19, 123, 114, 0.10);
}

.selected-chart-shell + .metric-grid {
  margin-top: 10px;
}

.selected-chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.selected-chart-header strong {
  display: block;
  margin-top: 4px;
  font-size: 0.96rem;
  line-height: 1.25;
  color: #17314b;
}

.selected-chart-badge {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 11px;
  background: rgba(19, 123, 114, 0.12);
  color: #0f5f58;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: right;
}

.selected-forecast-chart {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(243, 249, 248, 0.90));
  cursor: pointer;
}

.selected-chart-axis,
.selected-chart-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.selected-chart-axis {
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--muted);
}

.selected-chart-legend {
  margin-top: 8px;
  font-size: 0.8rem;
  color: #304050;
}

.selected-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#selectedChartActiveLegend {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(19, 49, 74, 0.08);
  color: #13314a;
  font-weight: 700;
}

.legend-swatch {
  display: inline-block;
  width: 14px;
  height: 4px;
  border-radius: 999px;
}

.legend-swatch.incidents {
  background: #137b72;
}

.legend-swatch.risk {
  background: #c86b29;
}

.legend-swatch.current {
  width: 4px;
  height: 14px;
  background: #13314a;
}

.detail-list {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.detail-list div {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 6px 7px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(18, 50, 74, 0.06);
  font-size: 0.8rem;
}

.detail-list span {
  display: block;
  font-size: 0.62rem;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.detail-list strong {
  display: block;
  min-width: 0;
  line-height: 1.14;
  font-size: 0.8rem;
  color: #17314b;
}

.selected-note,
.legend-note {
  margin: 10px 0 0;
  font-size: 0.82rem;
  line-height: 1.25;
  color: #223142;
}

.legend-bar {
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, #2f9a78 0%, #d0b74b 45%, #d58b2c 68%, #c24c3d 100%);
}

.legend-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.86rem;
  color: var(--muted);
}

.bottom-hud {
  left: calc(var(--widget-pad) + var(--left-panel-w) + 12px);
  right: calc(var(--widget-pad) + var(--side-panel-w) + 12px);
  bottom: var(--widget-pad);
  min-height: 150px;
  padding: 16px 18px 18px;
  border-color: rgba(42, 127, 255, 0.24);
  background: linear-gradient(180deg, rgba(232, 242, 255, 0.96), rgba(247, 251, 255, 0.94));
  box-shadow: 0 20px 38px rgba(42, 127, 255, 0.14);
}

.bottom-hud.is-playing {
  border-color: rgba(42, 127, 255, 0.34);
  box-shadow: 0 22px 44px rgba(42, 127, 255, 0.18);
  animation: timeline-pulse 900ms ease-in-out infinite alternate;
}

.timeline-kicker {
  display: block;
  margin-bottom: 8px;
}

.timeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.timeline-meta {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  min-width: 0;
}

.timeline-window {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  padding: 8px 14px 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(42, 127, 255, 0.18);
  border-left: 4px solid var(--sf-accent);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(240, 249, 247, 0.92));
  color: #17314b;
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.08;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.timeline-window-date,
.timeline-window-time {
  display: block;
  white-space: nowrap;
}

.timeline-window-date {
  color: var(--sf-muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.timeline-window-time {
  color: #17314b;
  font-size: 1.03rem;
}

.timeline-context {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 13px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(239, 247, 255, 0.94)),
    rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(42, 127, 255, 0.18);
  color: #234464;
  font-size: 0.88rem;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82), 0 10px 20px rgba(42, 127, 255, 0.10);
  white-space: nowrap;
}

.timeline-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.control-button {
  min-width: 66px;
  min-height: 42px;
  height: auto;
  padding: 9px 15px;
  border: 1px solid rgba(42, 127, 255, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.control-button:hover {
  transform: translateY(-1px);
  border-color: rgba(42, 127, 255, 0.30);
}

.control-button.primary {
  min-width: 172px;
  background: linear-gradient(135deg, var(--sf-accent), #1f67d4);
  color: white;
  box-shadow: 0 14px 28px rgba(42, 127, 255, 0.22);
  white-space: nowrap;
}

.control-button.primary.is-playing {
  background: linear-gradient(135deg, #1f67d4, var(--sf-accent));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18), 0 0 0 8px rgba(42, 127, 255, 0.14);
}

.timeline-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 30px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--sf-accent) 0%, var(--sf-accent) var(--progress, 0%), rgba(18, 50, 74, 0.10) var(--progress, 0%), rgba(18, 50, 74, 0.10) 100%);
  outline: none;
  overflow: visible;
  box-shadow: inset 0 0 0 1px rgba(18, 50, 74, 0.08), 0 10px 18px rgba(19, 123, 114, 0.10);
}

.timeline-slider.is-playing {
  animation: slider-pulse 700ms ease-in-out infinite alternate;
}

.timeline-slider::-webkit-slider-runnable-track {
  height: 30px;
  border-radius: 999px;
  background: transparent;
}

.timeline-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  margin-top: 1px;
  border: 3px solid rgba(255, 255, 255, 0.98);
  border-radius: 50%;
  background: var(--sf-accent);
  box-shadow: 0 8px 18px rgba(42, 127, 255, 0.26);
}

.timeline-slider::-moz-range-track {
  height: 30px;
  border-radius: 999px;
  background: transparent;
}

.timeline-slider::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.98);
  border-radius: 50%;
  background: var(--sf-accent);
  box-shadow: 0 8px 18px rgba(42, 127, 255, 0.26);
  transform: none;
}

.timeline-slider::-moz-range-progress {
  height: 30px;
  border-radius: 999px;
  background: var(--sf-accent);
}

.slider-scale {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted);
}

.slider-scale span:last-child {
  text-align: right;
}

@keyframes timeline-pulse {
  from {
    box-shadow: 0 22px 42px rgba(42, 127, 255, 0.16);
  }
  to {
    box-shadow: 0 24px 48px rgba(42, 127, 255, 0.26);
  }
}

@keyframes slider-pulse {
  from {
    box-shadow: inset 0 0 0 1px rgba(18, 50, 74, 0.08), 0 0 0 0 rgba(42, 127, 255, 0.00), 0 10px 18px rgba(42, 127, 255, 0.10);
  }
  to {
    box-shadow: inset 0 0 0 1px rgba(18, 50, 74, 0.08), 0 0 0 10px rgba(42, 127, 255, 0.12), 0 12px 22px rgba(42, 127, 255, 0.14);
  }
}

.loading-state,
.error-state {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: rgba(232, 241, 251, 0.62);
  backdrop-filter: blur(10px);
}

.loading-card {
  max-width: 28rem;
  padding: 22px 24px;
  border-radius: 18px;
  background: rgba(252, 250, 246, 0.96);
  border: 1px solid rgba(18, 50, 74, 0.08);
  box-shadow: 0 18px 36px rgba(17, 30, 43, 0.12);
}

.loading-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.loading-copy {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.error-card {
  border-color: rgba(194, 76, 61, 0.18);
}

.area-marker {
  cursor: pointer;
}

.area-zone,
.area-hit,
.area-label-box,
.area-label-line {
  transition: all 220ms ease;
}

.area-zone {
  stroke: rgba(198, 52, 44, 0.42);
  stroke-width: 3.2;
  stroke-linejoin: round;
}

.area-hit {
  cursor: pointer;
  fill: transparent;
}

.area-label-box {
  fill: rgba(248, 244, 237, 0.94);
  stroke: rgba(18, 50, 74, 0.18);
  stroke-width: 1;
}

.area-label-line {
  font-family: "Aptos", "Segoe UI Variable", "Trebuchet MS", sans-serif;
  fill: var(--ink);
}

.area-name {
  font-size: 12px;
  font-weight: 700;
}

.area-metrics {
  font-size: 11px;
  fill: #304050;
}

.area-marker.selected .area-label-box {
  stroke: #0f5f58;
  stroke-width: 3.4;
  fill: rgba(210, 245, 237, 0.99);
  filter: url(#panel-shadow);
}

.area-marker.selected .area-name {
  fill: #0f5f58;
  font-weight: 800;
}

.area-marker.selected .area-metrics {
  fill: #17314b;
  font-weight: 700;
}

.area-marker.selected .area-zone {
  stroke: #0f5f58;
  stroke-opacity: 0.72;
  stroke-width: 4.4;
}

@media (max-width: 1180px) {
  :root {
    --left-panel-w: min(305px, 30vw);
    --side-panel-w: min(335px, 32vw);
  }

  .title-stack,
  .panel,
  .bottom-hud {
    padding: 14px 16px;
  }

  .title-stack h1 {
    font-size: 1.72rem;
  }

  .map-title-hud {
    width: 300px;
    padding: 12px 14px;
  }

  .map-title-hud h2 {
    font-size: 1.04rem;
  }

  .timeline-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .timeline-meta {
    flex-wrap: wrap;
  }
}

@media (max-width: 980px) {
  body {
    padding: 10px;
  }

  .app-shell {
    width: 100%;
  }

  .map-stage {
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: auto;
    min-height: 0;
    padding: 10px;
    overflow: visible;
    border-radius: 24px;
  }

  .map-stage::before {
    display: none;
  }

  .hud {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    width: 100%;
  }

  .top-hud {
    display: contents;
  }

  .top-left-stack {
    display: contents;
    width: 100%;
  }

  .title-stack {
    order: 1;
  }

  .title-subline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .map-title-hud {
    order: 2;
    width: 100%;
    padding: 12px 14px;
  }

  .map-title-hud h2 {
    overflow: hidden;
    font-size: clamp(0.95rem, 3.8vw, 1.1rem);
    text-overflow: ellipsis;
  }

  .map-svg {
    position: relative;
    inset: auto;
    order: 3;
    width: 100%;
    height: clamp(380px, 60vh, 540px);
    min-height: 0;
    border: 1px solid var(--sf-stroke);
    border-radius: 20px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.70);
    touch-action: pan-y;
  }

  .side-hud {
    display: contents;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .bottom-hud {
    order: 4;
    min-height: 0;
    padding: 14px 16px 16px;
  }

  .legend-panel {
    order: 6;
  }

  .plan-panel {
    order: 7;
  }

  .about-panel {
    order: 8;
  }

  .selected-panel,
  .plan-panel,
  .about-panel {
    width: 100%;
  }

  .selected-panel {
    order: 5;
  }

  .panel-header > div:first-child {
    min-width: 0;
    flex: 1 1 auto;
    width: 100%;
  }

  .selected-area-dropdown {
    width: 100%;
  }

  .selected-area-trigger {
    min-width: 0;
  }

  .selected-area-menu {
    max-height: min(360px, 52vh);
  }

  .area-name {
    font-size: 18px;
  }

  .area-metrics {
    font-size: 15px;
  }

  .timeline-head {
    align-items: stretch;
  }

  .timeline-meta {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
  }

  .timeline-window,
  .timeline-context {
    min-width: 0;
  }

  .timeline-context {
    white-space: normal;
    text-align: center;
  }

  .timeline-controls {
    justify-content: flex-start;
    width: 100%;
  }

  .control-button.primary {
    min-width: 0;
    width: 100%;
  }

}

@media (max-width: 620px) {
  body {
    padding: 6px;
  }

  .map-stage {
    gap: 8px;
    padding: 8px;
    border-radius: 20px;
  }

  .title-stack {
    padding: 14px 15px;
  }

  .title-stack h1 {
    font-size: 1.42rem;
  }

  .panel,
  .bottom-hud {
    padding: 13px 14px;
  }

  .map-title-hud {
    padding: 11px 13px;
  }

  .title-subline,
  .timeline-meta {
    display: grid;
    grid-template-columns: 1fr;
  }

  .chip-link {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .map-svg {
    height: min(58vh, 430px);
    min-height: 330px;
    border-radius: 18px;
  }

  .panel-header {
    flex-direction: column;
    gap: 10px;
  }

  .score-pill {
    align-self: flex-start;
  }

  .selected-area-trigger {
    min-width: 0;
    font-size: 1.08rem;
    min-height: 50px;
  }

  .metric-grid,
  .detail-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .timeline-window {
    width: 100%;
  }

  .timeline-context {
    justify-content: flex-start;
  }

  .slider-scale {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    font-size: 0.68rem;
  }

  .slider-scale span {
    display: none;
  }

  .slider-scale span:nth-child(1),
  .slider-scale span:nth-child(3),
  .slider-scale span:nth-child(5),
  .slider-scale span:nth-child(7),
  .slider-scale span:nth-child(9) {
    display: block;
  }

  .posture-card {
    grid-template-columns: 74px minmax(0, 1fr);
  }

  .posture-copy .metric-label {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .posture-vehicle-image {
    height: 52px;
  }

  .selected-chart-header {
    gap: 8px;
  }

  .selected-chart-badge {
    max-width: 42%;
    white-space: normal;
  }
}

@media (max-width: 420px) {
  .map-svg {
    height: min(56vh, 380px);
    min-height: 310px;
  }

  .metric-grid,
  .detail-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .selected-chart-header {
    display: grid;
    grid-template-columns: 1fr;
  }

  .selected-chart-badge {
    max-width: none;
    justify-self: start;
    text-align: left;
  }

  .selected-chart-legend {
    font-size: 0.74rem;
  }

  #selectedChartActiveLegend {
    flex-basis: 100%;
    justify-content: center;
  }

  .slider-scale {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .slider-scale span:nth-child(3),
  .slider-scale span:nth-child(7) {
    display: none;
  }
}

