:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  color: #eef1eb;
  background: #111615;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

html,
body,
.app-shell {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

button {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 348px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  background: #151a19;
}

.sidebar {
  position: relative;
  z-index: 700;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  height: 100%;
  border-right: 1px solid #313937;
  background: #151b1a;
  transition: margin-left 160ms ease;
}

.sidebar-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid #303735;
}

.eyebrow {
  margin: 0 0 4px;
  color: #76c9bc;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.48rem;
  font-weight: 600;
}

h2 {
  margin-bottom: 0;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.icon-button,
.text-button,
.panel-toggle {
  border: 1px solid #3a4441;
  border-radius: 4px;
  background: #202826;
  cursor: pointer;
}

.icon-button:hover,
.text-button:hover,
.panel-toggle:hover {
  background: #2a3532;
}

.icon-button:focus-visible,
.text-button:focus-visible,
.panel-toggle:focus-visible,
.search-clear:focus-visible,
input:focus-visible,
.category-filter:focus-visible {
  outline: 2px solid #67caba;
  outline-offset: 2px;
}

.icon-button {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 1.35rem;
  line-height: 1;
}

.sidebar-close {
  display: none;
}

.search-wrap {
  padding: 14px 18px;
  border-bottom: 1px solid #303735;
}

.search-wrap label {
  display: block;
  margin-bottom: 7px;
  color: #b9c1bd;
  font-size: 0.76rem;
  font-weight: 650;
}

.search-wrap input {
  width: 100%;
  min-height: 40px;
  padding: 9px 42px 9px 11px;
  border: 1px solid #46504d;
  border-radius: 4px;
  color: #f5f6f2;
  background: #0f1413;
}

.search-control {
  position: relative;
}

.search-clear {
  position: absolute;
  top: 50%;
  right: 6px;
  display: grid;
  width: 28px;
  height: 28px;
  padding: 0;
  transform: translateY(-50%);
  place-items: center;
  border: 0;
  border-radius: 3px;
  color: #b9c1bd;
  font-size: 1.1rem;
  line-height: 1;
  background: transparent;
  cursor: pointer;
}

.search-clear:hover {
  color: #ffffff;
  background: #27302e;
}

.search-clear[hidden] {
  display: none;
}

.search-wrap input::placeholder {
  color: #77807c;
}

.search-wrap input::-webkit-search-cancel-button {
  appearance: none;
}

.filters {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: none;
  min-height: 0;
  padding: 13px 18px 15px;
  border-bottom: 1px solid #303735;
}

.map-overlays {
  grid-template-rows: auto auto;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.text-button {
  padding: 4px 8px;
  color: #c8cfcb;
  font-size: 0.72rem;
}

.category-filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 5px;
  scrollbar-color: #47514e #151b1a;
}

.category-filter {
  display: grid;
  grid-template-columns: 16px 23px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 29px;
  color: #d8ddd9;
  font-size: 0.78rem;
  cursor: pointer;
}

.category-filter input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: #4dc2b0;
}

.category-swatch {
  display: block;
  border: 1px solid #0f1413;
  border-radius: 50%;
  background: var(--swatch);
}

.resource-swatch {
  box-shadow: 0 0 0 1px rgba(255, 240, 189, 0.65);
}

.resource-deposit-marker {
  cursor: pointer;
}

.resource-deposit-marker:hover {
  filter: brightness(1.18);
}

.resource-tree,
.resource-group {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 7px;
  padding-top: 7px;
}

.resource-tree > summary,
.resource-group > summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  font-size: 13px;
  font-weight: 650;
  justify-content: space-between;
  list-style: none;
  min-height: 28px;
}

.resource-tree > summary::-webkit-details-marker,
.resource-group > summary::-webkit-details-marker {
  display: none;
}

.resource-tree > summary::before,
.resource-group > summary::before {
  content: "\25B8";
  margin-right: 7px;
}

.resource-tree[open] > summary::before,
.resource-group[open] > summary::before {
  content: "\25BE";
}

.resource-tree > summary span,
.resource-group > summary span {
  flex: 1;
}

.resource-tree summary small,
.resource-group summary small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.resource-group {
  border-top: 0;
  margin-left: 5px;
  margin-top: 2px;
  padding-top: 0;
}

.resource-group-items {
  margin-left: 12px;
}

.shroud-gradient-swatch {
  width: 24px;
  height: 18px;
  flex: 0 0 24px;
  border: 1px solid rgba(235, 228, 215, 0.42);
  border-radius: 3px;
  background: linear-gradient(135deg, #d2e8f0 0 24%, #91c1d5 25% 44%, #6c7fa6 45% 62%, #6c4c82 63% 78%, #933555 79% 100%);
  box-shadow: inset 0 0 0 1px rgba(16, 21, 20, 0.22);
}

.shroud-map-overlay {
  image-rendering: auto;
}

.category-swatch {
  width: 13px;
  height: 13px;
  margin-left: 4px;
}

.category-icon {
  display: block;
  width: 22px;
  height: 22px;
  object-fit: contain;
  filter: drop-shadow(0 1px 1px rgb(0 0 0 / 65%));
}

.category-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-label small {
  color: #78827e;
  font-size: 0.68rem;
}

.map-region {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  background: #111615;
}

#map {
  position: absolute;
  inset: 0;
  background: #111615;
}

.leaflet-container img.leaflet-tile {
  mix-blend-mode: normal;
}

.game-map-marker-icon {
  filter: drop-shadow(0 1px 2px rgb(0 0 0 / 75%));
  transition: opacity 140ms ease, filter 140ms ease;
}

