/* MAP floating coach — glowing orb + speech bubble */

.map-coach-root {
  position: fixed;
  /* Always under PackMate (11050+) so PackMate gets every click in its corner */
  z-index: 9000;
  max-width: min(22rem, calc(100vw - 1.25rem));
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transition:
    opacity 0.22s ease,
    transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    left 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    top 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  /* Default dock: bottom-LEFT — PackMate owns bottom-right */
  left: 14px;
  right: auto;
  top: auto;
  bottom: 18px;
  width: auto;
  height: auto;
}

.map-coach-root.is-on {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.map-coach-root.is-on:not(.is-min) {
  z-index: 9000;
}

.map-coach-root.is-min {
  max-width: none;
  width: auto !important;
  height: auto !important;
  /* Always bottom-left — never share PackMate’s corner */
  left: 14px !important;
  right: auto !important;
  top: auto !important;
  bottom: 18px !important;
  z-index: 8000;
  filter: drop-shadow(0 10px 28px rgba(0, 245, 212, 0.35));
}

/* Join-as-member orb — warmer gold so it reads as a different guide from founder create */
.map-coach-root.is-join .map-coach-orb {
  border-color: rgba(254, 228, 64, 0.85);
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.15) 18%, transparent 42%),
    radial-gradient(circle at 38% 35%, #fde68a 0%, #f59e0b 28%, transparent 55%),
    radial-gradient(circle at 70% 72%, #fb7185 0%, #f15bb5 40%, transparent 62%),
    radial-gradient(circle at 50% 50%, #7c2d12 0%, #1a0b12 70%);
  box-shadow:
    0 0 0 3px rgba(254, 228, 64, 0.18),
    0 0 22px rgba(245, 158, 11, 0.55),
    0 0 40px rgba(241, 91, 181, 0.28),
    inset 0 -8px 16px rgba(0, 0, 0, 0.35),
    inset 0 6px 12px rgba(255, 255, 255, 0.12);
}

.map-coach-root.is-join .map-coach-orb::after {
  border-color: rgba(254, 228, 64, 0.35);
}

.map-coach-root.is-join.is-min {
  filter: drop-shadow(0 10px 28px rgba(245, 158, 11, 0.4));
}

.map-coach-root.is-join .map-coach-kicker {
  color: #fde68a;
}

.map-coach-root.is-join .map-coach-next {
  border-color: rgba(254, 228, 64, 0.45);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(241, 91, 181, 0.2));
}

.map-coach-layout {
  display: flex;
  align-items: flex-end;
  gap: 0.55rem;
  pointer-events: none;
}

/* —— The orb itself —— */
.map-coach-orb {
  pointer-events: auto;
  flex: 0 0 auto;
  width: 3.6rem;
  height: 3.6rem;
  border-radius: 50%;
  border: 2px solid rgba(0, 245, 212, 0.75);
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.15) 18%, transparent 42%),
    radial-gradient(circle at 38% 35%, #e9d5ff 0%, #a78bfa 28%, transparent 55%),
    radial-gradient(circle at 70% 72%, #00f5d4 0%, #0ea5e9 40%, transparent 62%),
    radial-gradient(circle at 50% 50%, #4c1d95 0%, #12081f 70%);
  box-shadow:
    0 0 0 3px rgba(0, 245, 212, 0.14),
    0 0 22px rgba(155, 93, 229, 0.55),
    0 0 40px rgba(0, 245, 212, 0.25),
    inset 0 -8px 16px rgba(0, 0, 0, 0.35),
    inset 0 6px 12px rgba(255, 255, 255, 0.12);
  cursor: pointer;
  display: grid;
  place-items: center;
  position: relative;
  animation: map-coach-float 3.2s ease-in-out infinite;
  padding: 0;
  appearance: none;
}

.map-coach-orb::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid rgba(0, 245, 212, 0.25);
  animation: map-coach-ring 2.6s ease-out infinite;
  pointer-events: none;
}

.map-coach-orb-core {
  font-size: 1.25rem;
  line-height: 1;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.55));
  user-select: none;
}

