:root {
  color-scheme: light;
  --bg: #f6f1e7;
  --surface: #fffdf8;
  --surface-2: #e8f3f3;
  --ink: #14242c;
  --muted: #5a6970;
  --line: #d8d4ca;
  --sea: #0e5f73;
  --sea-2: #174657;
  --coral: #c64f30;
  --gold: #c48b2c;
  --green: #27684b;
  --shadow: 0 14px 40px rgba(22, 50, 59, .09);
  --radius: 20px;
  --content: 1120px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d171c;
  --surface: #142229;
  --surface-2: #17313a;
  --ink: #f5f1e8;
  --muted: #b8c2c6;
  --line: #31434a;
  --sea: #70c4d5;
  --sea-2: #a9dce6;
  --coral: #ff8b6c;
  --gold: #f2bd58;
  --green: #79cea4;
  --shadow: 0 16px 44px rgba(0, 0, 0, .24);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }
button, a { touch-action: manipulation; }
button { font: inherit; }

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 10px;
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.topbar {
  position: sticky;
  z-index: 100;
  top: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(16px);
}

.topbar-inner {
  max-width: var(--content);
  min-height: 72px;
  margin: auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--sea);
  color: var(--bg);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: .08em;
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; line-height: 1.25; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 12px; letter-spacing: .04em; }

