:root {
  --red: #b3202a;
  --red-dark: #8c1820;
  --green: #1f6b45;
  --gold: #e8b23a;
  --bg: #fbf7f2;
  --surface: #ffffff;
  --text: #1d1b19;
  --muted: #6b645d;
  --border: #e6ded4;
  --shadow: 0 6px 24px rgba(0, 0, 0, .12);
  --tabbar-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15120f;
    --surface: #221d19;
    --text: #f3ede6;
    --muted: #a99f94;
    --border: #3a322b;
    --shadow: 0 6px 24px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--red);
  color: #fff;
}
.topbar h1 { margin: 0; font-size: 1.2rem; }
.subtitle { margin: 0; font-size: .85rem; opacity: .85; }

main { flex: 1; position: relative; overflow: hidden; }
.tab { display: none; height: 100%; }
.tab.active { display: block; }
.page { overflow-y: auto; padding: 16px 16px calc(var(--tabbar-h) + 24px); }
.page h2 { margin: 4px 0 4px; }

#tab-live { position: relative; }
#map { position: absolute; inset: 0; z-index: 0; }

.notices { position: absolute; top: 10px; left: 10px; right: 58px; z-index: 500; display: grid; gap: 6px; }
.notice {
  background: var(--gold);
  color: #2a1f05;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: .85rem;
  box-shadow: var(--shadow);
}

