:root {
  color-scheme: dark;
  --bg: #0b0d17; --glass: rgba(18, 20, 36, .82); --line: rgba(255, 255, 255, .11);
  --soft: rgba(255, 255, 255, .06); --text: #f3f1fa; --muted: #a9a6c0; --accent: #9d6bff;
  --accent-2: #ff5fa2; --gold: #ffc261; --bad: #ff8f97; --good: #7fe0a4; --gap: 12px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
#map { position: fixed; inset: 0; }
.glass { background: var(--glass); border: 1px solid var(--line); box-shadow: 0 10px 34px rgba(0, 0, 0, .45);
  backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.topbar { position: fixed; z-index: 3; top: calc(var(--gap) + env(safe-area-inset-top));
  left: calc(var(--gap) + env(safe-area-inset-left)); right: calc(var(--gap) + env(safe-area-inset-right));
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 9px 16px 9px 12px; border-radius: 18px; min-width: 0; }
.brand h1 { font-size: 15px; margin: 0; letter-spacing: .01em; }
.brand p { margin: 0; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand { position: relative; }
.brand-text { min-width: 0; }
.brand h1 { display: flex; align-items: center; gap: 6px; }
.state-button { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; margin: -3px 0; padding: 0 9px 0 10px;
  border-radius: 99px; border: 1px solid var(--line); background: var(--soft); font-weight: 700; letter-spacing: .02em; }
.state-button:hover, .state-button[aria-expanded="true"] { border-color: var(--accent); background: rgba(157, 107, 255, .18); }
.chevron { width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg); opacity: .8; }
.state-button[aria-expanded="true"] .chevron { transform: translateY(1px) rotate(225deg); }
.state-menu { position: absolute; top: calc(100% + 8px); left: 0; z-index: 5; min-width: 290px; padding: 6px; border-radius: 16px;
  outline: none; animation: rise .15s ease-out; background: rgba(18, 20, 36, .97); }
.state-menu [role="option"] { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 14px;
  min-height: 46px; padding: 6px 12px; border: 0; border-radius: 11px; background: none; text-align: left; }
.state-menu [role="option"]:hover, .state-menu [role="option"]:focus-visible { background: var(--soft); outline: none; }
.state-menu [role="option"][aria-selected="true"] { background: rgba(157, 107, 255, .22); }
.state-menu .name { display: flex; flex-direction: column; }
.state-menu .name b { font-size: 14.5px; }
.state-menu .name small { color: var(--muted); font-size: 12px; }
.state-menu .count { flex: none; min-width: 30px; padding: 1px 8px; border-radius: 99px; background: var(--soft); color: var(--gold);
  font-size: 12.5px; font-weight: 700; text-align: center; }
.state-menu .note { margin: 6px 12px 4px; color: var(--muted); font-size: 11.5px; }

.locate { position: fixed; z-index: 2; right: calc(var(--gap) + env(safe-area-inset-right));
  top: calc(var(--gap) + 56px + env(safe-area-inset-top)); width: 44px; height: 44px; padding: 0; border-radius: 50%;
  display: grid; place-items: center; color: var(--text); }
.locate:hover { border-color: var(--accent); }
.locate.busy svg { animation: spin 1s linear infinite; }
.locate.on { color: #6fb8ff; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (min-width: 760px) { body.panel-open .locate { right: calc(410px + env(safe-area-inset-right)); } }
@media (max-width: 759px) { body.panel-open .locate { visibility: hidden; } }
.me { width: 18px; height: 18px; border-radius: 50%; background: #2f8cff; border: 3px solid #fff;
  box-shadow: 0 0 0 7px rgba(47, 140, 255, .25), 0 2px 8px rgba(0, 0, 0, .5); pointer-events: none; }

.spark { flex: none; width: 28px; height: 28px; border-radius: 50%;
  background: radial-gradient(circle, #fff 0 12%, var(--gold) 20%, var(--accent-2) 45%, var(--accent) 62%, transparent 70%); }
.actions { display: flex; gap: 8px; flex: none; }
.round { width: 44px; height: 44px; border-radius: 50%; font-weight: 700; font-family: Georgia, serif; font-style: italic; }
.primary { border: 0; background: linear-gradient(120deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 650;
  box-shadow: 0 8px 26px rgba(157, 107, 255, .42); }
.pill { height: 44px; padding: 0 20px; border-radius: 99px; }

.strip { position: fixed; z-index: 2; left: env(safe-area-inset-left); right: env(safe-area-inset-right);
  bottom: calc(30px + env(safe-area-inset-bottom)); display: flex; gap: 10px; overflow-x: auto; padding: 6px var(--gap);
  scroll-snap-type: x proximity; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.card { flex: 0 0 255px; display: flex; gap: 12px; align-items: center; text-align: left; padding: 10px 12px;
  border-radius: 18px; scroll-snap-align: start; }
.card[aria-current="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 10px 34px rgba(157, 107, 255, .35); }
.date { flex: none; width: 46px; text-align: center; border-radius: 12px; background: var(--soft); padding: 5px 0; }
.date small { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--gold); }
.date b { display: block; font-size: 20px; line-height: 1.1; }
.card .what { min-width: 0; }
.card strong, .card span.sub { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card span.sub { color: var(--muted); font-size: 12.5px; }
.card.empty { cursor: default; color: var(--muted); }

.pin { width: 34px; height: 34px; padding: 0; border: 0; background: none; }
.pin .dot { position: absolute; inset: 10px; border-radius: 50%; background: var(--gold); border: 2px solid #fff;
  box-shadow: 0 0 14px 5px rgba(255, 194, 97, .65); }
.pin .ring { position: absolute; inset: 4px; border-radius: 50%; border: 2px solid var(--gold); opacity: 0;
  animation: burst 2.6s ease-out infinite; }
.pin .label { position: absolute; top: 31px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 11px;
  font-weight: 650; padding: 1px 7px; border-radius: 99px; background: rgba(11, 13, 23, .82); border: 1px solid var(--line); }
.pin .label .more { margin-left: 4px; color: var(--gold); }
.pin[aria-current="true"] { z-index: 1; }
.choices { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.choices .card { flex: none; width: 100%; border: 1px solid var(--line); background: var(--soft); color: var(--text); }
.choices .card:hover { border-color: var(--accent); }
.pin[aria-current="true"] .dot { inset: 7px; background: var(--accent-2); box-shadow: 0 0 20px 9px rgba(255, 95, 162, .7); }
.pin[aria-current="true"] .ring { border-color: var(--accent-2); }
.pin.small .dot { background: #8b87a8; box-shadow: 0 0 8px 2px rgba(139, 135, 168, .5); }
.pin.small .ring { display: none; }
@keyframes burst { 0% { transform: scale(.5); opacity: .9; } 70%, 100% { transform: scale(1.7); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pin .ring { animation: none; } }

.panel { position: fixed; z-index: 4; left: 0; right: 0; bottom: 0; max-height: 78vh; max-height: 78dvh; display: flex;
  flex-direction: column; border-radius: 24px 24px 0 0; animation: rise .22s ease-out; }
@keyframes rise { from { transform: translateY(18px); opacity: 0; } }
/* Content scrolls below the close button, never underneath it. */
#panel-body { min-height: 0; margin-top: 52px; overflow-y: auto; overscroll-behavior: contain;
  padding: 0 20px calc(20px + env(safe-area-inset-bottom)); }
.close { position: absolute; top: 12px; right: 12px; z-index: 1; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--soft); font-size: 22px; line-height: 1; }
@media (min-width: 760px) {
  .panel { left: auto; top: calc(70px + env(safe-area-inset-top)); right: var(--gap); bottom: auto; width: 390px;
    max-height: calc(100% - 106px); border-radius: 24px; }
  body.panel-open .strip { right: 410px; }
}
@media (max-width: 759px) {
  body.panel-open .strip { visibility: hidden; }
  .card { flex-basis: 230px; }
}
@media (max-width: 420px) { .round { display: none; } .pill { padding: 0 15px; } }

.panel h2 { margin: 0 0 4px; font-size: 22px; line-height: 1.2; }
.panel h3 { margin: 22px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.panel p { margin: 8px 0; }
.panel .eyebrow { color: var(--gold); font-weight: 650; font-size: 13px; margin: 0 0 4px; }
.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--bad); }
.good { color: var(--good); }
.facts { margin: 16px 0; padding: 0; }
.facts div { display: grid; grid-template-columns: 74px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.badge { display: block; padding: 9px 12px; margin: 8px 0; border-radius: 12px; background: var(--soft); font-size: 13px; }
.buttons { display: flex; gap: 10px; margin: 16px 0 6px; }
.buttons > * { flex: 1; }
.button, button.wide { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 16px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--soft); font-weight: 650; text-decoration: none; color: var(--text); }
.button.primary, button.wide.primary { border: 0; background: linear-gradient(120deg, var(--accent), var(--accent-2)); }
button.wide { width: 100%; margin-top: 10px; }
.link { background: none; border: 0; padding: 4px 0; color: #c3a6ff; text-decoration: underline; text-align: left; }
.link.danger { color: var(--bad); }
a { color: #c3a6ff; }

label.field { display: block; margin: 12px 0 4px; font-size: 13px; color: var(--muted); }
input[type=text], input[type=email], input[type=url], select { width: 100%; min-height: 44px; padding: 0 12px;
  border-radius: 12px; border: 1px solid var(--line); background: #151729; font-size: 16px; }
.inline { display: flex; gap: 8px; }
.inline > input { flex: 1; min-width: 0; }
.inline > button { flex: none; min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--soft); font-weight: 650; }
.place { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin: 8px 0; background: var(--soft); }
.place header { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.place header span { color: var(--muted); font-size: 12.5px; flex: 1; }
.place .fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--soft); }
.segmented button { min-height: 38px; border: 0; border-radius: 11px; background: none; }
.segmented button[aria-pressed="true"] { background: var(--accent); color: #fff; font-weight: 650; }
.toggle { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 10px 0; }
.toggle input { appearance: none; -webkit-appearance: none; flex: none; width: 46px; height: 27px; border-radius: 99px;
  background: #3a3c55; position: relative; margin: 0; cursor: pointer; transition: background .15s; }
.toggle input::after { content: ""; position: absolute; width: 21px; height: 21px; top: 3px; left: 3px; border-radius: 50%;
  background: #fff; transition: transform .15s; }
.toggle input:checked { background: var(--accent); }
.toggle input:checked::after { transform: translateX(19px); }
.panel details { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 16px; padding: 6px 0; }
.panel summary { cursor: pointer; min-height: 34px; display: flex; align-items: center; justify-content: space-between;
  font-weight: 650; list-style: none; }
.panel summary::-webkit-details-marker { display: none; }
.panel summary::after { content: "+"; font-size: 20px; color: var(--muted); }
.panel details[open] summary::after { content: "\2212"; }
#panel-body { scrollbar-width: thin; scrollbar-color: #3a3c55 transparent; }
.trap { position: absolute; left: -10000px; }
.sources { margin: 8px 0; padding-left: 18px; font-size: 14px; }
.sources li { margin: 4px 0; color: var(--muted); }

.toast { position: fixed; z-index: 6; left: 50%; transform: translateX(-50%); top: calc(74px + env(safe-area-inset-top));
  width: max-content; max-width: calc(100% - 24px); padding: 11px 18px; border-radius: 14px; }

.maplibregl-map .maplibregl-ctrl-attrib { background: rgba(11, 13, 23, .8); color: var(--muted); font-size: 11px; }
.maplibregl-map .maplibregl-ctrl-attrib a { color: var(--muted); }
.maplibregl-ctrl-attrib-button { filter: invert(1); }
