/**
 * ArcadeHub Player Profile & Progression System - Stylesheet
 * 
 * Includes:
 * 1. Header Profile Pill (.header-profile-pill)
 * 2. Profile Backdrop (.profile-backdrop)
 * 3. Slide-Out Profile Drawer (.profile-drawer)
 * 4. Mobile Bottom Sheet (.sheet-drag-handle)
 * 5. Drawer Header & Gamer Tag Editor (.profile-header, .profile-tag-input)
 * 6. Avatar Picker Grid (.avatar-picker-grid, .avatar-btn)
 * 7. Flame Streak Banner (.streak-banner, .streak-flame)
 * 8. Level & XP Progress Section (.profile-level-section, .profile-xp-bar)
 * 9. Daily Quests Board (.quest-board, .quest-card, .btn-claim-quest)
 * 10. Lifetime Stats Grid (.profile-stats-grid, .profile-stat-card)
 * 11. Level-Up Celebration Modal (.level-up-modal, .level-up-content, .level-up-confetti-canvas)
 * 12. Floating XP Notifications (.xp-floating-tag)
 * 13. Light Theme Adaptations ([data-theme="light"])
 * 14. Accessibility & Reduced Motion (@media prefers-reduced-motion)
 */

/* ==========================================================================
   1. Profile Design Tokens & Scoped Variables
   ========================================================================== */

:root {
  --profile-drawer-bg: #0d121f;
  --profile-card-bg: rgba(255, 255, 255, 0.04);
  --profile-card-hover: rgba(255, 255, 255, 0.08);
  --profile-card-border: rgba(255, 255, 255, 0.08);
  --profile-pill-bg: rgba(255, 255, 255, 0.06);
  --profile-pill-hover: rgba(255, 255, 255, 0.12);
  --profile-pill-border: rgba(255, 255, 255, 0.12);
  --profile-text-main: #f8fafc;
  --profile-text-sub: #94a3b8;
  --profile-text-muted: #64748b;
  --profile-gold: #ffd700;
  --profile-gold-glow: rgba(255, 215, 0, 0.4);
  --profile-xp-gradient: linear-gradient(90deg, #6366f1, #a855f7, #ec4899);
  --profile-claim-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --profile-streak-bg: linear-gradient(135deg, rgba(245, 158, 11, 0.14) 0%, rgba(239, 68, 68, 0.08) 100%);
  --profile-streak-border: rgba(245, 158, 11, 0.3);
}

[data-theme="light"] {
  --profile-drawer-bg: #ffffff;
  --profile-card-bg: rgba(0, 0, 0, 0.035);
  --profile-card-hover: rgba(0, 0, 0, 0.06);
  --profile-card-border: rgba(0, 0, 0, 0.08);
  --profile-pill-bg: rgba(0, 0, 0, 0.05);
  --profile-pill-hover: rgba(0, 0, 0, 0.09);
  --profile-pill-border: rgba(0, 0, 0, 0.12);
  --profile-text-main: #0f172a;
  --profile-text-sub: #475569;
  --profile-text-muted: #64748b;
  --profile-gold: #b45309;
  --profile-gold-glow: rgba(217, 119, 6, 0.3);
  --profile-streak-bg: linear-gradient(135deg, rgba(254, 243, 199, 0.8) 0%, rgba(254, 226, 226, 0.6) 100%);
  --profile-streak-border: rgba(245, 158, 11, 0.4);
}

/* ==========================================================================
   2. Header Profile Pill (.header-profile-pill)
   ========================================================================== */

.header-profile-mount {
  display: inline-flex;
  align-items: center;
}

.header-profile-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem 0.35rem 0.5rem;
  background: var(--profile-pill-bg);
  border: 1px solid var(--profile-pill-border);
  border-radius: var(--radius-full, 9999px);
  color: var(--profile-text-main);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  backdrop-filter: var(--glass-blur-sm, blur(8px));
  -webkit-backdrop-filter: var(--glass-blur-sm, blur(8px));
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  line-height: 1;
  text-decoration: none;
}

