:root {
  color-scheme: dark;
  --bg: #191a17;
  --panel: #242620;
  --panel-2: #2b2d26;
  --paper: #f8f4eb;
  --muted: rgba(248, 244, 235, 0.64);
  --line: rgba(248, 244, 235, 0.14);
  --mint: #2fb7a7;
  --amber: #f4b942;
  --danger: #e84855;
  --safe-green: #73d99f;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--paper);
  font-family: "Segoe UI", "Malgun Gothic", system-ui, sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
  width: 100vw;
  height: 100vh;
  min-height: 0;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  min-height: 0;
  padding: 12px;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border-right: 1px solid var(--line);
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
}

.brand h1,
.brand p {
  margin: 0;
}

.brand h1 {
  font-size: 20px;
  line-height: 1.15;
}

.eyebrow {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
}

.picker-strip,
.route-options {
  display: grid;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.picker-strip {
  grid-template-columns: repeat(3, 1fr) 72px;
}

.route-options {
  grid-template-columns: repeat(3, 1fr);
}

.mode-button,
.option-button,
.command-button,
.map-toolbar button,
.field-clear,
.route-search-button,
.stop-toggle {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--paper);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.mode-button.active {
  border-color: transparent;
  background: var(--amber);
  color: #1a1812;
}

.option-button.active {
  border-color: transparent;
  background: var(--paper);
  color: #191a17;
}

.command-button.quiet {
  color: var(--muted);
}

.departure-time {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px 48px;
  grid-template-areas:
    "label label now"
    "date time now";
  gap: 5px;
  align-items: center;
  padding: 6px 5px 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.departure-time label {
  grid-area: label;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.departure-time input {
  min-width: 0;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 7px;
  background: rgba(25, 26, 23, 0.42);
  color: var(--paper);
}

#departureDateInput {
  grid-area: date;
}

#departureTimeInput {
  grid-area: time;
}

#nowTimeButton {
  grid-area: now;
  min-height: 48px;
}

.location-searches {
  display: grid;
  gap: 7px;
}

