:root {
  --ink: #17202b;
  --muted: #677487;
  --panel: rgba(250, 247, 241, 0.88);
  --panel-strong: rgba(247, 243, 236, 0.94);
  --line: rgba(28, 39, 54, 0.10);
  --navy: #12324a;
  --teal: #137b72;
  --amber: #d58b2c;
  --red: #c24c3d;
  --cream: #f6f2ea;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  font-family: "Aptos", "Segoe UI Variable", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background: #ffffff;
  overflow: hidden;
}

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,
.map-stage {
  width: 100%;
  height: 100%;
}

.map-stage {
  position: relative;
  overflow: hidden;
  background: #ffffff;
}

.map-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  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: 3;
}

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

.top-left-stack {
  width: min(31rem, 32vw);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: auto;
  gap: 8px;
}

.title-stack {
  max-width: 100%;
  padding: 18px 20px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(246, 242, 234, 0.96), rgba(250, 247, 241, 0.86));
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 40px rgba(17, 30, 43, 0.12);
}

.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: clamp(1.7rem, 2.8vw, 2.5rem);
  line-height: 1.04;
}

.title-subline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(18, 50, 74, 0.07);
  border: 1px solid rgba(18, 50, 74, 0.08);
  color: var(--navy);
  font-size: 0.86rem;
}

.chip-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 700;
  border-color: rgba(19, 123, 114, 0.20);
  background: linear-gradient(180deg, rgba(220, 244, 240, 0.96), rgba(240, 249, 247, 0.92));
  box-shadow: 0 10px 22px rgba(19, 123, 114, 0.10);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.chip-link:hover {
  transform: translateY(-1px);
  border-color: rgba(19, 123, 114, 0.34);
  background: linear-gradient(180deg, rgba(206, 239, 233, 0.98), rgba(233, 247, 244, 0.94));
}

.chip-link-cue {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(19, 123, 114, 0.14);
  color: #0f5f58;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.summary-box,
.panel,
.bottom-hud {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 36px rgba(17, 30, 43, 0.10);
}

.summary-box {
  padding: 14px 16px;
  min-height: 84px;
}

.context-highlight {
  border-color: rgba(19, 123, 114, 0.26);
  background: linear-gradient(180deg, rgba(220, 244, 240, 0.96), rgba(240, 249, 247, 0.92));
  box-shadow: 0 16px 30px rgba(19, 123, 114, 0.12);
}

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

.summary-value {
  margin-top: 10px;
  font-size: 1.18rem;
  font-weight: 700;
}

.summary-hour-time {
  display: inline-block;
  margin-left: 4px;
  font-size: 1.34em;
  font-weight: 800;
  color: #0f5f58;
}

.side-hud {
  top: 20px;
  right: 20px;
  bottom: 20px;
  width: min(380px, 28vw);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 10px;
}

.panel {
  padding: 16px 18px;
}

.selected-panel {
  flex: 0 0 auto;
  width: 125%;
  align-self: flex-end;
  margin-top: 0;
  margin-bottom: 0;
}

.critique-panel {
  flex: 0 0 auto;
  width: 100%;
  align-self: stretch;
  margin-top: 0;
  padding: 14px 16px;
}


.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, #163a53, #137b72);
  color: white;
  text-decoration: none;
  font-size: 0.94rem;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 14px 28px rgba(19, 123, 114, 0.18);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.plan-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 30px rgba(19, 123, 114, 0.22);
}

.critique-copy {
  margin: 0 0 12px;
  color: #304050;
  font-size: 0.94rem;
  line-height: 1.45;
}

.critique-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, #5b3a26, #b16a2c);
  color: white;
  text-decoration: none;
  font-size: 0.94rem;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 14px 28px rgba(177, 106, 44, 0.18);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.critique-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 30px rgba(177, 106, 44, 0.22);
}


.legend-panel {
  flex: 0 0 auto;
  padding: 14px 16px;
}

.map-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-control {
  min-width: 40px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(18, 50, 74, 0.10);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.mini-control:hover {
  transform: translateY(-1px);
  border-color: rgba(18, 50, 74, 0.22);
}

.mini-control.reset {
  min-width: 62px;
}

.mini-control.zoom-label {
  min-width: 88px;
}

.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: 2px 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: nowrap;
  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;
}

.ranking-list {
  display: grid;
  gap: 8px;
  overflow: auto;
  padding-right: 4px;
}

