:root {
  --blue: #126ed4;
  --blue-dark: #0a4f9e;
  --blue-soft: #eaf4ff;
  --ink: #17233a;
  --muted: #718096;
  --line: #e4eaf0;
  --surface: #fff;
  --page: #f4f7fa;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

.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;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(41, 129, 219, 0.08), transparent 28rem), var(--page);
  font-family:
    'Pretendard',
    -apple-system,
    BlinkMacSystemFont,
    'Apple SD Gothic Neo',
    sans-serif;
}

button,
a {
  font: inherit;
}

.site-shell {
  min-height: 100vh;
}

.fab-menu-container {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 100;
}

.fab-main-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--blue);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(18, 110, 212, 0.35);
  list-style: none;
  cursor: pointer;
}

.fab-main-btn::-webkit-details-marker {
  display: none;
}

.fab-main-btn:hover {
  background: var(--blue-dark);
}

.fab-main-btn:focus-visible,
.fab-menu-item:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.fab-dropup-menu {
  position: absolute;
  right: 0;
  bottom: 46px;
  width: min(210px, calc(100vw - 28px));
  max-height: calc(100dvh - 90px - env(safe-area-inset-bottom));
  padding: 5px 0;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid #d1d6db;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.fab-menu-item {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
}

.fab-menu-item:hover {
  color: var(--blue);
  background: var(--blue-soft);
}

.fab-menu-item.active {
  color: var(--blue);
  font-weight: 700;
}

.item-tag {
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.1;
}

.item-tag.tag-active {
  color: var(--blue);
  background: var(--blue-soft);
  border: 1px solid #c9e2ff;
}

.notice-modal {
  width: min(500px, calc(100% - 32px));
  max-height: calc(100dvh - 40px);
  padding: 28px;
  overflow-y: auto;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0;
  box-shadow: 0 20px 70px rgba(23, 35, 58, 0.22);
}

.notice-modal::backdrop {
  background: rgba(23, 35, 58, 0.45);
}

body:has(.notice-modal[open]) {
  overflow: hidden;
}

