/* Budget Bear — social styles: auth, identity card, avatars, groups, leaderboard */

/* ------- Auth ------- */

.auth-screen { max-width: 400px; margin: 0 auto; }
.auth-hero {
  text-align: center;
  padding: var(--sp-8) 0 var(--sp-6);
}
.auth-hero img { margin: 0 auto var(--sp-4); }
.auth-hero p { margin-top: var(--sp-2); font-size: var(--fs-14); }
.auth-alt { margin-top: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-1); }

/* ------- Accent picker ------- */

.accent-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.accent-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--dot);
  border: 3px solid transparent;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.65);
  transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast);
}
.accent-dot:active { transform: scale(0.9); }
.accent-dot[aria-checked="true"] {
  border-color: var(--text);
  transform: scale(1.08);
}

/* ------- Avatars ------- */

.avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--tint);
  display: inline-block;
}
.avatar-fallback {
  display: inline-grid;
  place-items: center;
  background: var(--green-600);
  color: var(--white);
  font-weight: var(--fw-semibold);
}
.avatar-stack { display: flex; align-items: center; }
.avatar-stack .avatar { position: relative; }
.avatar-more {
  margin-left: 6px;
  font-size: var(--fs-12);
  color: var(--text-2);
  font-weight: var(--fw-medium);
}

/* ------- Identity card (Discord-style) ------- */

.id-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
.id-banner {
  height: 72px;
  background: var(--banner, var(--green-600));
}
.id-body {
  padding: 0 var(--sp-4) var(--sp-4);
}
.id-avatar-wrap {
  margin-top: -38px;
  margin-bottom: var(--sp-2);
  display: inline-block;
}
.id-name {
  font-size: var(--fs-20);
  font-weight: var(--fw-bold);
  letter-spacing: -0.01em;
  display: inline-block;
}
.id-pronouns {
  font-size: var(--fs-12);
  color: var(--text-2);
  margin-left: 6px;
}
.id-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  background: var(--off-white);
  border: 1px solid var(--border);
  font-size: var(--fs-13);
}
.id-about {
  margin-top: var(--sp-3);
  font-size: var(--fs-14);
  color: var(--text-2);
  line-height: 1.45;
  border-top: 1px solid var(--border);
  padding-top: var(--sp-3);
}

/* Edit profile: tappable avatar with camera badge, live counters */
.ep-avatar-btn {
  position: relative;
  display: inline-block;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 50%;
}
.ep-avatar-btn:active { transform: scale(0.96); }
.ep-avatar-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  font-size: 13px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
}
.char-count {
  float: right;
  font-weight: var(--fw-regular);
  color: var(--text-2);
  font-size: var(--fs-11);
}

.profile-stats.card {
  display: flex;
  justify-content: space-around;
  gap: var(--sp-4);
  margin-top: var(--sp-3);
  padding: var(--sp-4);
  border-top: 1px solid var(--border);
  text-align: center;
}

/* ------- Groups list ------- */

.group-card .icon-bubble { flex-shrink: 0; }

.invite-box {
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  background: var(--off-white);
  padding: var(--sp-3) var(--sp-4);
}
.invite-url {
  font-size: var(--fs-13);
  word-break: break-all;
  color: var(--green-800);
  font-weight: var(--fw-medium);
}

.join-facts {
  display: flex;
  justify-content: center;
  gap: var(--sp-6);
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
}
.join-facts small { display: block; color: var(--text-2); font-size: var(--fs-11); margin-bottom: 2px; }
.join-facts strong { font-size: var(--fs-15); }

/* ------- Group detail ------- */

.gd-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.gd-hero { padding: var(--sp-5); }
.gd-tip {
  margin-top: 12px;
  padding: 12px 14px;
  background: linear-gradient(180deg, var(--surface), var(--tint));
  border-color: var(--green-100);
}

/* Leaderboard rows */

