:root {
  --bg: #F4F2EC; --paper: #FBFAF6; --soft: #ECE9E1; --ink: #24211C; --ink-soft: #6B655A; --ink-faint: #9A9384;
  --rule: #DAD4C6; --accent: #B23A2E; --hdr: rgba(251, 250, 246, .92);
  --must: #B23A2E; --mustBg: #F6E3DF; --ok: #3F7A5C; --okBg: #DFEDE4; --amber: #B9832A; --amberBg: #F5EBD6;
  --d1: #B9832A; --d2: #3F7A5C; --d3: #8C5A35; --d4: #3C7FA0; --d5: #7558A0; --d6: #B2443A; --d7: #5B6577;
  --on-c: #FFFFFF; --sh: 0 6px 24px rgba(36, 33, 28, .10);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161512; --paper: #1F1D19; --soft: #2A2722; --ink: #ECE7DC; --ink-soft: #A39C8E; --ink-faint: #7A7468;
    --rule: #37332C; --accent: #E0705F; --hdr: rgba(31, 29, 25, .92);
    --must: #E0705F; --mustBg: #3A2420; --ok: #5FA47F; --okBg: #1F3328; --amber: #D9A44A; --amberBg: #3A2F1C;
    --d1: #D9A44A; --d2: #5FA47F; --d3: #BA8455; --d4: #5DA5C8; --d5: #A086CC; --d6: #DE6A5E; --d7: #8F9AAE;
    --on-c: #161512; --sh: 0 6px 24px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161512; --paper: #1F1D19; --soft: #2A2722; --ink: #ECE7DC; --ink-soft: #A39C8E; --ink-faint: #7A7468;
  --rule: #37332C; --accent: #E0705F; --hdr: rgba(31, 29, 25, .92);
  --must: #E0705F; --mustBg: #3A2420; --ok: #5FA47F; --okBg: #1F3328; --amber: #D9A44A; --amberBg: #3A2F1C;
  --d1: #D9A44A; --d2: #5FA47F; --d3: #BA8455; --d4: #5DA5C8; --d5: #A086CC; --d6: #DE6A5E; --d7: #8F9AAE;
  --on-c: #161512; --sh: 0 6px 24px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  font-size: 16px; line-height: 1.75; overflow-x: hidden; -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
b, strong { font-weight: 700; }
.serif { font-family: "Noto Serif TC", "Songti TC", "PMingLiU", serif; }
.wrap {
  max-width: 980px; margin: 0 auto; padding: 0 20px;
  padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right));
}
@media (max-width: 640px) { .wrap { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); } }
.tnum { font-variant-numeric: tabular-nums; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ── Header ── */
header.top {
  position: sticky; top: 0; z-index: 900; background: var(--hdr);
  backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--rule); padding-top: env(safe-area-inset-top);
}
.hbar { display: flex; align-items: center; gap: 10px; min-height: 54px; padding-top: 8px; padding-bottom: 8px; }
.home { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; flex: 0 0 auto; }
.logo {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--c, var(--accent)); color: var(--on-c); font-size: 13px; font-weight: 700; flex: 0 0 auto;
}
.home .back { font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.hbar .htitle { font-size: 15px; font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.hbar nav::-webkit-scrollbar { display: none; }
.hbar nav a {
  flex: 0 0 auto; font-size: 13.5px; font-weight: 700; color: var(--ink-soft); text-decoration: none;
  padding: 8px 12px; border-radius: 999px; white-space: nowrap; transition: background .15s, color .15s;
}
.hbar nav a.on { background: var(--ink); color: var(--bg); }
@media (max-width: 760px) { .hbar .htitle { display: none; } .hbar { gap: 6px; } .hbar nav { margin-left: auto; } }

/* ── Hero ── */
.hero { padding-top: clamp(28px, 6vw, 52px); }
.hero .k { font-size: 14px; font-weight: 700; color: var(--c, var(--accent)); letter-spacing: .02em; }
.hero h1 { margin: 4px 0 0; font-family: "Noto Serif TC", serif; font-weight: 900; font-size: clamp(28px, 5.6vw, 48px); line-height: 1.22; letter-spacing: -.01em; }
.hero .lede { margin: 14px 0 0; color: var(--ink-soft); font-size: clamp(15px, 1.6vw, 17px); max-width: 38em; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 12px 0 0; font-size: 14px; color: var(--ink-soft); }
.meta b { color: var(--ink); font-weight: 500; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); margin: 28px 0 0; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule); }
.stats div { padding: 14px 4px 12px; }
.stats b { display: block; font-family: "Noto Serif TC", serif; font-weight: 900; font-size: clamp(26px, 5vw, 36px); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stats span { font-size: 13px; color: var(--ink-soft); }
@media (max-width: 520px) { .stats { grid-template-columns: repeat(2, 1fr); } }

.daytabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 18px 0 0; padding: 0; list-style: none; }
.daytabs a {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; text-decoration: none;
  font-weight: 700; font-size: 15px; border: 1.5px solid var(--c); color: var(--ink);
}
.daytabs a[aria-current="page"] { background: var(--c); color: var(--on-c); }

