.map-switch {
  position: absolute;
  z-index: 6;
  top: 0.85rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.15rem;
  padding: 0.2rem;
  border: 1px solid var(--line, #27272a);
  border-radius: 12px;
  background: var(--surface, #18181b);
}

.map-switch__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  border: 1px solid transparent;
  color: var(--muted, #d4aafb);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1.2;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.map-switch__btn .ph {
  font-size: 1.05rem;
}

.map-switch__btn:hover {
  color: #fff;
}

.map-switch__btn.is-active {
  background: var(--bg, #09090b);
  border-color: var(--line, #27272a);
  color: #fff;
}

.map-switch__btn:focus-visible {
  outline: 2px solid var(--accent, #a855f7);
  outline-offset: 2px;
}

.map-stage__frame.is-hidden,
.metro-stage.is-hidden {
  display: none !important;
}

.metro-stage {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: var(--bg, #09090b);
  overflow: hidden;
  cursor: grab;
}

.metro-stage.is-dragging {
  cursor: grabbing;
}

.metro-svg {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.metro-search {
  position: absolute;
  z-index: 5;
  top: 3.7rem;
  left: 0.85rem;
  width: min(18rem, calc(100vw - 1.7rem));
}

.metro-search__field {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0 0.75rem;
  border: 1px solid var(--line, #27272a);
  border-radius: 12px;
  background: var(--surface, #18181b);
}

.metro-search__field .ph {
  color: var(--muted, #d4aafb);
  font-size: 1.05rem;
}

.metro-search input {
  flex: 1;
  min-width: 0;
  padding: 0.7rem 0;
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.92rem;
}

.metro-search input:focus {
  outline: none;
}

.metro-search__field:focus-within {
  outline: 2px solid var(--accent, #a855f7);
  outline-offset: 0;
  border-color: var(--accent, #a855f7);
}

.metro-suggest {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0.25rem;
  border: 1px solid var(--line, #27272a);
  border-radius: 12px;
  background: var(--surface, #18181b);
  max-height: 14rem;
  overflow: auto;
}

.metro-suggest button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.65rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}

.metro-suggest button:hover,
.metro-suggest button.is-active {
  background: var(--bg, #09090b);
}

.metro-suggest button:focus-visible {
  outline: 2px solid var(--accent, #a855f7);
  outline-offset: 0;
}

.metro-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 999px;
  flex: 0 0 auto;
  background: var(--sw, #a855f7);
}

.metro-panel {
  position: absolute;
  z-index: 5;
  top: 3.7rem;
  right: 0.85rem;
  width: min(16.5rem, calc(100vw - 1.7rem));
  padding: 1rem 1.05rem 1.05rem;
  border: 1px solid var(--line, #27272a);
  border-radius: 12px;
  background: var(--surface, #18181b);
}

.metro-panel__line {
  margin: 0 0 0.35rem;
  color: var(--muted, #d4aafb);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metro-panel__name {
  margin: 0;
  padding-right: 1.6rem;
  font-family: var(--display, inherit);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

.metro-panel__coords {
  margin: 0.4rem 0 0.85rem;
  color: var(--muted, #d4aafb);
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
  font-size: 0.85rem;
}

.metro-panel__go {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  background: var(--accent, #a855f7);
  color: #fff;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.metro-panel__go:hover {
  background: var(--accent-hover, #9333ea);
}

.metro-panel__go:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.metro-panel__close {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  width: 1.75rem;
  height: 1.75rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted, #d4aafb);
  cursor: pointer;
}

.metro-panel__close:hover {
  color: #fff;
  background: var(--bg, #09090b);
}

.metro-panel__close:focus-visible {
  outline: 2px solid var(--accent, #a855f7);
}

.metro-hud-bl {
  position: absolute;
  z-index: 4;
  left: 0.85rem;
  bottom: 0.85rem;
  display: grid;
  gap: 0.45rem;
}

.metro-coords {
  margin: 0;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--line, #27272a);
  border-radius: 10px;
  background: var(--surface, #18181b);
  color: var(--muted, #d4aafb);
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
  font-size: 0.8rem;
}

.metro-legend {
  list-style: none;
  margin: 0;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--line, #27272a);
  border-radius: 10px;
  background: var(--surface, #18181b);
  display: grid;
  gap: 0.3rem;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
}

.metro-legend li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.metro-swatch {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 2px;
  background: var(--sw);
  flex: 0 0 auto;
}

.metro-tools {
  position: absolute;
  z-index: 4;
  right: 0.85rem;
  bottom: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.metro-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border: 1px solid var(--line, #27272a);
  border-radius: 10px;
  background: var(--surface, #18181b);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.metro-tool:hover {
  background: var(--bg, #09090b);
}

.metro-tool:focus-visible {
  outline: 2px solid var(--accent, #a855f7);
  outline-offset: 2px;
}

.metro-empty,
.metro-miss {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 5.5rem;
  transform: translateX(-50%);
  margin: 0;
  max-width: 22rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line, #27272a);
  border-radius: 12px;
  background: var(--surface, #18181b);
  color: var(--muted, #d4aafb);
  font-size: 0.88rem;
  text-align: center;
  line-height: 1.4;
}

.metro-empty .ph {
  display: block;
  margin: 0 auto 0.35rem;
  color: var(--accent, #a855f7);
  font-size: 1.35rem;
}

.metro-empty p {
  margin: 0;
}

.metro-grid {
  pointer-events: none;
}

.metro-line {
  fill: none;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.metro-mark-letter {
  font-family: var(--display, inherit);
  pointer-events: none;
}

.metro-label {
  fill: #fff;
  font-family: var(--display, inherit);
  font-weight: 650;
  pointer-events: none;
}

.metro-axis {
  fill: #d4aafb;
  font-family: var(--display, inherit);
  font-weight: 700;
  letter-spacing: 0.08em;
  pointer-events: none;
}

.metro-hit {
  fill: transparent;
  cursor: pointer;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 720px) {
  .map-switch {
    left: 0.85rem;
    right: 0.85rem;
    transform: none;
    width: auto;
    justify-content: stretch;
  }

  .map-switch__btn {
    flex: 1;
    justify-content: center;
  }

  .metro-search {
    top: 3.7rem;
    left: 0.85rem;
    right: 0.85rem;
    width: auto;
  }

  .metro-panel {
    top: auto;
    bottom: 7.25rem;
    right: 0.85rem;
    left: 0.85rem;
    width: auto;
  }

  .metro-empty,
  .metro-miss {
    left: 0.85rem;
    right: 0.85rem;
    transform: none;
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .map-switch__btn,
  .metro-panel__go,
  .metro-tool {
    transition: none;
  }
}