.status-card {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: calc(var(--tabbar-h) + 10px);
  z-index: 500;
  background: var(--surface);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.status-main { font-size: 1.15rem; font-weight: 700; }
.muted { color: var(--muted); font-size: .9rem; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.btn, .pill {
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn { background: var(--green); color: #fff; padding: 10px 16px; font-size: .95rem; }
.btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--border); }
.btn.big { width: 100%; padding: 16px; font-size: 1.1rem; margin: 12px 0 8px; }
.btn.stop { background: var(--red); }
.pill { background: #fff; color: var(--red); padding: 8px 14px; font-size: .9rem; }
.pill.on { background: var(--gold); color: #2a1f05; }

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1000;
  display: flex;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.tabbar button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: .75rem;
  cursor: pointer;
}
.tabbar button span { font-size: 1.35rem; line-height: 1; }
.tabbar button.active { color: var(--red); font-weight: 700; }
body.tracker-mode .tabbar, body.tracker-mode #alertsBtn { display: none; }

.lineup { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.lineup li {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}
.lineup .num {
  flex: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--bg);
  font-weight: 700;
}
.lineup .santa { border-color: var(--red); background: color-mix(in srgb, var(--red) 8%, var(--surface)); }
.lineup .santa .num { background: var(--red); color: #fff; }
.lineup strong { display: block; }
.sponsor { display: inline-block; margin-top: 2px; font-size: .75rem; color: var(--green); font-weight: 600; }

.info-block { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-top: 12px; }
.info-block h3 { margin: 0 0 6px; font-size: 1rem; }
.info-block ul { margin: 0; padding-left: 18px; }

.bingo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; max-width: 420px; }
.bingo button {
  aspect-ratio: 1;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  padding: 6px;
  cursor: pointer;
}
.bingo button.hit { background: var(--green); border-color: var(--green); color: #fff; }
.bingo-msg { font-weight: 700; color: var(--red); min-height: 1.5em; }

.track-stats { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin-top: 16px; }
.track-stats dt { color: var(--muted); }
.track-stats dd { margin: 0; font-weight: 600; }

dialog {
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  border: 0;
  border-radius: 18px;
  padding: 20px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog h2 { margin-top: 0; }
dialog label { display: block; margin: 12px 0; font-weight: 600; font-size: .95rem; }
dialog input[type=email], dialog select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
dialog fieldset { border: 1px solid var(--border); border-radius: 10px; margin: 12px 0; padding: 4px 12px; }
dialog legend { font-size: .9rem; color: var(--muted); padding: 0 4px; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
label.check input { margin-top: 4px; width: 18px; height: 18px; flex: none; }
.consent { background: var(--bg); border-radius: 10px; padding: 10px; }
.fine { font-size: .75rem; color: var(--muted); }
.fine a { color: inherit; }
.error { color: var(--red); font-size: .85rem; min-height: 1em; margin: 0; }

.toast {
  position: fixed;
  left: 50%;
  top: calc(env(safe-area-inset-top) + 72px);
  transform: translateX(-50%) translateY(-20px);
  width: max-content;
  z-index: 2000;
  max-width: calc(100vw - 32px);
  background: #1d1b19;
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: .9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.santa-icon { font-size: 30px; line-height: 1; filter: drop-shadow(0 2px 3px rgba(0,0,0,.4)); }
.spot-icon { font-size: 26px; line-height: 1; }
.amenity-icon {
  font-size: 15px;
  line-height: 26px;
  text-align: center;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.amenity-icon.donation { box-shadow: 0 0 0 2.5px var(--red), 0 1px 4px rgba(0,0,0,.35); }
.amenity-icon.featured { box-shadow: 0 0 0 2.5px var(--gold), 0 1px 4px rgba(0,0,0,.35); }
.lead-icon { font-size: 24px; line-height: 1; filter: drop-shadow(0 2px 3px rgba(0,0,0,.4)); }
.popup-bring { margin: 4px 0; font-weight: 600; }
.leaflet-control-layers-expanded { font: 14px/1.6 system-ui, sans-serif; }

.grow { flex: 1; min-width: 0; }
.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--gold);
  color: #2a1f05;
  font-size: .7rem;
  font-weight: 700;
  vertical-align: middle;
}
.btn.small { padding: 6px 12px; font-size: .85rem; flex: none; }

.vote-intro {
  display: grid;
  gap: 2px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--gold) 22%, var(--surface));
}
.collects { margin-top: 2px; font-size: .78rem; font-weight: 700; color: var(--red); }
.vote {
  flex: none;
  width: 40px; height: 40px;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--red);
  font-size: 1.2rem;
  cursor: pointer;
}
.vote.voted { background: var(--gold); border-color: var(--gold); color: #2a1f05; }
.vote:disabled { opacity: .4; cursor: default; }

.biz-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.biz {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}
.biz.featured { border-color: var(--gold); border-width: 2px; }
.biz-icon { font-size: 1.6rem; flex: none; }
.biz-special { color: var(--green); font-weight: 700; font-size: .92rem; }

.info-block p { margin: 0 0 6px; }
.info-block h4 { margin: 10px 0 4px; font-size: .9rem; }
.info-block ul + ul { margin-top: 6px; }
.stop-list { margin: 0; padding-left: 20px; }
.stop-list li { margin: 2px 0; }

.nudge {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 10px);
  z-index: 1500;
  display: flex;
  gap: 12px;
  align-items: center;
  max-width: 520px;
  margin: 0 auto;
  padding: 12px 14px;
  border-radius: 16px;
  border: 2px solid var(--gold);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.nudge[hidden] { display: none; }
.nudge img { border-radius: 10px; flex: none; }
.nudge strong { display: block; line-height: 1.25; }
.nudge-actions { display: grid; gap: 6px; flex: none; }

/* iPhone "Add to Home Screen" sheet, anchored near Safari's bottom toolbar. */
dialog.sheet { margin: auto auto calc(env(safe-area-inset-bottom) + 12px); overflow: visible; }
.ios-steps { list-style: none; counter-reset: step; padding: 0; margin: 14px 0 4px; display: grid; gap: 12px; }
.ios-steps li { counter-increment: step; display: flex; gap: 12px; align-items: center; }
.ios-steps li::before {
  content: counter(step);
  flex: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--red);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
}
.step-icon {
  flex: none;
  width: 40px; height: 40px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--bg);
  color: #0a7aff;
  box-shadow: inset 0 0 0 1px var(--border);
}
.step-icon.app { background: none; box-shadow: none; }
.step-icon.app img { border-radius: 8px; }
.ios-menu-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--border);
  font-weight: 600;
}
.ios-arrow {
  position: absolute;
  left: 50%;
  bottom: -30px;
  transform: translateX(-50%);
  font-size: 22px;
  color: #fff;
  animation: nudge-down 1.2s ease-in-out infinite;
}
@keyframes nudge-down { 50% { transform: translate(-50%, 6px); } }
@media (prefers-reduced-motion: reduce) { .ios-arrow { animation: none; } }

label.field { display: block; margin: 12px 0 0; font-weight: 600; }
label.field select, label.field input {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
