/* Player Progress Map — adventure board for Host Progress mode */

.qz-host-monitor--map {
  width: min(100%, 68rem);
  max-width: 100%;
}

.qz-pmap-mount {
  position: relative;
  width: 100%;
  min-height: 16rem;
  height: clamp(14rem, 36dvh, 22rem);
  border-radius: 1.1rem;
  overflow: hidden;
  isolation: isolate;
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, #fff 12%, transparent),
    0 12px 40px color-mix(in srgb, #000 45%, transparent);
}

.qz-pmap {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
  background: #1a0b2e;
  touch-action: pan-x;
  -webkit-overflow-scrolling: touch;
}

.qz-pmap__canvas {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.qz-pmap__markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.qz-pmap__hud {
  position: absolute;
  inset: 0.55rem 0.75rem auto;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  pointer-events: none;
  font-family: Fredoka, "Baloo 2", system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: color-mix(in srgb, #fff 88%, transparent);
  text-shadow: 0 1px 6px color-mix(in srgb, #000 55%, transparent);
}

.qz-pmap__hud-dest {
  color: #ffe08a;
}

/* ── Player markers ─────────────────────────────────────── */

.qz-pmap__marker {
  position: absolute;
  left: 0;
  top: 0;
  width: 4.25rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  transform: translate(0, 0);
  transform-origin: 50% 85%;
  will-change: transform;
  transition: filter 0.2s ease;
  outline: none;
}

.qz-pmap__marker:focus-visible {
  outline: 2px solid #ffe08a;
  outline-offset: 3px;
  border-radius: 0.75rem;
}

.qz-pmap__face {
  display: grid;
  place-items: center;
  width: 2.65rem;
  height: 2.65rem;
  margin: 0 auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, #fff8, transparent 45%),
    color-mix(in srgb, #1a1228 55%, #000);
  box-shadow:
    0 0 0 2px color-mix(in srgb, #fff 22%, transparent),
    0 6px 14px color-mix(in srgb, #000 45%, transparent),
    0 0 18px color-mix(in srgb, var(--qm-cta, #a78bfa) 25%, transparent);
  animation: qz-pmap-idle 2.4s ease-in-out infinite;
}

.qz-pmap__face .qz-mascot {
  --qz-mascot-size: 36px;
}

.qz-pmap__crown {
  position: absolute;
  left: 50%;
  top: -0.35rem;
  translate: -50% 0;
  font-size: 0.95rem;
  line-height: 1;
  opacity: 0;
  transform: scale(0.6) translateY(4px);
  filter: drop-shadow(0 0 6px #ffd54f);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  z-index: 2;
}

.qz-pmap__label {
  display: grid;
  justify-items: center;
  gap: 0.05rem;
  margin-top: 0.2rem;
  max-width: 4.4rem;
}

.qz-pmap__name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  font-family: Fredoka, "Baloo 2", system-ui, sans-serif;
  font-size: 0.68rem;
  font-weight: 650;
  color: #fff;
  background: color-mix(in srgb, #0b0618 72%, transparent);
  box-shadow: 0 2px 8px color-mix(in srgb, #000 40%, transparent);
}

.qz-pmap__score {
  font-family: Fredoka, system-ui, sans-serif;
  font-size: 0.58rem;
  font-weight: 600;
  color: color-mix(in srgb, #fff 70%, transparent);
  text-shadow: 0 1px 4px #000a;
}

/* Leader */
.qz-pmap__marker.is-leader .qz-pmap__crown {
  opacity: 1;
  transform: scale(1) translateY(0);
  animation: qz-pmap-crown 1.6s ease-in-out infinite;
}

.qz-pmap__marker.is-leader .qz-pmap__face {
  box-shadow:
    0 0 0 2px #ffd54f,
    0 0 22px color-mix(in srgb, #ffd54f 65%, transparent),
    0 8px 16px color-mix(in srgb, #000 40%, transparent);
}

.qz-pmap__marker.is-leader .qz-pmap__name {
  background: linear-gradient(90deg, #c9a227, #8b6914);
  color: #fff8e7;
}

.qz-pmap__marker.is-top3:not(.is-leader) .qz-pmap__face {
  box-shadow:
    0 0 0 2px color-mix(in srgb, #a78bfa 70%, #fff),
    0 6px 14px color-mix(in srgb, #000 40%, transparent);
}

/* Hop / hover / finish */
.qz-pmap__marker.is-hopping .qz-pmap__face {
  animation: qz-pmap-squash 0.35s ease;
  filter: drop-shadow(0 0 10px color-mix(in srgb, #fff 55%, transparent));
}

.qz-pmap__marker.is-hovered {
  z-index: 400 !important;
  filter: brightness(1.08);
}

.qz-pmap__marker.is-hovered .qz-pmap__label {
  transform: scale(1.08);
}

.qz-pmap__marker.is-finished .qz-pmap__face {
  box-shadow:
    0 0 0 2px #7cfc00,
    0 0 24px color-mix(in srgb, #7cfc00 55%, transparent);
}

/* Collapsed list under map */
.qz-host-monitor__details {
  border-radius: 0.75rem;
  background: color-mix(in srgb, #fff 5%, transparent);
  border: 1px solid color-mix(in srgb, #fff 10%, transparent);
  padding: 0.35rem 0.65rem 0.55rem;
}

.qz-host-monitor__details > summary {
  cursor: pointer;
  font-family: Fredoka, system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: color-mix(in srgb, #fff 72%, transparent);
  padding: 0.35rem 0;
  list-style: none;
}

.qz-host-monitor__details > summary::-webkit-details-marker {
  display: none;
}

.qz-host-monitor__details[open] .qz-host-monitor__list {
  margin-top: 0.45rem;
  max-height: min(28dvh, 14rem);
}

/* Theme-tint hooks (engine also paints canvas) */
.qz-pmap[data-map-theme="pirate"] { background: #0b3d5c; }
.qz-pmap[data-map-theme="space"] { background: #050816; }
.qz-pmap[data-map-theme="dragon"] { background: #1a0505; }
.qz-pmap[data-map-theme="snow"] { background: #0a1a2e; }
.qz-pmap[data-map-theme="japanese"] { background: #1a0a18; }
.qz-pmap[data-map-theme="jungle"] { background: #0a2818; }

@keyframes qz-pmap-idle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes qz-pmap-squash {
  0% { transform: scale(1, 1); }
  35% { transform: scale(1.12, 0.88); }
  70% { transform: scale(0.94, 1.08); }
  100% { transform: scale(1, 1); }
}

@keyframes qz-pmap-crown {
  0%, 100% { transform: scale(1) translateY(0) rotate(-4deg); }
  50% { transform: scale(1.08) translateY(-2px) rotate(4deg); }
}

@media (max-width: 720px) {
  .qz-pmap-mount {
    height: clamp(12rem, 42dvh, 18rem);
  }

  .qz-pmap {
    overflow-x: auto;
  }

  .qz-pmap__marker {
    width: 3.6rem;
  }

  .qz-pmap__face {
    width: 2.25rem;
    height: 2.25rem;
  }

  .qz-pmap__name {
    font-size: 0.6rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .qz-pmap__face,
  .qz-pmap__marker.is-leader .qz-pmap__crown,
  .qz-pmap__marker.is-hopping .qz-pmap__face {
    animation: none;
  }
}
