:root {
  --map-bg: #09151f;
  --map-panel: #102333;
  --map-border: #29485f;
  --map-text: #d7e5ef;
  --map-muted: #8ea5b8;
  --mob: #ff6b3d;
  --node: #29c980;
  --quest: #35b2ff;
}

body.map-fullscreen-page main {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0;
}

body.map-fullscreen-page .recipes-page {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0;
}

body.map-fullscreen-page .page-header {
  margin: 0;
  padding: 0.85rem 1.1rem 0.45rem;
}

body.map-fullscreen-page .world-map-toolbar,
body.map-fullscreen-page .world-map-coord-readout {
  padding-left: 1.1rem;
  padding-right: 1.1rem;
}

body.map-fullscreen-page .world-map-layout {
  height: calc(100vh - 190px);
}

body.map-fullscreen-page footer {
  display: none;
}

.world-map-toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.5rem;
  padding: 0 1rem;
}

.world-map-search-wrap input {
  width: 100%;
  border: 1px solid var(--map-border);
  background: #0d1d2c;
  color: var(--map-text);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  font-size: 0.95rem;
}

.world-map-search-wrap {
  position: relative;
}

.map-search-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.4rem;
  min-height: 1.5rem;
}

.map-search-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid #2e556f;
  background: #153246;
  color: #cae1f0;
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  font-size: 0.72rem;
}

.map-search-chip button {
  border: none;
  background: transparent;
  color: #cae1f0;
  cursor: pointer;
  font-size: 0.72rem;
  padding: 0;
}

.map-search-quick {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.map-search-quick button {
  border: 1px solid #2b4e66;
  background: #102838;
  color: #b9d3e5;
  border-radius: 999px;
  font-size: 0.72rem;
  padding: 0.12rem 0.5rem;
  cursor: pointer;
}

.map-search-suggestions {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 22;
  list-style: none;
  margin: 0;
  padding: 0.35rem;
  border: 1px solid #29485f;
  border-radius: 10px;
  background: #0f2232;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
  max-height: 260px;
  overflow: auto;
}

.map-search-suggestions li {
  margin: 0;
}

.map-search-suggestions button {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: #d7e5ef;
  border-radius: 7px;
  padding: 0.45rem 0.5rem;
  cursor: pointer;
}

.map-search-suggestions button:hover,
.map-search-suggestions button.active {
  background: #19384e;
}

.world-map-filters {
  display: grid;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--map-text);
}

.world-map-filters label {
  display: inline-flex;
  justify-content: space-between;
  gap: 0.35rem;
  align-items: center;
}

.count-pill {
  margin-left: auto;
  font-size: 0.75rem;
  color: #9fc0d8;
  border: 1px solid #2c5068;
  border-radius: 999px;
  padding: 0.1rem 0.4rem;
}

.world-map-zoom-controls {
  display: flex;
  gap: 0.4rem;
}

.world-map-zoom-controls button {
  border: 1px solid var(--map-border);
  background: #11283a;
  color: var(--map-text);
  border-radius: 8px;
  padding: 0.45rem 0.65rem;
  min-width: 44px;
  cursor: pointer;
}

.world-map-coord-readout {
  margin: 0 0 0.9rem;
  color: var(--map-muted);
  font-size: 0.86rem;
}

.world-map-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 0;
  height: calc(100vh - 200px);
  position: relative;
  width: 100%;
}

.world-map-sidepanel {
  background: #0f2232;
  border-right: 1px solid var(--map-border);
  padding: 0.8rem;
  overflow-y: auto;
}

.sidepanel-section {
  margin-bottom: 0.9rem;
  border: 1px solid #25465c;
  border-radius: 10px;
  padding: 0.65rem;
  background: rgba(11, 25, 37, 0.8);
}

.sidepanel-section h3 {
  margin: 0 0 0.45rem;
  font-size: 0.9rem;
  color: #d7e5ef;
}

.sidepanel-row-actions {
  display: flex;
  gap: 0.45rem;
  margin-bottom: 0.45rem;
}

.sidepanel-row-actions button,
.sidepanel-section button,
.sidepanel-section select,
.sidepanel-section input {
  border: 1px solid var(--map-border);
  background: #11283a;
  color: var(--map-text);
  border-radius: 8px;
  padding: 0.4rem 0.55rem;
}

.sidepanel-section select,
.sidepanel-section input {
  width: 100%;
}

.goto-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.goto-grid #goto-z,
.goto-grid #goto-coords {
  grid-column: span 2;
}

