/* ============================================================================
 * userinfo.lol - PROGRESSION UI
 * Rarity system + reusable progression components (level badge, XP bar,
 * toasts, unlock popup, cosmetic tiles, profile borders). Load site-wide.
 * ========================================================================== */

:root {
  --rar-common:    #9ca3af;
  --rar-rare:      #3b82f6;
  --rar-epic:      #a855f7;
  --rar-legendary: #f59e0b;
  --rar-mythic:    #ec4899;
  --prog-bg:       rgba(255,255,255,0.04);
  --prog-border:   rgba(255,255,255,0.1);
}

/* --- Rarity tokens: any element with data-rarity inherits its presentation - */
[data-rarity="common"]    { --rar: var(--rar-common);    --rar-glow: rgba(156,163,175,0.45); }
[data-rarity="rare"]      { --rar: var(--rar-rare);      --rar-glow: rgba(59,130,246,0.55); }
[data-rarity="epic"]      { --rar: var(--rar-epic);      --rar-glow: rgba(168,85,247,0.6); }
[data-rarity="legendary"] { --rar: var(--rar-legendary); --rar-glow: rgba(245,158,11,0.65); }
[data-rarity="mythic"]    { --rar: var(--rar-mythic);    --rar-glow: rgba(236,72,153,0.7); }

