* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", sans-serif;
  color: #222;
  background: #f3f5f8;
  line-height: 1.5;
}

.topbar {
  background: #9f1a16;
  color: #fff;
  padding: 14px 18px 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(22px, 2.2vw, 28px);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-left: auto;
  padding: 0;
  border-radius: 0;
  background: transparent;
}

.controls label {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 14px;
  color: #ffe8e8;
}

.city-dropdown {
  position: relative;
  min-width: 160px;
}

.city-dropdown-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 160px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 6px;
  background: #fff;
  color: #3a1a1a;
  font-size: 14px;
  cursor: pointer;
}

.city-dropdown-btn:focus-visible {
  outline: 2px solid #ffe08a;
  outline-offset: 1px;
}

.city-dropdown-arrow {
  width: 8px;
  height: 8px;
  border-right: 2px solid #7b2222;
  border-bottom: 2px solid #7b2222;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.15s ease;
}

.city-dropdown.open .city-dropdown-arrow {
  transform: rotate(-135deg) translateY(-1px);
}

.city-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 100%;
  max-width: min(92vw, 320px);
  max-height: 260px;
  margin: 0;
  padding: 6px 0;
  list-style: none;
  overflow: auto;
  background: #fff;
  border: 1px solid #e5d9d9;
  border-radius: 8px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.15);
  z-index: 2000;
}

.city-dropdown-item {
  padding: 8px 12px;
  color: #3a1a1a;
  font-size: 14px;
  cursor: pointer;
}

.city-dropdown-item:hover {
  background: #f8eded;
}

.city-dropdown-item.active {
  background: #f2dede;
  color: #8f1714;
  font-weight: 700;
}

.controls button {
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 4px;
  height: 36px;
  padding: 0 14px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  transition: background-color 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
}

.controls button:hover {
  background: rgba(255, 255, 255, 0.24);
  border-color: rgba(255, 255, 255, 0.62);
}

.controls button:active {
  transform: translateY(1px);
}

.controls select {
  height: 36px;
  min-width: 140px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  color: #3a1a1a;
  font-size: 14px;
}

.status {
  margin: 2px 0 0;
  font-size: 13px;
  color: #ffdcdc;
  flex-basis: 100%;
  opacity: 0.95;
}

.https-tip {
  margin: 2px 0 0;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: #fff3d9;
  background: rgba(60, 0, 0, 0.22);
  border: 1px solid rgba(255, 220, 170, 0.45);
  flex-basis: 100%;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 12px;
  padding: 12px;
  height: calc(100vh - 128px);
}

.map-wrap {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
  min-height: 420px;
}

.sidebar {
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  overflow: auto;
  min-height: 220px;
}

.route-list {
  margin: 0;
  padding-left: 20px;
}

.route-list li {
  margin: 0 0 10px;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 8px;
  transition: background-color 0.2s ease;
}

.route-list li:hover {
  background: #f5f6f8;
}

.route-list li.active {
  color: #9f1a16;
  font-weight: 700;
  background: #fbeeee;
}

.push-card {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: min(400px, calc(100vw - 24px));
  max-height: 80vh;
  overflow: auto;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  padding: 14px;
  z-index: 9999;
}

.push-card img {
  width: 100%;
  border-radius: 8px;
  margin: 8px 0;
  background: #ebedf0;
  min-height: 120px;
  object-fit: cover;
}

.close-btn {
  float: right;
  border: none;
  background: #9f1a16;
  color: #fff;
  border-radius: 4px;
  padding: 6px 8px;
  cursor: pointer;
}

.hidden {
  display: none;
}

@media (max-width: 960px) {
  .topbar h1 {
    font-size: 24px;
  }

  .controls {
    margin-left: 0;
    width: 100%;
    border-radius: 10px;
  }

  .city-dropdown {
    min-width: 0;
    flex: 1 1 180px;
  }

  .layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  #map {
    height: 50vh;
  }
}

@media (max-width: 768px) {
  .topbar {
    padding: 12px;
    gap: 8px 10px;
  }

  .topbar h1 {
    font-size: 20px;
  }

  .controls {
    gap: 8px;
  }

  .controls button {
    height: 34px;
    padding: 0 12px;
    font-size: 13px;
  }

  .city-dropdown {
    width: 100%;
    flex: 1 1 100%;
  }

  .city-dropdown-btn {
    width: 100%;
  }

  .layout {
    gap: 10px;
    padding: 10px;
  }

  #map {
    min-height: 320px;
    height: 46vh;
  }

  .sidebar {
    padding: 10px;
    border-radius: 10px;
  }

  .sidebar h2 {
    margin: 0 0 8px;
    font-size: 18px;
  }

  .route-list {
    padding-left: 0;
    list-style-position: inside;
  }
}

@media (max-width: 480px) {
  .topbar {
    padding: 10px;
  }

  .topbar h1 {
    font-size: 18px;
  }

  .controls {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .controls button {
    width: 100%;
    justify-content: center;
  }

  .city-dropdown {
    width: 100%;
  }

  .city-dropdown-menu {
    max-width: calc(100vw - 20px);
  }

  #map {
    min-height: 280px;
    height: 42vh;
  }

  .push-card {
    right: 8px;
    left: 8px;
    width: auto;
    bottom: 8px;
    max-height: 72vh;
  }
}
