:root {
  --bg-color: #111;
  --bg-color-overlay: rgba(17,17,17,0.92);
  --bg-color-btn: rgba(255,255,255,0.10);
  --bg-color-btn-hover: rgba(255,255,255,0.14);
  --text-color: #fff;
  --text-subtitle-color: rgba(255,255,255,0.75);
  --border-color: rgba(255,255,255,0.18);
  --shadow-color: rgba(0,0,0,0.45);
  --border-color-hover: rgba(255,255,255,0.35);
  --accent-color: rgb(251, 196, 46);
  --accent-color-hover: rgba(251, 196, 4, 0.16);
  --accent-color-border: rgba(251, 196, 4, 0.45);
  --accent-color-text: #fff;
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: light) {
  :root {
      --bg-color: #efefef;
      --bg-color-overlay: rgb(229 229 229 / 92%);
      --bg-color-btn: rgba(0,0,0,0.10);
      --bg-color-btn-hover: rgba(0,0,0,0.14);
      --text-color: #000000;
      --text-subtitle-color: rgba(0,0,0,0.75);
      --border-color: rgb(0 0 0 / 18%);
      --shadow-color: rgb(255 255 255 / 45%);
      --border-color-hover: rgb(0 0 0 / 35%);
      --accent-color: rgb(0, 155, 90);
      --accent-color-hover: rgba(0, 155, 90, 0.16);
      --accent-color-border: rgba(0, 155, 90, 0.45);
      --accent-color-text: #000000;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #111;
    --bg-color-overlay: rgba(17,17,17,0.92);
    --bg-color-btn: rgba(255,255,255,0.10);
    --bg-color-btn-hover: rgba(255,255,255,0.14);
    --text-color: #fff;
    --text-subtitle-color: rgba(255,255,255,0.75);
    --border-color: rgba(255,255,255,0.18);
    --shadow-color: rgba(0,0,0,0.45);
    --border-color-hover: rgba(255,255,255,0.35);
    --accent-color: rgb(251, 196, 4);
    --accent-color-hover: rgba(251, 196, 4, 0.16);
    --accent-color-border: rgba(251, 196, 4, 0.45);
    --accent-color-text: #fff;
  }
}

