/* GTA 6 Leonida offline map — no external assets, system fonts only */

:root {
  --bg: #0a0d13;
  --panel: #0e131b;
  --panel-2: #121926;
  --panel-3: #172030;
  --line: #212c3d;
  --line-soft: #1a2331;
  --txt: #e8eef8;
  --dim: #94a3b8;
  --dim-2: #64748b;
  --accent: #ff2e88;
  --accent-2: #22d3ee;
  --ok: #34d399;
  --warn: #fbbf24;
  --loc: #38bdf8;
  --col: #f472b6;
  --act: #a3e635;
  --radius: 12px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .55);
  --sbw: 392px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

html[data-theme="night"] {
  --accent: #22d3ee;
  --panel: #0b0f1a;
  --panel-2: #0f1524;
  --panel-3: #141d31;
  --line: #22304a;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body { overflow: hidden; }

button, input, select { font: inherit; color: inherit; }

button { cursor: pointer; }

.noscript {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: var(--bg); color: var(--txt); z-index: 9999; font-size: 16px;
}

#app {
  display: flex;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

/* ------------------------------------------------------------------ sidebar */

#sidebar {
  width: var(--sbw);
  flex: 0 0 var(--sbw);
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--panel-2), var(--panel) 220px);
  border-right: 1px solid var(--line);
  z-index: 30;
}

.sb-head {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line-soft);
  flex: 0 0 auto;
}

.brand-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }

.brand { display: flex; flex-direction: column; line-height: 1; }
.brand-kicker {
  font-size: 10px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--dim-2); margin-bottom: 6px; font-weight: 600;
}
.brand-title {
  font-size: 26px; font-weight: 800; letter-spacing: .02em;
  background: linear-gradient(96deg, #fff 10%, var(--accent) 62%, var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-title em {
  font-style: normal; font-size: 13px; font-weight: 600; letter-spacing: .22em;
  text-transform: uppercase; color: var(--dim); -webkit-text-fill-color: var(--dim);
  margin-left: 4px;
}

.head-meta {
  margin-top: 8px; font-size: 11.5px; color: var(--dim-2);
  font-variant-numeric: tabular-nums; letter-spacing: .01em;
}

.sb-close { display: none; }

.progress-hero {
  margin-top: 14px;
  background: linear-gradient(180deg, rgba(255, 46, 136, .08), rgba(34, 211, 238, .04));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 12px 10px;
}
.ph-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; color: var(--txt); font-variant-numeric: tabular-nums; }
.ph-top b { font-size: 14px; }
#ovPct { font-weight: 700; color: var(--accent); font-size: 15px; }
.ph-sub { display: flex; justify-content: space-between; margin-top: 7px; font-size: 10.5px; color: var(--dim-2); }
.ph-offline {
  text-transform: uppercase; letter-spacing: .14em; font-weight: 700;
  color: var(--ok); border: 1px solid rgba(52, 211, 153, .35);
  padding: 1px 6px; border-radius: 999px; font-size: 9px;
}

.bar { height: 6px; border-radius: 999px; background: #0a0f18; overflow: hidden; border: 1px solid var(--line-soft); }
.bar.big { height: 8px; margin-top: 8px; }
.bar i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent), #ff8a3d 55%, var(--accent-2));
  transition: width .25s ease;
}

.search-wrap {
  position: relative; margin-top: 12px; display: flex; align-items: center;
}
.search-wrap .s-ico {
  position: absolute; left: 11px; width: 17px; height: 17px; color: var(--dim-2); pointer-events: none;
}
#search {
  width: 100%; padding: 10px 34px 10px 35px; border-radius: 10px;
  background: #0a0f17; border: 1px solid var(--line); color: var(--txt);
  outline: none; font-size: 13px;
}
#search::placeholder { color: var(--dim-2); }
#search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 46, 136, .14); }
#search::-webkit-search-cancel-button { display: none; }
.s-clear { position: absolute; right: 6px; }

.icon-btn {
  background: none; border: 0; color: var(--dim); padding: 4px 7px;
  border-radius: 6px; line-height: 1; font-size: 13px;
}
.icon-btn:hover { color: var(--txt); background: var(--panel-3); }

.sb-scroll {
  overflow-y: auto; overflow-x: hidden; flex: 1 1 auto;
  scrollbar-width: thin; scrollbar-color: #2b3a4f transparent;
  padding-bottom: 18px;
}
.sb-scroll::-webkit-scrollbar { width: 9px; }
.sb-scroll::-webkit-scrollbar-thumb { background: #26344a; border-radius: 8px; border: 2px solid var(--panel); }

/* ------------------------------------------------------------------ panels */

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 8px;
  font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--dim-2); font-weight: 700;
}
.panel-head .head-actions { display: flex; gap: 4px; }
.panel-hint { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--dim-2); }

