:root {
  --bg: #f6f7f9; --surface: #ffffff; --ink: #14181f; --muted: #5d6675; --line: #e3e6eb;
  --accent: #0A7FA3; --accent-ink: #ffffff; --accent-soft: #E3F6FC; --brand: #14B8E6; --brand-ink: #0B3C52;
  --price: #c2410c; --ok: #15803d; --warn: #b45309; --danger: #b91c1c;
  --radius: 12px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1216; --surface: #171b21; --ink: #e8ebf0; --muted: #9aa3b2; --line: #2a3039;
    --accent: #38C6EE; --accent-ink: #062431; --accent-soft: #0F2E3A; --price: #fb923c; --brand-ink: #E6F7FD;
    --ok: #4ade80; --warn: #fbbf24; --danger: #f87171; --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}
a { color: var(--accent); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
header.top { background: var(--surface); border-bottom: 1px solid var(--line); }
header.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 18px; text-decoration: none; color: var(--ink); display: flex; gap: 8px; align-items: center; }
.brand img { display: block; flex: none; }
.brand .bw { font-family: 'Bricolage Grotesque', 'Noto Sans TC', sans-serif; font-weight: 700; font-size: 21px; letter-spacing: -0.3px; color: var(--brand-ink); }
.brand .bw b { color: var(--accent); font-weight: 700; }
.brand .bz { font-size: 12px; font-weight: 500; letter-spacing: 3px; color: var(--muted); padding-left: 10px; border-left: 1px solid var(--line); }
@media (max-width: 420px) { .brand .bz { display: none; } }
.meta { color: var(--muted); font-size: 13px; }
h1 { font-size: 22px; margin: 24px 0 4px; }
h2 { font-size: 17px; margin: 28px 0 10px; }
.sub { color: var(--muted); margin: 0 0 16px; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 16px 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px;
  padding: 5px 12px; font-size: 13px; cursor: pointer; font-family: inherit;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
input[type=text], input[type=search], input[type=number], input[type=password], input[type=url], select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 10px; min-width: 0;
}
textarea { width: 100%; resize: vertical; }
.btn {
  font: inherit; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  padding: 7px 14px; border-radius: 8px; cursor: pointer; font-weight: 600;
}
.btn.ghost { background: transparent; color: var(--accent); }
.btn.danger { border-color: var(--danger); background: transparent; color: var(--danger); }
.btn:disabled { opacity: .5; cursor: default; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-bottom: 40px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.card .route { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card .dest { font-size: 20px; font-weight: 700; }
.card .country { color: var(--muted); font-size: 13px; margin-left: 4px; font-weight: 400; }
.card .price { color: var(--price); font-size: 22px; font-weight: 800; white-space: nowrap; }
.card .price small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.card .row { font-size: 13px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; }
.card .row b { color: var(--ink); font-weight: 600; }
.tag { display: inline-block; border-radius: 6px; padding: 1px 7px; font-size: 12px; background: var(--accent-soft); color: var(--accent); }
.tag.warn { background: transparent; border: 1px solid var(--warn); color: var(--warn); }
.sugg { border-top: 1px dashed var(--line); padding-top: 8px; font-size: 13px; }
.sugg ul { margin: 4px 0 0; padding-left: 18px; }
.sugg li { margin: 2px 0; }
.sugg .d { font-weight: 600; font-variant-numeric: tabular-nums; }
.card footer { margin-top: auto; display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); gap: 8px; }
.empty { text-align: center; color: var(--muted); padding: 60px 16px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.country-block { border-top: 1px solid var(--line); padding: 12px 0; }
.country-block:first-child { border-top: 0; }
.country-head { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 6px; }
.cities { display: flex; flex-wrap: wrap; gap: 6px 14px; }
label.ck { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; font-size: 14px; }
label.ck .n { font-size: 11px; color: var(--price); font-weight: 700; }
.sticky-save { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; display: flex; gap: 12px; align-items: center; border-top: 1px solid var(--line); flex-wrap: wrap; }
.msg { font-size: 14px; }
.msg.ok { color: var(--ok); } .msg.bad { color: var(--danger); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.table-scroll { overflow-x: auto; }
.form-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.form-row > * { flex: 1 1 160px; }
.form-row > .btn { flex: 0 0 auto; }
pre.log { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: 12px; overflow: auto; max-height: 260px; white-space: pre-wrap; }
.pill { font-size: 12px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.pill.on { color: var(--ok); border-color: var(--ok); } .pill.off { color: var(--danger); border-color: var(--danger); }
@media (max-width: 520px) {
  .grid { grid-template-columns: 1fr; }
  h1 { font-size: 20px; }
}

.sugg .q { color: var(--price); font-variant-numeric: tabular-nums; }
.fine { font-size: 11px; color: var(--muted); margin-top: 4px; }
.cheap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-bottom: 40px; }
.cheap { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.cheap:hover { border-color: var(--accent); }
.cheap .c { font-weight: 700; } .cheap .c small { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 4px; }
.cheap .p { color: var(--price); font-weight: 800; font-variant-numeric: tabular-nums; }
.cheap .w { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