.world-map-viewport {
  background: linear-gradient(165deg, #0d1b2a, #10273a 55%, #17364b);
  border: none;
  border-radius: 0;
  overflow: hidden;
  height: 100%;
  width: 100%;
  position: relative;
  cursor: grab;
}

.world-map-viewport:active {
  cursor: grabbing;
}

.world-map-canvas {
  position: absolute;
  inset: 0;
  transform-origin: center center;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
}

#world-map-image {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  -o-object-fit: contain;
     object-fit: contain;
}

.world-map-markers {
  position: absolute;
  inset: 0;
}

.world-map-calibration-points {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.map-control-point {
  position: absolute;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  margin-top: -8px;
  border-radius: 4px;
  border: 2px solid #0b1119;
  background: #ffd166;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.24);
}

.map-control-point.active {
  background: #ef476f;
}

.map-marker {
  position: absolute;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  margin-top: -7px;
  border-radius: 50%;
  border: 2px solid #0b1119;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.18);
  cursor: pointer;
}

.map-marker.mob { background: var(--mob); }
.map-marker.node { background: var(--node); }
.map-marker.quest { background: var(--quest); }
.map-marker.custom { background: #ffda6e; }
.map-marker.active {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5);
  z-index: 2;
}

.map-cluster {
  position: absolute;
  min-width: 28px;
  height: 28px;
  margin-left: -14px;
  margin-top: -14px;
  border-radius: 999px;
  border: 2px solid #0b1119;
  background: #ffc857;
  color: #17222c;
  font-weight: 800;
  font-size: 0.72rem;
  cursor: pointer;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2);
}

.custom-pin-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
  max-height: 170px;
  overflow: auto;
}

.custom-pin-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--map-text);
}

.custom-pin-list button {
  padding: 0.15rem 0.4rem;
  font-size: 0.72rem;
}

.world-map-zoom-controls .is-active {
  border-color: #f5c65a;
  box-shadow: 0 0 0 2px rgba(245, 198, 90, 0.2);
}

.world-map-panel {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 340px;
  max-height: 50vh;
  background: var(--map-panel);
  border: 1px solid var(--map-border);
  border-radius: 14px;
  padding: 1rem;
  color: var(--map-text);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  overflow-y: auto;
  z-index: 10;
  min-height: 620px;
  overflow: auto;
}

.world-map-panel h2 {
  margin: 0;
  font-size: 1rem;
}

#map-stats {
  margin: 0.5rem 0 0.8rem;
  color: var(--map-muted);
  font-size: 0.88rem;
}

.world-map-results {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.world-map-results button {
  width: 100%;
  text-align: left;
  border: 1px solid #29485f;
  background: #0f2434;
  color: var(--map-text);
  border-radius: 8px;
  padding: 0.5rem 0.55rem;
  cursor: pointer;
}

.world-map-results .meta {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: var(--map-muted);
}

.world-map-calibration {
  margin-top: 1rem;
  border-top: 1px solid var(--map-border);
  padding-top: 0.8rem;
}

.world-map-calibration h3 {
  margin: 0 0 0.45rem;
  font-size: 0.95rem;
}

.world-map-calibration-help {
  margin: 0 0 0.55rem;
  color: var(--map-muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.world-map-calibration select {
  width: 100%;
  border: 1px solid var(--map-border);
  background: #0d1d2c;
  color: var(--map-text);
  border-radius: 8px;
  padding: 0.45rem;
}

.world-map-calibration-status {
  margin: 0.55rem 0;
  color: var(--map-muted);
  font-size: 0.8rem;
}

.world-map-calibration-actions {
  display: flex;
  gap: 0.5rem;
}

.world-map-calibration-actions button {
  border: 1px solid var(--map-border);
  background: #11283a;
  color: var(--map-text);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
}

@media (max-width: 980px) {
  .world-map-toolbar {
    grid-template-columns: 1fr auto;
  }

  .world-map-layout {
    grid-template-columns: 1fr;
    height: calc(100vh - 130px);
  }

  .world-map-sidepanel {
    position: absolute;
    top: 0.7rem;
    left: 0.7rem;
    width: min(300px, calc(100vw - 1.4rem));
    max-height: calc(100% - 1.4rem);
    z-index: 12;
    border: 1px solid var(--map-border);
    border-radius: 12px;
  }

  .world-map-panel {
    width: 320px !important;
    bottom: 1rem !important;
    right: 1rem !important;
    min-height: 420px;
  }

  body.map-fullscreen-page .world-map-layout {
    height: calc(100vh - 172px);
  }
}
