:root {
  --bg: #09090b;
  --surface: #232327;
  --surface-2: #303036;
  --line: rgba(255,255,255,.1);
  --text: #f0efed;
  --muted: #a8aab2;
  --pink: #ff4fa3;
  --teal: #2ee6d6;
  --yellow: #ffd166;
  --radius: 14px;
  --top-h: 56px;
  --panel-w: 320px;
  --panel-bg: #0e0e12;
  --card-bg: #131317;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 Geist, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--text); }

.muted { color: var(--muted); }

/* Top bar */
.top {
  position: fixed; inset: 0 0 auto 0; height: var(--top-h); z-index: 1000;
  display: flex; align-items: center; gap: 8px; padding: 0 12px;
  padding-top: env(safe-area-inset-top);
  background: rgba(9,9,11,.96);
  border-bottom: 1px solid var(--line);
}
.brand { font-size: 17px; white-space: nowrap; letter-spacing: .2px; margin-right: auto; }
.brand b {
  background: linear-gradient(90deg, var(--pink), var(--teal));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.btn {
  height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--pink); border-color: var(--pink); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.jar { background: var(--yellow); border-color: var(--yellow); color: #1a1300; font-weight: 600; }
.btn.on { border-color: var(--teal); color: var(--teal); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.acct svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; flex: none; }
.btn.acct img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; flex: none; }
.btn.acct.in { padding: 0 6px; }
.btn.acct.in span { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }

/* Sign-in dialog */
.auth #authOut, .auth #authIn { display: grid; gap: 10px; }
.auth [hidden] { display: none !important; }
.auth .muted { margin: 0 0 4px; font-size: 14px; line-height: 1.45; }
.btn.prov { height: 44px; justify-content: center; font-weight: 600; gap: 10px; }
.btn.prov svg { width: 20px; height: 20px; flex: none; }
.auth .small { font-size: 13px; margin: 0; text-align: center; }
.auth .small a { color: var(--teal); }
.auth h3 { margin: 6px 0 0; font-size: 14px; color: var(--muted); font-weight: 600; }
.subs { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 220px; overflow: auto; }
.subs li { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 14px; }
.subs li b { font-weight: 600; margin-right: 8px; }
.subs a { color: var(--teal); font-size: 13px; }
.st { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; border: 1px solid currentColor; }
.st-new { color: var(--yellow); }
.st-added { color: var(--teal); }
.st-rejected { color: var(--muted); }
#adminLink { justify-content: center; text-decoration: none; color: var(--teal); border-color: var(--teal); }
.spot-ring {
  width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--pink);
  box-shadow: 0 0 0 4px rgba(255,79,163,.25); pointer-events: none;
}

/* Map */
#map {
  position: fixed; top: var(--top-h); left: 0; right: 0; bottom: 0;
  background: #2f90b0; /* sea colour of the tiles */
}
.ol-viewport { font: inherit; }
.ol-viewport.county-pointer, .ol-viewport.pin-hover { cursor: pointer; }
/* Zoom buttons, top right */
.ol-zoom { top: 12px; right: 12px; left: auto; background: none; padding: 0; }
.ol-zoom button {
  width: 34px; height: 34px; margin: 0; font: 600 20px/1 system-ui, sans-serif;
  background: var(--card-bg); color: #fff; border: 1px solid var(--line); border-radius: 0;
}
.ol-zoom .ol-zoom-in { border-radius: 4px 4px 0 0; }
.ol-zoom .ol-zoom-out { border-radius: 0 0 4px 4px; border-top: 0; }
.ol-zoom button:hover, .ol-zoom button:focus-visible { background: var(--surface); color: #fff; outline: none; }
/* Pin name on hover */
.pin-tip {
  padding: 4px 8px; border-radius: 4px; white-space: nowrap; pointer-events: none;
  background: rgba(19,19,23,.94); color: #fff; font-size: 13px; font-weight: 600;
  box-shadow: 0 2px 6px rgba(0,0,0,.4);
}
/* Category icon: a white symbol cut from the icon file */
.gi {
  display: block; width: 70%; height: 70%; background: #fff;
  -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat;
}
.ic:has(.gi) { background: var(--c); }
.gb { display: block; width: 100%; height: 100%; object-fit: contain; }
.ic:has(.gb) { border: 0 !important; background: none; }


/* Counties: hover dimming, frames and names are drawn on the map canvas (app.js) */

/* Menu: a left drawer with a "Меню" tab, on phones too */
.panel {
  position: fixed; top: var(--top-h); bottom: 0; left: 0; z-index: 1000;
  width: min(var(--panel-w), calc(100vw - 48px));
  transition: transform .25s ease;
}
.panel.collapsed { transform: translateX(-100%); }
.panel-in {
  height: 100%; display: flex; flex-direction: column;
  background: var(--panel-bg); border-right: 1px solid var(--line);
  box-shadow: 8px 0 30px rgba(0,0,0,.35);
  padding-bottom: env(safe-area-inset-bottom);
}
.panel.collapsed .panel-in { box-shadow: none; visibility: hidden; transition: visibility 0s .25s; }
.menu-tab {
  position: absolute; left: 100%; top: 50%; transform: translateY(-50%);
  width: 34px; padding: 12px 0 14px; display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: var(--panel-bg); border: 1px solid var(--line); border-left: 0; border-radius: 0 12px 12px 0;
  box-shadow: 6px 0 16px rgba(0,0,0,.3);
}
.menu-tab:hover { background: var(--surface); }
.menu-tab svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.menu-tab span { writing-mode: vertical-rl; font-size: 13px; letter-spacing: .03em; }
.menu-tab .dot { position: absolute; top: 6px; right: 6px; width: 9px; height: 9px; border-radius: 50%; background: #ff3b47; }
.menu-tab .dot[hidden] { display: none; }
/* no-anim: the start state is set without sliding */
.panel.no-anim, .panel.no-anim .panel-in { transition: none !important; }
@media (prefers-reduced-motion: reduce) { .panel, .panel.collapsed .panel-in { transition: none; } }

.panel-top { flex: none; display: grid; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.psearch { position: relative; display: block; }
.psearch svg { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; margin-top: -8px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
#search {
  width: 100%; height: 40px; padding: 0 12px 0 36px;
  background: transparent; border: 1px solid var(--line); border-radius: 8px; outline: none;
}
#search:focus { border-color: rgba(255,255,255,.3); }
.ptools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pbtn { height: 36px; border: 1px solid var(--line); border-radius: 8px; background: transparent; font-size: 14px; }
.pbtn:hover { background: var(--surface); }
.tgl {
  height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 15px;
}
.tgl:hover { color: var(--text); }
.tgl[aria-pressed="true"] { background: var(--surface-2); color: var(--text); }
.tgl .box { width: 16px; height: 16px; border-radius: 4px; border: 2px solid currentColor; display: grid; place-items: center; }
.tgl[aria-pressed="true"] .box { background: #3bb273; border-color: #3bb273; }
.tgl[aria-pressed="true"] .box::after { content: ""; width: 4px; height: 9px; margin-top: -2px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.tgl svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.tgl[aria-pressed="true"] svg { fill: var(--pink); stroke: var(--pink); }

.panel-main { flex: 1; min-height: 0; display: flex; }
.rail {
  flex: none; width: 44px; overflow-y: auto; scrollbar-width: none;
  display: flex; flex-direction: column; gap: 4px; padding: 8px 6px; border-right: 1px solid var(--line);
}
.rail::-webkit-scrollbar { display: none; }
.rail button {
  flex: none; width: 32px; height: 32px; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: none; color: var(--muted);
}
.rail button:hover { color: var(--text); }
.rail button.active { background: var(--surface-2); color: var(--text); }
.rail svg { width: 18px; height: 18px; fill: currentColor; }
.panel-body { flex: 1; min-width: 0; overflow-y: auto; padding: 4px 10px 16px; overscroll-behavior: contain; }

.grp { padding-bottom: 6px; }
.grp-head { display: flex; align-items: center; gap: 4px; height: 36px; margin-bottom: 4px; }
.grp-fold {
  flex: 1; min-width: 0; height: 100%; display: flex; align-items: center; gap: 6px; padding: 0 8px;
  border: 0; background: none; color: var(--muted); text-align: left;
  font-size: 12px; font-weight: 600; line-height: 1; letter-spacing: .05em; text-transform: uppercase;
}
.grp-fold:hover { color: var(--text); }
.grp-fold svg { flex: none; width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; transition: transform .15s; }
.grp.folded .grp-fold svg { transform: rotate(-90deg); }
.grp.folded .cats { display: none; }
.grp-fold span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eye { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--text); }
.eye:hover { background: var(--surface); }
.eye svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.eye.part { opacity: .6; }
.eye.off { color: var(--muted); }
.cats { display: grid; gap: 4px; }
.cat {
  width: 100%; min-height: 36px; display: flex; align-items: center; gap: 10px; padding: 4px 10px;
  border: 0; border-radius: 8px; background: var(--surface); text-align: left;
}
.cat:hover { background: var(--surface-2); }
.cat.off { opacity: .4; }
.cat.off:hover { opacity: .7; }
.cat .ic { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; }
.cat .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat .n { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.results-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 0 6px; color: var(--muted); font-size: 13px; }
.results-head button { border: 0; background: none; color: var(--teal); font-size: 13px; padding: 4px 0; }
.pfoot { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.credit { font-size: 12px; margin: 8px 0 0; }
.credit a { color: var(--teal); }

@media (min-width: 820px) {
  .top .btn span { display: inline; }
}
@media (max-width: 560px) {
  .top .btn span { display: none; }
  .brand { font-size: 15px; }
  .brand { max-width: 92px; white-space: normal; line-height: 1.1; }
}

/* Progress */
.progress-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.progress-head strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.bar { height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; margin: 8px 0 12px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--pink), var(--teal)); }
.tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.tools .btn { height: 34px; font-size: 14px; }

/* List */
.list { list-style: none; margin: 0; padding: 0; }
.item {
  display: flex; align-items: center; gap: 10px; padding: 7px 8px; margin: 0 -8px;
  border-radius: 8px; cursor: pointer;
}
.item:hover { background: var(--surface-2); }
.item .ic { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--c); font-size: 13px; }
.item .t { flex: 1; min-width: 0; }
.item .t b { display: block; font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .t span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item.found .t b { text-decoration: line-through; color: var(--muted); }
.item .ok { color: var(--teal); font-size: 13px; }
.empty { padding: 24px 0; text-align: center; color: var(--muted); }

/* Point popup: a card above the marker */
.point-pop { position: relative; width: 288px; max-width: calc(100vw - 32px); }
.point-pop .pop-wrap {
  padding: 0; border-radius: 8px; overflow: hidden;
  background: var(--card-bg); color: var(--text); border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(0,0,0,.55);
}
.point-pop .pop-content { margin: 0; font-size: 14px; line-height: 1.45; }
.point-pop .pop-tip-wrap { position: absolute; left: 50%; bottom: -12px; width: 28px; height: 13px; margin-left: -14px; overflow: hidden; pointer-events: none; }
.point-pop .pop-tip { width: 16px; height: 16px; margin: -9px auto 0; transform: rotate(45deg); background: var(--card-bg); border: 1px solid rgba(255,255,255,.1); }
.point-pop .pop-close {
  position: absolute; top: 8px; right: 8px; padding: 0; cursor: pointer; width: 26px; height: 26px; z-index: 1;
  display: grid; place-items: center; font: 400 18px/1 system-ui, sans-serif;
  color: #fff; background: rgba(0,0,0,.55); border: 0; border-radius: 50%;
}
.point-pop .pop-close:hover { color: #fff; background: #000; }
.pp-photo { display: block; background: var(--bg); }
.pp-photo img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.pp-body { padding: 12px 14px 10px; max-height: min(44vh, 380px); overflow-y: auto; }
.pp-body h3 {
  margin: 0 30px 4px 0; font-size: 17px; font-weight: 600; line-height: 1.3;
}
.pp-photo + .pp-body h3 { margin-right: 0; }
.pp-cat { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.pp-cat .ic { flex: none; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; }
.pp-area { color: var(--muted); font-size: 13px; margin-top: 2px; }
.pp-body p { margin: 8px 0; color: rgba(240,239,237,.85); }
.pp-body p a { color: var(--teal); }
.pp-found {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  margin: 10px 0 6px; padding: 0 12px; height: 36px; background: none;
  border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; font-weight: 500;
}
.pp-found:hover { border-color: rgba(255,255,255,.25); }
.pp-found .box { width: 16px; height: 16px; border: 2px solid var(--muted); border-radius: 4px; display: grid; place-items: center; }
.pp-found.on { border-color: var(--teal); color: var(--teal); }
.pp-found.on .box { background: var(--teal); border-color: var(--teal); }
.pp-found.on .box::after { content: ""; width: 4px; height: 8px; margin-top: -2px; border: solid var(--bg); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.pp-votes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pp-votes .btn { justify-content: center; height: 32px; font-size: 13px; border-radius: 8px; }
.pp-src { font-size: 12px; color: var(--muted); margin-top: 8px; }
.pp-src a { color: var(--text); font-weight: 600; text-decoration: none; }
.pp-src a:hover { text-decoration: underline; }
.pp-foot {
  display: flex; align-items: center; gap: 6px; padding: 0 14px 12px;
}
.pp-ic, .pp-nav button {
  width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; background: none; color: var(--muted);
}
.pp-ic:hover, .pp-nav button:hover:not(:disabled) { background: rgba(255,255,255,.08); color: var(--text); }
.pp-ic svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.pp-ic.on svg { fill: var(--pink); stroke: var(--pink); }
.pp-nav { margin-left: auto; display: flex; align-items: center; gap: 0; }
.pp-nav button { width: 24px; font-size: 20px; line-height: 1; padding-bottom: 2px; border: 0; }
.pp-nav button:disabled { opacity: .35; cursor: default; }
.pp-nav b { white-space: nowrap; font-size: 13px; font-weight: 600; line-height: 1; color: var(--muted); font-variant-numeric: tabular-nums; }
.item.active { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--teal); }
.reward {
  font-size: 20px; font-weight: 700; color: var(--yellow); margin: 8px 0;
}
.facts { display: grid; gap: 8px; margin: 10px 0; }
.fact { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.fact small { display: block; color: var(--muted); font-size: 12px; }
.code { font: 700 22px/1.2 ui-monospace, Menlo, monospace; letter-spacing: 3px; }
.status { font-size: 13px; padding: 8px 12px; border-radius: 10px; background: var(--bg); margin: 10px 0; }
.status.warn { color: var(--yellow); }
.status.good { color: var(--teal); }

/* Dialog */
dialog {
  width: min(460px, calc(100vw - 24px)); max-height: calc(100vh - 24px);
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text); padding: 20px;
}
dialog::backdrop { background: rgba(0,0,0,.7); }
dialog h2 { margin: 0 0 4px; }
dialog form { display: grid; gap: 10px; }
dialog label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
dialog input, dialog select, dialog textarea {
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; outline: none;
}
dialog input:focus, dialog select:focus, dialog textarea:focus { border-color: var(--teal); }
.row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.pick { display: flex; align-items: center; gap: 10px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; }

.pick-banner {
  position: fixed; top: calc(var(--top-h) + 12px); left: 50%; transform: translateX(-50%);
  z-index: 1100; background: var(--pink); color: #fff; padding: 10px 16px; border-radius: 999px; font-weight: 600;
  box-shadow: 0 6px 20px rgba(0,0,0,.4);
}

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 40px); opacity: 0;
  z-index: 2000; background: #fff; color: #09090b; padding: 10px 16px; border-radius: 999px;
  font-weight: 600; transition: .2s; pointer-events: none; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

.ol-attribution {
  right: 0; bottom: 0; max-width: calc(100% - 16px); border-radius: 6px 0 0 0;
  background: rgba(9,9,11,.75); color: var(--muted); font-size: 11px;
}
.ol-attribution ul { color: var(--muted); text-shadow: none; padding: 2px 6px; font-size: 11px; }
.ol-attribution a { color: var(--teal); }
