:root {
  --profile-primary: #07379d;
  --profile-primary-hover: #052870;
  --profile-secondary: #fcd104;
  --profile-bg: #f8fafc;
  --profile-card-bg: #ffffff;
  --profile-text-main: #1e293b;
  --profile-text-muted: #64748b;
  --profile-border: #e2e8f0;
  --profile-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --profile-streak: #fcd104;
}

.profile-container {
  max-width: 1000px;
  margin: 2rem auto;
  padding: 0 1rem;
  font-family: 'Poppins', sans-serif;
}

.profile-card {
  background: var(--profile-card-bg);
  border-radius: 1.5rem;
  overflow: hidden;
  box-shadow: var(--profile-shadow);
  border: 1px solid var(--profile-border);
}

.profile-header {
  background: linear-gradient(135deg, var(--profile-primary) 0%, var(--profile-secondary) 100%);
  padding: 3rem 2rem;
  color: white;
  display: flex;
  align-items: center;
  gap: 2rem;
  position: relative;
}

.profile-avatar-wrapper {
  position: relative;
}

.profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.3);
  object-fit: cover;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.profile-avatar-placeholder {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: 700;
  border: 4px solid rgba(255, 255, 255, 0.3);
}

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

.profile-info h1 {
  font-size: 2.25rem;
  font-weight: 700;
  margin: 0;
}

.profile-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.025em;
  text-transform: capitalize;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(8px);
  user-select: none;
  line-height: 1.2;
}

.profile-role-badge.role-admin {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.9) 0%, rgba(220, 38, 38, 0.95) 100%);
  color: #ffffff;
  border: 1px solid rgba(254, 202, 202, 0.4);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.35);
}

.profile-role-badge.role-client {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.9) 0%, rgba(5, 150, 105, 0.95) 100%);
  color: #ffffff;
  border: 1px solid rgba(167, 243, 208, 0.4);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.25);
}

.profile-role-badge.role-guest {
  background: linear-gradient(135deg, rgba(100, 116, 139, 0.9) 0%, rgba(71, 85, 105, 0.95) 100%);
  color: #ffffff;
  border: 1px solid rgba(203, 213, 225, 0.4);
}

.profile-email {
  font-size: 1rem;
  opacity: 0.9;
  margin-bottom: 1.5rem;
}

.profile-actions {
  display: flex;
  gap: 1rem;
}

.btn-profile-edit {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 0.6rem 1.2rem;
  border-radius: 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
}

.btn-profile-edit:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.btn-profile-known-words {
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.4) 0%, rgba(15, 118, 110, 0.6) 100%);
  border: 1px solid rgba(94, 234, 212, 0.5);
  color: #ffffff !important;
  padding: 0.6rem 1.2rem;
  border-radius: 0.75rem;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
  display: inline-flex;
  align-items: center;
}

.btn-profile-known-words:hover {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.6) 0%, rgba(13, 148, 136, 0.8) 100%);
  border-color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.4);
}

.stat-item-link {
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease;
  cursor: pointer;
}

.stat-item-link:hover {
  background: #f0fdfa !important;
  transform: translateY(-2px);
}

.btn-known-words-link {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
  color: #ffffff !important;
  border: 1px solid #5eead4;
  border-radius: 0.75rem;
  font-weight: 700;
  text-decoration: none;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.3);
}

.btn-known-words-link:hover {
  background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
  border-color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.45);
  color: #ffffff !important;
}

.profile-honey-pill {
  background: linear-gradient(135deg, rgba(254, 243, 199, 0.9) 0%, rgba(253, 230, 138, 0.95) 100%);
  border: 1.5px solid #f59e0b;
  color: #78350f !important;
  text-decoration: none;
  cursor: pointer;
  padding: 0.55rem 1.1rem;
  border-radius: 0.75rem;
  font-size: 0.9rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  user-select: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.profile-honey-pill:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 6px 16px rgba(217, 119, 6, 0.35);
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

.profile-honey-pill .honey-pot-emoji {
  font-size: 1.25rem;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
  animation: honeyWiggle 3.5s ease-in-out infinite;
}

.profile-honey-pill .honey-amount-display {
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
  font-size: 1.1rem;
  font-weight: 900;
  color: #92400e;
  letter-spacing: -0.01em;
}

.profile-honey-pill .honey-text-display {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #b45309;
}

.profile-streak-container {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.profile-streak-badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 1.25rem 1.75rem;
  border-radius: 1.25rem;
  text-align: center;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), inset 0 1px 1px rgba(255, 255, 255, 0.4);
  min-width: 140px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.profile-streak-badge:hover {
  transform: translateY(-3px) scale(1.02);
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 12px 30px rgba(234, 88, 12, 0.25), inset 0 1px 2px rgba(255, 255, 255, 0.6);
}

.streak-daily-status-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.28rem 0.75rem;
  border-radius: 9999px;
  margin-bottom: 0.5rem;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.streak-daily-status-tag.is-done {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.35) 0%, rgba(5, 150, 105, 0.45) 100%);
  border: 1.5px solid rgba(52, 211, 153, 0.75);
  color: #ecfdf5;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.4);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.streak-daily-status-tag.is-done i {
  color: #6ee7b7;
  font-size: 0.8rem;
}

.streak-daily-status-tag.is-not-done {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.32) 0%, rgba(220, 38, 38, 0.42) 100%);
  border: 1.5px solid rgba(248, 113, 113, 0.7);
  color: #fff1f2;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.28), inset 0 1px 1px rgba(255, 255, 255, 0.4);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.streak-daily-status-tag.is-not-done i {
  color: #fca5a5;
  font-size: 0.8rem;
}

.streak-count {
  font-size: 2.75rem;
  font-weight: 900;
  display: block;
  line-height: 1;
  color: #ffffff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.streak-label {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.95);
  margin-top: 0.25rem;
  display: block;
}

.streak-icon {
  color: #f97316;
  margin-top: 0.4rem;
  font-size: 1.4rem;
  filter: drop-shadow(0 2px 8px rgba(249, 115, 22, 0.6));
  animation: streakFlamePulse 1.8s ease-in-out infinite alternate;
}

@keyframes streakFlamePulse {
  0% { transform: scale(1); filter: drop-shadow(0 2px 6px rgba(249, 115, 22, 0.5)); }
  100% { transform: scale(1.15); filter: drop-shadow(0 4px 14px rgba(239, 68, 68, 0.8)); }
}

.btn-preview-streak-animations {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0.12) 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: 0.55rem 1.15rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1), inset 0 1px 1px rgba(255, 255, 255, 0.5);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
  width: 100%;
}

.btn-preview-streak-animations:hover {
  background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
  border-color: #fde047;
  color: #ffffff;
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 6px 20px rgba(234, 88, 12, 0.45), inset 0 1px 2px rgba(255, 255, 255, 0.6);
}

.btn-preview-streak-animations i {
  color: #fef08a;
  font-size: 0.95rem;
  transition: transform 0.2s ease;
}

.btn-preview-streak-animations:hover i {
  transform: scale(1.2) rotate(8deg);
  color: #ffffff;
}

/* ==========================================================================
   User Experience & Level Progress Bar
   ========================================================================== */

.profile-xp-section {
  background: #ffffff;
  padding: 1.5rem 2rem 1.25rem 2rem;
  border-bottom: 1px solid var(--profile-border);
  box-sizing: border-box;
}

