:root {
  color-scheme: light;
  --paper: #f7f4ed;
  --surface: #fffdf8;
  --ink: #232c26;
  --muted: #575e54;
  --line: #d8d9cd;
  --evergreen: #254839;
  --moss: #e8ede1;
  --rust: #85472d;
  --rust-surface: #f3e5d9;
  --display: "Noto Serif SC", "Songti SC", "SimSun", Georgia, serif;
  --body: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.6 var(--body); }
h1, h2, h3, h4, p, figure { margin: 0; }
h1, h2 { font-family: var(--display); font-weight: 700; }
h2 { font-size: clamp(1.7rem, 3.6vw, 2.35rem); line-height: 1.3; }
h3 { font-size: 1.25rem; line-height: 1.4; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
button, summary { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--evergreen); outline-offset: 3px; }
.shell { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
.secondary { color: var(--muted); font-size: .9rem; }
.topbar { min-height: 74px; display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.brand { font-family: var(--display); font-size: 1.12rem; font-weight: 700; text-decoration: none; }
.button {
  min-height: 43px;
  width: fit-content;
  padding: .5rem .95rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: .88rem;
  font-weight: 650;
  white-space: nowrap;
}
.button-light { background: var(--surface); }
.button-light:hover { background: var(--moss); }
.button-primary { background: var(--evergreen); border-color: var(--evergreen); color: white; }
.button-primary:hover { background: #1b392c; }

.hero { display: grid; grid-template-columns: .9fr 1.1fr; align-items: center; gap: clamp(1.5rem, 5vw, 4.25rem); padding-block: clamp(1.5rem, 5vw, 3.8rem) 2.2rem; }
.hero-copy { display: grid; gap: 1.05rem; }
h1 { color: var(--evergreen); font-size: clamp(2.8rem, 6.4vw, 5.5rem); letter-spacing: -.065em; line-height: 1.04; }
.hero-copy > p { max-width: 28em; }
.hero-context { color: var(--muted); font-size: .9rem; }
.hero-media img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: var(--moss); }
figcaption { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .15rem .8rem; padding-top: .4rem; }
.photo-title { font-size: .85rem; font-weight: 650; }
.photo-credit { color: var(--muted); font-size: .73rem; overflow-wrap: anywhere; }
.photo-credit a { text-decoration-color: var(--line); text-underline-offset: 3px; }
.photo-credit a:hover { text-decoration-color: currentColor; }

.planner { background: var(--moss); border: 1px solid #d1dac9; border-radius: 9px; padding: clamp(1rem, 3vw, 1.85rem); }
.planner h2 { margin-bottom: 1rem; font-size: clamp(1.4rem, 3.2vw, 1.9rem); }
#planner-form { display: grid; grid-template-columns: minmax(240px, 1.4fr) minmax(110px, .8fr) minmax(110px, .8fr) auto; gap: 1rem; align-items: start; }
.regions { padding: 0; margin: 0; border: 0; min-width: 0; }
.regions legend, .field > label { padding: 0; margin-bottom: .33rem; font-size: .88rem; font-weight: 650; }
.region-options { display: flex; flex-wrap: wrap; gap: .25rem; }
.region-options label { position: relative; cursor: pointer; }
.region-options input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.region-options span { display: grid; place-items: center; min-height: 42px; padding: .38rem .68rem; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); font-size: .87rem; }
.region-options input:checked + span { background: var(--evergreen); border-color: var(--evergreen); color: white; }
.region-options input:focus-visible + span { outline: 2px solid var(--evergreen); outline-offset: 2px; }
.field { display: grid; align-content: start; }
.number-field { display: flex; align-items: center; gap: .4rem; min-height: 42px; padding-inline: .5rem; background: var(--surface); border: 1px solid var(--line); border-radius: 5px; }
.number-field:focus-within { outline: 2px solid var(--evergreen); outline-offset: 2px; }
.number-field input { background: none; border: none; outline: none; padding: .35rem 0; width: 100%; min-width: 0; font-variant-numeric: tabular-nums; }
.number-field input:focus-visible { outline: none; }
.number-field span, .field small { color: var(--muted); white-space: nowrap; font-size: .77rem; }
.field small { margin-top: .15rem; }
.drive-control { display: inline-flex; align-items: center; gap: .4rem; font-size: .88rem; cursor: pointer; min-height: 42px; margin-top: 1.73rem; }
.drive-control input { width: 1.05rem; height: 1.05rem; accent-color: var(--evergreen); }
.form-feedback:empty { display: none; }
.form-feedback { margin-top: .55rem; color: var(--rust); font-size: .85rem; }

.results { margin-top: clamp(2rem, 5vw, 3.5rem); }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .25rem 1.25rem; margin-bottom: 1rem; }
.result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(.9rem, 2.5vw, 1.6rem); }
.route-card { display: grid; grid-template-rows: auto 1fr; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.route-card.selected { border-color: var(--evergreen); }
.route-card > img { display: block; width: 100%; aspect-ratio: 2.15; object-fit: cover; background: var(--moss); }
.card-content { display: grid; grid-template-rows: auto auto 1fr auto auto auto; align-items: start; gap: .45rem; padding: clamp(.85rem, 2.5vw, 1.35rem); }
.card-meta { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .2rem .7rem; color: var(--muted); font-size: .8rem; }
.fit-label { font-size: .77rem; font-weight: 650; padding: .12rem .4rem; border-radius: 4px; background: var(--moss); color: var(--evergreen); }
.fit-over, .fit-possible { color: var(--rust); background: var(--rust-surface); }
.card-stops { color: var(--muted); font-size: .9rem; }
.price { color: var(--evergreen); font-family: var(--display); font-size: clamp(1.35rem, 3.2vw, 2.1rem); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.3; }
.fit-notes { list-style: none; padding: 0; margin: .1rem 0 .45rem; color: var(--muted); font-size: .84rem; }
.other-results { margin-top: 1rem; border-block: 1px solid var(--line); }
.other-results summary { padding: .65rem 0; font-size: .9rem; font-weight: 650; }
.other-results ul { list-style: none; margin: 0; padding: 0; }
.other-route { display: flex; justify-content: space-between; gap: .3rem 1rem; flex-wrap: wrap; width: 100%; padding: .55rem 0; text-align: left; border: 0; border-top: 1px solid var(--line); background: transparent; }
.other-route:hover { color: var(--evergreen); text-decoration: underline; }

.route-detail { margin-top: clamp(2rem, 5vw, 3.5rem); padding-top: clamp(1.25rem, 3vw, 2rem); border-top: 1px solid var(--line); }
.detail-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem 1rem; }
.detail-heading h2 { scroll-margin: 1rem; }
.detail-intro { margin: .45rem 0 .3rem; }
.gallery-heading { margin-top: 1.5rem; }
.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem 1.05rem; margin-top: .55rem; }
.gallery > figure { min-width: 0; }
.gallery figure > a { display: block; border-radius: 6px; overflow: hidden; }
.gallery img { display: block; width: 100%; aspect-ratio: 1.6; object-fit: cover; background: var(--moss); }
.detail-grid { display: grid; grid-template-columns: 1.35fr .9fr; gap: clamp(1rem, 4vw, 3.1rem); align-items: start; margin-top: 2rem; }
.detail-grid h3 + p { margin-top: .25rem; }
.timeline { list-style: none; margin: .45rem 0 0; padding: 0; }
.stop { display: grid; grid-template-columns: 7.5rem 1fr; gap: .5rem; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.stop-days { font-size: .83rem; color: var(--evergreen); font-variant-numeric: tabular-nums; }
.stop-info { display: grid; gap: .13rem; }
.stop-info p { font-size: .85rem; }
.cost-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 1rem; }
.costs { margin: .35rem 0 .65rem; }
.costs > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .1rem .4rem; border-bottom: 1px solid var(--line); padding: .37rem 0; font-size: .87rem; }
.costs dd { margin: 0; font-variant-numeric: tabular-nums; }
.costs .cost-total { font-weight: 700; color: var(--evergreen); padding-top: .55rem; }
.footer { margin-top: 2.4rem; padding: 1rem 0 1.5rem; border-top: 1px solid var(--line); font-size: .85rem; color: var(--muted); }