.header-profile-pill:hover {
  background: var(--profile-pill-hover);
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.header-profile-pill:active {
  transform: scale(0.98);
}

.header-profile-pill:focus-visible {
  outline: 2px solid var(--accent-cyan, #00f0ff);
  outline-offset: 2px;
}

/* Pill Avatar Icon */
.pill-avatar {
  font-size: 1.15rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Pill Level Badge */
.pill-level-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.35);
  white-space: nowrap;
}

/* Pill Gamer Tag */
.pill-gamer-tag {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--profile-text-main);
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Pill Mini XP Progress Bar */
.pill-xp-bar {
  width: 54px;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

.pill-xp-fill {
  height: 100%;
  width: 0%;
  background: var(--profile-xp-gradient);
  border-radius: 9999px;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 6px rgba(168, 85, 247, 0.5);
}

/* ==========================================================================
   3. Profile Backdrop Overlay (.profile-backdrop)
   ========================================================================== */

.profile-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: opacity 0.25s ease, visibility 0.25s ease;
  will-change: opacity, visibility;
}

.profile-backdrop.is-closed,
.profile-backdrop:not(.is-open) {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.profile-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ==========================================================================
   4. Slide-Out Profile Drawer (.profile-drawer)
   ========================================================================== */

.profile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(400px, 92vw);
  height: 100vh;
  z-index: 1001;
  background: var(--profile-drawer-bg);
  border-left: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  color: var(--profile-text-main);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s ease;
  will-change: transform, visibility;
}

.profile-drawer.is-closed,
.profile-drawer:not(.is-open) {
  transform: translateX(100%);
  visibility: hidden;
  pointer-events: none;
}

.profile-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
}

/* Drawer Scrollable Body */
.profile-drawer-body,
.profile-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.profile-drawer-body::-webkit-scrollbar,
.profile-body::-webkit-scrollbar {
  width: 6px;
}

.profile-drawer-body::-webkit-scrollbar-track,
.profile-body::-webkit-scrollbar-track {
  background: transparent;
}

.profile-drawer-body::-webkit-scrollbar-thumb,
.profile-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 9999px;
}

.profile-drawer-body::-webkit-scrollbar-thumb:hover,
.profile-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* Drag Handle Bar (Hidden on desktop, visible on mobile bottom sheet) */
.sheet-drag-handle {
  display: none;
  width: 44px;
  height: 4px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.25);
  margin: 10px auto 4px auto;
  cursor: grab;
  flex-shrink: 0;
}

/* ==========================================================================
   5. Drawer Header & Gamer Tag Editor
   ========================================================================== */

.profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  background: rgba(255, 255, 255, 0.02);
  flex-shrink: 0;
}

.profile-header-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.profile-header-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--profile-text-main);
}

.profile-rank-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full, 9999px);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--profile-text-sub);
}

.profile-close-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--profile-text-sub);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, transform 0.25s ease;
}

.profile-close-btn:hover {
  color: var(--profile-text-main);
  background: rgba(255, 255, 255, 0.08);
  transform: rotate(90deg);
}

.profile-close-btn:focus-visible {
  outline: 2px solid var(--accent-cyan, #00f0ff);
  outline-offset: 1px;
}

/* Gamer Tag Editor Container */
.profile-tag-container {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.profile-tag-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--profile-text-muted);
}

.profile-tag-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.profile-tag-input {
  width: 100%;
  padding: 0.65rem 2.25rem 0.65rem 0.85rem;
  background: var(--profile-card-bg);
  border: 1px solid var(--profile-card-border);
  border-radius: var(--radius-md, 12px);
  color: var(--profile-text-main);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.profile-tag-input:focus {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--accent-cyan, #00f0ff);
  box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.25);
}

.profile-tag-edit-icon {
  position: absolute;
  right: 0.75rem;
  font-size: 0.85rem;
  color: var(--profile-text-muted);
  pointer-events: none;
}

