:root {
  --bg: #f4f6fb;
  --ink: #152033;
  --muted: #65718b;
  --line: #dfe5f0;
  --card: #ffffff;
  --brand: #1463ff;
  --brand-ink: #ffffff;
  --soft: #eef4ff;
  --good: #0d8f61;
  --bad: #c0392b;
  --shadow: 0 14px 40px rgba(25, 45, 85, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(1000px 500px at 15% -10%, #dce9ff 0, transparent 55%),
    radial-gradient(900px 480px at 110% 10%, #e8fff6 0, transparent 45%),
    var(--bg);
  color: var(--ink);
  font: 15px/1.55 "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

.shell { width: min(1120px, calc(100% - 36px)); margin: 0 auto; padding: 44px 0 28px; }
.hero { margin-bottom: 24px; }
.eyebrow { color: var(--brand); font-size: 11px; letter-spacing: .18em; font-weight: 800; }
h1 { font-size: clamp(30px, 5vw, 52px); line-height: 1.05; margin: 8px 0 12px; letter-spacing: -.035em; }
h2 { font-size: 24px; margin: 4px 0 4px; letter-spacing: -.02em; }
.lede { max-width: 700px; margin: 0; color: var(--muted); font-size: 15px; }
.hero-links { margin-top: 14px; }
.text-link { color: var(--brand); font-size: 13px; font-weight: 800; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.search-panel { padding: 22px; }
.route-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr) minmax(190px, .8fr);
  gap: 12px;
  align-items: end;
}
.field { display: grid; gap: 7px; min-width: 0; }
.field > span { color: var(--muted); font-size: 12px; font-weight: 700; }
input, select {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 13px;
  background: #fbfcff;
  color: var(--ink);
  font: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
select { padding-right: 30px; cursor: pointer; }
input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(20, 99, 255, .1); }
.swap {
  height: 48px;
  width: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
  color: var(--brand);
  font-size: 20px;
  cursor: pointer;
}
.swap:hover { border-color: var(--brand); }
.actions { display: flex; align-items: center; gap: 14px; margin-top: 18px; flex-wrap: wrap; }
button { font: inherit; }
.primary {
  border: 0;
  border-radius: 12px;
  background: var(--brand);
  color: var(--brand-ink);
  padding: 13px 22px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(20, 99, 255, .22);
}
.primary:disabled { opacity: .55; cursor: wait; box-shadow: none; }
.ghost {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  padding: 9px 14px;
  font-weight: 700;
  cursor: pointer;
}
.ghost:hover { border-color: var(--brand); color: var(--brand); }
.hint { color: var(--muted); font-size: 12px; }

.status-panel { margin-top: 18px; padding: 18px 20px; }
.status-row { display: flex; gap: 13px; align-items: flex-start; }
.dot { width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 5px rgba(20,99,255,.1); animation: pulse 1.3s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 9px rgba(20,99,255,.02); } }
.status-row strong { font-size: 15px; }
.status-row p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.progress { height: 5px; border-radius: 99px; background: var(--soft); overflow: hidden; margin-top: 14px; }
.progress > span { display: block; height: 100%; width: 8%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), #43c4a0); transition: width .7s ease; }

.error-panel { margin-top: 18px; padding: 18px 20px; border-color: #f2c9c3; background: #fff8f7; }
.error-panel strong { color: var(--bad); }
pre { white-space: pre-wrap; word-break: break-word; margin: 8px 0 0; color: #71352d; font: 13px/1.6 "Cascadia Code", Consolas, monospace; }

.hidden { display: none !important; }
#result-panel { margin-top: 30px; }
.result-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.muted { color: var(--muted); }
.summary { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.chip {
  display: inline-flex; align-items: baseline; gap: 7px;
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 7px 12px; font-size: 12px; color: var(--muted);
}
.chip b { color: var(--ink); font-size: 15px; }
.airline-filter {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 14px 0 16px; flex-wrap: wrap;
}
.airline-filter-label { color: var(--muted); font-size: 11px; font-weight: 700; padding-top: 7px; }
.airline-options { display: flex; flex-wrap: wrap; gap: 7px; }
.airline-chip {
  border: 1px solid var(--line); border-radius: 999px; background: #fff;
  color: #4d5a72; padding: 6px 11px; font-size: 11px; font-weight: 700; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.airline-chip:hover { border-color: var(--brand); color: var(--brand); }
.airline-chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.airline-chip.all { background: var(--soft); border-color: #d5e3ff; color: var(--brand); }
.airline-chip.all.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.airline-chip small { opacity: .7; margin-left: 3px; }
.recommendations {
  margin: 20px 0 26px;
  padding: 20px;
  border: 1px solid #cddcff;
  border-radius: 18px;
  background: linear-gradient(145deg, #f5f8ff 0%, #ffffff 55%, #f3fffb 100%);
  box-shadow: var(--shadow);
}
.recommendation-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 15px; }
.recommendation-head h3, .all-head h3 { margin: 4px 0 0; font-size: 21px; letter-spacing: -.02em; }
.recommendation-head p { margin: 5px 0 0; font-size: 12px; max-width: 760px; }
.recommendation-badge {
  flex: none; border: 1px solid #bfe9dc; border-radius: 999px; background: #ecfff9;
  color: #087657; font-size: 11px; font-weight: 800; padding: 5px 10px;
}
.preference-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: -3px 0 15px; }
.preference-label { color: var(--muted); font-size: 11px; font-weight: 700; }
.preference-switch {
  display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--line);
  border-radius: 999px; background: #fff;
}
.preference-switch button {
  border: 0; border-radius: 999px; background: transparent; color: var(--muted);
  padding: 6px 11px; font-size: 11px; font-weight: 700; cursor: pointer;
  transition: background .15s, color .15s;
}
.preference-switch button:hover { color: var(--brand); }
.preference-switch button.active { background: var(--soft); color: var(--brand); }
.recommendation-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.rec-card {
  display: flex; flex-direction: column; min-width: 0;
  border: 1px solid var(--line); border-radius: 15px; background: #fff;
  padding: 15px; box-shadow: 0 8px 24px rgba(25, 45, 85, .05);
}
.rec-card.primary { border-color: var(--brand); box-shadow: 0 12px 28px rgba(20, 99, 255, .14); }
.rec-label { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 10px; }
.rec-label span:first-child {
  display: inline-flex; border-radius: 999px; padding: 4px 9px;
  background: var(--soft); color: var(--brand); font-size: 11px; font-weight: 800;
}
.rec-card.primary .rec-label span:first-child { background: var(--brand); color: #fff; }
.rec-label span:last-child { color: #a0aabc; font-size: 11px; font-variant-numeric: tabular-nums; }
.rec-airline { margin: 0; color: #39455d; font-size: 13px; font-weight: 700; line-height: 1.45; }
.rec-timeline { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: start; margin: 13px 0 10px; }
.rec-timeline > div:last-child { text-align: right; }
.rec-time { font-size: 25px; font-weight: 900; letter-spacing: -.04em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.rec-day { display: block; color: var(--muted); font-size: 10px; font-weight: 600; min-height: 14px; }
.rec-airport { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.35; overflow-wrap: anywhere; }
.rec-line { align-self: center; text-align: center; min-width: 58px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.rec-line::before { content: "—— ✈ ——"; display: block; color: #9db7e8; font-size: 10px; white-space: nowrap; letter-spacing: -1px; }
.rec-price { display: flex; align-items: baseline; gap: 5px; margin-top: auto; padding-top: 8px; }
.rec-price strong { color: var(--brand); font-size: 24px; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.rec-price small { color: var(--muted); font-size: 10px; }
.rec-reasons { margin: 9px 0 0; padding: 0; list-style: none; display: grid; gap: 3px; }
.rec-reasons li { position: relative; padding-left: 12px; color: #4d5a72; font-size: 11px; line-height: 1.45; }
.rec-reasons li::before { content: "·"; position: absolute; left: 2px; color: var(--brand); font-weight: 900; }
.rec-action {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  margin-top: 12px; border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 10px; color: var(--ink); background: #fff;
  font-size: 11px; font-weight: 800; text-decoration: none;
}
.rec-card.primary .rec-action { background: var(--brand); border-color: var(--brand); color: #fff; }
.rec-action:hover { border-color: var(--brand); }
.rec-card.primary .rec-action:hover { background: #0c54de; }
.rec-note { margin: 9px 0 0; color: #8b96aa; font-size: 10px; line-height: 1.4; }
.all-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 22px 2px 10px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; min-width: 850px; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid #edf1f7; vertical-align: top; }
th { position: sticky; top: 0; background: #f8faff; color: var(--muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; z-index: 1; }
tbody tr:hover { background: #fafcff; }
tbody tr:last-child td { border-bottom: 0; }
.flight-no { font-weight: 800; white-space: nowrap; }
.airline { color: var(--muted); font-size: 13px; }
.time { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 700; }
.date-note { display: block; color: var(--muted); font-size: 11px; font-weight: 500; }
.airport { min-width: 170px; font-size: 13px; color: #35415a; }
.duration { white-space: nowrap; color: var(--muted); font-size: 13px; }
.stops { white-space: nowrap; font-size: 12px; }
.stops.direct { color: var(--good); font-weight: 800; }
.stops.transfer { color: #9a6300; font-weight: 700; }
.price-col { text-align: right; }
.price { white-space: nowrap; text-align: right; font-weight: 900; font-size: 17px; color: var(--brand); font-variant-numeric: tabular-nums; }
.price small { font-size: 11px; color: var(--muted); font-weight: 600; }
.disclaimer { color: var(--muted); font-size: 12px; margin: 12px 2px 0; }
.footer { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: #8a94a8; font-size: 12px; padding: 24px 2px 0; }

/* 全国低价页 */
.hero.narrow { max-width: 900px; }
.back-link { display: inline-block; margin-bottom: 22px; color: var(--muted); font-size: 12px; font-weight: 700; text-decoration: none; }
.back-link:hover { color: var(--brand); }
.nationwide-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(180px, .6fr) auto; }
.nationwide-grid .primary { height: 48px; white-space: nowrap; }
.podium { margin: 18px 0 24px; padding: 20px; border: 1px solid #cddcff; border-radius: 18px; background: linear-gradient(145deg, #f5f8ff, #fff 55%, #f3fffb); box-shadow: var(--shadow); }
.podium-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.podium-head h3 { margin: 4px 0 0; font-size: 21px; letter-spacing: -.02em; }
.podium-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.origin-card {
  border: 1px solid var(--line); border-radius: 15px; background: #fff;
  padding: 15px; box-shadow: 0 8px 24px rgba(25, 45, 85, .05);
}
.origin-card.rank-1 { border-color: var(--brand); box-shadow: 0 12px 28px rgba(20, 99, 255, .14); }
.origin-card-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 12px; }
.origin-rank { border-radius: 999px; background: var(--soft); color: var(--brand); font-size: 11px; font-weight: 800; padding: 4px 9px; }
.origin-card.rank-1 .origin-rank { background: var(--brand); color: #fff; }
.origin-card-label { color: var(--muted); font-size: 11px; }
.origin-name { margin: 0; font-size: 22px; letter-spacing: -.03em; }
.origin-price { margin: 9px 0 0; color: var(--brand); font-size: 32px; font-weight: 900; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.origin-price small { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0; }
.origin-meta { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.origin-card a { display: inline-flex; margin-top: 12px; color: var(--brand); font-size: 11px; font-weight: 800; text-decoration: none; }
.origin-card a:hover { text-decoration: underline; }
.rank-cell { color: var(--muted); font-variant-numeric: tabular-nums; width: 62px; }
.origin-cell { font-weight: 800; white-space: nowrap; }
.origin-code { color: var(--muted); font-size: 11px; font-weight: 500; margin-left: 4px; }
.price-cell { color: var(--brand); font-weight: 900; white-space: nowrap; font-variant-numeric: tabular-nums; }
.delta-cell { color: var(--muted); font-size: 12px; white-space: nowrap; }
.table-link { color: var(--brand); font-size: 12px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.table-link:hover { text-decoration: underline; }

/* 航司航线页 */
.hero-links { display: flex; gap: 18px; flex-wrap: wrap; }
.hero-links .back-link { margin-bottom: 22px; }
.airline-route-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, .8fr) minmax(90px, .45fr) auto; }
.airline-route-grid .primary { height: 48px; white-space: nowrap; }
.route-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.route-card {
  border: 1px solid var(--line); border-radius: 16px; background: #fff;
  padding: 16px; box-shadow: 0 8px 24px rgba(25, 45, 85, .05);
  display: flex; flex-direction: column; gap: 10px;
}
.route-card:hover { border-color: #b9ccf4; }
.route-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.route-route { margin: 0; font-size: 21px; letter-spacing: -.03em; }
.route-route small { color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: 0; margin-left: 4px; }
.route-badge { border-radius: 999px; background: var(--soft); color: var(--brand); font-size: 11px; font-weight: 800; padding: 4px 9px; white-space: nowrap; }
.route-badge.muted { background: #f1f4f9; color: var(--muted); }
.route-flights { display: flex; flex-wrap: wrap; gap: 6px; }
.flight-pill { border: 1px solid #e4eaf5; border-radius: 8px; background: #f8faff; color: #35415a; font-size: 11px; font-weight: 700; padding: 4px 7px; white-space: nowrap; }
.route-price-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: auto; }
.route-price { color: var(--brand); font-size: 26px; font-weight: 900; letter-spacing: -.04em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.route-price small { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0; margin-left: 3px; }
.route-price-date { color: var(--muted); font-size: 11px; margin-top: 3px; }
.route-low-dates { display: flex; flex-wrap: wrap; gap: 5px; }
.low-date { border: 1px solid #d9e6ff; border-radius: 999px; background: #fff; color: #2c4c86; font-size: 10px; font-weight: 700; padding: 3px 7px; cursor: pointer; }
.low-date:hover { border-color: var(--brand); color: var(--brand); }
.route-link { color: var(--brand); font-size: 11px; font-weight: 800; text-decoration: none; white-space: nowrap; }
.route-link:hover { text-decoration: underline; }
.route-empty { color: var(--muted); font-size: 11px; }
.route-price-row .route-link { margin-bottom: 3px; }

@media (max-width: 760px) {
  .shell { width: min(100% - 22px, 1120px); padding-top: 26px; }
  .route-grid { grid-template-columns: 1fr 1fr; }
  .field:first-child, .field:nth-child(3) { grid-column: span 1; }
  .swap { grid-column: span 1; width: 100%; }
  .date-field { grid-column: span 2; }
  .search-panel { padding: 16px; }
  .result-head { align-items: flex-start; flex-direction: column; }
  .primary { width: 100%; }
  .hint { width: 100%; }
  th, td { padding: 10px 11px; }
  .recommendations { padding: 14px; }
  .recommendation-head { flex-direction: column; gap: 8px; }
  .recommendation-grid { grid-template-columns: 1fr; }
  .nationwide-grid { grid-template-columns: 1fr; }
  .nationwide-grid .primary { width: 100%; }
  .podium { padding: 14px; }
  .podium-head { flex-direction: column; gap: 8px; }
  .podium-grid { grid-template-columns: 1fr; }
  .airline-route-grid { grid-template-columns: 1fr; }
  .airline-route-grid .primary { width: 100%; }
  .route-list { grid-template-columns: 1fr; }
}