.location-field {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.location-label {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.location-label small {
  color: var(--muted);
}

.pin {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--mint);
}

.pin.waypoint {
  background: var(--amber);
}

.pin.destination {
  background: var(--danger);
}

.search-input {
  min-width: 0;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
  background: rgba(25, 26, 23, 0.42);
  color: var(--paper);
}

.selected-stop {
  align-self: center;
  max-width: 110px;
  overflow: hidden;
  color: var(--paper);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-clear {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 26px;
  min-height: 24px;
}

.search-results {
  grid-column: 1 / -1;
  display: none;
  max-height: 170px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(25, 26, 23, 0.94);
}

.search-results.visible {
  display: grid;
}

.search-result {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 8px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: var(--paper);
  text-align: left;
  cursor: pointer;
}

.search-result:hover,
.search-result:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.search-result-head {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.search-result small,
.selected-stop small {
  color: var(--muted);
}

.subway-line-badge,
.stop-badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  min-height: 18px;
  border-radius: 5px;
  padding: 0 5px;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
}

.subway-line-badge {
  background: var(--line-color, #667085);
  color: var(--line-text, #fff);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.rail-station-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 18px;
  border-radius: 5px;
  padding: 0 5px;
  background: rgba(255, 255, 255, 0.11);
  color: var(--paper);
  font-size: 10px;
  font-weight: 900;
}

.rail-station-icon {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f4b942;
  box-shadow: 0 0 0 2px rgba(244, 185, 66, 0.22);
}

.route-search-action {
  display: grid;
}

.route-search-button {
  min-height: 34px;
  border-color: rgba(47, 183, 167, 0.55);
  background: rgba(47, 183, 167, 0.2);
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.summary-metric {
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.summary-metric span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.summary-metric strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
  font-size: 14px;
}

#summaryWalk {
  overflow-wrap: normal;
  white-space: nowrap;
  font-size: 12px;
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(330px, 48vh) minmax(0, 1fr);
  }

  .panel {
    order: 2;
    border-top: 1px solid var(--line);
    border-right: 0;
  }

  .map-stage {
    order: 1;
  }
}

.route-action {
  display: grid;
}

.route-action.hidden {
  display: none;
}

.route-action-button {
  min-height: 30px;
  border: 1px solid rgba(47, 183, 167, 0.55);
  border-radius: 8px;
  padding: 5px 8px;
  background: rgba(47, 183, 167, 0.18);
  color: var(--paper);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.route-candidates {
  display: none;
  gap: 6px;
  min-height: 0;
}

.route-candidates.visible {
  display: grid;
}

.candidate-card {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 6px 8px;
  align-items: start;
  width: 100%;
  min-height: 48px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--paper);
  text-align: left;
  cursor: pointer;
}

.candidate-card.active {
  border-color: rgba(244, 185, 66, 0.66);
  background: rgba(244, 185, 66, 0.13);
}

.candidate-rank {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(248, 244, 235, 0.16);
  color: var(--amber);
  font-size: 13px;
  font-weight: 900;
}

.candidate-main strong,
.candidate-main span {
  display: block;
}

.candidate-main strong {
  font-size: 13px;
}

.candidate-main span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.candidate-stats {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.candidate-stats span {
  min-height: 19px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.075);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.candidate-stats b {
  color: var(--paper);
}

.legs {
  flex: 1 1 0;
  min-height: 0;
  margin: 0 -4px 0 0;
  padding: 0 5px 6px 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  list-style: none;
}

.panel-legs:empty {
  display: none;
}

.leg {
  display: grid;
  grid-template-columns: 8px 1fr;
  gap: 8px;
  min-height: 56px;
  padding: 8px 7px;
  border-bottom: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    transform 140ms ease;
}

.leg:hover,
.leg:focus-visible {
  background: rgba(255, 255, 255, 0.07);
  outline: none;
}

.leg.active {
  background: rgba(244, 185, 66, 0.13);
  box-shadow: inset 0 0 0 1px rgba(244, 185, 66, 0.42);
}

.leg-swatch {
  width: 8px;
  min-height: 38px;
  border-radius: 6px;
  background: var(--mint);
}

.leg.walk .leg-swatch {
  background: repeating-linear-gradient(
    to bottom,
    #35352f 0,
    #35352f 7px,
    transparent 7px,
    transparent 13px
  );
  border: 1px solid var(--muted);
}

.leg.via .leg-swatch {
  background: var(--amber);
}

.leg.gap .leg-swatch {
  background: repeating-linear-gradient(
    to bottom,
    #e84855 0,
    #e84855 7px,
    transparent 7px,
    transparent 13px
  );
  border: 1px solid rgba(232, 72, 85, 0.8);
}

.leg.notice {
  background: rgba(232, 72, 85, 0.08);
  cursor: pointer;
}

.leg.notice .leg-swatch {
  background: #e84855;
}

.leg h3 {
  margin: 0 0 3px;
  font-size: 13px;
  line-height: 1.35;
}

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

.leg-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.leg-meta span {
  min-height: 19px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--paper);
  font-size: 10px;
  font-weight: 800;
}

.leg-meta span.duration {
  border: 1px solid rgba(244, 185, 66, 0.62);
  background: rgba(244, 185, 66, 0.2);
  color: #ffd56e;
}

.leg-meta span.wait {
  border: 1px solid rgba(47, 183, 167, 0.38);
  background: rgba(47, 183, 167, 0.13);
  color: #73dbcf;
}

.route-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.route-chip {
  display: inline-flex;
  align-items: center;
  min-height: 19px;
  max-width: 100%;
  padding: 2px 6px;
  border: 1px solid currentColor;
  border-radius: 6px;
  color: #f8f4eb;
  background: rgba(255, 255, 255, 0.055);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
}

.route-chip.primary {
  background: rgba(248, 244, 235, 0.16);
}

.route-chip.more {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--muted);
}

.stop-toggle {
  margin-top: 6px;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 7px;
  background: rgba(244, 185, 66, 0.16);
  color: var(--amber);
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
}

.map-stage {
  position: relative;
  min-width: 0;
  background: #d8d2c4;
  overflow: hidden;
}

#baseMap,
#mapCanvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

#baseMap {
  z-index: 0;
  pointer-events: none;
}

#mapCanvas {
  z-index: 1;
  cursor: grab;
}

#mapCanvas.pan-mode {
  cursor: grab;
}

#mapCanvas.pick-origin {
  cursor: crosshair;
}

#mapCanvas.pick-waypoint {
  cursor: crosshair;
}

#mapCanvas.pick-destination {
  cursor: crosshair;
}

#mapCanvas.dragging {
  cursor: grabbing;
}

body.is-routing #mapCanvas {
  cursor: wait;
}

