/* ============================================================================
   LIVE STUDY LEADERBOARD STYLES (Supabase Real-Time Rankings)
   ============================================================================ */

/* Top Navigation Leaderboard Trigger Button */
.nav-leaderboard-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.15) 0%, rgba(245, 158, 11, 0.08) 100%);
  border: 1px solid rgba(234, 179, 8, 0.35);
  border-radius: var(--radius-pill);
  padding: 6px 13px;
  color: #eab308;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 10px rgba(234, 179, 8, 0.08);
}

.nav-leaderboard-btn:hover {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.25) 0%, rgba(245, 158, 11, 0.16) 100%);
  border-color: rgba(234, 179, 8, 0.6);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(234, 179, 8, 0.2);
}

.leaderboard-icon {
  font-size: 0.95rem;
  line-height: 1;
}

/* Modal Card Customizations for Leaderboard - High-End Single-Scroll Flex Architecture */
#leaderboardModalOverlay {
  overflow: hidden !important;
}

.modal-card-leaderboard {
  max-width: 580px;
  width: min(94vw, 580px);
  height: min(88vh, 88dvh);
  max-height: 760px;
  min-height: 520px;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  padding: 0 !important;
  border-radius: 22px;
  background: #0b0f19;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 64px -8px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.05);
  position: relative;
  scrollbar-width: none;
}

.modal-card-leaderboard .modal-close-btn {
  z-index: 25 !important;
  top: 16px;
  right: 16px;
}

@media (max-width: 480px) {
  .modal-card-leaderboard {
    width: 96vw;
    height: min(94vh, 94dvh);
    max-height: none;
    min-height: 480px;
    border-radius: 18px;
  }
}

.leaderboard-modal-header {
  flex-shrink: 0;
  padding: 18px 22px 14px;
  background: rgba(11, 15, 25, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 10;
  margin-bottom: 0;
}

@media (max-width: 480px) {
  .leaderboard-modal-header {
    padding: 14px 16px 12px;
  }
}

/* Single Unified Smooth Scroll Container */
.leaderboard-scroll-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 18px 20px 20px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}

@media (max-width: 480px) {
  .leaderboard-scroll-body {
    padding: 14px 14px 16px;
  }
}

.leaderboard-scroll-body::-webkit-scrollbar {
  width: 6px;
}

.leaderboard-scroll-body::-webkit-scrollbar-track {
  background: transparent;
}

.leaderboard-scroll-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
}

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

/* Pinned Footer Area */
.leaderboard-modal-footer {
  flex-shrink: 0;
  padding: 12px 20px 16px;
  background: rgba(11, 15, 25, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 10;
}

@media (max-width: 480px) {
  .leaderboard-modal-footer {
    padding: 10px 14px 12px;
  }
}

.leaderboard-modal-footer .leaderboard-guest-cta-card,
.leaderboard-modal-footer .leaderboard-user-bar {
  margin: 0;
  width: 100%;
}

.leaderboard-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-right: 36px;
  margin-bottom: 12px;
}

.leaderboard-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.leaderboard-title-text-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.leaderboard-title {
  font-size: 1.28rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leaderboard-subtitle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.live-active-counter {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid rgba(16, 185, 129, 0.22);
  line-height: 1;
}

.live-pulse-dot {
  width: 5px;
  height: 5px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 5px #10b981;
  animation: livePulseAnim 1.8s infinite ease-in-out;
  flex-shrink: 0;
}

@keyframes livePulseAnim {

  0%,
  100% {
    transform: scale(0.9);
    opacity: 0.7;
    box-shadow: 0 0 3px #10b981;
  }

  50% {
    transform: scale(1.3);
    opacity: 1;
    box-shadow: 0 0 8px #10b981;
  }
}

.reset-countdown {
  color: var(--text-muted);
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  white-space: nowrap;
}

.leaderboard-actions-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Timeframe Segmented Switcher (Daily / Weekly / Monthly) */
.leaderboard-timeframe-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  padding: 4px;
  border-radius: var(--radius-pill);
  margin-top: 4px;
}

.lb-timeframe-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  touch-action: manipulation;
}

.lb-timeframe-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.lb-timeframe-tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-medium);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.lb-tab-icon {
  font-size: 0.85rem;
  line-height: 1;
}

.lb-tab-label {
  font-size: 0.8rem;
  font-weight: 600;
}

.btn-icon-subtle {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  touch-action: manipulation;
}

.btn-icon-subtle:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.btn-icon-subtle svg {
  width: 16px;
  height: 16px;
}