.profile-tag-hint {
  font-size: 0.7rem;
  color: var(--profile-text-muted);
}

/* ==========================================================================
   6. Avatar Picker Grid (.avatar-picker-grid)
   ========================================================================== */

.avatar-picker-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.avatar-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.avatar-picker-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--profile-text-muted);
}

.avatar-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.avatar-btn,
.avatar-item {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  height: 52px;
  padding: 0;
  background: var(--profile-card-bg);
  border: 2px solid var(--profile-card-border);
  border-radius: var(--radius-md, 12px);
  cursor: pointer;
  user-select: none;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), 
              border-color 0.2s ease, 
              box-shadow 0.2s ease, 
              background 0.2s ease;
}

.avatar-btn:hover,
.avatar-item:hover {
  transform: scale(1.15);
  background: var(--profile-card-hover);
  border-color: rgba(255, 255, 255, 0.25);
  z-index: 2;
}

.avatar-btn:active,
.avatar-item:active {
  transform: scale(0.95);
}

.avatar-btn:focus-visible,
.avatar-item:focus-visible {
  outline: 2px solid var(--accent-cyan, #00f0ff);
  outline-offset: 2px;
}

.avatar-btn.is-selected,
.avatar-item.is-selected {
  border: 2px solid var(--profile-gold);
  background: rgba(255, 215, 0, 0.12);
  box-shadow: 0 0 14px var(--profile-gold-glow);
  transform: scale(1.05);
}

/* ==========================================================================
   7. Streak Banner (.streak-banner)
   ========================================================================== */

.streak-banner {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.85rem 1rem;
  background: var(--profile-streak-bg);
  border: 1px solid var(--profile-streak-border);
  border-radius: var(--radius-lg, 16px);
  position: relative;
  overflow: hidden;
}

.streak-flame-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: rgba(245, 158, 11, 0.2);
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.4);
  animation: flame-glow 2.5s ease-in-out infinite;
}

.streak-flame {
  font-size: 1.65rem;
  line-height: 1;
  display: inline-block;
  animation: flame-wiggle 1.8s ease-in-out infinite;
  transform-origin: center bottom;
}

@keyframes flame-wiggle {
  0%, 100% {
    transform: scale(1) rotate(0deg);
  }
  25% {
    transform: scale(1.08) rotate(-3deg);
  }
  50% {
    transform: scale(1.14) rotate(3deg);
  }
  75% {
    transform: scale(1.06) rotate(-2deg);
  }
}

@keyframes flame-glow {
  0%, 100% {
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.35);
  }
  50% {
    box-shadow: 0 0 22px rgba(245, 158, 11, 0.65);
  }
}

.streak-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.streak-title-row {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.streak-count,
.streak-number {
  font-size: 1.35rem;
  font-weight: 900;
  color: #f59e0b;
  line-height: 1;
}

.streak-days {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--profile-text-main);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.streak-subtitle,
.streak-label {
  font-size: 0.75rem;
  color: var(--profile-text-sub);
  font-weight: 500;
}

/* ==========================================================================
   8. Level & XP Progress Section (.profile-level-section)
   ========================================================================== */

.profile-level-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--profile-card-bg);
  border: 1px solid var(--profile-card-border);
  border-radius: var(--radius-lg, 16px);
  padding: 1.1rem;
}

.profile-level-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.profile-level-badge-large {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.profile-level-number {
  font-size: 1.75rem;
  font-weight: 900;
  line-height: 1;
  background: var(--profile-xp-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.profile-rank-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--profile-text-main);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.profile-xp-text,
.profile-xp-readout {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--profile-text-sub);
}

.profile-xp-bar {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full, 9999px);
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

.profile-xp-fill {
  height: 100%;
  width: 0%;
  background: var(--profile-xp-gradient);
  border-radius: var(--radius-full, 9999px);
  transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
  position: relative;
  background-size: 200% 100%;
  animation: xp-shimmer 3s ease infinite;
}

@keyframes xp-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

.profile-xp-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: var(--profile-text-muted);
}