/* Docked orb when hidden — slightly smaller so it never feels like it owns the corner */
.map-coach-root.is-min .map-coach-orb {
  width: 3.5rem;
  height: 3.5rem;
  border-width: 2px;
  animation: map-coach-float 2.8s ease-in-out infinite, map-coach-pulse 2.4s ease-in-out infinite;
}

.map-coach-root.is-min .map-coach-orb-core {
  font-size: 1.25rem;
}

@keyframes map-coach-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

@keyframes map-coach-pulse {
  0%,
  100% {
    box-shadow:
      0 0 0 3px rgba(0, 245, 212, 0.14),
      0 0 22px rgba(155, 93, 229, 0.5),
      0 0 36px rgba(0, 245, 212, 0.22);
  }
  50% {
    box-shadow:
      0 0 0 8px rgba(0, 245, 212, 0.1),
      0 0 36px rgba(155, 93, 229, 0.65),
      0 0 52px rgba(0, 245, 212, 0.4);
  }
}

@keyframes map-coach-ring {
  0% {
    transform: scale(0.92);
    opacity: 0.7;
  }
  100% {
    transform: scale(1.35);
    opacity: 0;
  }
}

/* Speech bubble beside the orb */
.map-coach-bubble {
  pointer-events: auto;
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  max-width: min(18.5rem, calc(100vw - 5.5rem));
  padding: 0.75rem 0.85rem 0.7rem;
  border-radius: 16px;
  border: 1px solid rgba(0, 245, 212, 0.45);
  background:
    radial-gradient(ellipse 90% 80% at 20% 0%, rgba(155, 93, 229, 0.28), transparent 55%),
    linear-gradient(165deg, rgba(22, 18, 40, 0.97), rgba(10, 8, 20, 0.98));
  color: #f4f0ff;
  font-family: inherit;
  line-height: 1.35;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.45));
}

.map-coach-root.is-min .map-coach-bubble {
  display: none;
}

.map-coach-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.map-coach-kicker {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #00f5d4;
}

/* Single hide control (×) — the glowing circle to the LEFT of the box is the orb itself */
.map-coach-hide {
  font-size: 1.1rem !important;
  font-weight: 700;
  line-height: 1;
}

.map-coach-tools {
  display: flex;
  gap: 0.25rem;
  pointer-events: auto;
}

.map-coach-tools button {
  appearance: none;
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: #d4cfff;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.map-coach-tools button:hover {
  background: rgba(0, 245, 212, 0.2);
  color: #fff;
}

.map-coach-text {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 500;
}

.map-coach-meta {
  margin: 0.45rem 0 0;
  font-size: 0.75rem;
  color: rgba(220, 210, 255, 0.72);
}

