:root {
  color-scheme: light dark;
  --bg: #fafafa;
  --fg: #1a1a1a;
  --card: #fff;
  --border: rgba(0, 0, 0, .12);
  --muted: rgba(0, 0, 0, .55);
  --need-park-bg: #1b5e20;
  --need-park-fg: #fff;
  --need-loc-bg: #4a148c;
  --need-loc-fg: #fff;
  --warn: #b3261e;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101214;
    --fg: #eee;
    --card: #1a1d20;
    --border: rgba(255, 255, 255, .14);
    --muted: rgba(255, 255, 255, .6);
    --need-park-bg: #a5d6a7;
    --need-park-fg: #05320a;
    --need-loc-bg: #d8b6f5;
    --need-loc-fg: #2b0a45;
    --warn: #f2b8b5;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  padding: 0 12px 24px;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
}
img { max-width: 100%; }
[hidden] { display: none !important; }

.topbar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 -12px;
  padding: 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.title { font-weight: 700; font-size: 17px; }
.nav { font-size: 13px; }
.nav a, .nav button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 6px 4px;
  text-decoration: underline;
  cursor: pointer;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 10px 0;
  padding: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
}
.filters label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: var(--muted);
}
.filters label.check {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  color: var(--fg);
}
.filters select {
  font: inherit;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
}
.filters input[type=checkbox] { width: 18px; height: 18px; }

.status {
  color: var(--muted);
  font-size: 13px;
  margin: 10px 0;
}
.status.bad { color: var(--warn); }

.spots {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.spot {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}
.spot-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.spot-call {
  font-weight: 700;
  font-size: 17px;
}
.spot-freq {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.spot-park {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}
.spot-comment {
  font-size: 13px;
  font-style: italic;
  color: var(--muted);
  margin-top: 4px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}
.chip {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid currentColor;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 18px;
  white-space: nowrap;
  opacity: .85;
}
.chip.need {
  font-weight: 700;
  letter-spacing: .02em;
  border-color: transparent;
  background: var(--need-park-bg);
  color: var(--need-park-fg);
  opacity: 1;
}
.chip.need-loc { background: var(--need-loc-bg); color: var(--need-loc-fg); }
.chip.band { font-weight: 700; border-width: 2px; }
.chip.region { opacity: .8; }
.chip.band.warn { border-style: dashed; font-weight: 700; color: var(--warn); }
.chip.life { opacity: .7; }
.chip.life.fading { text-decoration: underline dotted; opacity: 1; font-weight: 600; }
.chip.src { opacity: .7; text-transform: lowercase; }
.chip.src.self { font-weight: 700; opacity: .95; }
.chip.src.auto { font-style: italic; }
.chip.rbn { opacity: .75; }
.chip.link {
  font: inherit;
  font-weight: 700;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
  background: none;
  color: inherit;
  appearance: none;
  -webkit-appearance: none;
}
.chip.link:hover { background: rgba(127, 127, 127, .22); }

.respot-form {
  margin-top: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.respot-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.respot-row input {
  font: inherit;
  font-size: 13px;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--fg);
  min-width: 0;
  flex: 1 1 100px;
}
.respot-row button {
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 7px 12px;
  border: none;
  border-radius: 6px;
  background: var(--need-park-bg);
  color: var(--need-park-fg);
  cursor: pointer;
}
.respot-row button.secondary {
  background: none;
  border: 1px solid var(--border);
  color: var(--fg);
  font-weight: 400;
}
.respot-msg { font-size: 12px; color: var(--muted); }
.respot-msg.bad { color: var(--warn); }

.login-page { display: flex; min-height: 100vh; align-items: center; justify-content: center; }
.login-card {
  width: min(92vw, 380px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.login-card h1 { margin: 0 0 4px; font-size: 20px; }
.login-card .sub { color: var(--muted); font-size: 13px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.login-card input {
  font: inherit;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
}
.login-card button {
  font: inherit;
  font-weight: 700;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: var(--need-park-bg);
  color: var(--need-park-fg);
  cursor: pointer;
}
.login-card .error {
  background: var(--warn);
  color: #fff;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
}