.btn-icon-subtle.spinning svg {
  animation: spinRefresh 0.7s linear infinite;
}

@keyframes spinRefresh {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* --- PODIUM TOP 3 CARDS --- */
.leaderboard-podium-container {
  display: grid;
  grid-template-columns: 1fr 1.25fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
  align-items: flex-end;
}

.podium-skeleton {
  display: grid;
  grid-template-columns: 1fr 1.25fr 1fr;
  gap: 12px;
  width: 100%;
  align-items: flex-end;
}

.podium-slot {
  background: rgba(18, 24, 40, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  animation: pulseSkeleton 1.5s infinite ease-in-out;
}

.podium-slot.rank-1 {
  height: 224px;
}

.podium-slot.rank-2 {
  height: 180px;
}

.podium-slot.rank-3 {
  height: 162px;
}

.podium-card {
  background: rgba(18, 24, 40, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
  justify-content: flex-start;
}

.podium-card:hover {
  transform: translateY(-3px);
}

/* 1st Place - Champion Pedestal */
.podium-card.rank-1 {
  min-height: 224px;
  padding: 26px 10px 14px;
  background: linear-gradient(180deg, rgba(234, 179, 8, 0.22) 0%, rgba(234, 179, 8, 0.06) 40%, rgba(18, 24, 40, 0.95) 100%);
  border: 1.5px solid rgba(234, 179, 8, 0.65);
  box-shadow: 0 10px 32px rgba(234, 179, 8, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transform: translateY(-4px);
  z-index: 2;
}

.podium-card.rank-1:hover {
  transform: translateY(-7px);
  box-shadow: 0 14px 40px rgba(234, 179, 8, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

/* 2nd Place - Silver Pedestal */
.podium-card.rank-2 {
  min-height: 180px;
  padding: 18px 8px 12px;
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.18) 0%, rgba(148, 163, 184, 0.04) 40%, rgba(18, 24, 40, 0.95) 100%);
  border: 1px solid rgba(148, 163, 184, 0.45);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  z-index: 1;
}

/* 3rd Place - Bronze Pedestal */
.podium-card.rank-3 {
  min-height: 162px;
  padding: 16px 8px 12px;
  background: linear-gradient(180deg, rgba(217, 119, 6, 0.18) 0%, rgba(217, 119, 6, 0.04) 40%, rgba(18, 24, 40, 0.95) 100%);
  border: 1px solid rgba(217, 119, 6, 0.45);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  z-index: 1;
}

@keyframes floatCrown {

  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  50% {
    transform: translateY(-3px) scale(1.08);
  }
}

.podium-crown-badge {
  position: absolute;
  top: -14px;
  font-size: 1.4rem;
  filter: drop-shadow(0 2px 6px rgba(234, 179, 8, 0.6));
  animation: floatCrown 3s ease-in-out infinite;
}

.podium-avatar-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  margin-bottom: 6px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.podium-card.rank-1 .podium-avatar-wrap {
  width: 58px;
  height: 58px;
  margin-bottom: 8px;
}

.podium-card.rank-3 .podium-avatar-wrap {
  width: 40px;
  height: 40px;
}

.podium-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  aspect-ratio: 1 / 1;
  border: 2px solid var(--border-subtle);
  background: var(--bg-subtle);
  display: block;
  /* Fix H1: GPU compositing layer prevents repaint flash on leaderboard re-render */
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.row-avatar-img,
.user-bar-avatar {
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.avatar-sticker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-style: normal;
  line-height: 1;
  user-select: none;
  border-radius: 50%;
  background: var(--bg-subtle);
  width: 100%;
  height: 100%;
  font-size: 1.45rem;
}

.podium-card.rank-1 .avatar-sticker {
  font-size: 1.85rem;
}

.podium-card.rank-3 .avatar-sticker {
  font-size: 1.3rem;
}

.podium-card.rank-1 .podium-avatar-img {
  border-color: #eab308;
  box-shadow: 0 0 14px rgba(234, 179, 8, 0.4);
}

.podium-card.rank-2 .podium-avatar-img {
  border-color: #94a3b8;
  box-shadow: 0 0 8px rgba(148, 163, 184, 0.25);
}

.podium-card.rank-3 .podium-avatar-img {
  border-color: #cd7f32;
  box-shadow: 0 0 8px rgba(205, 127, 50, 0.25);
}

.podium-rank-pill {
  position: absolute;
  bottom: -3px;
  right: -3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 800;
  color: #fff;
  border: 1.5px solid var(--bg-card);
  z-index: 3;
}

.podium-card.rank-1 .podium-rank-pill {
  width: 20px;
  height: 20px;
  background: #eab308;
  color: #000;
  font-size: 0.72rem;
}

.podium-card.rank-2 .podium-rank-pill {
  background: #64748b;
}

.podium-card.rank-3 .podium-rank-pill {
  background: #b45309;
}

/* Podium Name & Flag Block */
.podium-name-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 34px;
  margin-bottom: 3px;
}

.podium-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}

.podium-card.rank-1 .podium-name {
  font-size: 0.88rem;
  font-weight: 800;
}

.lb-flag-bottom {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  line-height: 1;
  margin-top: 2px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}

.podium-card.rank-1 .lb-flag-bottom {
  font-size: 1.05rem;
}

.podium-time {
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--accent-blue);
  font-family: var(--font-mono, monospace);
  margin-bottom: 4px;
}

.podium-card.rank-1 .podium-time {
  color: #eab308;
  font-size: 0.95rem;
  font-weight: 900;
}

/* Status Chips */
.live-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: auto;
}