.xp-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.xp-honey-reward-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: #475569;
  font-weight: 600;
  background: #fffbeb;
  border: 1px dashed #fcd34d;
  padding: 0.2rem 0.65rem;
  border-radius: 9999px;
}

.xp-honey-reward-hint .hint-text {
  color: #64748b;
}

.xp-honey-reward-hint .honey-reward-tag {
  color: #b45309;
  font-weight: 800;
}

.xp-level-label {
  font-size: 1.15rem;
  font-weight: 800;
  color: #07379d;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.xp-title-label {
  font-size: 1rem;
  font-weight: 800;
  color: #64748b;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.xp-track {
  width: 100%;
  height: 14px;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, #0284c7 0%, #38bdf8 60%, #fcd104 100%);
  border-radius: 9999px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

.xp-bar-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.4rem;
}

.xp-count {
  font-size: 0.9rem;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.02em;
}

/* User Level Badge for Community Cards */
.user-level-badge {
  display: inline-block;
  background: #eff6ff;
  color: #0284c7;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
  border: 1px solid #bfdbfe;
  margin-left: 0.35rem;
  vertical-align: middle;
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: #f8fafc;
  border-bottom: 1px solid var(--profile-border);
}

.profile-stats-grid.has-honey {
  grid-template-columns: repeat(4, 1fr);
}

.honey-stat-card {
  background: linear-gradient(180deg, rgba(254, 243, 199, 0.4) 0%, rgba(255, 255, 255, 0) 100%);
}

.honey-stat-value {
  color: #b45309 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.honey-icon-small {
  font-size: 1.6rem;
  line-height: 1;
  display: inline-block;
  animation: honeyWiggle 3.5s ease-in-out infinite;
}

.stat-item {
  padding: 1.75rem 1rem;
  text-align: center;
  border-right: 1px solid var(--profile-border, #e2e8f0);
}

.stat-item:last-child {
  border-right: none;
}

.profile-stats-grid .stat-value {
  display: block;
  font-size: 1.85rem;
  font-weight: 800;
  color: #0f172a !important;
  line-height: 1.2;
}

.profile-stats-grid .stat-label {
  display: block;
  font-size: 0.8rem;
  color: #475569 !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  margin-top: 0.35rem;
}

.profile-stats-grid .text-teal-600 {
  color: #0d9488 !important;
}

.profile-content {
  padding: 2.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
}

.content-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--profile-text-main);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.view-all-link {
  font-size: 0.875rem;
  color: var(--profile-primary);
  text-decoration: none;
  font-weight: 500;
}

.view-all-link:hover {
  text-decoration: underline;
}

.attempts-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.attempt-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: #f8fafc;
  border-radius: 1rem;
  border: 1px solid var(--profile-border);
  transition: all 0.2s ease;
}

.attempt-card:hover {
  border-color: var(--profile-secondary);
  background: white;
  transform: translateX(4px);
}

.attempt-word {
  font-weight: 700;
  color: var(--profile-text-main);
  display: block;
}

.attempt-date {
  font-size: 0.75rem;
  color: var(--profile-text-muted);
}

.status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 2rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.status-badge.correct {
  background: #dcfce7;
  color: #166534;
}

.status-badge.incorrect {
  background: #fee2e2;
  color: #991b1b;
}

.contests-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.contest-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.contest-group .contests-list {
  gap: 0.75rem;
}

.contest-group-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--profile-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
  display: block;
}

.contest-card {
  display: block;
  padding: 1.25rem;
  border-radius: 1rem;
  text-decoration: none;
  transition: all 0.2s ease;
  border: 1px solid var(--profile-border);
}

.contest-card.created {
  background: #eff6ff;
  border-color: #dbeafe;
}

.contest-card.created:hover {
  background: #dbeafe;
  transform: translateY(-2px);
}

.contest-card.participating {
  background: #f8fafc;
}

.contest-card.participating:hover {
  background: #f1f5f9;
  transform: translateY(-2px);
}

.contest-title {
  display: block;
  font-weight: 700;
  color: #1e40af;
  margin-bottom: 0.25rem;
}

.contest-card.participating .contest-title {
  color: var(--profile-text-main);
}

.contest-meta {
  font-size: 0.75rem;
  color: #60a5fa;
}

.contest-card.participating .contest-meta {
  color: var(--profile-text-muted);
}

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  background: #f8fafc;
  border-radius: 1rem;
  border: 2px dashed var(--profile-border);
}

.empty-state p {
  color: var(--profile-text-muted);
  margin-bottom: 1rem;
}

.empty-state-link {
  color: var(--profile-primary);
  font-weight: 600;
  text-decoration: none;
}

@media (max-width: 768px) {
  .profile-container {
    padding: 0 0.75rem;
    margin: 1rem auto;
  }

  .profile-card {
    border-radius: 1.25rem;
  }

  .profile-header {
    flex-direction: column;
    text-align: center;
    align-items: center;
    padding: 3rem 1.25rem 2rem;
    gap: 1.5rem;
  }

  .profile-avatar-wrapper {
    margin-top: 0.5rem;
    margin-bottom: 0.25rem;
  }

  .profile-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
  }

  .profile-name-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    width: 100%;
    margin-bottom: 0.25rem;
    text-align: center;
  }

  .profile-info h1 {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    word-break: break-word;
  }

  .profile-role-badge {
    margin: 0 auto;
    font-size: 0.78rem;
    padding: 0.25rem 0.7rem;
  }

  .profile-email {
    font-size: 0.9rem;
    opacity: 0.9;
    margin: 0.15rem 0 1.25rem 0;
    text-align: center;
    word-break: break-all;
  }

  .profile-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .btn-profile-edit,
  .btn-back-community,
  .profile-honey-pill {
    font-size: 0.85rem;
    padding: 0.55rem 1rem;
    box-sizing: border-box;
  }

  .xp-honey-reward-hint {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
  }

  .profile-streak-container {
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-top: 0.5rem;
    width: 100%;
    max-width: 240px;
    align-items: center;
    justify-content: center;
  }

  .profile-streak-badge {
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 1rem 1.5rem;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .streak-count {
    font-size: 2.25rem;
  }

  .btn-preview-streak-animations {
    width: 100%;
    box-sizing: border-box;
  }

  .profile-stats-grid,
  .profile-stats-grid.has-honey {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-item {
    border-right: 1px solid var(--profile-border);
    border-bottom: 1px solid var(--profile-border);
    padding: 1.25rem 0.75rem;
  }

  .stat-item:nth-child(2n) {
    border-right: none;
  }

  .stat-item:last-child {
    border-bottom: none;
  }

  .profile-content {
    grid-template-columns: 1fr;
    padding: 1.5rem;
  }
}

@media (max-width: 480px) {
  .profile-header {
    padding: 3.25rem 1rem 1.75rem;
    gap: 1.25rem;
  }

  .profile-info h1 {
    font-size: 1.55rem;
  }

  .profile-actions {
    gap: 0.6rem;
  }

  .btn-profile-edit,
  .btn-back-community,
  .profile-honey-pill {
    padding: 0.5rem 0.9rem;
    font-size: 0.82rem;
  }
}

/* ==== Invitations Page Styling ==== */
.invitations-container {
  max-width: 800px;
  margin: 4rem auto;
  padding: 0 1.5rem;
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
}

.invitations-header {
  text-align: center;
  margin-bottom: 3rem;
}

.invitations-header .page-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.invitations-header .subtitle {
  color: #64748b;
  font-size: 1.1rem;
}

.invitations-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.invitation-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border-radius: 16px;
  padding: 1.5rem 2rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
  border: 1px solid #e2e8f0;
  transition: transform 0.2s, box-shadow 0.2s;
}

