/* The profile's Habitat tab intentionally mirrors the game's map view. */
body[data-embed-map] {
  --embed-map-border: #b9f9ff;
  background: #09131b;
}

body[data-embed-map] .map-app,
body[data-embed-map] .map-stage,
body[data-embed-map] #palworld-map {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100dvh !important;
  min-width: 0 !important;
  min-height: 0 !important;
}

body[data-embed-map] .map-hud-frame {
  z-index: 780;
  display: block;
  background: linear-gradient(90deg, rgb(3 15 23 / 24%), transparent 12%, transparent 88%, rgb(3 15 23 / 24%));
}

body[data-embed-map] .map-hud-frame::after { display: none; }

body[data-embed-map] > .app-header,
body[data-embed-map] > .source-notice,
body[data-embed-map] > .coordinate-hud,
body[data-embed-map] .layers-panel,
body[data-embed-map] .layers-backdrop,
body[data-embed-map] .layers-fab-group,
body[data-embed-map] .map-control-legend,
body[data-embed-map] .map-status,
body[data-embed-map] .map-buttons,
body[data-embed-map] .marker-details,
body[data-embed-map] .map-error {
  display: none !important;
}

body[data-embed-map] .leaflet-marker-icon {
  display: none !important;
}

body[data-embed-map] .leaflet-marker-icon.palpedia-embed-habitat-icon {
  display: block !important;
  width: 40px !important;
  height: 40px !important;
  margin: 0 !important;
  pointer-events: none;
}

body[data-embed-map] .palpedia-embed-habitat-icon .embed-habitat-marker {
  position: relative;
  display: block;
  width: 40px;
  height: 40px;
  pointer-events: none;
}

body[data-embed-map] .palpedia-embed-habitat-icon .embed-habitat-marker__portrait {
  display: block;
  width: 34px;
  height: 34px;
  margin: 3px;
  object-fit: cover;
  border: 2px solid #b9f9ff;
  border-radius: 50%;
  background: #09131b;
  box-shadow: 0 1px 5px rgb(0 0 0 / 70%);
}

body[data-embed-map] .palpedia-embed-habitat-icon .embed-habitat-marker__portrait.is-stack {
  position: absolute;
  top: 8px;
  left: calc(var(--embed-habitat-index) * 8px);
  width: 24px;
  height: 24px;
  margin: 0;
  z-index: calc(3 - var(--embed-habitat-index));
}

body[data-embed-map] .map-toolbar {
  right: 24px;
  bottom: 20px;
  z-index: 900;
  display: block;
  pointer-events: none;
}

.embed-map-controls {
  display: none;
}

body[data-embed-map] .embed-map-controls {
  display: grid;
  grid-template-columns: 44px 44px 90px 90px;
  min-height: 44px;
  pointer-events: auto;
}

body[data-embed-map][data-nocturnal-pal="false"] .embed-map-controls {
  grid-template-columns: 44px 44px;
}

body[data-embed-map] .embed-map-controls button {
  display: inline-flex;
  min-width: 0;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: #dbeaec;
  font: 700 1.1rem/1 "Palworld UI", system-ui, sans-serif;
  background: rgb(73 80 83 / 88%);
  border: 0;
  border-left: 1px solid rgb(255 255 255 / 15%);
  cursor: pointer;
}

body[data-embed-map] .embed-map-controls button[hidden] {
  display: none !important;
}

body[data-embed-map] .embed-map-controls button:first-child {
  background: rgb(246 252 255 / 92%);
  color: #192a31;
  border-left: 0;
}

body[data-embed-map] .embed-map-controls button:nth-child(2) {
  background: rgb(17 86 102 / 92%);
}

body[data-embed-map] .embed-map-controls button:nth-child(3).is-active {
  color: #fff;
  background: #ff7900;
}

body[data-embed-map] .embed-map-controls button:nth-child(4).is-active {
  color: #fff;
  background: #526169;
}

body[data-embed-map] .embed-map-controls button:hover,
body[data-embed-map] .embed-map-controls button:focus-visible {
  outline: 2px solid #b9f9ff;
  outline-offset: -2px;
  filter: brightness(1.16);
}

body[data-embed-map] .embed-map-controls kbd {
  padding: 4px 6px;
  color: #162830;
  font: 800 .95rem/1 "Palworld UI", system-ui, sans-serif;
  background: #eefcff;
  border-radius: 2px;
}

body[data-embed-map][data-map-mode="night"] #palworld-map::after {
  position: absolute;
  z-index: 700;
  inset: 0;
  display: block;
  content: "";
  background: rgb(24 26 70 / 24%);
  pointer-events: none;
}

@media (max-width: 620px) {
  body[data-embed-map] .map-toolbar { right: 12px; bottom: 12px; }
  body[data-embed-map] .embed-map-controls { grid-template-columns: 38px 38px 76px 76px; }
  body[data-embed-map] .embed-map-controls button { min-height: 38px; }
}
