:root {
  /* Original app brand: dark navy with an orange/blue accent pair. */
  --bg: #0b1220;
  --surface: #141b2d;
  --surface-2: #1c2540;
  --text: #eef1f8;
  --muted: #9aa4bf;
  --border: #2a3350;
  --accent: #ff7a45;
  --accent-2: #3aa8ff;
  --seg-default: #6b7280;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-2: #f0f2f8;
  --text: #16182a;
  --muted: #5b6478;
  --border: #e2e5ef;
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f7f8fb;
    --surface: #ffffff;
    --surface-2: #f0f2f8;
    --text: #16182a;
    --muted: #5b6478;
    --border: #e2e5ef;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#title-line, .card h2, .card h3, .day-plan-title, .empty-title {
  font-family: Georgia, "Noto Serif", "Songti SC", "PingFang SC", serif;
}

#app {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Sticky part: kept deliberately lean — just the app name and main nav,
   since this is permanently pinned on screen. Everything else (subtitle,
   search, date tabs) lives in #subheader below, which scrolls away
   normally instead of eating screen space forever. */
header {
  padding: 8px 14px 6px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.brand-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand-seal { width: 30px; height: 30px; flex-shrink: 0; }
#title-line { font-size: 0.98rem; font-weight: 700; margin: 0; line-height: 1.2; }

.icon-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 5px 8px;
  color: var(--text);
  font-size: 0.8rem;
  cursor: pointer;
}

#subheader { padding: 8px 14px 0; }
#subtitle-line { color: var(--muted); font-size: 0.72rem; margin-bottom: 8px; line-height: 1.3; }

#search-wrap { margin-bottom: 8px; }
#search-input {
  width: 100%;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
}

#tab-bar, #section-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
#tab-bar { padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }

.tab {
  flex: 0 0 auto;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  cursor: pointer;
  white-space: nowrap;
}
.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1206;
  font-weight: 600;
}

#content {
  flex: 1;
  padding: 16px;
  padding-bottom: 48px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.card h2, .card h3 { margin-top: 0; }
.muted { color: var(--muted); font-size: 0.85rem; }
.zh-inline { color: var(--muted); font-weight: 400; }

.day-header { margin-bottom: 12px; }
.day-date { color: var(--muted); font-size: 0.85rem; }

.empty-state {
  text-align: center;
  padding: 40px 16px;
  color: var(--muted);
}
.empty-title { font-size: 1.1rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-hint { font-size: 0.9rem; }

.badge {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.75rem;
  color: var(--muted);
}
.proposal-badge { color: var(--accent-2); border-color: var(--accent-2); margin-bottom: 8px; }
.stretch-badge { color: var(--accent); border-color: var(--accent); margin-bottom: 8px; margin-left: 6px; }

.transport-card { }
.transport-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.transport-no { font-weight: 700; }
.transport-route { display: flex; align-items: center; gap: 10px; }
.transport-time { flex: 1; }
.transport-time .time { font-size: 1.4rem; font-weight: 700; }
.transport-time .place { font-size: 0.85rem; color: var(--muted); cursor: pointer; text-decoration: underline dotted; }
.transport-arrow { text-align: center; color: var(--muted); font-size: 0.8rem; }
.transport-meta { display: flex; justify-content: space-between; margin-top: 8px; font-size: 0.8rem; color: var(--muted); }

.link-btn {
  display: inline-block;
  margin-top: 10px;
  margin-right: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--accent-2);
  text-decoration: none;
  font-size: 0.85rem;
}

.hotel-city, .hotel-dates, .hotel-address { font-size: 0.9rem; margin: 2px 0; }

