/* Gamify v31 — home stars, bubble traces, rank glow, scroll UX */

.v2-stars {
  pointer-events: none;
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
}
.v2-stars::before,
.v2-stars::after {
  content: '';
  position: absolute;
  inset: -50%;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.35) 0%, transparent 100%),
    radial-gradient(1px 1px at 60% 70%, rgba(255,255,255,0.25) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 80% 20%, rgba(232,244,255,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 40% 80%, rgba(255,255,255,0.2) 0%, transparent 100%);
  background-size: 200% 200%;
  animation: gfy-stars-drift 120s linear infinite;
  opacity: 0.45;
}
.v2-stars::after {
  animation-duration: 180s;
  animation-direction: reverse;
  opacity: 0.25;
}
@keyframes gfy-stars-drift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-8%, -12%, 0); }
}

.v2-home > *:not(.v2-stars) { position: relative; z-index: 1; }

.v2-home-gear {
  position: absolute;
  left: max(16px, env(safe-area-inset-left));
  bottom: max(20px, env(safe-area-inset-bottom));
  width: 52px;
  height: 52px;
  border-radius: 16px;
  border: 1px solid rgba(232,244,255,0.25);
  background: rgba(12,12,24,0.85);
  color: #E8F4FF;
  font-size: 22px;
  cursor: pointer;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.v2-home-greeting-block { padding: 0 20px 8px; flex-shrink: 0; }
.v2-home-greeting-block .v2-home-greeting { font-size: 15px; text-align: left; }

.v3-rank-bar { width: 100%; }
.v3-rank-bar-fill { background: #f0f0f8; }
.v3-rank-bar-fill.high { background: var(--green); }

.rank-tier-card.unlocked .v3-rank-badge-xl svg {
  filter: drop-shadow(0 0 14px rgba(139,131,232,0.55));
}

.gfy-coin-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(240,164,41,0.12);
  border: 1px solid rgba(240,164,41,0.35);
  border-radius: 999px;
  padding: 6px 12px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: #F0A429;
  cursor: pointer;
}

.v2-bubble-tile { --bubble-outline: rgba(255,255,255,0.5); }
.v2-bubble-tile::after {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: calc(var(--v2-radius) - 8px);
  border: 1.5px solid var(--bubble-outline);
  opacity: 0.7;
  pointer-events: none;
  animation: gfy-bubble-trace 4s linear infinite;
}
@keyframes gfy-bubble-trace {
  0% { clip-path: inset(0 70% 92% 0); }
  25% { clip-path: inset(0 0 70% 92%); }
  50% { clip-path: inset(92% 0 0 70%); }
  75% { clip-path: inset(70% 92% 0 0); }
  100% { clip-path: inset(0 70% 92% 0); }
}
.v2-bubble-tile.workout { --bubble-outline: rgba(29,184,122,0.85); }
.v2-bubble-tile.budget { --bubble-outline: rgba(240,212,0,0.85); }
.v2-bubble-tile.achievements { --bubble-outline: rgba(139,131,232,0.9); }
.v2-bubble-tile.nutrition { --bubble-outline: rgba(232,244,255,0.75); }

.v2-scroll-indicator {
  position: absolute;
  left: 4px;
  top: 12%;
  bottom: 12%;
  width: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  z-index: 20;
}
.v2-scroll-indicator::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 18%;
  min-height: 24px;
  border-radius: 999px;
  background: var(--purple);
  top: calc(var(--scroll-pct, 0) * 82%);
  transition: top 0.25s ease;
}

.v2-rail-icon.scroll-selected {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}

.nut-macro-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.ach-ring-value-only .v2-ring-label { display: none; }

.wk-plate-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0;
}
.wk-plate-btn {
  padding: 12px 8px;
  border-radius: 12px;
  border: 1px solid var(--border2);
  background: var(--surface2);
  font-family: var(--mono);
  font-weight: 700;
  cursor: pointer;
}

.v2-card-inner.meal-log-scroll {
  max-height: 55vh;
  min-height: 280px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

#boot-debug { display: none !important; }
#loading-sub { display: none !important; }

.merch-spin-card { animation: merch-rotate-y 8s linear infinite; }
@keyframes merch-rotate-y {
  from { transform: rotateY(0deg); }
  to { transform: rotateY(360deg); }
}

.plans-rank-showcase { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 16px 0; }