.ranking-row {
  width: 100%;
  border: 1px solid rgba(18, 50, 74, 0.07);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.54);
  padding: 11px 12px;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.ranking-row:hover,
.ranking-row.active {
  transform: translateX(-2px);
  border-color: rgba(18, 50, 74, 0.20);
  background: rgba(255, 255, 255, 0.80);
}

.ranking-number {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(18, 50, 74, 0.08);
  font-weight: 700;
}

.ranking-area {
  font-weight: 700;
}

.ranking-subline {
  font-size: 0.85rem;
  color: var(--muted);
}

.ranking-risk {
  text-align: right;
}

.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);
}

.context-highlight .summary-value,
.context-highlight .summary-label {
  color: #0f5f58;
}

.bottom-hud {
  left: calc(20px + min(31rem, 32vw) + 20px);
  right: calc(20px + (min(380px, 28vw) * 1.25) + 20px);
  bottom: 20px;
  min-height: 164px;
  padding: 16px 18px 18px;
  border-color: rgba(19, 123, 114, 0.24);
  background: linear-gradient(180deg, rgba(228, 246, 242, 0.96), rgba(247, 252, 251, 0.94));
  box-shadow: 0 22px 42px rgba(19, 123, 114, 0.14);
}

.bottom-hud.is-playing {
  border-color: rgba(19, 123, 114, 0.34);
  box-shadow: 0 22px 44px rgba(19, 123, 114, 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: 16px;
  margin-bottom: 12px;
}

.timeline-meta {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  min-width: 0;
}

.timeline-window {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 14px 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(19, 123, 114, 0.18);
  border-left: 4px solid #137b72;
  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;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.timeline-context {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.70);
  border: 1px solid rgba(19, 123, 114, 0.14);
  color: #355064;
  font-size: 0.88rem;
  font-weight: 700;
}

.timeline-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.control-button {
  min-width: 66px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(18, 50, 74, 0.10);
  border-radius: 12px;
  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(18, 50, 74, 0.22);
}

.control-button.primary {
  background: linear-gradient(135deg, #163a53, #137b72);
  color: white;
  box-shadow: 0 14px 28px rgba(19, 123, 114, 0.20);
}

.control-button.primary.is-playing {
  background: linear-gradient(135deg, #0f5f58, #1aa493);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18), 0 0 0 8px rgba(26, 164, 147, 0.14);
}

.timeline-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 30px;
  border-radius: 999px;
  background: linear-gradient(90deg, #19a899 0%, #19a899 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: #137b72;
  box-shadow: 0 8px 18px rgba(19, 123, 114, 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: #137b72;
  box-shadow: 0 8px 18px rgba(19, 123, 114, 0.26);
  transform: none;
}

.timeline-slider::-moz-range-progress {
  height: 30px;
  border-radius: 999px;
  background: #19a899;
}

.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(19, 123, 114, 0.16);
  }
  to {
    box-shadow: 0 24px 48px rgba(19, 123, 114, 0.28);
  }
}

@keyframes slider-pulse {
  from {
    box-shadow: inset 0 0 0 1px rgba(18, 50, 74, 0.08), 0 0 0 0 rgba(25, 168, 153, 0.00), 0 10px 18px rgba(19, 123, 114, 0.10);
  }
  to {
    box-shadow: inset 0 0 0 1px rgba(18, 50, 74, 0.08), 0 0 0 10px rgba(25, 168, 153, 0.12), 0 12px 22px rgba(19, 123, 114, 0.14);
  }
}

.loading-state,
.error-state {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: rgba(242, 239, 234, 0.58);
  backdrop-filter: blur(10px);
}

.startup-gate {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(240, 244, 246, 0.76);
  backdrop-filter: blur(12px);
}

.startup-card {
  width: min(38rem, calc(100vw - 32px));
  max-height: min(90vh, 760px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  padding: 18px 20px 18px;
  border-radius: 20px;
  border: 1px solid rgba(194, 76, 61, 0.18);
  background: linear-gradient(180deg, rgba(252, 250, 246, 0.99), rgba(247, 244, 238, 0.97));
  box-shadow: 0 24px 44px rgba(17, 30, 43, 0.16);
  overscroll-behavior: contain;
}

.startup-card h2 {
  margin: 6px 0 10px;
  font-size: clamp(1.4rem, 2vw, 1.85rem);
  line-height: 1.08;
}

.startup-card p {
  margin: 0;
  color: #304050;
  font-size: 0.95rem;
  line-height: 1.48;
}

.startup-intro,
.startup-emphasis,
.startup-warning-block {
  padding: 12px 14px;
  border-radius: 16px;
}

.startup-intro {
  border: 1px solid rgba(18, 50, 74, 0.08);
  background: rgba(255, 255, 255, 0.66);
}

.startup-emphasis {
  margin-top: 10px;
  border: 1px solid rgba(19, 123, 114, 0.14);
  background: linear-gradient(180deg, rgba(220, 244, 240, 0.92), rgba(240, 249, 247, 0.90));
}

.startup-warning-block {
  margin-top: 10px;
  border: 1px solid rgba(194, 76, 61, 0.16);
  background: linear-gradient(180deg, rgba(253, 242, 239, 0.94), rgba(252, 247, 244, 0.92));
}

.startup-lead,
.startup-section-title {
  margin-bottom: 6px;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.startup-lead {
  color: var(--navy);
}

.startup-section-title {
  color: #0f5f58;
}

.startup-warning-block .startup-section-title {
  color: #9b3d31;
}

.startup-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(18, 50, 74, 0.10);
  color: #17314b;
  font-size: 0.88rem;
  line-height: 1.38;
  cursor: pointer;
}

.startup-check input {
  margin: 2px 0 0;
  width: 18px;
  height: 18px;
  accent-color: #137b72;
  flex: 0 0 auto;
}

.startup-check span {
  flex: 1 1 auto;
}

.startup-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  bottom: 0;
  margin-top: 14px;
  padding-top: 12px;
  background: linear-gradient(180deg, rgba(247, 244, 238, 0), rgba(247, 244, 238, 0.92) 28%, rgba(247, 244, 238, 0.98));
}

#startupAccept:disabled {
  cursor: not-allowed;
  opacity: 0.56;
  box-shadow: none;
  transform: none;
  filter: grayscale(0.12);
}

.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);
}