.intro-hint { color: var(--muted); font-size: 0.85rem; margin-bottom: 12px; }
.room-list { display: flex; flex-direction: column; gap: 6px; }
.room-chip { font-size: 0.85rem; padding: 4px 0; border-bottom: 1px solid var(--border); }
.room-chip:last-child { border-bottom: none; }
.roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}
.roster-card { text-align: center; }
.avatar {
  width: 108px; height: 108px; border-radius: 50%;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 8px;
  font-weight: 700;
  font-size: 1.7rem;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.roster-name {
  font-family: "Dancing Script", Georgia, "Noto Serif", "Songti SC", "PingFang SC", serif;
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.2;
  color: var(--accent);
}
.roster-fullname { font-size: 0.75rem; margin-top: 1px; }
.roster-bio { font-size: 0.8rem; color: var(--muted); margin: 4px 0 8px; }
.roster-contacts { display: flex; justify-content: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.roster-contacts .link-btn { margin: 2px 4px; padding: 4px 8px; font-size: 0.75rem; }

.contact-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
}
.contact-btn.wa { background: #10402c; border-color: #1f7a50; }
.contact-btn.ig { background: #3a1f45; border-color: #6b3fa0; color: #fff; }
.contact-btn.tel { color: var(--accent-2); }
.contact-btn:active { opacity: 0.7; }

.route-tagline { color: var(--accent-2); font-size: 0.9rem; margin: 4px 0 8px; }
.route-card details { margin-top: 10px; }
.route-card summary { cursor: pointer; color: var(--accent-2); font-size: 0.85rem; }
.day-plan-block { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.day-plan-block:first-child { margin-top: 10px; padding-top: 0; border-top: none; }
.day-plan-title { font-weight: 600; font-size: 0.92rem; margin-bottom: 4px; }
.day-plan-block ul { margin: 6px 0; padding-left: 20px; }
.day-plan-block li { margin-bottom: 8px; line-height: 1.5; font-size: 0.88rem; }
.day-plan-block li:last-child { margin-bottom: 0; }

/* Hero / photo placeholders */
.hero-photo, .route-photo {
  width: 100%; height: 140px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 10px;
}
.hero-photo-placeholder, .route-photo-placeholder {
  display: flex; align-items: center; justify-content: center;
  font-size: 2.4rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}

/* Places / food grid on the guide overview */
.poi-group-label {
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--accent); margin: 10px 0 4px;
}
.poi-group-label:first-child { margin-top: 2px; }
.poi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 6px 0 12px; }
.poi-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.poi-name { font-weight: 600; font-size: 0.85rem; }
.poi-desc { font-size: 0.75rem; margin-top: 2px; }

.food-carousel {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin: 6px 0 12px;
  scroll-snap-type: x mandatory;
}
.food-card {
  flex: 0 0 140px;
  scroll-snap-align: start;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.food-photo, .food-photo-placeholder {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
}
.food-photo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}
.food-name { font-weight: 700; font-size: 0.8rem; padding: 8px 8px 2px; }
.food-desc { font-size: 0.72rem; padding: 0 8px 8px; line-height: 1.35; }

.route-map {
  width: 100%;
  height: 200px;
  border: 1px solid var(--border);
  border-radius: 10px 10px 0 0;
  margin: 8px 0 0;
  display: block;
}
.map-open-btn {
  display: block;
  width: 100%;
  padding: 8px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 10px 10px;
  background: var(--surface-2);
  color: var(--accent-2);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.map-open-btn:active { opacity: 0.7; }

/* Route vitals / highlights */
.route-vitals { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 6px; }
.vital-chip { font-size: 0.72rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); }
.vital-chip.cost-budget { color: #4caf7d; border-color: #4caf7d; }
.vital-chip.cost-mid { color: #e0a94f; border-color: #e0a94f; }
.vital-chip.cost-premium { color: var(--accent); border-color: var(--accent); }
.route-highlights { margin-bottom: 6px; }
.highlight-chip {
  display: inline-block;
  font-size: 0.72rem;
  margin: 2px 4px 2px 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
}
.route-best-for { font-size: 0.8rem; color: var(--muted); margin: 6px 0; }

/* Route comparison table */
.route-compare-scroll { overflow-x: auto; }
.route-compare-table { border-collapse: collapse; width: 100%; min-width: 760px; table-layout: fixed; }
.route-compare-table th, .route-compare-table td { border: 1px solid var(--border); padding: 6px 8px; font-size: 0.76rem; text-align: left; white-space: normal; overflow-wrap: break-word; line-height: 1.35; }
.route-compare-table th:first-child, .route-compare-table td:first-child { width: 84px; font-weight: 600; color: var(--muted); }
.route-compare-table th:not(:first-child), .route-compare-table td:not(:first-child) { width: 135px; }
.compare-footnote { margin-top: 8px; }

.calc-display {
  text-align: right;
  font-size: 1.8rem;
  font-weight: 700;
  padding: 10px 6px;
  margin-bottom: 10px;
}
.calc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.calc-btn {
  padding: 14px 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
}
.fx-swap-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.fx-side { flex: 1; text-align: center; background: var(--surface-2); border-radius: 10px; padding: 10px; }
.fx-code { font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; }
.fx-value { font-size: 1.3rem; font-weight: 700; word-break: break-all; }
.fx-swap-btn {
  flex: 0 0 auto;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
}
.fx-swap-btn:active { opacity: 0.7; }

.app-carousel { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.app-tile {
  flex: 0 0 160px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
}
.app-name { font-weight: 700; margin-bottom: 4px; }
.app-desc { font-size: 0.8rem; color: var(--muted); }
.app-tile-stores { display: flex; gap: 6px; margin-top: 8px; }
.store-btn {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
}
.store-btn svg { width: 13px; height: 13px; }
.store-btn:active { opacity: 0.7; }

.quick-ref-table { width: 100%; border-collapse: collapse; }
.quick-ref-table td { padding: 8px 4px; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
.quick-ref-table td:last-child { text-align: right; font-weight: 600; }
.quick-ref-table tr:last-child td { border-bottom: none; }

.built-by { text-align: center; margin-top: 8px; }
.built-by-link { font-size: 0.78rem; color: var(--muted); text-decoration: none; }
.built-by-link:active { opacity: 0.7; }

#map-sheet {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: flex-end;
  z-index: 20;
}
#map-sheet.open { display: flex; }
.map-sheet-panel {
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}
.map-sheet-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.map-option {
  display: block;
  padding: 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  margin-bottom: 8px;
  text-align: center;
}

@media (max-width: 420px) {
  .roster-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