dialog { width: min(32rem, calc(100% - 2rem)); color: inherit; background: var(--surface); padding: 1.2rem; border: 1px solid var(--line); border-radius: 9px; }
dialog::backdrop { background: rgb(25 45 35 / .46); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: .55rem; }
.dialog-heading h2 { font-size: clamp(1.25rem, 5vw, 1.55rem); }
#share-summary { margin: .45rem 0 .9rem; }
.share-label { display: block; font-size: .9rem; font-weight: 650; }
#share-url { width: 100%; min-height: 43px; border: 1px solid var(--line); border-radius: 5px; background: var(--paper); padding: .4rem; }
.copy-button { margin-top: .65rem; }
#copy-feedback { font-size: .86rem; color: var(--evergreen); margin-top: .3rem; }

@media (max-width: 850px) {
  #planner-form { grid-template-columns: 1fr 1fr; }
  .regions { grid-column: 1 / -1; }
  .drive-control { grid-column: 1 / -1; margin-top: -.4rem; }
}
@media (max-width: 620px) {
  .shell { width: calc(100% - 28px); }
  .topbar { min-height: 60px; }
  .hero { grid-template-columns: 1fr; gap: .8rem; padding-block: 1.4rem 1rem; }
  .hero-copy { gap: .48rem; }
  .hero-break { display: none; }
  h1 { font-size: clamp(1.95rem, 7.6vw, 2.75rem); letter-spacing: -.05em; }
  .hero-media img { aspect-ratio: 2.1; }
  .hero-context { font-size: .78rem; }
  .planner h2 { margin-bottom: .65rem; }
  #planner-form { gap: .5rem .65rem; }
  .drive-control { margin-top: 0; }
  .result-grid, .gallery { gap: .6rem; }
  .card-meta { line-height: 1.35; }
  .card-content { padding: .65rem; }
  .card-content h3 { font-size: 1rem; }
  .card-stops, .fit-notes { font-size: .77rem; }
  .result-grid .button { padding-inline: .4rem; font-size: .77rem; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: 1fr; }
  .stop { grid-template-columns: 5.7rem 1fr; }
}