/* --- Level badge ----------------------------------------------------------- */
.prog-level-badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 7px; border-radius: 999px;
  font-size: 11px; font-weight: 700; line-height: 1.6;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, rgba(244,114,182,0.22), rgba(168,85,247,0.22));
  border: 1px solid rgba(244,114,182,0.4);
  color: #fce7f3; white-space: nowrap; vertical-align: middle;
}
.prog-level-badge.lv-high   { background: linear-gradient(135deg, rgba(168,85,247,0.3), rgba(59,130,246,0.3)); border-color: rgba(168,85,247,0.5); }
.prog-level-badge.lv-elite  { background: linear-gradient(135deg, rgba(245,158,11,0.28), rgba(236,72,153,0.28)); border-color: rgba(245,158,11,0.55); color: #fef3c7; }
.prog-level-badge .pl-star  { color: #fbbf24; font-size: 9px; }

/* --- Profile title chip (equipped via Arcade Unlocks) --------------------- */
.profile-title {
  display: inline-flex; align-items: center;
  padding: 1px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; line-height: 1.6;
  background: linear-gradient(135deg, rgba(245,158,11,0.22), rgba(236,72,153,0.18));
  border: 1px solid rgba(245,158,11,0.4);
  color: #fde68a; white-space: nowrap; vertical-align: middle;
}

/* --- XP bar ---------------------------------------------------------------- */
.prog-xp-bar { width: 100%; }
.prog-xp-bar .xpb-meta {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; color: rgba(255,255,255,0.55); margin-bottom: 5px;
  font-variant-numeric: tabular-nums;
}
.prog-xp-bar .xpb-meta strong { color: #fff; font-size: 13px; }
.prog-xp-bar .xpb-track {
  height: 9px; border-radius: 999px; overflow: hidden;
  background: rgba(255,255,255,0.07); border: 1px solid var(--prog-border);
}
.prog-xp-bar .xpb-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #f472b6, #a855f7);
  box-shadow: 0 0 12px rgba(168,85,247,0.5);
  transition: width .6s cubic-bezier(.2,.8,.2,1);
}

/* --- Cosmetic tile (inventory grid) --------------------------------------- */
.cosmetic-tile {
  position: relative; display: flex; flex-direction: column; align-items: center;
  gap: 6px; padding: 10px; border-radius: 12px;
  background: var(--prog-bg); border: 1px solid var(--rar, var(--prog-border));
  box-shadow: 0 0 0 1px rgba(0,0,0,0.2), 0 0 14px -4px var(--rar-glow, transparent);
  transition: transform .15s ease, box-shadow .15s ease;
}
.cosmetic-tile:hover { transform: translateY(-2px); box-shadow: 0 0 20px -2px var(--rar-glow, transparent); }
.cosmetic-tile img { width: 64px; height: 64px; object-fit: contain; }
.cosmetic-tile .ct-name { font-size: 12px; font-weight: 600; color: #fff; text-align: center; }
.cosmetic-tile .ct-rarity { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--rar); }
.cosmetic-tile.locked { opacity: .4; filter: grayscale(.8); }
.cosmetic-tile.equipped { outline: 2px solid var(--rar); outline-offset: 1px; }
.cosmetic-tile[data-rarity="legendary"],
.cosmetic-tile[data-rarity="mythic"] { animation: ct-shimmer 3s ease-in-out infinite; }
@keyframes ct-shimmer {
  0%,100% { box-shadow: 0 0 14px -4px var(--rar-glow); }
  50%     { box-shadow: 0 0 24px 0 var(--rar-glow); }
}

/* --- Toasts (level up / achievement / unlock) ----------------------------- */
.prog-toast-stack {
  position: fixed; right: 16px; bottom: 16px; z-index: 9000;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.prog-toast {
  display: flex; align-items: center; gap: 10px;
  min-width: 240px; max-width: 340px; padding: 12px 14px;
  border-radius: 12px; color: #fff;
  background: rgba(20,12,30,0.96); border: 1px solid var(--rar, rgba(244,114,182,0.5));
  box-shadow: 0 8px 30px rgba(0,0,0,0.5), 0 0 18px -6px var(--rar-glow, rgba(244,114,182,0.4));
  animation: toast-in .35s cubic-bezier(.2,.8,.2,1);
}
.prog-toast.out { animation: toast-out .25s ease forwards; }
.prog-toast .pt-icon { font-size: 22px; line-height: 1; }
.prog-toast .pt-title { font-size: 13px; font-weight: 700; }
.prog-toast .pt-sub { font-size: 12px; color: rgba(255,255,255,0.6); }
@keyframes toast-in  { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(40px); } }

/* --- Unlock popup ---------------------------------------------------------- */
.prog-unlock-overlay {
  position: fixed; inset: 0; z-index: 9100;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5,2,12,0.8); backdrop-filter: blur(6px);
  animation: toast-in .2s ease;
}
.prog-unlock-card {
  text-align: center; padding: 28px 32px; border-radius: 18px;
  background: rgba(20,12,30,0.98); border: 1px solid var(--rar);
  box-shadow: 0 0 50px -8px var(--rar-glow);
  max-width: 320px;
}
.prog-unlock-card .pu-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--rar); }
.prog-unlock-card img { width: 110px; height: 110px; object-fit: contain; margin: 14px auto; filter: drop-shadow(0 0 16px var(--rar-glow)); }
.prog-unlock-card .pu-name { font-size: 18px; font-weight: 800; color: #fff; }
.prog-unlock-card .pu-rarity { font-size: 12px; font-weight: 700; color: var(--rar); margin-top: 2px; }
.prog-unlock-card button {
  margin-top: 16px; padding: 9px 22px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--rar); background: var(--rar-glow); color: #fff; font-weight: 700; font-size: 13px;
}

