@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@500;600&display=swap');

:root {
  color-scheme: light;
  --ink: #102a43;
  --muted: #627d98;
  --line: #d9e2ec;
  --panel: #ffffff;
  --wash: #f3f7fa;
  --teal: #087f8c;
  --coffee: #ad5f2d;
  --market: #7057a3;
  --restroom: #1769aa;
  --lounge: #9a6b16;
  --shadow: 0 12px 32px rgba(16, 42, 67, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--wash); }

body {
  margin: 0;
  color: var(--ink);
  background: var(--wash);
  min-width: 320px;
}

button, select, input { font: inherit; }

.topbar {
  min-height: 64px;
  padding: 0 max(20px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: white;
  background: var(--ink);
  border-bottom: 3px solid #2cb1bc;
}

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

.brand-copy { display: grid; line-height: 1; }
.brand-name { font-weight: 780; letter-spacing: -.02em; }
.brand-tagline {
  margin-top: 3px;
  color: #71dfd3;
  font-family: "Caveat", "Segoe Print", "Bradley Hand", cursive;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: .8;
  letter-spacing: .01em;
  transform: rotate(-1deg);
  transform-origin: left center;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 9px;
}

.brand-mark svg { width: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.status { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: #d9e2ec; }
.status span { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #5eead4; }

main { width: min(1220px, 100%); margin: 0 auto; padding: 26px 24px 60px; }

.controls {
  display: grid;
  grid-template-columns: minmax(220px, 1.25fr) minmax(145px, .7fr) minmax(155px, .75fr) minmax(240px, 1fr);
  gap: 18px;
  align-items: end;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

label { display: block; margin-bottom: 7px; color: #486581; font-size: .78rem; font-weight: 760; text-transform: uppercase; letter-spacing: .08em; }

select, input {
  width: 100%;
  min-height: 48px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #bcccdc;
  border-radius: 10px;
  outline: none;
}

select:disabled, input:disabled { color: #829ab1; background: #f3f7fa; cursor: not-allowed; }

select { appearance: none; padding: 0 42px 0 14px; font-weight: 700; }
.select-wrap { position: relative; }
.select-wrap::after { content: "⌄"; position: absolute; right: 15px; top: 10px; pointer-events: none; color: #486581; font-size: 1.2rem; }

.airport-block p { margin: 7px 0 0; color: var(--muted); font-size: .82rem; }
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 14px; top: 13px; width: 21px; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.search-wrap input { padding: 0 14px 0 44px; }
select:focus, input:focus, button:focus-visible { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(8,127,140,.16); }

.filter-row { display: flex; gap: 10px; overflow-x: auto; padding: 18px 2px; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; padding: 10px 14px; color: #334e68; background: #fff; border: 1px solid var(--line); border-radius: 999px; font-size: .9rem; font-weight: 700; cursor: pointer; }
.chip:disabled { opacity: .48; cursor: not-allowed; }
.chip span { margin-right: 5px; color: currentColor; }
.chip.active { color: white; background: var(--ink); border-color: var(--ink); }
.chip.restaurant.active { background: var(--teal); border-color: var(--teal); }
.chip.coffee.active { background: var(--coffee); border-color: var(--coffee); }
.chip.market.active { background: var(--market); border-color: var(--market); }
.chip.restroom.active { background: var(--restroom); border-color: var(--restroom); }
.chip.lounge.active { background: var(--lounge); border-color: var(--lounge); }

.map-panel, .directory { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 22px 24px 18px; border-bottom: 1px solid #e6edf3; }
.eyebrow { margin: 0 0 5px; color: var(--teal); font-size: .76rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
h1, h2 { margin: 0; font-family: ui-serif, Georgia, serif; letter-spacing: -.025em; }
h1 { font-size: clamp(1.65rem, 3vw, 2.25rem); }
h2 { font-size: 1.55rem; }
.match-count { display: flex; align-items: baseline; gap: 7px; text-align: right; color: var(--muted); font-size: .82rem; }
.match-count strong { color: var(--ink); font-family: ui-serif, Georgia, serif; font-size: 1.7rem; }

.map-scroll { overflow-x: auto; padding: 18px 20px 6px; outline: none; }
.gate-map { display: flex; align-items: flex-end; gap: 18px; min-height: 280px; width: max-content; min-width: 100%; padding: 0 12px 34px; position: relative; }
.gate-map::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 46px; height: 4px; border-radius: 4px; background: #9fb3c8; }
.gate-group { position: relative; width: 168px; min-height: 232px; display: flex; flex-direction: column; justify-content: flex-end; z-index: 1; }
.gate-cards { display: grid; gap: 7px; margin-bottom: 25px; }
.mini-card { width: 100%; padding: 10px; text-align: left; color: var(--ink); background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--teal); border-radius: 9px; box-shadow: 0 5px 14px rgba(16,42,67,.07); cursor: pointer; }
.mini-card.coffee { border-left-color: var(--coffee); }
.mini-card.market { border-left-color: var(--market); }
.mini-card.restroom { border-left-color: var(--restroom); }
.mini-card.lounge { border-left-color: var(--lounge); }
.mini-card strong { display: block; font-size: .78rem; line-height: 1.25; }
.mini-card small { display: block; margin-top: 5px; color: var(--muted); font-size: .68rem; }
.gate-dot { position: absolute; bottom: 40px; left: calc(50% - 7px); width: 14px; height: 14px; background: var(--ink); border: 3px solid #fff; border-radius: 50%; box-shadow: 0 0 0 2px var(--ink); }
.gate-label { position: absolute; bottom: 0; left: 50%; width: auto; min-width: 52px; padding: 5px 9px; transform: translateX(-50%); text-align: center; color: #fff; background: var(--ink); border: 2px solid #fff; border-radius: 999px; box-shadow: 0 0 0 2px var(--ink), 0 4px 10px rgba(16,42,67,.18); font-size: 1rem; font-weight: 900; line-height: 1; letter-spacing: .01em; white-space: nowrap; }
.map-note { margin: 0; padding: 12px 24px 16px; color: var(--muted); font-size: .78rem; border-top: 1px solid #edf2f7; }

.gate-map.prompt { display: grid; place-items: center; width: 100%; min-height: 250px; padding: 24px; }
.gate-map.prompt::after { display: none; }
.airport-prompt { max-width: 440px; text-align: center; }
.airport-prompt strong { display: block; margin-bottom: 9px; font-family: ui-serif, Georgia, serif; font-size: 1.6rem; }
.airport-prompt span { display: block; color: var(--muted); font-size: 1rem; line-height: 1.55; }

.map-scroll.overview-scroll { overflow-x: visible; padding: 18px 20px; }
.gate-map.overview { display: block; width: 100%; min-height: 0; padding: 0; }
.gate-map.overview::after { display: none; }
.area-overview { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; width: 100%; }
.area-tile { position: relative; min-height: 158px; padding: 18px; overflow: hidden; text-align: left; color: var(--ink); background: linear-gradient(145deg, #fff 0%, #f5f9fc 100%); border: 1px solid var(--line); border-radius: 15px; cursor: pointer; }
.area-tile:hover { border-color: #829ab1; transform: translateY(-1px); }
.area-tile.no-matches { opacity: .54; }
.area-route { position: absolute; top: 0; right: 22px; width: 4px; height: 44px; background: #b8c7d5; }
.area-route::after { content: ""; position: absolute; left: -5px; bottom: -6px; width: 14px; height: 14px; background: var(--ink); border: 3px solid white; border-radius: 50%; box-shadow: 0 0 0 2px var(--ink); }
.area-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-right: 24px; font-weight: 800; }
.area-arrow { color: var(--teal); font-size: 1.1rem; }
.area-tile > strong { display: block; margin-top: 18px; font-family: ui-serif, Georgia, serif; font-size: 2rem; line-height: 1; }
.area-tile > small { display: block; margin-top: 4px; color: var(--muted); font-size: .72rem; }
.area-stats { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 13px; }
.area-stat { padding: 4px 6px; color: #486581; background: #e8f4f5; border-radius: 5px; font-size: .64rem; white-space: nowrap; }
.area-stat.coffee { background: #f7ece5; }
.area-stat.market { background: #f0ecf8; }
.area-stat.restroom { background: #e8f1fa; }
.area-stat.lounge { background: #f7f0df; }
.area-stat b { color: var(--ink); }

.directory { margin-top: 22px; }
.venue-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 18px; }
.venue-list.grouped { display: block; padding: 0; }
.area-directory + .area-directory { border-top: 1px solid var(--line); }
.area-directory-heading { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 17px 20px; text-align: left; color: var(--ink); background: #f8fafc; border: 0; cursor: pointer; }
.area-directory-heading span { font-family: ui-serif, Georgia, serif; font-size: 1.22rem; font-weight: 700; }
.area-directory-heading small { color: var(--muted); font-size: .74rem; font-weight: 700; }
.area-directory-heading b { margin-left: 5px; color: var(--teal); font-size: 1rem; }
.area-venue-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 14px 18px 20px; }
.venue-card { display: flex; align-items: center; gap: 12px; min-height: 82px; padding: 14px; text-align: left; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 13px; cursor: pointer; }
.highlighted { border-color: var(--teal) !important; box-shadow: 0 0 0 3px rgba(8,127,140,.18), 0 8px 20px rgba(16,42,67,.12); }
.venue-card:hover, .mini-card:hover { border-color: #829ab1; transform: translateY(-1px); }
.category-icon { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; color: white; background: var(--teal); border-radius: 10px; font-size: 1.05rem; }
.category-icon.coffee { background: var(--coffee); }
.category-icon.market { background: var(--market); }
.category-icon.restroom { background: var(--restroom); }
.category-icon.lounge { background: var(--lounge); }
.venue-copy { min-width: 0; }
.venue-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; }
.venue-copy span { display: block; margin-top: 4px; color: var(--muted); font-size: .78rem; }
.empty { grid-column: 1 / -1; padding: 48px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; margin-bottom: 6px; color: var(--ink); font-size: 1.05rem; }

dialog { width: min(520px, calc(100% - 32px)); padding: 0; color: var(--ink); background: #fff; border: 0; border-radius: 18px; box-shadow: 0 24px 80px rgba(16,42,67,.25); }
dialog::backdrop { background: rgba(16,42,67,.52); backdrop-filter: blur(2px); }
.close-dialog { position: absolute; right: 13px; top: 12px; width: 38px; height: 38px; color: var(--muted); background: #edf2f7; border: 0; border-radius: 50%; font-size: 1.5rem; cursor: pointer; }
.dialog-body { padding: 30px; }
.dialog-body h2 { padding-right: 35px; font-size: 1.8rem; }
.dialog-location { margin: 8px 0 20px; color: var(--muted); }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.tag { padding: 7px 10px; color: #334e68; background: #edf2f7; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.verify { padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; line-height: 1.55; }
.source-link { display: inline-block; margin-top: 12px; color: var(--teal); font-weight: 750; }

footer { padding: 0 24px max(28px, env(safe-area-inset-bottom)); text-align: center; color: var(--muted); font-size: .75rem; }

@media (max-width: 840px) {
  main { padding: 18px 14px 42px; }
  .controls { grid-template-columns: 1fr 1fr; }
  .search-block { grid-column: 1 / -1; }
  .venue-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .area-venue-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .topbar { min-height: 58px; }
  .status { display: none; }
  .controls { grid-template-columns: 1fr; gap: 12px; padding: 14px; border-radius: 15px; }
  .search-block { grid-column: auto; }
  .airport-block p { font-size: .75rem; }
  select, input { min-height: 46px; }
  .section-heading { align-items: center; padding: 18px; }
  .match-count { flex-direction: column; align-items: flex-end; gap: 0; }
  .match-count strong { font-size: 1.45rem; }
  .match-count span { max-width: 74px; line-height: 1.15; }
  .map-scroll { padding-left: 8px; padding-right: 8px; }
  .venue-list { grid-template-columns: 1fr; padding: 12px; }
  .venue-list.grouped { padding: 0; }
  .area-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .area-tile { min-height: 148px; padding: 14px; }
  .area-title { padding-right: 16px; font-size: .86rem; }
  .area-route { right: 15px; }
  .area-stats { gap: 4px; }
  .area-stat { font-size: .61rem; }
  .area-venue-grid { grid-template-columns: 1fr; padding: 10px 12px 16px; }
  .area-directory-heading { padding: 15px 14px; }
  .venue-card { min-height: 72px; }
  .directory-heading { padding-bottom: 14px; }
  .dialog-body { padding: 25px 22px; }
}

@media (prefers-reduced-motion: no-preference) {
  .venue-card, .mini-card { transition: transform .15s ease, border-color .15s ease; }
}