/* hebrew */
@font-face {
  font-family: 'Varela Round';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(w8gdH283Tvk__Lua32TysjIfpcuPP9g.woff2) format('woff2');
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
/* vietnamese */
@font-face {
  font-family: 'Varela Round';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(w8gdH283Tvk__Lua32TysjIfqMuPP9g.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
  font-family: 'Varela Round';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(w8gdH283Tvk__Lua32TysjIfqcuPP9g.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Varela Round';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(w8gdH283Tvk__Lua32TysjIfp8uP.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

html, body { height: 100%; }
body {
  margin: 0;
  /* font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; */
  font-family: "Varela Round", sans-serif;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

button {
  font-family: "Varela Round", sans-serif;
}

input[type="range"] {
  accent-color: var(--accent-color);
}

input[type="radio"] {
  accent-color: var(--accent-color-border);
}

#header {
  padding: 10px 12px;
  color: var(--text-color);
  font-size: 18px;
  font-weight: 1000;
  -webkit-text-stroke: 4px var(--bg-color);
  text-stroke: 4px var(--bg-color);
  paint-order: stroke fill;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
  background-image: url('./header_bg.png');
  background-size: auto 100%;
  background-position: center;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  background-color: var(--bg-color);
  cursor: pointer;
}

#topbar {
  padding: 10px 12px;
  background: var(--bg-color);
  color: var(--text-color);
  font-size: 14px;
  display: flex;
  gap: 12px;
  flex-wrap: nowrap;
  align-items: flex-start;
  position: relative;
  /* overflow: hidden; */
}

#topbarPills {
  display: flex;
  gap: 12px;
  flex-wrap: nowrap;
  align-items: center;
  flex: 1;
  min-width: 0; /* важно, чтобы работал overflow-x */
  overflow-x: auto;
}

#topbarMenu {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
}

#map { flex: 1; width: 100vw; min-height: 200px; }

#timebar {
  padding: 10px 12px;
  padding-bottom: calc(10px + var(--safe-area-bottom));
  background: var(--bg-color);
  color: var(--text-color);
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.info.legend {
  background: var(--bg-color-overlay);
  color: var(--text-color);
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  font-size: 12px;
  max-width: 330px;
  width: fit-content;
}

.legendTitle {
  font-weight: 650;
  margin-bottom: 6px;
}

.legendContent {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: flex-start;
}

.legendItem {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: fit-content;
}

.legendItemSwatch {
  width: 18px;
  height: 18px;
  display: inline-block;
  background: currentColor;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.legendItemText {
  font-size: 11px;
  opacity: 0.95;
  line-height: 1;
}

.leaflet-control-attribution {
  display: none;
}

.pill {
  background: var(--bg-color-btn);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.pill.time {
  flex: 1;
  width: 100%;
  max-width: 100%;
  min-width: 300px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}
.pill.time .timeTop {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.pill.time input[type="range"] {
  width: 100%;
}

.clickableTime {
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.dtPicker {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2000;
  width: min(560px, calc(100vw - 36px));
  max-height: min(70vh, 680px);
  max-height: min(70dvh, 680px);
  overflow: auto;
  background: var(--bg-color-overlay);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 18px 50px var(--shadow-color);
  color: var(--text-color);
  padding: 14px;
}
.dtPicker .title {
  font-weight: 800;
  margin-bottom: 10px;
}
.subtitle {
  font-weight: 650;
  margin: 14px 0 8px;
  color: var(--text-subtitle-color);
}
.dtPicker .grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settingsBtn {
  padding: 5px 10px !important;
  font-size: 18px;
  line-height: 1;
}

.menu {
  position: absolute;
  top: 54px;
  right: 10px;
  width: min(520px, calc(100vw - 46px));
  color: var(--text-color);
  background: var(--bg-color-overlay);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 18px 50px var(--shadow-color);
  z-index: 1100;
}
.menu .content {
  max-height: calc(100vh - 210px);
  max-height: calc(100dvh - 210px - var(--safe-area-bottom));
  overflow-y: auto;
}
.menu .close {
  position: absolute;
  top: 10px;
  right: 10px;
  cursor: pointer;
  font-size: 18px;
  z-index: 1110;
}

.menuSection + .menuSection {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--bg-color-btn);
}
.menuTitle {
  font-weight: 700;
  margin-bottom: 10px;
}
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.btnList {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.btn {
  appearance: none;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-color);
  background: var(--bg-color-btn);
}
.btn.active {
  background: var(--accent-color-hover);
  border-color: var(--accent-color-border);
}
.btn.inactive {
  opacity: 0.65;
}

.radioList {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.radioList label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.tokenHelp {
  opacity: 0.75;
  font-size: 12px;
  margin-top: 10px;
}
.tokenRow input {
  width: min(340px, 100%);
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-color-btn);
  color: var(--text-color);
  outline: none;
}
.smallBtn {
  appearance: none;
  border: 1px solid var(--border-color);
  background: var(--bg-color-btn);
  color: var(--text-color);
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
}

.addTopGap {
  margin-top: 10px;
}

/* ===== Описание карты - окошко в центре страницы ===== */
.about {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2000;
  background: var(--bg-color-overlay);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 13px;
  width: min(520px, calc(100vw - 46px));
  box-shadow: 0 18px 50px var(--shadow-color);
}
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 1999;
}
.about .close {
  position: absolute;
  top: 10px;
  right: 10px;
  cursor: pointer;
  font-size: 18px;
}

.about a {
  color: var(--accent-color);
  text-decoration: none;
}
.about a:hover {
  text-decoration: underline;
}

.about .content {
  padding: 10px 12px;
  max-height: min(520px, calc(100vh - 108px));
  max-height: min(520px, calc(100dvh - 108px - var(--safe-area-bottom)));
  overflow-y: auto;
}

/* Кастомная прокрутка */
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
  border-radius: 10px;
}
*::-webkit-scrollbar-track {
  background: var(--bg-color-overlay);
  border-radius: 10px;
}
*::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 10px;
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--border-color-hover);
  border-radius: 10px;
}

