@font-face { font-family: "B612 Mono"; src: url(/fonts/b612-mono-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "B612 Mono"; src: url(/fonts/b612-mono-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }

/* 概念：老機場翻牌看板＋航空行李標籤。深色＝夜間候機室，淺色＝舊紙票根。 */
:root {
  color-scheme: dark light;
  --bg: #0f0e0c; --panel: #1a1815; --panel2: #24211c; --line: #3a352c;
  --ink: #f1e8d6; --mute: #a59b87; --amber: #f5b21a; --amber-ink: #17130a;
  --red: #e4572e; --green: #8fbf6a; --flap: #1d1b17; --flap-ink: #f5b21a;
  --mono: "B612 Mono", ui-monospace, Menlo, monospace;
  --sans: -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #efe6d2; --panel: #f9f3e4; --panel2: #e8dcc3; --line: #cdbf9f;
    --ink: #221d13; --mute: #6c6250; --amber: #c98a00; --amber-ink: #fff8e6;
    --red: #b83c17; --green: #4d7d2c; --flap: #1d1b17; --flap-ink: #f5b21a;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); }
main { max-width: 560px; margin: 0 auto; padding: 0 16px calc(84px + env(safe-area-inset-bottom)); }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* 翻牌看板 */
.board { margin: 0 -16px; padding: calc(18px + env(safe-area-inset-top)) 16px 18px; background: #0a0908; color: #f1e8d6; border-bottom: 3px solid var(--amber); }
.board-route { display: flex; align-items: center; gap: 3px; }
.flap { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 1.28em; height: 1.72em; background: var(--flap); color: var(--flap-ink); font: 700 clamp(24px, 8vw, 32px)/1 var(--mono); border-radius: 3px; box-shadow: inset 0 0 0 1px #000, inset 0 1px 0 #38332a; overflow: hidden; }
.flap::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px; background: #000; opacity: .85; }
.arrow { width: 26px; height: 2px; margin: 0 8px; background: #8d8473; position: relative; }
.arrow::after { content: ""; position: absolute; right: 0; top: -4px; width: 8px; height: 8px; border-top: 2px solid #8d8473; border-right: 2px solid #8d8473; transform: rotate(45deg); }
.board-price { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 2px; margin-top: 12px; }
.board-price .flap { width: 1.1em; height: 1.5em; font-size: clamp(18px, 6vw, 24px); color: #f1e8d6; }
.board-price em { margin-left: 8px; font-style: normal; color: #a59b87; font-size: 13px; }
.board-sub { margin-top: 8px; font-size: 13px; color: #c5baa5; }
.scanning { animation: blink 1.1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .35; } }

/* 表單 */
.form { display: grid; gap: 14px; padding: 18px 0; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 6px; font-size: 12px; letter-spacing: .08em; color: var(--mute); }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.grow { flex: 1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 40px; padding: 0 13px; background: transparent; border: 1px solid var(--line); border-radius: 3px; white-space: nowrap; }
.chip b { font: 700 12px var(--mono); color: var(--mute); }
.chip.on { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); font-weight: 600; }
.chip.on b { color: inherit; }
.seg { display: inline-flex; }
.seg .chip { border-radius: 0; margin-left: -1px; }
.seg .chip:first-child { border-radius: 3px 0 0 3px; margin-left: 0; }
.seg .chip:last-child { border-radius: 0 3px 3px 0; }
.seg.small .chip { min-height: 32px; padding: 0 10px; font-size: 13px; }
.text, input[type=date], .balances input, .gate input { width: 100%; min-height: 42px; padding: 8px 10px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 3px; font: 15px var(--sans); }
.text { margin-top: 8px; }
.dates label { flex: 1 1 130px; min-width: 0; font-size: 12px; color: var(--mute); }
.dates input { margin-top: 4px; font-family: var(--mono); font-size: 14px; }
.primary { width: 100%; min-height: 50px; background: var(--amber); color: var(--amber-ink); border: 0; border-radius: 3px; font-weight: 700; font-size: 16px; letter-spacing: .2em; }
.primary:disabled { opacity: .55; }

.form.collapsed { padding: 12px 0; }
.summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13.5px; }
.summary .link { flex: none; min-height: 40px; }

/* 結果 */
.toolbar, .listhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.toolbar { margin: 4px 0 14px; }
.link { background: none; border: 0; padding: 8px 0; color: var(--amber); text-decoration: underline; text-underline-offset: 3px; }
.link.danger { color: var(--red); }
.notice { margin: 0 0 12px; padding: 10px 12px; font-size: 13px; color: var(--mute); border-left: 3px solid var(--line); background: var(--panel); }
.notice.amber { border-left-color: var(--amber); color: var(--ink); margin-top: 16px; }
.notice.err, .err { color: var(--red); border-left-color: var(--red); }

.month { margin-bottom: 14px; }
.month h3 { margin-bottom: 6px; font-size: 14px; }
.dow, .grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.dow i { font-style: normal; text-align: center; font-size: 11px; color: var(--mute); }
.grid { margin-top: 3px; }
.blank { aspect-ratio: 1 / 1.05; }
.day { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; aspect-ratio: 1 / 1.05; padding: 0; font: 400 11px/1.2 var(--mono); font-style: normal; border: 1px solid transparent; border-radius: 3px; background: none; }
i.day { color: var(--mute); opacity: .5; }
i.day.none { background: var(--panel); opacity: .75; }
i.day.out { opacity: .22; }
button.day b { font-size: 12px; font-weight: 700; letter-spacing: -.03em; }
button.day span { opacity: .75; font-size: 10px; }
.h1 { background: var(--amber); color: var(--amber-ink); }
.h2 { background: color-mix(in srgb, var(--amber) 38%, var(--panel)); color: var(--ink); }
.h3 { background: var(--panel2); color: var(--ink); }
.day.sel { outline: 2px solid var(--red); outline-offset: 1px; }
.legend { display: flex; gap: 14px; margin-bottom: 20px; font-size: 12px; color: var(--mute); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.k { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }
.listhead { margin-bottom: 10px; }
.listhead h2 { font-size: 20px; }
.listhead small { margin-left: 8px; font: 400 13px var(--mono); color: var(--mute); }

/* 登機證 */
.stub { margin-bottom: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.stub > header { display: flex; justify-content: space-between; padding: 9px 14px; background: var(--panel2); font-size: 13px; }
.fno { font: 700 13px var(--mono); overflow-wrap: anywhere; text-align: right; margin-left: 10px; }
.times { display: flex; align-items: center; gap: 12px; padding: 14px 14px 4px; }
.times b { display: block; font: 700 24px/1.1 var(--mono); letter-spacing: -.07em; }
.times sup { font-size: 11px; color: var(--amber); margin-left: 2px; }
.times small { font: 400 12px var(--mono); color: var(--mute); }
.line { flex: 1; height: 0; border-top: 2px dashed var(--line); }
.facts { padding: 2px 14px 12px; font-size: 12.5px; color: var(--mute); }
.perf { position: relative; height: 0; border-top: 2px dotted var(--line); }
.perf::before, .perf::after { content: ""; position: absolute; top: -9px; width: 16px; height: 16px; background: var(--bg); border-radius: 50%; }
.perf::before { left: -9px; } .perf::after { right: -9px; }
.offers { list-style: none; margin: 0; padding: 4px 14px; }
.offer { padding: 12px 0; border-top: 1px solid var(--line); }
.offer:first-child { border-top: 0; }
.offer.dim { opacity: .62; }
.offer-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.miles { font: 700 18px var(--mono); color: var(--amber); white-space: nowrap; letter-spacing: -.06em; }
.miles small { font: 400 11px var(--sans); color: var(--mute); letter-spacing: 0; }
.offer-sub { font-size: 12.5px; color: var(--mute); text-align: right; }
.offer-path { margin-top: 5px; font-size: 13.5px; }
.ok { color: var(--green); font-weight: 600; } .warn { color: var(--amber); } .bad { color: var(--red); } .mute { color: var(--mute); }
.offer-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 5px; font-size: 12px; color: var(--mute); }
.offer-links { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 6px; font-size: 13px; }
.offer-links a { padding: 4px 0; text-underline-offset: 3px; }
.more { width: 100%; min-height: 46px; margin-bottom: 14px; background: none; border: 1px solid var(--line); border-radius: 3px; }

.blind { margin-top: 18px; padding: 14px; border: 1px dashed var(--line); border-radius: 6px; font-size: 13.5px; }
.blind h3 { margin-bottom: 6px; font-size: 15px; }
.linkrow { display: flex; gap: 18px; margin: 8px 0; }
.linkrow a { padding: 4px 0; color: var(--amber); }
.attr { margin-top: 14px; font-size: 12px; color: var(--mute); text-align: center; }

.postcard { margin: 8px 0 18px; }
.postcard img { display: block; width: 100%; height: auto; border-radius: 4px; }
.postcard figcaption { display: flex; flex-direction: column; gap: 2px; padding-top: 10px; }
.postcard b { font-size: 16px; }
.postcard span { font-size: 13px; color: var(--mute); }

/* 其他頁 */
.pagehead { padding: calc(22px + env(safe-area-inset-top)) 0 16px; }
.pagehead h1 { font-size: 30px; line-height: 1.2; }
.pagehead p { color: var(--mute); font-size: 14px; }
.watch { margin-top: 14px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; font-size: 13.5px; }
.watch header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.watch header .link { padding: 0; white-space: nowrap; }
.fresh { margin-top: 8px; } .fresh b { font: 700 24px var(--mono); color: var(--amber); }
.freshlist { list-style: none; margin: 4px 0; padding: 0; font-size: 12.5px; }
.freshlist li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
#view-radar .notice { margin-top: 16px; }
.sec { margin: 24px 0 8px; font-size: 16px; }
.cards { list-style: none; margin: 0; padding: 0; }
.cards li { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 2px 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cards small { font-size: 12px; color: var(--mute); }
.switch { display: flex; align-items: center; gap: 10px; min-height: 30px; }
.switch input { width: 20px; height: 20px; accent-color: var(--amber); }
.small { font-size: 12.5px; margin-top: 8px; }
.balances { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.balances label { font-size: 12.5px; color: var(--mute); }
.balances input { margin-top: 3px; font-family: var(--mono); }
#logout { margin-top: 20px; }

/* 分頁列 */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; background: var(--panel); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.tabs button { flex: 1; max-width: 186px; min-height: 54px; background: none; border: 0; border-top: 3px solid transparent; margin-top: -1px; color: var(--mute); font-size: 14px; }
.tabs button.on { color: var(--ink); border-top-color: var(--amber); font-weight: 700; }

.gate { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100dvh; padding: 24px; gap: 12px; }
.gate img { border-radius: 16px; }
.gate h1 { font-size: 26px; }
.gate form { display: grid; gap: 8px; width: min(320px, 100%); }
.gate label { font-size: 13px; color: var(--mute); }

@media (prefers-reduced-motion: reduce) { .scanning { animation: none; } }

/* 定稿調整：對比、月曆層次、票根細節 */
@media (prefers-color-scheme: light) { :root { --amber: #8f5d00; } }
.board { border-bottom-color: var(--flap-ink); }
:root { --h2-bg: #7f5f17; --h2-line: #9c751c; --h3-bg: #2e2a23; --h3-line: #6e6555; --tab-bg: #12100d; }
@media (prefers-color-scheme: light) { :root { --h2-bg: #dfc58c; --h2-line: #9c7016; --h3-bg: #e2d5ba; --h3-line: #8a7b5c; --tab-bg: #e5d8be; } }
.h2 { background: var(--h2-bg); border: 1px solid var(--h2-line); }
.h3 { background: var(--h3-bg); border: 1px solid var(--h3-line); }
button.day.h2 span { opacity: 1; }
.blank, .day { aspect-ratio: 1.18 / 1; }
.month:not(:has(button.day)) .dow, .month:not(:has(button.day)) .grid { display: none; }
.month:not(:has(button.day)) h3 { margin-bottom: 0; color: var(--mute); font-weight: 400; }
.miles { font-size: 20px; }
.offer-path { margin-top: 6px; font-size: 14px; color: var(--ink); }
.offer-path b { font-weight: 700; }
.offer-path .warn, .offer-path .bad { font-size: 13px; }
.offer { padding: 10px 0; }
.stub { border-radius: 2px; overflow: visible; }
.stub > header { border-radius: 1px 1px 0 0; }
.perf::before, .perf::after { border: 1px solid var(--line); }
.perf::before { clip-path: inset(0 0 0 8px); }
.perf::after { clip-path: inset(0 8px 0 0); }
.blind, .watch { border-radius: 2px; }
.times > :last-child { text-align: right; }
.text, input[type=date], .balances input, .gate input, .dates input { font-size: 16px; }
.primary { letter-spacing: .06em; text-indent: .06em; }
.tabs { background: var(--tab-bg); border-top: 2px solid var(--line); }
.tabs button { margin-top: -2px; }
.watch header .link { padding: 8px 0 8px 12px; margin: -8px 0; }
