:root {
  --bg-base: #faf6ef;
  --bg-card: #ffffff;
  --bg-header: #b03a2e;
  --bg-header-2: #8e2b21;
  --accent: #b03a2e;
  --accent-soft: #fdeae7;
  --gold: #c9962e;
  --gold-soft: #fbf3e0;
  --teal: #1f7a6d;
  --teal-soft: #e2f2ef;
  --text-main: #2b2320;
  --text-muted: #7a6f68;
  --border: #ece3d7;
  --shadow: 0 2px 10px rgba(60, 40, 20, 0.08);
  --radius: 14px;
  --font-base: 17px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: var(--font-base); }

body {
  font-family: "Segoe UI", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg-base);
  color: var(--text-main);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Header ---------- */
.site-header {
  background: linear-gradient(135deg, var(--bg-header), var(--bg-header-2));
  color: #fff;
  padding: 1.4rem 1rem 1.2rem;
}
.header-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.site-header h1 { font-size: 1.45rem; line-height: 1.25; }
.site-header p { opacity: 0.92; font-size: 0.95rem; margin-top: 0.3rem; }

.lang-toggle {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.16);
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
}
.lang-toggle:active { background: rgba(255, 255, 255, 0.3); }

/* ---------- Tabs ---------- */
.tabs {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 6px rgba(60, 40, 20, 0.05);
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  padding: 0.6rem 0.25rem 0.5rem;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}
.tab-icon { font-size: 1.25rem; }
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---------- Main layout ---------- */
main {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
}
.maps-note {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.9rem;
}
.view { display: none; }
.view.active { display: block; }

/* ---------- Filter chips ---------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
}
.chip {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 0.42rem 0.9rem;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---------- Cards ---------- */
.cards { display: flex; flex-direction: column; gap: 0.8rem; }

.card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
}
.card:active { transform: scale(0.995); }

.card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
}
.card-name { font-size: 1.08rem; font-weight: 700; line-height: 1.3; }
.card-name .zh-name { color: var(--text-muted); font-weight: 600; font-size: 0.95rem; }
.card-area {
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--teal);
  background: var(--teal-soft);
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}
.card-why { margin-top: 0.4rem; font-size: 0.95rem; }
.card-notes {
  margin-top: 0.4rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  background: var(--gold-soft);
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
}
.card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.55rem;
}
.badge {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.14rem 0.55rem;
  border-radius: 999px;
}
.badge-saved  { background: var(--accent-soft); color: var(--accent); }
.badge-added  { background: #eef1f4; color: #5a6b7a; }
.badge-book   { background: var(--gold-soft); color: #96701c; }
.badge-ticket { background: #ece7f6; color: #5b4a8a; }
.badge-time   { background: var(--teal-soft); color: var(--teal); }

/* ---------- Card actions + inline map ---------- */
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.map-btn {
  flex: 1 1 140px;
  text-align: center;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.62rem 0.7rem;
  border-radius: 10px;
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
}
.map-toggle { background: var(--accent-soft); color: var(--accent); }
.map-toggle:active { background: #fbd9d3; }
.map-open { background: #e8f0fe; color: #1a56b0; }
.map-open:active { background: #d7e6fd; }

.card-map { margin-top: 0.75rem; }
.card-map[hidden] { display: none; }
.card-map iframe {
  width: 100%;
  height: 240px;
  border: 0;
  border-radius: 10px;
  display: block;
}

/* ---------- Overview map view ---------- */
.map-hint {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.7rem;
}
.trip-map {
  height: 46vh;
  min-height: 300px;
  width: 100%;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 1; /* keep tiles/controls below the sticky tab bar */
}
.map-legend {
  margin-top: 0.7rem;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}
.map-legend .lg { font-size: 1.05rem; vertical-align: -1px; }
.map-legend .lg-food  { color: #b03a2e; }
.map-legend .lg-sight { color: #1f7a6d; }

/* Leaflet popup — match the site */
.leaflet-popup-content { margin: 0.7rem 0.85rem; font-family: inherit; }
.pop-name { font-size: 1.02rem; font-weight: 700; line-height: 1.3; color: var(--text-main); }
.pop-name .pop-en { color: var(--text-muted); font-weight: 600; font-size: 0.9rem; }
.pop-area { font-size: 0.82rem; color: var(--teal); font-weight: 600; margin-top: 0.2rem; }
.pop-why { font-size: 0.9rem; color: var(--text-main); margin-top: 0.35rem; }
.pop-maps {
  display: inline-block;
  margin-top: 0.6rem;
  padding: 0.5rem 0.75rem;
  background: #e8f0fe;
  color: #1a56b0;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 8px;
  text-decoration: none;
}

/* ---------- Areas view ---------- */
.area-block { margin-bottom: 1.6rem; }
.area-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.2rem 0.8rem;
  margin-bottom: 0.6rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--border);
}
.area-title { font-size: 1.12rem; font-weight: 700; }
.area-travel { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }
.area-count { font-size: 0.85rem; color: var(--text-muted); }

/* ---------- Tips view ---------- */
.tip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
  margin-bottom: 0.8rem;
}
.tip-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}
.tip-body { font-size: 0.95rem; }

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 1.5rem 1rem 2.5rem;
}

/* ---------- Wider screens ---------- */
@media (min-width: 640px) {
  .site-header h1 { font-size: 1.7rem; }
  .cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
  .area-block .cards { grid-template-columns: 1fr 1fr; }
}