.about .content h1 {
  font-size: 24px;
  font-weight: 600;
  margin-top: 10px;
  margin-bottom: 10px;
}
.about .content h2 {
  font-size: 18px;
  font-weight: 600;
  margin-top: 10px;
  margin-bottom: 10px;
}

.about .content p {
  font-size: 13px;
  margin-bottom: 0;
}

/* ===== Статусы (toast) снизу слева карты ===== */
.toast {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 2000;
  background: var(--bg-color-overlay);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 13px;
  max-width: min(520px, calc(100vw - 46px));
  box-shadow: 0 18px 50px var(--shadow-color);
  pointer-events: none;
}

/* ===== Leaflet UI в стиле pill ===== */
.leaflet-control-zoom a {
  background: var(--bg-color-overlay) !important;
  color: var(--text-color) !important;
  border: 1px solid var(--border-color) !important;
  /* border-radius: 12px !important; */
  width: 38px !important;
  height: 38px !important;
  line-height: 38px !important;
  font-size: 20px !important;
  box-shadow: 0 18px 50px rgba(0,0,0,0.25) !important;
}
.leaflet-control-zoom a:first-child {
  border-top-left-radius: 12px !important;
  border-top-right-radius: 12px !important;
}
.leaflet-control-zoom a:last-child {
  border-bottom-left-radius: 12px !important;
  border-bottom-right-radius: 12px !important;
}
.leaflet-control-zoom a:hover {
  border-color: var(--border-color-hover) !important;
}
.leaflet-bar {
  border: none !important;
}

.leaflet-control-locate-nearest {
  margin-top: 10px !important;
}
.leaflet-control-locate-nearest a,
.leaflet-control-search-nearest a {
  display: block;
  background: var(--bg-color-overlay) !important;
  color: var(--text-color) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 12px !important;
  width: 38px !important;
  height: 38px !important;
  line-height: 38px !important;
  font-size: 19px !important;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 18px 50px rgba(0,0,0,0.25) !important;
}
.leaflet-control-search-nearest {
  margin-top: 10px !important;
}
.leaflet-control-search-nearest a {
  font-size: 30px !important;
}
.leaflet-control-locate-nearest a:hover,
.leaflet-control-search-nearest a:hover {
  border-color: var(--border-color-hover) !important;
}
.leaflet-control-locate-nearest a.is-loading,
.leaflet-control-search-nearest a.is-loading {
  opacity: 0.65;
  cursor: progress;
}

.locationSearchPicker {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2000;
  width: min(560px, calc(100vw - 36px));
  background: var(--bg-color-overlay);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 18px 50px var(--shadow-color);
  color: var(--text-color);
  padding: 14px;
}
.locationSearchPicker .title {
  font-weight: 800;
  margin-bottom: 10px;
}
.locationSearchPicker .subtitle {
  margin-top: 0;
}
.locationSearchPicker .close {
  position: absolute;
  top: 10px;
  right: 10px;
  cursor: pointer;
  font-size: 18px;
  z-index: 1110;
}
.locationSearchForm input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-color-btn);
  color: var(--text-color);
  outline: none;
}
.locationSearchActions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--bg-color-overlay) !important;
  color: var(--text-color) !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: 0 18px 50px rgba(0,0,0,0.35) !important;
}
.leaflet-popup-content-wrapper {
  border-radius: 14px !important;
}
.leaflet-popup-close-button {
  color: var(--text-subtitle-color) !important;
  /* font: 18px / 24px Tahoma, Verdana, sans-serif !important; */
  font: 18px / 24px "Varela Round", sans-serif !important;
}
.leaflet-popup-close-button:hover {
  color: var(--text-color) !important;
}
.leaflet-popup-content {
  margin: 12px 14px !important;
  /* font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif !important; */
  font-family: "Varela Round", sans-serif !important;
}
.leaflet-control-scale-line {
  border: 2px solid var(--bg-color) !important;
  border-bottom: none !important;
  line-height: 1.3 !important;
  padding: 2px 5px 1px !important;
  white-space: nowrap !important;
  -moz-box-sizing: border-box !important;
  box-sizing: border-box !important;
  background: var(--border-color);
  text-shadow: none !important;
  color: var(--text-color) !important;
  -webkit-text-stroke: 3px var(--bg-color) !important;
  text-stroke: 3px var(--bg-color) !important;
  paint-order: stroke fill !important;
  text-align: center !important;
  /* font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif !important; */
  font-family: "Varela Round", sans-serif !important;
  font-size: 14px !important;
  font-weight: 600 !important;
}
.leaflet-container {
  font-family: "Varela Round", sans-serif !important;
}

