:root {
  color-scheme: dark;
  --background: #101319;
  --surface: #1a2029;
  --line: #353e4a;
  --text: #f4f6f9;
  --muted: #abb7c7;
  --green: #d7ff7b;
  --on-green: #172109;
  --seen: #5a6676;
  --placeholder: #303943;
  --map-bg: #0d1015;
  font: 16px/1.45 system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--text); background: var(--background); }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; font: inherit; cursor: pointer; }
button:disabled { opacity: .7; cursor: wait; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
h1, h2, p { margin: 0; }
.shell { width: min(100% - 32px, 660px); margin: 0 auto; padding: max(18px, env(safe-area-inset-top)) 0 max(20px, env(safe-area-inset-bottom)); }
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 7px; font-size: 1rem; font-weight: 800; white-space: nowrap; }
.spark { display: grid; place-items: center; width: 32px; height: 32px; margin-right: 4px; border-radius: 10px; background: var(--green); color: var(--on-green); font-size: 23px; }
.year, .date, .muted { color: var(--muted); }
.date { font-size: .81rem; white-space: nowrap; }
h1 { margin: 20px 0 14px; font-size: clamp(2rem, 8vw, 3rem); letter-spacing: -.055em; line-height: 1.04; }
.nearby { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; column-gap: 12px; padding: 16px; border: 1px solid #506048; border-radius: 17px; background: linear-gradient(135deg, #252f24, #191f27 75%); }
.nearby-content { display: contents; }
.nearby-content > :not(.actions) { grid-column: 1; }
.nearby-label { color: var(--green); display: flex; gap: 7px; align-items: center; font-weight: 700; font-size: .81rem; margin-bottom: 5px; }
.icon { display: inline-block; width: 19px; height: 19px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.nearby-label .icon { width: 16px; height: 16px; }
.nearby h2 { font-size: clamp(1.12rem, 4.8vw, 1.45rem); line-height: 1.22; letter-spacing: -.025em; overflow-wrap: anywhere; }
#nearby-address, .location-status { font-size: .85rem; margin-top: 5px; }
.location-status[data-active="true"] { color: var(--green); font-weight: 700; }
.photo-button { padding: 0; overflow: hidden; border: 0; background: var(--placeholder); cursor: zoom-in; }
.photo-button img { display: block; width: 100%; height: 100%; object-fit: cover; }
.nearby-image { grid-column: 2; grid-row: 1 / span 4; width: clamp(62px, 20vw, 130px); aspect-ratio: 1; border-radius: 10px; background: var(--surface); }
.actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin-top: 12px; }
.primary, .secondary { display: inline-flex; gap: 7px; align-items: center; justify-content: center; min-height: 44px; padding: 8px 12px; border: 1px solid transparent; border-radius: 10px; font-size: .88rem; font-weight: 750; }
.primary { background: var(--green); color: var(--on-green); }
.secondary { background: #262f34; border-color: #566260; color: var(--text); }
.catalog { margin-top: 21px; }
.catalog-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.catalog-heading h2 { font-size: 1.35rem; letter-spacing: -.03em; }
#progress-label { font-size: .83rem; text-align: right; }
progress { display: block; border: 0; width: 100%; height: 5px; appearance: none; background: var(--surface); color: var(--green); border-radius: 10px; overflow: hidden; }
progress::-webkit-progress-bar { background: var(--surface); }
progress::-webkit-progress-value { background: var(--green); }
progress::-moz-progress-bar { background: var(--green); }
#storage-status { color: #ffcc9b; margin-top: 9px; font-size: .85rem; }
.filter { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 3px; margin: 14px 0 10px; border: 1px solid var(--line); border-radius: 12px; background: #151a21; }
.filter button { min-height: 44px; min-width: 0; padding: 4px; background: transparent; color: var(--muted); border: 0; border-radius: 8px; font-size: .86rem; font-weight: 650; }
.filter button[aria-pressed=true] { background: #2b3540; color: var(--text); }
.zones { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: -2px 0 10px; padding: 2px 0; }
.zones::-webkit-scrollbar { display: none; }
.zones button { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 13px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); font-size: .84rem; font-weight: 650; white-space: nowrap; }
.zones button:focus-visible { outline-offset: -4px; }
.zones button[aria-pressed=true] { background: var(--green); color: var(--on-green); border-color: transparent; }
.zone-count { font-size: .74rem; opacity: .7; font-variant-numeric: tabular-nums; }
.view-switch { grid-template-columns: repeat(2, 1fr); margin-bottom: 8px; }
.view-switch + .filter { margin-top: 0; }
.map-view { position: relative; height: min(68vh, 640px); min-height: 320px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--map-bg); }
#map { position: absolute; inset: 0; background: var(--map-bg); font: inherit; }
#map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.5); }
#map .leaflet-control-attribution { background: #101319cc; color: #8a96a6; font-size: 9px; }
#map .leaflet-control-attribution a { color: var(--muted); }
#map .leaflet-bar { border: 1px solid var(--line); }
#map .leaflet-bar a { background: var(--surface); color: var(--text); border-color: var(--line); }
.map-message { position: absolute; inset: 0; z-index: 600; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--muted); background: var(--map-bg); }
.pin { position: relative; width: 14px; height: 14px; margin: 15px; border-radius: 50%; background: var(--green); border: 2px solid var(--background); box-shadow: 0 2px 6px #0009; }
.pin img, .pin b { display: none; }
.pin.seen { background: var(--seen); }
.pin.active { outline: 4px solid color-mix(in srgb, var(--green) 40%, transparent); outline-offset: 2px; }
.near .pin { width: 44px; height: 44px; margin: 0; border: 3px solid var(--green); background: var(--placeholder); }
.near .pin.seen { border-color: var(--seen); }
.near .pin img { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.near .pin.seen img { filter: grayscale(1) brightness(.6); }
.near .pin b { position: absolute; right: -7px; bottom: -5px; display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 4px; border: 2px solid var(--background); border-radius: 10px; background: var(--green); color: var(--on-green); font-size: 10px; font-weight: 800; line-height: 1; }
.near .pin.seen b { background: var(--seen); color: #fff; }
.map-card { position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 500; display: flex; align-items: center; gap: 8px; padding: 8px; border: 1px solid #505d6e; border-radius: 13px; background: #1a2029f2; box-shadow: 0 6px 25px #0008; }
.map-card-photo { flex: 0 0 64px; height: 64px; border-radius: 9px; }
.map-card .object-text { flex: 1; }
.objects { padding: 0; margin: 0; list-style: none; display: grid; gap: 8px; }
.object { display: flex; align-items: center; gap: 4px; padding: 8px; min-width: 0; border-radius: 13px; border: 1px solid #2c3540; background: var(--surface); }
.object-details { flex: 1; min-width: 0; display: flex; align-items: center; border-radius: 6px; }
.thumb { flex: 0 0 58px; height: 58px; margin-right: 6px; border-radius: 7px; }
.object-text { min-width: 0; display: grid; gap: 2px; }
.object-meta { display: flex; gap: 7px; font-size: .74rem; color: var(--muted); font-weight: 650; }
.distance { color: var(--green); }
.object-name { font-size: .86rem; line-height: 1.21; overflow-wrap: anywhere; }
.object-place { font-size: .76rem; line-height: 1.25; overflow-wrap: anywhere; }
.icon-button { display: inline-grid; place-items: center; flex: 0 0 44px; min-height: 44px; border-radius: 9px; background: transparent; border: 1px solid var(--line); }
.visit { color: var(--green); }
.visit[aria-pressed=true] { background: var(--green); color: var(--on-green); border-color: transparent; }
.route { border-color: transparent; color: var(--muted); }
.empty { padding: 20px 8px; text-align: center; color: var(--muted); }
footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 18px; margin-top: 18px; font-size: .8rem; color: var(--muted); }
.credit { flex-basis: 100%; text-align: center; }
footer a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: underline; text-underline-offset: 3px; }
.toast { position: fixed; inset: auto 16px max(12px, env(safe-area-inset-bottom)); margin: auto; z-index: 2; width: min(100% - 32px, 540px); display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 1px solid #505d6e; border-radius: 11px; background: #293440; padding: 4px 7px 4px 12px; box-shadow: 0 6px 25px #0008; font-size: .87rem; }
.toast button { min-height: 44px; border: 0; border-radius: 7px; background: transparent; color: var(--green); font-weight: 750; }
.viewer { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: env(safe-area-inset-top) 0 0; border: 0; background: #000; color: var(--text); }
.viewer[open] { display: flex; flex-direction: column; }
.viewer::backdrop { background: #000; }
.viewer img { flex: 1; min-height: 0; width: 100%; object-fit: contain; cursor: zoom-out; }
.viewer-bar { display: flex; align-items: center; gap: 8px; padding: 12px 16px max(12px, env(safe-area-inset-bottom)); }
.viewer-text { flex: 1; min-width: 0; display: grid; gap: 2px; font-size: .88rem; overflow-wrap: anywhere; }
.viewer-text .muted { font-size: .8rem; }
.viewer form { display: contents; }
@media (max-width: 360px) {
  .shell { width: calc(100% - 22px); }
  .thumb { flex-basis: 42px; height: 50px; margin-right: 3px; }
  .nearby-image { display: none; }
}