.invitation-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.06);
  border-color: #cbd5e1;
}

.invitation-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.invitation-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #3b82f6;
}

.invitation-contest-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.invitation-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.invitation-actions form {
  margin: 0;
}

/* Empty State Card */
.empty-state-card {
  background-color: #ffffff;
  border-radius: 16px;
  padding: 4rem 2rem;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.04);
  border: 2px dashed #cbd5e1;
  max-width: 650px;
  margin: 0 auto;
}

.empty-state-card .empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.5rem auto;
  color: #94a3b8;
  background: #f8fafc;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state-card .empty-icon svg {
  width: 32px;
  height: 32px;
}

.empty-state-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.75rem;
}

.empty-state-card p {
  color: #64748b;
  font-size: 1.05rem;
  line-height: 1.6;
}

/* Invitation Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.btn-icon {
  width: 18px;
  height: 18px;
}

.btn-success {
  background-color: #10b981;
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
  background-color: #059669;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(16, 185, 129, 0.3);
}

.btn-danger {
  background-color: transparent;
  color: #ef4444;
  border: 1px solid #ef4444;
}

.btn-danger:hover {
  background-color: #fef2f2;
  transform: translateY(-1px);
}

@media (max-width: 640px) {
  .invitation-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
  }

  .invitation-actions {
    width: 100%;
    justify-content: stretch;
  }

  .invitation-actions form,
  .invitation-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ==== Community Page Styling ==== */
.community-container {
  max-width: 1000px;
  margin: 4rem auto;
  padding: 0 1.5rem;
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
}

.community-header {
  text-align: center;
  margin-bottom: 3rem;
}

.community-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.community-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
  border: 1px solid #e2e8f0;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.community-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.08);
  border-color: #cbd5e1;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.community-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #e2e8f0;
}

.community-avatar-placeholder {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--profile-primary) 0%, var(--profile-secondary) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  border: 2px solid #e2e8f0;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.community-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.user-submeta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.15rem;
}

.user-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  font-size: 0.85rem;
  color: #64748b;
}

.community-role-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  text-transform: capitalize;
  letter-spacing: 0.02em;
  display: inline-block;
  line-height: 1.2;
}

.community-role-badge.role-admin {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.community-role-badge.role-client {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.community-card-footer {
  display: flex;
  justify-content: center;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed #e2e8f0;
}

.btn-view-profile-card {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #0284c7;
  transition: all 0.2s ease;
}

.community-card-link:hover .btn-view-profile-card {
  color: #0369a1;
  transform: translateX(4px);
}

.card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  text-align: center;
  padding-top: 1rem;
  border-top: 1px solid #f1f5f9;
  margin-top: auto;
  gap: 0.5rem;
}

.card-stats .stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.card-stats .stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--profile-primary);
}

.card-stats .stat-label {
  font-size: 0.75rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.streak-icon-small {
  color: #ef4444;
}

/* ==========================================================================
   Golden Champion Frame Cosmetic Styles
   ========================================================================== */

.profile-avatar-wrapper.has-golden-frame {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.golden-shimmer-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #f59e0b, #fef08a, #d97706, #fde047, #f59e0b);
  animation: goldRingSpin 4s linear infinite;
  z-index: 1;
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.65), 0 0 10px rgba(254, 240, 138, 0.4);
}

@keyframes goldRingSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.profile-avatar.avatar-golden-framed,
.profile-avatar-placeholder.avatar-golden-framed {
  position: relative;
  z-index: 2;
  border: 4px solid #fef08a !important;
  box-shadow: 0 0 15px rgba(217, 119, 6, 0.5);
}

.golden-crown-badge {
  position: absolute;
  top: -12px;
  right: -6px;
  font-size: 1.85rem;
  z-index: 10;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
  animation: crownBounce 2s ease-in-out infinite;
}

@keyframes crownBounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-4px) rotate(8deg); }
}

.btn-profile-cosmetic-toggle {
  background: rgba(245, 158, 11, 0.2);
  border: 1.5px solid #fcd34d;
  color: #ffffff;
  padding: 0.55rem 1.1rem;
  border-radius: 0.75rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
}

.btn-profile-cosmetic-toggle.equipped {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.4) 0%, rgba(217, 119, 6, 0.5) 100%);
  border-color: #fde047;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

.btn-profile-cosmetic-toggle:hover {
  transform: translateY(-2px);
  background: rgba(245, 158, 11, 0.4);
  border-color: #ffffff;
}

/* Community Avatar Mini Golden Frame */
.community-avatar-wrapper {
  position: relative;
  display: inline-flex;
}

.community-avatar-wrapper.has-golden-frame-mini::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #f59e0b, #fef08a, #d97706, #fde047, #f59e0b);
  animation: goldRingSpin 4s linear infinite;
  z-index: 1;
}

.community-avatar.avatar-golden-frame-mini,
.community-avatar-placeholder.avatar-golden-frame-mini {
  position: relative;
  z-index: 2;
  border: 2px solid #fef08a !important;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.community-crown-tag {
  position: absolute;
  top: -8px;
  right: -6px;
  font-size: 1rem;
  z-index: 10;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.3));
}

.champion-frame-text-badge {
  font-size: 0.95rem;
  vertical-align: middle;
  margin-right: 0.2rem;
}

/* Navbar avatar golden framed */
.nav-avatar.nav-avatar-golden-framed {
  border: 2px solid #fde047;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

.nav-crown-icon {
  font-size: 0.85rem;
  margin-left: 0.15rem;
}

/* ==========================================================================
   Cosmic Galaxy Frame (Marco Cósmico de Galaxia)
   ========================================================================== */

.profile-avatar-wrapper.has-cosmic-frame {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cosmic-shimmer-ring {
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #9333ea, #38bdf8, #ec4899, #6366f1, #06b6d4, #9333ea);
  animation: cosmicRingSpin 4s linear infinite;
  z-index: 1;
  box-shadow: 0 0 30px rgba(147, 51, 234, 0.75), 0 0 15px rgba(56, 189, 248, 0.5);
}

@keyframes cosmicRingSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.profile-avatar.avatar-cosmic-framed,
.profile-avatar-placeholder.avatar-cosmic-framed {
  position: relative;
  z-index: 2;
  border: 4px solid #c084fc !important;
  box-shadow: 0 0 18px rgba(147, 51, 234, 0.6);
}

.cosmic-crown-badge {
  position: absolute;
  top: -12px;
  right: -6px;
  font-size: 1.85rem;
  z-index: 10;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
  animation: cosmicBadgeFloat 2.5s ease-in-out infinite;
}

@keyframes cosmicBadgeFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-4px) scale(1.15); }
}

.btn-profile-cosmetic-toggle.equipped-cosmic {
  background: linear-gradient(135deg, rgba(147, 51, 234, 0.4) 0%, rgba(56, 189, 248, 0.4) 100%);
  border-color: #c084fc;
  box-shadow: 0 0 14px rgba(147, 51, 234, 0.5);
}

