:root {
  --bg: #f5efe3;
  --ink: #11212d;
  --muted: #52606d;
  --panel: rgba(255, 252, 246, 0.88);
  --panel-strong: #fffaf1;
  --accent: #0f766e;
  --accent-soft: #d8efe9;
  --line: rgba(17, 33, 45, 0.08);
  --shadow: 0 18px 45px rgba(17, 33, 45, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.16), transparent 26%),
    radial-gradient(circle at top right, rgba(217, 119, 6, 0.12), transparent 22%),
    linear-gradient(180deg, #f4e6c8 0%, var(--bg) 42%, #f8f5ef 100%);
  min-height: 100vh;
}

body.modal-open {
  overflow: hidden;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.hero {
  padding: 28px;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(255, 250, 241, 0.92), rgba(255, 255, 255, 0.75));
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  color: var(--accent);
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.02;
}

.subtitle {
  margin: 16px 0 0;
  max-width: 720px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.search-bar {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-top: 22px;
}

.search-label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.search-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid rgba(17, 33, 45, 0.12);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  font: inherit;
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.search-input:focus {
  border-color: rgba(15, 118, 110, 0.45);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.1);
}

.toolbar,
.summary-card,
.stats-row,
.route-head,
.bus-item-top,
.location-head,
.nearest-stop-top {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.toolbar {
  margin-top: 22px;
  align-items: center;
  flex-wrap: wrap;
}

button {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.primary {
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.28);
}

.secondary {
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(17, 33, 45, 0.08);
  color: var(--ink);
  font-weight: 700;
}

.primary:disabled {
  opacity: 0.6;
  cursor: wait;
}

.secondary:disabled {
  opacity: 0.6;
  cursor: wait;
}

.status {
  color: var(--muted);
}

.summary-card {
  margin: 22px 0;
  padding: 16px 18px;
  border-radius: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}

.location-card {
  margin: 0 0 22px;
  padding: 18px;
  border-radius: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.location-head {
  align-items: flex-start;
  gap: 14px;
}

.location-label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
}

.location-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.location-note {
  margin: 0;
  max-width: 220px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: right;
}

.nearest-stop-panel {
  margin-top: 16px;
}

.nearest-stop-card,
.nearest-bus-card {
  padding: 16px;
  border-radius: 18px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.nearest-bus-card {
  margin-top: 14px;
}

.nearest-stop-name,
.nearest-bus-main {
  margin: 8px 0 0;
  font-size: 24px;
}

.nearest-stop-distance {
  margin: 0;
  font-size: 14px;
  color: var(--accent);
  font-weight: 700;
}

.nearest-stop-desc,
.nearest-bus-title,
.nearest-bus-sub {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.nearest-bus-title {
  font-size: 13px;
}

.meta-label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
}

.meta-value {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.routes-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.route-card {
  padding: 22px;
  border-radius: 26px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.route-chip {
  display: inline-flex;
  margin: 0 0 10px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.route-title {
  margin: 0;
  font-size: 28px;
}

.route-time,
.route-endpoints,
.route-fare {
  color: var(--muted);
}

.route-endpoints {
  margin: 10px 0 6px;
}

.route-fare {
  margin: 0;
}

.route-info-panel {
  max-height: 420px;
  overflow: auto;
  padding: 2px 4px 4px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 118, 110, 0.45) transparent;
}

.route-info-panel::-webkit-scrollbar {
  width: 8px;
}

.route-info-panel::-webkit-scrollbar-track {
  background: transparent;
}

.route-info-panel::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.35);
}

.stats-row {
  margin: 16px 0 24px;
}

.stat-box {
  flex: 1;
  min-width: 0;
  padding: 14px;
  border-radius: 18px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 20px;
}

h3 {
  margin: 22px 0 12px;
  font-size: 17px;
}

.buses-list,
.highlights-list,
.plan-times-list {
  display: grid;
  gap: 10px;
}

.buses-panel {
  max-height: 360px;
  overflow: auto;
  padding: 2px 4px 4px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 118, 110, 0.45) transparent;
}

.buses-panel::-webkit-scrollbar {
  width: 8px;
}

.buses-panel::-webkit-scrollbar-track {
  background: transparent;
}

.buses-panel::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.35);
}