/* ==========================================================================
   9. Daily Quests Board (.quest-board, .quest-card)
   ========================================================================== */

.quest-board {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.quest-board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quest-board-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--profile-text-muted);
}

.quest-reset-tag {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-cyan, #00f0ff);
  background: rgba(0, 240, 255, 0.1);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full, 9999px);
  border: 1px solid rgba(0, 240, 255, 0.2);
}

.quest-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.quest-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  background: var(--profile-card-bg);
  border: 1px solid var(--profile-card-border);
  border-radius: var(--radius-md, 12px);
  padding: 0.85rem;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.quest-card:hover {
  background: var(--profile-card-hover);
  border-color: rgba(255, 255, 255, 0.15);
}

.quest-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.quest-card-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.quest-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--profile-text-main);
  line-height: 1.25;
}

.quest-meta-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.72rem;
}

.quest-category-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--profile-text-sub);
}

.quest-xp-reward {
  font-weight: 700;
  color: #10b981;
}

/* Quest Progress Bar */
.quest-progress-track,
.quest-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}

.quest-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

.quest-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.1rem;
}

.quest-progress-text {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--profile-text-muted);
}

/* Claim XP Button */
.btn-claim-quest,
.quest-claim-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-md, 8px);
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease, background 0.2s ease;
  white-space: nowrap;
}

.btn-claim-quest:focus-visible,
.quest-claim-btn:focus-visible {
  outline: 2px solid #10b981;
  outline-offset: 2px;
}

/* Claimable state: pulsing green button */
.btn-claim-quest.is-claimable,
.btn-claim-quest:not(:disabled):not(.is-claimed),
.quest-claim-btn.is-claimable {
  background: var(--profile-claim-gradient);
  color: #ffffff;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.45);
  animation: claim-pulse 1.8s infinite;
  cursor: pointer;
}

.btn-claim-quest.is-claimable:hover,
.btn-claim-quest:not(:disabled):not(.is-claimed):hover,
.quest-claim-btn.is-claimable:hover {
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.65);
}

.btn-claim-quest.is-claimable:active,
.btn-claim-quest:not(:disabled):not(.is-claimed):active,
.quest-claim-btn.is-claimable:active {
  transform: scale(0.97);
}

@keyframes claim-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
}

/* Claimed state: muted checkmark */
.btn-claim-quest.is-claimed,
.btn-claim-quest[disabled],
.quest-claim-btn.is-claimed,
.quest-claim-btn[disabled] {
  background: rgba(255, 255, 255, 0.08);
  color: var(--profile-text-muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: none;
  animation: none;
  cursor: not-allowed;
  opacity: 0.75;
}

/* ==========================================================================
   10. Lifetime Stats Grid (.profile-stats-grid)
   ========================================================================== */

.profile-stats-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.profile-stats-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--profile-text-muted);
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.profile-stat-card,
.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  background: var(--profile-card-bg);
  border: 1px solid var(--profile-card-border);
  border-radius: var(--radius-md, 12px);
  padding: 0.75rem 0.5rem;
  text-align: center;
  transition: transform 0.2s ease, background 0.2s ease;
}

.profile-stat-card:hover,
.stat-card:hover {
  background: var(--profile-card-hover);
  transform: translateY(-1px);
}

.stat-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.stat-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--profile-text-main);
  line-height: 1;
}

.stat-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--profile-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ==========================================================================
   11. Level-Up Celebration Modal (.level-up-modal & .level-up-content)
   ========================================================================== */

