/* The realm dock is anchored to the viewport, outside the moving map scene. */
.map-viewport-wrapper {
  position: relative;
  isolation: isolate;
}

.map-container::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: calc(var(--map-dock-height, 90px) + 64px);
  background: linear-gradient(transparent, #0a151aee 38%, #0a151afa);
  pointer-events: none;
  z-index: 2;
}

.map-container .map-gesture-hint {
  bottom: calc(var(--map-dock-height, 90px) + 28px);
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 28px);
  white-space: nowrap;
  font-size: 0.64rem;
  background: #09161be8;
  color: #c1cdc8;
  z-index: 3;
}

.map-realm-dock {
  position: absolute;
  inset: auto 18px 15px;
  width: min(100% - 36px, 510px);
  margin-inline: auto;
  display: grid;
  gap: 8px;
  cursor: default;
  z-index: 12;
}

.map-realm-dock .map-realms-label {
  color: #d5cfbb;
  font-size: 0.64rem;
  line-height: 1.2;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: center;
  text-shadow: 0 1px 4px #000;
}

.map-realm-dock .map-realm-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.map-realm-dock .map-realm-link {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
  min-height: 66px;
  padding: 10px 13px;
  border: 1px solid #8fa97865;
  border-radius: 8px;
  background: linear-gradient(120deg, #28362bf2, #122226fa);
  box-shadow: 0 6px 20px #0007, inset 0 1px #e5ebbe12;
  color: #e4dcb9;
  text-align: left;
  transition: border-color 160ms, background 160ms, transform 160ms;
}

.map-realm-dock .map-realm-link[data-region-id="hiclik"] {
  border-color: #a58ac770;
  background: linear-gradient(120deg, #302341f2, #18212efa);
  color: #dbc6f4;
}

.map-realm-dock .map-realm-link:hover {
  border-color: #e4d49a;
  transform: translateY(-2px);
}

.map-realm-dock .map-realm-link:focus-visible {
  outline: 2px solid #fff0bc;
  outline-offset: 3px;
}

.map-realm-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.map-realm-copy strong {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.2;
}

.map-realm-copy small {
  color: #b9c6be;
  font-size: 0.58rem;
  line-height: 1.3;
}

.map-realm-arrow {
  margin-left: auto;
  font-size: 1rem;
}

.region-emblem {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: block;
  overflow: visible;
}

.hover-region-icon,
.region-modal-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border: 1px solid #bca46c4d;
  border-radius: 5px;
  background: linear-gradient(145deg, #d4bd8614, #0b191b66);
  color: #e4ca8d;
}

.region-modal-icon {
  width: 50px;
  height: 50px;
}

.region-modal-icon .region-emblem {
  width: 36px;
  height: 36px;
}

.hover-card-header > div {
  min-width: 0;
}

.map-hover-card .hover-region-badge {
  max-width: 100%;
  white-space: normal;
}

.map-hover-card {
  max-height: calc(100% - var(--map-dock-height, 90px) - 65px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

@media (max-width: 600px) {
  .map-container {
    height: clamp(510px, 78svh, 700px);
    max-height: calc(100svh - 56px);
  }

  .map-realm-dock {
    inset-inline: 12px;
    width: calc(100% - 24px);
    bottom: 12px;
  }

  .map-realm-dock .map-realm-links {
    gap: 8px;
  }

  .map-realm-dock .map-realm-link {
    gap: 8px;
    min-height: 66px;
    padding: 10px;
  }

  .map-realm-link .region-emblem {
    width: 27px;
    height: 27px;
  }

  .map-realm-copy strong {
    font-size: 0.75rem;
  }

  .map-realm-copy small {
    font-size: 0.54rem;
  }

  .map-realm-arrow {
    display: none;
  }

  .map-hover-card {
    padding: 13px;
  }

  .region-modal-badge-row {
    flex-wrap: wrap;
  }

  .region-modal-badge {
    max-width: calc(100% - 60px);
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  .map-realm-dock .map-realm-link {
    transition: none;
  }
}