/* ===== Иконка точки ===== */
.am-marker svg { cursor: pointer; }

/* Переменная для смещения */
.am-marker svg { --shift: 0px; }
.am-marker svg:hover { --shift: 20px; }
.am-marker circle.colored { stroke: rgb(233, 233, 114); }
.am-marker .arrow-back {
  stroke: rgb(233, 233, 114);
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 16px;
}

.am-marker svg.active { --shift: 0px; }
.am-marker svg.active:hover { --shift: 0px; }
.am-marker svg.active circle.colored { stroke: rgb(111, 231, 147); }
.am-marker svg.active .arrow-back { stroke: rgb(111, 231, 147); }

/* Групповая (кластерная) иконка */
.am-marker svg.group circle.colored { stroke: rgb(233, 233, 114); }
.am-marker svg.group .arrow-back { stroke: rgb(233, 233, 114); }
.am-marker svg.group text.count {
  /* font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; */
  font-family: "Varela Round", sans-serif;
  font-weight: 800;
  font-size: 64px;
  fill: #fff;
  paint-order: stroke;
  stroke: rgba(0,0,0,0.55);
  stroke-width: 10px;
}

.am-marker .arrow-group {
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: 100px 100px;
}

.am-marker .arrow-path {
  stroke: #000;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 6px;
}

/* ===== Popup со списком вариантов при совпадении координат ===== */
.variants {
  /* font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; */
  font-family: "Varela Round", sans-serif;
  font-size: 13px;
  max-width: min(360px, calc(100vw - 46px));
}
.variants .title {
  font-weight: 650;
  margin-bottom: 8px;
}
.variants .list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: min(520px, calc(100vh - 108px));
  max-height: min(520px, calc(100dvh - 108px - var(--safe-area-bottom)));
  overflow-y: auto;
}
.variants button.active {
  background: var(--accent-color-hover);
  border-color: var(--accent-color-border);
}
.variants button.active:hover {
  background: var(--accent-color-hover);
  border-color: var(--accent-color-border);
}
.variants button {
  appearance: none;
  border: 1px solid var(--border-color);
  background: var(--bg-color-btn);
  color: var(--text-color);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
  line-height: 1.2;
}
button:hover {
  background: var(--bg-color-btn-hover);
  border-color: var(--border-color-hover);
}
.variants .meta {
  opacity: 0.75;
  font-size: 12px;
  margin-top: 3px;
}
.hidden {
  display: none !important;
}
.person {
	display: block;
	text-align: left;
	width: fit-content;
	height: 6em;
	margin: 1em auto 0 auto;
}
.person div.contact {
	display: inline-block;
	vertical-align: middle;
}
.person div.logo {
	display: inline-block;
	vertical-align: middle;
	width: 5.2em;
	height: 6em;
	background-color: currentColor;
	-webkit-mask-image: url(../../images/Garic-Che_logo.svg);
	mask-image: url(../../images/Garic-Che_logo.svg);
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
}