/* Community Avatar Mini Cosmic Frame */
.community-avatar-wrapper.has-cosmic-frame-mini::before {
  content: '';
  position: absolute;
  inset: -3.5px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #9333ea, #38bdf8, #ec4899, #6366f1, #06b6d4, #9333ea);
  animation: cosmicRingSpin 4s linear infinite;
  z-index: 1;
}

.community-avatar.avatar-cosmic-frame-mini,
.community-avatar-placeholder.avatar-cosmic-frame-mini {
  position: relative;
  z-index: 2;
  border: 2px solid #c084fc !important;
  box-shadow: 0 0 10px rgba(147, 51, 234, 0.5);
}

/* Navbar avatar cosmic framed */
.nav-avatar.nav-avatar-cosmic-framed {
  border: 2px solid #c084fc;
  box-shadow: 0 0 10px rgba(147, 51, 234, 0.8), 0 0 5px rgba(56, 189, 248, 0.6);
}

/* ==========================================================================
   Flame Frame (Marco Ígneo de Llamas - Exclusivo Cofre Legendario)
   ========================================================================== */

.profile-avatar-wrapper.has-flame-frame {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Blazing Flame Aura Backdrop (Profile) */
.flame-aura-backdrop {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 230px;
  height: 230px;
  pointer-events: none;
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flame-burst-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 0 18px rgba(239, 68, 68, 0.85)) drop-shadow(0 0 35px rgba(249, 115, 22, 0.6));
}

.flame-layer-outer {
  transform-origin: 120px 120px;
  animation: flameOuterDance 2.2s ease-in-out infinite alternate;
}

.flame-layer-mid {
  transform-origin: 120px 120px;
  animation: flameMidDance 1.6s ease-in-out infinite alternate-reverse;
}

.flame-layer-inner {
  transform-origin: 120px 120px;
  animation: flameInnerDance 1.1s ease-in-out infinite alternate;
}

@keyframes flameOuterDance {
  0% {
    transform: scale(0.97) rotate(-2deg);
    opacity: 0.88;
  }
  50% {
    transform: scale(1.08, 1.15) rotate(2.5deg);
    opacity: 1;
  }
  100% {
    transform: scale(1.02, 1.07) rotate(-1.5deg);
    opacity: 0.92;
  }
}

@keyframes flameMidDance {
  0% {
    transform: scale(1) rotate(1.5deg);
    opacity: 0.92;
  }
  50% {
    transform: scale(1.07, 1.12) rotate(-2deg);
    opacity: 1;
  }
  100% {
    transform: scale(0.97, 1.04) rotate(2deg);
    opacity: 0.9;
  }
}

@keyframes flameInnerDance {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.06, 1.1);
    filter: brightness(1.35);
  }
  100% {
    transform: scale(0.96, 1.03);
    filter: brightness(1.15);
  }
}

/* Floating Rising Embers */
.flame-ember {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, #fef08a 0%, #f97316 70%, transparent 100%);
  box-shadow: 0 0 8px #f97316, 0 0 14px #ef4444;
  pointer-events: none;
  animation: emberRise linear infinite;
}

.flame-ember.ember-1 { width: 6px; height: 6px; left: 46%; bottom: 22%; animation-duration: 2.2s; animation-delay: 0s; }
.flame-ember.ember-2 { width: 5px; height: 5px; left: 28%; bottom: 26%; animation-duration: 2.6s; animation-delay: 0.5s; }
.flame-ember.ember-3 { width: 7px; height: 7px; left: 66%; bottom: 24%; animation-duration: 2.0s; animation-delay: 0.9s; }
.flame-ember.ember-4 { width: 4px; height: 4px; left: 18%; bottom: 35%; animation-duration: 2.8s; animation-delay: 1.3s; }
.flame-ember.ember-5 { width: 5px; height: 5px; left: 78%; bottom: 32%; animation-duration: 2.4s; animation-delay: 1.7s; }

@keyframes emberRise {
  0% {
    transform: translateY(0) scale(1) translateX(0);
    opacity: 0.95;
  }
  50% {
    transform: translateY(-50px) scale(1.25) translateX(8px);
    opacity: 1;
  }
  100% {
    transform: translateY(-110px) scale(0.2) translateX(-10px);
    opacity: 0;
  }
}

.flame-shimmer-ring {
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #ef4444, #f97316, #fde047, #ea580c, #b91c1c, #f59e0b, #ef4444);
  animation: flameRingSpin 3s linear infinite;
  z-index: 1;
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.8), 0 0 18px rgba(249, 115, 22, 0.6);
}

@keyframes flameRingSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.profile-avatar.avatar-flame-framed,
.profile-avatar-placeholder.avatar-flame-framed {
  position: relative;
  z-index: 2;
  border: 4px solid #fb923c !important;
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.7);
}

.flame-crown-badge {
  position: absolute;
  top: -14px;
  right: -6px;
  font-size: 1.85rem;
  z-index: 10;
  filter: drop-shadow(0 2px 10px rgba(239, 68, 68, 0.7));
  animation: flameBadgeFlicker 1.6s ease-in-out infinite;
}

@keyframes flameBadgeFlicker {
  0%, 100% { transform: translateY(0) scale(1) rotate(-3deg); filter: drop-shadow(0 2px 6px rgba(249, 115, 22, 0.8)); }
  50% { transform: translateY(-5px) scale(1.18) rotate(5deg); filter: drop-shadow(0 4px 14px rgba(239, 68, 68, 0.95)); }
}

.btn-profile-cosmetic-toggle.equipped-flame {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.4) 0%, rgba(249, 115, 22, 0.4) 100%);
  border-color: #f97316;
  box-shadow: 0 0 14px rgba(249, 115, 22, 0.5);
}

/* Community Avatar Mini Flame Frame */
.community-avatar-wrapper.has-flame-frame-mini::before {
  content: '';
  position: absolute;
  inset: -3.5px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #ef4444, #f97316, #fde047, #ea580c, #b91c1c, #f59e0b, #ef4444);
  animation: flameRingSpin 3s linear infinite;
  z-index: 1;
}

.community-avatar.avatar-flame-frame-mini,
.community-avatar-placeholder.avatar-flame-frame-mini {
  position: relative;
  z-index: 2;
  border: 2px solid #fb923c !important;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
}

/* Navbar avatar flame framed */
.nav-avatar.nav-avatar-flame-framed {
  border: 2px solid #f97316;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.8), 0 0 5px rgba(245, 158, 11, 0.6);
  animation: flameNavGlow 2s ease-in-out infinite alternate;
}

