:root {
  --world-map-filter-width: clamp(280px, 23vw, 360px);
  --world-map-safe-top: env(safe-area-inset-top, 0px);
  --world-map-safe-bottom: env(safe-area-inset-bottom, 0px);
  --world-map-surface: rgba(7, 15, 26, 0.94);
  --world-map-surface-soft: rgba(9, 18, 32, 0.8);
  --world-map-panel:
    radial-gradient(circle at top left, rgba(112, 214, 255, 0.1), transparent 34%),
    linear-gradient(160deg, rgba(16, 29, 50, 0.97), rgba(7, 14, 27, 0.99));
  --world-map-panel-soft:
    linear-gradient(160deg, rgba(15, 28, 49, 0.92), rgba(8, 16, 31, 0.9));
}

.world-map-main,
.world-map-main *,
.world-map-main *::before,
.world-map-main *::after {
  box-sizing: border-box;
}

body.world-map-page {
  --shell-mobilebar-offset: 0px;
  overflow: hidden;
}

@media (max-width: 1080px) {
  body.world-map-page {
    --shell-mobilebar-offset: calc(72px + env(safe-area-inset-top, 0px));
  }
}

body.world-map-page .shell-layout {
  width: min(100% - 18px, 1760px);
  grid-template-columns: minmax(0, 1fr);
  padding-top: var(--shell-mobilebar-offset);
}

body.world-map-page .shell-main {
  min-width: 0;
}

body.world-map-page .shell-sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 39;
  display: block;
  background: rgba(1, 7, 16, 0.56);
  backdrop-filter: blur(4px);
}

body.world-map-page .shell-sidebar {
  position: fixed;
  inset: 10px auto 10px 10px;
  top: 10px;
  width: min(320px, calc(100vw - 20px));
  max-height: calc(100vh - 20px);
  z-index: 41;
  transform: translateX(calc(-100% - 12px));
  transition: transform 0.22s ease;
}

body.world-map-page .shell-sidebar.is-open {
  transform: translateX(0);
}

body.world-map-page .shell-sidebar-scroll {
  max-height: calc(100vh - 220px);
}

body.world-map-page .shell-sidebar-utility-row {
  display: none;
}

.world-map-main {
  position: relative;
  min-width: 0;
  height: calc(100dvh - 50px);
}

.world-map-shell {
  display: grid;
  grid-template-columns: minmax(0, var(--world-map-filter-width)) minmax(0, 1fr);
  gap: 14px;
  height: 100%;
  min-height: 0;
  align-items: stretch;
}

.world-map-filter,
.world-map-stage {
  min-width: 0;
  min-height: 0;
  border-radius: 28px;
  border: 1px solid var(--shell-line);
  box-shadow: var(--shell-shadow);
  overflow: hidden;
}

.world-map-filter {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  background: var(--world-map-panel);
  backdrop-filter: blur(14px);
}

.world-map-filter__top,
.world-map-filter__controls {
  padding-left: 14px;
  padding-right: 14px;
}

.world-map-filter__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 16px;
}

.world-map-filter__controls {
  padding-top: 10px;
}

.world-map-logo {
  display: block;
  width: min(100%, 205px);
  height: auto;
  object-fit: contain;
  object-position: left center;
}

.world-map-field-label {
  display: block;
  margin: 0 0 8px;
  color: var(--shell-muted);
  font-size: 13px;
}

.world-map-search,
.world-map-toolbar-field select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--shell-line);
  border-radius: 14px;
  padding: 0 14px;
  background: var(--world-map-surface);
  color: var(--shell-text);
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.world-map-search::placeholder {
  color: #88a1bc;
}

.world-map-search:focus,
.world-map-toolbar-field select:focus {
  border-color: rgba(112, 214, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(112, 214, 255, 0.12);
}

.world-map-action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.world-map-action-row button,
.world-map-icon-btn {
  border: 1px solid rgba(112, 214, 255, 0.18);
  border-radius: 14px;
  background:
    linear-gradient(155deg, rgba(22, 43, 72, 0.94), rgba(11, 22, 40, 0.9));
  color: #eef7ff;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.world-map-action-row button {
  min-height: 40px;
  padding: 0 14px;
  font-weight: 600;
}

.world-map-action-row button:hover,
.world-map-icon-btn:hover,
.world-map-group__header:hover {
  transform: translateY(-1px);
}

.world-map-summary {
  margin-top: 12px;
  padding: 11px 13px;
  border-radius: 14px;
  border: 1px solid var(--shell-line);
  background: var(--world-map-surface-soft);
  color: var(--shell-muted);
  font-size: 13px;
  line-height: 1.6;
}

.world-map-category-list {
  flex: 1;
  padding: 14px 12px 16px;
  overflow: auto;
}

.world-map-category-list::-webkit-scrollbar {
  width: 10px;
}

.world-map-category-list::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(112, 214, 255, 0.2);
  background-clip: padding-box;
}

