@font-face {
  font-family: 'JH Fallout';
  src: url('../fonts/JH_FALLOUT.TTF') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --fsm-yellow: #D8BC2C;
  --fsm-green: #3AE603;
  --fsm-bg: #101010;
  --fsm-panel: #000000;
  --fsm-panel-border: rgba(216, 188, 44, 0.62);
  --fsm-panel-grey: #c8c8c8;
}

.fsm-map-shell {
  position: relative;
  z-index: 0;
  isolation: isolate;
  width: 100%;
  height: var(--fsm-map-height, 100vh);
  min-height: 420px;
  overflow: hidden;
  background: var(--fsm-bg);
}

.fsm-map {
  width: 100%;
  height: 100%;
  background: var(--fsm-bg);
}

/* Vault-Tec ovládací panel s filtry */
.fsm-layer-panel {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 1000;
  box-sizing: border-box;
  width: 218px;
  max-width: calc(100% - 28px);
  max-height: calc(100% - 88px);
  overflow: visible;
  margin: 0;
  padding: 11px 10px 10px;
  border: 1px solid var(--fsm-panel-border);
  border-radius: 14px;
  background: #000000;
  color: var(--fsm-panel-grey);
  font: 12px Arial, sans-serif;
  font-weight: 400;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.7),
    0 8px 24px rgba(0, 0, 0, 0.72);
}

.fsm-filter-panel-body {
  max-height: calc(100vh - 116px);
  overflow: auto;
  padding: 0;
}

.fsm-filter-panel-body::-webkit-scrollbar {
  width: 8px;
}

.fsm-filter-panel-body::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 99px;
}

.fsm-filter-panel-body::-webkit-scrollbar-thumb {
  background: rgba(216, 188, 44, 0.45);
  border-radius: 99px;
}

.fsm-filter-toggle {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  box-sizing: border-box;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: rgba(18, 18, 18, 0.96);
  color: #ffffff;
  font: 20px/24px Arial, sans-serif;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.75);
  text-shadow: 0 0 4px rgba(255, 255, 255, 0.55);
}

.fsm-filter-toggle::before {
  content: "▾";
}

.fsm-filter-toggle:hover,
.fsm-filter-toggle:focus {
  background: rgba(32, 32, 32, 0.98);
  color: #ffffff;
  outline: none;
}

.fsm-layer-panel.fsm-is-collapsed {
  width: 42px;
  height: 42px;
  min-width: 42px;
  max-width: 42px;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: #000000;
  overflow: hidden;
}

.fsm-layer-panel.fsm-is-collapsed .fsm-filter-panel-body {
  display: none;
}

.fsm-layer-panel.fsm-is-collapsed .fsm-filter-toggle {
  position: static;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 20px;
  line-height: 38px;
  box-shadow: none;
}

.fsm-layer-panel.fsm-is-collapsed .fsm-filter-toggle::before {
  content: "☰";
}

.fsm-vault-logo-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 0 10px;
  padding: 2px 4px 8px;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.fsm-vault-logo-wrap.is-empty {
  display: none;
}

.fsm-vault-logo {
  display: block;
  width: 174px;
  max-width: 100%;
  height: auto;
  image-rendering: auto;
  opacity: 1;
  filter: none !important;
  background: transparent !important;
  box-shadow: none !important;
  pointer-events: none;
  user-select: none;
}

.fsm-game-filter {
  display: block;
  margin: 0 0 10px;
  padding: 0 0 11px;
  border-bottom: 1px solid rgba(216, 188, 44, 0.22);
  color: var(--fsm-panel-grey);
  font-weight: 400;
  user-select: none;
}

.fsm-layer-title {
  display: block;
  margin: 0 0 5px;
  color: rgba(216, 188, 44, 0.92);
  font: 11px/1.2 'JH Fallout', 'Arial Narrow', Arial, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: normal;
}

.fsm-game-filter.is-disabled {
  opacity: 0.55;
}

.fsm-game-select {
  box-sizing: border-box;
  display: block;
  width: 160px;
  max-width: 100%;
  min-height: 30px;
  margin: 0 auto;
  border: 1px solid rgba(216, 188, 44, 0.62);
  border-radius: 8px;
  background: #000000;
  color: #d8d8d8;
  font: 12px Arial, sans-serif;
  font-weight: 400;
  padding: 5px 8px;
  outline: none;
  text-overflow: ellipsis;
}