.member-row {
  padding: 12px 14px;
  border-left: 3px solid var(--accent, var(--green-600));
}
.member-row.me {
  background: linear-gradient(90deg, var(--surface) 60%, color-mix(in srgb, var(--accent) 7%, var(--surface)));
}
.member-row .rank {
  width: 26px;
  text-align: center;
  font-size: 16px;
  flex-shrink: 0;
}
.member-row .rank-num {
  font-size: var(--fs-13);
  color: var(--text-3);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
}
.member-name {
  font-weight: var(--fw-semibold);
  font-size: var(--fs-15);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.you-tag {
  font-size: var(--fs-11);
  font-weight: var(--fw-semibold);
  color: var(--accent, var(--green-700));
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.member-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
}
.member-badges > * { flex-shrink: 0; }
.member-status {
  font-size: var(--fs-12);
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.member-bar {
  height: 6px;
  border-radius: var(--r-full);
  background: var(--green-50);
  overflow: hidden;
  margin-top: 7px;
}
.member-bar i {
  display: block;
  height: 100%;
  border-radius: var(--r-full);
  background: var(--accent, var(--green-600));
  transition: width var(--dur-slow) var(--ease-out);
}
.member-row .end { text-align: right; }
.member-row .end .amount { font-weight: var(--fw-bold); font-size: var(--fs-15); }
.member-row .end .meta { font-size: var(--fs-12); color: var(--text-2); }

/* ------- Flair ring around avatars ------- */

.flair-ring {
  display: inline-flex;
  padding: 2.5px;
  border-radius: 50%;
  flex-shrink: 0;
}
.flair-ring .avatar { border: 2px solid var(--surface) !important; }

/* ------- Level chip ------- */

.level-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--r-full);
  background: var(--green-50);
  color: var(--green-800);
  font-size: var(--fs-11);
  font-weight: var(--fw-bold);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ------- Shop ------- */

.points-balance { display: inline-flex; align-items: center; gap: 4px; }

.shop-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-2);
}
.shop-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast);
}
.shop-tile:active { transform: scale(0.96); }
.shop-tile.equipped { border-color: var(--green-600); background: var(--tint); }
.shop-tile small {
  font-size: var(--fs-12);
  font-weight: var(--fw-medium);
  color: var(--text);
}
.shop-tile.locked-tile { opacity: 0.85; }

.shop-swatch {
  display: inline-block;
  width: 96px;
  height: 34px;
  border-radius: var(--r-sm);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.shop-price {
  font-size: var(--fs-11);
  font-weight: var(--fw-semibold);
  color: var(--green-700);
  background: var(--green-50);
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-variant-numeric: tabular-nums;
}
.shop-state {
  font-size: var(--fs-11);
  font-weight: var(--fw-semibold);
  color: var(--text-2);
  padding: 2px 8px;
}
.shop-state.on { color: var(--green-700); }

.shop-fx {
  font-weight: var(--fw-bold);
  font-size: var(--fs-16);
  padding: 4px 6px;
}

/* ------- User tag pills (equipped slogan tags) ------- */

.user-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--tag, var(--green-600)) 26%, var(--surface)),
    color-mix(in srgb, var(--tag, var(--green-600)) 11%, var(--surface)));
  border: 1px solid color-mix(in srgb, var(--tag, var(--green-600)) 46%, transparent);
  color: color-mix(in srgb, var(--tag, var(--green-600)) 72%, var(--text));
  font-size: var(--fs-11);
  font-weight: var(--fw-bold);
  letter-spacing: 0.01em;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, #ffffff 45%, transparent),
    0 1px 2px color-mix(in srgb, var(--tag, var(--green-600)) 28%, transparent);
}
.user-tag .tag-glyph { font-size: 0.92em; line-height: 1; }