.world-map-group {
  margin-bottom: 12px;
  border-radius: 18px;
  border: 1px solid var(--shell-line);
  background: linear-gradient(155deg, rgba(18, 34, 58, 0.94), rgba(10, 19, 36, 0.9));
  box-shadow: 0 16px 38px rgba(2, 8, 20, 0.2);
  overflow: hidden;
}

.world-map-group__header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid rgba(170, 214, 255, 0.08);
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.world-map-group.is-collapsed .world-map-group__header {
  border-bottom-color: transparent;
}

.world-map-group__title {
  min-width: 0;
}

.world-map-group__title strong {
  display: block;
  font-size: 15px;
}

.world-map-group__title span {
  display: block;
  margin-top: 4px;
  color: var(--shell-muted);
  font-size: 12px;
}

.world-map-group__arrow {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: var(--shell-muted);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  transform: rotate(90deg);
  transition: transform 0.18s ease;
}

.world-map-group.is-collapsed .world-map-group__arrow {
  transform: rotate(0deg);
}

.world-map-group__items {
  padding: 8px 7px 7px;
}

.world-map-group.is-collapsed .world-map-group__items {
  display: none;
}

.world-map-item {
  display: grid;
  grid-template-columns: 18px 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.world-map-item:hover {
  background: rgba(112, 214, 255, 0.08);
}

.world-map-item.is-active {
  background: linear-gradient(135deg, rgba(112, 214, 255, 0.18), rgba(148, 247, 216, 0.11));
}

.world-map-item__check {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid rgba(170, 214, 255, 0.28);
  color: transparent;
  background: rgba(9, 20, 33, 0.92);
  font-size: 12px;
}

.world-map-item.is-active .world-map-item__check {
  color: #06111d;
  border-color: rgba(148, 247, 216, 0.65);
  background: linear-gradient(135deg, var(--shell-accent), var(--shell-accent-2));
}

.world-map-item__icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(112, 214, 255, 0.08);
  overflow: hidden;
}

.world-map-item__icon img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.world-map-item__name {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
}

.world-map-item__count {
  min-width: 24px;
  justify-self: end;
  text-align: right;
  color: var(--shell-muted);
  font-size: 12px;
}

.world-map-empty,
.world-map-loading {
  padding: 28px 18px;
  border-radius: 18px;
  border: 1px dashed rgba(170, 214, 255, 0.24);
  background: linear-gradient(155deg, rgba(16, 31, 53, 0.94), rgba(11, 20, 37, 0.9));
  color: var(--shell-muted);
  text-align: center;
  line-height: 1.8;
}

.world-map-loading::before {
  content: "";
  display: block;
  width: 28px;
  height: 28px;
  margin: 0 auto 12px;
  border: 3px solid rgba(112, 214, 255, 0.18);
  border-top-color: var(--shell-accent);
  border-radius: 50%;
  animation: world-map-spin 0.9s linear infinite;
}

.world-map-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  background:
    radial-gradient(circle at 18% 16%, rgba(112, 214, 255, 0.08), transparent 24%),
    radial-gradient(circle at 82% 12%, rgba(145, 132, 255, 0.08), transparent 22%),
    linear-gradient(180deg, #050d17, #081423 48%, #091827 100%);
}

#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #08111d;
}

.leaflet-container {
  background: #08111d;
}

.world-map-toolbar {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 520;
  display: grid;
  grid-template-columns: minmax(0, max-content) minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--shell-line);
  border-radius: 16px;
  background: var(--world-map-panel-soft);
  box-shadow: 0 24px 60px rgba(2, 8, 20, 0.34);
  backdrop-filter: blur(14px);
}

.world-map-toolbar-field {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--shell-muted);
  font-size: 13px;
}

.world-map-toolbar-field select {
  width: 124px;
  min-height: 40px;
}

.world-map-toolbar-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  min-width: 0;
  justify-self: end;
}

.world-map-toolbar-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--shell-muted);
  font-size: 13px;
  min-width: 0;
}

.world-map-toolbar-check input {
  accent-color: var(--shell-accent);
}

.world-map-note-btn {
  min-height: 40px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(112, 214, 255, 0.2);
  border-radius: 14px;
  background:
    linear-gradient(155deg, rgba(19, 38, 64, 0.94), rgba(10, 20, 37, 0.92));
  color: #eef7ff;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.world-map-note-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(112, 214, 255, 0.36);
  box-shadow: 0 18px 34px rgba(2, 8, 20, 0.22);
}

.world-map-status {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 520;
  max-width: min(460px, calc(100% - 32px));
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--shell-line);
  background: rgba(10, 19, 36, 0.9);
  color: #f5fbff;
  box-shadow: 0 20px 54px rgba(2, 8, 20, 0.3);
  font-size: 13px;
  line-height: 1.6;
}

.world-map-icon-btn {
  min-height: 40px;
  min-width: 40px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
}

.world-map-backdrop,
.world-map-mobile-only {
  display: none;
}

.world-map-note-dialog {
  width: min(560px, calc(100% - 28px));
  border: 0;
  padding: 0;
  border-radius: 28px;
  background: transparent;
  color: inherit;
}

