:root {
  --ink: #141210;
  --ink-soft: #3a342c;
  --paper: #f3ede1;
  --paper-dim: rgba(243, 237, 225, 0.88);
  --glass: rgba(18, 16, 14, 0.72);
  --glass-2: rgba(18, 16, 14, 0.55);
  --line: rgba(243, 237, 225, 0.14);
  --kapok: #c44536;
  --gold: #d4a017;
  --teal: #2a8f88;
  --lav: #7b6bb0;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --serif: "Noto Serif SC", "Songti SC", serif;
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --panel-w: 400px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: var(--sans);
  color: var(--paper);
  background: #0c1014;
}

#map {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: #1b2420;
}

.map-veil {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(1200px 600px at 0% 0%, rgba(12, 10, 8, 0.45), transparent 55%),
    linear-gradient(90deg, rgba(12, 10, 8, 0.28) 0, transparent 42%);
}

.leaflet-control-zoom {
  border: 0 !important;
  box-shadow: var(--shadow) !important;
}
.leaflet-control-zoom a {
  background: var(--glass) !important;
  color: var(--paper) !important;
  border: 1px solid var(--line) !important;
  width: 34px !important;
  height: 34px !important;
  line-height: 34px !important;
  backdrop-filter: blur(12px);
}
.leaflet-control-attribution {
  background: rgba(12, 10, 8, 0.55) !important;
  color: rgba(243, 237, 225, 0.55) !important;
  font-size: 10px !important;
}
.leaflet-control-attribution a { color: rgba(243, 237, 225, 0.7) !important; }
body.theme-night .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.95) saturate(0.35);
}
body.theme-sat .leaflet-tile-pane { filter: saturate(1.08) brightness(0.88) contrast(1.08); }
body.theme-sat .map-veil {
  background:
    radial-gradient(900px 520px at 0% 0%, rgba(12, 10, 8, 0.35), transparent 58%),
    linear-gradient(90deg, rgba(12, 10, 8, 0.22) 0, transparent 46%);
}
.leaflet-tooltip {
  background: rgba(18, 16, 14, 0.9);
  color: #f3ede1;
  border: 1px solid rgba(243, 237, 225, 0.16);
  border-radius: 8px;
  box-shadow: none;
  font-size: 12px;
  padding: 4px 8px;
}
.leaflet-tooltip-top:before { border-top-color: rgba(18, 16, 14, 0.9); }
.leaflet-popup-content-wrapper {
  background: #161310;
  color: var(--paper);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
}
.leaflet-popup-content { margin: 0; width: 280px !important; }
.leaflet-popup-tip { background: #161310; }
.leaflet-popup-close-button { color: var(--paper) !important; top: 8px !important; right: 8px !important; }

.pop img {
  display: block;
  width: 100%;
  height: 128px;
  object-fit: cover;
}
.pop-body { padding: 12px 14px 14px; }
.pop-kicker {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 4px;
}
.pop-body h3 {
  font-family: var(--serif);
  font-size: 18px;
  margin: 0 0 6px;
  font-weight: 700;
}
.pop-body p {
  margin: 0 0 8px;
  font-size: 12.5px;
  line-height: 1.55;
  color: rgba(243, 237, 225, 0.82);
}
.pop-meta {
  font-size: 11.5px;
  color: rgba(243, 237, 225, 0.62);
  line-height: 1.45;
}
.pop-dishes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 8px 0 0;
}
.pop-dishes span {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(212, 160, 23, 0.15);
  color: #f0d48a;
}

.chrome-top { display: contents; }

