:root {
  --paper: #f5f1e9;
  --paper-deep: #ebe5da;
  --ink: #17231f;
  --muted: #68716c;
  --green: #174f45;
  --green-soft: #e1ece7;
  --orange: #df653d;
  --orange-soft: #f7ded2;
  --yellow: #efc44f;
  --white: #fffefa;
  --line: rgba(23, 35, 31, 0.12);
  --shadow: 0 8px 24px rgba(30, 45, 39, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { min-width: 320px; margin: 0; background: var(--paper); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: max(12px, env(safe-area-inset-top)) 16px 11px;
  color: var(--white);
  background: rgba(23, 79, 69, 0.97);
  box-shadow: 0 1px 0 rgba(255,255,255,.1);
  backdrop-filter: blur(16px);
}
.app-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.header-actions { display: flex; align-items: center; gap: 7px; }
.trip-name h1 { margin: 0; font-size: 20px; line-height: 1.2; letter-spacing: -.02em; }
.trip-name p { margin: 3px 0 0; color: rgba(255,255,255,.66); font-size: 12px; }
.plan-button, .food-button, .icon-button, .text-button { border: 0; cursor: pointer; }
.plan-button, .food-button {
  min-height: 40px;
  padding: 0 12px;
  color: var(--white);
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  font-weight: 800;
}
.food-button { color: var(--green); background: var(--yellow); border-color: var(--yellow); font-weight: 900; }
.plan-button span {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  margin-left: 4px;
  padding: 0 5px;
  color: var(--green);
  background: var(--yellow);
  border-radius: 999px;
  font-size: 11px;
}
.heat-switch { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; color: rgba(255,255,255,.8); font-size: 12px; cursor: pointer; }
.heat-switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { width: 34px; height: 20px; padding: 2px; border-radius: 999px; background: rgba(255,255,255,.24); transition: .2s ease; }
.switch-track::after { content: ""; display: block; width: 16px; height: 16px; border-radius: 50%; background: white; transition: .2s ease; }
.heat-switch input:checked + .switch-track { background: var(--orange); }
.heat-switch input:checked + .switch-track::after { transform: translateX(14px); }

.section-shell { width: min(100%, 760px); margin: 0 auto; }
.route-section { padding: 0 14px 42px; }
.day-tabs {
  position: sticky;
  top: 91px;
  z-index: 8;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 0 -14px;
  padding: 10px 14px;
  background: rgba(245,241,233,.96);
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
  backdrop-filter: blur(12px);
}
.day-tabs::-webkit-scrollbar { display: none; }
.day-tab {
  flex: 0 0 auto;
  min-width: 78px;
  min-height: 48px;
  padding: 8px 10px;
  text-align: left;
  color: var(--muted);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.day-tab strong, .day-tab span { display: block; }
.day-tab strong { color: var(--ink); font-size: 13px; line-height: 1.2; }
.day-tab span { margin-top: 3px; font-size: 10px; white-space: nowrap; }
.day-tab.active { color: rgba(255,255,255,.7); background: var(--green); border-color: var(--green); }
.day-tab.active strong { color: var(--white); }

.day-overview { margin: 14px 0 24px; }

.active-route { padding: 17px 15px 12px; background: var(--white); border: 1px solid rgba(23,79,69,.18); border-radius: 18px; box-shadow: var(--shadow); }
.active-route-header { display: grid; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.active-route-header > div:first-child > span { display: inline-flex; padding: 4px 8px; color: #8f351c; background: var(--orange-soft); border-radius: 999px; font-size: 10px; font-weight: 800; }
.active-route-header h3 { margin: 9px 0 5px; font-size: 21px; line-height: 1.25; }
.active-route-header p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.route-endpoints { display: flex; align-items: center; gap: 7px; color: var(--green); font-size: 11px; }
.route-endpoints strong { min-width: 0; }
.route-endpoints i { color: var(--orange); font-style: normal; }
.route-timeline { margin: 0; padding: 10px 0 0; list-style: none; }
.route-step { position: relative; padding-left: 26px; }
.route-step::before { content: ""; position: absolute; left: 6px; top: 24px; bottom: -2px; width: 2px; background: var(--green-soft); }
.route-step:last-child::before { display: none; }
.route-node { position: relative; display: grid; grid-template-columns: 48px minmax(0,1fr) auto; gap: 9px; align-items: start; padding: 9px 0 12px; }
.route-node::before { content: ""; position: absolute; left: -25px; top: 14px; width: 12px; height: 12px; background: var(--green); border: 3px solid var(--white); border-radius: 50%; box-shadow: 0 0 0 1px var(--green); }
.route-step.optional .route-node::before { background: var(--yellow); box-shadow: 0 0 0 1px #b78910; }
.route-node time { padding-top: 2px; color: var(--orange); font-size: 11px; font-weight: 800; }
.route-node h4 { margin: 0; font-size: 14px; line-height: 1.4; }
.route-node h4 small { display: inline-flex; margin-left: 4px; padding: 2px 5px; color: #86640b; background: #fbf0ca; border-radius: 999px; font-size: 9px; vertical-align: 2px; }
.route-node p { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.route-node > a { padding: 5px 0 5px 8px; color: var(--green); font-size: 11px; font-weight: 800; text-decoration: none; }
.route-move { display: flex; align-items: center; gap: 7px; min-height: 25px; margin-left: -25px; color: var(--muted); }
.route-move span { display: grid; place-items: center; width: 24px; height: 24px; background: var(--paper); border-radius: 50%; font-size: 12px; }
.route-move em { font-size: 10px; font-style: normal; }

.preset-section { margin-top: 18px; }
.preset-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 9px; }
.preset-heading h3 { margin: 0; font-size: 17px; }
.preset-heading p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.preset-grid { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(210px, 78%); gap: 10px; overflow-x: auto; padding: 1px 1px 7px; scroll-snap-type: x proximity; scrollbar-width: none; }
.preset-grid::-webkit-scrollbar { display: none; }
.preset-card { display: flex; flex-direction: column; min-height: 176px; padding: 15px; background: var(--white); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); scroll-snap-align: start; }
.preset-card.active { border-color: var(--green); box-shadow: 0 7px 22px rgba(23,79,69,.13); }
.preset-card > span { align-self: flex-start; padding: 4px 8px; color: var(--green); background: var(--green-soft); border-radius: 999px; font-size: 10px; font-weight: 800; }
.preset-card h4 { margin: 10px 0 5px; font-size: 17px; }
.preset-card p { margin: 0 0 14px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.preset-card button { min-height: 38px; margin-top: auto; color: var(--white); background: var(--green); border: 0; border-radius: 999px; cursor: pointer; font-size: 12px; font-weight: 800; }
.preset-card.active button { color: var(--green); background: var(--green-soft); }
.decision-rules { margin-top: 10px; padding: 13px 15px; background: var(--paper-deep); border-radius: 14px; }
.decision-rules strong { font-size: 12px; }
.decision-rules ul { margin: 7px 0 0; padding-left: 19px; color: var(--muted); font-size: 11px; line-height: 1.65; }

.route-board { display: block; }
.tuning-panel { overflow: hidden; background: var(--white); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.tuning-panel > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px; cursor: pointer; list-style: none; }
.tuning-panel > summary::-webkit-details-marker { display: none; }
.tuning-panel > summary span { display: grid; gap: 3px; }
.tuning-panel > summary strong { font-size: 15px; }
.tuning-panel > summary small { color: var(--muted); font-size: 10px; }
.tuning-panel > summary em { flex: 0 0 auto; color: var(--green); font-size: 10px; font-style: normal; font-weight: 800; }
.tuning-panel > summary::after { content: "⌄"; color: var(--muted); font-size: 18px; line-height: 1; transition: transform .2s ease; }
.tuning-panel[open] > summary::after { transform: rotate(180deg); }
.tuning-panel[open] > summary { border-bottom: 1px solid var(--line); }
.route-board-inner { display: grid; gap: 28px; padding: 18px 14px; }
.route-group { min-width: 0; }
.group-header { margin-bottom: 10px; }
.group-header h3 { margin: 0; font-size: 17px; line-height: 1.3; }
.group-header p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.option-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.option-card {
  min-width: 0;
  padding: 15px;
  background: var(--white);
  border: 1px solid transparent;
  border-radius: 16px;
  box-shadow: var(--shadow);
  transition: border-color .2s ease, opacity .2s ease;
}
.option-card.selected { border-color: var(--orange); box-shadow: 0 7px 22px rgba(223,101,61,.13); }
.option-card.heat-hidden { display: none; }
.option-card.heat-caution { opacity: .52; }
.option-card.heat-caution::after { content: "高温建议跳过"; display: block; margin-top: 9px; color: #953b22; font-size: 11px; font-weight: 800; }
.option-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; }
.option-tag { display: inline-flex; padding: 4px 8px; color: var(--green); background: var(--green-soft); border-radius: 999px; font-size: 10px; font-weight: 800; }
.option-card.recommended .option-tag { color: #8f351c; background: var(--orange-soft); }
.option-card h4 { margin: 10px 0 5px; font-size: 17px; line-height: 1.3; }
.option-meta { margin: 0 0 7px; color: var(--orange); font-size: 11px; font-weight: 800; line-height: 1.4; }
.option-copy { display: grid; gap: 7px; }
.option-copy p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.option-copy strong { margin-right: 7px; color: var(--ink); font-size: 11px; }
.option-voices { padding-top: 7px; border-top: 1px dashed var(--line); }
.option-voices strong { color: var(--green); }
.option-desc { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.option-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.pick-button {
  min-height: 38px;
  padding: 0 12px;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}
.selected .pick-button { color: var(--white); background: var(--orange); border-color: var(--orange); }
.map-link { min-height: 38px; display: inline-flex; align-items: center; padding-left: 10px; color: var(--green); font-size: 12px; font-weight: 800; text-decoration: none; }

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 20px;
  color: var(--white);
  background: var(--orange);
  border: 0;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
}
.plan-drawer { position: fixed; inset: 0; z-index: 30; visibility: hidden; }
.plan-drawer.open { visibility: visible; }
.drawer-backdrop { position: absolute; inset: 0; width: 100%; border: 0; background: rgba(17,29,25,.58); opacity: 0; transition: opacity .25s ease; }
.open .drawer-backdrop { opacity: 1; }
.drawer-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  width: min(100%, 620px);
  max-height: 92dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 20px 18px max(18px, env(safe-area-inset-bottom));
  background: var(--paper);
  border-radius: 24px 24px 0 0;
  transform: translateY(100%);
  transition: transform .28s ease;
  overflow-y: auto;
}
.open .drawer-panel { transform: translateY(0); }
.drawer-header { display: flex; justify-content: space-between; align-items: center; }
.drawer-header h2 { margin: 0; font-size: 25px; letter-spacing: -.03em; }
.drawer-header p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.icon-button { width: 42px; height: 42px; color: var(--ink); background: var(--paper-deep); border-radius: 50%; font-size: 24px; }
.route-health { margin: 16px 0; padding: 13px; background: var(--green-soft); border-radius: 12px; font-size: 12px; line-height: 1.55; }
.route-health.warning { color: #7c321e; background: var(--orange-soft); }
.plan-list { display: grid; gap: 18px; }
.plan-day h3 { margin: 0 0 7px; font-size: 15px; }
.plan-endpoints { margin: -2px 0 8px; color: var(--green); font-size: 10px; font-weight: 800; }
.plan-day ol { margin: 0; padding-left: 21px; color: var(--muted); font-size: 13px; }
.plan-day li { padding: 4px 0; }
.plan-day li time { display: inline-block; min-width: 52px; margin-right: 6px; color: var(--orange); font-size: 10px; font-weight: 800; }
.plan-extras { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; padding-top: 8px; border-top: 1px dashed var(--line); }
.plan-extras strong { width: 100%; color: var(--muted); font-size: 10px; }
.plan-extras span { padding: 4px 7px; color: var(--green); background: var(--green-soft); border-radius: 999px; font-size: 9px; }
.empty-plan { padding: 28px 0; color: var(--muted); text-align: center; }
.drawer-actions { display: grid; gap: 6px; margin-top: auto; padding-top: 20px; }
.text-button { padding: 10px; color: var(--muted); background: transparent; }
.toast { position: fixed; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); z-index: 40; padding: 11px 15px; color: var(--white); background: var(--ink); border-radius: 999px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: .2s ease; font-size: 13px; white-space: nowrap; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
body.drawer-open { overflow: hidden; }

.food-panel { width: min(100%, 760px); }
.food-principle { display: grid; gap: 5px; margin: 15px 0 12px; padding: 13px; color: var(--white); background: var(--green); border-radius: 14px; }
.food-principle strong { color: var(--yellow); font-size: 13px; }
.food-principle span { color: rgba(255,255,255,.78); font-size: 11px; line-height: 1.55; }
.food-filters { display: flex; gap: 7px; overflow-x: auto; padding: 3px 0 7px; scrollbar-width: none; }
.food-filters::-webkit-scrollbar { display: none; }
.food-filters button { flex: 0 0 auto; min-height: 34px; padding: 0 11px; color: var(--muted); background: var(--white); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-size: 11px; font-weight: 800; }
.food-filters button.active { color: var(--white); background: var(--green); border-color: var(--green); }
.food-mode-filters { margin-bottom: 7px; padding-top: 0; }
.food-mode-filters button.active { background: var(--orange); border-color: var(--orange); }
.food-list { display: grid; gap: 11px; padding-bottom: 6px; }
.food-card { padding: 15px; background: var(--white); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.food-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.food-card-top span { padding: 4px 8px; color: var(--green); background: var(--green-soft); border-radius: 999px; font-size: 10px; font-weight: 900; }
.food-card-top em { color: var(--orange); font-size: 10px; font-style: normal; font-weight: 800; }
.food-card h3 { margin: 9px 0 4px; font-size: 17px; }
.food-location { margin: 0 0 10px; color: var(--muted); font-size: 10px; }
.food-card dl { display: grid; gap: 8px; margin: 0; }
.food-card dl > div { display: grid; grid-template-columns: 76px minmax(0,1fr); gap: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.food-card dt { color: var(--ink); font-size: 10px; font-weight: 900; }
.food-card dd { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.food-card .food-risk dt { color: #963b21; }
.food-card-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.food-card-actions a { color: var(--green); font-size: 11px; font-weight: 900; text-decoration: none; }
.food-card-actions span { color: var(--orange); font-size: 10px; font-weight: 800; text-align: right; }

@media (min-width: 700px) {
  .app-header { padding-inline: max(20px, calc((100vw - 760px) / 2)); }
  .route-section { padding-inline: 20px; }
  .day-tabs { margin-inline: -20px; padding-inline: 20px; }
  .option-grid { grid-template-columns: repeat(2, 1fr); }
  .preset-grid { grid-auto-flow: initial; grid-template-columns: repeat(auto-fit, minmax(205px, 1fr)); overflow: visible; }
  .active-route-header { grid-template-columns: minmax(0,1fr) auto; align-items: end; }
  .food-list { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