.mini {
  background: var(--panel-3); border: 1px solid var(--line);
  color: var(--dim); border-radius: 6px; padding: 2px 7px;
  font-size: 10px; letter-spacing: .04em; text-transform: uppercase; font-weight: 700;
}
.mini:hover { color: var(--txt); border-color: var(--accent); }

.jump-row { padding: 0 16px 10px; }
#typeJump {
  width: 100%; padding: 8px 10px; border-radius: 8px; font-size: 12.5px;
  background: var(--panel-3); border: 1px solid var(--line); color: var(--txt);
  outline: none;
}
#typeJump:focus { border-color: var(--accent-2); }

.regions { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 16px 10px; }
.regions button {
  background: transparent; border: 1px dashed #2a3748;
  color: var(--dim); font-size: 10.5px; padding: 3px 8px; border-radius: 999px;
}
.regions button:hover { color: var(--accent-2); border-color: var(--accent-2); }

/* -------------------------------------------------------------------- tree */

.tree { padding: 0 10px; }

.t-sec { margin-bottom: 6px; border-radius: 10px; overflow: hidden; border: 1px solid transparent; }
.t-sec.open { border-color: var(--line-soft); background: rgba(255, 255, 255, .012); }

.trow {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 8px; border-radius: 9px; user-select: none;
}
.trow:hover { background: rgba(255, 255, 255, .035); }
.trow.sec { background: linear-gradient(90deg, rgba(255, 46, 136, .10), transparent 70%); }
.trow.grp { padding-left: 14px; }

.caret {
  width: 16px; height: 16px; flex: 0 0 16px; background: none; border: 0; padding: 0;
  color: var(--dim-2); display: grid; place-items: center;
}
.caret svg { width: 10px; height: 10px; transition: transform .15s ease; }
.open > .trow .caret svg { transform: rotate(90deg); }