/* Clickable full step list — free tour forward/back */
.map-coach-roadmap {
  list-style: none;
  margin: 0.45rem 0 0;
  padding: 0.35rem 0.4rem;
  max-height: 9.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  border-radius: 0.55rem;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.map-coach-roadmap li {
  margin: 0;
  padding: 0;
}

.map-coach-road-btn {
  pointer-events: auto;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: rgba(226, 232, 240, 0.72);
  font: inherit;
  font-size: 0.72rem;
  line-height: 1.25;
  padding: 0.28rem 0.4rem;
  border-radius: 0.35rem;
  cursor: pointer;
}

.map-coach-road-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.map-coach-roadmap li.is-current .map-coach-road-btn {
  background: rgba(0, 245, 212, 0.16);
  color: #e2e8f0;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(0, 245, 212, 0.35);
}

.map-coach-root.is-join .map-coach-roadmap li.is-current .map-coach-road-btn {
  background: rgba(245, 158, 11, 0.18);
  box-shadow: inset 0 0 0 1px rgba(254, 228, 64, 0.4);
}

.map-coach-roadmap li.is-done .map-coach-road-btn {
  color: rgba(0, 245, 212, 0.75);
}

.map-coach-free-hint {
  margin: 0.35rem 0 0;
  font-size: 0.7rem;
  line-height: 1.35;
  color: rgba(226, 232, 240, 0.55);
}

.map-coach-roadmap li.is-remain .map-coach-road-btn {
  color: rgba(251, 191, 36, 0.9);
}

.map-coach-roadmap li.is-optional .map-coach-road-btn {
  color: rgba(226, 232, 240, 0.5);
}

.map-coach-remain-btn {
  pointer-events: auto;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(255, 180, 100, 0.45);
}

.map-coach-remain-btn:hover {
  color: #fff;
}

.map-coach-missing.is-complete {
  background: rgba(0, 245, 212, 0.12);
  border-color: rgba(0, 245, 212, 0.35);
  color: rgba(200, 255, 240, 0.95);
}

.map-coach-missing {
  margin: 0.5rem 0 0;
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  background: rgba(255, 90, 120, 0.12);
  border: 1px solid rgba(255, 90, 120, 0.35);
  font-size: 0.78rem;
  color: #ffc9d4;
}

.map-coach-missing strong {
  display: block;
  margin-bottom: 0.2rem;
  color: #ffb3c1;
}

.map-coach-missing ul {
  margin: 0;
  padding-left: 1.1rem;
}

.map-coach-actions {
  margin-top: 0.55rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.45rem;
  pointer-events: auto;
}

.map-coach-back,
.map-coach-next {
  appearance: none;
  border: 1px solid rgba(0, 245, 212, 0.55);
  background: linear-gradient(135deg, rgba(0, 245, 212, 0.22), rgba(155, 93, 229, 0.28));
  color: #f4f0ff;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  pointer-events: auto;
}

.map-coach-back {
  border-color: rgba(155, 93, 229, 0.45);
  background: rgba(255, 255, 255, 0.06);
  font-weight: 600;
}

.map-coach-back:hover:not(:disabled),
.map-coach-next:hover {
  border-color: rgba(0, 245, 212, 0.9);
  background: linear-gradient(135deg, rgba(0, 245, 212, 0.35), rgba(155, 93, 229, 0.4));
}

.map-coach-back:disabled,
.map-coach-back.is-disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

/* Tail points toward the orb (left of bubble) */
.map-coach-arrow {
  position: absolute;
  width: 12px;
  height: 12px;
  background: rgba(16, 12, 32, 0.98);
  border-right: 1px solid rgba(0, 245, 212, 0.45);
  border-bottom: 1px solid rgba(0, 245, 212, 0.45);
  left: -6px;
  bottom: 1.15rem;
  transform: rotate(135deg);
}

/* Placement classes still used for outer root positioning */
.map-coach-root.place-above .map-coach-arrow,
.map-coach-root.place-below .map-coach-arrow,
.map-coach-root.place-left .map-coach-arrow,
.map-coach-root.place-right .map-coach-arrow {
  /* keep tail toward orb on the left of bubble */
  left: -6px;
  bottom: 1.15rem;
  top: auto;
  right: auto;
  transform: rotate(135deg);
}

/* Soft highlight on current field */
.map-coach-target-glow {
  outline: 2px solid rgba(0, 245, 212, 0.55) !important;
  outline-offset: 3px;
  border-radius: 10px;
  transition: outline-color 0.2s ease;
}

/* Fireworks */
.map-coach-fx {
  position: fixed;
  inset: 0;
  z-index: 13000;
  pointer-events: none;
  overflow: hidden;
}

.map-coach-fx canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.map-coach-congrats {
  position: fixed;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%) scale(0.9);
  z-index: 13010;
  pointer-events: none;
  padding: 1rem 1.35rem;
  border-radius: 18px;
  border: 1px solid rgba(0, 245, 212, 0.5);
  background: rgba(12, 10, 24, 0.92);
  color: #f8f5ff;
  font-weight: 700;
  font-size: 1.15rem;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition:
    opacity 0.25s ease,
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.map-coach-congrats.is-on {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.map-coach-congrats small {
  display: block;
  margin-top: 0.35rem;
  font-weight: 500;
  font-size: 0.85rem;
  color: rgba(220, 210, 255, 0.8);
}

@media (max-width: 640px) {
  .map-coach-root {
    max-width: min(20rem, calc(100vw - 0.85rem));
  }

  .map-coach-orb {
    width: 3.15rem;
    height: 3.15rem;
  }

  .map-coach-root.is-min .map-coach-orb {
    width: 3.85rem;
    height: 3.85rem;
  }

  .map-coach-text {
    font-size: 0.88rem;
  }

  .map-coach-bubble {
    max-width: min(16.5rem, calc(100vw - 4.75rem));
  }
}
