.psm-map {
  position: relative;
  color: #102b4e;
  background: #f8fbff;
  border: 1px solid #d8e7f6;
  border-radius: 14px;
  overflow: hidden;
  container-type: inline-size;
}

.psm-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 9px;
  background: #edf6ff;
  border-bottom: 1px solid #dceaf8;
}

.psm-tabs > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  padding: 4px 13px;
  color: #102b4e;
  background: #fff;
  border: 1px solid #dbe8f6;
  border-radius: 8px;
  text-decoration: none;
  font-size: .79rem;
  font-weight: 750;
  line-height: 1.1;
}

.psm-tabs .psm-icon { width: 15px; height: 15px; }
.psm-tabs > [aria-selected="true"] { color: #fff; background: #0064e5; border-color: #0064e5; }
.psm-panel[hidden] { display: none; }
.psm-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(134px, 17%);
  align-items: stretch;
  background: #ebf4e8;
}

.psm-map-viewport {
  min-width: 0;
  overflow-x: auto;
}

.psm-map-canvas {
  position: relative;
  width: 100%;
  min-width: 550px;
  min-height: 285px;
  height: 100%;
  aspect-ratio: 800 / 345;
  isolation: isolate;
  background: #dceecf;
}

.psm-map-canvas > img,
.psm-map-drawing { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.psm-map-drawing { pointer-events: none; }
.psm-center { --psm-accent: #075abe; --psm-fill: #62b7fa; }
.psm-kengzi { --psm-accent: #7710bb; --psm-fill: #cb85fa; }
.psm-longtian { --psm-accent: #865205; --psm-fill: #fbd250; }
.psm-shijing { --psm-accent: #b60066; --psm-fill: #ff81ba; }
.psm-biling { --psm-accent: #136717; --psm-fill: #83df5e; }
.psm-metro14 { --psm-accent: #0454be; }
.psm-metro16 { --psm-accent: #7b10ba; }
.psm-rail { --psm-accent: #4d5768; }
.psm-civic { --psm-accent: #075abe; }
.psm-green { --psm-accent: #136717; }

.psm-shape {
  fill: var(--psm-fill);
  fill-opacity: .59;
  stroke: var(--psm-accent);
  stroke-width: 1.35;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.psm-route,
.psm-route-halo,
.psm-leader { fill: none; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.psm-route-halo { stroke: #fff; stroke-width: 5.2; }
.psm-route { stroke: var(--psm-accent); stroke-width: 2.8; }
.psm-stop { fill: #fff; stroke: var(--psm-accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.psm-leader { stroke: #627b74; stroke-width: .9; stroke-dasharray: 3 3; }
.psm-pin { fill: var(--psm-accent); stroke: #fff; stroke-width: 2; vector-effect: non-scaling-stroke; }

.psm-north {
  position: absolute;
  top: 9px;
  left: 10px;
  width: 29px;
  height: 37px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: #fffffff2;
  color: #102b4e;
  font-weight: 800;
  font-size: 11px;
  line-height: .9;
}

.psm-north svg { height: 13px; width: 15px; margin-top: -6px; }
.psm-map-label,
.psm-line-label {
  position: absolute;
  transform: translate(-50%, -50%);
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
}

.psm-map-label:hover,
.psm-map-label:focus-visible { z-index: 2; }
.psm-map-label:focus-visible,
.psm-tabs > a:focus-visible,
.psm-legend a:focus-visible,
.psm-map-viewport:focus-visible { outline: 3px solid #0053c1; outline-offset: 3px; }

.psm-area-label {
  min-height: 32px;
  place-content: center;
  padding: 5px 8px;
  color: #fff;
  background: var(--psm-accent);
  border: 1px solid #fff;
  border-radius: 9px;
  box-shadow: 0 3px 9px #162b4833;
  white-space: nowrap;
  font-size: clamp(10px, 1.5cqi, 14px);
  font-weight: 800;
}

.psm-area-label:hover { color: #fff; text-decoration: underline; }
.psm-place-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 4px 5px;
  color: #102b4e;
  background: #fffffff5;
  border: 1px solid #ebf0f5;
  border-radius: 7px;
  box-shadow: 0 3px 7px #162b4826;
  white-space: nowrap;
  font-size: clamp(9px, 1.35cqi, 12px);
  font-weight: 700;
  text-align: left;
}

.psm-place-label:hover { color: #102b4e; text-decoration: underline; }
.psm-icon { width: 1.1rem; height: 1.1rem; flex: 0 0 auto; color: var(--psm-accent, currentColor); }
.psm-line-label {
  border: 1px solid #fff;
  border-radius: 5px;
  padding: 2px 4px;
  color: #fff;
  background: var(--psm-accent);
  white-space: nowrap;
  font-weight: 750;
  font-size: clamp(9px, 1.25cqi, 11px);
}

.psm-legend {
  align-self: center;
  margin: 8px;
  padding: 10px;
  border: 1px solid #dde9f2;
  border-radius: 11px;
  background: #fffffff5;
  box-shadow: 0 4px 12px #1e364b15;
  color: #132e51;
}

.psm-legend h3 {
  margin: 0 0 8px;
  font-size: .85rem;
  font-weight: 800;
  line-height: 1.12;
}

.psm-legend h3 span { display: block; font-size: .72rem; font-weight: 650; }
.psm-legend ul { margin: 0; padding: 0; list-style: none; }
.psm-legend li { font-size: .72rem; font-weight: 640; line-height: 1.2; }
.psm-legend li + li { margin-top: 5px; }
.psm-legend a,
.psm-legend-transport li { display: flex; align-items: center; gap: 6px; color: inherit; }
.psm-legend a:not(:hover) { text-decoration: none; }
.psm-swatch { width: 16px; height: 10px; flex: 0 0 auto; background: var(--psm-fill); border: 1px solid var(--psm-accent); border-radius: 2px; }
.psm-legend .psm-legend-transport { margin-top: 9px; padding-top: 8px; border-top: 1px solid #dce6ef; }
.psm-key { flex: 0 0 16px; display: grid; place-items: center; }
.psm-key:not(.psm-rail)::before { content: ''; display: block; width: 16px; height: 3px; border-radius: 2px; background: var(--psm-accent); }
.psm-key .psm-icon { width: 14px; height: 14px; }

.psm-map-note {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 10px;
  margin: 0;
  padding: 6px 10px;
  border-top: 1px solid #dde9f3;
  background: #f8fbff;
  color: #304b68;
  font-size: .69rem;
  line-height: 1.45;
}

.psm-swipe-hint { display: none; }
.psm-detail-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 8px;
  margin: 0;
  padding: 10px;
  list-style: none;
}

.psm-detail-list article {
  display: flex;
  gap: 8px;
  min-height: 100%;
  padding: 10px;
  border: 1px solid #dbe8f6;
  border-radius: 9px;
  background: #fff;
}

.psm-detail-list h3 { margin: 0 0 4px; font-size: .9rem; font-weight: 760; color: #102b4e; }
.psm-detail-list p { margin: 0; font-size: .8rem; line-height: 1.37; color: #365571; }

@container (min-width: 686px) {
  .psm-map:has(#psm-view-map:not([hidden])) .psm-tabs {
    position: absolute;
    z-index: 4;
    top: 7px;
    left: 9px;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .psm-tabs > a { min-height: 25px; padding: 4px 12px; font-size: .72rem; box-shadow: 0 2px 7px #18364e1c; }
  .psm-tabs .psm-icon { width: 13px; height: 13px; }

  .psm-layout { grid-template-columns: minmax(0, 1fr) clamp(138px, 18cqi, 164px); }
  .psm-map-canvas { min-height: clamp(263px, 36cqi, 376px); aspect-ratio: auto; }
  .psm-north { top: 40px; width: 26px; height: 33px; }
  .psm-area-label { min-height: 28px; padding: 4px 7px; font-size: clamp(10px, 1.4cqi, 14px); }
  .psm-place-label { min-height: 25px; padding: 3px 5px; font-size: clamp(9px, 1.28cqi, 12px); }
  .psm-place-label .psm-icon { width: 15px; height: 15px; }
  .psm-legend { align-self: start; margin: 7px 7px 7px 4px; padding: 8px 7px; }
  .psm-legend h3 { margin-bottom: 6px; font-size: .78rem; }
  .psm-legend h3 span { font-size: .67rem; }
  .psm-legend li { font-size: .65rem; line-height: 1.18; }
  .psm-legend li + li { margin-top: 5px; }
  .psm-legend a,
  .psm-legend-transport li { gap: 5px; }
  .psm-legend-transport li { white-space: nowrap; }
  .psm-legend .psm-legend-transport { margin-top: 7px; padding-top: 7px; }
  .psm-map-note { padding: 4px 9px; }
}

@container (max-width: 685px) {
  .psm-layout { grid-template-columns: minmax(0, 1fr); }
  .psm-legend { margin: 5px; }
  .psm-legend ul { display: flex; flex-wrap: wrap; gap: 8px 12px; }
  .psm-legend li + li { margin-top: 0; }
  .psm-legend h3 span { display: inline; margin-left: 5px; }
}

@container (max-width: 535px) {
  .psm-tabs > a { min-height: 38px; }
  .psm-map-canvas { min-width: 570px; }
  .psm-area-label { font-size: 12px; }
  .psm-place-label { font-size: 10px; }
  .psm-swipe-hint { display: inline; font-weight: 700; }
}