.map-toolbar {
  position: absolute;
  z-index: 2;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 5px;
}

.map-toolbar button {
  min-width: 31px;
  min-height: 28px;
  background: rgba(25, 26, 23, 0.82);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.attribution {
  position: absolute;
  z-index: 2;
  right: 18px;
  bottom: 14px;
  padding: 5px 7px;
  border-radius: 6px;
  background: rgba(248, 244, 235, 0.86);
  color: rgba(25, 26, 23, 0.8);
  font-size: 11px;
  font-weight: 700;
}

.attribution a {
  color: inherit;
}

.status {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 44px;
  width: fit-content;
  max-width: calc(100% - 36px);
  padding: 7px 9px;
  border-radius: 8px;
  background: rgba(25, 26, 23, 0.86);
  color: var(--paper);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.routing-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(10, 11, 9, 0.32);
  backdrop-filter: blur(1.5px);
}

.routing-card {
  display: grid;
  justify-items: center;
  width: min(310px, calc(100vw - 44px));
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  padding: 22px 20px 19px;
  background: rgba(36, 38, 32, 0.94);
  color: var(--paper);
  text-align: center;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.42);
}

.routing-card strong {
  margin-top: 12px;
  font-size: 19px;
  line-height: 1.25;
}

.routing-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.routing-spinner {
  position: relative;
  width: 48px;
  height: 48px;
}

.routing-spinner::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 90deg, transparent 0 28%, var(--amber) 28% 48%, var(--mint) 48% 74%, transparent 74%);
  animation: routingSpin 900ms linear infinite;
}

.routing-spinner::after {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.11);
}

.routing-spinner span {
  position: absolute;
  left: 50%;
  bottom: 14px;
  z-index: 1;
  width: 4px;
  height: 12px;
  border-radius: 3px;
  background: var(--paper);
  transform-origin: 50% 10px;
  animation: routingPulse 900ms ease-in-out infinite;
}

.routing-spinner span:nth-child(1) {
  transform: translateX(-12px);
}

.routing-spinner span:nth-child(2) {
  transform: translateX(-2px);
  animation-delay: 120ms;
}

.routing-spinner span:nth-child(3) {
  transform: translateX(8px);
  animation-delay: 240ms;
}

.routing-overlay.hidden {
  display: none;
}

@keyframes routingSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes routingPulse {
  0%,
  100% {
    height: 8px;
    opacity: 0.55;
  }
  45% {
    height: 18px;
    opacity: 1;
  }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(10, 11, 9, 0.62);
}

.route-modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(520px, calc(100vw - 36px));
  max-height: min(680px, calc(100vh - 48px));
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  overflow: hidden;
  background: #242620;
  color: var(--paper);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
}

.route-modal-header {
  display: grid;
  grid-template-columns: 1fr 32px;
  gap: 10px;
  align-items: start;
  padding: 14px 14px 11px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
}

.route-modal-meta {
  margin: 0 0 4px;
  color: var(--amber);
  font-size: 11px;
  font-weight: 800;
}

.route-modal h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.route-modal-body {
  display: block;
  min-height: 0;
  padding: 10px 12px 12px;
  overflow: auto;
}

.route-modal .route-candidates {
  max-height: none;
  overflow: auto;
  padding-right: 4px;
}

.modal-backdrop.hidden {
  display: none;
}

.stop-modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(520px, calc(100vw - 36px));
  max-height: min(720px, calc(100vh - 48px));
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  overflow: hidden;
  background: #242620;
  color: var(--paper);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
}

.alert-modal {
  display: grid;
  grid-template-rows: auto auto;
  width: min(430px, calc(100vw - 36px));
  border: 1px solid rgba(232, 72, 85, 0.42);
  border-radius: 8px;
  overflow: hidden;
  background: #242620;
  color: var(--paper);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.48);
}

.alert-modal-header {
  display: grid;
  grid-template-columns: 1fr 40px;
  gap: 14px;
  align-items: start;
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(232, 72, 85, 0.28);
  background: rgba(232, 72, 85, 0.1);
}

.alert-modal-meta {
  margin: 0 0 6px;
  color: #ff9a91;
  font-size: 12px;
  font-weight: 800;
}

.alert-modal h2 {
  margin: 0;
  font-size: 21px;
  line-height: 1.25;
}