/* Filled gradient — bold, high-contrast. */
.user-tag.tag-gradient {
  color: #fff;
  background: linear-gradient(135deg, var(--tag), color-mix(in srgb, var(--tag) 58%, #000 12%));
  border-color: transparent;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
}
/* Metallic — brushed sheen sweeping across, tinted by --tag (gold, silver…). */
.user-tag.tag-metal {
  color: color-mix(in srgb, var(--tag) 62%, #000);
  background: linear-gradient(120deg,
    color-mix(in srgb, var(--tag) 55%, #fff),
    #ffffff 40%,
    color-mix(in srgb, var(--tag) 72%, #000 6%) 58%,
    color-mix(in srgb, var(--tag) 55%, #fff));
  background-size: 220% 100%;
  border-color: color-mix(in srgb, var(--tag) 60%, #000 8%);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
  animation: tag-sheen 4s linear infinite;
}
/* Holographic — iridescent color drift, the top rarity look. */
.user-tag.tag-holo {
  color: #2a2036;
  background: linear-gradient(100deg, #ffd1f0, #c8e0ff, #c6ffe6, #fff3c4, #ffd1f0);
  background-size: 300% 100%;
  border-color: rgba(178, 150, 220, 0.65);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
  animation: tag-holo 5s linear infinite;
}
@keyframes tag-sheen { from { background-position: 200% 0; } to { background-position: -60% 0; } }
@keyframes tag-holo  { from { background-position: 0 0; }    to { background-position: 300% 0; } }
@media (prefers-reduced-motion: reduce) {
  .user-tag.tag-metal, .user-tag.tag-holo { animation: none !important; }
}

/* ------- Name effects (GPU-friendly: background-position/opacity/transform) ------- */

.fx-shimmer {
  background: linear-gradient(100deg, var(--text) 40%, #9dd48a 50%, var(--text) 60%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: fx-slide 2.6s linear infinite;
}
.fx-rainbow {
  background: linear-gradient(100deg, #ff5f6d, #ffc371, #7FC96A, #2193b0, #c86dd7, #ff5f6d);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: fx-slide 4s linear infinite;
}
.fx-gold {
  background: linear-gradient(100deg, #b8860b, #ffd700 45%, #fff3b0 55%, #ffd700 65%, #b8860b);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: fx-slide 3s linear infinite;
}
.fx-frost {
  background: linear-gradient(100deg, #4a7ba6, #bfe6ff 45%, #ffffff 55%, #bfe6ff 65%, #4a7ba6);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: fx-slide 3.4s linear infinite;
}
@keyframes fx-slide {
  from { background-position: 200% 0; }
  to   { background-position: -100% 0; }
}

.fx-wave {
  display: inline-block;
  animation: fx-bounce 1.6s var(--ease-inout) infinite;
}
@keyframes fx-bounce {
  0%, 100% { transform: translateY(0); }
  30% { transform: translateY(-3px); }
  60% { transform: translateY(1px); }
}

.fx-sparkle { position: relative; }
.fx-sparkle::before, .fx-sparkle::after {
  content: "✦";
  position: absolute;
  font-size: 0.55em;
  color: #C9A227;
  animation: fx-twinkle 1.8s ease infinite;
}
.fx-sparkle::before { top: -0.45em; right: -0.75em; }
.fx-sparkle::after { bottom: -0.35em; left: -0.75em; animation-delay: 0.9s; }
@keyframes fx-twinkle {
  0%, 100% { opacity: 0; transform: scale(0.6) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.1) rotate(40deg); }
}

/* High-end name effects */
.fx-plasma {
  background: linear-gradient(100deg, #7f5fff, #ff6ec4 30%, #4adede 55%, #ff6ec4 75%, #7f5fff);
  background-size: 320% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: fx-slide 3.2s linear infinite;
}
.fx-ember {
  background: linear-gradient(100deg, #7a1500, #ff5e00 35%, #ffd23f 52%, #ff5e00 68%, #7a1500);
  background-size: 260% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: fx-slide 2.8s linear infinite;
  filter: drop-shadow(0 0 5px rgba(255, 94, 0, 0.4));
}
.fx-prismatic {
  background: linear-gradient(100deg, #ff5f6d, #ffc371, #7FC96A, #2193b0, #c86dd7, #ff5f6d);
  background-size: 400% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: fx-slide 2.4s linear infinite;
  filter: drop-shadow(0 0 4px rgba(200, 109, 215, 0.45));
}

@media (prefers-reduced-motion: reduce) {
  .fx-shimmer, .fx-rainbow, .fx-gold, .fx-frost, .fx-wave,
  .fx-plasma, .fx-ember, .fx-prismatic,
  .fx-sparkle::before, .fx-sparkle::after {
    animation: none !important;
  }
}

/* ------- Daily Spin wheel ------- */

.spin-overlay .achievement-card { width: 100%; }

.spin-stage {
  position: relative;
  width: 250px;
  height: 250px;
  margin: 18px auto 0;
}
/* Bulb ring around the wheel — a masked repeating-conic gradient reads as
   little lights. */
.spin-rim {
  position: absolute;
  inset: -11px;
  border-radius: 50%;
  background: repeating-conic-gradient(from -1.5deg,
    #ffe89a 0deg 2deg, #b98b18 2deg 3.6deg, transparent 3.6deg 22.5deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 13px), #000 calc(100% - 12px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 13px), #000 calc(100% - 12px));
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
  animation: spin-rim-pulse 1.5s ease-in-out infinite;
}
@keyframes spin-rim-pulse { 0%, 100% { opacity: 0.8; } 50% { opacity: 1; } }

.spin-pointer {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 13px solid transparent;
  border-right: 13px solid transparent;
  border-top: 24px solid #ffd23f;
  z-index: 4;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4));
}
.spin-pointer::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -30px;
  width: 12px;
  height: 12px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6cf, #e0a51f);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
.spin-wheel {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 6px solid var(--surface);
  box-shadow: 0 0 0 3px #d9b64e, var(--shadow-3), inset 0 0 22px rgba(0, 0, 0, 0.28);
  will-change: transform;
  overflow: hidden;
}
/* Fixed glossy highlight that does not rotate with the wheel. */
.spin-glass {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 2;
  background:
    radial-gradient(circle at 50% 26%, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0) 42%),
    radial-gradient(circle at 50% 118%, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0) 42%);
}
.spin-label {
  position: absolute;
  left: 50%;
  top: 50%;
  margin-left: -16px;
  margin-top: -105px;
  width: 32px;
  text-align: center;
  transform-origin: 16px 105px;
  font-weight: var(--fw-bold);
  font-size: var(--fs-14);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}
.spin-hub {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid #d9b64e;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), inset 0 0 0 2px var(--surface);
  display: grid;
  place-items: center;
  z-index: 3;
}

/* Glowing Spin button + win celebration */
.spin-overlay #spin-go {
  animation: spin-go-pulse 1.8s ease-in-out infinite;
}
@keyframes spin-go-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green-600) 45%, transparent); }
  50% { box-shadow: 0 0 0 9px color-mix(in srgb, var(--green-600) 0%, transparent); }
}
.achievement-card.spin-win { animation: spin-pop 0.5s var(--ease-out); }
@keyframes spin-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.03); }
  100% { transform: scale(1); }
}
.spin-burst {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  overflow: visible;
}
.spin-burst i {
  position: absolute;
  left: 50%;
  top: 44%;
  width: 8px;
  height: 12px;
  border-radius: 2px;
  background: var(--cc, #7FC96A);
  opacity: 0;
  animation: confetti-fly 1s var(--ease-out) var(--d, 0s) forwards;
}
@keyframes confetti-fly {
  0% { opacity: 1; transform: translate(-50%, -50%) rotate(0); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--r)); }
}

/* Home entry card */
.spin-cta {
  margin-top: 12px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(120deg, var(--tint), var(--surface) 70%);
  border-color: var(--green-100);
}
/* Slow sheen sweep so the teaser looks alive. */
.spin-cta::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 38%, color-mix(in srgb, var(--green-400) 22%, transparent) 50%, transparent 62%);
  transform: translateX(-120%);
  animation: spin-cta-sheen 4.5s ease-in-out 1s infinite;
}
.spin-cta .icon-bubble {
  animation: spin-tease 5s var(--ease-inout) infinite;
}
@keyframes spin-tease {
  0%, 84%, 100% { transform: rotate(0); }
  88% { transform: rotate(-14deg); }
  92% { transform: rotate(12deg); }
  96% { transform: rotate(-6deg); }
}
@keyframes spin-cta-sheen {
  0%, 70% { transform: translateX(-120%); }
  100% { transform: translateX(120%); }
}

/* Animated flair keyframes (Lucky Clover, Aurora Crown) */
@keyframes flair-flow {
  from { background-position: 0% 0; }
  to   { background-position: 200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .spin-cta .icon-bubble,
  .spin-cta::after,
  .spin-rim,
  .spin-overlay #spin-go,
  .achievement-card.spin-win,
  .spin-burst i { animation: none !important; }
}

/* ------- Plans ------- */

.plan-card h2 { font-size: var(--fs-17); }
.plan-featured { border-color: var(--green-500); box-shadow: 0 0 0 1px var(--green-500), var(--shadow-2); }
.plan-list {
  margin: 0;
  padding-left: 18px;
  font-size: var(--fs-14);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.plan-list li::marker { color: var(--green-400); }

/* ------- House ad ------- */

.house-ad { margin-top: 14px; padding: 12px 14px; }
.house-ad-label {
  font-size: var(--fs-11);
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.house-ad-x {
  min-height: auto;
  padding: 2px 8px;
  color: var(--text-3);
  font-size: var(--fs-13);
  flex-shrink: 0;
}

.plan-current-tag {
  display: inline-block;
  font-size: var(--fs-11);
  font-weight: var(--fw-semibold);
  color: var(--green-800);
  background: var(--tint);
  border: 1px solid var(--green-500);
  border-radius: var(--r-full);
  padding: 1px 8px;
  vertical-align: middle;
  margin-left: 6px;
}
