/*
 * Тема карты POLIT (Pl3xMap на map.majure.org) в стиле majure.org.
 * Подключается nginx на дедике (deploy/nginx/majure-site.conf, sub_filter перед </head>), файлы плагина не меняются,
 * поэтому тема переживает перезапуск и обновление Pl3xMap. Правка: этот файл -> коммит -> через пару минут на карте.
 * Классы и переменные взяты из веб-интерфейса Pl3xMap 1.21.11-544 (styles.css, src/control, src/sidebar).
 */
@import url("https://fonts.googleapis.com/css2?family=Golos+Text:wght@400;500;600&family=Unbounded:wght@600;700&display=swap");

:root,
:root:not([data-x]) {
  color-scheme: dark;

  --mj: #c45dfa;
  --mj-soft: rgba(196, 93, 250, 0.16);
  --mj-glow: 0 0 0 1px rgba(196, 93, 250, 0.45), 0 8px 30px -8px rgba(196, 93, 250, 0.55);

  --ui-font: "Golos Text", "Helvetica Neue", Arial, sans-serif;
  --ui-button-size: 4.4rem;
  --ui-element-spacing: 1.2rem;
  --ui-border-radius: 999px;
  --mj-glass: rgba(18, 18, 22, 0.55);
  --mj-glass-border: 1px solid rgba(255, 255, 255, 0.12);
  --mj-blur: blur(18px) saturate(140%);
  --ui-border: 1px solid rgba(255, 255, 255, 0.1);
  --ui-text-shadow: none;
  --ui-outline: solid rgba(196, 93, 250, 0.7) 0.2rem;
  --ui-box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.7);

  --ui-background: var(--mj-glass);
  --ui-background-disabled: var(--mj-glass);
  --ui-background-hover: rgba(40, 40, 48, 0.7);
  --ui-background-active: rgba(196, 93, 250, 0.22);
  --ui-background-selected: var(--mj);

  --ui-text: rgba(255, 255, 255, 0.85);
  --ui-text-hover: #ffffff;
  --ui-text-active: #ffffff;
  --ui-text-selected: #ffffff;
  --ui-text-disabled: rgba(255, 255, 255, 0.35);

  --ui-sidebar-width: 26rem;
}

html,
body {
  background: #09090b;
  font-family: var(--ui-font);
}

/* Пустые места карты (не прорисованные чанки) тёмные, как фон сайта, вместо синего «неба». */
.map,
.leaflet-container {
  background: #09090b !important;
}

/* Кнопки: тёмное стекло, тонкая рамка, скругление как у кнопок сайта. */
.leaflet-control-button,
#sidebar #sidebar__buttons button {
  border-radius: 999px;
  border: var(--mj-glass-border);
  background-color: var(--mj-glass);
  -webkit-backdrop-filter: var(--mj-blur);
  backdrop-filter: var(--mj-blur);
}

.leaflet-control-button,
#sidebar #sidebar__buttons button,
.leaflet-bar a,
.leaflet-touch .leaflet-bar a {
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

#sidebar #sidebar__buttons button:hover,
.leaflet-control-button:hover,
.leaflet-bar a:hover {
  box-shadow: var(--mj-glow);
}

#sidebar #sidebar__buttons button[aria-expanded="true"] {
  background-color: var(--mj);
  color: #fff;
  box-shadow: var(--mj-glow);
  font-weight: 600;
}

/* Плюс и минус: одна стеклянная таблетка, кнопки внутри прозрачные. */
.leaflet-bar,
.leaflet-touch .leaflet-bar {
  border-radius: 999px;
  overflow: hidden;
  border: var(--mj-glass-border);
  background: var(--mj-glass);
  -webkit-backdrop-filter: var(--mj-blur);
  backdrop-filter: var(--mj-blur);
  box-shadow: var(--ui-box-shadow);
}

.leaflet-bar a,
.leaflet-touch .leaflet-bar a,
.leaflet-bar a:first-child,
.leaflet-touch .leaflet-bar a:first-child,
.leaflet-bar a:last-child,
.leaflet-touch .leaflet-bar a:last-child {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  font-family: var(--ui-font);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
}

