:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --text: #16201c;
  --muted: #66736d;
  --line: #d8e1dc;
  --accent: #0f8a5f;
  --accent-2: #f0642f;
  --panel: #ffffff;
}

* {
  box-sizing: border-box;
}

html,
body,
.app,
#map {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 0;
}

.map-wrap {
  min-width: 0;
  min-height: 100vh;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100vh;
  padding: 24px;
  overflow: hidden;
  background: var(--panel);
  border-left: 1px solid var(--line);
}

.menu-toggle,
.panel-backdrop {
  display: none;
}

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

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
}

.summary {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.actions button,
.menu-toggle {
  height: 40px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

.actions button:last-child {
  background: var(--accent-2);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stats div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.stats strong,
.stats span {
  display: block;
}

.stats strong {
  font-size: 20px;
}

.stats span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.route-list {
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: auto;
  color: var(--muted);
  line-height: 1.5;
  list-style: none;
}

.route-list li {
  border-bottom: 1px solid #edf2ef;
}

.route-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 8px;
  width: 100%;
  height: auto;
  padding: 9px 8px;
  border: 0;
  border-radius: 0;
  color: var(--muted);
  background: #eef8f4;
  text-align: left;
  cursor: pointer;
}

.route-item:hover {
  background: #edf8f3;
}

.route-item.is-active {
  background: var(--accent);
  color: #fff;
}

.route-item.is-active .route-index {
  color: var(--accent);
  background: #fff;
}

.route-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin-top: 1px;
  border-radius: 999px;
  color: var(--accent);
  background: #e0f2ea;
  font-weight: 800;
}

.route-copy {
  min-width: 0;
}

.route-copy b,
.route-copy small {
  display: block;
}

.route-copy b {
  color: var(--text);
  font-size: 15px;
}

.route-item.is-active .route-copy b,
.route-item.is-active .route-copy small {
  color: #fff;
}

.route-copy small {
  margin-top: 2px;
  font-size: 13px;
}

.marker-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 180px;
  padding: 4px 8px 4px 5px;
  border-radius: 999px;
  color: var(--text);
  background: rgba(237, 248, 243, 0.96);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.amap-marker-label {
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.marker-label b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  color: var(--accent);
  background: #dff2eb;
  font-size: 11px;
}

.marker-label.is-active {
  color: #fff;
  background: rgba(15, 138, 95, 0.94);
}

.marker-label.is-active b {
  color: var(--accent);
  background: #fff;
}

.point-popup {
  display: grid;
  gap: 6px;
  min-width: 170px;
  color: var(--text);
}

.point-popup strong {
  font-size: 15px;
}

.point-popup span {
  color: var(--muted);
}

.point-popup a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  padding: 7px 10px;
  border-radius: 7px;
  color: #fff;
  background: var(--accent-2);
  font-weight: 700;
  text-decoration: none;
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: 68vh auto;
  }

  .map-wrap {
    min-height: 0;
  }

  .panel {
    height: auto;
    max-height: none;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 900px) and (orientation: portrait) {
  .app {
    display: block;
    height: 100%;
  }

  .map-wrap {
    height: 100vh;
    min-height: 100vh;
  }

  .menu-toggle {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 120;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: 38px;
    padding: 0 14px;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  }

  .panel-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: block;
    background: rgba(0, 0, 0, 0.25);
  }

  .panel-backdrop[hidden] {
    display: none;
  }

  .panel {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 110;
    width: 90vw;
    height: 100vh;
    max-height: none;
    padding: 62px 18px 18px;
    border-top: 0;
    border-left: 1px solid var(--line);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.16);
    transform: translateX(100%);
    transition: transform 180ms ease;
  }

  .panel.is-open {
    transform: translateX(0);
  }
}