/* ── Sections ── */
section.sec { padding: clamp(40px, 7vw, 60px) 0 0; }
h2.st { margin: 0 0 6px; font-family: "Noto Serif TC", serif; font-size: clamp(21px, 4vw, 27px); font-weight: 900; line-height: 1.35; }
h2.st small { font-family: "Noto Sans TC", sans-serif; color: var(--ink-faint); font-size: 13px; font-weight: 700; margin-left: 8px; display: inline-block; }
p.sd { margin: 0 0 18px; color: var(--ink-soft); font-size: 15px; max-width: 40em; }

/* ── Leaflet map ── */
.mapwrap { position: relative; border-radius: 18px; overflow: hidden; border: 1px solid var(--rule); background: var(--soft); box-shadow: var(--sh); }
.lmap { height: clamp(320px, 56vw, 520px); width: 100%; background: var(--soft); }
.mapnote { position: absolute; left: 10px; bottom: 10px; z-index: 500; font-size: 12px; color: var(--ink-soft); background: var(--hdr); padding: 3px 10px; border-radius: 8px; pointer-events: none; max-width: calc(100% - 20px); }
.leaflet-container { font-family: inherit; }
.lmap .leaflet-tile-pane { filter: saturate(.55) sepia(.12); }
.lmap.dark-tiles .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) saturate(.4) brightness(.82) contrast(.92); }
.leaflet-control-attribution { font-size: 10px; background: var(--hdr) !important; color: var(--ink-soft) !important; }
.leaflet-control-attribution a { color: var(--ink-soft) !important; }
.leaflet-bar a { background: var(--paper) !important; color: var(--ink) !important; border-color: var(--rule) !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--paper); color: var(--ink); box-shadow: var(--sh); }
.leaflet-popup-content { margin: 12px 14px; font-size: 14px; line-height: 1.6; }
.leaflet-popup-content b { display: block; font-size: 15px; }
.leaflet-popup-content a { color: var(--accent); font-weight: 700; }
.pin {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--c); color: var(--on-c); font-weight: 700; font-size: 13px; border: 2.5px solid var(--paper);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .3); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.pin.wide { width: auto; padding: 0 7px; border-radius: 14px; }
.plabel {
  font-size: 12px; font-weight: 700; color: var(--ink); white-space: nowrap;
  text-shadow: 0 0 3px var(--bg), 0 0 3px var(--bg), 0 0 3px var(--bg), 0 0 3px var(--bg);
}
.plabel i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--paper); border: 2px solid var(--ink); margin-right: 5px; vertical-align: -1px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 12px 0 0; font-size: 13px; color: var(--ink-soft); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 18px; height: 4px; border-radius: 2px; background: var(--c); }