.level-up-modal {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 1.5rem;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.level-up-modal.is-hidden,
.level-up-modal[style*="display: none"] {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.level-up-confetti-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1051;
}

.level-up-content,
.level-up-card {
  position: relative;
  z-index: 1052;
  width: min(440px, 92vw);
  background: radial-gradient(circle at 50% 30%, #1e1b4b 0%, #0f172a 75%, #090d16 100%);
  border: 2px solid rgba(255, 215, 0, 0.5);
  border-radius: var(--radius-xl, 24px);
  padding: 2.25rem 1.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.25rem;
  box-shadow: 0 0 50px rgba(168, 85, 247, 0.4), 
              0 0 80px rgba(255, 215, 0, 0.25),
              0 20px 40px rgba(0, 0, 0, 0.8);
  animation: level-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  overflow: hidden;
}

/* Golden Ray Rotation Effect Behind Badge */
.level-up-rays {
  position: absolute;
  top: 15%;
  left: 50%;
  width: 280px;
  height: 280px;
  margin-left: -140px;
  margin-top: -140px;
  background: conic-gradient(
    from 0deg,
    rgba(255, 215, 0, 0.2) 0deg 20deg,
    transparent 20deg 40deg,
    rgba(255, 215, 0, 0.2) 40deg 60deg,
    transparent 60deg 80deg,
    rgba(255, 215, 0, 0.2) 80deg 100deg,
    transparent 100deg 120deg,
    rgba(255, 215, 0, 0.2) 120deg 140deg,
    transparent 140deg 160deg,
    rgba(255, 215, 0, 0.2) 160deg 180deg,
    transparent 180deg 200deg,
    rgba(255, 215, 0, 0.2) 200deg 220deg,
    transparent 220deg 240deg,
    rgba(255, 215, 0, 0.2) 240deg 260deg,
    transparent 260deg 280deg,
    rgba(255, 215, 0, 0.2) 280deg 300deg,
    transparent 300deg 320deg,
    rgba(255, 215, 0, 0.2) 320deg 340deg,
    transparent 340deg 360deg
  );
  border-radius: 50%;
  filter: blur(2px);
  animation: ray-spin 20s linear infinite;
  pointer-events: none;
  opacity: 0.65;
}

@keyframes ray-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Popping Level Badge */
.level-up-badge-wrapper {
  position: relative;
  z-index: 2;
  margin-top: 0.5rem;
}

.level-up-badge {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffd700 0%, #f59e0b 50%, #ec4899 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.7),
              inset 0 2px 4px rgba(255, 255, 255, 0.5);
  border: 3px solid #ffffff;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.level-up-badge .badge-label {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.level-up-badge .badge-number {
  font-size: 2.25rem;
  font-weight: 900;
  line-height: 1;
}

@keyframes level-pop {
  0% {
    transform: scale(0.3) rotate(-10deg);
    opacity: 0;
  }
  70% {
    transform: scale(1.15) rotate(3deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* Modal Typography */
.level-up-header {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.level-up-kicker {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
}

.level-up-title {
  margin: 0;
  font-size: 1.85rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.level-up-rank-unlocked {
  font-size: 1.05rem;
  font-weight: 700;
  color: #a855f7;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.25rem 0.85rem;
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.35);
  border-radius: 9999px;
}

.level-up-desc {
  font-size: 0.85rem;
  color: var(--profile-text-sub);
  margin: 0;
  line-height: 1.4;
}

/* Modal Action Continue Button */
.btn-level-up-continue,
.level-up-btn {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-md, 12px);
  border: none;
  background: linear-gradient(135deg, #ffd700 0%, #f59e0b 50%, #d97706 100%);
  color: #000000;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.5);
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn-level-up-continue:hover,
.level-up-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.7);
  filter: brightness(1.08);
}

.btn-level-up-continue:active,
.level-up-btn:active {
  transform: scale(0.98);
}

.btn-level-up-continue:focus-visible,
.level-up-btn:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 2px;
}

/* ==========================================================================
   12. Floating XP Notifications (.xp-floating-tag)
   ========================================================================== */

.xp-floating-tag {
  position: fixed;
  top: 70px;
  right: 20px;
  z-index: 1060;
  pointer-events: none;
  font-size: 0.9rem;
  font-weight: 800;
  color: #10b981;
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  animation: float-up-fade 1.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes float-up-fade {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.85);
  }
  20% {
    opacity: 1;
    transform: translateY(0) scale(1.05);
  }
  80% {
    opacity: 1;
    transform: translateY(-20px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-36px) scale(0.9);
  }
}

/* ==========================================================================
   13. Responsive Mobile Bottom Sheet (@media max-width: 640px)
   ========================================================================== */

@media (max-width: 640px) {
  /* Header Pill adjustments for tight screens */
  .header-profile-pill {
    padding: 0.3rem 0.5rem;
    gap: 0.35rem;
  }

  .pill-gamer-tag {
    display: none;
  }

  .pill-xp-bar {
    width: 42px;
  }

  /* Profile Drawer transforms into Bottom Sheet */
  .profile-drawer {
    top: auto;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-height: 88vh;
    border-left: none;
    border-top: 1px solid var(--profile-pill-border);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.6);
    padding-bottom: env(safe-area-inset-bottom, 16px);
  }

  .profile-drawer.is-closed,
  .profile-drawer:not(.is-open) {
    transform: translateY(100%);
  }

  .profile-drawer.is-open {
    transform: translateY(0);
  }

  .sheet-drag-handle {
    display: block;
  }

  .avatar-picker-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }

  .avatar-btn,
  .avatar-item {
    height: 48px;
    font-size: 1.5rem;
  }

  .level-up-content,
  .level-up-card {
    padding: 1.75rem 1.25rem;
  }

  .level-up-title {
    font-size: 1.55rem;
  }
}

/* ==========================================================================
   14. Light Theme Overrides & Nuances
   ========================================================================== */

[data-theme="light"] .profile-drawer {
  background: #ffffff;
  border-left-color: rgba(0, 0, 0, 0.1);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.15);
}

