/* Scene map: the current page shrinks to the centre and its categories branch out in glass. */
.discover-poster { -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.scene-map {
  position: fixed; inset: 0; z-index: 80; color: white; touch-action: none; user-select: none; -webkit-user-select: none;
  background: radial-gradient(ellipse at center, #0c141ba8, #080e13d9);
  backdrop-filter: blur(22px) saturate(1.15); -webkit-backdrop-filter: blur(22px) saturate(1.15);
  animation: map-veil .32s ease-out both;
}
@keyframes map-veil { from { background-color: transparent; opacity: 0; } }
.map-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.map-lines line { stroke: #ffffff59; stroke-width: 1; stroke-dasharray: 3 5; animation: map-line .5s .12s ease-out both; }
@keyframes map-line { from { opacity: 0; } }
.map-level { position: absolute; inset: 0; }
.map-node {
  position: absolute; transform: translate(-50%, -50%); width: 124px; padding: 0; margin: 0; border: 0; background: none; color: inherit;
  display: grid; justify-items: center; gap: 5px; text-align: center; cursor: pointer; font: inherit;
}
.map-art {
  display: grid; place-items: center; width: 82px; height: 82px; padding: 4px; border-radius: 50%; overflow: hidden;
  border: 1px solid #ffffff80; background: linear-gradient(125deg, #ffffff2e, #ffffff08 52%, #ffffff1c), #1e20253d;
  box-shadow: inset 0 1px 0 #ffffff45, 0 8px 24px #0006;
  transition: transform .18s ease, border-color .18s, box-shadow .18s;
}
.map-art img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; pointer-events: none; }
.map-art i svg { width: 26px; height: 26px; }
.map-node strong { font: 400 14px/1.2 Georgia, serif; text-shadow: 0 1px 6px #000c; max-width: 124px; }
.map-node small { font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: #ffffffb8; text-shadow: 0 1px 4px #000c; }
.map-node.is-current .map-art { border-color: white; box-shadow: inset 0 1px 0 #ffffff45, 0 0 0 3px #ffffff38, 0 8px 24px #0006; }
.map-node:is(.is-hover, :hover, :focus-visible) .map-art { transform: scale(1.14); border-color: white; box-shadow: inset 0 1px 0 #ffffff70, 0 0 0 5px #ffffff40, 0 10px 30px #0008; }
.map-node:focus-visible { outline: none; }
.map-centre { width: 150px; z-index: 1; }
.map-centre .map-art { width: 104px; height: 132px; border-radius: 18px; }
.map-centre .map-art img { border-radius: 14px; }
.map-centre strong { font-size: 15px; max-width: 150px; }
.map-level:not(.is-shrinking) .map-node { animation: map-pop .3s cubic-bezier(.2,.8,.3,1.1) both; }
.is-shrinking .map-node:not(.map-centre) { animation: map-pop .34s .16s cubic-bezier(.2,.8,.3,1.1) both; }
.is-shrinking .map-centre :is(strong, small) { animation: map-line .3s .25s both; }
/* The centre starts at the size of the whole page, so the page is seen to shrink into the map. */
.is-shrinking .map-centre .map-art { animation: map-shrink .42s cubic-bezier(.3,0,.15,1) both; }
@keyframes map-shrink { from { transform: scale(var(--map-zoom, 7)); border-radius: 0; border-color: transparent; } }
@keyframes map-pop { from { opacity: 0; transform: translate(-50%, -50%) scale(.6); } }
.map-prompt {
  position: absolute; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 26px); transform: translateX(-50%); margin: 0;
  padding: 9px 16px; border-radius: 999px; white-space: nowrap; font-size: 11px; letter-spacing: .09em; text-transform: uppercase;
  border: 1px solid #ffffff59; background: #ffffff1a; box-shadow: inset 0 1px 0 #ffffff33; pointer-events: none;
}
.map-close {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 21px); right: 4vw; width: 36px; height: 36px; padding: 0;
  display: grid; place-items: center; border-radius: 50%; color: white; cursor: pointer;
  border: 1px solid #ffffff80; background: #ffffff1f; box-shadow: inset 0 1px 0 #ffffff45;
}
.map-close svg { width: 15px; height: 15px; }
.map-close:focus-visible { outline: 2px solid white; outline-offset: 2px; }
body.scene-map-open :is(.life-header, .life-nav) { visibility: hidden; }

/* First visit: the scene dims and a ghost finger plays the whole gesture. */
.map-coach {
  position: fixed; inset: 0; z-index: 45; pointer-events: none; color: white; text-align: center;
  display: grid; align-content: center; justify-items: center; gap: 14px; padding: 24px;
  background: radial-gradient(ellipse at center, #0a1118b3, #0a11188c); animation: map-line .45s both;
}
.map-coach h2 { margin: 6px 0 0; font: 400 clamp(22px, 2.2vw, 30px)/1.15 Georgia, serif; color: white; text-shadow: 0 1px 8px #000a; }
.map-coach ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.map-coach li {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 8px; border-radius: 999px; font-size: 13px;
  border: 1px solid #ffffff66; background: linear-gradient(125deg, #ffffff2e, #ffffff0a 52%, #ffffff1c), #1e202552;
  box-shadow: inset 0 1px 0 #ffffff45; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.map-coach li b { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: white; color: #1b2a36; font-size: 11px; }
.coach-stage { position: relative; width: 280px; height: 250px; }
.coach-stage > span { position: absolute; left: 50%; top: 50%; }
/* A round ghost shows where to press and how long: the ring closes in while the press is held. */
.coach-press {
  width: 78px; height: 78px; margin: -39px 0 0 -39px; border-radius: 50%; border: 2px solid white;
  background: radial-gradient(circle, #ffffffb8, #ffffff4d 70%); box-shadow: 0 0 0 10px #ffffff24, 0 6px 26px #0008;
  animation: coach-press 4.4s ease-in-out infinite;
}
.coach-ring { width: 150px; height: 150px; margin: -75px 0 0 -75px; border-radius: 50%; border: 2px solid white; animation: coach-ring 4.4s ease-in-out infinite; }
/* Ghost arrows then fan out from the circle, one chevron after another, showing where to slide. */
.coach-arrow { width: 0; height: 0; transform: rotate(var(--angle)) translateX(58px); }
.coach-arrow i {
  position: absolute; top: -8px; left: calc(var(--n) * 17px); width: 14px; height: 14px; transform: scaleY(.6) rotate(45deg);
  border-top: 2.5px solid white; border-right: 2.5px solid white; filter: drop-shadow(0 1px 3px #000a);
  animation: coach-arrow 4.4s ease-out infinite; animation-delay: calc(var(--n) * .16s);
}
.coach-arrow i:nth-child(1) { --n: 0; } .coach-arrow i:nth-child(2) { --n: 1; } .coach-arrow i:nth-child(3) { --n: 2; }
@keyframes coach-press { 0%,6% { scale: 1.12; opacity: .55; } 16%,40% { scale: .88; opacity: 1; } 52%,100% { scale: 1; opacity: .7; } }
@keyframes coach-ring { 0%,6% { scale: 1; opacity: 0; } 14% { scale: 1; opacity: .9; } 40% { scale: .56; opacity: .9; } 46%,100% { scale: .56; opacity: 0; } }
@keyframes coach-arrow { 0%,40% { opacity: 0; translate: -10px 0; } 52% { opacity: 1; translate: 0 0; } 78% { opacity: 1; translate: 6px 0; } 94%,100% { opacity: 0; translate: 14px 0; } }

/* In the real map, while the finger is still down, arrows run out along every branch. */
.map-arrow { animation: map-arrow 1.3s ease-in-out infinite; }
.map-arrow path { fill: none; stroke: white; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 1px 3px #000a); }
@keyframes map-arrow { 0% { opacity: 0; transform: translateX(-12px); } 35%,65% { opacity: .95; } 100% { opacity: 0; transform: translateX(14px); } }

/* Until the map has been used once, a round ghost stays on the scene as the place to press. */
.map-reminder {
  position: fixed; left: 50%; top: 60%; transform: translate(-50%, -50%); z-index: 30; margin: 0; pointer-events: none;
  display: grid; justify-items: center; gap: 12px; color: white; animation: map-line .4s both;
}
.map-reminder i {
  width: 58px; height: 58px; border-radius: 50%; border: 1.5px solid #ffffffe6;
  background: radial-gradient(circle, #ffffff8c, #ffffff2e 70%); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: coach-pulse 2s ease-out infinite;
}
.map-reminder span { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; text-shadow: 0 1px 4px #000c; }
@keyframes coach-pulse { 0% { box-shadow: 0 0 0 0 #ffffffa6, 0 4px 18px #0006; scale: 1; } 50% { scale: .92; } 100% { box-shadow: 0 0 0 20px #fff0, 0 4px 18px #0006; scale: 1; } }
body.scene-map-open :is(.map-coach, .map-reminder) { visibility: hidden; }

@media (max-width: 640px) {
  .map-node { width: 96px; gap: 4px; }
  .map-art { width: 60px; height: 60px; padding: 3px; }
  .map-node strong { font-size: 11.5px; max-width: 96px; }
  .map-node small { font-size: 8px; }
  .map-centre { width: 116px; }
  .map-centre .map-art { width: 78px; height: 100px; border-radius: 14px; }
  .map-centre .map-art img { border-radius: 11px; }
  .map-centre strong { font-size: 13px; max-width: 116px; }
  .map-close { top: calc(env(safe-area-inset-top, 0px) + 13px); right: 20px; }
  .map-coach ol { flex-direction: column; align-items: center; }
  .map-coach li { font-size: 12.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .scene-map, .scene-map *, .map-coach, .map-coach *, .map-reminder, .map-reminder * { animation: none !important; transition: none !important; }
  .coach-ring { opacity: 0; } .coach-arrow i { opacity: 1; }
}