.game-map-marker-icon.is-checked {
  opacity: 0.32 !important;
  filter: grayscale(1) drop-shadow(0 1px 1px rgb(0 0 0 / 55%));
}

.map-caption-anchor {
  width: 0 !important;
  height: 0 !important;
  border: 0;
  background: transparent;
}

.map-caption-label {
  position: absolute;
  display: block;
  max-width: 220px;
  transform: translate(-50%, -50%);
  color: #e8e2cf;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  text-shadow: 0 1px 1px #111, 0 0 3px #111, 0 0 6px #111;
  white-space: nowrap;
  transition: opacity 140ms ease, filter 140ms ease;
}

.map-caption-anchor.is-checked .map-caption-label {
  opacity: 0.32;
  filter: grayscale(1);
}

.leaflet-interactive.is-checked {
  opacity: 0.32 !important;
  filter: grayscale(1);
}

.panel-toggle {
  position: absolute;
  z-index: 650;
  top: 12px;
  left: 12px;
  min-height: 36px;
  padding: 7px 11px;
  color: #edf1ec;
  font-size: 0.78rem;
  font-weight: 650;
  box-shadow: 0 2px 8px rgb(0 0 0 / 28%);
  display: none;
}

.coordinate-readout {
  position: absolute;
  z-index: 650;
  right: 12px;
  bottom: 12px;
  min-width: 132px;
  padding: 7px 9px;
  border: 1px solid rgb(231 236 226 / 20%);
  border-radius: 4px;
  color: #eef2ec;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.72rem;
  text-align: center;
  background: rgb(17 22 21 / 88%);
  pointer-events: none;
}

.gv-credit {
  position: absolute;
  z-index: 650;
  left: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid rgb(231 236 226 / 20%);
  border-radius: 4px;
  background: rgb(17 22 21 / 88%);
  color: #eef2ec;
  font-size: 0.68rem;
  text-decoration: none;
  opacity: 0.75;
  transition: opacity 140ms ease;
}
.gv-credit:hover { opacity: 1; }

.leaflet-control-zoom a {
  color: #edf1ec;
  background: #202826;
  border-color: #3a4441;
}

.leaflet-control-zoom a:hover {
  color: #ffffff;
  background: #2a3532;
}

.leaflet-control-zoom-reset::before {
  content: "\21bb";
  font-size: 18px;
  font-weight: 700;
}

.leaflet-control-zoom a.leaflet-control-zoom-reset.is-disabled,
.leaflet-control-zoom a.leaflet-control-zoom-reset.is-disabled:hover {
  color: #68726e;
  background: #202826;
  cursor: default;
}

.leaflet-control-zoom-reset:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid #6fd6c5;
  outline-offset: -2px;
}

.leaflet-bar {
  border: 0;
  box-shadow: 0 2px 8px rgb(0 0 0 / 28%);
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  color: #e7ebe6;
  background: #19201e;
}

.leaflet-popup-content-wrapper {
  border: 1px solid #46504d;
  border-radius: 6px;
}

.leaflet-popup-content {
  margin: 14px 16px;
  max-height: min(58vh, 430px);
  overflow-y: auto;
}

.location-popup h3 {
  margin-bottom: 5px;
  font-size: 0.95rem;
}

.location-popup p {
  margin-bottom: 7px;
  color: #bbc3bf;
  font-size: 0.76rem;
}

.popup-context {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 7px;
  color: #75cdbf !important;
  font-weight: 650;
}

.popup-context span + span::before {
  margin-right: 7px;
  color: #65716c;
  content: "/";
}

.popup-position {
  display: grid;
  gap: 2px;
  font-family: Consolas, "Courier New", monospace;
}

.popup-facts {
  margin: 8px 0;
  padding-left: 17px;
  color: #d8ded9;
  font-size: 0.76rem;
}

.popup-facts li + li {
  margin-top: 3px;
}

.popup-quests {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid #37413e;
}

.popup-quests h4 {
  margin: 0 0 7px;
  color: #e4e9e4;
  font-size: 0.76rem;
}

.popup-quests ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.popup-quests li {
  color: #dce1dc;
  font-size: 0.72rem;
}

.popup-quests strong,
.popup-quests span {
  display: block;
}

.popup-quests span {
  margin-top: 2px;
  color: #98a39e;
}

.marker-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  margin: 9px 0 8px;
  padding-top: 8px;
  border-top: 1px solid #37413e;
  color: #e2e7e2;
  font-size: 0.78rem;
  font-weight: 650;
  cursor: pointer;
}

.marker-progress input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #55c4b3;
}

.leaflet-tooltip {
  border: 1px solid #46504d;
  border-radius: 3px;
  color: #e7ebe6;
  font-size: 0.72rem;
  background: #19201e;
  box-shadow: 0 2px 7px rgb(0 0 0 / 24%);
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: absolute;
    z-index: 800;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: min(58vh, 560px);
    border-top: 1px solid #3a4441;
    border-right: 0;
    transition: transform 180ms ease;
  }

  .sidebar.is-closed {
    margin-left: 0;
    transform: translateY(100%);
  }

  .sidebar-close {
    display: grid;
    place-items: center;
  }

  .sidebar-header {
    padding: 12px 14px 10px;
  }

  .search-wrap {
    padding: 10px 14px;
  }

  .filters {
    padding: 10px 14px 11px;
  }

  .category-filters {
    grid-template-columns: minmax(0, 1fr);
  }

  .map-region {
    width: 100%;
    height: 100%;
  }

  .leaflet-popup-content {
    width: min(280px, calc(100vw - 72px)) !important;
    max-height: min(32vh, 220px);
  }

  .panel-toggle {
    display: block;
  }

  .coordinate-readout {
    bottom: 10px;
  }
}