.alert-modal-body {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.alert-modal-body p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.alert-modal-ok {
  justify-self: end;
  min-width: 72px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: var(--amber);
  color: #191a17;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.stop-modal-header {
  display: grid;
  grid-template-columns: 1fr 40px;
  gap: 14px;
  align-items: start;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
}

.stop-modal-meta {
  margin: 0 0 6px;
  color: var(--amber);
  font-size: 12px;
  font-weight: 800;
}

.stop-modal h2 {
  margin: 0;
  font-size: 21px;
  line-height: 1.25;
}

.modal-close {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--paper);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.modal-stop-list {
  min-height: 0;
  margin: 0;
  padding: 10px 18px 18px;
  overflow: auto;
  list-style: none;
}

.modal-stop-list li {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 44px;
  border-bottom: 1px solid var(--line);
  color: rgba(248, 244, 235, 0.84);
}

.modal-stop-info {
  min-width: 0;
}

.modal-stop-info strong,
.modal-stop-info small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-stop-info small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.modal-stop-list li.boarding,
.modal-stop-list li.alighting {
  color: var(--paper);
}

.modal-stop-number {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.075);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.modal-stop-list li.boarding .modal-stop-number {
  background: rgba(47, 183, 167, 0.22);
  color: var(--mint);
}

.modal-stop-list li.alighting .modal-stop-number {
  background: rgba(232, 72, 85, 0.2);
  color: var(--red);
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 44vh 56vh;
  }

  .panel {
    height: auto;
    order: 2;
    padding: 16px;
    overflow: auto;
  }

  .map-stage {
    order: 1;
  }

  .legs {
    flex: none;
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 400px) {
  .departure-time {
    grid-template-columns: minmax(0, 1fr) 128px 43px;
  }
}

@media (max-width: 350px) {
  .departure-time {
    grid-template-columns: 1fr 43px;
    grid-template-areas:
      "label now"
      "date now"
      "time now";
  }
}

.safety-panel.off {
  border-color: rgba(248, 244, 235, 0.14);
  background: rgba(255, 255, 255, 0.04);
}

.safety-panel.active {
  border-color: rgba(115, 217, 159, 0.72);
  background: linear-gradient(135deg, rgba(115, 217, 159, 0.18), rgba(76, 201, 240, 0.10));
  box-shadow: inset 0 0 0 1px rgba(115, 217, 159, 0.18), 0 0 0 1px rgba(115, 217, 159, 0.10);
}

.safety-panel.active .safety-panel-header strong::after {
  content: "ON";
  display: inline-flex;
  align-items: center;
  min-height: 16px;
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--safe-green);
  color: #142017;
  font-size: 9px;
  font-weight: 1000;
}

.safety-panel.off .safety-panel-header strong::after {
  content: "OFF";
  display: inline-flex;
  align-items: center;
  min-height: 16px;
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(248, 244, 235, 0.14);
  color: rgba(248, 244, 235, 0.76);
  font-size: 9px;
  font-weight: 1000;
}

.safety-toggle {
  min-width: 78px;
  color: rgba(248, 244, 235, 0.78);
}

.safety-toggle.active {
  border-color: transparent;
  background: var(--safe-green);
  color: #142017;
  box-shadow: 0 0 0 2px rgba(115, 217, 159, 0.18);
}
.safety-map-badge {
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 6;
  max-width: min(420px, calc(100% - 180px));
  padding: 8px 11px;
  border: 1px solid rgba(115, 217, 159, 0.52);
  border-radius: 8px;
  background: rgba(25, 26, 23, 0.86);
  color: var(--paper);
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.safety-map-badge.active {
  color: #dfffe9;
}

.safety-map-badge.hidden {
  display: none;
}
/* Compact one-line safe-return controls */
.safety-panel {
  display: grid;
  grid-template-columns: minmax(128px, 0.78fr) minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.safety-panel-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.safety-panel-header strong {
  overflow: hidden;
  color: rgba(248, 244, 235, 0.84);
  font-size: 10px;
  font-weight: 1000;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.safety-panel .safety-panel-header strong::after {
  content: none;
}

.safety-kicker,
.safety-summary {
  display: none;
}

.safety-toggle,
.safety-type {
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(248, 244, 235, 0.78);
  cursor: pointer;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.safety-toggle {
  min-width: 64px;
  padding: 0 7px;
}

.safety-type-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  min-width: 0;
}

.safety-type.active {
  border-color: rgba(115, 217, 159, 0.48);
  color: #dfffe9;
  background: rgba(115, 217, 159, 0.14);
}