.topbar {
  position: fixed;
  z-index: 5;
  top: calc(14px + var(--safe-top));
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  max-width: calc(100% - 32px);
  gap: 8px;
}
.topbar > * { pointer-events: auto; }

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 8px 14px 8px 10px;
  box-shadow: var(--shadow);
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background:
    radial-gradient(circle at 50% 50%, #f3ede1 0 3px, transparent 4px),
    radial-gradient(circle at 50% 18%, var(--kapok) 0 7px, transparent 8px),
    radial-gradient(circle at 78% 38%, var(--kapok) 0 7px, transparent 8px),
    radial-gradient(circle at 22% 38%, var(--kapok) 0 7px, transparent 8px),
    radial-gradient(circle at 34% 72%, var(--kapok) 0 7px, transparent 8px),
    radial-gradient(circle at 66% 72%, var(--kapok) 0 7px, transparent 8px),
    #2a1816;
}
.brand-kicker {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}
.brand h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.1;
  font-weight: 700;
}

.top-actions { display: flex; gap: 8px; align-items: center; }
.lang-switch {
  appearance: none;
  display: inline-flex;
  gap: 0;
  padding: 3px;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--paper);
  backdrop-filter: blur(16px);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.lang-switch span {
  padding: 6px 9px;
  border-radius: 999px;
  font: 650 12px/1 var(--sans);
  letter-spacing: 0.04em;
  color: rgba(243, 237, 225, 0.7);
}
.lang-switch span.on {
  background: var(--paper);
  color: var(--ink);
}
body.lang-en .pin.food.optional span { font-size: 10px; }
.ghost-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--paper);
  backdrop-filter: blur(16px);
  border-radius: 999px;
  padding: 8px 14px;
  font: 500 13px/1 var(--sans);
  cursor: pointer;
  box-shadow: var(--shadow);
}
.ghost-btn:hover { border-color: rgba(243, 237, 225, 0.35); }
.ghost-btn.active { background: var(--paper); color: var(--ink); }

