/* World map: full map dialog, desktop minimap, journey waypoint list. */

/* ---------- full map dialog ---------- */
#map-dialog {
  --width: min(1120px, calc(100vw - 24px));
  --spacing: 0;
}
#map-dialog::part(dialog) {
  max-height: calc(100dvh - 24px);
  border: 1px solid #d8bf7d66;
  border-radius: 22px;
  background: #10261e;
  color: #f7f4e7;
  box-shadow: 0 24px 80px #0008;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
}
#map-dialog::part(header) {
  padding: 12px 14px 10px 22px;
  border-bottom: 1px solid #d8bf7d33;
}
#map-dialog::part(title) {
  color: #f3dc9b;
  font-family: Georgia, "Yu Mincho", serif;
  font-size: 20px;
  letter-spacing: 0.02em;
}
#map-dialog::part(close-button) {
  color: #f7f4e7;
}
#map-dialog::part(body) {
  padding: 0;
}
.map-stage {
  position: relative;
  height: min(76vh, 780px);
  overflow: hidden;
  background: #10261e;
  user-select: none;
  -webkit-user-select: none;
}
#map-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}
.map-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  color: #d8bf7d;
  font-size: 14px;
  pointer-events: none;
}
.map-empty[hidden] {
  display: none;
}

.map-tooltip,
.map-popover {
  position: absolute;
  z-index: 2;
  transform: translate(-50%, -100%);
  border: 1px solid #d8bf7d88;
  border-radius: 12px;
  background: #10261ef0;
  color: #f7f4e7;
  box-shadow: 0 8px 24px #0007;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}
.map-tooltip.below,
.map-popover.below {
  transform: translate(-50%, 36px);
}
.map-tooltip {
  padding: 5px 10px;
  pointer-events: none;
}
.map-popover {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-width: 150px;
  padding: 10px 12px 12px;
  animation: map-pop-in 0.14s ease-out;
}
.map-popover strong {
  color: #f3dc9b;
  font-size: 14px;
}
.map-popover small {
  max-width: 220px;
  color: #c9d3c4;
  font-weight: 500;
  white-space: normal;
  text-align: center;
  line-height: 1.45;
}
.map-tooltip[hidden],
.map-popover[hidden],
.map-popover [hidden] {
  display: none;
}
#map-teleport::part(base) {
  min-height: 34px;
  border-radius: 10px;
  padding-inline: 16px;
  background: #315c40;
  border-color: #f3dc9b88;
  color: #fff;
}
@keyframes map-pop-in {
  from {
    opacity: 0;
    margin-top: 6px;
  }
}

.map-legend {
  position: absolute;
  right: 14px;
  bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0;
  padding: 7px 12px;
  border-radius: 999px;
  background: #10261ecc;
  list-style: none;
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
}
.map-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}
.map-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
}
.legend-you {
  clip-path: polygon(50% 0, 100% 100%, 50% 75%, 0 100%);
  background: #fff8e2;
}
.legend-waypoint,
.legend-locked {
  transform: rotate(45deg) scale(0.8);
  border: 1.5px solid #e9fffb;
  background: #2fb8b4;
}
.legend-locked {
  background: #8e978f;
}
.legend-objective {
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  background: #f3dc9b;
}

/* ---------- minimap (desktop only) ---------- */
.minimap {
  position: absolute;
  z-index: 6;
  top: calc(max(14px, env(safe-area-inset-top)) + 66px);
  right: max(22px, env(safe-area-inset-right));
  width: 150px;
  height: 150px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  box-shadow: 0 6px 22px #0006;
  cursor: pointer;
}
.minimap[hidden] {
  display: none;
}
.minimap canvas {
  display: block;
  width: 150px;
  height: 150px;
  border-radius: 50%;
}
.minimap:hover {
  box-shadow:
    0 6px 22px #0006,
    0 0 0 3px #f3dc9b55;
}
.minimap:focus-visible {
  outline: 2px solid #f3dc9b;
  outline-offset: 3px;
}
@media (max-width: 760px), (max-height: 520px) {
  .minimap {
    display: none;
  }
}

/* ---------- journey drawer: waypoint list ---------- */
.waypoint-loading {
  margin: 4px 0;
  color: #75836c;
  font-size: 14px;
}
.destination-list .waypoint-button::part(label) {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 0;
}
.destination-list .waypoint-button small {
  color: #89987e;
  font-weight: 650;
}
.waypoint-locked {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px dashed #d4dece;
  border-radius: 14px;
  background: #f4f4ef;
  color: #7c887a;
}
.waypoint-lock {
  font-size: 15px;
  filter: grayscale(1);
}
.waypoint-text {
  display: grid;
  gap: 2px;
}
.waypoint-text b {
  color: #6c7a69;
  font-weight: 650;
}
.waypoint-text small {
  font-size: 12px;
  line-height: 1.4;
}

@media (max-width: 760px), (pointer: coarse) {
  #map-dialog {
    --width: calc(100vw - 12px);
  }
  .map-stage {
    height: calc(100dvh - 92px);
  }
  .map-legend {
    right: 8px;
    bottom: 40px;
    left: auto;
    max-width: calc(100% - 16px);
    border-radius: 14px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .map-popover {
    animation: none;
  }
}
