:root {
  --free: #0f7a45;
  --limited: #a15c00;
  --full: #b43333;
  --unknown: #5e6973;
  --closed: #3d4654;
  --ink: #17211c;
  --muted: #5c675f;
  --paper: #f3f0e8;
  --panel: #fffdf8;
  --line: #e3dccf;
  --header: #14352c;
  --header-ink: #f4f7f4;
  --warn-bg: #fff4d6;
  --warn-ink: #5c4510;
  --focus: #0b6b4f;
  --shadow: 0 8px 24px rgb(20 40 30 / 12%);
  color-scheme: light;
  font-family: "PingFang HK", "PingFang TC", "Noto Sans CJK TC", "Noto Sans TC", "Microsoft JhengHei", "Heiti TC", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e7f0ea;
    --muted: #b7c4bb;
    --paper: #101613;
    --panel: #18211c;
    --line: #314038;
    --header: #0c241d;
    --warn-bg: #3a2e12;
    --warn-ink: #f6e2b6;
    --free: #3dbe78;
    --limited: #f0b429;
    --full: #ff8b84;
    --unknown: #b7c0c8;
    --closed: #d5dbe3;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: 0.5rem;
  top: 0.5rem;
  transform: translateY(-150%);
  background: #fff;
  color: #14352c;
  padding: 0.4rem 0.7rem;
  z-index: 5;
}

.skip:focus { transform: none; }

.top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  align-items: center;
  padding: 0.65rem 1rem;
  background: var(--header);
  color: var(--header-ink);
}

.brand { min-width: 0; }

.eyebrow {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  opacity: 0.85;
}

h1 {
  margin: 0.1rem 0 0;
  font-size: 1.25rem;
  font-weight: 750;
  line-height: 1.25;
}

.actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }

button, select, input { font: inherit; }

.actions button, .filters button, .park {
  cursor: pointer;
}

.actions button {
  min-height: 44px;
  border-radius: 999px;
  border: 0;
  padding: 0.35rem 0.9rem;
  background: #f4f1ea;
  color: #14352c;
  font-weight: 700;
}

.actions button[disabled] { opacity: 0.7; cursor: progress; }

.disclaimer {
  margin: 0;
  padding: 0.45rem 1rem;
  background: var(--warn-bg);
  color: var(--warn-ink);
  font-size: 0.86rem;
  line-height: 1.45;
}

.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(300px, 400px) minmax(0, 1fr);
}

.map-wrap { position: relative; min-height: 280px; }

#map { position: absolute; inset: 0; }

.legend, .map-credit {
  position: absolute;
  z-index: 2;
  background: rgb(255 253 248 / 0.94);
  color: #17211c;
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.legend {
  top: 0.6rem;
  left: 0.6rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
  margin: 0;
  padding: 0.45rem 0.6rem;
  list-style: none;
  max-width: min(100% - 4.5rem, 28rem);
  font-size: 0.78rem;
}

.legend li { display: flex; align-items: center; gap: 0.3rem; }
.legend .dot { margin-top: 0; }

.map-credit {
  left: 0.6rem;
  bottom: 0.6rem;
  max-width: min(18rem, calc(100% - 1.2rem));
  padding: 0.35rem 0.5rem 0.4rem;
  line-height: 1.3;
}

.map-credit img {
  display: block;
  width: 8.5rem;
  height: auto;
  margin-bottom: 0.2rem;
}

.map-credit p { margin: 0; font-size: 0.68rem; }

.panel {
  min-height: 0;
  overflow: auto;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 0.75rem 0.9rem 1.2rem;
}

.tools, .check, .summary, .error, .price-note, .help, .sources, .empty {
  margin: 0 0 0.7rem;
}

.search, select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  padding: 0.4rem 0.7rem;
}

.search { font-size: 1rem; margin-bottom: 0.45rem; }

.check {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  font-size: 0.92rem;
}

.check input { width: 1.1rem; height: 1.1rem; margin-top: 0.15rem; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.7rem;
}

.filters button {
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 0.25rem 0.7rem;
  white-space: nowrap;
}

.filters button[aria-checked="true"] {
  background: var(--header);
  color: var(--header-ink);
  border-color: var(--header);
}

.summary { font-size: 0.86rem; color: var(--muted); line-height: 1.4; }

.error, .notice {
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  font-size: 0.9rem;
}

.error {
  background: #fde8e6;
  color: #7a1f1f;
}

.notice {
  background: var(--warn-bg);
  color: var(--warn-ink);
}

.price-note, .help { font-size: 0.82rem; color: var(--muted); line-height: 1.45; }

.help summary { cursor: pointer; color: var(--ink); font-weight: 700; }

.list { display: flex; flex-direction: column; }

.park {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.65rem;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  padding: 0.75rem 0.15rem;
  min-height: 44px;
}

.park.is-selected { background: color-mix(in srgb, var(--free) 14%, transparent); }

.park-body { display: flex; flex-direction: column; gap: 0.12rem; min-width: 0; }

.park-body strong { font-size: 0.98rem; }

.park-body small {
  color: var(--muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dot {
  width: 0.75rem;
  height: 0.75rem;
  margin-top: 0.28rem;
  border-radius: 50%;
  background: var(--unknown);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.65);
  flex: none;
}

.dot.free { background: var(--free); }
.dot.limited { background: var(--limited); }
.dot.full { background: var(--full); }
.dot.closed { background: var(--closed); }
.dot.unknown { background: var(--unknown); }

.sources { font-size: 0.8rem; color: var(--muted); }

.sources a, .popup a { color: #0d6a45; }

.empty { color: var(--muted); }

.maplibregl-popup-content {
  border-radius: 12px;
  padding: 0.75rem 0.85rem 0.65rem;
  color: #17211c;
  background: #fffdf8;
  box-shadow: var(--shadow);
}

.maplibregl-popup-close-button {
  width: 1.8rem;
  height: 1.8rem;
  font-size: 1.2rem;
}

.popup h2, .popup h3, .popup p { margin: 0 0 0.35rem; }

.popup h2 { font-size: 1.05rem; line-height: 1.3; }

.popup h3 { margin-top: 0.55rem; font-size: 0.82rem; }

.popup .alt, .popup .addr, .popup .facts, .popup .when { color: #5c675f; font-size: 0.84rem; }

.status-line { display: flex; align-items: center; gap: 0.35rem; font-weight: 700; }

.status-line .dot { margin-top: 0; }

.popup ul.plain { margin: 0; padding-left: 1.1rem; }

.popup li { margin: 0.15rem 0; }

.popup .noprice { list-style: none; margin-left: -1.1rem; }

.actions-row { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 0.55rem; }

.stale { color: #8a4b08; font-weight: 750; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: minmax(260px, 46dvh) minmax(0, 1fr); }
  .map-wrap { grid-row: 1; }
  .panel { grid-row: 2; border-right: 0; border-top: 1px solid var(--line); }
  h1 { font-size: 1.05rem; }
  .map-credit img { width: 6.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