.tname {
  flex: 1 1 auto; min-width: 0; text-align: left; background: none; border: 0;
  color: var(--txt); font-size: 13px; font-weight: 600; padding: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.trow.sec .tname { font-size: 13px; letter-spacing: .02em; text-transform: uppercase; font-size: 11.5px; letter-spacing: .08em; }
.trow.grp .tname { font-weight: 500; color: #cfdaea; font-size: 12.5px; }
.tname:hover { color: var(--accent); }
.t-row .tname { font-weight: 450; color: #b9c6d8; font-size: 12.5px; }

.tcount {
  font-family: var(--mono); font-size: 10.5px; color: var(--dim-2);
  font-variant-numeric: tabular-nums; flex: 0 0 auto; white-space: nowrap;
}
.tcount b { color: var(--dim); font-weight: 600; }
.tcount.done b, .tcount.done { color: var(--ok); }

.t-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .12s; flex: 0 0 auto; }
.trow:hover .t-actions, .trow:focus-within .t-actions { opacity: 1; }
.t-actions .mini { padding: 1px 5px; font-size: 9px; }

.tbody { display: none; padding: 0 0 6px; }
.open > .tbody { display: block; }

.mini-bar { height: 2px; border-radius: 2px; background: #0a0f18; overflow: hidden; margin: 0 8px 4px 40px; }
.mini-bar i { display: block; height: 100%; background: var(--ok); width: 0; }

/* type row */
.type-row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px 4px 34px; border-radius: 7px; cursor: pointer;
}
.type-row:hover { background: rgba(255, 255, 255, .04); }
.type-row input[type="checkbox"] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cbx {
  width: 14px; height: 14px; flex: 0 0 14px; border-radius: 4px;
  border: 1.5px solid #33415522; border-color: #35445a; background: #0a0f18;
  display: grid; place-items: center;
}
.cbx::after {
  content: ""; width: 7px; height: 4px; border-left: 2px solid #04121a; border-bottom: 2px solid #04121a;
  transform: rotate(-45deg) scale(0); transition: transform .1s;
}
.type-row input:checked + .cbx,
.cbx-label input:checked + .cbx { background: var(--accent-2); border-color: var(--accent-2); }
.type-row input:checked + .cbx::after,
.cbx-label input:checked + .cbx::after { transform: rotate(-45deg) scale(1); }
.type-row input:focus-visible + .cbx,
.cbx-label input:focus-visible + .cbx { outline: 2px solid var(--accent); outline-offset: 2px; }

.cbx-label { position: relative; display: inline-flex; flex: 0 0 14px; cursor: pointer; }
.cbx-label input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cbx-label input:indeterminate + .cbx { background: var(--accent-2); border-color: var(--accent-2); }
.cbx-label input:indeterminate + .cbx::after {
  width: 7px; height: 0; border-left: 0; border-bottom: 2px solid #04121a;
  transform: rotate(0deg) scale(1);
}

.type-row .tname { font-weight: 450; color: #b9c6d8; font-size: 12.5px; }

.swatch {
  width: 18px; height: 18px; flex: 0 0 18px; border-radius: 50%;
  /* sprite icons carry their own circular background and transparent corners;
     a white backdrop erased their light halves and read as a cropped icon */
  background-repeat: no-repeat; background-color: transparent;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .10);
}
.swatch.lg { width: 30px; height: 30px; flex-basis: 30px; }

.t-row .tname { flex: 1 1 auto; text-align: left; background: none; border: 0; padding: 0; }
.type-row .tcount { margin-left: auto; }

/* --------------------------------------------------------------- search res */

.results { padding: 0 10px 10px; }

.res {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 8px; border-radius: 9px; border: 1px solid transparent;
  background: none; text-align: left; color: var(--txt);
}
.res:hover, .res:focus-visible { background: var(--panel-3); border-color: var(--line); outline: none; }
.res-main { min-width: 0; flex: 1 1 auto; }
.res-name { display: block; font-size: 12.8px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-meta { display: block; font-size: 10.5px; color: var(--dim-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-snip { display: block; font-size: 10.8px; color: #93a4bb; margin-top: 2px; line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.res-snip mark, .res-name mark { background: rgba(251, 191, 36, .22); color: #fde68a; border-radius: 3px; padding: 0 1px; }
.res-badges { display: flex; gap: 3px; color: var(--dim-2); flex: 0 0 auto; }
.res-badges svg { width: 13px; height: 13px; }
.res.is-found .res-name { color: var(--dim-2); text-decoration: line-through; }
.res-found { color: var(--ok); font-size: 12px; flex: 0 0 auto; }
.more-note { padding: 8px; font-size: 11px; color: var(--dim-2); text-align: center; }

.type-jumps { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 10px 10px; }
.type-jumps button {
  border: 1px solid var(--line); background: var(--panel-3); color: var(--dim);
  border-radius: 999px; font-size: 10.5px; padding: 3px 9px;
}
.type-jumps button:hover { color: var(--txt); border-color: var(--accent-2); }

/* ------------------------------------------------------------------ tools */

.tools-panel {
  margin: 12px 16px 8px; padding: 12px; border: 1px solid var(--line-soft);
  border-radius: var(--radius); background: rgba(255, 255, 255, .015);
}
.switch-row { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.switch-row > span { flex: 1 1 auto; display: flex; flex-direction: column; }
.switch-row b { font-size: 12.5px; font-weight: 600; }
.switch-row small { color: var(--dim-2); font-size: 10.5px; margin-top: 1px; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch {
  width: 34px; height: 19px; border-radius: 999px; background: #26313f;
  position: relative; flex: 0 0 34px; transition: background .15s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px;
  border-radius: 50%; background: #94a3b8; transition: transform .15s, background .15s;
}
.switch-row input:checked + .switch { background: rgba(52, 211, 153, .25); }
.switch-row input:checked + .switch::after { transform: translateX(15px); background: var(--ok); }
.switch-row input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 2px; }

.tool-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-top: 12px; }
.btn {
  background: var(--panel-3); border: 1px solid var(--line); color: var(--txt);
  border-radius: 8px; padding: 7px 6px; font-size: 11px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.btn:hover { border-color: var(--accent-2); }
.btn.danger { color: #fca5a5; }
.btn.danger:hover { border-color: #ef4444; background: rgba(239, 68, 68, .1); }

.fineprint { margin: 10px 0 0; font-size: 10px; line-height: 1.5; color: var(--dim-2); }

.sb-foot { padding: 10px 16px 22px; border-top: 1px solid var(--line-soft); margin-top: 10px; }
.sb-foot p { margin: 0 0 4px; font-size: 9.5px; line-height: 1.5; color: var(--dim-2); }
.sb-foot .tiny { opacity: .75; }

/* -------------------------------------------------------------------- map */

#mapwrap { position: relative; flex: 1 1 auto; min-width: 0; height: 100%; background: var(--bg); }

#map {
  position: absolute; inset: 0;
  background-color: #0a1018;
  background-image:
    radial-gradient(circle at 50% 40%, rgba(34, 211, 238, .07), transparent 60%),
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 100% 100%, 64px 64px, 64px 64px;
  cursor: grab;
}
#map:active { cursor: grabbing; }

.leaflet-container { background: transparent; font-family: var(--font); }
.leaflet-tile { will-change: auto; }
.leaflet-container .leaflet-tile-pane { filter: saturate(1.04) contrast(1.03); }
html[data-theme="night"] .leaflet-container .leaflet-tile-pane { filter: saturate(.92) contrast(1.06) brightness(.92); }

.marker-canvas {
  position: absolute; left: 0; top: 0; pointer-events: none;
  transition: opacity .12s;
}
.marker-canvas.zooming { opacity: .25; }

.map-top {
  position: absolute; top: 12px; left: 12px; right: 12px; z-index: 500;
  display: flex; align-items: center; gap: 8px; pointer-events: none;
}
.map-top > * { pointer-events: auto; }

.map-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(12, 18, 28, .88); border: 1px solid var(--line);
  color: var(--txt); border-radius: 9px; padding: 7px 10px; font-size: 12px;
  font-weight: 600; backdrop-filter: blur(8px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
}
.map-btn:hover { border-color: var(--accent-2); color: #fff; }
.map-btn svg { width: 16px; height: 16px; }
.map-btn.sq { width: 34px; height: 34px; justify-content: center; padding: 0; font-size: 16px; }
.map-btn[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }
#sbToggle { display: none; }

.legend {
  display: flex; gap: 12px; font-size: 10.5px; color: #cbd5e1;
  background: rgba(10, 15, 23, .72); border: 1px solid var(--line-soft);
  padding: 6px 10px; border-radius: 999px; backdrop-filter: blur(8px);
}
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.loc { background: var(--loc); }
.dot.col { background: var(--col); }
.dot.act { background: var(--act); }

.map-tools {
  position: absolute; right: 12px; bottom: 60px; z-index: 500;
  display: flex; flex-direction: column; gap: 6px; align-items: center;
}
.zoom-stack { display: flex; flex-direction: column; border-radius: 9px; overflow: hidden; border: 1px solid var(--line); box-shadow: 0 6px 20px rgba(0,0,0,.35); }
.zoom-stack .map-btn { border-radius: 0; border: 0; background: rgba(12, 18, 28, .9); }
.zoom-stack .map-btn + .map-btn { border-top: 1px solid var(--line); }

.hover-tip {
  position: absolute; z-index: 700; pointer-events: none;
  background: rgba(8, 12, 20, .95); border: 1px solid var(--line);
  border-radius: 7px; padding: 5px 8px; font-size: 11.5px; max-width: 260px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5); transform: translate(-50%, -140%);
}
.hover-tip b { display: block; font-size: 12px; margin-bottom: 1px; }
.hover-tip span { color: var(--dim-2); font-size: 10px; }

.map-note {
  position: absolute; left: 50%; bottom: 46px; transform: translateX(-50%);
  background: rgba(180, 83, 9, .92); color: #fff; font-size: 11.5px;
  padding: 6px 12px; border-radius: 999px; z-index: 600; max-width: 90%;
  text-align: center;
}

.map-note.warn {
  top: 12px; bottom: auto; z-index: 900;
  font-size: 13px; font-weight: 600; padding: 10px 16px;
  border-radius: 10px; background: rgba(153, 27, 27, .96);
  border: 1px solid rgba(255, 255, 255, .28);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .55);
}

.map-attr {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 400;
  padding: 5px 12px; font-size: 9.5px; color: #9fb0c4;
  background: linear-gradient(0deg, rgba(6, 9, 14, .92), rgba(6, 9, 14, .55) 70%, transparent);
  pointer-events: none; text-align: right;
}

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: #101a26; border: 1px solid var(--line); color: var(--txt);
  padding: 9px 16px; border-radius: 999px; font-size: 12px; z-index: 2000;
  box-shadow: var(--shadow);
}

.err-box {
  position: absolute; left: 12px; bottom: 34px; right: 12px; z-index: 3000;
  background: rgba(127, 29, 29, .96); border: 1px solid #ef4444; border-radius: 10px;
  padding: 10px 12px; font-size: 12px; max-height: 40vh; overflow: auto;
}
.err-box pre { margin: 6px 0 0; font-size: 11px; white-space: pre-wrap; }

/* ------------------------------------------------------------------ popups */

.leaflet-popup-content-wrapper {
  background: #0f1622; color: var(--txt); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); padding: 0; overflow: hidden;
}
.leaflet-popup-content { margin: 0; width: auto !important; line-height: 1.45; }
.leaflet-popup-tip { background: #0f1622; border: 1px solid var(--line); }
.leaflet-popup-close-button {
  color: var(--dim) !important; font-size: 18px !important; padding: 6px 8px 0 0 !important;
  width: 28px !important; height: 28px !important;
}
.leaflet-popup-close-button:hover { color: #fff !important; }

.pop { width: 300px; max-width: min(84vw, 340px); display: flex; flex-direction: column; }
.pop-head { display: flex; gap: 10px; padding: 12px 12px 8px; align-items: flex-start; }
.pop-swatch {
  border-radius: 50%; background-repeat: no-repeat; background-color: #fff; flex: 0 0 34px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .15), 0 3px 10px rgba(0, 0, 0, .45);
}
.pop-titles { min-width: 0; }
.pop-titles h3 { margin: 1px 0 2px; font-size: 14.5px; font-weight: 700; line-height: 1.25; padding-right: 16px; }
.pop-type { font-size: 10.5px; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.pop-type .sep { color: var(--dim-2); margin: 0 4px; }
.pop-scroll { overflow-y: auto; max-height: min(46vh, 320px); padding: 0 12px 4px; scrollbar-width: thin; }
.pop-desc { font-size: 12px; color: #c3d0e1; line-height: 1.55; }
.pop-desc p { margin: 0 0 7px; }
.pop-desc strong { color: #fff; }
.pop-desc em { color: #dbe6f5; }
.pop-img {
  display: block; width: 100%; height: auto; border-radius: 8px; margin: 4px 0 8px;
  border: 1px solid var(--line); background: #0a0f17; min-height: 0;
}
.pop-actions {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px 11px; border-top: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, .015);
}
.btn-found {
  flex: 1 1 auto; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-3); color: var(--txt); font-size: 12px; font-weight: 700;
  padding: 8px 10px;
}
.btn-found:hover { border-color: var(--ok); color: #fff; }
.btn-found.on { background: rgba(52, 211, 153, .15); border-color: var(--ok); color: #a7f3d0; }
.pop-coords { font-family: var(--mono); font-size: 9px; color: var(--dim-2); }
.pop-note {
  font-size: 10px; color: var(--dim-2); font-style: italic;
  border-top: 1px dashed var(--line); padding-top: 5px; margin-top: 2px;
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 980px) {
  #sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; width: min(88vw, 380px);
    transform: translateX(-102%); transition: transform .22s ease;
    box-shadow: 24px 0 60px rgba(0, 0, 0, .55); z-index: 1200;
  }
  body.sb-open #sidebar { transform: none; }
  .sb-close { display: inline-flex; }
  #sbToggle { display: inline-flex; }
  #backdrop {
    position: fixed; inset: 0; background: rgba(3, 6, 10, .55); z-index: 1100;
    backdrop-filter: blur(2px);
  }
  body.sb-open #backdrop { display: block; }
  .legend { display: none; }
  .map-attr { font-size: 8.5px; padding-right: 8px; }
  .map-tools { bottom: 52px; }
}

@media (max-width: 520px) {
  .brand-title { font-size: 22px; }
  .pop { width: 260px; }
  .map-top { top: 8px; left: 8px; right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

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

/* ==================================================================== v2 */

/* --------------------------------------------------------------- regions */
.region-ctl { padding: 0 16px 10px; }
.region-toggles { display: flex; gap: 6px; margin-bottom: 7px; }

.chip-btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel-3); color: var(--dim);
  border-radius: 999px; font-size: 10.5px; font-weight: 600; padding: 3px 9px;
}
.chip-btn:hover { color: var(--txt); border-color: var(--accent-2); }
.chip-btn[hidden] { display: none; }
.chip-btn input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip-btn input:checked + span { color: var(--accent-2); }
.chip-btn input:checked + span::before { content: "✓ "; font-weight: 800; }
.chip-btn input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.regions { display: flex; flex-wrap: wrap; gap: 5px; padding: 0; }
.region-chip {
  background: transparent; border: 1px dashed #2a3748;
  color: var(--dim); font-size: 10.5px; padding: 3px 9px; border-radius: 999px;
}
.region-chip:hover { color: var(--accent-2); border-color: var(--accent-2); }
.region-chip.state { color: #f472b6; border-color: rgba(244, 114, 182, .5); }

.region-label { background: none; border: 0; }
.region-label span {
  display: inline-block; transform: translate(-50%, -50%);
  font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: #f1f5f9; white-space: nowrap; padding: 2px 8px; border-radius: 7px;
  background: rgba(6, 10, 18, .74);
  border: 1px solid rgba(148, 163, 184, .32);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .55);
  text-shadow: 0 1px 2px #000, 0 0 4px rgba(0, 0, 0, .9);
}
.region-label.state span {
  color: #ffe4ef; font-size: 12.5px; letter-spacing: .18em;
  background: rgba(38, 8, 24, .78);
  border-color: rgba(244, 114, 182, .55);
}

/* ----------------------------------------------------------- fold panels */
.fold { border-top: 1px solid var(--line-soft); margin-top: 4px; }
.fold .panel-head { padding: 10px 16px 6px; }
.fold-head {
  display: inline-flex; align-items: center; gap: 6px; background: none; border: 0;
  padding: 0; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit;
}
.fold-head:hover { color: var(--txt); }
.fold-caret { width: 9px; height: 9px; transition: transform .15s ease; }
.fold.open .fold-caret { transform: rotate(90deg); }
.fold-meta { color: var(--dim-2); font-weight: 600; letter-spacing: .04em; }
.fold-body { padding: 0 16px 12px; }

/* -------------------------------------------------------------- heatmaps */
.heat-tools { display: flex; align-items: center; gap: 5px; margin: 8px 0; }
#heatFilter {
  flex: 1 1 auto; min-width: 0; padding: 6px 9px; border-radius: 8px; font-size: 12px;
  background: #0a0f17; border: 1px solid var(--line); color: var(--txt); outline: none;
}
#heatFilter:focus { border-color: var(--accent-2); }
.heat-groups { max-height: 300px; overflow-y: auto; scrollbar-width: thin; padding-right: 2px; }
.h-grp { border-radius: 8px; }
.h-grp + .h-grp { border-top: 1px solid var(--line-soft); }
.hrow { display: flex; align-items: center; gap: 7px; padding: 5px 2px; border-radius: 7px; cursor: pointer; }
.hrow:hover { background: rgba(255, 255, 255, .035); }
.hname {
  flex: 1 1 auto; min-width: 0; text-align: left; background: none; border: 0; padding: 0;
  color: #cfdaea; font-size: 12px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hname:hover { color: var(--accent-2); }
.hbody { display: none; padding: 0 0 4px 22px; }
.h-grp.open > .hbody { display: block; }
.h-grp.open > .hrow .caret svg { transform: rotate(90deg); }
.h-layer {
  display: flex; align-items: center; gap: 6px; padding: 2px 4px; border-radius: 6px;
  cursor: pointer; font-size: 11.5px; color: #b9c6d8;
}
.h-layer:hover { background: rgba(255, 255, 255, .04); color: var(--txt); }
.h-layer input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.h-layer input:checked + .cbx { background: var(--accent-2); border-color: var(--accent-2); }
.h-layer input:checked + .cbx::after { transform: rotate(-45deg) scale(1); }
.h-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-n { font-family: var(--mono); font-size: 9.5px; color: var(--dim-2); flex: 0 0 auto; }
.heat-stat {
  margin-top: 8px; font-size: 10px; color: var(--dim-2);
  border-top: 1px dashed var(--line); padding-top: 6px; font-variant-numeric: tabular-nums;
}
.heat-canvas { position: absolute; left: 0; top: 0; pointer-events: none; opacity: .92; }
html[data-theme="night"] .heat-canvas { opacity: .82; mix-blend-mode: screen; }

/* ------------------------------------------------------------ checklists */
.inline-add { display: flex; gap: 6px; margin-bottom: 8px; }
#newListName {
  flex: 1 1 auto; min-width: 0; padding: 7px 9px; border-radius: 8px; font-size: 12px;
  background: #0a0f17; border: 1px solid var(--line); color: var(--txt); outline: none;
}
#newListName:focus { border-color: var(--accent-2); }
.lists { display: flex; flex-direction: column; gap: 7px; }
.list-item {
  border: 1px solid var(--line-soft); border-radius: 9px; padding: 8px 9px;
  background: rgba(255, 255, 255, .014);
}
.list-item.active { border-color: var(--accent-2); background: rgba(34, 211, 238, .06); }
.li-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.li-name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-count { font-family: var(--mono); font-size: 10px; color: var(--dim-2); flex: 0 0 auto; }
.bar.thin { height: 3px; margin: 5px 0 7px; }
.li-actions { display: flex; gap: 4px; }
.li-actions .mini { font-size: 9px; padding: 2px 6px; }
.empty-note { font-size: 10.5px; color: var(--dim-2); font-style: italic; padding: 4px 0 6px; }

/* --------------------------------------------------------- custom markers */
.btn.wide { width: 100%; }
.btn.on { border-color: var(--accent); color: #fff; background: rgba(255, 46, 136, .16); }
.btn.primary { background: rgba(34, 211, 238, .16); border-color: var(--accent-2); color: #e0f7ff; }
.custom-list { margin-top: 8px; display: flex; flex-direction: column; gap: 3px; }
.custom-item { display: flex; align-items: center; gap: 7px; padding: 3px 4px; border-radius: 6px; }
.custom-item:hover { background: rgba(255, 255, 255, .04); }
.cd { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 10px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); }
.ci-name {
  flex: 1 1 auto; min-width: 0; text-align: left; background: none; border: 0; padding: 0;
  color: #cfdaea; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ci-name:hover { color: var(--accent-2); }
.custom-item .mini { font-size: 9px; padding: 1px 5px; opacity: 0; }
.custom-item:hover .mini, .custom-item:focus-within .mini { opacity: 1; }

/* add-marker form (floats over the map) */
.add-form {
  position: absolute; z-index: 800; width: 210px;
  background: #0f1622; border: 1px solid var(--line); border-radius: 11px;
  padding: 10px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 7px;
}
.add-form[hidden] { display: none; }
.af-head { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim-2); font-weight: 700; }
.add-form input[type="text"], .add-form textarea {
  width: 100%; padding: 6px 8px; border-radius: 7px; font-size: 12px;
  background: #0a0f17; border: 1px solid var(--line); color: var(--txt); outline: none; resize: none;
}
.add-form input[type="text"]:focus, .add-form textarea:focus { border-color: var(--accent-2); }
.af-colors { display: flex; gap: 5px; }
.color-dot {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid transparent; padding: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .45);
}
.color-dot.on { border-color: #fff; }
.af-actions { display: flex; gap: 5px; }
.af-actions .btn { flex: 1 1 0; padding: 6px 4px; font-size: 10.5px; }

#map.adding, #map.adding:active { cursor: crosshair; }
#map.dragging-marker, #map.dragging-marker:active { cursor: grabbing; }

/* ------------------------------------------------------ filters (tri-state) */
.seg {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px;
  background: #0a0f18; border: 1px solid var(--line); border-radius: 9px; padding: 3px;
}
.seg button {
  background: none; border: 0; border-radius: 6px; padding: 5px 2px;
  font-size: 10.5px; font-weight: 600; color: var(--dim); white-space: nowrap;
}
.seg button b { font-family: var(--mono); font-size: 9.5px; color: var(--dim-2); font-weight: 600; margin-left: 2px; }
.seg button:hover { color: var(--txt); }
.seg button.on { background: var(--panel-3); color: var(--txt); box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset; }
.seg button.on b { color: var(--accent-2); }
.tools-panel .switch-row { margin-top: 12px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.res-mynote { color: var(--warn); }
.res-mynote svg { filter: drop-shadow(0 0 3px rgba(251, 191, 36, .4)); }

/* ------------------------------------------------------- popup additions */
.pop-sec-head {
  font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--dim-2); font-weight: 700; margin: 9px 0 5px;
}
.pop-gallery {
  display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 6px;
  scrollbar-width: thin; scrollbar-color: #2b3a4f transparent;
}
.pop-gallery .thumb {
  flex: 0 0 auto; width: 66px; height: 48px; padding: 0; border-radius: 7px;
  border: 1px solid var(--line); overflow: hidden; background: #0a0f17;
}
.pop-gallery .thumb:hover, .pop-gallery .thumb:focus-visible { border-color: var(--accent-2); }
.pop-gallery .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pop-img { display: block; width: 100%; height: auto; border-radius: 8px; margin: 4px 0 8px;
  border: 1px solid var(--line); background: #0a0f17; }

.pop-notes { border-top: 1px solid var(--line-soft); margin-top: 4px; }
.note-input {
  width: 100%; resize: vertical; min-height: 52px; padding: 7px 8px; border-radius: 8px;
  background: #0a0f17; border: 1px solid var(--line); color: var(--txt);
  font: inherit; font-size: 12px; line-height: 1.45; outline: none;
}
.note-input:focus { border-color: var(--accent-2); }
.note-actions { display: flex; align-items: center; gap: 6px; margin-top: 5px; }
.note-actions .mini.primary { border-color: var(--accent-2); color: #e0f7ff; background: rgba(34, 211, 238, .14); }
.note-status { font-size: 9.5px; color: var(--ok); margin-left: auto; }

.pop-lists { border-top: 1px solid var(--line-soft); }
.list-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.list-chip {
  display: inline-flex; align-items: center; gap: 3px; font-size: 10px;
  background: var(--panel-3); border: 1px solid var(--line); border-radius: 999px; padding: 2px 4px 2px 8px;
}
.chip-x { background: none; border: 0; color: var(--dim-2); font-size: 12px; line-height: 1; padding: 0 3px; border-radius: 50%; }
.chip-x:hover { color: #fca5a5; }
.list-add-row { display: flex; gap: 5px; }
.list-select {
  flex: 1 1 auto; min-width: 0; padding: 5px 7px; border-radius: 7px; font-size: 11.5px;
  background: var(--panel-3); border: 1px solid var(--line); color: var(--txt); outline: none;
}
.list-select:focus { border-color: var(--accent-2); }

.custom-name {
  width: 100%; padding: 4px 7px; border-radius: 7px; font-size: 13.5px; font-weight: 700;
  background: #0a0f17; border: 1px solid var(--line); color: var(--txt); outline: none;
}
.custom-name:focus { border-color: var(--accent-2); }
.custom-swatch { width: 34px !important; height: 34px !important; border: 2px solid rgba(255, 255, 255, .35); }

/* ------------------------------------------------------------- lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 4000; display: flex; align-items: center; justify-content: center;
  background: rgba(3, 6, 11, .93); backdrop-filter: blur(3px); padding: 24px 56px;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 100%; max-height: 100%; border-radius: 10px; border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .7); object-fit: contain;
}
.lb-btn {
  position: absolute; background: rgba(16, 26, 38, .9); border: 1px solid var(--line);
  color: #fff; border-radius: 50%; width: 40px; height: 40px; font-size: 20px; line-height: 1;
}
.lb-btn:hover { border-color: var(--accent-2); }
.lb-btn[hidden] { display: none; }
.lb-close { top: 14px; right: 16px; }
.lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 12px; top: 50%; transform: translateY(-50%); }
.lb-count {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  font-family: var(--mono); font-size: 11px; color: var(--dim);
  background: rgba(10, 16, 24, .8); border: 1px solid var(--line-soft);
  padding: 3px 10px; border-radius: 999px;
}
body.lb-open { overflow: hidden; }

@media (max-width: 520px) {
  .lightbox { padding: 12px; }
  .lb-prev, .lb-next { width: 34px; height: 34px; }
  .heat-groups { max-height: 240px; }
}

/* ----------------------------------------------------------- support / modal */
.support-row {
  display: flex; gap: 8px; margin: 0 0 10px;
}
.support-row.top { margin: 12px 0 0; }
.sbtn {
  flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 10px; font: inherit; font-size: 12px; font-weight: 600; letter-spacing: .2px;
  color: var(--txt); background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 10px; cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.sbtn svg { width: 15px; height: 15px; flex: 0 0 15px; }
.sbtn:hover { background: var(--panel-3); border-color: #2c3a4f; }
.sbtn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
#btnDonate:hover { color: #ffd7e8; border-color: #4a2436; }
#btnDiscord:hover { color: #cfe9ff; border-color: #22384f; }

.smodal { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; padding: 18px; }
.smodal[hidden] { display: none; }
.smodal-bg { position: absolute; inset: 0; background: rgba(4, 7, 11, .72); backdrop-filter: blur(3px); }
.smodal-card {
  position: relative; width: min(560px, 100%); max-height: min(82vh, 720px); overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); animation: smodal-in .16s ease-out;
}
@keyframes smodal-in { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
.smodal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--line-soft); position: sticky; top: 0;
  background: var(--panel); z-index: 1;
}
.smodal-head h2 { margin: 0; font-size: 15px; letter-spacing: .3px; }
.smodal-body { padding: 14px 16px 18px; }
.smodal-lead { margin: 0 0 14px; color: var(--dim); font-size: 12.5px; line-height: 1.55; }
.qr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.qr-item {
  background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: 12px;
  padding: 12px; text-align: center; display: flex; flex-direction: column; gap: 9px; align-items: center;
}
.qr-item img { width: 132px; height: 132px; border-radius: 8px; background: #fff; padding: 6px; display: block; }
.qr-item .qr-name { font-size: 12px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; color: var(--dim); }
.qr-item a.qr-link, .qr-item .qr-link {
  font-size: 11.5px; color: var(--accent-2); text-decoration: none; word-break: break-all;
}
.qr-item a.qr-link:hover { text-decoration: underline; }
.addr {
  font-family: var(--mono); font-size: 10.5px; color: var(--dim); word-break: break-all;
  background: var(--panel-3); border: 1px solid var(--line-soft); border-radius: 8px; padding: 7px 8px; width: 100%;
}
.copy-btn {
  font: inherit; font-size: 11px; font-weight: 600; color: var(--txt);
  background: var(--panel-3); border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 10px; cursor: pointer;
}
.copy-btn:hover { border-color: #2c3a4f; background: #1d293d; }
.smodal-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.smodal-actions a.cta {
  flex: 1 1 auto; text-align: center; text-decoration: none; font-size: 12.5px; font-weight: 700;
  padding: 11px 14px; border-radius: 10px; color: #071018; background: var(--accent-2);
}
.smodal-actions a.cta.alt { background: #5865f2; color: #fff; }
.smodal-actions a.cta:hover { filter: brightness(1.08); }
@media (max-width: 520px) {
  .qr-item img { width: 116px; height: 116px; }
}
