/* ==========================================================================
  Achievements collection + Customize loadout UI (profile tabs)
  Depends on design-tokens.css + player-identity.css.
  ========================================================================== */

/* ---- Profile tab pills ---- */
.profile-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 2px;
  margin-bottom: 1rem;
}
.profile-tabs::-webkit-scrollbar { display: none; }

.profile-tab-btn {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  position: relative;
}

.profile-tab-btn.is-active {
  color: #0b1120;
  background: linear-gradient(135deg, #D4A650, #E5C37E);
  border-color: transparent;
}

.profile-tab-btn .profile-tab-unread,
.profile-tab-btn .dg-unread-bubble.profile-tab-unread {
  position: absolute;
  top: -4px;
  right: -4px;
}

.profile-tab-panel.hidden { display: none; }

/* ---- Shared gold unread bubbles (iOS-style) ---- */
.dg-unread-bubble {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: linear-gradient(135deg, #D4A650, #E5C37E);
  color: #171006;
  text-shadow: none;
  font-size: 9px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid rgba(8, 12, 26, 0.85);
  box-shadow: 0 0 8px rgba(212, 166, 80, 0.45);
  pointer-events: none;
  z-index: 3;
  line-height: 1;
}

.dg-unread-bubble--dot {
  min-width: 10px;
  width: 10px;
  height: 10px;
  padding: 0;
  top: 6px;
  right: 6px;
}

/* ---- Achievements summary ---- */
.ach-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ach-summary__count {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
}

.ach-summary__count strong { color: var(--dg-gold, #D4A650); }

.ach-clear-all-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-shrink: 0;
  min-height: 30px;
  padding: 6px 9px;
  border-radius: 9px;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.11);
  font-size: 10px;
  font-weight: 650;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.ach-clear-all-btn:hover,
.ach-clear-all-btn:focus-visible {
  color: #fff;
  background: rgba(212, 166, 80, 0.1);
  border-color: rgba(212, 166, 80, 0.35);
  outline: none;
}

.ach-clear-overlay {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(18px, env(safe-area-inset-top, 0px)) 18px calc(18px + env(safe-area-inset-bottom, 0px));
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.ach-clear-card {
  width: min(100%, 370px);
  padding: 22px 18px 18px;
  border-radius: 22px;
  text-align: center;
  color: #f8fafc;
  background: linear-gradient(160deg, rgba(24, 33, 53, 0.99), rgba(10, 16, 31, 0.99));
  border: 1px solid rgba(229, 195, 126, 0.2);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5), 0 0 30px rgba(212, 166, 80, 0.07);
}

.ach-clear-icon {
  width: 46px;
  height: 46px;
  margin: 0 auto 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #f8e3ad;
  background: rgba(212, 166, 80, 0.12);
  border: 1px solid rgba(229, 195, 126, 0.3);
  box-shadow: 0 0 20px rgba(212, 166, 80, 0.12);
}

.ach-clear-title {
  margin: 0 0 7px;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
}

.ach-clear-copy {
  margin: 0 auto;
  max-width: 30ch;
  color: rgba(226, 232, 240, 0.67);
  font-size: 12px;
  line-height: 1.55;
}

.ach-clear-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 19px;
}

.ach-clear-btn {
  min-height: 40px;
  padding: 9px 11px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.ach-clear-btn:active { transform: scale(0.98); }
.ach-clear-btn:disabled { cursor: wait; opacity: 0.72; }

.ach-clear-btn--cancel {
  color: rgba(255, 255, 255, 0.76);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.11);
}

.ach-clear-btn--confirm {
  color: #171006;
  background: linear-gradient(135deg, #D4A650, #E5C37E);
  border: 1px solid transparent;
  box-shadow: 0 7px 20px rgba(212, 166, 80, 0.18);
}

/* ---- Sort by rarity (section header mounts) ---- */
.rarity-sort-mount {
  flex-shrink: 0;
}

.rarity-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.rarity-sort__label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: none;
  color: rgba(255, 255, 255, 0.4);
  margin-right: 2px;
  white-space: nowrap;
}

.rarity-sort__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.rarity-sort__btn:hover {
  color: rgba(255, 255, 255, 0.75);
  border-color: rgba(255, 255, 255, 0.18);
}

.rarity-sort__btn.is-active {
  color: #0b1120;
  background: linear-gradient(135deg, #D4A650, #E5C37E);
  border-color: transparent;
}

@media (max-width: 380px) {
  .rarity-sort__label { display: none; }
}

/* ---- Filter pills ---- */
.ach-filters {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: 14px;
}
.ach-filters::-webkit-scrollbar { display: none; }

.ach-filter-btn {
  flex-shrink: 0;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.ach-filter-btn.is-active {
  color: #e2c17c;
  background: rgba(212, 166, 80, 0.14);
  border-color: rgba(212, 166, 80, 0.4);
}

/* ---- Category groups (collapsed by default) ---- */
.ach-group { margin-bottom: 10px; }

.ach-group__header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  cursor: pointer;
  text-align: left;
  position: relative;
}

.ach-group__header .dg-unread-bubble {
  position: static;
  margin-left: 2px;
  flex-shrink: 0;
}

.ach-group__logo {
  width: 26px; height: 26px;
  border-radius: 7px;
  object-fit: contain;
  flex-shrink: 0;
  background: transparent;
}

.ach-group__icon {
  width: 26px; height: 26px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: rgba(212, 166, 80, 0.12);
  color: #e2c17c;
}

.ach-group__name {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

.ach-group__count {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.45);
  font-variant-numeric: tabular-nums;
}

.ach-group__count.is-complete { color: var(--dg-gold, #D4A650); }

.ach-group__chevron {
  color: rgba(255, 255, 255, 0.3);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.ach-group.is-open .ach-group__chevron { transform: rotate(90deg); }

.ach-group__body {
  display: none;
  padding: 10px 2px 2px;
}

.ach-group.is-open .ach-group__body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

@media (min-width: 640px) {
  .ach-group.is-open .ach-group__body { grid-template-columns: 1fr 1fr; }
}

/* ---- Achievement cards (rarity-scaled) ---- */
.ach-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  cursor: pointer;
  position: relative;
  /* Visible so badge particle FX (flames, sparkles) can spill past the card */
  overflow: visible;
  text-align: left;
  width: 100%;
}

.ach-card.is-unread {
  border-color: rgba(212, 166, 80, 0.55);
  box-shadow: 0 0 0 1px rgba(212, 166, 80, 0.18), 0 0 18px rgba(212, 166, 80, 0.12) inset;
}

.ach-card__icon {
  width: 68px; height: 68px;
  flex-shrink: 0;
  object-fit: contain;
  margin: -4px;
}

/* Reward-aware achievement visual (badge / theme / tagline / seal) */
.ach-visual {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
}

.ach-visual--locked {
  overflow: hidden;
}

.ach-visual__lock {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 23, 0.28);
  color: rgba(248, 250, 252, 0.72);
  pointer-events: none;
  z-index: 2;
}

.ach-visual__lock svg {
  width: 42%;
  height: 42%;
  opacity: 0.85;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
}

.ach-visual--detail .ach-visual__lock svg {
  width: 36%;
  height: 36%;
}
.ach-visual--row {
  width: 60px;
  height: 60px;
}
.ach-visual--detail {
  width: 108px;
  height: 108px;
  border-radius: 22px;
  margin: 0 auto 12px;
}
.ach-visual--toast {
  width: 44px;
  height: 44px;
  border-radius: 12px;
}
.ach-visual--badge {
  background: transparent;
  overflow: visible;
}
.ach-visual--badge img,
.ach-visual--badge .pi-badge-wrap > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.ach-visual--badge .pi-badge-wrap {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.ach-visual--detail.ach-visual--badge {
  overflow: visible;
  /* Room for rising flame / sparkle FX around the badge */
  margin-top: 10px;
  margin-bottom: 16px;
}
.ach-visual--theme {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.ach-visual--theme .ach-visual__initials,
.ach-visual--theme .pi-initials {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
}
.ach-visual--detail.ach-visual--theme .pi-initials {
  font-size: 32px;
}
.ach-visual--toast.ach-visual--theme .pi-initials {
  font-size: 14px;
}
.ach-visual--tagline {
  flex-direction: column;
  justify-content: center;
  gap: 0;
  padding: 6px 7px;
  text-align: center;
  background: linear-gradient(160deg, rgba(212, 166, 80, 0.14), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(212, 166, 80, 0.28);
}
.ach-visual--tagline.rarity-rare {
  background: linear-gradient(160deg, rgba(125, 211, 252, 0.12), rgba(255, 255, 255, 0.03));
  border-color: rgba(125, 211, 252, 0.28);
}
.ach-visual--tagline.rarity-epic {
  background: linear-gradient(160deg, rgba(167, 139, 250, 0.14), rgba(255, 255, 255, 0.03));
  border-color: rgba(167, 139, 250, 0.3);
}
.ach-visual--tagline.rarity-legendary {
  background: linear-gradient(160deg, rgba(212, 166, 80, 0.2), rgba(255, 255, 255, 0.04));
  border-color: rgba(246, 210, 127, 0.4);
}
.ach-visual--tagline.rarity-mythic {
  background: linear-gradient(160deg, rgba(251, 113, 133, 0.18), rgba(167, 139, 250, 0.12), rgba(255, 255, 255, 0.03));
  border-color: rgba(251, 113, 133, 0.45);
}
.ach-visual__tag {
  font-size: 9px;
  font-weight: 650;
  font-style: italic;
  line-height: 1.2;
  color: #e2c17c;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: auto;
}
.ach-visual__tag::before { content: '\201C'; }
.ach-visual__tag::after { content: '\201D'; }
.ach-visual--detail.ach-visual--tagline {
  width: min(220px, 72vw);
  height: auto;
  min-height: 72px;
  padding: 14px 16px;
  border-radius: 16px;
}
.ach-visual--detail .ach-visual__tag {
  font-size: 15px;
  line-height: 1.3;
  -webkit-line-clamp: 3;
  padding: 0;
}
.ach-visual--toast .ach-visual__tag {
  font-size: 8px;
  -webkit-line-clamp: 2;
}
.ach-visual--seal,
.ach-visual--masked {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(203, 213, 225, 0.75);
}
.ach-visual--seal.rarity-rare,
.ach-visual--masked.rarity-rare { color: #7dd3fc; border-color: rgba(125, 211, 252, 0.28); }
.ach-visual--seal.rarity-epic,
.ach-visual--masked.rarity-epic { color: #c4b5fd; border-color: rgba(167, 139, 250, 0.3); }
.ach-visual--seal.rarity-legendary,
.ach-visual--masked.rarity-legendary { color: #f6d27f; border-color: rgba(212, 166, 80, 0.35); }
.ach-visual--seal.rarity-mythic,
.ach-visual--masked.rarity-mythic { color: #fb7185; border-color: rgba(251, 113, 133, 0.4); }
.ach-visual__seal-icon {
  width: 52%;
  height: 52%;
}
.ach-visual__glyph {
  font-size: 22px;
  font-weight: 700;
  opacity: 0.7;
}
.ach-visual--detail .ach-visual__glyph { font-size: 36px; }
.ach-detail-icon-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 4px;
  overflow: visible;
  padding: 12px 8px 4px;
}

.ach-card__body { flex: 1; min-width: 0; }

.ach-card__name {
  font-size: 13px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.25;
}

.ach-card__desc {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.48);
  margin-top: 2px;
  line-height: 1.35;
}

.ach-card__progress {
  margin-top: 6px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.ach-card__progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #D4A650, #E5C37E);
  transition: width 0.3s ease;
}

.ach-card__progress-label {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}

/* Locked states */
.ach-card.is-locked .ach-card__icon,
.ach-card.is-locked .ach-visual { filter: grayscale(1) brightness(0.7); opacity: 0.7; }
.ach-card.is-locked .ach-card__name { color: rgba(255, 255, 255, 0.55); }

.ach-card.is-masked .ach-card__icon,
.ach-card.is-masked .ach-visual { filter: grayscale(1) brightness(0.35) contrast(1.4); }
.ach-card.is-masked .ach-card__name { color: rgba(255, 255, 255, 0.5); }
.ach-card.is-masked .ach-card__desc { letter-spacing: 0.15em; }

/* Rarity borders - visuals scale with difficulty */
.ach-card.rarity-common.is-unlocked { border-color: rgba(255, 255, 255, 0.14); }

.ach-card.rarity-rare.is-unlocked {
  border-color: rgba(125, 211, 252, 0.35);
  box-shadow: 0 0 12px rgba(125, 211, 252, 0.08) inset;
}

.ach-card.rarity-epic.is-unlocked {
  border-color: rgba(167, 139, 250, 0.45);
  box-shadow: 0 0 16px rgba(167, 139, 250, 0.12) inset;
}

.ach-card.rarity-legendary.is-unlocked {
  border-color: rgba(212, 166, 80, 0.55);
  box-shadow: 0 0 20px rgba(212, 166, 80, 0.15) inset;
}

.ach-card.rarity-legendary.is-unlocked::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(246, 210, 127, 0.12) 50%, transparent 70%);
  background-size: 250% 100%;
  animation: ach-legendary-sheen 3.2s linear infinite;
  pointer-events: none;
}

.ach-card.rarity-mythic.is-unlocked {
  border-color: rgba(251, 113, 133, 0.6);
  box-shadow:
  0 0 22px rgba(251, 113, 133, 0.16) inset,
  0 0 18px rgba(167, 139, 250, 0.1);
}

.ach-card.rarity-mythic.is-unlocked::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
  115deg,
  transparent 25%,
  rgba(251, 113, 133, 0.14) 42%,
  rgba(196, 181, 253, 0.14) 58%,
  transparent 75%
  );
  background-size: 250% 100%;
  animation: ach-legendary-sheen 2.6s linear infinite;
  pointer-events: none;
}

@keyframes ach-legendary-sheen {
  0% { background-position: 200% 50%; }
  100% { background-position: -50% 50%; }
}

.ach-rarity-dot {
  width: 7px; height: 7px;
  border-radius: 999px;
  flex-shrink: 0;
}

.rarity-common .ach-rarity-dot { background: #94a3b8; }
.rarity-rare .ach-rarity-dot { background: #7dd3fc; }
.rarity-epic .ach-rarity-dot { background: #a78bfa; }
.rarity-legendary .ach-rarity-dot { background: #f6d27f; box-shadow: 0 0 6px rgba(246, 210, 127, 0.7); }
.rarity-mythic .ach-rarity-dot {
  background: linear-gradient(135deg, #fb7185, #c4b5fd);
  box-shadow: 0 0 8px rgba(251, 113, 133, 0.75);
}

/* ---- Detail drawer / modal (centered; clears tab bar on mobile) ---- */
.ach-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) 16px calc(16px + var(--dg-tab-bar-h, 64px) + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
}

@media (min-width: 640px) {
  .ach-detail-overlay {
  padding: 24px;
  }
}

.ach-detail-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: min(82dvh, calc(100dvh - 32px - var(--dg-tab-bar-h, 64px)));
  margin: auto 0;
  overflow-x: visible;
  overflow-y: auto;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 22px 20px;
}

.ach-detail-card--secret {
  /* Keep badge art vertically centered; corner mark is out of flow. */
  padding-top: 22px;
}

.ach-detail-secret {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: min(138px, 40%);
  height: auto;
  margin: 0;
  pointer-events: none;
  user-select: none;
  transform: rotate(6deg);
  transform-origin: 90% 20%;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45));
}

@media (min-width: 420px) {
  .ach-detail-secret {
    width: 148px;
    top: 10px;
    right: 10px;
  }
}

.ach-detail-card .ach-detail-icon {
  width: 108px; height: 108px;
  margin: 0 auto 12px;
  display: block;
  object-fit: contain;
}
.ach-detail-card .ach-visual--detail {
  margin: 0 auto 12px;
}

.ach-detail-rarity {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.ach-detail-rarity.rarity-common { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; }
.ach-detail-rarity.rarity-rare { background: rgba(125, 211, 252, 0.14); color: #7dd3fc; }
.ach-detail-rarity.rarity-epic { background: rgba(167, 139, 250, 0.15); color: #c4b5fd; }
.ach-detail-rarity.rarity-legendary { background: rgba(212, 166, 80, 0.18); color: #f6d27f; }
.ach-detail-rarity.rarity-mythic {
  background: linear-gradient(135deg, rgba(251, 113, 133, 0.2), rgba(167, 139, 250, 0.18));
  color: #fda4af;
}

.ach-detail-no-reward {
  margin-top: 12px;
}

.ach-detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

/* Multiple independent reward buttons (badge / title / theme) wrap neatly. */
.ach-detail-actions--multi {
  flex-wrap: wrap;
}

.ach-detail-actions--multi .ach-detail-equip-btn {
  flex: 1 1 calc(50% - 4px);
}

.ach-detail-actions--solo .ach-detail-close-btn {
  flex: 1;
}

.ach-detail-equip-btn {
  flex: 1;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  color: #0b1120;
  background: linear-gradient(135deg, #D4A650, #E5C37E);
  border: none;
  cursor: pointer;
}

.ach-detail-equip-btn:disabled {
  color: rgba(148, 163, 184, 0.85);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: default;
  opacity: 1;
}

.ach-detail-close-btn {
  flex: 1;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  color: #cbd5e1;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
}

/* ---- Customize (loadout editor) ---- */
.loadout-subtabs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.loadout-subtabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
  flex: 1;
}
.loadout-subtabs::-webkit-scrollbar { display: none; }

.loadout-subtab {
  flex-shrink: 0;
  padding: 7px 15px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.loadout-subtab.is-active {
  color: #e2c17c;
  background: rgba(212, 166, 80, 0.14);
  border-color: rgba(212, 166, 80, 0.4);
}

.loadout-show-locked {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 500;
  color: rgba(148, 163, 184, 0.9);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.loadout-show-locked input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: #c9a24a;
  cursor: pointer;
}

.loadout-option--locked {
  cursor: default;
  gap: 7px;
  opacity: 0.72;
  background: rgba(255, 255, 255, 0.02);
  border-color: transparent;
  pointer-events: none;
}

.loadout-option--locked .loadout-lock-icon {
  flex-shrink: 0;
  color: currentColor;
  opacity: 0.8;
}

.loadout-option--locked.rarity-common { color: #94a3b8; }
.loadout-option--locked.rarity-rare { color: #7dd3fc; }
.loadout-option--locked.rarity-epic { color: #c4b5fd; }
.loadout-option--locked.rarity-legendary { color: #f6d27f; }
.loadout-option--locked.rarity-mythic { color: #fb7185; }

.loadout-option--locked .loadout-option__label {
  font-size: 8px;
  font-weight: 500;
  line-height: 1.15;
  color: inherit;
  opacity: 0.58;
  text-shadow: none;
}

.loadout-option--locked.rarity-legendary .loadout-option__label {
  text-shadow: none;
}

.loadout-option--locked.rarity-mythic .loadout-option__label {
  text-shadow: none;
}

.loadout-section { margin-bottom: 18px; }

.loadout-section__title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.loadout-section__hint {
  font-size: 10px;
  text-transform: none;
  letter-spacing: 0;
  color: rgba(255, 255, 255, 0.3);
}

.loadout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 6px;
}

.loadout-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 5px 3px 6px;
  min-height: 58px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  text-align: center;
}

.loadout-option .pi-initials { font-size: 16px; }

.loadout-option__label {
  font-size: 9.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Rarity-tinted labels so unlocking rarer flair feels distinct */
.loadout-option.rarity-common .loadout-option__label { color: #94a3b8; }
.loadout-option.rarity-rare .loadout-option__label { color: #7dd3fc; }
.loadout-option.rarity-epic .loadout-option__label { color: #c4b5fd; }
.loadout-option.rarity-legendary .loadout-option__label {
  color: #f6d27f;
  text-shadow: 0 0 8px rgba(246, 210, 127, 0.35);
}
.loadout-option.rarity-mythic .loadout-option__label {
  color: #fb7185;
  text-shadow: 0 0 10px rgba(251, 113, 133, 0.4);
}

.ach-card.rarity-common .ach-card__name { color: #cbd5e1; }
.ach-card.rarity-rare .ach-card__name { color: #7dd3fc; }
.ach-card.rarity-epic .ach-card__name { color: #c4b5fd; }
.ach-card.rarity-legendary .ach-card__name { color: #f6d27f; }
.ach-card.rarity-mythic .ach-card__name {
  color: #fda4af;
  text-shadow: 0 0 12px rgba(251, 113, 133, 0.35);
}

.loadout-option.is-selected {
  border-color: rgba(212, 166, 80, 0.65);
  background: rgba(212, 166, 80, 0.1);
  box-shadow: 0 0 10px rgba(212, 166, 80, 0.12);
}

.loadout-option img.loadout-badge-img,
.loadout-option .pi-badge-wrap > img.loadout-badge-img {
  width: 68px; height: 68px;
  object-fit: contain;
  margin: -4px;
}
.loadout-option .pi-badge-wrap {
  width: 60px;
  height: 60px;
  pointer-events: none;
}
.loadout-option .pi-badge-wrap > img.loadout-badge-img {
  width: 100%;
  height: 100%;
  margin: 0;
  pointer-events: none;
}

/* ---- Badge replace modal (3 slots full) ---- */
.badge-replace-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) 16px calc(16px + var(--dg-tab-bar-h, 64px) + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
}

@media (min-width: 640px) {
  .badge-replace-overlay {
  padding: 24px;
  }
}

.badge-replace-card {
  width: 100%;
  max-width: 380px;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 18px 16px 16px;
}

.badge-replace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.badge-replace-title {
  font-size: 16px;
  font-weight: 700;
  color: #f3f6fc;
  margin: 0;
}

.badge-replace-close {
  width: 30px; height: 30px;
  border-radius: 9px;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(200, 210, 230, 0.7);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.badge-replace-hint {
  font-size: 12px;
  color: rgba(148, 163, 184, 0.9);
  margin: 0 0 12px;
}

.badge-replace-hint strong { color: #e2c17c; font-weight: 600; }

.badge-replace-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.badge-replace-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  text-align: left;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.badge-replace-row:hover {
  border-color: rgba(212, 166, 80, 0.45);
  background: rgba(212, 166, 80, 0.08);
}

.badge-replace-row__img {
  width: 40px; height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}

/* Particle-wrapped badges (speedrun, hidden, etc.) need an explicit box - otherwise the wrap collapses in this flex row and the icon disappears. */
.badge-replace-row .pi-badge-wrap {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  overflow: visible;
}
.badge-replace-row .pi-badge-wrap > img.badge-replace-row__img,
.badge-replace-row .pi-badge-wrap > img {
  width: 100%;
  height: 100%;
  flex-shrink: 0;
}

.badge-replace-row__name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  color: rgba(248, 250, 252, 0.92);
}

.badge-replace-row__action {
  font-size: 11px;
  font-weight: 650;
  color: #e2c17c;
  flex-shrink: 0;
}

.badge-replace-cancel {
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  color: rgba(203, 213, 225, 0.85);
  font-size: 13px;
  cursor: pointer;
}

.loadout-option--tagline {
  min-height: 42px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
  font-style: italic;
}

.loadout-status { font-size: 12px; }

/* ---- Sign-in gate card ---- */
.ach-gate {
  text-align: center;
  padding: 28px 18px;
}

.ach-gate__icon {
  width: 46px; height: 46px;
  margin: 0 auto 12px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(212, 166, 80, 0.12);
  color: #e2c17c;
}

.ach-gate__icon--badge {
  width: 64px;
  height: 64px;
  border-radius: 0;
  background: transparent;
  color: inherit;
}

.ach-gate__badge {
  width: 64px;
  height: 64px;
  object-fit: contain;
  display: block;
}

/* ---- Friend profile viewer modal ---- */
.friend-profile-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) 16px calc(16px + var(--dg-tab-bar-h, 64px) + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
}

@media (min-width: 640px) {
  .friend-profile-overlay {
  padding: 24px;
  }
}

.friend-profile-card {
  width: 100%;
  max-width: 400px;
  max-height: min(82dvh, calc(100dvh - 32px - var(--dg-tab-bar-h, 64px)));
  margin: auto 0;
  overflow-y: auto;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 22px 20px;
}

.friend-profile-card .fp-badges {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  overflow: visible;
}

.friend-profile-card .fp-badge-btn {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 1 auto;
  width: min(156px, calc((100% - 12px) / 3));
  aspect-ratio: 1;
  min-width: 0;
}

.friend-profile-card .fp-badge-btn:hover {
  opacity: 0.9;
  transform: scale(1.03);
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.friend-profile-card .fp-badges .fp-badge-btn .pi-badge-wrap,
.friend-profile-card .fp-badges .fp-badge-btn > img.pi-badge {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 1;
  object-fit: contain;
}

.friend-profile-card .fp-badges .fp-badge-btn .pi-badge-wrap {
  overflow: visible;
  display: block;
}

.friend-profile-card .fp-badges .fp-badge-btn .pi-badge-wrap > img.pi-badge {
  width: 100% !important;
  height: 100% !important;
}

.friend-profile-card .fp-initials {
  text-align: center;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.3em 0 0.1em;
  margin-bottom: 4px;
  color: #a78bfa;
}

.friend-profile-card .fp-initials--btn {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  cursor: pointer;
}

.friend-profile-card .fp-tagline {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 0;
  background: transparent;
  border: none;
  font-size: 12px;
  font-style: italic;
  color: #e2c17c;
  cursor: pointer;
  text-align: center;
}

.friend-profile-card .fp-tagline:hover,
.friend-profile-card .fp-initials--btn:hover {
  opacity: 0.88;
}

.fp-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.fp-stat {
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  text-align: center;
}

.fp-stat__value {
  font-size: 18px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
  font-variant-numeric: tabular-nums;
}

.fp-stat__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .ach-card.rarity-legendary.is-unlocked::after,
  .ach-card.rarity-mythic.is-unlocked::after { animation: none; }
}

/* ---- Secret ? float particles (locked secret cosmetics) ---- */
.secret-qm-layer {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  overflow: hidden;
}

.secret-qm {
  position: fixed;
  left: 0;
  top: 0;
  display: block;
  width: 1.2em;
  height: 1.2em;
  margin: 0;
  padding: 0;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: var(--qm-size, 18px);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  color: hsl(var(--qm-hue, 340) 85% 78% / 0.95);
  text-shadow:
    0 0 10px hsl(var(--qm-hue, 340) 90% 65% / 0.55),
    0 1px 2px rgba(0, 0, 0, 0.45);
  will-change: transform, opacity;
  animation: secret-qm-float var(--qm-dur, 1100ms) cubic-bezier(0.22, 0.61, 0.36, 1) var(--qm-delay, 0ms) forwards;
  transform: translate3d(-50%, -50%, 0) translate3d(var(--qm-ox, 0px), var(--qm-oy, 0px), 0) scale(0.55);
  opacity: 0;
}

@keyframes secret-qm-float {
  0% {
    opacity: 0;
    transform: translate3d(-50%, -50%, 0) translate3d(var(--qm-ox, 0px), var(--qm-oy, 0px), 0) scale(0.55) rotate(0deg);
  }
  14% {
    opacity: 0.98;
    transform: translate3d(-50%, -50%, 0)
      translate3d(
        calc(var(--qm-ox, 0px) + var(--qm-dx, 0px) * 0.12),
        calc(var(--qm-oy, 0px) + var(--qm-dy, 0px) * 0.12),
        0
      )
      scale(1.08) rotate(calc(var(--qm-rot, 0deg) * 0.25));
  }
  100% {
    opacity: 0;
    transform: translate3d(-50%, -50%, 0)
      translate3d(
        calc(var(--qm-ox, 0px) + var(--qm-dx, 0px)),
        calc(var(--qm-oy, 0px) + var(--qm-dy, 0px)),
        0
      )
      scale(0.82) rotate(var(--qm-rot, 0deg));
  }
}

@media (prefers-reduced-motion: reduce) {
  .secret-qm {
    animation-duration: 700ms;
    animation-timing-function: ease-out;
  }
}