@media (max-width: 640px) {
  [data-theme="light"] .profile-drawer {
    border-top-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15);
  }
  [data-theme="light"] .sheet-drag-handle {
    background: rgba(0, 0, 0, 0.2);
  }
}

[data-theme="light"] .profile-header {
  border-bottom-color: rgba(0, 0, 0, 0.08);
  background: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .profile-close-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .pill-xp-bar,
[data-theme="light"] .profile-xp-bar,
[data-theme="light"] .quest-progress-track,
[data-theme="light"] .quest-progress-bar {
  background: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .profile-tag-input:focus {
  background: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .quest-reset-tag {
  color: #0284c7;
  background: rgba(2, 132, 199, 0.1);
  border-color: rgba(2, 132, 199, 0.25);
}

[data-theme="light"] .quest-xp-reward {
  color: #059669;
}

[data-theme="light"] .avatar-btn.is-selected,
[data-theme="light"] .avatar-item.is-selected {
  border-color: #d97706;
  background: rgba(245, 158, 11, 0.15);
  box-shadow: 0 0 12px rgba(217, 119, 6, 0.35);
}

[data-theme="light"] .level-up-content,
[data-theme="light"] .level-up-card {
  background: radial-gradient(circle at 50% 30%, #312e81 0%, #1e1b4b 75%, #0f172a 100%);
  color: #ffffff;
}

/* ==========================================================================
   15. Accessibility & Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .header-profile-pill,
  .profile-backdrop,
  .profile-drawer,
  .avatar-btn,
  .avatar-item,
  .streak-flame,
  .streak-flame-wrapper,
  .profile-xp-fill,
  .quest-progress-fill,
  .btn-claim-quest,
  .quest-claim-btn,
  .level-up-content,
  .level-up-card,
  .level-up-rays,
  .xp-floating-tag {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }

  .header-profile-pill:hover,
  .avatar-btn:hover,
  .avatar-item:hover,
  .btn-claim-quest:hover,
  .btn-level-up-continue:hover {
    transform: none !important;
  }

  .streak-flame {
    transform: none !important;
  }
}