.notice-modal h2 {
  margin: 0 0 20px;
  font-size: clamp(21px, 5vw, 26px);
  line-height: 1.45;
  letter-spacing: -0.045em;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.notice-description p {
  margin: 0 0 14px;
  color: #435169;
  font-size: 12px;
  line-height: 1.8;
  text-align: justify;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.notice-description p:last-child {
  margin-bottom: 0;
}

.notice-actions {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.notice-hide-today {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.notice-hide-today input {
  margin: 0;
  accent-color: var(--blue);
}

.notice-confirm {
  padding: 10px 26px;
  color: #fff;
  background: var(--blue);
  border: 0;
  border-radius: 0;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.notice-confirm:hover {
  background: var(--blue-dark);
}

.notice-modal button:focus-visible,
.notice-hide-today input:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  background: #1bb66c;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(27, 182, 108, 0.12);
}

.content {
  width: min(1400px, calc(100% - 48px));
  margin: 0 auto;
  padding: 34px 0 70px;
}

.intro {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 28px;
  margin-bottom: 22px;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 7px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.intro h1 {
  margin: 0;
  font-size: clamp(26px, 2.2vw, 36px);
  line-height: 1.25;
  letter-spacing: -0.045em;
}

.intro-copy {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: -0.015em;
}

.route-switch {
  width: min(720px, 64vw);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  padding: 5px;
  background: #e9eef3;
  border: 1px solid #dde5ec;
  border-radius: 15px;
}

.route-tab {
  min-width: 0;
  padding: 11px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #6a788b;
  background: transparent;
  border: 0;
  border-radius: 11px;
  cursor: pointer;
  transition: 0.18s ease;
}

.route-tab:hover {
  color: var(--ink);
}

.route-tab.active {
  color: #233247;
  background: #fff;
  box-shadow: none;
}

.tab-time {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  opacity: 0.78;
}

.tab-name {
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.map-card {
  height: min(680px, calc(100vh - 240px));
  min-height: 510px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid #dbe3ea;
  border-radius: 22px;
  box-shadow: 0 18px 48px rgba(32, 54, 80, 0.1);
}

.map-pane {
  position: relative;
  min-width: 0;
  background: #eaf0f2;
}

#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.update-chip,
.map-tools {
  position: absolute;
  z-index: 5;
}

.map-tools {
  top: 18px;
  right: 18px;
  display: flex;
  gap: 7px;
}

.map-tools button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #536176;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #dbe3ea;
  border-radius: 11px;
  box-shadow: 0 5px 17px rgba(34, 55, 76, 0.12);
  cursor: pointer;
}

.map-tools button:hover {
  color: var(--blue);
}

.map-tools button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.map-tools .mobile-refresh-button {
  display: none;
}

.map-tools .mobile-refresh-button.is-refreshing svg {
  animation: map-refresh-spin 0.75s linear infinite;
}

.map-tools .mobile-refresh-button:disabled {
  color: var(--blue);
  cursor: wait;
}

@keyframes map-refresh-spin {
  to {
    transform: rotate(360deg);
  }
}

.map-tools .subway-toggle {
  width: auto;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
}

.map-tools .subway-toggle[aria-pressed='true'] {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: #a8ccef;
}

.map-tools button[hidden] {
  display: none;
}

.map-tools svg {
  width: 19px;
  height: 19px;
}

.update-chip {
  bottom: 16px;
  left: 18px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  color: #6f7e90;
  background: rgba(255, 255, 255, 0.93);
  border: 1px solid rgba(218, 227, 234, 0.94);
  border-radius: 9px;
  box-shadow: 0 4px 15px rgba(34, 55, 76, 0.08);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  backdrop-filter: blur(10px);
}

.update-chip time {
  padding-right: 7px;
  border-right: 1px solid #dbe3ea;
  font-variant-numeric: tabular-nums;
}

.update-chip svg {
  width: 14px;
  height: 14px;
  color: var(--blue);
}

.route-panel {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 29px 28px 24px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-left: 1px solid var(--line);
}

.route-summary {
  margin: 0 0 14px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  text-align: center;
}

.route-summary strong,
.route-summary span {
  display: block;
}

.route-summary strong {
  color: var(--ink);
  font-size: 13px;
  letter-spacing: -0.02em;
}

.route-summary span {
  margin-top: 4px;
  color: #8290a3;
  font-size: 10px;
}

.operation-board {
  margin-bottom: 17px;
  padding: 13px;
  background: #fbfcfe;
  border: 1px solid #e4eaf0;
  border-radius: 13px;
}

.operation-heading,
.arrival-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.operation-heading {
  margin-bottom: 9px;
}

.operation-heading h3,
.arrival-heading h3 {
  margin: 0;
  color: #435169;
  font-size: 11px;
  letter-spacing: -0.015em;
}

.live-count {
  padding: 4px 7px;
  color: #77869a;
  background: #eef2f6;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

/* .live-count.active {
  color: #087443;
  background: #e4f7ed;
}

.live-count.active::before {
  content: '';
  width: 5px;
  height: 5px;
  margin-right: 4px;
  display: inline-block;
  vertical-align: 1px;
  background: #16a765;
  border-radius: 50%;
} */

.service-timeline {
  display: grid;
  gap: 6px;
}

.service-row {
  min-height: 54px;
  padding: 9px 10px;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  background: #fff;
  border: 1px solid #e6ebf0;
  border-radius: 10px;
}

.service-row time {
  color: #185fae;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.service-row > div {
  min-width: 0;
}

.service-row strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-row strong {
  color: #27354b;
  font-size: 10.5px;
}

.service-row span {
  margin-top: 3px;
  display: block;
  color: #8793a4;
  font-size: 8.5px;
  line-height: 1.35;
  white-space: normal;
}

.service-row.live {
  background: #f2fbf6;
  border-color: #caecd9;
}

.service-row.live time {
  color: #087443;
}

.service-empty,
.board-loading {
  padding: 11px 12px;
  color: #8793a4;
  background: #fff;
  border: 1px dashed #dce3ea;
  border-radius: 9px;
  font-size: 9.5px;
  line-height: 1.45;
}

.service-empty strong,
.service-empty span {
  display: block;
}

.service-empty strong {
  color: #536176;
  font-size: 10.5px;
}

.service-empty span {
  margin-top: 3px;
}

.board-loading.error {
  color: #a45b52;
  background: #fff9f7;
  border-color: #f0d9d4;
}

.arrival-heading {
  margin: 14px 0 8px;
  padding-top: 11px;
  border-top: 1px solid #e8edf2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.arrival-heading .title-area {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.arrival-heading h3 {
  margin: 0;
  color: #27354b;
  font-size: 11px;
  font-weight: 800;
  line-height: 16px;
  white-space: nowrap;
}

.arrival-heading .ref-badge {
  padding: 1.5px 6px;
  color: #1768bd;
  background: #edf5fe;
  border: 1px solid #d4e5f9;
  border-radius: 5px;
  font-size: 8px;
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.25;
}

.arrival-heading a {
  box-sizing: border-box;
  height: 16px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  color: var(--blue);
  background: #fff;
  border: 1px solid #d7e4f2;
  border-radius: 999px;
  font-size: 8px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.arrival-heading a:hover {
  background: #edf5fe;
  border-color: #bfd6ed;
}

.arrival-history {
  display: grid;
  gap: 6px;
}

.history-row {
  min-height: 34px;
  padding: 4px 6px 4px 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #fbfcfe;
  border: 1px solid #e8eef4;
  border-radius: 8px;
}

.history-row > strong {
  flex: 0 0 auto;
  color: #33435b;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.history-times {
  min-width: 0;
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

.history-chip {
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #334155;
  background: #fff;
  border: 1px solid #dbe3ed;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(30, 50, 80, 0.04);
  transition: 0.15s ease;
}

.history-chip.is-nearest {
  color: #1262c5;
  background: #edf5fe;
  border-color: #bad6fa;
  font-weight: 800;
}

.history-chip:hover {
  background: #eef4fb;
  border-color: #cbdcf2;
}

.no-history {
  color: #9aa5b4;
  font-size: 9px;
}

.stop-list {
  flex: 0 0 auto;
  min-height: 0;
  margin: 0;
  padding: 1px 0 1px 5px;
  overflow: visible;
  list-style: none;
}

.stop-item {
  --stop-color: var(--blue);
  position: relative;
  min-height: 77px;
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 0 0 17px;
  cursor: pointer;
}

.stop-item:last-child {
  min-height: auto;
  padding-bottom: 0;
}

.stop-item::before {
  content: '';
  position: absolute;
  top: 17px;
  bottom: -1px;
  left: 10px;
  width: 2px;
  background: #acd1f7;
}

.stop-item:last-child::before {
  display: none;
}

.stop-node {
  position: relative;
  z-index: 1;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: #fff;
  background: #fff;
  border: 2px solid var(--stop-color);
  border-radius: 50%;
  box-shadow: 0 0 0 4px #eff6fd;
}

.stop-item.major .stop-node {
  background: var(--stop-color);
}

.stop-item.major .stop-node::after {
  content: '';
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
}

.stop-info strong,
.stop-info span {
  display: block;
}

.stop-info strong {
  padding-top: 1px;
  color: #23314a;
  font-size: 14px;
  letter-spacing: -0.025em;
}

.stop-info span {
  margin-top: 4px;
  color: #8b98aa;
  font-size: 10px;
  line-height: 1.35;
}

.stop-order {
  padding-top: 3px;
  color: #a1adbb;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.stop-item.active .stop-info strong {
  color: var(--blue);
}

.stop-item.active .stop-node {
  box-shadow: 0 0 0 5px rgba(18, 110, 212, 0.13);
  transform: scale(1.08);
}

.panel-footer {
  margin-top: 21px;
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #145da8;
  background: linear-gradient(135deg, #f0f7ff, #e7f3ff);
  border-radius: 13px;
}

.bus-symbol {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 5px 13px rgba(18, 110, 212, 0.12);
}

.bus-symbol svg {
  width: 27px;
  height: 27px;
}

.panel-footer strong,
.panel-footer div > span {
  display: block;
}

.panel-footer strong {
  font-size: 11px;
}

.panel-footer div > span {
  margin-top: 3px;
  color: #6f8cac;
  font-size: 9px;
  line-height: 1.4;
}

.service-note {
  margin: 14px 0 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  color: #8895a6;
  font-size: 10px;
}

.service-note svg {
  width: 14px;
  height: 14px;
}

.map-stop-marker {
  position: relative;
  padding: 0;
  background: transparent;
  border: 0;
  cursor: pointer;
  transform: translate(-50%, -50%);
}

.map-stop-marker .marker-dot {
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 4px solid var(--marker-color, #126ed4);
  border-radius: 50%;
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.95),
    0 4px 9px rgba(30, 67, 109, 0.28);
  transition: 0.16s ease;
}

.map-stop-marker:hover .marker-dot,
.map-stop-marker.selected .marker-dot {
  transform: scale(1.22);
  box-shadow:
    0 0 0 5px rgba(255, 255, 255, 0.95),
    0 6px 14px rgba(30, 67, 109, 0.3);
}

.map-stop-marker .marker-label {
  position: absolute;
  left: 50%;
  bottom: 30px;
  padding: 7px 9px;
  color: #20304a;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #dce5ed;
  border-radius: 8px;
  box-shadow: 0 5px 13px rgba(30, 67, 109, 0.13);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  transform: translateX(-50%);
}

.map-stop-marker .marker-exit {
  color: #126ed4;
  font-size: 10px;
  font-weight: 700;
  margin-left: 2px;
}

.map-stop-marker .marker-subway-icon {
  width: 13px;
  height: 13px;
  margin-right: 4px;
  color: #126ed4;
  vertical-align: -2px;
}

.map-bus-marker {
  --bus-bg: linear-gradient(145deg, #3b82f6, #1d4ed8);
  --bus-tail: #1d4ed8;
  --bus-shadow: rgba(29, 78, 216, 0.35);

  position: relative;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--bus-bg);
  border: 2px solid #fff;
  border-radius: 9px;
  box-shadow: 0 5px 14px var(--bus-shadow);
  transform: translate(-50%, calc(-100% - 7px));
}

/* 가는 방향 (역 방면) - 청명한 블루 */
.map-bus-marker.to-station {
  --bus-bg: linear-gradient(145deg, #3b82f6, #1d4ed8);
  --bus-tail: #1d4ed8;
  --bus-shadow: rgba(29, 78, 216, 0.35);
}

/* 오는 방향 (삼육대 복귀 방면) - 따뜻하고 눈에 띄는 오렌지/선셋 */
.map-bus-marker.to-sahmyook {
  --bus-bg: linear-gradient(145deg, #fb923c, #ea580c);
  --bus-tail: #ea580c;
  --bus-shadow: rgba(234, 88, 12, 0.35);
}

.map-bus-marker::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  width: 8px;
  height: 8px;
  background: var(--bus-tail);
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: translateX(-50%) rotate(45deg);
}

.map-bus-marker svg {
  position: relative;
  z-index: 1;
  width: 18px;
  height: 18px;
}

.map-bus-marker .bus-tag {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1.5px 5px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 4px;
  font-size: 8px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}

.map-bus-marker.to-station .bus-tag {
  background: #1e40af;
}

.map-bus-marker.to-sahmyook .bus-tag {
  background: #c2410c;
}

.subway-board {
  position: absolute;
  top: 68px;
  right: 18px;
  z-index: 6;
  width: min(390px, calc(100% - 36px));
  max-height: calc(100% - 86px);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid #dbe3ea;
  border-radius: 13px;
  box-shadow: 0 8px 28px rgba(32, 54, 80, 0.16);
}

.subway-board[hidden] {
  display: none;
}

.subway-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.subway-heading h2 {
  margin: 0;
  flex-shrink: 0;
  font-size: 14px;
  letter-spacing: -0.035em;
  white-space: nowrap;
}

.subway-close {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  padding: 4px;
  display: grid;
  place-items: center;
  color: #718096;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.subway-close:hover {
  background: #eef3f8;
}

.subway-close svg {
  width: 16px;
  height: 16px;
}

.subway-refresh-note {
  margin-left: auto;
  color: #8290a2;
  font-size: 10px;
  white-space: nowrap;
}

.subway-stations {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.subway-station-tabs,
.subway-line-tabs {
  display: flex;
  gap: 5px;
}

.subway-line-tabs {
  flex-shrink: 0;
}

.subway-station-tabs button {
  flex: 1;
  padding: 8px;
  color: #718096;
  background: #f1f4f8;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.subway-station-tabs button[aria-pressed='true'] {
  color: var(--blue-dark);
  background: var(--blue-soft);
  border-color: #c7def5;
}

.subway-line-tabs button {
  padding: 5px 10px;
  color: #718096;
  background: #f1f4f8;
  border: 0;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.subway-line-tabs button[aria-pressed='true'] {
  color: #fff;
}

.subway-line-tabs .line-1001[aria-pressed='true'] {
  background: #0052a4;
}

.subway-line-tabs .line-1006[aria-pressed='true'] {
  background: #a95005;
}

.subway-line-tabs .line-1007[aria-pressed='true'] {
  background: #747f00;
}

.subway-directions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.subway-direction {
  min-width: 0;
  padding: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: baseline;
  gap: 6px;
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.subway-direction-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
  line-height: 1.6;
}

.subway-direction-head strong {
  display: block;
  color: #435169;
  font-size: 12px;
}

.subway-direction-head span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.subway-trains {
  margin: 0;
  padding: 0;
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.subway-train-destination {
  color: #35435a;
  font-size: inherit;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.subway-train-tag {
  display: inline-block;
  margin-left: 5px;
  padding: 2px 4px;
  color: #a74424;
  background: #fff0e9;
  border-radius: 4px;
  font-size: 9px;
}

.subway-train-arrival {
  color: var(--blue-dark);
  font-weight: 600;
}

.subway-no-train,
.subway-message {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.subway-message.error {
  color: #a45b52;
}

@media (max-width: 900px) {
  .site-header {
    height: 66px;
    padding: 0 18px;
  }

  .content {
    width: min(100% - 28px, 700px);
    padding-top: 24px;
  }

  .intro {
    align-items: stretch;
    flex-direction: column;
    gap: 17px;
  }

  .route-switch {
    width: 100%;
  }

  .map-card {
    height: auto;
    min-height: 0;
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .map-pane {
    height: min(58vh, 520px);
    min-height: 410px;
    overflow: hidden;
    border-radius: 21px 21px 0 0;
  }

  .route-panel {
    height: auto;
    overflow: visible;
    padding: 25px 24px;
    border-top: 1px solid var(--line);
    border-left: 0;
    border-radius: 0 0 21px 21px;
  }

  .stop-list {
    overflow: visible;
  }
}

@media (max-width: 560px) {
  .subway-board {
    top: 52px;
    right: 8px;
    width: calc(100% - 16px);
    max-height: calc(100% - 60px);
    padding: 14px;
  }

  .map-pane.subway-open {
    height: clamp(380px, 55dvh, 460px);
  }

  .subway-heading {
    gap: 6px;
  }

  .subway-heading h2 {
    font-size: 11px;
  }

  .subway-station-tabs button {
    font-size: 10.5px;
  }

  .subway-line-tabs button {
    font-size: 9px;
  }

  .subway-direction-head strong,
  .subway-direction-head span {
    font-size: 10px;
  }

  .subway-trains {
    font-size: 10.5px;
  }

  .subway-refresh-note {
    font-size: 9px;
  }

  .subway-no-train,
  .subway-message {
    font-size: 9.5px;
  }

  .subway-close {
    width: 28px;
    height: 28px;
  }

  .intro-copy {
    display: none;
  }

  .content {
    width: calc(100% - 20px);
    padding: 10px 0 70px;
  }

  .intro {
    gap: 0;
    margin-bottom: 8px;
  }

  .intro h1 {
    font-size: 25px;
  }

  .route-switch {
    gap: 4px;
    padding: 4px;
    border-radius: 13px;
  }

  .route-tab {
    padding: 7px 4px;
    flex-direction: column;
    gap: 2px;
  }

  .tab-time {
    font-size: 8.5px;
  }

  .tab-name {
    font-size: 11.5px;
  }

  .map-card {
    border-radius: 18px;
  }

  .map-pane {
    height: clamp(280px, 42dvh, 350px);
    min-height: 0;
    border-radius: 17px 17px 0 0;
  }

  .map-tools {
    top: 12px;
    right: 12px;
  }

  .map-tools button {
    width: 32px;
    height: 32px;
    border-radius: 8px;
  }

  .map-tools .mobile-refresh-button {
    display: grid;
  }

  .map-tools .subway-toggle {
    width: 32px;
    padding: 0;
  }

  .map-tools .subway-toggle span {
    display: none;
  }

  .map-tools svg {
    width: 16px;
    height: 16px;
  }

  .update-chip {
    display: none;
  }

  .route-panel {
    padding: 14px;
  }

  .route-summary {
    margin: 0 0 9px;
    padding: 0;
  }

  .operation-board {
    margin-bottom: 0;
    padding: 10px;
  }

  .operation-heading {
    margin-bottom: 6px;
  }

  .service-row {
    min-height: 46px;
    padding: 6px 8px;
    grid-template-columns: 50px minmax(0, 1fr);
  }

  .history-time:nth-child(3) {
    display: none;
  }

  .arrival-heading {
    margin: 10px 0 6px;
    padding-top: 8px;
  }

  .history-row {
    min-height: 30px;
    padding: 3px 5px 3px 8px;
  }

  .stop-list {
    display: none;
  }

  .service-note {
    margin-top: 8px;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 0 4px;
    font-size: 9px;
    line-height: 1.45;
  }

  .map-stop-marker .marker-label {
    font-size: 9px;
  }

  .map-stop-marker .marker-exit {
    font-size: 8px;
  }

  .map-bus-marker {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    transform: translate(-50%, calc(-100% - 6px));
  }

  .map-bus-marker::after {
    bottom: -5px;
    width: 7px;
    height: 7px;
  }

  .map-bus-marker svg {
    width: 15px;
    height: 15px;
  }

  .map-bus-marker .bus-tag {
    top: -14px;
    font-size: 7px;
    padding: 1px 3.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