.fsm-game-select:focus {
  border-color: var(--fsm-green);
  box-shadow: 0 0 0 1px rgba(58, 230, 3, 0.28);
}

.fsm-layer-title {
  margin-top: 1px;
}

.fsm-layer-list {
  display: grid;
  gap: 5px;
}

.fsm-layer-panel label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--fsm-panel-grey);
  font-weight: 400;
  line-height: 1.25;
  white-space: normal;
  user-select: none;
}

.fsm-layer-panel label span {
  color: var(--fsm-panel-grey);
  font-weight: 400;
}

.fsm-layer-panel input[type="checkbox"] {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  margin: 0;
  vertical-align: -2px;
  accent-color: var(--fsm-yellow);
}

.fsm-map .leaflet-top.leaflet-left {
  top: 10px;
  left: 10px;
}

.leaflet-tooltip.fs-map-label {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  color: var(--fsm-green) !important;
  font-family: 'JH Fallout', 'Arial Narrow', Arial, sans-serif;
  font-size: 10px;
  font-weight: normal;
  letter-spacing: 0.015em;
  padding: 0 !important;
  box-shadow: none !important;
  text-shadow:
    -1px -1px 0 #000,
     1px -1px 0 #000,
    -1px  1px 0 #000,
     1px  1px 0 #000,
     0  1px 2px #000;
}

.leaflet-tooltip.fs-map-label::before {
  display: none !important;
  border: none !important;
}

.fs-hide-labels .leaflet-tooltip.fs-map-label {
  display: none;
}

/* Automatické skrývání kolidujících popisků. Body zůstávají viditelné, schová se jen text s nižší prioritou. */
.leaflet-tooltip.fs-map-label.fs-label-collided {
  visibility: hidden !important;
  pointer-events: none !important;
}

.fsm-map .leaflet-interactive {
  outline: none;
}

.fs-popup .leaflet-popup-content-wrapper,
.fs-popup .leaflet-popup-tip {
  background: rgba(16, 16, 16, 0.96);
  color: #f1e7b0;
  border: 1px solid rgba(216, 188, 44, 0.62);
}

.fs-popup .leaflet-popup-content {
  font: 13px Arial, sans-serif;
  line-height: 1.35;
}

.fs-popup strong {
  color: var(--fsm-yellow);
}

.fs-popup a.fs-popup-link {
  color: var(--fsm-green);
  text-decoration: none;
}

.fs-popup a.fs-popup-link:hover {
  text-decoration: underline;
}

.fs-popup-note,
.fs-popup-meta {
  display: inline-block;
  color: #cfc49a;
  font-size: 12px;
}

.fsm-error-panel {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 1005;
  box-sizing: border-box;
  max-width: 360px;
  padding: 10px 12px;
  border: 1px solid rgba(216, 188, 44, 0.72);
  border-radius: 10px;
  background: rgba(15, 10, 10, 0.94);
  color: #f1e7b0;
  font: 13px Arial, sans-serif;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.72);
}

/* Celé okno / fullscreen režim mapy */
.fsm-map-fullscreen-lock {
  overflow: hidden !important;
}

.fsm-map-shell.fsm-is-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  min-height: 0 !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  z-index: 999999 !important;
  background: var(--fsm-bg);
}

.fsm-map-shell.fsm-is-fullscreen .fsm-map {
  width: 100% !important;
  height: 100% !important;
}

.fsm-fullscreen-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1002;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(216, 188, 44, 0.8);
  border-radius: 2px;
  background: rgba(14, 14, 14, 0.9);
  color: var(--fsm-green);
  font: 22px/30px Arial, sans-serif;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65);
}

.fsm-fullscreen-toggle:hover,
.fsm-fullscreen-toggle:focus {
  background: rgba(0, 0, 0, 0.96);
  color: var(--fsm-yellow);
  outline: none;
}

.fsm-fullscreen-toggle.is-active {
  font-size: 28px;
  line-height: 28px;
}

/* Leaflet +/- zoom tlačítka ve stejném duchu jako fullscreen tlačítko */
.fsm-map .leaflet-control-zoom,
#fsm-admin-map .leaflet-control-zoom {
  border: none !important;
  border-radius: 2px !important;
  background: transparent !important;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65) !important;
}