.theme-toggle {
  min-width: 64px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

main { overflow: clip; }

.summary {
  max-width: var(--content);
  margin: 0 auto;
  padding: 64px 20px 32px;
}

.summary-copy {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--sea);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3, p, li { overflow-wrap: anywhere; }
p, li { word-break: break-all; }
h1 { margin-bottom: 16px; font-size: clamp(34px, 7vw, 68px); line-height: 1.15; letter-spacing: -.035em; overflow-wrap: anywhere; }
h2 { margin-bottom: 8px; font-size: clamp(28px, 5vw, 42px); line-height: 1.15; letter-spacing: -.025em; }
h3 { margin-bottom: 6px; font-size: 18px; line-height: 1.35; }

.lede { color: var(--muted); font-size: clamp(17px, 2vw, 20px); max-width: 700px; }

.flight-strip {
  margin-top: 32px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.flight-strip div { padding: 20px; border-right: 1px solid var(--line); }
.flight-strip div:last-child { border-right: 0; }
.flight-strip span, .flight-strip small { display: block; color: var(--muted); }
.flight-strip span { font-size: 12px; font-weight: 700; }
.flight-strip strong { display: block; margin: 4px 0; font-size: 20px; font-variant-numeric: tabular-nums; }
.flight-strip small { font-size: 13px; }

.alert {
  margin-top: 20px;
  padding: 18px 20px;
  border-left: 4px solid var(--coral);
  border-radius: 4px 14px 14px 4px;
  background: color-mix(in srgb, var(--coral) 10%, var(--surface));
}

.cover {
  margin: 24px 0 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.cover img { width: 100%; height: auto; display: block; }

.day-nav {
  position: sticky;
  z-index: 90;
  top: 72px;
  max-width: calc(var(--content) - 40px);
  margin: 0 auto;
  padding: 8px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 8px 24px rgba(22, 50, 59, .08);
  scrollbar-width: none;
}

.day-nav::-webkit-scrollbar { display: none; }
.day-nav a {
  flex: 1 0 auto;
  min-width: 68px;
  min-height: 44px;
  padding: 10px 14px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
}
.day-nav a:hover, .day-nav a:focus-visible { background: var(--surface-2); color: var(--sea-2); }

.section {
  max-width: var(--content);
  margin: 0 auto;
  padding: 76px 20px 0;
  scroll-margin-top: 130px;
}

.section-heading { max-width: 760px; margin-bottom: 28px; }
.section-heading > p:last-child { color: var(--muted); }

.ticket-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ticket-card, .route-card, .guide-grid article, .source-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.map-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.visible-maps {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  max-width: 1000px;
}
.route-map-figure {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.route-map-figure figcaption {
  padding: 18px 20px 12px;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--line);
}
.route-map-figure figcaption span { color: var(--coral); font-size: 14px; font-weight: 850; }
.route-map-figure figcaption strong { font-size: 20px; }
.route-map-figure img { width: 100%; height: auto; display: block; background: #dfe9ed; }
.route-map-figure p { margin: 0; padding: 14px 20px 18px; color: var(--muted); }
.map-links-heading { margin-top: 40px; }
.map-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.map-card p { color: var(--muted); }
.map-day { margin-bottom: 4px; color: var(--coral); font-size: 14px; font-weight: 850; }

.ticket-card { padding: 22px; }
.ticket-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.status {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.status.buy { background: color-mix(in srgb, var(--coral) 14%, var(--surface)); color: var(--coral); }
.status.day { background: color-mix(in srgb, var(--gold) 18%, var(--surface)); color: color-mix(in srgb, var(--gold) 78%, var(--ink)); }
.status.done { background: color-mix(in srgb, var(--green) 15%, var(--surface)); color: var(--green); }
.status.free { background: var(--surface-2); color: var(--sea-2); }
.ticket-meta { margin: 14px 0; color: var(--muted); }

.button-row { display: flex; flex-wrap: wrap; gap: 10px; }
.button, .copy-button {
  min-height: 44px;
  padding: 10px 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--sea);
  border-radius: 12px;
  background: var(--sea);
  color: var(--bg);
  text-decoration: none;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
  transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease;
}
.button.secondary, .copy-button { background: transparent; color: var(--sea-2); }
.button:hover { background: var(--sea-2); }
.button.secondary:hover, .copy-button:hover { background: var(--surface-2); }

.guide-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.guide-grid article { padding: 24px; }
.guide-grid p { margin-bottom: 0; color: var(--muted); }
.step-no { color: var(--coral); font-weight: 850; font-variant-numeric: tabular-nums; }
.source-link { display: inline-block; margin-top: 18px; color: var(--sea-2); font-weight: 700; }

.day-header {
  margin-bottom: 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 20px;
}
.day-date { color: var(--coral); font-size: 14px; font-weight: 850; letter-spacing: .04em; }
.day-note { max-width: 420px; color: var(--muted); text-align: right; }

.route-list { position: relative; display: grid; gap: 16px; }
.route-list::before {
  content: "";
  position: absolute;
  top: 26px;
  bottom: 26px;
  left: 24px;
  width: 2px;
  background: var(--line);
}
.route-card { position: relative; margin-left: 56px; padding: 22px; }
.route-card::before {
  content: "";
  position: absolute;
  top: 22px;
  left: -42px;
  width: 16px;
  height: 16px;
  border: 4px solid var(--bg);
  border-radius: 50%;
  background: var(--sea);
  box-shadow: 0 0 0 1px var(--line);
}
.route-time { color: var(--coral); font-size: 13px; font-weight: 850; font-variant-numeric: tabular-nums; }
.route-title { margin: 4px 0 8px; }
.route-text { color: var(--muted); }
.route-text strong { color: var(--ink); }
.ride-steps {
  margin: 16px 0;
  padding: 16px 16px 16px 42px;
  border-radius: 14px;
  background: var(--surface-2);
}
.ride-steps li { padding: 3px 0 3px 4px; }
.ride-steps li::marker { color: var(--sea-2); font-weight: 850; }
.map-query {
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-2) 42%, var(--surface));
  color: var(--ink);
  font-size: 14px;
  overflow-wrap: anywhere;
}
.map-query span { display: block; margin-bottom: 2px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .06em; }
.route-warning { margin-top: 12px; color: var(--coral); font-size: 14px; font-weight: 700; }

.check-list { margin: 0; padding: 0; display: grid; gap: 12px; list-style: none; }
.check-list li { padding: 16px 18px; border-left: 3px solid var(--sea); background: var(--surface); }

.source-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.source-card { min-height: 112px; padding: 18px; display: flex; flex-direction: column; justify-content: space-between; text-decoration: none; }
.source-card:hover { border-color: var(--sea); }
.source-card strong { line-height: 1.35; }
.source-card small { color: var(--muted); }

.weather-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.weather-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.weather-card p, .weather-card li { color: var(--muted); }
.weather-card ul { margin: 0; padding-left: 22px; }
.weather-links { margin-top: 18px; }
.forecast-list { display: grid; gap: 12px; }
.forecast-list div { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.forecast-list div:last-child { padding-bottom: 0; border-bottom: 0; }
.forecast-list strong, .forecast-list span, .forecast-list small { display: block; }
.forecast-list small { color: var(--muted); }
.daily-weather-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.daily-weather-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.daily-weather-card.has-forecast { border: 2px solid var(--green); }
.weather-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.weather-card-head span { color: var(--sea-2); font-size: 14px; font-weight: 800; }
.weather-card-head h3 { margin: 2px 0 0; }
.weather-range { flex: 0 0 auto; color: var(--coral); font-size: 22px; font-variant-numeric: tabular-nums; }
.weather-humidity, .weather-note { color: var(--muted); }
.weather-wear { margin-bottom: 0; padding-top: 12px; border-top: 1px solid var(--line); }
.weather-status { margin-top: 16px; padding: 16px 18px; border-left: 4px solid var(--gold); background: var(--surface); }

footer {
  max-width: var(--content);
  margin: 80px auto 0;
  padding: 28px 20px calc(28px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.toast {
  position: fixed;
  z-index: 200;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  max-width: min(360px, calc(100vw - 40px));
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--bg);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}
.toast.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 800px) {
  .summary { padding-top: 44px; }
  .flight-strip { grid-template-columns: repeat(2, 1fr); }
  .flight-strip div:nth-child(2) { border-right: 0; }
  .flight-strip div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .ticket-grid, .source-grid, .map-grid, .visible-maps, .daily-weather-grid { grid-template-columns: 1fr; }
  .weather-grid { grid-template-columns: 1fr; }
  .guide-grid { grid-template-columns: 1fr; }
  .day-header { grid-template-columns: 1fr; }
  .day-note { text-align: left; }
}

@media (max-width: 560px) {
  .topbar-inner { padding-inline: 16px; }
  .summary, .section { padding-left: 16px; padding-right: 16px; }
  .day-nav { max-width: calc(100% - 24px); }
  h1 { font-size: 34px; }
  .ticket-grid, .source-grid, .map-grid, .visible-maps, .daily-weather-grid { grid-template-columns: 1fr; }
  .weather-card-head { flex-direction: column; gap: 6px; }
  .flight-strip div { padding: 16px; }
  .route-list::before { left: 10px; }
  .route-card { margin-left: 30px; padding: 18px; }
  .route-card::before { left: -28px; width: 14px; height: 14px; }
  .button-row { display: grid; grid-template-columns: 1fr; }
  .button, .copy-button { width: 100%; }
  footer { flex-direction: column; }
}

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

@media print {
  .topbar, .day-nav, .theme-toggle, .button-row, .toast { display: none !important; }
  body { background: white; color: black; }
  .summary, .section { max-width: none; padding: 24px 0; }
  .ticket-card, .route-card, .guide-grid article, .source-card { box-shadow: none; break-inside: avoid; }
}