@keyframes flameNavGlow {
  0% { box-shadow: 0 0 6px rgba(239, 68, 68, 0.6); }
  100% { box-shadow: 0 0 12px rgba(249, 115, 22, 0.9), 0 0 4px #fde047; }
}

/* ==========================================================================
   MARCO SOBERANO SUPREMO (ADMIN GOD-TIER FRAME)
   ========================================================================== */

.profile-avatar-wrapper.has-sovereign-frame {
  position: relative;
  border-radius: 50%;
  animation: sovereignFloatWrapper 4s ease-in-out infinite alternate;
}

@keyframes sovereignFloatWrapper {
  0% { transform: translateY(0); }
  100% { transform: translateY(-4px); }
}

/* Multi-layered God-Tier Pulsing Halo Ring */
.sovereign-halo-ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    #f59e0b,
    #ef4444,
    #ec4899,
    #8b5cf6,
    #3b82f6,
    #10b981,
    #fde047,
    #f59e0b
  );
  animation: sovereignHaloSpin 3.5s linear infinite;
  z-index: 1;
  box-shadow: 
    0 0 35px rgba(245, 158, 11, 0.8),
    0 0 55px rgba(239, 68, 68, 0.6),
    0 0 80px rgba(139, 92, 246, 0.4),
    inset 0 0 15px rgba(254, 240, 138, 0.8);
}

.sovereign-pulse-aura {
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

.sovereign-laser-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px dashed rgba(254, 240, 138, 0.85);
  animation: sovereignLaserSpin 6s linear infinite reverse;
  box-shadow: 0 0 20px rgba(253, 224, 71, 0.7);
}

/* Orbiting Holy Plasma Orbs */
.sovereign-orb {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 0%, #fde047 40%, #ef4444 100%);
  box-shadow: 0 0 12px #fef08a, 0 0 20px #ef4444;
  pointer-events: none;
}

.sovereign-orb.orb-1 {
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  animation: sovereignOrbDance1 3s ease-in-out infinite alternate;
}

.sovereign-orb.orb-2 {
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  animation: sovereignOrbDance2 3s ease-in-out infinite alternate;
}

.sovereign-orb.orb-3 {
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  animation: sovereignOrbDance3 3.4s ease-in-out infinite alternate;
}

.sovereign-orb.orb-4 {
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  animation: sovereignOrbDance4 3.4s ease-in-out infinite alternate;
}

@keyframes sovereignHaloSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes sovereignLaserSpin {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.06); }
  100% { transform: rotate(360deg) scale(1); }
}

@keyframes sovereignOrbDance1 {
  0% { transform: translateX(-50%) translateY(0) scale(1); }
  100% { transform: translateX(-50%) translateY(-10px) scale(1.3); }
}

@keyframes sovereignOrbDance2 {
  0% { transform: translateX(-50%) translateY(0) scale(1); }
  100% { transform: translateX(-50%) translateY(10px) scale(1.3); }
}

@keyframes sovereignOrbDance3 {
  0% { transform: translateY(-50%) translateX(0) scale(1); }
  100% { transform: translateY(-50%) translateX(-10px) scale(1.3); }
}

@keyframes sovereignOrbDance4 {
  0% { transform: translateY(-50%) translateX(0) scale(1); }
  100% { transform: translateY(-50%) translateX(10px) scale(1.3); }
}

/* Avatar Image & Placeholder styling */
.profile-avatar.avatar-sovereign-framed,
.profile-avatar-placeholder.avatar-sovereign-framed {
  position: relative;
  z-index: 2;
  border: 4.5px solid #fbbf24 !important;
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.8), 0 0 40px rgba(239, 68, 68, 0.6);
}

/* Imperial God Crown */
.sovereign-crown-badge {
  position: absolute;
  top: -22px;
  right: -10px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sovereign-crown-icon {
  font-size: 2.2rem;
  filter: drop-shadow(0 0 12px #fbbf24) drop-shadow(0 0 22px #ef4444);
  animation: sovereignCrownFloat 2s ease-in-out infinite alternate;
}

.sovereign-sparkle {
  position: absolute;
  color: #fffbeb;
  font-size: 1rem;
  filter: drop-shadow(0 0 6px #fde047);
  animation: sovereignSparkleTwinkle 1.8s ease-in-out infinite alternate;
}

.sovereign-sparkle.sparkle-1 { top: -4px; left: -8px; animation-delay: 0s; }
.sovereign-sparkle.sparkle-2 { top: -12px; right: -2px; font-size: 0.85rem; animation-delay: 0.6s; }
.sovereign-sparkle.sparkle-3 { bottom: 2px; right: -10px; animation-delay: 1.2s; }

@keyframes sovereignCrownFloat {
  0% { transform: translateY(0) rotate(-4deg) scale(1); filter: drop-shadow(0 0 10px #fbbf24) drop-shadow(0 0 18px #ef4444); }
  100% { transform: translateY(-7px) rotate(6deg) scale(1.18); filter: drop-shadow(0 0 16px #fde047) drop-shadow(0 0 28px #dc2626); }
}

@keyframes sovereignSparkleTwinkle {
  0% { opacity: 0.3; transform: scale(0.7) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.3) rotate(90deg); }
  100% { opacity: 0.4; transform: scale(0.8) rotate(180deg); }
}

/* Community Card Sovereign Frame */
.community-avatar-wrapper.has-sovereign-frame-mini::before {
  content: '';
  position: absolute;
  inset: -4.5px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    #f59e0b,
    #ef4444,
    #ec4899,
    #8b5cf6,
    #3b82f6,
    #10b981,
    #fde047,
    #f59e0b
  );
  animation: sovereignHaloSpin 3.5s linear infinite;
  z-index: 1;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.7), 0 0 20px rgba(239, 68, 68, 0.5);
}

.community-avatar.avatar-sovereign-frame-mini,
.community-avatar-placeholder.avatar-sovereign-frame-mini {
  position: relative;
  z-index: 2;
  border: 2.5px solid #fbbf24 !important;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.7);
}

.community-crown-tag.community-crown-sovereign {
  font-size: 1.15rem;
  filter: drop-shadow(0 0 6px #fbbf24) drop-shadow(0 0 10px #ef4444);
  animation: sovereignCrownFloat 2s ease-in-out infinite alternate;
}

.champion-frame-text-badge.sovereign-text-badge {
  font-size: 1rem;
  filter: drop-shadow(0 0 6px #f59e0b) drop-shadow(0 0 10px #ef4444);
  display: inline-block;
  animation: sovereignSparkleTwinkle 2s ease-in-out infinite alternate;
}

.card-header.has-community-sovereign-frame {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(147, 51, 234, 0.08) 50%, rgba(245, 158, 11, 0.08) 100%);
  border-radius: 12px;
  padding: 0.5rem;
}

/* Navbar avatar sovereign framed */
.nav-avatar.nav-avatar-sovereign-framed {
  border: 2.5px solid #fbbf24;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.9), 0 0 8px rgba(239, 68, 68, 0.7);
  animation: sovereignNavGlow 2s ease-in-out infinite alternate;
}

.nav-crown-icon.nav-crown-sovereign {
  font-size: 1.05rem;
  filter: drop-shadow(0 0 6px #fbbf24) drop-shadow(0 0 10px #ef4444);
  animation: sovereignCrownFloat 2s ease-in-out infinite alternate;
}

@keyframes sovereignNavGlow {
  0% { box-shadow: 0 0 8px rgba(245, 158, 11, 0.7); border-color: #fbbf24; }
  100% { box-shadow: 0 0 18px rgba(239, 68, 68, 0.95), 0 0 10px #fde047; border-color: #fde047; }
}

/* ==== Community Featured Admins Section ==== */
.community-section-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 2rem 0 1.25rem 0;
}

.community-section-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #1e293b;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.community-featured-badge {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.2rem 0.65rem;
  border-radius: 9999px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.community-featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.community-admin-card {
  background: linear-gradient(145deg, #ffffff 0%, #fefce8 100%);
  border: 2px solid #fde047;
  border-radius: 18px;
  padding: 1.5rem;
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.15);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.community-admin-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #f59e0b, #ef4444, #8b5cf6, #f59e0b);
  background-size: 200% 100%;
  animation: adminBannerShimmer 4s linear infinite;
}

@keyframes adminBannerShimmer {
  0% { background-position: 0% 0%; }
  100% { background-position: 200% 0%; }
}

.community-admin-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 16px 35px rgba(245, 158, 11, 0.28);
  border-color: #f59e0b;
}

.community-admin-card .community-role-badge.role-admin {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.18) 0%, rgba(220, 38, 38, 0.25) 100%);
  color: #b91c1c;
  border: 1.5px solid #f87171;
  font-weight: 800;
  padding: 0.15rem 0.55rem;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.2);
}

.community-admin-card .community-avatar,
.community-admin-card .community-avatar-placeholder {
  border-color: #f59e0b;
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
}

.community-divider-line {
  height: 1px;
  background: linear-gradient(90deg, transparent, #e2e8f0 20%, #e2e8f0 80%, transparent);
  margin: 2.5rem 0;
}


/* ==========================================================================
   COMMUNITY TABS & CLAN (ENJAMBRE) SYSTEM
   ========================================================================== */

/* Community Navigation Tabs Switcher */
.community-tabs-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin: 1.5rem 0 2.5rem 0;
  padding: 0.35rem;
  background: #f1f5f9;
  border-radius: 9999px;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
  border: 1px solid #e2e8f0;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.04);
}

.community-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.4rem;
  border-radius: 9999px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #64748b;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: none;
  background: transparent;
  cursor: pointer;
}

.community-tab-btn:hover {
  color: #1e293b;
  background: rgba(255, 255, 255, 0.6);
}

.community-tab-btn.is-active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
}

.community-tab-btn .tab-count-pill {
  background: #e2e8f0;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
}

.community-tab-btn.is-active .tab-count-pill {
  background: #fef08a;
  color: #854d0e;
}

/* Clans Top Header & Action Row */
.clans-top-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.clans-top-title h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.clans-top-title p {
  font-size: 0.88rem;
  color: #64748b;
  margin: 0.2rem 0 0 0;
}

.btn-open-create-clan {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.92rem;
  padding: 0.65rem 1.35rem;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-decoration: none;
}

.btn-open-create-clan:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
  color: #ffffff;
}