.world-map-note-dialog::backdrop {
  background: rgba(2, 8, 18, 0.72);
  backdrop-filter: blur(6px);
}

.world-map-note-dialog__shell {
  display: grid;
  gap: 18px;
  padding: 22px;
  border: 1px solid rgba(170, 214, 255, 0.18);
  border-radius: 28px;
  background:
    radial-gradient(circle at top right, rgba(112, 214, 255, 0.14), transparent 30%),
    linear-gradient(160deg, rgba(12, 24, 42, 0.98), rgba(6, 13, 26, 0.99));
  box-shadow: 0 28px 60px rgba(2, 8, 20, 0.46);
}

.world-map-note-dialog__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.world-map-note-dialog__head h2 {
  margin: 0;
  color: #f5fbff;
  font-size: 28px;
}

.world-map-note-dialog__close {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(170, 214, 255, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: #eef7ff;
  font: inherit;
  cursor: pointer;
}

.world-map-note-dialog__body {
  display: block;
}

.world-map-note-dialog__body p {
  margin: 0;
  color: #b8cde0;
  font-size: 14px;
  line-height: 1.8;
}

.world-map-note-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.world-map-note-dialog__link,
.world-map-note-dialog__confirm {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
}

.world-map-note-dialog__link {
  text-decoration: none;
  border: 1px solid rgba(112, 214, 255, 0.2);
  background: linear-gradient(135deg, rgba(112, 214, 255, 0.16), rgba(140, 247, 210, 0.12));
  color: #eefaff;
}

.world-map-note-dialog__confirm {
  border: 1px solid rgba(170, 214, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: #eef7ff;
  cursor: pointer;
}

.leaflet-control-zoom a,
.leaflet-control-layers {
  color: var(--shell-text);
}

.leaflet-control-zoom a {
  background: rgba(13, 24, 40, 0.9);
  border-bottom-color: rgba(170, 214, 255, 0.16);
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: rgba(14, 27, 47, 0.96);
  color: var(--shell-text);
}

.leaflet-popup-pane {
  z-index: 760;
}

.leaflet-popup-content {
  min-width: 220px;
  line-height: 1.6;
}

.leaflet-popup-content h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.leaflet-popup-content p {
  margin: 4px 0;
  color: #d4e3f2;
  font-size: 13px;
}

.leaflet-popup-content strong {
  color: #f5fbff;
}

.world-map-text-label {
  background: transparent;
  border: 0;
}

.world-map-text-label span {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(170, 214, 255, 0.18);
  background: rgba(8, 18, 31, 0.82);
  color: #eff7ff;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(2, 8, 20, 0.24);
}

.world-map-fallback-pin {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--shell-accent), var(--shell-accent-2));
  border: 2px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.22);
}

@keyframes world-map-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 980px) {
  .world-map-main {
    height: calc(100dvh - var(--shell-mobilebar-offset) - 20px);
  }

  .world-map-shell {
    display: block;
  }

  .world-map-stage {
    position: relative;
    z-index: 1;
    height: 100%;
    min-height: calc(100dvh - var(--shell-mobilebar-offset) - 20px);
  }

  .world-map-mobile-only {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .world-map-filter {
    position: fixed;
    top: calc(var(--shell-mobilebar-offset) + 10px);
    bottom: 10px;
    left: 10px;
    width: min(88vw, 320px);
    max-width: calc(100vw - 20px);
    border-radius: 24px;
    z-index: 2000;
    transform: translateX(calc(-100% - 14px));
    transition: transform 0.22s ease;
  }

  body.world-map-filter-open .world-map-filter {
    z-index: 2002;
    transform: translateX(0);
  }

  .world-map-backdrop {
    position: fixed;
    inset: 0;
    display: block;
    z-index: 1990;
    background: rgba(3, 8, 17, 0.58);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  body.world-map-filter-open .world-map-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .world-map-toolbar {
    top: 12px;
    left: 12px;
    right: 12px;
    z-index: 530;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px 12px;
    align-items: start;
    padding: 10px 12px;
  }

  .world-map-toolbar-field {
    width: 100%;
  }

  .world-map-toolbar-field {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: center;
  }

  .world-map-toolbar-field select {
    width: 100%;
  }

  .world-map-toolbar-check {
    min-height: 34px;
    font-size: 12px;
    line-height: 1.5;
  }

  .world-map-toolbar-meta {
    grid-column: 1 / -1;
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    margin-left: 0;
  }

  .world-map-note-btn {
    justify-self: end;
  }

  .world-map-status {
    left: 12px;
    right: 12px;
    bottom: calc(12px + var(--world-map-safe-bottom));
    z-index: 530;
    max-width: none;
    font-size: 12px;
  }

  .world-map-note-dialog {
    width: min(100% - 18px, 560px);
  }

  .world-map-note-dialog__shell {
    padding: 18px;
    border-radius: 24px;
  }

  .world-map-note-dialog__head h2 {
    font-size: 24px;
  }

  .world-map-note-dialog__actions {
    flex-direction: column;
  }

  .world-map-note-dialog__link,
  .world-map-note-dialog__confirm {
    width: 100%;
  }
}
