:root { color-scheme: light dark; --page: #f4f5f8; --text: #202734; --muted: #687180; --card: #fff; --card-end: #f0f3f9; --blue: #0066cc; --gap: 16px; --padding: 18px; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif; line-height: 1.5; }
/* 320px 카드 10개와 9개 간격. 더 넓은 화면에서도 10열을 넘지 않는다. */
main { max-width: 3380px; margin: auto; padding: 32px 18px 48px; }
.page-header { display: flex; align-items: baseline; flex-wrap: wrap; gap: 12px; margin-bottom: 28px; }
h1 { margin: 0; font-size: 26px; letter-spacing: -.04em; }
h2 { margin: 0 0 14px; font-size: 19px; letter-spacing: -.025em; }
h3, h4, p { margin: 0; }
a { color: var(--blue); }
/* 카드·그룹의 display 지정이 hidden 속성을 덮지 않게 한다. */
[hidden] { display: none !important; }
.data-link { margin-left: auto; font-size: 12px; text-underline-offset: 3px; }
.hidden-toggle { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); cursor: pointer; }
.hidden-toggle:not([hidden]) + .data-link { margin-left: 0; }
.hidden-toggle input { margin: 0; accent-color: var(--blue); }
/* 동작을 실행하므로 button이지만 옆의 JSON 보기 링크와 같은 모양으로 둔다. */
.refresh-link { padding: 0; border: 0; background: none; color: var(--blue); font: inherit; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.refresh-link:disabled { color: var(--muted); text-decoration: none; cursor: progress; }
.flight-group + .flight-group { margin-top: 32px; }
.flight-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: var(--gap); list-style: none; padding: 0; margin: 0; }
.flight-card { min-width: 0; display: flex; flex-direction: column; border-radius: 18px; background: linear-gradient(145deg, var(--card), var(--card-end)); box-shadow: 0 5px 18px #182d4e0d; overflow: hidden; }
.flight-card--lowest { background: linear-gradient(145deg, #2e7af5, #144ac2); color: white; box-shadow: 0 5px 18px #1765d529; --muted: #ffffffe0; }
.card-header, .card-body, .card-footer { padding: var(--padding); }
.route { font-size: 18px; font-weight: 650; letter-spacing: -.03em; }
.dates { margin-top: 6px; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.price-row { display: flex; align-items: baseline; gap: 8px; margin-top: 20px; }
.price { min-width: 0; font-variant-numeric: tabular-nums; }
.price strong { font-size: 26px; letter-spacing: -.04em; }
.amount, .change { white-space: nowrap; }
.change { font-size: 16px; }
.cabin { font-size: 11px; color: var(--muted); white-space: nowrap; margin-left: auto; }
.muted, .updated, .duration { color: var(--muted); font-size: 11px; }
h4 { font-size: 14px; font-weight: 650; }
.card-body { flex: 1; }
.legs { display: grid; gap: 10px; margin-top: 12px; }
.leg { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-variant-numeric: tabular-nums; }
.leg-route { font-size: 11px; white-space: nowrap; }
.duration { white-space: nowrap; font-size: 10px; }
.itinerary + .history { margin-top: 28px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.history-scroll { height: 140px; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-width: none; border-radius: 8px; }
.history-scroll::-webkit-scrollbar { display: none; }
.history-scroll ol { list-style: none; padding: 0; margin: 0; }
.history-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; }
.history-row time { color: var(--muted); font-size: 11px; }
.history-price { font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.history-price--lowest { color: var(--blue); }
/* 파란 카드에서도 이력의 파란 최저가를 읽을 수 있도록 밝은 바탕을 둔다. */
.flight-card--lowest .history-price--lowest { background: #fff; border-radius: 5px; padding: 1px 4px; }
.history-empty { min-height: 36px; }
.card-footer { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.updated { font-variant-numeric: tabular-nums; }
.source-link { flex: 0 0 40px; width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid #68718055; background: #6871800a; border-radius: 50%; color: inherit; text-decoration: none; }
.source-link svg { width: 18px; height: 18px; }
.flight-card--lowest .source-link { border-color: #ffffff66; background: #ffffff14; }
.source-link:hover { background: #68718020; }
.flight-card--lowest .source-link:hover { background: #ffffff30; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.flight-card--lowest :focus-visible { outline-color: white; }
.unavailable { color: var(--muted); font-size: 13px; }
@media (prefers-color-scheme: dark) {
  :root { --page: #17191f; --text: #f0f2f6; --muted: #aab2c0; --card: #333844; --card-end: #242933; --blue: #70b7ff; }
  .flight-card--lowest .history-price--lowest { color: #0066cc; }
}
@media (max-width: 400px) {
  main { padding: 22px 12px 32px; }
  :root { --padding: 16px; }
  h1 { font-size: 22px; }
  .dates { font-size: 11px; }
  .price strong { font-size: 24px; }
}

.chart-range { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11px; color: var(--muted); }
.chart-minimum { color: var(--blue); }
.flight-card--lowest .chart-minimum { color: white; font-weight: 600; }
.price-chart { position: relative; height: 170px; margin-top: 4px; touch-action: pan-y; user-select: none; cursor: crosshair; --chart-color: var(--text); }
.price-chart svg { display: block; width: 100%; height: 170px; overflow: visible; }
.chart-line { fill: none; stroke: var(--chart-color); stroke-width: 2; stroke-linejoin: round; }
.chart-grid { stroke: currentColor; opacity: .15; }
.chart-label { fill: var(--muted); font-size: 10px; }
.chart-guide { stroke: currentColor; opacity: .5; stroke-dasharray: 3 3; }
.chart-minimum-dot { fill: var(--blue); stroke: var(--card); stroke-width: 2; }
.chart-dot { fill: var(--chart-color); stroke: var(--card); stroke-width: 1.5; }
.chart-tooltip { position: absolute; display: flex; gap: 8px; align-items: baseline; max-width: 100%; padding: 6px 8px; border: 1px solid #80808055; border-radius: 8px; background: var(--card); color: var(--text); box-shadow: 0 2px 8px #0002; white-space: nowrap; font-size: 11px; pointer-events: none; }
.chart-tooltip span { opacity: .7; }
[hidden] { display: none !important; }

.chart-dot.chart-minimum-dot { fill: var(--blue); }

.chart-maximum-dot { fill: #ff453a; stroke: var(--card); stroke-width: 2; }
.chart-dot.chart-maximum-dot { fill: #ff453a; }