/* My Clan Hero Card */
.my-clan-hero-card {
  background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
  border: 2px solid #818cf8;
  border-radius: 20px;
  padding: 2rem;
  color: #ffffff;
  margin-bottom: 3rem;
  box-shadow: 0 12px 35px rgba(30, 27, 75, 0.35);
  position: relative;
  overflow: hidden;
}

.my-clan-hero-card::after {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.25) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.my-clan-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.my-clan-identity {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.my-clan-emblem {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.my-clan-details h3 {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.my-clan-details p {
  color: #94a3b8;
  margin: 0.3rem 0 0 0;
  font-size: 0.9rem;
}

.clan-tag-badge {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fde047;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  letter-spacing: 0.05em;
}

.my-clan-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.my-clan-stat-item {
  text-align: center;
}

.my-clan-stat-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: #f8fafc;
  display: block;
}

.my-clan-stat-lbl {
  font-size: 0.75rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.my-clan-members-list-title {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 1.5rem 0 1rem 0;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.my-clan-members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
}

.my-clan-member-pill {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 0.65rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
}

.my-clan-member-pill:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  color: #ffffff;
}

.my-clan-member-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid #818cf8;
  object-fit: cover;
}

.my-clan-member-placeholder {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #4f46e5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  color: #ffffff;
}

.my-clan-member-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #f1f5f9;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.my-clan-member-role-tag {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  display: inline-block;
  margin-top: 2px;
}

.my-clan-member-role-tag.role-leader {
  background: #f59e0b;
  color: #78350f;
}

.my-clan-member-role-tag.role-member {
  background: rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
}

.my-clan-actions-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.15);
}

.btn-leave-clan {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 0.45rem 0.95rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-leave-clan:hover {
  background: #ef4444;
  color: #ffffff;
}

/* Clans Explorer Cards Grid */
.clans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.5rem;
}

.clan-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 1.5rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.clan-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: var(--clan-banner, #f59e0b);
}

.clan-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
  border-color: #cbd5e1;
}

.clan-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.clan-emblem-badge {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  flex-shrink: 0;
}

.clan-info-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.clan-card-tag {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: 5px;
}

.clan-leader-meta {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 0.15rem;
}

.clan-desc {
  font-size: 0.85rem;
  color: #475569;
  line-height: 1.45;
  margin-bottom: 1.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.clan-stats-row {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 10px;
  padding: 0.65rem;
  margin-bottom: 1rem;
}

.clan-stat-box {
  text-align: center;
}

.clan-stat-val {
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f172a;
}

.clan-stat-lbl {
  font-size: 0.68rem;
  color: #64748b;
  text-transform: uppercase;
  display: block;
}

.btn-join-clan-action {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: #0284c7;
  color: #ffffff;
  border: none;
  padding: 0.55rem 1rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-join-clan-action:hover {
  background: #0369a1;
  transform: translateY(-1px);
}

.btn-clan-full {
  width: 100%;
  text-align: center;
  background: #f1f5f9;
  color: #94a3b8;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.55rem;
  border-radius: 10px;
}

/* Modal Form for Clan Creation */
.clan-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.clan-modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.clan-modal-box {
  background: #ffffff;
  border-radius: 20px;
  width: 100%;
  max-width: 480px;
  padding: 2rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  transform: scale(0.9);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.clan-modal-overlay.is-open .clan-modal-box {
  transform: scale(1);
}

.clan-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.clan-modal-header h3 {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0;
  color: #0f172a;
}

.btn-close-clan-modal {
  background: #f1f5f9;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
}

.clan-form-group {
  margin-bottom: 1.15rem;
}

.clan-form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 0.35rem;
}

.clan-form-input,
.clan-form-textarea {
  width: 100%;
  padding: 0.65rem 0.95rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  font-size: 0.92rem;
  font-family: inherit;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

.clan-form-input:focus,
.clan-form-textarea:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.clan-selector-grid {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.clan-emoji-option,
.clan-color-option {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 2px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.clan-emoji-option.is-selected,
.clan-color-option.is-selected {
  border-color: #0f172a;
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-submit-clan-create {
  width: 100%;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  border: none;
  padding: 0.8rem;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.35);
  margin-top: 0.5rem;
  transition: all 0.2s ease;
}

.btn-submit-clan-create:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
}


/* ==========================================================================
   CLAN GROUP CHAT & MEMBER CAPACITY CONTROLS
   ========================================================================== */

/* Capacity Selector */
.clan-members-slider-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.clan-members-slider {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: #e2e8f0;
  outline: none;
  accent-color: #f59e0b;
  cursor: pointer;
}

.clan-members-capacity-badge {
  background: #fef3c7;
  color: #92400e;
  border: 1.5px solid #fde68a;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-weight: 800;
  font-size: 0.88rem;
  white-space: nowrap;
}

/* Clan Chat Container */
.clan-chat-card {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  margin-top: 1.75rem;
  display: flex;
  flex-direction: column;
  height: 380px;
}

.clan-chat-header {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.clan-chat-header-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.clan-chat-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 800;
  color: #16a34a;
  background: #dcfce7;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
}

.clan-chat-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  animation: liveDotPulse 1.5s infinite;
}

@keyframes liveDotPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
}

.clan-chat-messages-container {
  flex: 1;
  padding: 1rem 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background: #fdfdfd;
}

.clan-chat-empty-state {
  margin: auto;
  text-align: center;
  color: #94a3b8;
  font-size: 0.85rem;
}

.clan-chat-msg {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  max-width: 82%;
  animation: chatMsgFadeIn 0.2s ease-out;
}

.clan-chat-msg.is-me {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.clan-chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1.5px solid #e2e8f0;
}

.clan-chat-avatar-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #6366f1;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  flex-shrink: 0;
}

.clan-chat-body {
  display: flex;
  flex-direction: column;
}

.clan-chat-msg.is-me .clan-chat-body {
  align-items: flex-end;
}

.clan-chat-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: #64748b;
  margin-bottom: 0.2rem;
}

