:root {
  color-scheme: light;
  --ink: #202124;
  --muted: #6d716f;
  --line: #d9ddd8;
  --panel: #fbfbf8;
  --paper: #ffffff;
  --green: #2f7d5b;
  --blue: #2c6f9f;
  --red: #c95d4f;
  --yellow: #e8b34c;
  --pink: #d86c8b;
  --violet: #7569c9;
  --shadow: 0 18px 50px rgba(42, 48, 45, 0.16);
  --soft-shadow: 0 10px 28px rgba(38, 45, 42, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  color: var(--ink);
  background: #f5f6f2;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  height: 100vh;
  overflow: hidden;
}

.map-stage {
  position: relative;
  overflow: hidden;
  height: 100vh;
  min-height: 100vh;
  background: #fbfbf8;
  touch-action: none;
  user-select: none;
}

.map-canvas {
  position: absolute;
  inset: 0;
  transform-origin: center;
  transition: transform 160ms ease;
}

.blocks-layer {
  display: none;
}

.poi-block {
  display: none;
}

.pins-layer,
.route-line {
  position: absolute;
  inset: 0;
}

.route-line svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.9));
}

.pin {
  position: absolute;
  min-width: 92px;
  max-width: 178px;
  min-height: 36px;
  border: 1px solid rgba(35, 42, 39, 0.08);
  border-radius: 999px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 6px 8px;
  font-weight: 700;
  text-align: left;
  transform: translate(-50%, -50%);
  box-shadow: var(--soft-shadow);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
  background:
    linear-gradient(90deg, var(--pin-color, var(--green)) 0 6px, transparent 6px),
    rgba(255, 255, 255, 0.94);
}

.pin span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.route-pin {
  padding-left: 7px;
}

.cluster-pin {
  min-width: 96px;
  font-weight: 800;
}

.route-index {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--pin-color, var(--green));
  background: color-mix(in srgb, var(--pin-color, var(--green)) 12%, #fff);
  font-size: 12px;
  line-height: 1;
}

.pin.active {
  transform: translate(-50%, -50%) scale(1.08);
  border-color: color-mix(in srgb, var(--pin-color, var(--green)) 42%, #fff);
  box-shadow: 0 14px 34px rgba(39, 47, 43, 0.18);
  outline: 3px solid color-mix(in srgb, var(--pin-color, var(--green)) 16%, transparent);
  z-index: 2;
}

.pin::before {
  content: "";
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--pin-color, var(--green));
}

.you-pin {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  gap: 5px;
  justify-items: center;
  transform: translate(-50%, -50%);
  z-index: 3;
  color: #1d2220;
  font-size: 12px;
  font-weight: 800;
}

.you-pin::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 4px solid #fff;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 8px rgba(201, 93, 79, 0.1);
}

.map-toolbar {
  position: absolute;
  z-index: 5;
  left: 18px;
  top: 18px;
  display: flex;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(35, 42, 39, 0.08);
  background: rgba(255, 255, 255, 0.9);
}

.map-toolbar button {
  min-width: 34px;
  height: 34px;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  background: #f6f7f4;
  font-weight: 800;
}

.interest-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 16px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border-radius: 999px;
  color: #39403c;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 12px;
}

.legend-item::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--legend-color);
}

.side-panel {
  z-index: 2;
  height: 100vh;
  min-height: 0;
  padding: 28px;
  background: rgba(251, 251, 248, 0.98);
  border-left: 1px solid rgba(150, 156, 150, 0.26);
  backdrop-filter: blur(18px);
  overflow-y: auto;
}

.brand-block h1,
.modal-header h2,
.section-title h2 {
  margin: 0;
  letter-spacing: 0;
}

.brand-block h1 {
  font-size: 30px;
  line-height: 1.12;
}

.brand-block p:last-child {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.eyebrow,
.muted {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.search-strip,
.mode-tabs,
.shop-card,
.route-card,
.setup-modal {
  border: 1px solid var(--line);
  background: var(--paper);
}

.search-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 26px 0 16px;
  padding: 14px;
  border-radius: 8px;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: var(--ink);
  font-size: 22px;
}

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border-radius: 8px;
}

.mode-tab {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
}

.mode-tab.active {
  color: #fff;
  background: var(--green);
}

.panel-section {
  margin-top: 24px;
}

.hidden {
  display: none;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-title h2 {
  font-size: 18px;
}

.section-title span {
  color: var(--muted);
  font-size: 13px;
}

.shop-list {
  display: grid;
  gap: 10px;
}

.empty-state {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  font-size: 14px;
  line-height: 1.6;
}

.shop-card {
  padding: 14px;
  border-radius: 8px;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
  text-align: left;
  background: #fff;
}

.shop-card:hover {
  transform: translateY(-2px);
  border-color: rgba(47, 125, 91, 0.55);
}

.shop-card.selected {
  border-color: rgba(47, 125, 91, 0.7);
  box-shadow: 0 0 0 3px rgba(47, 125, 91, 0.1), var(--soft-shadow);
}

.selected-detail {
  display: none;
  margin-bottom: 12px;
  padding: 16px;
  border: 1px solid rgba(47, 125, 91, 0.34);
  border-radius: 8px;
  background: #f6faf6;
}

.selected-detail.visible {
  display: block;
}

.selected-detail h3 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.selected-detail p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.65;
  font-size: 13px;
}