.live-status-chip.studying {
  background: rgba(16, 185, 129, 0.14);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.live-status-chip.studying .status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
  flex-shrink: 0;
  animation: livePulseAnim 1.8s infinite ease-in-out;
}

.live-status-chip.resting {
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.live-status-chip.resting .status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

/* Ranked List Row User Info Column */
.row-user-info-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-width: 0;
  gap: 1px;
}

.row-user-info-col .lb-flag-bottom {
  font-size: 0.85rem;
  margin-top: 0;
}

/* --- LEADERBOARD LIST (RANKS 4 TO 25) --- */
.leaderboard-list-card {
  background: rgba(18, 24, 40, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 8px;
}

.leaderboard-list-header {
  display: grid;
  grid-template-columns: 32px 1fr auto auto;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.55);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.col-rank {
  text-align: center;
}

.col-time {
  text-align: right;
  min-width: 55px;
}

/* Nested scroll trap eliminated — inner container is now auto height and smoothly scrolls with parent */
.leaderboard-list-items {
  max-height: none !important;
  overflow: visible !important;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 32px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background var(--transition-fast);
}

.leaderboard-row:last-child {
  border-bottom: none;
}

.leaderboard-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.leaderboard-row.is-current-user {
  background: rgba(59, 130, 246, 0.12);
  border-left: 3px solid #3b82f6;
}

.row-rank-num {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  font-family: var(--font-mono, monospace);
}

.row-user-col {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.row-avatar-img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.row-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-time {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono, monospace);
  text-align: right;
  white-space: nowrap;
}

/* Empty State */
.leaderboard-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 36px 20px;
  color: var(--text-muted);
}

.leaderboard-empty-state svg {
  width: 40px;
  height: 40px;
  stroke: var(--text-muted);
  margin-bottom: 12px;
  opacity: 0.6;
}

.leaderboard-empty-state p {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 4px;
}

.leaderboard-empty-state span {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* --- STICKY BOTTOM BAR (Personal User Card or Guest CTA) --- */
.leaderboard-guest-cta-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.92), rgba(147, 51, 234, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all var(--transition-normal);
}

.leaderboard-guest-cta-card.hidden,
.leaderboard-user-bar.hidden {
  display: none !important;
}

.lb-guest-cta-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.lb-guest-trophy {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
}

.lb-guest-cta-texts {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.lb-guest-cta-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-guest-cta-desc {
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.88);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-guest-login-btn {
  background: #ffffff !important;
  color: #4f46e5 !important;
  font-size: 0.78rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.04em !important;
  padding: 7px 18px !important;
  border-radius: var(--radius-pill) !important;
  border: none !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18) !important;
  transition: all var(--transition-fast) !important;
}

.lb-guest-login-btn:hover {
  transform: scale(1.05) !important;
  background: #f8fafc !important;
  color: #4338ca !important;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25) !important;
}

.leaderboard-user-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--accent-blue);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.12);
}

.user-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-bar-rank {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--accent-blue);
  font-family: var(--font-mono, monospace);
  min-width: 24px;
}

.user-bar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--accent-blue);
}

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

.user-bar-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.user-bar-status {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.user-bar-time {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--accent-blue);
  font-family: var(--font-mono, monospace);
}

/* ============================================================================
   PROFILE CUSTOMIZATION MODAL STYLES
   ============================================================================ */

