.map-section {
  margin-bottom: 44px;
}

.map-heading {
  gap: 16px;
}

.map-heading select {
  min-height: 42px;
  max-width: 55%;
}

.map-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #dbe5d4;
  isolation: isolate;
}

#map {
  display: block;
  width: 100%;
  height: clamp(360px, 60vh, 620px);
  touch-action: none;
  user-select: none;
  cursor: grab;
}

#map:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: -3px;
}

#map.is-dragging, #map.is-dragging .map-region {
  cursor: grabbing;
}

.map-image {
  pointer-events: none;
  image-rendering: pixelated;
}

.map-region {
  fill: #fffcdf;
  fill-opacity: 0.06;
  stroke: #fffbe5;
  stroke-width: 1.3px;
  stroke-opacity: 0.7;
  cursor: pointer;
}

.map-region.is-done {
  fill: #25b766;
  fill-opacity: 0.42;
  stroke: #146836;
  stroke-opacity: 1;
  stroke-width: 2px;
}

.map-region:hover, .map-region:focus-visible {
  fill-opacity: 0.35;
  stroke: #f8bd35;
  stroke-width: 3px;
  stroke-opacity: 1;
  outline: none;
}

.map-region.is-done:hover, .map-region.is-done:focus-visible {
  fill-opacity: 0.6;
}

.map-checks {
  pointer-events: none;
  fill: white;
  stroke: #146836;
  stroke-width: 0.6;
  paint-order: stroke;
  font-size: 3px;
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: central;
}

.map-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  gap: 6px;
}

.map-controls button {
  width: 40px;
  height: 40px;
  background: #fffffff5;
  border: 1px solid #ced9c9;
  border-radius: 9px;
  font-size: 24px;
  box-shadow: 0 2px 8px #18371a12;
}

.map-controls button:hover {
  background: #edf4e7;
}

.map-selection {
  position: absolute;
  bottom: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 15px;
  background: #fffffff0;
  border: 1px solid #d4dfce;
  border-radius: 10px;
  font-size: 12px;
  pointer-events: none;
}

#map-region-status {
  flex-shrink: 0;
  color: var(--muted);
}

#map-region-status.is-done {
  color: var(--green);
  font-weight: 700;
}

.map-notice {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 72px;
  width: fit-content;
  margin: 0;
  padding: 10px 14px;
  border-radius: 8px;
  background: #fffffff0;
  font-size: 12px;
  pointer-events: none;
}

.map-caption {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin-top: 12px;
  font-size: 11px;
  color: #697564;
}

.map-caption p {
  margin: 0;
}

.map-legend, .map-legend span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.map-legend {
  gap: 15px;
}

.map-legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  border: 1px solid #b5bda9;
  background: #fffcdf;
}

.map-legend .legend-done {
  background: #25b766;
  border-color: #146836;
}

@media (max-width: 600px) {
  #map { height: 420px; }
  .map-controls { top: 10px; right: 10px; }
  .map-selection { left: 10px; right: 10px; bottom: 10px; font-size: 11px; }
  .map-caption { line-height: 1.7; }
}

.map-entrance { cursor: pointer; outline: none; }
.map-entrance .entrance-hitbox { fill: transparent; stroke: none; }
.entrance-sprite { pointer-events: none; filter: drop-shadow(0 1px 1px #0008); }
.map-entrance:hover .entrance-hitbox, .map-entrance:focus-visible .entrance-hitbox {
  fill: #ffe29a33;
  stroke: #ffe29a;
  stroke-width: 2;
  stroke-dasharray: 4 2;
  shape-rendering: crispEdges;
}