/* --- Profile borders (equipped via the 'border' slot) --------------------- */
.pb-bronze    { box-shadow: 0 0 0 3px #b08d57; }
.pb-silver    { box-shadow: 0 0 0 3px #c0c0c0, 0 0 12px rgba(192,192,192,0.5); }
.pb-gold      { box-shadow: 0 0 0 3px #f5c451, 0 0 16px rgba(245,196,81,0.6); }
.pb-neon      { box-shadow: 0 0 0 3px #a855f7, 0 0 22px rgba(168,85,247,0.75); animation: ct-shimmer 2.4s ease-in-out infinite; }
.pb-prismatic {
  box-shadow: 0 0 0 3px transparent, 0 0 26px rgba(236,72,153,0.7);
  background: linear-gradient(90deg,#f472b6,#a855f7,#22d3ee,#34d399) border-box;
  animation: pb-spin 6s linear infinite;
}
@keyframes pb-spin { to { filter: hue-rotate(360deg); } }

/* --- Daily quests widget (arcade / casino hubs) --------------------------- */
.prog-quests-card {
  background: rgba(20,12,30,0.62); border: 1px solid var(--prog-border);
  border-radius: 16px; padding: 15px 18px;
  box-shadow: 0 8px 30px -12px rgba(0,0,0,0.6);
}
.prog-quests-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  margin-bottom: 12px;
}
.prog-quests-head .pq-title { font-size: 15px; font-weight: 800; color: #fff; }
.prog-quests-head .pq-reset {
  font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.5);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.pq-list { display: flex; flex-direction: column; gap: 9px; }
.pq-row {
  display: flex; gap: 12px; align-items: center;
  padding: 9px 11px; border-radius: 11px;
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06);
}
.pq-row.ready { border-color: rgba(244,114,182,0.45); background: rgba(244,114,182,0.07); }
.pq-info { flex: 1; min-width: 0; }
.pq-name { font-size: 13px; font-weight: 700; color: #fff; }
.pq-desc { font-size: 11px; color: rgba(255,255,255,0.45); margin: 1px 0 6px; }
.pq-bar { height: 6px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; }
.pq-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #f472b6, #a855f7);
  transition: width .5s cubic-bezier(.2,.8,.2,1);
}
.pq-side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.pq-reward { font-size: 11px; font-weight: 700; color: #fbbf24; white-space: nowrap; }
.pq-claim {
  padding: 4px 13px; border-radius: 999px; cursor: pointer;
  font-size: 11px; font-weight: 700; color: #fff;
  border: 1px solid #e879f9; background: rgba(232,121,249,0.22);
}
.pq-claim:hover { background: rgba(232,121,249,0.4); }
.pq-prog { font-size: 11px; font-weight: 600; color: rgba(255,255,255,0.4); font-variant-numeric: tabular-nums; }
.pq-done { font-size: 11px; font-weight: 700; color: #34d399; }
.pq-empty { font-size: 13px; color: rgba(255,255,255,0.5); text-align: center; padding: 10px 0; margin: 0; }
.pq-empty a { color: #e879f9; font-weight: 600; }

/* --- Arcade Unlocks tab ---------------------------------------------------- */
.au-section { margin-bottom: 22px; }
.au-section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 10px;
  font-size: 13px; font-weight: 700; color: #fff;
}
.au-count { font-size: 11px; font-weight: 600; color: rgba(255,255,255,0.45); }
.au-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
}
.au-grid .cosmetic-tile { padding: 12px 8px; }
.au-grid .cosmetic-tile.locked { opacity: .55; filter: none; }
.au-grid .cosmetic-tile.locked img,
.au-grid .cosmetic-tile.locked .au-color-sample,
.au-grid .cosmetic-tile.locked .au-border-sample { filter: grayscale(1) brightness(.65); }

.au-title-sample {
  font-size: 14px; font-weight: 800; color: #fff; height: 64px;
  display: flex; align-items: center; justify-content: center; text-align: center;
}
.au-color-sample {
  font-size: 30px; font-weight: 900; height: 64px;
  display: flex; align-items: center; justify-content: center;
}
.au-border-sample {
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(255,255,255,0.06);
}

.au-lock {
  font-size: 10px; font-weight: 600; color: rgba(255,255,255,0.5);
  text-align: center; line-height: 1.3; margin-top: 2px;
}
.au-btn {
  margin-top: 2px; padding: 5px 14px; border-radius: 999px; cursor: pointer;
  font-size: 11px; font-weight: 700;
  border: 1px solid var(--rar, rgba(244,114,182,0.5));
  background: var(--rar-glow, rgba(244,114,182,0.25)); color: #fff;
}
.au-btn:hover { filter: brightness(1.15); }
.au-btn-off {
  background: transparent; color: rgba(255,255,255,0.7);
  border-color: rgba(255,255,255,0.2);
}

/* --- Achievements tab ------------------------------------------------------ */
.ach-summary { display: flex; gap: 12px; margin-bottom: 20px; }
.ach-sum {
  flex: 1; text-align: center; padding: 14px 12px; border-radius: 12px;
  background: var(--prog-bg); border: 1px solid var(--prog-border);
}
.ach-sum-num { font-size: 22px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }
.ach-sum-lbl { font-size: 11px; color: rgba(255,255,255,0.5); margin-top: 3px; text-transform: uppercase; letter-spacing: .04em; }
.ach-section { margin-bottom: 12px; }
.ach-section-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; font-weight: 700; color: #fff; margin-bottom: 9px;
  cursor: pointer; user-select: none;
}
.ach-section-head .ach-count { font-size: 11px; font-weight: 600; color: rgba(255,255,255,0.45); }
.ach-chevron {
  display: inline-block; width: 11px; margin-right: 6px;
  font-size: 9px; color: rgba(255,255,255,0.45);
  transition: transform .15s ease;
}
.ach-section.collapsed .ach-chevron { transform: rotate(-90deg); }
.ach-section.collapsed .ach-section-head { margin-bottom: 0; }
.ach-section.collapsed .ach-section-body { display: none; }
.ach-tools { display: flex; gap: 8px; margin-bottom: 14px; }
.ach-tool {
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7); border-radius: 999px;
  padding: 5px 13px; font-size: 11px; font-weight: 700; cursor: pointer;
  font-family: inherit; transition: background .15s, color .15s;
}
.ach-tool:hover { background: rgba(255,255,255,0.1); color: #fff; }
.ach-scope {
  font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: rgba(255,255,255,0.6); background: rgba(255,255,255,0.07);
  border-radius: 999px; padding: 2px 7px; margin-left: 8px; vertical-align: middle;
}
.ach-scope[data-scope="casino"] { color: #f0abfc; background: rgba(217,70,239,0.14); }
.ach-scope[data-scope="arcade"] { color: #7dd3fc; background: rgba(56,189,248,0.12); }
.ach-row {
  display: flex; gap: 12px; align-items: center;
  padding: 11px 13px; margin-bottom: 8px; border-radius: 12px;
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06);
}
.ach-row.done { border-color: rgba(245,158,11,0.4); background: rgba(245,158,11,0.06); }
.ach-icon { font-size: 22px; line-height: 1; flex-shrink: 0; }
.ach-row:not(.done) .ach-icon { filter: grayscale(1); opacity: .55; }
.ach-main { flex: 1; min-width: 0; }
.ach-name { font-size: 13px; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ach-reward {
  font-size: 10px; font-weight: 700; padding: 1px 8px; border-radius: 999px;
  color: var(--rar, #9ca3af); border: 1px solid var(--rar, #9ca3af);
  background: rgba(255,255,255,0.04);
}
.ach-desc { font-size: 11px; color: rgba(255,255,255,0.5); margin: 3px 0 7px; }
.ach-bar { height: 6px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; }
.ach-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #f59e0b, #ec4899); transition: width .5s cubic-bezier(.2,.8,.2,1); }
.ach-side { flex-shrink: 0; text-align: right; }
.ach-pts { font-size: 12px; font-weight: 800; color: #fbbf24; white-space: nowrap; }
.ach-prog { font-size: 11px; color: rgba(255,255,255,0.45); font-variant-numeric: tabular-nums; margin-top: 2px; }

@media (prefers-reduced-motion: reduce) {
  .cosmetic-tile, .prog-toast, .prog-unlock-overlay, .pb-neon, .pb-prismatic,
  .prog-xp-bar .xpb-fill, .ach-fill { animation: none !important; transition: none !important; }
}