.clan-chat-sender-name {
  font-weight: 700;
  color: #1e293b;
}

.clan-chat-role-tag {
  font-size: 0.62rem;
  font-weight: 800;
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
}

.clan-chat-role-tag.is-leader {
  background: #fef3c7;
  color: #92400e;
}

.clan-chat-role-tag.is-member {
  background: #f1f5f9;
  color: #475569;
}

.clan-chat-bubble {
  background: #f1f5f9;
  color: #0f172a;
  border-radius: 14px;
  border-top-left-radius: 3px;
  padding: 0.55rem 0.85rem;
  font-size: 0.88rem;
  line-height: 1.4;
  word-break: break-word;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.clan-chat-msg.is-me .clan-chat-bubble {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border-top-left-radius: 14px;
  border-top-right-radius: 3px;
}

.clan-chat-input-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
}

.clan-chat-input {
  flex: 1;
  padding: 0.55rem 0.85rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  font-size: 0.88rem;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s ease;
}

.clan-chat-input:focus {
  border-color: #0284c7;
}

.btn-send-clan-msg {
  background: #0284c7;
  color: #ffffff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-send-clan-msg:hover {
  background: #0369a1;
  transform: scale(1.05);
}

@keyframes chatMsgFadeIn {
  0% { opacity: 0; transform: translateY(6px); }
  100% { opacity: 1; transform: translateY(0); }
}


/* ==========================================================================
   CLAN LEADER SETTINGS & MANAGEMENT CONTROLS
   ========================================================================== */

.btn-clan-admin-settings {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(245, 158, 11, 0.15);
  color: #fde047;
  border: 1.5px solid #f59e0b;
  padding: 0.45rem 1rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-clan-admin-settings:hover {
  background: #f59e0b;
  color: #78350f;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

.clan-settings-modal-box {
  background: #ffffff;
  border-radius: 20px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  transform: scale(0.9);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.clan-modal-overlay.is-open .clan-settings-modal-box {
  transform: scale(1);
}

.clan-members-kick-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
  max-height: 240px;
  overflow-y: auto;
  padding: 0.25rem;
}

.clan-kick-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.6rem 0.85rem;
  gap: 0.75rem;
}

.clan-kick-user-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.btn-kick-member {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-kick-member:hover {
  background: #ef4444;
  color: #ffffff;
}

.clan-danger-box {
  background: #fef2f2;
  border: 1.5px solid #fecaca;
  border-radius: 14px;
  padding: 1.25rem;
  margin-top: 1.75rem;
}

.clan-danger-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #991b1b;
  margin: 0 0 0.35rem 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.clan-danger-desc {
  font-size: 0.82rem;
  color: #7f1d1d;
  margin: 0 0 1rem 0;
  line-height: 1.4;
}

.btn-disband-clan {
  width: 100%;
  background: #dc2626;
  color: #ffffff;
  border: none;
  padding: 0.65rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-disband-clan:hover {
  background: #b91c1c;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
}


/* ==========================================================================
   MOBILE RESPONSIVE STYLING FOR COMMUNITY & CLANS
   ========================================================================== */

@media (max-width: 640px) {
  .community-container {
    margin: 1.5rem auto 3rem auto;
    padding: 0 0.85rem;
  }

  .community-header {
    margin-bottom: 1.5rem;
  }

  .community-header .page-title {
    font-size: 1.8rem;
    margin-bottom: 0.35rem;
  }

  .community-header .subtitle {
    font-size: 0.85rem;
    padding: 0 0.5rem;
    line-height: 1.4;
  }

  /* Full Width Tab Switcher */
  .community-tabs-nav {
    width: 100%;
    max-width: 360px;
    margin: 1rem auto 1.75rem auto;
    padding: 0.25rem;
    gap: 0.35rem;
  }

  .community-tab-btn {
    flex: 1;
    justify-content: center;
    padding: 0.55rem 0.75rem;
    font-size: 0.88rem;
    gap: 0.35rem;
  }

  .community-tab-btn .tab-count-pill {
    font-size: 0.7rem;
    padding: 0.05rem 0.35rem;
  }

  /* Clans Top Header */
  .clans-top-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
    margin-bottom: 1.5rem;
  }

  .clans-top-title h2 {
    font-size: 1.25rem;
  }

  .clans-top-title p {
    font-size: 0.82rem;
  }

  .btn-open-create-clan {
    width: 100%;
    justify-content: center;
    padding: 0.75rem;
    font-size: 0.95rem;
  }

  /* My Clan Hero Card */
  .my-clan-hero-card {
    padding: 1.25rem 1rem;
    border-radius: 16px;
    margin-bottom: 2rem;
  }

  .my-clan-header-row {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    margin-bottom: 1.25rem;
  }

  .my-clan-identity {
    gap: 0.85rem;
  }

  .my-clan-emblem {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    font-size: 1.8rem;
  }

  .my-clan-details h3 {
    font-size: 1.25rem;
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .clan-tag-badge {
    font-size: 0.75rem;
    padding: 0.15rem 0.45rem;
  }

  .my-clan-details p {
    font-size: 0.82rem;
  }

  .btn-clan-admin-settings {
    width: 100%;
    justify-content: center;
    padding: 0.55rem;
  }

  .my-clan-leader-info {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
  }

  .my-clan-stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
    padding: 0.75rem 0.4rem;
    margin-bottom: 1.25rem;
  }

  .my-clan-stat-val {
    font-size: 1rem;
  }

  .my-clan-stat-lbl {
    font-size: 0.65rem;
  }

  .my-clan-members-grid {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .my-clan-member-pill {
    padding: 0.55rem 0.75rem;
  }

  /* Clan Chat Responsive */
  .clan-chat-card {
    height: 330px;
    border-radius: 14px;
    margin-top: 1.25rem;
  }

  .clan-chat-header {
    padding: 0.6rem 0.85rem;
  }

  .clan-chat-header-title {
    font-size: 0.88rem;
  }

  .clan-chat-messages-container {
    padding: 0.75rem 0.65rem;
    gap: 0.65rem;
  }

  .clan-chat-msg {
    max-width: 90%;
    gap: 0.5rem;
  }

  .clan-chat-avatar,
  .clan-chat-avatar-placeholder {
    width: 28px;
    height: 28px;
    font-size: 0.78rem;
  }

  .clan-chat-meta {
    font-size: 0.68rem;
    gap: 0.3rem;
  }

  .clan-chat-bubble {
    font-size: 0.82rem;
    padding: 0.45rem 0.7rem;
    border-radius: 12px;
  }

  .clan-chat-input-bar {
    padding: 0.5rem 0.65rem;
    gap: 0.4rem;
  }

  .clan-chat-input {
    font-size: 0.85rem;
    padding: 0.5rem 0.65rem;
  }

  .btn-send-clan-msg {
    width: 34px;
    height: 34px;
    font-size: 0.85rem;
  }

  .my-clan-actions-bar {
    margin-top: 1rem;
    padding-top: 1rem;
  }

  .btn-leave-clan {
    width: 100%;
    justify-content: center;
    padding: 0.6rem;
  }

  /* Grid Layouts on Mobile */
  .clans-grid,
  .community-grid,
  .community-featured-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .clan-card {
    padding: 1.15rem;
    border-radius: 14px;
  }

  .community-admin-card {
    padding: 1.15rem;
    border-radius: 14px;
  }

  .community-section-title {
    font-size: 1.15rem;
  }

  /* Modals on Mobile */
  .clan-modal-overlay {
    padding: 0.75rem;
  }

  .clan-modal-box,
  .clan-settings-modal-box {
    padding: 1.25rem 1rem;
    border-radius: 16px;
    max-height: 90vh;
  }

  .clan-modal-header h3 {
    font-size: 1.15rem;
  }

  .clan-form-group {
    margin-bottom: 0.9rem;
  }

  .clan-selector-grid {
    gap: 0.35rem;
  }

  .clan-emoji-option,
  .clan-color-option {
    width: 36px;
    height: 36px;
    font-size: 1.15rem;
  }

  .clan-kick-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding: 0.6rem;
  }

  .btn-kick-member {
    width: 100%;
    justify-content: center;
    padding: 0.45rem;
  }

  .clan-danger-box {
    padding: 1rem;
    margin-top: 1.25rem;
  }

  .btn-disband-clan {
    padding: 0.6rem;
    font-size: 0.85rem;
  }
}


/* ==========================================================================
   PERFECT ALIGNMENT FOR FEATURED ADMINS & COMMUNITY CARDS
   ========================================================================== */

.user-name-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  line-height: 1.25;
}

.user-name-text {
  font-size: 1.05rem;
  font-weight: 800;
  color: #1e293b;
  word-break: break-word;
}

.community-featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.community-admin-card {
  background: linear-gradient(145deg, #ffffff 0%, #fffdf0 100%) !important;
  border: 2px solid #fde047 !important;
  border-radius: 18px !important;
  padding: 1.4rem !important;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.12) !important;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
  position: relative !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  gap: 1.15rem !important;
  height: 100% !important;
}

.community-card {
  height: 100% !important;
  justify-content: space-between !important;
}

.community-admin-card .card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.community-admin-card .user-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  flex: 1;
}