.leaflet-bar a:first-child {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.leaflet-bar a:hover,
.leaflet-touch .leaflet-bar a:hover {
  background: rgba(196, 93, 250, 0.22);
  color: #fff;
  box-shadow: none;
}

/* Предел приближения или отдаления: та же таблетка, знак приглушён (раньше серая заливка). */
.leaflet-bar a.leaflet-disabled,
.leaflet-touch .leaflet-bar a.leaflet-disabled {
  background: transparent !important;
  color: rgba(255, 255, 255, 0.28) !important;
}

/* Выбор мира убран: на карте только верхний мир (в config.yml включён только он). */
#sidebar #sidebar__buttons button[aria-controls="sidebar__worlds"],
#sidebar__worlds {
  display: none !important;
}

/* Кнопка «Ссылка на это место» убрана (просьба пользователя 09.10: лишняя, по нажатию просто перезагружала карту). */
.leaflet-control-link {
  display: none !important;
}

/* Плашка «Unknown block / Unknown biome» убрана (в config.yml ui.blockinfo пустой; здесь на всякий случай). */
.leaflet-control-blockinfo {
  display: none !important;
}

/* Плашки (координаты и т.п.). */
.leaflet-control-panel {
  background: var(--mj-glass);
  border: var(--mj-glass-border);
  border-radius: 999px;
  -webkit-backdrop-filter: var(--mj-blur);
  backdrop-filter: var(--mj-blur);
  box-shadow: var(--ui-box-shadow);
  padding: 0.6rem 2rem;
}

/* Координаты: подпись и числа одним блоком по центру таблетки. Высоты Y нет (в lang-ru.yml формат «<x>, <z>»),
   пробелы, которыми Pl3xMap выравнивает числа, схлопываются, поэтому строка не съезжает вбок. */
.leaflet-control-coordinates {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.9rem 2.4rem;
  white-space: nowrap;
  font-family: "Unbounded", var(--ui-font);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: 0.05rem;
  font-size: 1.5rem;
  line-height: 1.1;
  min-width: 17rem;
}

/* Ячейка Pl3xMap внизу по центру — треть ширины карты; на телефоне таблетка в неё не влезала и цифры вылезали.
   Таблетка шириной по цифрам, по центру ячейки (может выходить за её края). */
.leaflet-bottom.leaflet-center {
  justify-content: center;
  justify-items: center;
}

.leaflet-bottom.leaflet-center .leaflet-control-coordinates {
  width: max-content;
}

.leaflet-control-coordinates:before {
  font-family: var(--ui-font);
  color: rgba(255, 255, 255, 0.45);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.25rem;
  text-transform: uppercase;
  margin: 0;
}

/* Боковая панель (слои, игроки). */
#sidebar #sidebar__content {
  background: rgba(18, 18, 22, 0.6);
  -webkit-backdrop-filter: var(--mj-blur);
  backdrop-filter: var(--mj-blur);
  border: var(--mj-glass-border);
  border-radius: 2.4rem;
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.8);
  padding: 1.8rem 1.8rem;
  top: 0;
  height: calc(100vh - 2 * var(--ui-element-spacing));
}

#sidebar #sidebar__content h2 {
  font-family: "Unbounded", var(--ui-font);
  font-weight: 700;
  font-size: 2rem;
  line-height: 2.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05rem;
  color: #fff;
  margin-bottom: 1.4rem;
}

#sidebar #sidebar__content h3 {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.25rem;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

/* Пункты списков в панели (слои, игроки) как кнопки сайта. */
.menu input + label {
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.6);
  padding: 0.9rem 1.6rem;
  margin-bottom: 0.6rem;
  font-family: "Unbounded", var(--ui-font);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.03rem;
  box-shadow: none;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.menu input + label:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* Включённый слой: фиолетовое стекло (раньше сплошной светло-серый). */
.menu input:checked + label {
  background-color: rgba(196, 93, 250, 0.18);
  border-color: rgba(196, 93, 250, 0.55);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(196, 93, 250, 0.15), 0 6px 20px -10px rgba(196, 93, 250, 0.6);
}

