/* JO Crystal — gem pet at the top of the Drippy stack + charging menu. */

/* Sits as the first child of #coach-avatar-col, above the highest unlocked
   Drippy. Static (no necklace, no drag); click opens the charge menu. Reuses
   the .af-pet sizing conventions of the other Drippy pets. */
.jo-crystal-pet{
  pointer-events:auto;
  cursor:pointer;
  position:relative;
  top:-40px;            /* lift 40px so it clears the drippy below (which pulls itself up 40px) */
  display:flex;
  align-items:center;
  justify-content:center;
  width:40px;
  margin-bottom:14px;
  z-index:2;
  filter:drop-shadow(0 0 6px rgba(220,150,190,0.5));
  transition:transform 0.12s ease, filter 0.15s ease;
}
.jo-crystal-pet:hover{
  transform:translateY(-2px) scale(1.1);
  filter:drop-shadow(0 0 10px rgba(255,190,225,0.85));
}
.jo-crystal-gem{ width:23px; height:54px; display:block; overflow:visible; }

/* Charged state (buff active): blue gem, glow pulse, gentle size pulse + stars. */
.jo-crystal-pet.jo-charged{ animation:joCrystChargedPulse 1.9s ease-in-out infinite; }
.jo-crystal-pet.jo-charged .jo-cryst-body{ fill:url(#jo-pet-grad-charged); stroke:rgba(180,220,255,0.9); }
.jo-crystal-pet.jo-charged .jo-cryst-facets{ stroke:rgba(200,230,255,0.8); }
.jo-crystal-pet.jo-charged .jo-cryst-shine{ fill:rgba(220,240,255,0.7); }
.jo-crystal-pet.jo-charged .jo-crystal-gem{ transform-origin:center; animation:joCrystGemPulse 1.9s ease-in-out infinite; }
@keyframes joCrystChargedPulse{
  0%,100%{ filter:drop-shadow(0 0 6px rgba(90,150,240,0.6)); }
  50%    { filter:drop-shadow(0 0 14px rgba(140,200,255,0.97)); }
}
@keyframes joCrystGemPulse{
  0%,100%{ transform:scale(1); }
  50%    { transform:scale(1.08); }
}

/* Sparkle stars around the gem — small, each drifting and twinkling on its own
   rhythm (separate durations/delays). Only animate while charged. */
.jo-spark{
  position:absolute;
  pointer-events:none;
  opacity:0;
  font-size:5px;
  line-height:1;
  color:#dff0ff;
  text-shadow:0 0 4px rgba(150,200,255,0.95),0 0 8px rgba(110,170,250,0.7);
  z-index:3;
}
.jo-spark1{ top:2px;    left:4px;   font-size:6px; }
.jo-spark2{ top:10px;   right:1px;  font-size:5px; }
.jo-spark3{ top:48%;    left:-2px;  font-size:5px; }
.jo-spark4{ bottom:8px; right:4px;  font-size:5px; }
.jo-spark5{ bottom:16px; left:1px;  font-size:3.6px; }
.jo-crystal-pet.jo-charged .jo-spark1{ animation:joSpark1 2.7s ease-in-out infinite;       }
.jo-crystal-pet.jo-charged .jo-spark2{ animation:joSpark2 3.4s ease-in-out 0.5s infinite;  }
.jo-crystal-pet.jo-charged .jo-spark3{ animation:joSpark3 3.0s ease-in-out 1.1s infinite;  }
.jo-crystal-pet.jo-charged .jo-spark4{ animation:joSpark4 3.7s ease-in-out 0.3s infinite;  }
.jo-crystal-pet.jo-charged .jo-spark5{ animation:joSpark5 2.5s ease-in-out 1.6s infinite;  }
@keyframes joSpark1{
  0%  { opacity:0;   transform:translate(0,0) scale(0.4) rotate(0deg); }
  35% { opacity:1;   transform:translate(3px,-4px) scale(1) rotate(40deg); }
  70% { opacity:0.6; transform:translate(6px,-1px) scale(0.8) rotate(70deg); }
  100%{ opacity:0;   transform:translate(2px,3px) scale(0.4) rotate(90deg); }
}
@keyframes joSpark2{
  0%  { opacity:0;   transform:translate(0,0) scale(0.4) rotate(0deg); }
  40% { opacity:1;   transform:translate(-4px,-3px) scale(1) rotate(-35deg); }
  75% { opacity:0.6; transform:translate(-2px,-6px) scale(0.85) rotate(-60deg); }
  100%{ opacity:0;   transform:translate(-5px,-1px) scale(0.4) rotate(-90deg); }
}
@keyframes joSpark3{
  0%  { opacity:0;   transform:translate(0,0) scale(0.4) rotate(0deg); }
  35% { opacity:1;   transform:translate(-3px,3px) scale(1) rotate(30deg); }
  70% { opacity:0.6; transform:translate(-6px,-2px) scale(0.8) rotate(55deg); }
  100%{ opacity:0;   transform:translate(-2px,-4px) scale(0.4) rotate(90deg); }
}
@keyframes joSpark4{
  0%  { opacity:0;   transform:translate(0,0) scale(0.4) rotate(0deg); }
  40% { opacity:1;   transform:translate(4px,3px) scale(1) rotate(-40deg); }
  72% { opacity:0.6; transform:translate(1px,6px) scale(0.85) rotate(-65deg); }
  100%{ opacity:0;   transform:translate(5px,2px) scale(0.4) rotate(-90deg); }
}
@keyframes joSpark5{
  0%  { opacity:0;   transform:translate(0,0) scale(0.4) rotate(0deg); }
  38% { opacity:1;   transform:translate(-3px,-3px) scale(1) rotate(45deg); }
  70% { opacity:0.6; transform:translate(3px,-5px) scale(0.8) rotate(75deg); }
  100%{ opacity:0;   transform:translate(0,-7px) scale(0.4) rotate(95deg); }
}

/* ── Menu ─────────────────────────────────────────────────────────────────── */
.jo-crystal-menu{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
}
/* Menu silhouette matches the pendant SVG exactly:
     viewBox 48×128 → polygon points 0,12 10,0 38,0 48,12 48,96 24,128 0,96.
   In percentages that's 0% 9.375% / 20.833% 0% / 79.167% 0% / 100% 9.375% /
   100% 75% / 50% 100% / 0% 75%. Aspect-ratio 3/8 keeps the proportions exact
   so stroke widths and the fill bar don't distort. */
.jo-menu-shape{
  position:relative;
  height:min(760px, 88vh);
  aspect-ratio:3 / 8;
  filter:drop-shadow(0 0 22px rgba(255,200,220,0.45));
}
.jo-menu-clip{
  position:absolute;inset:0;
  clip-path:polygon(0% 9.375%, 20.833% 0%, 79.167% 0%, 100% 9.375%, 100% 75%, 50% 100%, 0% 75%);
  overflow:hidden;
}
.jo-menu-bg-shape{
  position:absolute;inset:0;
  background:
    linear-gradient(180deg,rgba(255,240,245,0.22) 0%,rgba(245,215,225,0.14) 50%,rgba(220,190,210,0.22) 100%),
    radial-gradient(ellipse at 50% 25%,rgba(255,255,255,0.22) 0%,transparent 60%);
  box-shadow:inset 0 0 80px rgba(255,255,255,0.08);
}
/* Vertical fill bar — fills bottom-up, clipped to the crystal silhouette by
   .jo-menu-clip. Made noticeably saturated/opaque so the progress reads at a
   glance. */
.jo-menu-fill{
  position:absolute;
  left:0;right:0;bottom:0;
  height:0%;
  background:linear-gradient(180deg,rgba(160,210,255,0.85) 0%,rgba(60,130,230,0.95) 100%);
  transition:height 0.45s ease;
  box-shadow:0 -10px 30px rgba(80,150,230,0.55) inset, 0 0 24px rgba(120,180,255,0.5);
}
/* White border — drawn as an SVG stroke that traces the same polygon, on
   top of everything else so it cleanly outlines the silhouette. */
.jo-menu-outline{
  position:absolute;inset:0;
  width:100%;height:100%;
  pointer-events:none;
  overflow:visible;
  z-index:2;
}
.jo-menu-outline polygon{
  fill:none;
  stroke:#ffffff;
  stroke-width:0.9;
  stroke-linejoin:round;
  filter:drop-shadow(0 0 4px rgba(255,255,255,0.55));
}
.jo-menu-content{
  position:absolute;inset:0;
  padding:13% 9% 28%;
  display:flex;flex-direction:column;align-items:center;
  text-align:center;
  color:#f0e8f0;
  font-family:'Exo 2',sans-serif;
  z-index:3;
}
.jo-menu-content h2{
  font-size:26px;
  font-weight:800;
  margin:0 0 16px;
  letter-spacing:1.2px;
  color:#ffffff;
  text-shadow:0 0 14px rgba(255,200,230,0.6),0 1px 3px rgba(0,0,0,0.6);
}
.jo-charge-text{
  font-size:17px;
  font-weight:700;
  color:#ffe8f0;
  text-shadow:0 1px 2px rgba(0,0,0,0.6);
  margin-bottom:6px;
  line-height:1.4;
}
.jo-charge-pct{
  font-size:14px;
  font-weight:700;
  color:#d8c0d0;
  margin-top:2px;
}
.jo-charge-row{
  display:flex;gap:6px;margin-top:18px;width:100%;justify-content:center;
}
.jo-charge-row input{
  flex:1;max-width:160px;
  padding:7px 10px;
  border-radius:6px;
  border:1px solid rgba(255,255,255,0.4);
  background:rgba(20,10,24,0.5);
  color:#fff;
  font-size:16px;font-weight:700;
  text-align:center;
  font-family:inherit;
}
.jo-charge-row input:focus{outline:none;border-color:rgba(255,220,240,0.9);}
.jo-charge-btn,
.jo-charge-max,
.jo-menu-close{
  padding:8px 18px;
  border-radius:6px;
  border:1px solid rgba(255,255,255,0.4);
  background:linear-gradient(135deg,rgba(180,90,140,0.7),rgba(110,40,90,0.7));
  color:#fff;font-size:16px;font-weight:700;
  cursor:pointer;font-family:inherit;
  transition:filter 0.15s,transform 0.1s;
}
.jo-charge-btn:hover,
.jo-charge-max:hover,
.jo-menu-close:hover{ filter:brightness(1.2); }
.jo-charge-max{
  margin-top:8px;
  padding:6px 14px;
  font-size:14px;
  background:linear-gradient(135deg,rgba(80,140,200,0.65),rgba(40,80,160,0.65));
}
.jo-menu-close{
  margin-top:auto;
  position:relative;
  top:-5px;            /* nudged up to make room for the bigger text + charge meter */
  background:linear-gradient(135deg,rgba(80,40,60,0.7),rgba(40,20,30,0.7));
  font-size:14px;padding:6px 18px;
}
/* Vertical charge meter — fills the space between Charge Max and Close, rising
   bottom→top with how full the crystal is. Live-updated by the 1Hz tick. */
.jo-meter{
  flex:1;
  width:34px;
  min-height:50px;
  margin:12px 0;
  position:relative;
  border-radius:8px;
  border:1px solid rgba(255,255,255,0.45);
  background:rgba(20,10,24,0.5);
  overflow:hidden;
  box-shadow:inset 0 0 6px rgba(0,0,0,0.45);
}
.jo-meter-fill{
  position:absolute;
  left:0;right:0;bottom:0;
  width:100%;
  height:0%;
  border-radius:8px;
  background:linear-gradient(0deg,rgba(60,130,230,0.95),rgba(160,210,255,0.9));
  box-shadow:0 0 10px rgba(120,180,255,0.6);
  transition:height 0.45s ease;
}
.jo-buff-active{
  margin-top:18px;
  padding:14px 18px;
  border-radius:8px;
  background:rgba(40,80,180,0.35);
  border:1px solid rgba(140,200,255,0.6);
  color:#e8f4ff;
  font-size:17px;font-weight:700;
  text-shadow:0 0 10px rgba(120,180,255,0.7);
  line-height:1.5;
}

/* Charged-state visual: blue gradient overrides + glow on the menu shape. */
.jo-crystal-menu.charged .jo-menu-bg-shape{
  background:
    linear-gradient(180deg,rgba(180,220,255,0.36) 0%,rgba(80,140,220,0.32) 60%,rgba(40,90,180,0.45) 100%),
    radial-gradient(ellipse at 50% 30%,rgba(220,240,255,0.5) 0%,transparent 60%);
  box-shadow:inset 0 0 110px rgba(160,220,255,0.4);
}
.jo-crystal-menu.charged .jo-menu-shape{
  filter:drop-shadow(0 0 30px rgba(80,160,255,0.85));
  animation:joMenuChargedPulse 2.2s ease-in-out infinite;
}
.jo-crystal-menu.charged .jo-menu-outline polygon{
  stroke:#bfe1ff;
  filter:drop-shadow(0 0 6px rgba(140,200,255,0.85));
}
.jo-crystal-menu.charged .jo-menu-content h2{
  color:#e8f4ff;
  text-shadow:0 0 18px rgba(140,200,255,0.85),0 1px 3px rgba(0,0,0,0.5);
}
@keyframes joMenuChargedPulse{
  0%,100%{filter:drop-shadow(0 0 30px rgba(80,160,255,0.85));}
  50%   {filter:drop-shadow(0 0 60px rgba(140,210,255,1));}
}