.district-marker {
  cursor: pointer;
}

.district-glow,
.district-zone,
.district-core,
.district-hit,
.district-label-box,
.district-label-line,
.district-label-micro {
  transition: all 220ms ease;
}

.district-zone {
  stroke: rgba(198, 52, 44, 0.42);
  stroke-width: 3.2;
  stroke-linejoin: round;
}

.district-hit {
  cursor: pointer;
  fill: transparent;
}

.district-label-box {
  fill: rgba(248, 244, 237, 0.94);
  stroke: rgba(18, 50, 74, 0.18);
  stroke-width: 1;
}

.district-label-line {
  font-family: "Aptos", "Segoe UI Variable", "Trebuchet MS", sans-serif;
  fill: var(--ink);
}

.district-number {
  font-size: 11px;
  font-weight: 700;
}

.district-name {
  font-size: 12px;
  font-weight: 700;
}

.district-metrics {
  font-size: 11px;
  fill: #304050;
}

.district-marker.selected .district-label-box {
  stroke: #0f5f58;
  stroke-width: 3.4;
  fill: rgba(210, 245, 237, 0.99);
  filter: url(#panel-shadow);
}

.district-marker.selected .district-name {
  fill: #0f5f58;
  font-weight: 800;
}

.district-marker.selected .district-metrics {
  fill: #17314b;
  font-weight: 700;
}

.district-marker.selected .district-zone {
  stroke: #0f5f58;
  stroke-opacity: 0.72;
  stroke-width: 4.4;
}

.district-marker.selected .district-core {
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 2.2;
}

@media (max-width: 1380px) {
  .top-hud {
    right: 20px;
    flex-direction: column;
  }

  .top-left-stack {
    width: 100%;
    min-height: auto;
    justify-content: flex-start;
  }

  .summary-strip {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bottom-hud {
    left: 20px;
    right: 20px;
  }

  .side-hud {
    width: min(400px, 34vw);
  }

  .selected-panel {
    width: 100%;
  }

  .critique-panel {
    width: 100%;
  }

  .plan-panel {
    width: 100%;
  }
}

@media (max-width: 1120px) {
  body {
    overflow: auto;
  }

  .map-stage {
    min-height: 1180px;
  }

  .side-hud {
    top: 420px;
    width: calc(100% - 40px);
    right: 20px;
    left: 20px;
    bottom: 140px;
  }
}

@media (max-height: 900px) {
  .startup-card {
    max-height: 92vh;
    padding: 16px 18px 16px;
  }

  .startup-card h2 {
    font-size: 1.5rem;
  }

  .startup-card p {
    font-size: 0.9rem;
  }
}