/* Игроки: голова слева в круге пункта и при наведении, и у выбранного (раньше растягивалась на весь пункт). */
.menu input.players + label,
.menu input.players + label:hover,
.menu input.players:checked + label {
  border-radius: 999px;
  background-repeat: no-repeat;
  background-size: 2.8rem 2.8rem;
  background-position: 0.8rem center;
  padding-left: 4.6rem;
}

/* Полоса прокрутки панели. */
#sidebar__content::-webkit-scrollbar {
  width: 6px;
}

#sidebar__content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

/* Подпись внизу справа: вместо «Pl3xMap © 2020-2023» пишем «MAJURE © 2026» (просьба пользователя 09.10). */
.leaflet-control-attribution,
.leaflet-container .leaflet-control-attribution {
  background: rgba(18, 18, 22, 0.6) !important;
  color: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  padding: 0.2rem 0.9rem;
  font-family: var(--ui-font);
  font-size: 0 !important;
}

.leaflet-control-attribution > * {
  display: none !important;
}

.leaflet-control-attribution::after {
  content: "MAJURE © 2026";
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.05rem;
  color: rgba(255, 255, 255, 0.55);
}

.leaflet-control-attribution a,
.leaflet-control-attribution a:visited,
.leaflet-control-attribution a:active,
.leaflet-control-attribution a:hover {
  color: rgba(255, 255, 255, 0.55);
}

/* Крестик окна: круглая стеклянная кнопка внутри окна, а не на скруглённом углу. */
.leaflet-container a.leaflet-popup-close-button {
  top: 1.4rem;
  right: 1.4rem;
  width: 2.8rem;
  height: 2.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.75);
  font: 400 1.8rem/1 var(--ui-font);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.leaflet-container a.leaflet-popup-close-button:hover {
  background: rgba(196, 93, 250, 0.35);
  color: #fff;
}

.leaflet-container a.leaflet-popup-close-button span {
  margin-top: -0.2rem;
}

/* Подсказки и окна меток. */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip,
.leaflet-tooltip {
  background: rgba(18, 18, 22, 0.92);
  color: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--ui-box-shadow);
  font-family: var(--ui-font);
}

.leaflet-popup-content-wrapper {
  border-radius: 1.2rem;
}

.leaflet-tooltip {
  border-radius: 0.8rem;
}

.leaflet-tooltip-top:before {
  border-top-color: rgba(18, 18, 22, 0.92);
}

.leaflet-tooltip-bottom:before {
  border-bottom-color: rgba(18, 18, 22, 0.92);
}

.leaflet-tooltip-left:before {
  border-left-color: rgba(18, 18, 22, 0.92);
}

.leaflet-tooltip-right:before {
  border-right-color: rgba(18, 18, 22, 0.92);
}

@media (max-width: 640px) {
  :root {
    --ui-button-size: 4rem;
    --ui-element-spacing: 0.8rem;
  }

  .leaflet-control-coordinates {
    min-width: 0;
    padding: 0.7rem 1.8rem;
    font-size: 1.3rem;
    margin-bottom: 3.4rem !important;
  }
}

/* Окна и подсказки поверх голов и ников игроков (слой игроков Pl3xMap висит высоко). */
.leaflet-popup-pane {
  z-index: 2000 !important;
}

.leaflet-tooltip-pane {
  z-index: 1990 !important;
}

/* ===== Окна MajureMap и MapTowny (окно города: вариант D «две колонки», подсказка-таблетка; решения 09.10) ===== */
.leaflet-popup-content-wrapper:has(.mj-town),
.leaflet-popup-content-wrapper:has(.mj-wonder) {
  padding: 0;
  overflow: hidden;
  border-radius: 2.4rem;
  background: rgba(18, 18, 22, 0.72);
  -webkit-backdrop-filter: var(--mj-blur);
  backdrop-filter: var(--mj-blur);
}

.leaflet-popup-content:has(.mj-town),
.leaflet-popup-content:has(.mj-wonder) {
  margin: 0 !important;
  width: auto !important;
}

.mj-town,
.mj-wonder {
  width: 300px;
  font-family: var(--ui-font);
  font-size: 13px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.88);
}