@media (max-width: 640px) {
  .community-featured-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
    margin-bottom: 1.75rem !important;
  }

  .community-admin-card {
    padding: 1.15rem !important;
    border-radius: 16px !important;
  }

  .user-name-text {
    font-size: 0.98rem !important;
  }
}


/* ==========================================================================
   CONSECUTIVE MESSAGE GROUPING & COOLDOWN CONTROLS
   ========================================================================== */

.clan-chat-msg.is-consecutive {
  margin-top: -0.45rem !important;
}

.clan-chat-msg.is-consecutive .clan-chat-avatar,
.clan-chat-msg.is-consecutive .clan-chat-avatar-placeholder {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.clan-chat-msg.is-consecutive .clan-chat-meta {
  display: none !important;
}

.clan-chat-msg.is-consecutive .clan-chat-bubble {
  border-top-left-radius: 8px !important;
  border-top-right-radius: 14px !important;
}

.clan-chat-msg.is-me.is-consecutive .clan-chat-bubble {
  border-top-right-radius: 8px !important;
  border-top-left-radius: 14px !important;
}

/* Cooldown Button Animation & Style */
.btn-send-clan-msg.is-cooling {
  background: #64748b !important;
  color: #f1f5f9 !important;
  cursor: not-allowed !important;
  transform: none !important;
  box-shadow: none !important;
  font-size: 0.78rem !important;
  font-weight: 800 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}


/* ==========================================================================
   CLAN LEVELING & XP PROGRESSION STYLES
   ========================================================================== */

.clan-level-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.78rem;
  padding: 0.2rem 0.65rem;
  border-radius: 9999px;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
  letter-spacing: 0.02em;
}

.clan-progress-section {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  margin: 1.25rem 0;
}

.clan-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: #f1f5f9;
}

.clan-progress-reward-badge {
  font-size: 0.78rem;
  color: #fde047;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.clan-progress-bar-wrap {
  width: 100%;
  height: 10px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.clan-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #fbbf24, #10b981);
  border-radius: 9999px;
  transition: width 0.4s ease-out;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.6);
}

.clan-progress-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: #cbd5e1;
}

/* Clan Card Mini Level Bar */
.clan-card-level-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0.65rem 0 0.35rem 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
}

.clan-card-progress-bar {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 0.85rem;
}

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


/* ==========================================================================
   CLAN XP ACTIVITY LOG & STATS MODAL STYLES
   ========================================================================== */

.my-clan-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  flex-wrap: wrap;
}

.btn-clan-stats-modal {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(2, 132, 199, 0.18);
  color: #38bdf8;
  border: 1.5px solid #0284c7;
  padding: 0.55rem 1.15rem;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-clan-stats-modal:hover {
  background: #0284c7;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(2, 132, 199, 0.4);
}

.clan-activity-modal-box {
  background: #ffffff;
  border-radius: 20px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.75rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  transform: scale(0.9);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.clan-modal-overlay.is-open .clan-activity-modal-box {
  transform: scale(1);
}

/* Activity Summary Cards Grid */
.clan-activity-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 1.25rem 0 1.5rem 0;
}

.clan-activity-summary-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.75rem 0.65rem;
  text-align: center;
}

.clan-activity-summary-val {
  display: block;
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
}

.clan-activity-summary-lbl {
  display: block;
  font-size: 0.7rem;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  margin-top: 0.15rem;
}

/* Top Contributors */
.clan-top-contrib-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
}

.clan-top-contrib-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
}

.clan-top-contrib-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 0.88rem;
  color: #1e293b;
}

.clan-top-contrib-badge {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
}

/* Activity Feed */
.clan-activity-feed-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.clan-activity-feed-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.65rem 0.85rem;
  gap: 0.75rem;
  animation: chatMsgFadeIn 0.2s ease-out;
}

.clan-activity-feed-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.clan-activity-feed-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.clan-activity-feed-user-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clan-activity-feed-source {
  font-size: 0.75rem;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.1rem;
}

.clan-activity-feed-xp-pill {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

@media (max-width: 640px) {
  .my-clan-actions-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-clan-stats-modal {
    width: 100%;
    justify-content: center;
  }

  .clan-activity-summary-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.35rem;
  }

  .clan-activity-summary-val {
    font-size: 0.95rem;
  }

  .clan-activity-summary-lbl {
    font-size: 0.62rem;
  }
}