.cluster-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.cluster-member {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  text-align: left;
  color: var(--ink);
  background: #fff;
}

.cluster-member:hover {
  border-color: rgba(47, 125, 91, 0.55);
}

.cluster-member strong {
  display: block;
  font-size: 14px;
}

.cluster-member span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.shop-card header,
.route-stop header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.shop-card h3,
.route-card h3,
.route-stop h4 {
  margin: 0;
  letter-spacing: 0;
}

.shop-card h3 {
  font-size: 16px;
}

.shop-card p,
.route-card p,
.route-stop p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.badge {
  padding: 4px 8px;
  border-radius: 999px;
  color: #4c5651;
  background: #f0f2ee;
  font-size: 12px;
}

.secondary-button,
.primary-button {
  border: 0;
  border-radius: 7px;
  color: #fff;
  background: var(--ink);
}

.secondary-button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.route-card-stack {
  perspective: 900px;
}

.route-card {
  min-height: 430px;
  padding: 18px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  transform-origin: center right;
  animation: dealCard 360ms ease;
}

@keyframes dealCard {
  from {
    opacity: 0;
    transform: rotateY(18deg) translateX(18px);
  }
}

.route-card h3 {
  font-size: 22px;
}

.route-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 14px 0 18px;
}

.route-warning {
  width: 100%;
  margin-top: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(201, 93, 79, 0.28);
  border-radius: 8px;
  color: #7a382f;
  background: #fff6f3;
  font-size: 13px;
  line-height: 1.55;
}

.route-stop {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  width: 100%;
  border: 0;
  padding: 12px 0;
  text-align: left;
  color: inherit;
  background: transparent;
  border-top: 1px solid var(--line);
}

.route-stop:hover h4 {
  color: var(--green);
}

.stop-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--green);
  font-weight: 800;
  font-size: 13px;
}

.modal-backdrop {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(30, 34, 32, 0.36);
  backdrop-filter: blur(10px);
}

.modal-backdrop.closed {
  display: none;
}

.setup-modal {
  width: min(620px, 100%);
  max-height: calc(100vh - 44px);
  overflow-y: auto;
  padding: 26px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.modal-header h2 {
  font-size: 28px;
}

.keyword-field {
  display: grid;
  gap: 8px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 13px;
  position: relative;
}

.keyword-field input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 14px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.keyword-field input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 125, 91, 0.13);
}

.place-suggestions {
  display: none;
  max-height: 210px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.place-suggestions.visible {
  display: grid;
}

.place-option {
  border: 0;
  border-bottom: 1px solid #ecefeb;
  padding: 11px 12px;
  text-align: left;
  color: var(--ink);
  background: #fff;
}

.place-option:last-child {
  border-bottom: 0;
}

.place-option strong {
  display: block;
  font-size: 14px;
}

.place-option span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.place-option.selected {
  background: #f1f7f3;
}

.quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 22px;
}

.quick-tags button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: #f8f8f5;
}

.quick-tags button.selected {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}

.modal-note {
  margin: 10px 0 22px;
  color: var(--muted);
  line-height: 1.6;
  font-size: 12px;
}

.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.choice-card {
  min-height: 116px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  text-align: left;
  color: var(--ink);
  background: #fff;
}

.choice-card span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
  font-size: 13px;
}

.choice-card.selected {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 125, 91, 0.12);
}

.primary-button {
  width: 100%;
  min-height: 48px;
  margin-top: 20px;
  font-weight: 700;
  background: var(--green);
  position: sticky;
  bottom: 0;
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
    min-height: 100vh;
    height: auto;
    overflow: visible;
  }

  .map-stage {
    height: auto;
    min-height: 44vh;
    max-height: 52vh;
    border-bottom: 1px solid var(--line);
  }

  .side-panel {
    height: auto;
    min-height: auto;
    padding: 22px;
    border-left: 0;
    border-top: 1px solid rgba(150, 156, 150, 0.26);
  }

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

  .pin {
    min-width: 82px;
    max-width: 142px;
    min-height: 32px;
    padding: 5px 10px 5px 8px;
  }

  .pin span {
    font-size: 11px;
  }
}

@media (max-width: 520px) {
  body {
    background: #fbfbf8;
  }

  .map-toolbar {
    left: 12px;
    top: 12px;
  }

  .side-panel,
  .setup-modal {
    padding: 18px;
  }

  .brand-block h1,
  .modal-header h2 {
    font-size: 24px;
  }

  .brand-block p:last-child {
    font-size: 14px;
  }

  .search-strip {
    margin: 20px 0 12px;
  }

  .route-card {
    min-height: auto;
  }
}