.modal-card-profile {
  max-width: 500px;
  width: 100%;
  max-height: min(90vh, 90dvh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  margin: auto;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  background: var(--bg-card);
}

.profile-modal-top-pinned {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 10;
}

.profile-hero-wrap {
  padding: 0 20px 12px 20px;
}

.profile-submenu-nav-wrap {
  padding: 0 20px 12px 20px;
}

.profile-modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 20px 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border-subtle) transparent;
}

/* Moderation Notice Banner */
.moderation-notice-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.22);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.75rem;
  line-height: 1.35;
}

.moderation-notice-banner .notice-shield-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: #10b981;
}

/* Live Profile Card Preview */
.profile-hero-showcase {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-card, #141416) !important;
  border: 1px solid var(--border-medium);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  width: 100%;
}

.hero-showcase-bg {
  display: none !important;
}

.hero-showcase-body {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: transparent;
  position: relative;
  z-index: 2;
}

.hero-avatar-col {
  flex-shrink: 0;
  margin-top: 0;
  position: relative;
  z-index: 3;
}

.hero-avatar-circle-wrap {
  position: relative;
  cursor: pointer;
  display: inline-flex;
}

.hero-avatar-circle,
.hero-avatar-ring {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  padding: 2px;
  background: var(--bg-subtle, #1e1e24);
  border: 1.5px solid var(--border-medium, rgba(255, 255, 255, 0.15));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: none !important;
  transition: border-color 0.2s ease;
}

.hero-avatar-icon {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  line-height: 1;
  user-select: none;
  overflow: hidden;
}

.hero-avatar-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.hero-flag-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  font-size: 1rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
  z-index: 5;
}

.hero-avatar-edit-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-blue, #3b82f6);
  color: #fff;
  border: 2px solid #141416;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  z-index: 6;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s;
  padding: 0;
}

.hero-avatar-edit-badge svg {
  width: 10px;
  height: 10px;
}

.hero-avatar-circle-wrap:hover .hero-avatar-edit-badge {
  background: #2563eb;
  transform: scale(1.1);
}

.hero-avatar-circle-wrap:hover .hero-avatar-icon {
  transform: scale(1.05);
}

.hero-details-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
  padding-top: 2px;
}

.hero-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.hero-name {
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
  line-height: 1.2;
}

.hero-role-pill {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #8b5cf6;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  line-height: 1.2;
  flex-shrink: 0;
}

.hero-tags-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.hero-mood-pill {
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #f59e0b;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-exam-pill {
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: #06b6d4;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-motto {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

/* Customization Submenu Navigation Tabs */
.profile-submenu-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 4px;
  background: var(--bg-subtle, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 0;
}

.profile-tab-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.80rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.profile-tab-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: 0.8;
}

.profile-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.profile-tab-btn.active {
  background: var(--bg-card);
  color: var(--accent-blue, #3b82f6);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-medium);
}

.profile-tab-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: tabFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

@keyframes tabFadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Avatar Submode Segmented Toggle (Photo vs Stickers) */
.avatar-submode-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--bg-subtle, rgba(255, 255, 255, 0.04));
  padding: 4px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  margin-bottom: 4px;
}

.avatar-submode-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.avatar-submode-btn svg {
  width: 14px;
  height: 14px;
  opacity: 0.8;
}

.avatar-submode-btn:hover {
  color: var(--text-primary);
}

.avatar-submode-btn.active {
  background: var(--accent-blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}

/* Photo Upload Box & Actions */
.photo-upload-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
}

.photo-upload-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.photo-upload-preview-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}

.photo-upload-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px dashed var(--border-medium);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  font-size: 1.8rem;
  color: var(--text-muted);
  transition: border-color 0.2s ease;
}

.photo-upload-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.photo-upload-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.photo-btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.photo-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.photo-upload-btn svg {
  width: 14px;
  height: 14px;
}

.photo-upload-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.photo-url-row {
  display: flex;
  align-items: center;
}

.photo-url-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.photo-url-input-wrap input {
  flex: 1;
  font-size: 0.8rem;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.photo-url-input-wrap input:focus {
  border-color: var(--accent-blue);
  outline: none;
}

.avatar-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #6366f1 0%, #3b82f6 100%);
  user-select: none;
  text-transform: uppercase;
}

.profile-info-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-md);
  margin-top: 4px;
}

.profile-info-banner .info-icon {
  font-size: 1.05rem;
  line-height: 1.2;
  flex-shrink: 0;
}

.profile-info-banner .info-text {
  font-size: 0.76rem;
  color: var(--text-secondary);
  line-height: 1.4;
}