:root {
  --ink: #eef8fb;
  --muted: #a8bcc4;
  --paper: rgba(5, 17, 26, 0.90);
  --line: rgba(78, 191, 210, 0.30);
  --teal: #2bd0df;
  --teal-soft: rgba(43, 208, 223, 0.14);
  --gold: #f5cf57;
  --blue: #36a8ff;
  --green: #36d8a1;
  --pink: #ed76b6;
  --red: #ff5a45;
}

* { box-sizing: border-box; }

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

body {
  overflow: hidden;
  background: #061018;
  color: var(--ink);
  font-family: "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

button { font: inherit; }

#map { position: absolute; inset: 0; background: #061018; }

.basemap-contrast #map::after {
  position: absolute;
  inset: 0;
  z-index: 100;
  background: rgba(42, 112, 154, 0.18);
  mix-blend-mode: screen;
  content: "";
  pointer-events: none;
}

.map-ui { position: absolute; inset: 0; z-index: 500; pointer-events: none; }

.map-title,
.map-panel,
.map-caption,
.home-btn {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  box-shadow: 0 5px 18px rgba(26, 49, 58, 0.16);
  backdrop-filter: blur(8px);
}

.map-title {
  position: absolute;
  top: 14px;
  left: 50%;
  width: min(610px, calc(100vw - 690px));
  min-width: 440px;
  padding: 10px 18px 11px;
  transform: translateX(-50%);
  text-align: center;
}

.map-title .kicker {
  color: var(--teal);
  font-size: 10px;
  font-weight: 800;
}

.map-title h1 {
  margin: 3px 0 2px;
  font-size: 20px;
  line-height: 1.22;
  letter-spacing: 0;
}

.map-title p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.map-panel {
  position: absolute;
  right: 16px;
  width: 284px;
  padding: 12px;
  pointer-events: auto;
}

.layer-panel { top: 16px; }
.legend-panel { right: 16px; bottom: 18px; }

.map-panel h2 {
  margin: 0 0 9px;
  font-size: 13px;
  line-height: 1.3;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.mode-button {
  min-height: 32px;
  padding: 5px 7px;
  border: 1px solid rgba(126, 163, 175, 0.30);
  border-radius: 3px;
  background: rgba(15, 34, 44, 0.82);
  color: #b5c7ce;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.mode-button:hover { border-color: var(--teal); color: var(--teal); }

.mode-button.is-active {
  border-color: var(--teal);
  background: rgba(31, 173, 190, 0.30);
  color: #f5ffff;
  box-shadow: inset 0 0 0 1px rgba(43, 208, 223, 0.14), 0 0 14px rgba(43, 208, 223, 0.14);
}

.mode-button:last-child:nth-child(odd) { grid-column: 1 / -1; }

.legend-ramp {
  height: 10px;
  border: 1px solid rgba(185, 222, 230, 0.24);
  background: linear-gradient(
    90deg,
    #193684 0%,
    #205bbe 25%,
    #00aaff 47%,
    #00e0b8 65%,
    #f7e35f 82%,
    #ff9a3d 93%,
    #ff4f36 98%,
    #ffeee2 100%
  );
}

.legend-ramp--sparse-poi {
  background: linear-gradient(
    90deg,
    #00e1ff 0%,
    #00e1ff 10%,
    #36d8a1 22%,
    #f7e35f 40%,
    #ff9a3d 90%,
    #ff4f36 98.5%,
    #ff382d 100%
  );
}

.legend-scale,
.legend-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.legend-scale { margin-top: 5px; }
.legend-meta { margin-top: 9px; padding-top: 8px; border-top: 1px solid rgba(151, 190, 200, 0.20); }
.legend-meta strong { color: var(--ink); font-weight: 800; }

.legend-list { display: grid; gap: 7px; }

.legend-group-title {
  margin-top: 2px;
  padding-top: 6px;
  border-top: 1px solid rgba(151, 190, 200, 0.18);
  color: var(--ink);
  font-size: 10px;
  font-weight: 800;
}

.legend-group-title:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #b4c7ce;
  font-size: 11px;
  line-height: 1.35;
}

.legend-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(112, 217, 230, 0.24), 0 0 9px currentColor;
}