.fsm-map .leaflet-control-zoom a,
#fsm-admin-map .leaflet-control-zoom a {
  box-sizing: border-box;
  width: 34px !important;
  height: 34px !important;
  padding: 0 !important;
  border: 1px solid rgba(216, 188, 44, 0.8) !important;
  border-bottom: 0 !important;
  border-radius: 0 !important;
  background: rgba(14, 14, 14, 0.9) !important;
  color: var(--fsm-green) !important;
  font: 22px/31px Arial, sans-serif !important;
  text-align: center !important;
  text-indent: 0 !important;
  text-decoration: none !important;
  text-shadow: none !important;
}

.fsm-map .leaflet-control-zoom a:first-child,
#fsm-admin-map .leaflet-control-zoom a:first-child {
  border-radius: 2px 2px 0 0 !important;
}

.fsm-map .leaflet-control-zoom a:last-child,
#fsm-admin-map .leaflet-control-zoom a:last-child {
  border-bottom: 1px solid rgba(216, 188, 44, 0.8) !important;
  border-radius: 0 0 2px 2px !important;
}

.fsm-map .leaflet-control-zoom a:hover,
.fsm-map .leaflet-control-zoom a:focus,
#fsm-admin-map .leaflet-control-zoom a:hover,
#fsm-admin-map .leaflet-control-zoom a:focus {
  background: rgba(0, 0, 0, 0.96) !important;
  color: var(--fsm-yellow) !important;
  outline: none !important;
}

.fsm-map .leaflet-control-zoom a.leaflet-disabled,
#fsm-admin-map .leaflet-control-zoom a.leaflet-disabled {
  background: rgba(14, 14, 14, 0.55) !important;
  color: rgba(160, 160, 160, 0.5) !important;
  cursor: default !important;
}

@media (max-width: 640px) {
  .fsm-layer-panel {
    left: 0;
    right: 0;
    bottom: max(0px, env(safe-area-inset-bottom));
    width: 100%;
    max-width: none;
    max-height: 72vh;
    padding: 30px 14px calc(12px + env(safe-area-inset-bottom));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 16px 16px 0 0;
  }

  .fsm-filter-panel-body {
    max-height: calc(72vh - 38px);
    overflow: auto;
    padding-bottom: max(0px, env(safe-area-inset-bottom));
  }

  .fsm-filter-toggle {
    top: 6px;
    right: auto;
    left: 50%;
    width: 52px;
    height: 24px;
    border-radius: 99px;
    transform: translateX(-50%);
    font-size: 16px;
    line-height: 20px;
  }

  .fsm-layer-panel.fsm-is-collapsed {
    left: 0;
    right: 0;
    bottom: max(22px, env(safe-area-inset-bottom));
    width: 100%;
    max-width: none;
    min-width: 0;
    height: 44px;
    max-height: 44px;
    border-radius: 16px 16px 0 0;
    overflow: visible;
  }

  .fsm-layer-panel.fsm-is-collapsed .fsm-filter-toggle {
    position: absolute;
    top: 7px;
    left: 50%;
    width: 62px;
    height: 28px;
    border: 0;
    border-radius: 99px;
    background: rgba(18, 18, 18, 0.96);
    transform: translateX(-50%);
    font-size: 16px;
    line-height: 22px;
  }

  .fsm-layer-panel.fsm-is-collapsed .fsm-filter-toggle::before {
    content: "▴";
  }

  .fsm-vault-logo-wrap {
    display: none !important;
  }

  .fsm-game-filter {
    width: 100%;
    margin-bottom: 12px;
  }

  .fsm-game-select {
    width: 100%;
    max-width: none;
  }

  .fsm-layer-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 10px;
  }

  .fsm-layer-panel label {
    font-size: 12px;
  }

  .fsm-map .leaflet-top.leaflet-left {
    top: 8px;
    left: 8px;
  }

  .fsm-fullscreen-toggle {
    top: 8px;
    right: 8px;
  }
}


/*
 * Z-index fix pro WordPress šablony / hover menu.
 * Leaflet má uvnitř mapy vlastní hodnoty 400–1000. Bez izolace mohou u některých
 * šablon přelézt přes rozbalovací menu v hlavičce stránky. Shell drží mapu
 * v samostatném nízkém stacking contextu; fullscreen režim výše ho záměrně přebije.
 */
.fsm-map-shell:not(.fsm-is-fullscreen) {
  z-index: 0 !important;
  isolation: isolate !important;
  box-sizing: border-box !important;
  border: 1px solid #b8b8b8 !important;
}
