/*
 * CryptoEarn — app.css  (Phase 8 final polish)
 * Augments Tailwind CDN with custom properties and component overrides.
 */

/* ── Design tokens ─────────────────────────────────────────────────────── */
:root {
  --color-primary:   var(--theme-primary, #7c3aed);  /* violet-600 */
  --color-accent:    var(--theme-accent,  #6d28d9);  /* violet-700 */
  --color-bg:        var(--theme-bg,      #030712);  /* gray-950   */
  --color-card:      var(--theme-card,    #111827);  /* gray-900   */
  --color-border:    #1f2937;                        /* gray-800   */
  --radius-card:     0.75rem;                        /* rounded-xl */
}

/* ── Base ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { color-scheme: dark; scroll-behavior: smooth; }

body {
  background-color: var(--color-bg);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Scrollbar styling (webkit) ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #374151; border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: #4b5563; }

/* ── Focus ring ─────────────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ── Typography ─────────────────────────────────────────────────────────── */
.metric-value { font-size: 2rem; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.metric-label { font-size: 0.75rem; color: #6b7280; margin-top: 0.25rem; }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background-color: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 1.25rem;
}
.card-hover { transition: border-color 0.15s ease; }
.card-hover:hover { border-color: #374151; }

/* ── Status badges (consistent across whole app) ────────────────────────── */
.badge           { display: inline-flex; align-items: center; padding: 0.125rem 0.625rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 500; border-width: 1px; }
.badge-success   { background: rgba(6,78,59,.5);   color: #6ee7b7; border-color: #065f46; }
.badge-warning   { background: rgba(120,53,15,.5); color: #fde68a; border-color: #92400e; }
.badge-danger    { background: rgba(127,29,29,.5); color: #fca5a5; border-color: #991b1b; }
.badge-info      { background: rgba(30,58,138,.5); color: #93c5fd; border-color: #1d4ed8; }
.badge-neutral   { background: #1f2937;            color: #9ca3af; border-color: #374151; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn         { display: inline-flex; align-items: center; justify-content: center; gap: 0.375rem; padding: 0.5rem 1rem; border-radius: 0.5rem; font-size: 0.875rem; font-weight: 500; transition: background-color 0.15s ease, opacity 0.15s ease; cursor: pointer; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background-color: var(--color-primary); color: #fff; }
.btn-primary:hover { background-color: var(--color-accent); }
.btn-secondary { background-color: #1f2937; color: #d1d5db; border: 1px solid #374151; }
.btn-secondary:hover { background-color: #374151; }
.btn-danger  { background-color: rgba(127,29,29,.3); color: #fca5a5; border: 1px solid #991b1b; }
.btn-danger:hover { background-color: rgba(127,29,29,.5); }

/* ── Form inputs ────────────────────────────────────────────────────────── */
.input {
  width: 100%;
  background-color: #1f2937;
  border: 1px solid #374151;
  border-radius: 0.5rem;
  color: #f9fafb;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input::placeholder { color: #6b7280; }
.input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(124,58,237,.2); }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.data-table { width: 100%; font-size: 0.875rem; }
.data-table thead { border-bottom: 1px solid #1f2937; }
.data-table th { padding: 0.75rem 1rem; text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: #6b7280; font-weight: 600; }
.data-table tbody tr { border-bottom: 1px solid #111827; transition: background-color 0.1s ease; }
.data-table tbody tr:hover { background-color: rgba(31,41,55,.4); }
.data-table td { padding: 0.75rem 1rem; }

/* ── Sidebar nav active state ───────────────────────────────────────────── */
.nav-active {
  background-color: rgba(124,58,237,.12);
  color: #ffffff;
  border: 1px solid rgba(124,58,237,.25);
}

/* ── Trust score arc (SVG gauge) ─────────────────────────────────────────── */
.trust-gauge { transform: rotate(-90deg); }

/* ── Rank username styling ──────────────────────────────────────────────── */
.rank-glow-violet { text-shadow: 0 0 8px rgba(139,92,246,.8); }
.rank-glow-gold   { text-shadow: 0 0 8px rgba(251,191,36,.8); }
.rank-glow-cyan   { text-shadow: 0 0 8px rgba(34,211,238,.8); }

/* ── Earning ticker ─────────────────────────────────────────────────────── */
.ticker-item { animation: ticker-slide-in 0.3s ease both; }
@keyframes ticker-slide-in {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Chat bubbles ───────────────────────────────────────────────────────── */
.chat-msg { word-break: break-word; }

/* ── Page transitions ───────────────────────────────────────────────────── */
.page-content { animation: fade-in 0.15s ease; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ── Progress bar ───────────────────────────────────────────────────────── */
.progress-bar { transition: width 0.4s ease; }

/* ── Alpine x-cloak (prevents flash of hidden content) ─────────────────── */
[x-cloak] { display: none !important; }

/* ── Mobile bottom nav ──────────────────────────────────────────────────── */
.mobile-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; }

/* ── Theme CSS variable injection (set by admin theme settings) ─────────── */
/* These are written inline by the app layout from the theme_settings table. */

/* ── Responsive table → cards on mobile ────────────────────────────────── */
@media (max-width: 639px) {
  .table-card-mobile thead { display: none; }
  .table-card-mobile tbody { display: grid; gap: 0.5rem; }
  .table-card-mobile tr { display: block; background: var(--color-card); border: 1px solid var(--color-border); border-radius: 0.75rem; padding: 0.75rem 1rem; }
  .table-card-mobile td { display: flex; justify-content: space-between; padding: 0.25rem 0; font-size: 0.8125rem; }
  .table-card-mobile td::before { content: attr(data-label); color: #6b7280; font-size: 0.75rem; }
}

/* ── Print ──────────────────────────────────────────────────────────────── */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; color: #000; }
}
/* Native promotion slots. Generic names keep layout stable and avoid brittle filters. */
.content-slot {
  width: 100%;
  max-width: 100%;
  margin-inline: auto;
  margin-bottom: 1.25rem;
  overflow: hidden;
  border: 1px solid rgba(31, 41, 55, 0.9);
  border-radius: 0.75rem;
  background: rgba(17, 24, 39, 0.82);
  aspect-ratio: var(--slot-ratio, 970 / 120);
  min-height: 72px;
}

.content-slot-inner,
.content-slot-link,
.content-slot-html,
.content-slot-empty {
  display: flex;
  width: 100%;
  height: 100%;
  min-width: 0;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.content-slot-link {
  color: inherit;
  text-decoration: none;
}

.content-slot-media {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
}

.content-slot-html {
  max-width: 100%;
}

.content-slot-text {
  display: flex;
  width: 100%;
  height: 100%;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.75rem 1rem;
  text-align: center;
}

.content-slot-text strong {
  max-width: 100%;
  overflow: hidden;
  color: #f9fafb;
  font-size: clamp(0.875rem, 2vw, 1.125rem);
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content-slot-text span {
  display: -webkit-box;
  max-width: 100%;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: #9ca3af;
  font-size: 0.8125rem;
  line-height: 1.35;
}

.content-slot-html iframe,
.content-slot-html embed,
.content-slot-html object,
.content-slot-html img,
.content-slot-html video {
  max-width: 100%;
}

.content-slot-empty {
  background: linear-gradient(135deg, rgba(55, 65, 81, 0.25), rgba(17, 24, 39, 0.45));
}

@media (max-width: 640px) {
  .content-slot {
    border-radius: 0.65rem;
    min-height: 64px;
  }
}

/* ── Ads & Sponsorships Manager · responsive safe containers ───────────── */
.content-slot {
  position: relative;
  contain: layout paint;
  isolation: isolate;
  max-width: 100%;
  overflow: hidden;
}
.content-slot-label {
  position: absolute;
  top: .3rem;
  left: .4rem;
  z-index: 2;
  border: 1px solid rgba(148,163,184,.22);
  border-radius: 999px;
  background: rgba(3,7,18,.78);
  padding: .12rem .45rem;
  color: #9ca3af;
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .08em;
  line-height: 1.25;
  text-transform: uppercase;
  pointer-events: none;
}
.content-slot-frame {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  border: 0;
  overflow: hidden;
  background: transparent;
}
.content-slot-safe-html { padding: .75rem 1rem; }
.content-slot-inline { grid-column: 1 / -1; min-height: 92px; margin-block: .35rem; }
.content-slot-wide_banner { min-height: 88px; }
.content-slot-compact_banner { min-height: 72px; }
.content-slot-mobile_banner { min-height: 64px; }
.content-slot-rectangle,
.content-slot-sidebar_box { aspect-ratio: 300 / 250; min-height: 220px; }
.content-slot-native_inline { aspect-ratio: 728 / 110; min-height: 92px; }
.content-slot-text_strip { aspect-ratio: 970 / 72; min-height: 64px; }
@media (max-width: 640px) {
  .content-slot { margin-bottom: 1rem; }
  .content-slot-wide_banner,
  .content-slot-compact_banner,
  .content-slot-native_inline,
  .content-slot-text_strip { aspect-ratio: 320 / 100; min-height: 82px; }
  .content-slot-rectangle,
  .content-slot-sidebar_box { aspect-ratio: 320 / 180; min-height: 160px; }
}

/* ── External ad auto-fit shells ───────────────────────────────────────── */
.content-slot-external {
  aspect-ratio: auto;
  min-height: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}
.content-slot-external .content-slot-inner {
  height: auto;
  min-height: 0;
  overflow: visible;
}
.content-slot-external-shell {
  position: relative;
  width: min(100%, calc(var(--creative-width) * 1px));
  height: calc(var(--creative-height) * 1px);
  margin-inline: auto;
  overflow: hidden;
  border-radius: .45rem;
  background: transparent;
}
.content-slot-external-stage {
  position: absolute;
  inset: 0 auto auto 0;
  width: calc(var(--creative-width) * 1px);
  height: calc(var(--creative-height) * 1px);
  transform: scale(var(--creative-scale, 1));
  transform-origin: top left;
}
.content-slot-external-stage .content-slot-frame {
  width: 100%;
  height: 100%;
}
.content-slot-external-responsive .content-slot-inner,
.content-slot-external-responsive .content-slot-frame {
  width: 100%;
  height: 100%;
}

/* ── EarnLoop Original Badge Artwork System ───────────────────────────── */
.badge-identity {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: .55rem;
  vertical-align: middle;
}
.badge-emblem {
  --badge-glow: rgba(148,163,184,.22);
  position: relative;
  isolation: isolate;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: 30%;
  filter: drop-shadow(0 .25rem .4rem rgba(0,0,0,.34));
}
.badge-emblem--xs { width: 1.35rem; height: 1.35rem; }
.badge-emblem--sm { width: 1.7rem; height: 1.7rem; }
.badge-emblem--md { width: 2.35rem; height: 2.35rem; }
.badge-emblem--lg { width: 4.5rem; height: 4.5rem; }
.badge-emblem--xl { width: 6.5rem; height: 6.5rem; }
.badge-emblem__aura {
  position: absolute;
  inset: -12%;
  z-index: -1;
  border-radius: 999px;
  background: radial-gradient(circle, var(--badge-glow), transparent 68%);
  opacity: .75;
  pointer-events: none;
}
.badge-artwork {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  user-select: none;
  -webkit-user-drag: none;
}
.badge-artwork--xs,
.badge-artwork--sm,
.badge-artwork--md,
.badge-artwork--lg,
.badge-artwork--xl { width: 100%; height: 100%; }
.badge-emblem--simple {
  border-radius: 999px;
  background: rgba(2,6,23,.72);
  padding: 8%;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.badge-emblem--premium .badge-artwork {
  transform: translateZ(0);
}
.badge-emblem--common { --badge-glow:rgba(148,163,184,.20); }
.badge-emblem--uncommon { --badge-glow:rgba(52,211,153,.28); }
.badge-emblem--rare { --badge-glow:rgba(56,189,248,.34); }
.badge-emblem--epic { --badge-glow:rgba(217,70,239,.40); }
.badge-emblem--legendary { --badge-glow:rgba(251,191,36,.50); }
.badge-emblem--epic:not(.badge-emblem--static) .badge-emblem__aura,
.badge-emblem--legendary:not(.badge-emblem--static) .badge-emblem__aura {
  animation: badge-artwork-breathe 2.8s ease-in-out infinite;
}
.badge-emblem--legendary:not(.badge-emblem--static) .badge-artwork {
  animation: badge-artwork-float 4.6s ease-in-out infinite;
}
.badge-emblem--locked {
  filter: grayscale(1) saturate(.12);
  opacity: .46;
}
.badge-emblem--locked::after {
  content: "";
  position: absolute;
  right: -2%;
  bottom: 2%;
  width: 29%;
  height: 24%;
  border: max(1px,.08em) solid rgba(226,232,240,.9);
  border-radius: 22%;
  background: #0f172a;
  box-shadow: 0 0 0 max(1px,.04em) rgba(15,23,42,.9);
}
.badge-emblem--locked::before {
  content: "";
  position: absolute;
  right: 5%;
  bottom: 20%;
  z-index: 2;
  width: 15%;
  height: 14%;
  border: max(1px,.08em) solid rgba(226,232,240,.9);
  border-bottom: 0;
  border-radius: 999px 999px 0 0;
}
.badge-emblem--missing {
  border: 1px dashed rgba(245,158,11,.55);
  background: rgba(245,158,11,.06);
  padding: 7%;
}
.badge-simple-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--badge-fallback-size, 1.7rem);
  height: var(--badge-fallback-size, 1.7rem);
  border: 1px solid currentColor;
  border-radius: 28%;
  padding: .08rem;
}
.badge-simple-fallback .badge-artwork { width: 100%; height: 100%; }
.badge-identity__copy { display:flex; flex-direction:column; line-height:1.1; }
.badge-identity__name { color:#f8fafc; font-size:.75rem; font-weight:700; }
.badge-identity__rarity { margin-top:.18rem; color:#64748b; font-size:.625rem; letter-spacing:.08em; text-transform:uppercase; }
@keyframes badge-artwork-breathe {
  0%,100% { opacity:.55; transform:scale(.92); }
  50% { opacity:1; transform:scale(1.08); }
}
@keyframes badge-artwork-float {
  0%,100% { transform:translateY(0) rotate(-.5deg); }
  50% { transform:translateY(-2.5%) rotate(.5deg); }
}
@media (prefers-reduced-motion: reduce) {
  .badge-emblem__aura,
  .badge-artwork { animation:none !important; }
}

/* ── Badge unlock celebration modal ───────────────────────────────────── */
.badge-celebration {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity .22s ease;
}
.badge-celebration[hidden] { display: none !important; }
.badge-celebration--open { opacity: 1; }
.badge-celebration__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background:
    radial-gradient(circle at 50% 30%, rgba(124,58,237,.25), transparent 42%),
    rgba(2,6,23,.88);
  backdrop-filter: blur(12px);
}
.badge-celebration__panel {
  position: relative;
  isolation: isolate;
  width: min(100%, 54rem);
  max-height: min(92vh, 52rem);
  overflow: auto;
  border: 1px solid rgba(167,139,250,.28);
  border-radius: 1.75rem;
  background:
    linear-gradient(145deg, rgba(30,20,58,.98), rgba(8,13,28,.99) 48%, rgba(8,21,31,.99)),
    #080d1c;
  box-shadow: 0 2rem 7rem rgba(0,0,0,.66), inset 0 1px 0 rgba(255,255,255,.08);
  padding: clamp(1.25rem, 4vw, 2.4rem);
  transform: translateY(1rem) scale(.96);
  transition: transform .28s cubic-bezier(.2,.85,.25,1);
}
.badge-celebration--open .badge-celebration__panel { transform: translateY(0) scale(1); }
.badge-celebration__panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  border-radius: inherit;
  background:
    radial-gradient(circle at 10% 0%, rgba(245,158,11,.13), transparent 30%),
    radial-gradient(circle at 90% 5%, rgba(34,211,238,.12), transparent 28%);
  pointer-events: none;
}
.badge-celebration__ambient span {
  position: absolute;
  z-index: -1;
  border: 1px solid rgba(196,181,253,.12);
  border-radius: 999px;
  pointer-events: none;
}
.badge-celebration__ambient span:nth-child(1) { width: 22rem; height: 22rem; top: -12rem; left: calc(50% - 11rem); }
.badge-celebration__ambient span:nth-child(2) { width: 15rem; height: 15rem; top: -8.5rem; left: calc(50% - 7.5rem); }
.badge-celebration__ambient span:nth-child(3) { width: 7rem; height: 7rem; top: -4.5rem; left: calc(50% - 3.5rem); border-color: rgba(251,191,36,.2); }
.badge-celebration__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 4;
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  border: 1px solid rgba(148,163,184,.18);
  border-radius: 999px;
  background: rgba(15,23,42,.72);
  color: #94a3b8;
  transition: .18s ease;
}
.badge-celebration__close:hover { border-color: rgba(196,181,253,.42); color: #fff; transform: rotate(4deg); }
.badge-celebration__close svg { width: 1rem; height: 1rem; }
.badge-celebration__header { max-width: 39rem; margin: 0 auto 1.5rem; text-align: center; }
.badge-celebration__crown {
  display: grid;
  width: 3.25rem;
  height: 3.25rem;
  place-items: center;
  margin: 0 auto .8rem;
  border: 1px solid rgba(251,191,36,.32);
  border-radius: 1.1rem;
  background: linear-gradient(145deg, rgba(251,191,36,.2), rgba(124,58,237,.15));
  color: #fde68a;
  box-shadow: 0 0 2rem rgba(245,158,11,.16);
}
.badge-celebration__crown svg { width: 1.75rem; height: 1.75rem; }
.badge-celebration__eyebrow { color: #c4b5fd; font-size: .68rem; font-weight: 800; letter-spacing: .22em; text-transform: uppercase; }
.badge-celebration__title {
  margin-top: .5rem;
  color: #fff;
  font-size: clamp(1.7rem, 5vw, 2.7rem);
  font-weight: 850;
  letter-spacing: -.035em;
  line-height: 1.08;
}
.badge-celebration__message { max-width: 34rem; margin: .75rem auto 0; color: #aeb9cc; font-size: .95rem; line-height: 1.65; }
.badge-celebration__grid { display: grid; grid-template-columns: repeat(var(--badge-columns, 1), minmax(0,1fr)); gap: .8rem; }
.badge-celebration__grid[data-count="2"] { --badge-columns: 2; }
.badge-celebration__grid[data-count="3"] { --badge-columns: 3; }
.badge-celebration__grid[data-count="4"],
.badge-celebration__grid[data-count="5"] { --badge-columns: 5; }
.badge-celebration-card {
  --celebration-accent: 148,163,184;
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(var(--celebration-accent),.22);
  border-radius: 1.25rem;
  background: linear-gradient(155deg, rgba(var(--celebration-accent),.11), rgba(15,23,42,.76) 42%, rgba(2,6,23,.84));
  padding: 1rem;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
  opacity: 0;
  transform: translateY(.7rem) scale(.96);
  animation: badge-celebration-card-in .5s cubic-bezier(.2,.82,.25,1) forwards;
  animation-delay: var(--badge-card-delay,0ms);
}
.badge-celebration-card--uncommon { --celebration-accent: 52,211,153; }
.badge-celebration-card--rare { --celebration-accent: 56,189,248; }
.badge-celebration-card--epic { --celebration-accent: 217,70,239; }
.badge-celebration-card--legendary { --celebration-accent: 251,191,36; }
.badge-celebration-card--hero { display: grid; grid-template-columns: minmax(8rem, 13rem) minmax(0,1fr); align-items: center; gap: clamp(1rem,4vw,2.2rem); max-width: 42rem; margin-inline: auto; padding: clamp(1rem,4vw,1.7rem); text-align: left; }
.badge-celebration-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 20%, rgba(255,255,255,.06) 43%, transparent 60%);
  transform: translateX(-120%);
  animation: badge-celebration-shine 2.8s 1s ease-in-out infinite;
  pointer-events: none;
}
.badge-celebration-card__visual { position: relative; display: grid; width: min(100%, 8.5rem); aspect-ratio: 1; place-items: center; margin: 0 auto .65rem; }
.badge-celebration-card--hero .badge-celebration-card__visual { width: min(100%, 12rem); margin-bottom: 0; }
.badge-celebration-card__aura { position: absolute; inset: 7%; border-radius: 999px; background: radial-gradient(circle, rgba(var(--celebration-accent),.34), transparent 67%); filter: blur(.2rem); animation: badge-celebration-pulse 2.5s ease-in-out infinite; }
.badge-celebration-card__artwork { position: relative; z-index: 1; display: block; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 .65rem 1rem rgba(0,0,0,.45)); }
.badge-celebration-card__meta { display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem; }
.badge-celebration-card--hero .badge-celebration-card__meta { justify-content: flex-start; }
.badge-celebration-card__rarity,
.badge-celebration-card__category { border: 1px solid rgba(var(--celebration-accent),.23); border-radius: 999px; padding: .2rem .45rem; color: rgb(var(--celebration-accent)); font-size: .55rem; font-weight: 800; letter-spacing: .11em; line-height: 1; text-transform: uppercase; }
.badge-celebration-card__category { border-color: rgba(148,163,184,.16); color: #94a3b8; }
.badge-celebration-card__name { margin-top: .65rem; color: #fff; font-size: clamp(.9rem,2vw,1.12rem); font-weight: 800; line-height: 1.2; }
.badge-celebration-card--hero .badge-celebration-card__name { font-size: clamp(1.25rem,4vw,1.7rem); }
.badge-celebration-card__description { display: -webkit-box; overflow: hidden; margin-top: .45rem; -webkit-box-orient: vertical; -webkit-line-clamp: 2; color: #8f9bae; font-size: .72rem; line-height: 1.45; }
.badge-celebration-card--hero .badge-celebration-card__description { font-size: .88rem; -webkit-line-clamp: 3; }
.badge-celebration-card__facts { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem .7rem; margin-top: .7rem; color: #64748b; font-size: .63rem; }
.badge-celebration-card--hero .badge-celebration-card__facts { justify-content: flex-start; }
.badge-celebration-card__facts span + span::before { content: "•"; margin-right: .7rem; color: rgb(var(--celebration-accent)); }
.badge-celebration__queue { margin-top: 1rem; color: #94a3b8; font-size: .75rem; text-align: center; }
.badge-celebration__error { margin-top: .8rem; color: #fda4af; font-size: .75rem; text-align: center; }
.badge-celebration__actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .65rem; margin-top: 1.35rem; }
.badge-celebration__primary,
.badge-celebration__secondary,
.badge-celebration__ghost { display: inline-flex; min-height: 2.75rem; align-items: center; justify-content: center; gap: .5rem; border-radius: .85rem; padding: .65rem 1rem; font-size: .78rem; font-weight: 750; transition: .18s ease; }
.badge-celebration__primary { border: 1px solid rgba(196,181,253,.34); background: linear-gradient(135deg,#7c3aed,#6d28d9); color: #fff; box-shadow: 0 .7rem 1.8rem rgba(109,40,217,.24); }
.badge-celebration__primary:hover { transform: translateY(-1px); background: linear-gradient(135deg,#8b5cf6,#7c3aed); }
.badge-celebration__primary svg { width: 1rem; height: 1rem; }
.badge-celebration__secondary { border: 1px solid rgba(34,211,238,.25); background: rgba(8,145,178,.12); color: #a5f3fc; }
.badge-celebration__secondary:hover { border-color: rgba(34,211,238,.45); background: rgba(8,145,178,.2); }
.badge-celebration__secondary:disabled { cursor: wait; opacity: .55; }
.badge-celebration__ghost { border: 1px solid rgba(148,163,184,.15); background: rgba(15,23,42,.55); color: #94a3b8; }
.badge-celebration__ghost:hover { border-color: rgba(148,163,184,.32); color: #fff; }
.badge-celebration__confetti { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; pointer-events: none; }
.badge-celebration__confetti i { position: absolute; top: -1rem; left: var(--confetti-x); width: .32rem; height: .62rem; border-radius: .15rem; background: #c4b5fd; opacity: 0; transform: rotate(var(--confetti-rotate)); animation: badge-celebration-confetti var(--confetti-duration) var(--confetti-delay) ease-out 1 forwards; }
.badge-celebration__confetti i:nth-child(3n) { background: #fbbf24; }
.badge-celebration__confetti i:nth-child(3n+1) { background: #22d3ee; }
@keyframes badge-celebration-card-in { to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes badge-celebration-shine { 0%,55% { transform: translateX(-120%); } 85%,100% { transform: translateX(120%); } }
@keyframes badge-celebration-pulse { 0%,100% { opacity: .55; transform: scale(.88); } 50% { opacity: 1; transform: scale(1.08); } }
@keyframes badge-celebration-confetti { 0% { opacity: 0; transform: translateY(-1rem) rotate(var(--confetti-rotate)); } 12% { opacity: .95; } 100% { opacity: 0; transform: translateY(28rem) rotate(calc(var(--confetti-rotate) + 440deg)); } }
@media (max-width: 720px) {
  .badge-celebration { align-items: end; padding: .6rem; }
  .badge-celebration__panel { max-height: 94vh; border-radius: 1.45rem; padding: 1.15rem; }
  .badge-celebration__grid[data-count="3"],
  .badge-celebration__grid[data-count="4"],
  .badge-celebration__grid[data-count="5"] { --badge-columns: 2; }
  .badge-celebration__grid[data-count="5"] .badge-celebration-card:last-child { grid-column: 1 / -1; width: calc(50% - .4rem); justify-self: center; }
  .badge-celebration-card--hero { grid-template-columns: 1fr; text-align: center; }
  .badge-celebration-card--hero .badge-celebration-card__meta,
  .badge-celebration-card--hero .badge-celebration-card__facts { justify-content: center; }
  .badge-celebration-card--hero .badge-celebration-card__visual { width: min(56vw,10rem); }
  .badge-celebration__actions { display: grid; grid-template-columns: 1fr 1fr; }
  .badge-celebration__primary { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  .badge-celebration,
  .badge-celebration__panel,
  .badge-celebration-card,
  .badge-celebration-card::after,
  .badge-celebration-card__aura,
  .badge-celebration__confetti i { animation: none !important; transition: none !important; }
  .badge-celebration-card { opacity: 1; transform: none; }
}

/* EarnLoop Rank Identity & Prestige System */
.rank-medallion-shell{position:relative;display:inline-grid;place-items:center;flex:0 0 auto;border-radius:32%;isolation:isolate;background:radial-gradient(circle at 50% 35%,rgba(255,255,255,.13),rgba(2,6,23,.96) 72%);box-shadow:0 .45rem 1.2rem rgba(0,0,0,.35);overflow:visible}
.rank-medallion--sm{width:2rem;height:2rem}.rank-medallion--md{width:2.75rem;height:2.75rem}.rank-medallion--lg{width:4.25rem;height:4.25rem}
.rank-medallion__crest{display:block;width:116%;height:116%;object-fit:contain;filter:drop-shadow(0 .28rem .4rem rgba(0,0,0,.45));transition:transform .2s ease,filter .2s ease}.rank-medallion-shell:hover .rank-medallion__crest{transform:translateY(-1px) scale(1.025);filter:drop-shadow(0 .35rem .55rem rgba(0,0,0,.55))}
.rank-medallion__fallback{display:grid;width:82%;height:82%;place-items:center;border-radius:30%;font-weight:900;color:#fff;background:#334155}.rank-medallion__role{position:absolute;right:-18%;bottom:-16%;z-index:3;width:46%;height:46%;object-fit:contain;filter:drop-shadow(0 .18rem .25rem rgba(0,0,0,.7))}
.rank-nameplate{position:relative;display:inline-block;letter-spacing:.012em;text-decoration:none!important}.rank-nameplate::after{content:"";position:absolute;left:0;right:0;bottom:-.18em;height:1px;border-radius:999px;opacity:.55;transform:scaleX(.78);transition:.2s ease}.rank-nameplate:hover::after{transform:scaleX(1);opacity:.9}
.rank-nameplate--bronze{color:#fdba74;text-shadow:0 1px 0 #431407}.rank-nameplate--bronze::after{background:linear-gradient(90deg,transparent,#f97316,transparent)}
.rank-nameplate--silver{color:#f1f5f9;text-shadow:0 1px 0 #475569,0 0 8px rgba(226,232,240,.18)}.rank-nameplate--silver::after{background:linear-gradient(90deg,transparent,#cbd5e1,transparent)}
.rank-nameplate--gold{color:#fde68a;text-shadow:0 1px 0 #78350f,0 0 9px rgba(251,191,36,.35)}.rank-nameplate--gold::after{height:2px;background:linear-gradient(90deg,transparent,#fbbf24,#fff7ae,#fbbf24,transparent)}
.rank-nameplate--platinum{color:#cffafe;text-shadow:0 0 8px rgba(103,232,249,.38)}.rank-nameplate--platinum::after{background:linear-gradient(90deg,transparent,#67e8f9,#f8fafc,#67e8f9,transparent)}
.rank-nameplate--diamond{color:#e0f2fe;text-shadow:0 0 10px rgba(56,189,248,.5),0 1px 0 #075985}.rank-nameplate--diamond::after{height:2px;background:linear-gradient(90deg,transparent,#38bdf8,#fff,#a5f3fc,#38bdf8,transparent)}
.rank-nameplate--crown{color:#fae8ff;text-shadow:0 0 10px rgba(217,70,239,.48),0 1px 0 #701a75}.rank-nameplate--crown::before{content:"◆";margin-right:.28em;color:#fbbf24;font-size:.68em}.rank-nameplate--crown::after{height:2px;background:linear-gradient(90deg,transparent,#fbbf24,#e879f9,#fbbf24,transparent)}
.rank-nameplate--legend{color:#fff7ed;text-shadow:0 0 8px rgba(251,113,133,.72),0 0 17px rgba(251,191,36,.32),0 1px 0 #881337}.rank-nameplate--legend::before{content:"✦";margin-right:.3em;color:#fbbf24}.rank-nameplate--legend::after{height:2px;background:linear-gradient(90deg,transparent,#fb7185,#fbbf24,#fff7ed,#fbbf24,#fb7185,transparent);animation:rank-legend-flow 2.8s ease-in-out infinite}
.rank-nameplate--staff{font-weight:850}.rank-nameplate--staff::before{filter:drop-shadow(0 0 4px rgba(196,181,253,.8))}
.rank-tier-label{display:inline-flex;align-items:center;border:1px solid rgba(148,163,184,.18);border-radius:999px;padding:.16rem .45rem;font-size:.58rem;font-weight:850;letter-spacing:.12em;text-transform:uppercase;color:#94a3b8;background:rgba(15,23,42,.72)}
.official-role-chip{display:inline-flex;align-items:center;gap:.25rem;border:1px solid rgba(196,181,253,.34);border-radius:999px;padding:.14rem .42rem;font-size:.58rem;font-weight:850;letter-spacing:.08em;text-transform:uppercase;color:#ede9fe;background:linear-gradient(135deg,rgba(91,33,182,.3),rgba(30,41,59,.82));box-shadow:inset 0 1px 0 rgba(255,255,255,.06)}
.rank-profile-hero{position:relative;overflow:hidden;border:1px solid rgba(148,163,184,.15);border-radius:1.75rem;background:radial-gradient(circle at 18% 0%,rgba(124,58,237,.18),transparent 36%),linear-gradient(145deg,#0f172a,#050816 72%);box-shadow:0 1.2rem 3rem rgba(0,0,0,.24)}
.rank-profile-crest{position:relative;display:grid;place-items:center;width:clamp(8rem,24vw,12rem);aspect-ratio:1}.rank-profile-crest>img:first-child{width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 1rem 1.4rem rgba(0,0,0,.48))}.rank-profile-crest .rank-medallion__role{right:2%;bottom:1%;width:34%;height:34%}
.rank-progress-track{height:.7rem;overflow:hidden;border:1px solid rgba(148,163,184,.14);border-radius:999px;background:rgba(2,6,23,.72)}.rank-progress-fill{height:100%;border-radius:inherit;background:linear-gradient(90deg,#7c3aed,#22d3ee,#fbbf24);box-shadow:0 0 16px rgba(34,211,238,.3)}
.rank-requirement{display:flex;align-items:center;justify-content:space-between;gap:1rem;border:1px solid rgba(148,163,184,.12);border-radius:.85rem;padding:.65rem .8rem;background:rgba(15,23,42,.55)}.rank-requirement--met{border-color:rgba(52,211,153,.22);background:rgba(16,185,129,.07)}
@keyframes rank-legend-flow{0%,100%{opacity:.55;filter:brightness(.9)}50%{opacity:1;filter:brightness(1.35)}}
@media(prefers-reduced-motion:reduce){.rank-nameplate--legend::after{animation:none}.rank-medallion__crest{transition:none}}