.mj-band,
.mj-wonder-band {
  padding: 16px 56px 12px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.mj-band {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--mj-nation, #c45dfa) 55%, transparent),
    color-mix(in srgb, var(--mj-nation, #c45dfa) 12%, transparent) 70%);
}

.mj-wonder-band {
  background: linear-gradient(135deg, rgba(255, 184, 53, 0.55), rgba(255, 184, 53, 0.1) 70%);
}

.mj-title {
  font-family: "Unbounded", var(--ui-font);
  font-weight: 700;
  font-size: 18px;
  line-height: 1.2;
  color: #fff;
  word-break: break-word;
}

.mj-town {
  width: 470px;
}

/* Название и таблетка статуса в одну строку; длинное название переносит таблетку ниже. */
.mj-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.mj-head .mj-chip {
  margin: 0;
}

.mj-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
}

.mj-left {
  min-width: 0;
}

/* Колонка жителей высотой с левую часть, длинный список прокручивается. */
.mj-right {
  position: relative;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  padding: 12px;
}

.mj-people {
  position: absolute;
  top: 36px;
  bottom: 12px;
  left: 10px;
  right: 6px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

.mj-p {
  padding: 4px 8px;
  border-radius: 10px;
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mj-p:nth-child(odd) {
  background: rgba(255, 255, 255, 0.035);
}

.mj-mayor {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
  color: #ffe2a8;
}

.mj-mayor small {
  font-size: 10.5px;
  color: rgba(255, 226, 168, 0.7);
}

/* Подзаголовок раздела: «Чудеса · 3», «Жители · 12». */
.mj-h {
  margin: 0 0 6px 2px;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

.mj-sec {
  padding: 0 14px 12px;
}

/* Узкий экран: колонки друг под другом. */
@media (max-width: 540px) {
  .mj-town {
    width: calc(100vw - 32px);
  }

  /* Пока открыто окно города или чуда, кнопки по краям прячутся (иначе закрывают окно и крестик). */
  body:has(.mj-town, .mj-wonder) #sidebar,
  body:has(.mj-town, .mj-wonder) .leaflet-control-zoom {
    opacity: 0;
    pointer-events: none;
  }

  .mj-cols {
    grid-template-columns: 1fr;
  }

  .mj-right {
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
  }

  .mj-people {
    position: static;
    max-height: 160px;
  }
}

.mj-sub {
  margin-top: 3px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
}

.mj-kicker {
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 2px;
}

.mj-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px 14px;
}

.mj-tile {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  min-width: 0;
}

.mj-tile b {
  display: block;
  font-family: "Unbounded", var(--ui-font);
  font-size: 16px;
  color: #fff;
}

.mj-tile span {
  display: block;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.5);
  overflow-wrap: anywhere;
}

.mj-wide {
  grid-column: 1 / -1;
}

.mj-chips,
.mj-wonder-body {
  padding: 0 14px 12px;
}

.mj-wonder-body {
  padding-top: 12px;
}

.mj-chips:empty {
  display: none;
}

.mj-chip {
  display: inline-block;
  padding: 3px 10px;
  margin: 0 4px 4px 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  font-size: 12px;
}

.mj-chip-red {
  border-color: rgba(255, 90, 90, 0.5);
  background: rgba(255, 80, 80, 0.14);
  color: #ffb3b3;
}

.mj-chip-gold {
  border-color: rgba(255, 184, 53, 0.55);
  background: rgba(255, 184, 53, 0.16);
  color: #ffe2a8;
}

/* Подсказки при наведении: город, здание, чудо. */
.leaflet-tooltip:has(.mj-hover) {
  border-radius: 999px;
  padding: 6px 14px;
  background: rgba(18, 18, 22, 0.72);
  -webkit-backdrop-filter: var(--mj-blur);
  backdrop-filter: var(--mj-blur);
}

.mj-hover {
  font-family: var(--ui-font);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.85);
}

.mj-hover b {
  font-weight: 700;
  color: #fff;
}

.mj-hover-gold b {
  color: #ffe2a8;
}

.mj-dim {
  color: rgba(255, 255, 255, 0.5);
}