/* ── Day list (overview) ── */
.daylist { list-style: none; margin: 0; padding: 0; }
.daylist a {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center;
  padding: 16px 4px; border-bottom: 1px solid var(--rule); text-decoration: none;
}
.daylist li:first-child a { border-top: 1px solid var(--rule); }
.daylist .n { font-family: "Noto Serif TC", serif; font-weight: 900; font-size: 30px; line-height: 1; color: var(--c); font-variant-numeric: tabular-nums; }
.daylist .n small { display: block; font-size: 12px; font-family: "Noto Sans TC", sans-serif; font-weight: 700; margin-bottom: 4px; }
.daylist .tt { font-weight: 700; font-size: 17px; line-height: 1.45; }
.daylist .via { font-size: 14px; color: var(--ink-soft); line-height: 1.5; margin-top: 2px; }
.daylist .go { font-size: 22px; color: var(--ink-soft); transition: transform .2s ease; }
.daylist a:hover .go, .daylist a:focus-visible .go { transform: translateX(4px); color: var(--c); }
.daylist a:hover .tt { color: var(--c); }
.daylist .prog { font-size: 12px; color: var(--ink-faint); font-weight: 500; }

/* ── Cards ── */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.card {
  display: block; text-decoration: none; background: var(--paper); border: 1px solid var(--rule);
  border-radius: 16px; padding: 18px 20px; transition: border-color .15s, transform .15s;
}
a.card:hover { border-color: var(--ink-soft); transform: translateY(-2px); }
.card .ck { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.card .ct { font-family: "Noto Serif TC", serif; font-weight: 900; font-size: 22px; line-height: 1.35; margin-top: 2px; }
.card .cs { font-size: 14px; color: var(--ink-soft); margin-top: 4px; }
.card .cgo { margin-top: 10px; font-size: 14px; font-weight: 700; color: var(--accent); }
.card h3 { margin: 0 0 6px; font-size: 14px; color: var(--ink-soft); font-weight: 700; }
.card ul { margin: 0; padding-left: 1.2em; }
.flights { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.flight .who { font-size: 13px; color: var(--ink-soft); }
.flight .time { font-family: "Noto Serif TC", serif; font-weight: 900; font-size: 30px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.flight .where { font-size: 14px; }
@media (max-width: 520px) { .flights { grid-template-columns: 1fr; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0 !important; margin: 0; }
.chips li { padding: 3px 12px; border-radius: 999px; border: 1px solid var(--rule); font-size: 14px; font-weight: 500; }
.facts { display: grid; gap: 14px; }

/* ── Timeline (stops) ── */
.stops { list-style: none; margin: 8px 0 0; padding: 0; }
.stop { display: grid; grid-template-columns: 88px 26px 1fr; column-gap: 12px; }
.stop .t { text-align: right; font-weight: 700; font-size: 14px; line-height: 1.45; padding-top: 2px; font-variant-numeric: tabular-nums; }
.stop .rail { position: relative; display: flex; justify-content: center; }
.stop .rail::before { content: ""; position: absolute; top: 0; bottom: 0; width: 3px; background: var(--c); }
.stop:first-child .rail::before { top: 12px; }
.stop:last-child .rail::before { bottom: auto; height: 12px; }
.check {
  position: relative; z-index: 1; width: 24px; height: 24px; margin-top: 1px; padding: 0; border-radius: 50%;
  border: 3px solid var(--c); background: var(--bg); cursor: pointer; display: grid; place-items: center;
}
.check svg { width: 12px; height: 12px; opacity: 0; }
.check svg path { stroke: var(--on-c); }
.check[aria-pressed="true"] { background: var(--c); }
.check[aria-pressed="true"] svg { opacity: 1; }
.stop .body { padding-bottom: 26px; min-width: 0; }
.stop h3 { margin: 0; font-size: 17px; line-height: 1.45; }
.stop h3 .num {
  display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--c); color: var(--on-c);
  font-size: 11.5px; margin-right: 6px; vertical-align: 2px; cursor: pointer; border: 0; padding: 0; font-weight: 700; font-family: inherit;
}
.stop .chain { display: block; margin-top: 4px; font-size: 14px; line-height: 1.8; }
.stop p { margin: 4px 0 0; color: var(--ink-soft); font-size: 15px; }
.stop.done h3 { text-decoration: line-through; text-decoration-thickness: 1px; color: var(--ink-soft); }
.stop.done p, .stop.done .chain { opacity: .6; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag { font-size: 12px; font-weight: 500; padding: 0 8px; border-radius: 6px; border: 1px solid var(--c); }
.slinks { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; font-size: 13.5px; font-weight: 700; }
.slinks a { color: var(--c); text-decoration: none; }
.slinks a:hover { text-decoration: underline; }
@media (max-width: 520px) {
  .stop { grid-template-columns: 62px 24px 1fr; column-gap: 8px; }
  .stop .t { font-size: 13px; }
}

/* ── Notes ── */
.notes { border-top: 1px solid var(--rule); }
.note { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; padding: 14px 2px; border-bottom: 1px solid var(--rule); align-items: start; }
.note .badge {
  font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 6px; margin-top: 3px; white-space: nowrap;
  background: var(--soft); color: var(--ink-soft);
}
.note.must .badge { background: var(--mustBg); color: var(--must); }
.note b { display: block; font-size: 16px; line-height: 1.5; }
.note p { margin: 2px 0 0; font-size: 14.5px; color: var(--ink-soft); line-height: 1.7; }
.note p b { display: inline; color: var(--ink); font-size: inherit; }

/* ── Checklist ── */
.cl-head { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; }
.cl-count { font-family: "Noto Serif TC", serif; font-weight: 900; font-size: 22px; font-variant-numeric: tabular-nums; }
.cl-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--soft); overflow: hidden; }
.cl-bar i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .25s ease; }
.cl-reset { font: inherit; font-size: 13px; color: var(--ink-soft); background: none; border: 1px solid var(--rule); border-radius: 999px; padding: 4px 12px; cursor: pointer; }
.cl-reset:hover { color: var(--ink); border-color: var(--ink-soft); }
.clist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.clist label {
  display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; background: var(--paper);
  border: 1px solid var(--rule); border-radius: 12px; cursor: pointer; font-size: 15px; line-height: 1.5; min-height: 46px;
}
.clist input { appearance: none; -webkit-appearance: none; flex: 0 0 auto; width: 20px; height: 20px; margin: 1px 0 0; border-radius: 6px; border: 2px solid var(--ink-faint); display: grid; place-items: center; cursor: pointer; background: var(--bg); }
.clist input::after { content: ""; width: 10px; height: 6px; border-left: 2.5px solid var(--on-c); border-bottom: 2.5px solid var(--on-c); transform: rotate(-45deg) translate(1px, -1px); opacity: 0; }
.clist input:checked { background: var(--ok); border-color: var(--ok); }
.clist input:checked::after { opacity: 1; }
.clist input:checked + span { color: var(--ink-faint); text-decoration: line-through; text-decoration-thickness: 1px; }
.cl-group { margin-top: 22px; }
.cl-group h3 { margin: 0 0 10px; font-size: 15px; font-weight: 700; color: var(--ink-soft); }

/* ── Toggle (去程／回程) ── */
.toggle { display: flex; width: max-content; max-width: 100%; background: var(--soft); border-radius: 999px; padding: 3px; gap: 3px; margin: 22px 0 0; overflow-x: auto; scrollbar-width: none; }
.toggle a { text-decoration: none; color: var(--ink-soft); font-size: 14px; font-weight: 700; padding: 9px 16px; border-radius: 999px; white-space: nowrap; min-height: 40px; display: inline-flex; align-items: center; }
.toggle a.on { background: var(--ink); color: var(--bg); }

/* ── Pan / zoom schematic ── */
.panview {
  position: relative; background: var(--paper); border: 1px solid var(--rule); border-radius: 18px; overflow: hidden;
  touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; height: clamp(300px, 54vw, 480px); box-shadow: var(--sh);
}
.panview.drag { cursor: grabbing; }
.panview svg { position: absolute; top: 0; left: 0; transform-origin: 0 0; width: 1000px; height: 610px; }
.pctrl { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 6px; z-index: 5; }
.pctrl button {
  width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--rule); background: var(--paper); color: var(--ink);
  font-size: 18px; font-weight: 700; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, .1); display: grid; place-items: center; line-height: 1; font-family: inherit;
}
.pctrl button:active { background: var(--soft); }
.phint { position: absolute; left: 10px; top: 10px; z-index: 5; pointer-events: none; background: var(--hdr); border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.sch-box { fill: var(--bg); stroke: var(--ink); stroke-width: 2; }
.sch-box.hl { fill: var(--amberBg); stroke: var(--amber); }
.sch-box.hl2 { fill: var(--okBg); stroke: var(--ok); }
.sch-box.ghost { fill: none; stroke: var(--ink-faint); stroke-dasharray: 6 6; }
.sch-t { fill: var(--ink); font-size: 24px; font-weight: 700; }
.sch-s { fill: var(--ink-soft); font-size: 17px; }
.sch-ghost { fill: var(--ink-faint); }
.sch-edge { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.sch-arrow { fill: var(--accent); }
.sch-n { fill: var(--ink); }
.sch-n.hl { fill: var(--amber); } .sch-n.hl2 { fill: var(--ok); }
.sch-nt { fill: var(--bg); font-size: 18px; font-weight: 700; }
.sch-cap { fill: var(--ink-faint); font-size: 15px; }

.ann { margin-top: 20px; border-top: 1px solid var(--rule); }
.ann .a { display: grid; grid-template-columns: 28px 1fr; gap: 13px; padding: 14px 2px; border-bottom: 1px solid var(--rule); align-items: start; }
.ann .n { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--bg); font-size: 12.5px; font-weight: 700; display: grid; place-items: center; margin-top: 2px; }
.ann .a.hl .n { background: var(--amber); color: var(--on-c); } .ann .a.hl2 .n { background: var(--ok); color: var(--on-c); }
.ann b { font-size: 16px; display: block; }
.ann p { font-size: 14.5px; color: var(--ink-soft); line-height: 1.7; margin: 2px 0 0; }
.ann p b { display: inline; color: var(--ink); font-size: inherit; }

/* simple steps (airport timeline) */
.steps { list-style: none; margin: 0; padding: 0; border-left: 3px solid var(--accent); margin-left: 6px; }
.steps li { position: relative; padding: 0 0 20px 22px; }
.steps li::before { content: ""; position: absolute; left: -9px; top: 6px; width: 15px; height: 15px; border-radius: 50%; background: var(--bg); border: 3px solid var(--accent); }
.steps .t { font-size: 13.5px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.steps b { display: block; font-size: 16px; line-height: 1.5; }
.steps p { margin: 2px 0 0; font-size: 14.5px; color: var(--ink-soft); }
.steps a { font-size: 13.5px; font-weight: 700; color: var(--accent); text-decoration: none; }

/* ── Pager & footer ── */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 44px; }
.pager a { text-decoration: none; border: 1px solid var(--rule); border-radius: 14px; padding: 12px 16px; background: var(--paper); }
.pager a:hover { border-color: var(--ink-soft); }
.pager small { display: block; font-size: 12px; color: var(--ink-soft); }
.pager span { font-weight: 700; font-size: 15px; }
.pager .next { text-align: right; grid-column: 2; }
footer.foot { margin: 56px 0 0; padding: 22px 0 calc(40px + env(safe-area-inset-bottom)); border-top: 1px solid var(--rule); font-size: 13px; color: var(--ink-faint); }
footer.foot a { color: var(--ink-soft); }
.totop { float: right; text-decoration: none; font-weight: 700; color: var(--ink-soft); }
.small-reset { margin-top: 10px; font: inherit; font-size: 13px; color: var(--ink-soft); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