.legend-line {
  width: 22px;
  height: 3px;
  flex: 0 0 auto;
  border-radius: 2px;
  box-shadow: 0 0 9px currentColor;
}

.map-note {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.home-btn {
  position: absolute;
  bottom: 136px;
  left: 18px;
  min-width: 58px;
  height: 32px;
  padding: 0 11px;
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  pointer-events: auto;
}

.home-btn:hover { border-color: var(--teal); background: rgba(20, 69, 78, 0.92); color: var(--teal); }

.map-caption {
  position: absolute;
  right: 320px;
  bottom: 18px;
  left: 50%;
  width: min(610px, calc(100vw - 760px));
  min-width: 430px;
  padding: 8px 12px;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
  text-align: center;
}

.map-error { color: #ff8274; }

.amap-logo, .amap-copyright { opacity: 0.72; filter: brightness(1.3); }

@media (max-width: 980px) {
  .map-title {
    right: 16px;
    left: 16px;
    width: auto;
    min-width: 0;
    transform: none;
    text-align: left;
  }

  .layer-panel { top: 106px; }
  .map-panel { width: 250px; }
  .map-caption { right: 16px; left: 16px; width: auto; min-width: 0; transform: none; text-align: left; }
}

@media (max-width: 640px) {
  .map-title p { display: none; }
  .map-title h1 { font-size: 17px; }
  .layer-panel { top: 76px; right: 10px; width: 220px; }
  .legend-panel { right: 10px; bottom: 62px; width: 220px; }
  .map-caption { display: none; }
}

.candidate-browser {
  position: absolute;
  top: 16px;
  right: 16px;
  bottom: 18px;
  z-index: 540;
  display: flex;
  width: 420px;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(78, 191, 210, 0.42);
  border-radius: 6px;
  background: rgba(5, 17, 26, 0.96);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(10px);
  pointer-events: auto;
  transition: transform 180ms ease, opacity 180ms ease;
}

.candidate-browser.is-collapsed {
  opacity: 0;
  transform: translateX(calc(100% + 28px));
  pointer-events: none;
}

.candidate-browser-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 10px 12px 9px 14px;
  border-bottom: 1px solid rgba(126, 163, 175, 0.22);
}

.candidate-browser-header span {
  color: var(--teal);
  font-size: 9px;
  font-weight: 800;
}

.candidate-browser-header h2 {
  margin: 2px 0 0;
  font-size: 15px;
  line-height: 1.2;
}

.candidate-browser-toggle,
.candidate-browser-open,
.candidate-detail-back,
.candidate-empty button {
  border: 1px solid rgba(126, 163, 175, 0.34);
  border-radius: 4px;
  background: rgba(15, 34, 44, 0.9);
  color: var(--ink);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.candidate-browser-toggle { min-width: 48px; height: 29px; }

.candidate-browser-open {
  position: absolute;
  top: 190px;
  right: 16px;
  z-index: 541;
  min-width: 72px;
  height: 34px;
  padding: 0 10px;
  pointer-events: auto;
}

.candidate-browser-open[hidden] { display: none; }

.candidate-browser-body {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  padding: 10px 12px 12px;
}

.candidate-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(126, 163, 175, 0.20);
}

.candidate-filter-grid label {
  display: grid;
  min-width: 0;
  gap: 3px;
  color: var(--muted);
  font-size: 9px;
}

.candidate-filter-grid select {
  width: 100%;
  min-width: 0;
  height: 30px;
  padding: 0 26px 0 7px;
  overflow: hidden;
  border: 1px solid rgba(126, 163, 175, 0.28);
  border-radius: 3px;
  background: #0b202b;
  color: var(--ink);
  font-size: 11px;
  text-overflow: ellipsis;
}

.candidate-sort-field { grid-column: 1 / -1; }

.candidate-browser-summary {
  padding: 9px 2px 7px;
  color: var(--muted);
  font-size: 10px;
}

.candidate-list,
.candidate-detail {
  min-height: 0;
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-color: rgba(43, 208, 223, 0.5) transparent;
}

.candidate-row {
  display: grid;
  width: 100%;
  min-height: 52px;
  grid-template-columns: 25px 34px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 6px 7px;
  border: 0;
  border-bottom: 1px solid rgba(126, 163, 175, 0.15);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.candidate-row:hover { background: rgba(43, 208, 223, 0.08); }

.candidate-row.is-selected {
  border-left: 3px solid var(--teal);
  background: rgba(43, 208, 223, 0.14);
}

.candidate-rank {
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.candidate-level {
  display: inline-flex;
  width: 32px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border: 1px solid currentColor;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 800;
}

.candidate-level-A { color: var(--red); }
.candidate-level-B { color: #ff9a3d; }
.candidate-level-C { color: var(--teal); }

.candidate-row-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.candidate-row-copy strong,
.candidate-row-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.candidate-row-copy strong { font-size: 12px; }
.candidate-row-copy small { color: var(--muted); font-size: 9px; }

.candidate-row-score {
  color: var(--gold);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  text-align: right;
}

.candidate-empty {
  display: grid;
  min-height: 180px;
  place-content: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.candidate-empty button { height: 30px; padding: 0 10px; }

.candidate-detail-back {
  height: 30px;
  padding: 0 10px;
}

.candidate-detail-heading {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  margin: 12px 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(126, 163, 175, 0.20);
}

.candidate-detail-heading small { color: var(--muted); font-size: 9px; }
.candidate-detail-heading h3 { margin: 3px 0 0; overflow-wrap: anywhere; font-size: 15px; }
.candidate-detail-heading > strong { color: var(--gold); font-size: 20px; font-variant-numeric: tabular-nums; }

.candidate-score-section { display: grid; gap: 8px; }

.candidate-score-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
}

.candidate-score-row strong { color: var(--ink); font-variant-numeric: tabular-nums; text-align: right; }

.candidate-score-track {
  height: 7px;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(126, 163, 175, 0.18);
}

.candidate-score-track i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--gold));
  box-shadow: 0 0 8px rgba(43, 208, 223, 0.38);
}

.candidate-detail-facts { display: grid; gap: 0; margin: 15px 0 0; }

.candidate-detail-facts div {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid rgba(126, 163, 175, 0.15);
}

.candidate-detail-facts dt { color: var(--muted); font-size: 10px; }
.candidate-detail-facts dd { margin: 0; overflow-wrap: anywhere; font-size: 11px; line-height: 1.55; }

.candidate-checks h4 { margin: 14px 0 7px; font-size: 11px; }
.candidate-checks ul { margin: 0; padding-left: 17px; color: var(--muted); font-size: 10px; line-height: 1.7; }

.candidate-coordinate-note {
  margin: 14px 0 0;
  padding: 8px;
  border-left: 2px solid var(--gold);
  background: rgba(245, 207, 87, 0.07);
  color: var(--muted);
  font-size: 9px;
  line-height: 1.55;
}

.has-candidate-browser .layer-panel {
  top: 126px;
  right: auto;
  left: 16px;
}

.has-candidate-browser .legend-panel { right: 452px; }

.has-candidate-browser .map-title {
  left: calc((100% - 452px) / 2);
  width: min(610px, calc(100vw - 520px));
  min-width: 0;
}

.has-candidate-browser .map-caption {
  right: 752px;
  left: 18px;
  width: auto;
  min-width: 0;
  transform: none;
}

@media (max-width: 1180px) and (min-width: 721px) {
  .candidate-browser { width: 360px; }
  .has-candidate-browser .legend-panel { right: 392px; }
  .has-candidate-browser .map-title {
    right: auto;
    left: calc((100% - 392px) / 2);
    width: min(560px, calc(100vw - 500px));
    min-width: 0;
    transform: translateX(-50%);
    text-align: center;
  }
  .has-candidate-browser .map-caption { right: 692px; }
}

@media (max-width: 850px) and (min-width: 721px) {
  .has-candidate-browser .layer-panel { top: 190px; }
  .has-candidate-browser .map-caption { display: none; }
}

@media (max-width: 720px) {
  .candidate-browser {
    top: auto;
    right: 8px;
    bottom: 8px;
    left: 8px;
    width: auto;
    max-height: 56vh;
  }

  .candidate-browser.is-collapsed {
    opacity: 0;
    transform: translateY(calc(100% + 18px));
  }

  .candidate-browser-open { top: 170px; right: 10px; bottom: auto; }
  .candidate-browser-header { min-height: 48px; }
  .candidate-browser-body { padding: 8px 9px 10px; }
  .candidate-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .candidate-row { min-height: 48px; }
  .has-candidate-browser .map-title { right: 10px; left: 10px; width: auto; min-width: 0; transform: none; text-align: left; }
  .has-candidate-browser .layer-panel { top: 76px; right: 10px; left: auto; }
  .has-candidate-browser .legend-panel { right: 10px; left: auto; bottom: 62px; width: 220px; }
  .has-candidate-browser .map-caption { display: none; }
  body:has(.candidate-browser:not(.is-collapsed)) .legend-panel { display: none; }
  body:has(.candidate-browser:not(.is-collapsed)) .map-export-launcher { display: none !important; }
  body:has(.candidate-browser:not(.is-collapsed)) .home-btn,
  body:has(.candidate-browser:not(.is-collapsed)) .amap-scalecontrol,
  body:has(.candidate-browser:not(.is-collapsed)) .amap-controlbar { display: none !important; }
}

.transit-browser {
  position: absolute;
  top: 16px;
  right: 16px;
  bottom: 18px;
  z-index: 540;
  display: flex;
  width: 420px;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(78, 191, 210, 0.42);
  border-radius: 6px;
  background: rgba(5, 17, 26, 0.96);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(10px);
  pointer-events: auto;
  transition: transform 180ms ease, opacity 180ms ease;
}

.transit-browser.is-collapsed {
  opacity: 0;
  transform: translateX(calc(100% + 28px));
  pointer-events: none;
}

.transit-browser-header {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 9px 14px;
  border-bottom: 1px solid rgba(126, 163, 175, 0.22);
}

.transit-browser-header span,
.transit-search > span,
.transit-layer-toggles legend {
  color: var(--teal);
  font-size: 9px;
  font-weight: 800;
}

.transit-browser-header h2 {
  margin: 2px 0 0;
  font-size: 15px;
  line-height: 1.2;
}

.transit-browser-toggle,
.transit-browser-open,
.transit-clear {
  height: 30px;
  border: 1px solid rgba(126, 163, 175, 0.34);
  border-radius: 4px;
  background: rgba(15, 34, 44, 0.9);
  color: var(--ink);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.transit-browser-toggle { min-width: 48px; }

.transit-browser-open {
  position: absolute;
  top: 190px;
  right: 16px;
  z-index: 541;
  min-width: 72px;
  padding: 0 10px;
  pointer-events: auto;
}

.transit-browser-open[hidden] { display: none; }

.transit-browser-body {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  padding: 10px 12px 12px;
}

.transit-search {
  display: grid;
  gap: 4px;
}

.transit-search input {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(126, 163, 175, 0.30);
  border-radius: 3px;
  outline: 0;
  background: #0b202b;
  color: var(--ink);
  font-size: 12px;
}

.transit-search input::placeholder { color: #718b95; }

.transit-layer-toggles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 10px 0 0;
  padding: 8px 0 10px;
  border: 0;
  border-bottom: 1px solid rgba(126, 163, 175, 0.18);
}

.transit-layer-toggles legend { padding: 0 0 5px; }

.transit-layer-toggles label {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 5px;
  color: var(--muted);
  cursor: pointer;
  font-size: 9px;
  line-height: 1.35;
}

.transit-layer-toggles input {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  margin: 0;
  accent-color: var(--teal);
}

.transit-browser-summary {
  padding: 8px 2px 6px;
  color: var(--muted);
  font-size: 10px;
}

.transit-route-list,
.transit-route-detail {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-color: rgba(43, 208, 223, 0.5) transparent;
}

.transit-route-list { flex: 1 1 52%; }

.transit-route-list:has(.transit-route-row.is-selected) {
  max-height: 44%;
  flex: 0 1 auto;
}

.transit-route-detail {
  flex: 1 1 auto;
  margin-top: 8px;
  padding-top: 9px;
  border-top: 1px solid rgba(126, 163, 175, 0.24);
}

.transit-route-row {
  display: grid;
  width: 100%;
  min-height: 49px;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 6px 7px;
  border: 0;
  border-bottom: 1px solid rgba(126, 163, 175, 0.14);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.transit-route-row:hover { background: rgba(43, 208, 223, 0.08); }

.transit-route-row.is-selected {
  border-left: 3px solid #23d5ff;
  background: rgba(35, 213, 255, 0.14);
}

.transit-route-badge {
  display: grid;
  width: 44px;
  height: 27px;
  place-items: center;
  overflow: hidden;
  border: 1px solid #23d5ff;
  border-radius: 3px;
  color: #8deaff;
  font-size: 10px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transit-route-copy,
.transit-direction-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.transit-route-copy strong,
.transit-route-copy small,
.transit-direction-copy strong,
.transit-direction-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transit-route-copy strong { font-size: 12px; }
.transit-route-copy small { color: var(--muted); font-size: 9px; }

.transit-detail-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px 7px;
}

.transit-detail-heading span { color: var(--muted); font-size: 9px; }
.transit-detail-heading h3 { margin: 0; font-size: 13px; }

.transit-direction-list { display: grid; }

.transit-direction {
  display: grid;
  width: 100%;
  min-height: 44px;
  grid-template-columns: 37px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  padding: 5px 7px;
  border: 0;
  border-bottom: 1px solid rgba(126, 163, 175, 0.13);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.transit-direction:hover { background: rgba(35, 213, 255, 0.07); }

.transit-direction.is-selected {
  background: rgba(35, 213, 255, 0.16);
  box-shadow: inset 3px 0 #23d5ff;
}

.transit-direction.is-stopped { color: #cc9c8e; }
.transit-direction-index { color: #7be7ff; font-size: 9px; font-weight: 800; }
.transit-direction-copy strong { font-size: 10px; }
.transit-direction-copy small { color: var(--muted); font-size: 9px; }

.transit-clear {
  width: 100%;
  flex: 0 0 31px;
  margin-top: 8px;
  border-color: rgba(245, 207, 87, 0.40);
  color: var(--gold);
}

.transit-empty {
  display: grid;
  min-height: 120px;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
}

.transit-browser button:focus-visible,
.transit-browser input:focus-visible,
.transit-browser-open:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.has-transit-browser .layer-panel {
  top: 126px;
  right: auto;
  left: 16px;
}

.has-transit-browser .legend-panel { right: 452px; }

.has-transit-browser .map-title {
  left: calc((100% - 452px) / 2);
  width: min(610px, calc(100vw - 520px));
  min-width: 0;
}

.has-transit-browser .map-caption {
  right: 752px;
  left: 18px;
  width: auto;
  min-width: 0;
  transform: none;
}

@media (max-width: 1180px) and (min-width: 721px) {
  .transit-browser { width: 360px; }
  .transit-layer-toggles { grid-template-columns: 1fr; }
  .has-transit-browser .legend-panel { right: 392px; }
  .has-transit-browser .map-title {
    right: auto;
    left: calc((100% - 392px) / 2);
    width: min(560px, calc(100vw - 500px));
    transform: translateX(-50%);
    text-align: center;
  }
  .has-transit-browser .map-caption { right: 692px; }
}

@media (max-width: 850px) and (min-width: 721px) {
  .has-transit-browser .layer-panel { top: 190px; }
  .has-transit-browser .map-caption { display: none; }
}

@media (max-width: 720px) {
  .transit-browser {
    top: auto;
    right: 8px;
    bottom: 8px;
    left: 8px;
    width: auto;
    max-height: 62vh;
  }

  .transit-browser.is-collapsed {
    opacity: 0;
    transform: translateY(calc(100% + 18px));
  }

  .transit-browser-open { top: 170px; right: 10px; }
  .transit-browser-header { min-height: 48px; }
  .transit-browser-body { padding: 8px 9px 10px; }
  .transit-layer-toggles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .transit-route-row { min-height: 46px; }
  .has-transit-browser .map-title { right: 10px; left: 10px; width: auto; transform: none; text-align: left; }
  .has-transit-browser .layer-panel { top: 76px; right: 10px; left: auto; }
  .has-transit-browser .legend-panel { right: 10px; left: auto; bottom: 62px; width: 220px; }
  .has-transit-browser .map-caption { display: none; }
  body:has(.transit-browser:not(.is-collapsed)) .legend-panel,
  body:has(.transit-browser:not(.is-collapsed)) .map-export-launcher { display: none !important; }
  body:has(.transit-browser:not(.is-collapsed)) .home-btn,
  body:has(.transit-browser:not(.is-collapsed)) .amap-scalecontrol,
  body:has(.transit-browser:not(.is-collapsed)) .amap-controlbar { display: none !important; }
}

/* Resource inventory workbench used by the station-and-canopy map. */
.resource-browser {
  position: absolute;
  top: 16px;
  right: 16px;
  bottom: 18px;
  z-index: 540;
  display: flex;
  width: 420px;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(78, 191, 210, 0.42);
  border-radius: 6px;
  background: rgba(5, 17, 26, 0.96);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(10px);
  pointer-events: auto;
  transition: transform 180ms ease, opacity 180ms ease;
}

.resource-browser.is-collapsed { opacity: 0; transform: translateX(calc(100% + 28px)); pointer-events: none; }
.resource-browser-header { display: flex; min-height: 58px; align-items: center; justify-content: space-between; padding: 10px 12px 9px 14px; border-bottom: 1px solid rgba(126, 163, 175, 0.22); }
.resource-browser-header span, .resource-filter-search > span, .resource-filter-row > label > span, .resource-nature-filters legend, .resource-editor > label > span, .resource-poi-search > span, .resource-coordinate > span { color: var(--teal); font-size: 9px; font-weight: 800; }
.resource-browser-header h2 { margin: 2px 0 0; font-size: 15px; line-height: 1.2; }

.resource-browser-toggle, .resource-browser-open, .resource-actions button, .resource-import, .resource-detail-back, .resource-detail-actions button, .resource-editor button {
  height: 30px;
  border: 1px solid rgba(126, 163, 175, 0.34);
  border-radius: 4px;
  background: rgba(15, 34, 44, 0.9);
  color: var(--ink);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.resource-browser-toggle { min-width: 48px; }
.resource-browser-open { position: absolute; top: 190px; right: 16px; z-index: 541; min-width: 80px; padding: 0 10px; pointer-events: auto; }
.resource-browser-open[hidden] { display: none; }
.resource-browser-body { display: flex; min-height: 0; flex: 1; flex-direction: column; padding: 10px 12px 12px; }
.resource-filter-search { display: grid; gap: 4px; }
.resource-filter-search input, .resource-filter-row select, .resource-editor input, .resource-editor select, .resource-editor textarea {
  width: 100%;
  border: 1px solid rgba(126, 163, 175, 0.30);
  border-radius: 3px;
  outline: 0;
  background: #0b202b;
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
}

.resource-filter-search input, .resource-editor input, .resource-editor select { height: 34px; padding: 0 10px; }
.resource-editor textarea { min-height: 54px; padding: 8px 10px; resize: vertical; }
.resource-filter-search input::placeholder, .resource-editor input::placeholder { color: #718b95; }
.resource-filter-row { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 9px; margin-top: 9px; }
.resource-filter-row > label { display: grid; gap: 4px; }
.resource-filter-row select { height: 30px; padding: 0 22px 0 7px; font-size: 11px; }
.resource-actions { display: flex; align-items: end; justify-content: end; gap: 6px; }
.resource-actions button, .resource-import { min-width: 48px; padding: 0 8px; }
.resource-import { display: inline-flex; align-items: center; justify-content: center; }
.resource-import input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }

.resource-nature-filters { display: flex; flex-wrap: wrap; gap: 5px 10px; margin: 10px 0 0; padding: 7px 0 9px; border: 0; border-top: 1px solid rgba(126, 163, 175, 0.18); border-bottom: 1px solid rgba(126, 163, 175, 0.18); }
.resource-nature-filters legend { width: 100%; padding: 0 0 2px; }
.resource-nature-filters label { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); cursor: pointer; font-size: 10px; }
.resource-nature-filters input { width: 13px; height: 13px; margin: 0; accent-color: var(--cyan); }
.resource-browser-summary { padding: 9px 2px 7px; color: var(--muted); font-size: 10px; }
.resource-list, .resource-detail, .resource-editor { min-height: 0; flex: 1; overflow-x: hidden; overflow-y: auto; scrollbar-color: rgba(43, 208, 223, 0.5) transparent; }
.resource-list[hidden], .resource-detail[hidden], .resource-editor[hidden] { display: none; }

.resource-row { display: grid; width: 100%; min-height: 53px; grid-template-columns: 24px minmax(0, 1fr) 38px; align-items: center; gap: 8px; margin: 0; padding: 6px 7px; border: 0; border-bottom: 1px solid rgba(126, 163, 175, 0.15); background: transparent; color: var(--ink); cursor: pointer; text-align: left; }
.resource-row:hover { background: rgba(43, 208, 223, 0.08); }
.resource-row.is-selected { border-left: 3px solid var(--teal); background: rgba(43, 208, 223, 0.14); }
.resource-row-status { display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center; border: 1px solid currentColor; border-radius: 50%; font-size: 9px; font-weight: 800; }
.resource-row-status--located { color: var(--teal); }
.resource-row-status--unlocated { color: var(--orange); }
.resource-row-copy { display: grid; min-width: 0; gap: 3px; }
.resource-row-copy strong, .resource-row-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resource-row-copy strong { font-size: 12px; }
.resource-row-copy small { color: var(--muted); font-size: 9px; }
.resource-row-seq { color: var(--gold); font-size: 10px; font-variant-numeric: tabular-nums; text-align: right; }
.resource-empty { display: grid; min-height: 180px; place-content: center; color: var(--muted); font-size: 12px; text-align: center; }

.resource-detail-heading { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 9px; margin: 12px 0 14px; padding-bottom: 12px; border-bottom: 1px solid rgba(126, 163, 175, 0.20); }
.resource-nature-chip { display: inline-flex; min-height: 22px; align-items: center; padding: 0 7px; border: 1px solid var(--cyan); border-radius: 3px; color: var(--cyan); font-size: 10px; font-weight: 800; }
.resource-detail-heading small { color: var(--muted); font-size: 9px; }
.resource-detail-heading h3 { margin: 3px 0 0; overflow-wrap: anywhere; font-size: 15px; }
.resource-detail-facts { display: grid; gap: 0; margin: 0; }
.resource-detail-facts div { display: grid; grid-template-columns: 68px minmax(0, 1fr); gap: 8px; padding: 8px 0; border-top: 1px solid rgba(126, 163, 175, 0.15); }
.resource-detail-facts dt { color: var(--muted); font-size: 10px; }
.resource-detail-facts dd { margin: 0; overflow-wrap: anywhere; font-size: 11px; line-height: 1.55; }
.resource-detail-actions { display: flex; gap: 7px; margin-top: 15px; }
.resource-detail-actions button { padding: 0 10px; }

.resource-editor { display: grid; align-content: start; gap: 9px; padding-right: 2px; }
.resource-editor > header { display: grid; gap: 4px; padding-bottom: 8px; border-bottom: 1px solid rgba(126, 163, 175, 0.20); }
.resource-editor h3 { margin: 0; font-size: 15px; }
.resource-editor header p { min-height: 13px; margin: 0; color: var(--orange); font-size: 10px; }
.resource-editor > label { display: grid; gap: 4px; }
.resource-coordinate { display: grid; gap: 4px; padding: 8px; border-left: 2px solid var(--gold); background: rgba(245, 207, 87, 0.07); }
.resource-coordinate strong { color: var(--gold); font-size: 11px; font-variant-numeric: tabular-nums; }
.resource-poi-search > div { display: grid; grid-template-columns: minmax(0, 1fr) 55px; gap: 6px; margin-top: 4px; }
.resource-search-results { display: grid; gap: 4px; }
.resource-search-results button { display: grid; height: auto; min-height: 38px; gap: 2px; padding: 6px 8px; text-align: left; }
.resource-search-results strong { font-size: 11px; }
.resource-search-results small { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.resource-empty-note { margin: 0; color: var(--muted); font-size: 10px; }
.resource-editor-actions { display: flex; justify-content: end; gap: 7px; padding-top: 3px; }
.resource-editor-actions button { padding: 0 10px; }
#resourceSaveButton { border-color: rgba(43, 208, 223, 0.7); color: var(--cyan); }
#resourceClearButton { border-color: rgba(255, 154, 61, 0.62); color: var(--orange); }
#resourceClearButton:hover { background: rgba(255, 154, 61, 0.13); }

.has-resource-browser .layer-panel { top: 126px; right: auto; left: 16px; }
.has-resource-browser .legend-panel { right: 452px; }
.has-resource-browser .map-title { left: calc((100% - 452px) / 2); width: min(610px, calc(100vw - 520px)); min-width: 0; }
.has-resource-browser .map-caption { right: 752px; left: 18px; width: auto; min-width: 0; transform: none; }
body.is-resource-picking #map { cursor: crosshair; }

@media (max-width: 1180px) and (min-width: 721px) {
  .resource-browser { width: 360px; }
  .has-resource-browser .legend-panel { right: 392px; }
  .has-resource-browser .map-title { right: auto; left: calc((100% - 392px) / 2); width: min(560px, calc(100vw - 500px)); min-width: 0; transform: translateX(-50%); text-align: center; }
  .has-resource-browser .map-caption { right: 692px; }
}

@media (max-width: 720px) {
  .resource-browser { top: auto; right: 8px; bottom: 8px; left: 8px; width: auto; max-height: 62vh; }
  .resource-browser.is-collapsed { transform: translateY(calc(100% + 18px)); }
  .resource-browser-open { top: 170px; right: 10px; }
  .has-resource-browser .map-title { right: 10px; left: 10px; width: auto; min-width: 0; transform: none; text-align: left; }
  .has-resource-browser .layer-panel { top: 76px; right: 10px; left: auto; }
  .has-resource-browser .legend-panel { right: 10px; left: auto; bottom: 62px; width: 220px; }
  .has-resource-browser .map-caption { display: none; }
}