.daybar {
  position: fixed;
  z-index: 5;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(18px + var(--safe-bottom));
  display: flex;
  gap: 6px;
  padding: 6px;
  background: var(--glass);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  max-width: calc(100vw - 24px);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.daybar::-webkit-scrollbar { display: none; }
.day-chip {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(243, 237, 225, 0.75);
  font: 500 13px/1 var(--sans);
  padding: 9px 12px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.day-chip.active {
  background: var(--paper);
  color: var(--ink);
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot.d1 { background: var(--gold); }
.dot.d2 { background: var(--kapok); }
.dot.d3 { background: var(--teal); }
.dot.extra { background: #9fe1db; }

.panel {
  position: fixed;
  z-index: 4;
  top: calc(78px + var(--safe-top));
  left: 16px;
  width: var(--panel-w);
  bottom: calc(76px + var(--safe-bottom));
  background: var(--glass);
  backdrop-filter: blur(22px);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(0);
  transition: transform 0.28s ease, opacity 0.28s ease;
}
.panel.collapsed {
  transform: translateX(calc(-100% - 24px));
  opacity: 0;
  pointer-events: none;
}
.panel-handle { display: none; }
.panel-scroll {
  overflow: auto;
  padding: 18px 18px 28px;
  scrollbar-width: thin;
  scrollbar-color: rgba(243,237,225,.25) transparent;
}

.hero-card {
  border-radius: 16px;
  overflow: hidden;
  padding: 16px;
  margin-bottom: 18px;
  background:
    linear-gradient(180deg, rgba(12,10,8,.15), rgba(12,10,8,.72)),
    url("../assets/huacheng.jpg") center/cover no-repeat;
  min-height: 168px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border: 1px solid var(--line);
}
.hero-card.d1 { background-image: linear-gradient(180deg, rgba(12,10,8,.15), rgba(12,10,8,.72)), url("../assets/huacheng.jpg"); }
.hero-card.d2 { background-image: linear-gradient(180deg, rgba(12,10,8,.15), rgba(12,10,8,.72)), url("../assets/beijing-road.jpg"); }
.hero-card.d3 { background-image: linear-gradient(180deg, rgba(12,10,8,.15), rgba(12,10,8,.72)), url("../assets/chen-clan.jpg"); }
.hero-card.extra { background-image: linear-gradient(180deg, rgba(12,10,8,.15), rgba(12,10,8,.72)), url("../assets/seafood.jpg"); }
.eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: #f0d48a;
}
.hero-card h2 {
  font-family: var(--serif);
  margin: 0 0 8px;
  font-size: 26px;
  line-height: 1.2;
}
.lede {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: rgba(243, 237, 225, 0.88);
}

.block { margin-bottom: 22px; }
.block-head h3 {
  font-family: var(--serif);
  margin: 0 0 4px;
  font-size: 18px;
}
.block-head p {
  margin: 0 0 12px;
  font-size: 12.5px;
  color: rgba(243, 237, 225, 0.62);
  line-height: 1.55;
}

.hotel-list { display: grid; gap: 8px; }
.hotel-card {
  text-align: left;
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(243, 237, 225, 0.05);
  color: inherit;
  border-radius: 14px;
  padding: 12px;
  cursor: pointer;
  font: inherit;
}
.hotel-card:hover { background: rgba(243, 237, 225, 0.09); }
.hotel-card.active {
  border-color: rgba(212, 160, 23, 0.55);
  background: rgba(212, 160, 23, 0.1);
}
.hotel-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}
.hotel-brand {
  font-weight: 700;
  font-size: 14px;
}
.hotel-score {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(42, 143, 136, 0.2);
  color: #9fe1db;
}
.hotel-card.rec .hotel-score {
  background: rgba(196, 69, 54, 0.25);
  color: #ffc4bc;
}
.hotel-branch, .hotel-metro, .hotel-why {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: rgba(243, 237, 225, 0.72);
}
.hotel-why { margin-top: 6px; color: rgba(243, 237, 225, 0.86); }

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px dashed rgba(243, 237, 225, 0.2);
}
.step {
  position: relative;
  padding: 0 0 16px 16px;
  cursor: pointer;
}
.step:last-child { padding-bottom: 0; }
.step::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 8px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.2);
}
.step[data-day="2"]::before { background: var(--kapok); box-shadow: 0 0 0 3px rgba(196, 69, 54, 0.2); }
.step[data-day="3"]::before { background: var(--teal); box-shadow: 0 0 0 3px rgba(42, 143, 136, 0.2); }
.step.active {
  background: rgba(243, 237, 225, 0.06);
  border-radius: 0 12px 12px 0;
}
.step-time {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--gold);
  margin: 0 0 2px;
}
.step h4 {
  margin: 0 0 2px;
  font-size: 15px;
  font-weight: 650;
}
.step p {
  margin: 0;
  font-size: 12px;
  color: rgba(243, 237, 225, 0.65);
  line-height: 1.5;
}
.meal-tag {
  display: inline-block;
  font-size: 10px;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(243, 237, 225, 0.1);
  color: #f0d48a;
  font-weight: 500;
  vertical-align: 1px;
}

.optional-list { display: grid; gap: 8px; }
.opt-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  border: 1px dashed rgba(243, 237, 225, 0.25);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  background: rgba(243, 237, 225, 0.04);
  text-align: left;
  color: inherit;
  font: inherit;
  padding: 0;
}
.opt-card img { width: 72px; height: 72px; object-fit: cover; }
.opt-card div { padding: 8px 10px 8px 0; }
.opt-card h4 { margin: 0 0 2px; font-size: 13.5px; }
.opt-card p { margin: 0; font-size: 11.5px; color: rgba(243, 237, 225, 0.65); line-height: 1.45; }

.panel-foot {
  font-size: 11px;
  color: rgba(243, 237, 225, 0.45);
  line-height: 1.5;
}