.bus-item,
.highlight-item,
.empty-state {
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.plan-time-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.plan-time-clock {
  display: inline-flex;
  min-width: 68px;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
}

.plan-time-main {
  display: grid;
  gap: 6px;
}

.plan-time-main strong {
  font-size: 15px;
}

.plan-time-main span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.stat-button {
  display: block;
  width: 100%;
  text-align: left;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.stat-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(17, 33, 45, 0.08);
  border-color: rgba(15, 118, 110, 0.25);
}

.bus-highlight-button {
  width: 100%;
  text-align: left;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.bus-highlight-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(17, 33, 45, 0.08);
  border-color: rgba(15, 118, 110, 0.25);
}

.bus-button {
  width: 100%;
  text-align: left;
  background: var(--panel-strong);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.bus-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(17, 33, 45, 0.08);
  border-color: rgba(15, 118, 110, 0.25);
}

.bus-detail-link {
  display: inline-flex;
  margin-top: 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.bus-item p,
.highlight-item,
.empty-state {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.stations-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.station-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.station-order {
  display: inline-flex;
  min-width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.station-main {
  display: grid;
  gap: 6px;
}

.station-main strong {
  font-size: 15px;
}

.station-main span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.station-bus-stack {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}

.station-bus-badge {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(15, 118, 110, 0.08);
  border: 1px solid rgba(15, 118, 110, 0.18);
  text-align: left;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.station-bus-badge:hover {
  transform: translateY(-1px);
  background: rgba(15, 118, 110, 0.12);
  border-color: rgba(15, 118, 110, 0.3);
}

.station-bus-icon {
  display: inline-flex;
  min-width: 42px;
  height: 26px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.station-bus-text {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}

.station-bus-distance {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.station-live-muted {
  display: inline-flex;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 33, 45, 0.45);
  backdrop-filter: blur(4px);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(720px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  margin: 16px auto;
  padding: 24px;
  border-radius: 28px;
  background: linear-gradient(180deg, #fffdf8 0%, #f8f3e9 100%);
  box-shadow: 0 28px 80px rgba(17, 33, 45, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.modal-close {
  margin-left: auto;
  display: inline-flex;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(17, 33, 45, 0.08);
  color: var(--ink);
  font-weight: 700;
}

.modal-eyebrow {
  margin: 18px 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.modal-title {
  margin: 0;
  font-size: clamp(28px, 5vw, 42px);
}

.modal-body {
  margin-top: 18px;
}

.modal-plan-section {
  margin-top: 20px;
}

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

.detail-card {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
}

.detail-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.detail-value {
  font-size: 18px;
  line-height: 1.4;
}
}

.error-card {
  color: #9f1239;
}

@media (max-width: 900px) {
  .stats-row {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 430px) {
  .shell {
    width: min(390px, calc(100vw - 16px));
    padding-top: 8px;
  }

  .hero,
  .location-card,
  .route-card,
  .summary-card {
    padding: 16px;
    border-radius: 20px;
  }

  h1 {
    font-size: 30px;
  }

  .search-bar {
    grid-template-columns: 1fr;
  }

  .route-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .route-info-panel {
    max-height: 320px;
  }

  .buses-panel {
    max-height: 300px;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .toolbar,
  .summary-card,
  .location-head,
  .nearest-stop-top,
  .bus-item-top {
    align-items: stretch;
    flex-direction: column;
  }

  .status,
  .location-note,
  .nearest-stop-distance {
    text-align: left;
  }

  .location-note {
    max-width: none;
  }

  .route-title {
    font-size: 24px;
  }

  .nearest-stop-name,
  .nearest-bus-main {
    font-size: 22px;
  }
}
