/* =========================================================
   1) Collection menu: keep the glow centered BEHIND each medal
      at any screen size (glow is now positioned inside the
      medal's own column instead of the whole page).
   ========================================================= */
#collection .book-blue-close-container .col:has(> .glow-spin),
#collection .book-red-close-container .col:has(> .glow-spin),
#collection .book-orange-close-container .col:has(> .glow-spin),
#collection .col.glow-host {
  position: relative;
}

#collection .glow-spin-badge-blue,
#collection .glow-spin-badge-red,
#collection .glow-spin-badge-orange {
  top: 50% !important;
  left: 50% !important;
  margin: 0 !important;
  width: 133% !important;     /* same size as before (48% of screen) */
  max-width: none !important;
}

/* =========================================================
   2) AR scene: final gold medal (shown when 9/9 found)
   ========================================================= */
#ar-gold-medal {
  display: none;               /* JS shows it (flex) */
  position: fixed;
  inset: 0;
  z-index: 50;                 /* above AR scene, below UI (90) and popups (100) */
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

#ar-gold-medal .ar-gold-medal-stage {
  position: relative;
  width: min(55vw, 30vh);
  pointer-events: auto;
}

/* Glow behind the medal (same look as the collection medals) */
#ar-gold-medal .ar-gold-medal-glow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 190%;
  transform: translate(-50%, -50%);
  transform-origin: center center;
  animation: glowSpinOnly 30s linear infinite;
  z-index: 0;
  pointer-events: none;
}
#ar-gold-medal .ar-gold-medal-glow .ui-glow { width: 100%; opacity: 1; }

/* Turning medal (same tilt animation as the other medals) */
#ar-gold-medal .badge-flip-container {
  position: relative;
  left: auto;
  top: auto;
  margin: 0;
  width: 100%;
  aspect-ratio: 548 / 859;
  transform: none;
  display: block;
  perspective: 1000px;
  z-index: 1;
  cursor: pointer;
}
#ar-gold-medal .badge-flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  padding-top: 0;
  transform-style: preserve-3d;
}
#ar-gold-medal .badge-front-img,
#ar-gold-medal .badge-back-img,
#ar-gold-medal .badge-edge-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
#ar-gold-medal .badge-back-img { transform: rotateY(180deg); }

/* Close button */
#ar-gold-medal .ar-gold-medal-close {
  position: absolute;
  top: -4%;
  right: -14%;
  width: 22%;
  min-width: 36px;
  z-index: 2;
  cursor: pointer;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.4));
}

#ar-gold-medal.ar-gold-medal-in .ar-gold-medal-stage {
  animation: magicBounce 0.35s ease-out both;
}