.legend {
  position: fixed;
  z-index: 5;
  right: 16px;
  bottom: calc(78px + var(--safe-bottom));
  background: var(--glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 12px;
  display: grid;
  gap: 6px;
  box-shadow: var(--shadow);
}
.legend div { display: flex; align-items: center; gap: 8px; color: rgba(243,237,225,.8); }
.lg-pin {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.lg-pin.hotel { background: #e8d9a8; }
.lg-pin.spot { background: #c44536; }
.lg-pin.food { background: #d4a017; }
.lg-pin.optional { background: transparent; border: 2px dashed #9fe1db; width: 8px; height: 8px; }

.pin {
  width: 32px;
  height: 32px;
  border-radius: 50% 50% 50% 4px;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #f3ede1;
  box-shadow: 0 8px 16px rgba(0,0,0,.35);
}
.pin span {
  transform: rotate(45deg);
  font-size: 12px;
  font-weight: 700;
  color: #141210;
}
.pin.spot { background: #c44536; }
.pin.spot.d1 { background: #d4a017; }
.pin.spot.d2 { background: #c44536; }
.pin.spot.d3 { background: #2a8f88; }
.pin.food { background: #f0d48a; border-radius: 10px; transform: none; }
.pin.food span { transform: none; }
.pin.food.optional {
  background: #1f6f6a;
  border: 2px solid #9fe1db;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  transform: none;
}
.pin.food.optional span { color: #f3ede1; transform: none; font-size: 12px; }
.opt-label {
  background: rgba(18, 16, 14, 0.92) !important;
  color: #f3ede1 !important;
  border: 1px solid rgba(159, 225, 219, 0.45) !important;
  border-radius: 8px !important;
  box-shadow: none !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  padding: 4px 8px !important;
  white-space: nowrap;
}
.opt-label::before { display: none !important; }
.pin.hotel {
  background: #e8d9a8;
  border-radius: 8px;
  transform: none;
  width: 30px;
  height: 30px;
}
.pin.hotel span { transform: none; font-size: 11px; }
.pin.hotel.home {
  outline: 3px solid rgba(212, 160, 23, 0.85);
  outline-offset: 2px;
}
.pin.dim { opacity: 0.28; filter: grayscale(0.4); }

.leaflet-div-icon { background: none; border: 0; }

@media (max-width: 860px) {
  .leaflet-popup-content { width: min(280px, calc(100vw - 40px)) !important; }
  .pop img { height: 110px; }
  .map-veil { background: radial-gradient(800px 400px at 50% 100%, rgba(12,10,8,.35), transparent 60%); }
  .hide-sm { display: none; }
  .chrome-top {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: fixed;
    z-index: 5;
    top: 0;
    left: 0;
    right: 0;
    padding: calc(10px + var(--safe-top)) 12px 8px;
    pointer-events: none;
  }
  .chrome-top > * { pointer-events: auto; }
  .topbar {
    position: static;
    left: auto;
    right: auto;
    top: auto;
    max-width: none;
    width: 100%;
    gap: 8px;
  }
  .brand {
    flex: 1 1 auto;
    min-width: 0;
    padding: 6px 10px 6px 8px;
  }
  .brand-kicker { display: none; }
  .brand-mark { width: 28px; height: 28px; flex-shrink: 0; }
  .brand h1 {
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .top-actions {
    flex-shrink: 0;
    gap: 6px;
  }
  .ghost-btn { padding: 8px 10px; font-size: 12px; }
  #btn-fit { display: none; }
  .daybar {
    position: static;
    transform: none;
    top: auto;
    bottom: auto;
    left: auto;
    right: auto;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
  }
  .panel {
    top: auto;
    left: 0;
    right: 0;
    width: 100%;
    bottom: 0;
    height: 46vh;
    border-radius: 22px 22px 0 0;
    transform: none;
  }
  .panel.collapsed {
    transform: translateY(calc(100% - 56px));
    opacity: 1;
    pointer-events: auto;
  }
  .panel-handle {
    display: block;
    width: 42px;
    height: 4px;
    background: rgba(243,237,225,.3);
    border-radius: 99px;
    margin: 8px auto 0;
  }
  .legend { display: none; }
  .leaflet-control-zoom { display: none; }
}

@media (max-width: 520px) {
  .brand-kicker { display: none; }
  .brand h1 { font-size: 17px; }
  .ghost-btn { padding: 8px 11px; font-size: 12px; }
  .day-chip { padding: 8px 10px; font-size: 12px; }
  .lang-switch span { padding: 6px 7px; }
}
