/* ===== EXTRACTED NON-CRITICAL MODALS & ANALYSIS ===== */
/* ========================================
   DEEP ANALYSIS TOOLS
   ======================================== */
.advanced-analysis-toggle {
  margin: 24px 0 12px;
  display: flex;
  justify-content: center;
}

.toggle-analysis-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 10px 20px;
  border-radius: 30px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-analysis-btn:hover {
  background: var(--input-bg);
  border-color: var(--accent-color);
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-dark);
}

.toggle-analysis-btn .toggle-icon {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}

.advanced-analysis-content {
  overflow: hidden;
  transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, padding 0.3s ease;
  background: rgba(15, 23, 42, 0.3);
  border-radius: 16px;
  border: 1px solid transparent;
}

.advanced-analysis-content.collapsed {
  max-height: 0;
  opacity: 0;
  padding: 0 16px;
  pointer-events: none;
}

.advanced-analysis-content.expanded {
  max-height: 2000px;
  opacity: 1;
  padding: 24px 16px;
  /* Increased padding for elegance */
  border-color: var(--border-color);
  margin-top: 12px;
  pointer-events: all;
}

.advanced-analysis-toggle .toggle-analysis-btn.active .toggle-icon {
  transform: rotate(180deg);
}

.analysis-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.analysis-section-header h4 {
  margin: 0;
  font-size: 16px;
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.heatmap-legend {
  display: flex;
  gap: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-tertiary);
}

.color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.color-dot.red {
  background: #ef4444;
}

.color-dot.yellow {
  background: #f59e0b;
}

.color-dot.green {
  background: #10b981;
}

.heatmap-keyboard-container {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 24px;
  /* Generous padding for premium feel */
  border: 1px solid var(--border-color);
  overflow-x: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 30px;
  padding-top: 40px;
  /* Crucial fix for tooltip clipping */
}

.kb-row {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.kb-key {
  width: 44px;
  /* Restored to comfortable size */
  height: 44px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--border-color);
  /* Premium key look */
}

.kb-key:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 var(--border-color), 0 8px 24px var(--shadow-dark);
  border-color: var(--accent-color);
  z-index: 10;
}

.kb-key.wide {
  min-width: 65px;
  flex-grow: 1;
}

.kb-key.space {
  width: 320px;
  height: 40px;
}

/* Premium Tooltip */
.kb-key::after {
  content: attr(data-acc);
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%) translateY(5px);
  background: var(--text-primary);
  color: var(--bg-primary);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  white-space: nowrap;
  box-shadow: 0 4px 12px var(--shadow-dark);
  z-index: 20;
}

.kb-key:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.section-desc {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.latency-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  /* 9 columns for desktop (straight line) */
  gap: 6px;
  margin-top: 12px;
}

/* Premium Premium Latency Cards with Severity Coloring */
.latency-card {
  background: var(--bg-tertiary);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 48px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.latency-card:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  z-index: 2;
}

/* Severity Markers and Glows */
.latency-card.low {
  border-bottom: 2px solid #10b981;
}

.latency-card.mid {
  border-bottom: 2px solid #f59e0b;
}

.latency-card.high {
  border-bottom: 2px solid #ef4444;
}

.latency-card.low:hover {
  background: rgba(16, 185, 129, 0.15);
  border-color: #10b981;
}

.latency-card.mid:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: #f59e0b;
}

.latency-card.high:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
}

.latency-key {
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-secondary);
  opacity: 0.9;
  letter-spacing: 0.5px;
}

.latency-value-container {
  display: flex;
  align-items: baseline;
  gap: 1px;
}

.latency-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.latency-unit {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: lowercase;
}

.latency-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 10px;
  color: var(--text-tertiary);
  font-style: italic;
  font-size: 13px;
}

@media (max-width: 768px) {
  .heatmap-keyboard-container {
    padding: 20px 8px;
    padding-top: 36px;
  }

  .kb-key {
    width: 36px;
    height: 36px;
    font-size: 11px;
  }

  .kb-row {
    gap: 4px;
  }

  .latency-grid {
    grid-template-columns: repeat(3, 1fr);
    /* 3x3 Grid on mobile */
  }
}

@media (max-width: 480px) {
  .kb-key {
    width: 28px;
    height: 28px;
    font-size: 10px;
    box-shadow: 0 2px 0 var(--border-color);
  }

  .kb-key.space {
    width: 180px;
  }

  .latency-grid {
    grid-template-columns: repeat(3, 1fr);
    /* 3x3 Grid on mobile */
    gap: 6px;
  }

  .latency-card {
    padding: 6px 4px;
    min-height: 40px;
  }

  .latency-key,
  .latency-value {
    font-size: 13px;
  }
}


/* ========================================
   PROFILE MODAL - PREMIUM DESIGN
   ======================================== */

/* Profile Modal Overlay */
#profileModal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 2000;
  justify-content: center;
  align-items: center;
  padding: 20px;
  overflow-y: auto;
}

#profileModal.show {
  display: flex;
  animation: fadeIn 0.3s ease;
}

/* Profile Card */
.profile-card {
  background: var(--bg-secondary);
  border-radius: 20px;
  padding: 24px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Profile Header */
.profile-header {
  text-align: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.profile-avatar-large {
  width: 90px;
  height: 90px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bg-tertiary), var(--border-color));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  border: 3px solid var(--bg-primary);
}

.profile-avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--bg-tertiary);
}

.profile-avatar-large #profileInitials {
  font-size: 36px;
  font-weight: 700;
  color: white;
  text-transform: uppercase;
}

#profileName {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.profile-since {
  font-size: 12px;
  color: var(--text-tertiary);
  margin: 0;
}

/* Stats Grid */
.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.profile-stat {
  background: var(--bg-tertiary);
  border-radius: 12px;
  padding: 12px 6px;
  text-align: center;
  border: 1px solid var(--border-color);
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.profile-stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--shadow);
}


.profile-stat .stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.profile-stat .stat-label {
  font-size: 10px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Profile Sections */
.profile-section {
  margin-bottom: 20px;
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title svg {
  width: 18px;
  height: 18px;
  color: var(--accent-color);
}

/* Personal Bests - Premium Style */
.personal-bests {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.best-item {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
  border-radius: 16px;
  padding: 16px;
  text-align: center;
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.best-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent-color);
  opacity: 0.5;
}

.best-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  border-color: var(--accent-color);
}

.best-label {
  display: block;
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  font-weight: 600;
}

.best-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
}

/* Improvement Cards - Premium Style */
.improvement-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.improvement-card {
  background: var(--bg-tertiary);
  border-radius: 20px;
  padding: 24px 20px;
  text-align: center;
  border: 1px solid var(--border-color);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.improvement-card:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 15px 35px var(--shadow-dark);
}

.improvement-card.positive {
  border-color: rgba(16, 185, 129, 0.4);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, var(--bg-tertiary) 100%);
}

.improvement-card.positive:hover {
  box-shadow: 0 15px 35px rgba(16, 185, 129, 0.25);
  border-color: rgba(16, 185, 129, 0.6);
}

.improvement-card.negative {
  border-color: rgba(239, 68, 68, 0.4);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, var(--bg-tertiary) 100%);
}

.improvement-card.negative:hover {
  box-shadow: 0 15px 35px rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.6);
}

.improvement-bg-icon {
  position: absolute;
  right: -10px;
  bottom: -10px;
  width: 100px;
  height: 100px;
  opacity: 0.1;
  transform: rotate(-15deg);
  pointer-events: none;
  transition: all 0.5s ease;
}

.improvement-card:hover .improvement-bg-icon {
  transform: rotate(0deg) scale(1.2);
  opacity: 0.2;
}

.improvement-bg-icon svg {
  width: 100%;
  height: 100%;
  color: var(--accent-color);
}

.positive .improvement-bg-icon svg {
  color: #10b981;
}

.negative .improvement-bg-icon svg {
  color: #ef4444;
}

.improvement-info {
  position: relative;
  z-index: 1;
}


.improvement-value {
  font-size: 32px;
  font-weight: 800;
  display: inline-block;
  vertical-align: middle;
  letter-spacing: -1px;
}

.improvement-label {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
  display: block;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.positive .improvement-arrow,
.positive .improvement-value {
  color: #10b981;
  text-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
}

.negative .improvement-arrow,
.negative .improvement-value {
  color: #ef4444;
  text-shadow: 0 2px 10px rgba(239, 68, 68, 0.3);
}

/* Badges Grid - SHINING EFFECT */
.badges-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.badge-item {
  position: relative;
  background: var(--bg-tertiary);
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
  border: 1px solid var(--border-color);
  overflow: hidden;
  transition: all 0.3s;
}

.badge-item.locked {
  opacity: 0.5;
  filter: grayscale(1);
}

.badge-item.earned {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.15), var(--bg-tertiary));
  border-color: var(--accent-color);
}

/* Shining Animation for Earned Badges */
.badge-item.earned::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg,
      transparent 30%,
      rgba(255, 255, 255, 0.15) 50%,
      transparent 70%);
  animation: badgeShine 3s ease-in-out infinite;
  pointer-events: none;
}

@keyframes badgeShine {
  0% {
    transform: translateX(-100%) rotate(45deg);
  }

  50%,
  100% {
    transform: translateX(100%) rotate(45deg);
  }
}

.badge-icon {
  width: 36px;
  height: 36px;
  margin: 0 auto 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-color), var(--accent-secondary));
  box-shadow: 0 4px 12px rgba(96, 165, 250, 0.3);
}

.badge-icon svg {
  width: 20px;
  height: 20px;
  color: white;
  stroke: white;
  fill: none;
}

.badge-item.locked .badge-icon {
  background: var(--bg-secondary);
  box-shadow: none;
}

.badge-item.locked .badge-icon svg {
  color: var(--text-tertiary);
  stroke: var(--text-tertiary);
}

.badge-name {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px var(--shadow);
}

/* Badge Tooltip */
.badge-item[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-5px);
  background: var(--text-primary);
  color: var(--bg-primary);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 10px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s;
  z-index: 100;
}

.badge-item:hover[data-tooltip]::after {
  opacity: 1;
  transform: translateX(-50%) translateY(-10px);
}

/* Challenge Card */
.challenge-card {
  background: var(--bg-tertiary);
  border-radius: 12px;
  padding: 16px;
  border: 1px solid var(--border-color);
}

.challenge-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.challenge-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.challenge-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-color), var(--success-color));
  border-radius: 4px;
  transition: width 0.5s ease;
}

.challenge-status {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* Profile Settings */
.profile-settings {
  background: var(--bg-tertiary);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.setting-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.setting-label svg {
  width: 18px;
  height: 18px;
  color: var(--text-tertiary);
}

/* Profile Action Buttons */
.profile-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--border-color);
  margin-top: 16px;
}

.profile-btn svg {
  width: 18px;
  height: 18px;
}

.cert-btn {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  border-color: #d97706;
}

.cert-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

#shareProfileBtn:hover {
  color: var(--accent-color);
  background: rgba(59, 130, 246, 0.1);
  transform: scale(1.1);
}

.share-btn {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.share-btn:hover {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
  transform: translateY(-2px);
}

/* Recent Tests List */
.recent-tests-list {
  background: var(--bg-tertiary);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  max-height: 180px;
  overflow-y: auto;
}

.no-tests {
  padding: 20px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
}

.recent-test-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.2s;
}

.recent-test-item:last-child {
  border-bottom: none;
}

.recent-test-item:hover {
  background: var(--bg-secondary);
}

.test-info {
  flex: 1;
}

.test-date {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: 2px;
}

.test-duration {
  font-size: 12px;
  color: var(--text-secondary);
}

.test-stats {
  display: flex;
  gap: 12px;
  text-align: right;
}

.test-wpm,
.test-acc {
  font-size: 13px;
  font-weight: 600;
}

.test-wpm {
  color: var(--accent-color);
}

.test-acc {
  color: var(--success-color);
}

/* Make profile icon clickable */
#userProfileIcon {
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  border: none !important;
  background: linear-gradient(135deg, #e2e8f0 0%, #f8fafc 100%);
  box-shadow:
    0 0 0 2px var(--bg-secondary),
    0 4px 12px rgba(0, 0, 0, 0.1);
}

#userProfileIcon:hover {
  transform: scale(1.1);
  box-shadow:
    0 0 0 2px var(--bg-secondary),
    0 6px 16px rgba(0, 0, 0, 0.15);
}

#userInitials {
  color: #0f172a;
  font-weight: 800;
}

.dark-theme #userProfileIcon {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

.dark-theme #userInitials {
  color: #e2e8f0;
}

/* Special Badge Colors */
.badge-speed .badge-icon {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
}

.badge-accuracy .badge-icon {
  background: linear-gradient(135deg, #10b981, #34d399);
}

.badge-marathon .badge-icon {
  background: linear-gradient(135deg, #8b5cf6, #a78bfa);
}

.badge-perfect .badge-icon {
  background: linear-gradient(135deg, #ec4899, #f472b6);
}

.badge-streak .badge-icon {
  background: linear-gradient(135deg, #ef4444, #f87171);
}

.badge-consistent .badge-icon {
  background: linear-gradient(135deg, #3b82f6, #60a5fa);
}

.badge-early .badge-icon {
  background: linear-gradient(135deg, #f97316, #fb923c);
}

.badge-night .badge-icon {
  background: linear-gradient(135deg, #6366f1, #818cf8);
}

/* ===== DAILY TASKS STYLING ===== */
.daily-reset-timer {
  margin-left: auto;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  background: var(--bg-tertiary);
  padding: 4px 10px;
  border-radius: 12px;
}

.daily-tasks-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.daily-task {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-tertiary);
  border-radius: 10px;
  border: 1px solid var(--border-color);
  transition: all 0.2s;
}

.daily-task.completed {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
  border-color: rgba(16, 185, 129, 0.3);
}

.daily-task .task-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.daily-task.completed .task-icon {
  background: #10b981;
  border-color: #10b981;
  color: white;
}

.daily-task .task-info {
  flex: 1;
}

.daily-task .task-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
}

.daily-task .task-desc {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.daily-task .task-count {
  font-size: 11px;
  color: var(--accent-color);
  font-weight: 600;
  margin-top: 4px;
}

.daily-task .task-progress-bar {
  width: 60px;
  height: 6px;
  background:
    radial-gradient(circle at 12% -8%, color-mix(in srgb, var(--accent-color) 12%, transparent) 0%, transparent 45%),
    radial-gradient(circle at 88% 110%, color-mix(in srgb, var(--accent-secondary, #3b82f6) 10%, transparent) 0%, transparent 42%),
    var(--bg-primary);
  background-attachment: fixed;
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}

.daily-task .task-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-color), var(--accent-secondary));
  border-radius: 3px;
  transition: width 0.3s ease;
}

.daily-task.completed .task-progress-fill {
  background: #10b981;
}

/* ===== BADGE TOOLTIP (Hover Info) ===== */
.badge-item {
  position: relative;
  cursor: pointer;
}

.badge-item .badge-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background:
    radial-gradient(circle at 12% -8%, color-mix(in srgb, var(--accent-color) 12%, transparent) 0%, transparent 45%),
    radial-gradient(circle at 88% 110%, color-mix(in srgb, var(--accent-secondary, #3b82f6) 10%, transparent) 0%, transparent 42%),
    var(--bg-primary);
  background-attachment: fixed;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 12px;
  min-width: 180px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 100;
  pointer-events: none;
}

.badge-item:hover .badge-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-4px);
}

.badge-tooltip .tooltip-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.badge-tooltip .tooltip-desc {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.badge-tooltip .tooltip-criteria {
  font-size: 10px;
  color: var(--accent-color);
  font-weight: 600;
  padding: 4px 8px;
  background: rgba(96, 165, 250, 0.1);
  border-radius: 4px;
  display: inline-block;
}

.badge-tooltip .tooltip-progress {
  margin-top: 8px;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}

.badge-tooltip .tooltip-progress-fill {
  height: 100%;
  background: var(--accent-color);
  border-radius: 2px;
}

.badge-tooltip .tooltip-season {
  margin-top: 6px;
  font-size: 10px;
  color: var(--text-tertiary);
  font-style: italic;
}

/* Badge Category Colors */
.badge-item[data-category="streak"] .badge-icon {
  background: linear-gradient(135deg, #3b82f6, #60a5fa);
}

.badge-item[data-category="accuracy"] .badge-icon {
  background: linear-gradient(135deg, #10b981, #34d399);
}

.badge-item[data-category="speed"] .badge-icon {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
}

.badge-item[data-category="endurance"] .badge-icon {
  background: linear-gradient(135deg, #8b5cf6, #a78bfa);
}

.badge-item[data-category="time"] .badge-icon {
  background: linear-gradient(135deg, #ec4899, #f472b6);
}

.badge-item[data-category="milestone"] .badge-icon {
  background: linear-gradient(135deg, #06b6d4, #22d3ee);
}

.badge-item[data-category="recovery"] .badge-icon {
  background: linear-gradient(135deg, #ef4444, #f87171);
}

.badge-item[data-category="leaderboard"] .badge-icon {
  background: linear-gradient(135deg, #f97316, #fb923c);
}

.badge-item[data-category="special"] .badge-icon {
  background: linear-gradient(135deg, #6366f1, #818cf8);
}

.badge-item.locked .badge-icon {
  background: #2c3e50 !important;
  /* Fallback for locked badges without data-rarity if any */
}

/* ===== BADGE RARITY COLORS ===== */
/* Rarity overrides category colors for earned badges */
/* Rarity backgrounds apply to all, but desaturated if locked */
.badge-item[data-rarity="1"] .badge-icon {
  background: linear-gradient(135deg, #95A5A6, #BDC3C7);
  box-shadow: 0 4px 12px rgba(149, 165, 166, 0.3);
}

.badge-item[data-rarity="1"] {
  border-color: rgba(149, 165, 166, 0.5);
}

.badge-item[data-rarity="2"] .badge-icon {
  background: linear-gradient(135deg, #2980B9, #3498DB);
  box-shadow: 0 4px 14px rgba(52, 152, 219, 0.4);
}

.badge-item[data-rarity="2"] {
  border-color: rgba(52, 152, 219, 0.5);
  background: linear-gradient(135deg, rgba(52, 152, 219, 0.1), var(--bg-tertiary));
}

.badge-item[data-rarity="3"] .badge-icon {
  background: linear-gradient(135deg, #8E44AD, #9B59B6);
  box-shadow: 0 4px 14px rgba(155, 89, 182, 0.4);
}

.badge-item[data-rarity="3"] {
  border-color: rgba(155, 89, 182, 0.5);
  background: linear-gradient(135deg, rgba(155, 89, 182, 0.1), var(--bg-tertiary));
}

.badge-item[data-rarity="4"] .badge-icon {
  background: linear-gradient(135deg, #E67E22, #F39C12);
  box-shadow: 0 4px 16px rgba(243, 156, 18, 0.5);
}

.badge-item[data-rarity="4"] {
  border-color: rgba(243, 156, 18, 0.5);
  background: linear-gradient(135deg, rgba(243, 156, 18, 0.12), var(--bg-tertiary));
}

.badge-item[data-rarity="5"] .badge-icon {
  background: linear-gradient(135deg, #E74C3C, #C0392B);
  box-shadow: 0 4px 15px rgba(231, 76, 60, 0.6);
  border: 2px solid #E74C3C;
}

.badge-item.earned[data-rarity="5"] .badge-icon {
  animation: mythicGlow 3s infinite alternate;
}

/* Rarity-based Icon Colors - Dark Theme Only for Neon Effect */
.dark-theme .badge-item[data-rarity="1"] .badge-icon svg {
  color: #f0f4f8;
}

.dark-theme .badge-item[data-rarity="2"] .badge-icon svg {
  color: #e3f2fd;
}

.dark-theme .badge-item[data-rarity="3"] .badge-icon svg {
  color: #f3e5f5;
}

.dark-theme .badge-item[data-rarity="4"] .badge-icon svg {
  color: #fffde7;
  filter: drop-shadow(0 0 2px rgba(255, 179, 0, 0.5));
}

.dark-theme .badge-item[data-rarity="5"] .badge-icon svg {
  color: #ffebee;
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.8));
}

.badge-item.earned[data-rarity="5"] .badge-icon svg {
  animation: mythic-pulsate 2s infinite ease-in-out;
}

@keyframes mythic-pulsate {

  0%,
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.8));
  }

  50% {
    transform: scale(1.1);
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 1));
  }
}

.badge-item[data-rarity="5"] {
  border-color: rgba(231, 76, 60, 0.6);
  background: linear-gradient(135deg, rgba(231, 76, 60, 0.15), var(--bg-tertiary));
}

/* Locked Badge State - Desaturate but keep rarity hint */
.badge-item:not(.earned) {
  filter: grayscale(0.85) opacity(0.5);
  cursor: help;
}

.badge-item:not(.earned) .badge-icon svg {
  color: #fff !important;
  filter: none !important;
  animation: none !important;
}

.badge-item:not(.earned):hover {
  filter: grayscale(0.4) opacity(0.8);
  transform: translateY(-2px);
}

@keyframes mythicPulse {

  0%,
  100% {
    box-shadow: 0 4px 20px rgba(231, 76, 60, 0.4);
  }

  50% {
    box-shadow: 0 4px 30px rgba(231, 76, 60, 0.8), 0 0 15px rgba(231, 76, 60, 0.3);
  }
}

/* ===== ACHIEVEMENTS BUTTON - PREMIUM UPGRADE ===== */
.achievements-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
  border: 1px solid var(--border-color);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Shining Effect */
.achievements-btn::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -60%;
  width: 20%;
  height: 200%;
  background: linear-gradient(to right,
      rgba(255, 255, 255, 0) 0%,
      rgba(255, 255, 255, 0.15) 50%,
      rgba(255, 255, 255, 0) 100%);
  transform: rotate(25deg);
  transition: all 0.7s ease;
}

.achievements-btn:hover::after {
  left: 120%;
}

.achievements-btn:hover {
  border-color: var(--accent-color);
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 12px 30px var(--shadow-dark);
}

.achievements-btn-icon {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent-color), var(--accent-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.4s ease;
  box-shadow: 0 4px 12px var(--shadow);
}

.achievements-btn:hover .achievements-btn-icon {
  transform: rotate(10deg) scale(1.1);
  box-shadow: 0 6px 16px rgba(96, 165, 250, 0.4);
}

.secondary-btn-sm {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.secondary-btn-sm:hover {
  background:
    radial-gradient(circle at 12% -8%, color-mix(in srgb, var(--accent-color) 12%, transparent) 0%, transparent 45%),
    radial-gradient(circle at 88% 110%, color-mix(in srgb, var(--accent-secondary, #3b82f6) 10%, transparent) 0%, transparent 42%),
    var(--bg-primary);
  background-attachment: fixed;
  border-color: var(--accent-color);
  transform: translateY(-1px);
}

/* Problematic Words Analysis */
.problematic-words-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.problematic-word-item {
  background: var(--bg-tertiary);
  border-radius: 10px;
  padding: 12px;
  border-left: 4px solid var(--border-color);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.problematic-word-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow);
}

.problematic-word-item.typo {
  border-left-color: var(--error-color);
  background: rgba(239, 68, 68, 0.05);
}

.problematic-word-item.corrected {
  border-left-color: #10B981;
  background: rgba(16, 185, 129, 0.05);
}

.problematic-word-item.slow {
  border-left-color: #fbbf24;
  background: rgba(251, 191, 36, 0.05);
}

.problematic-word-item .word-text {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
  margin-bottom: 4px;
  word-break: break-all;
}

.problematic-word-item .word-type {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.achievements-btn-icon svg {
  width: 28px;
  height: 28px;
  color: white;
  stroke: white;
}

.achievements-btn-info {
  flex: 1;
  text-align: left;
}

.achievements-btn-title {
  display: block;
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.achievements-btn-count {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-top: 2px;
  opacity: 0.8;
}

.achievements-btn-arrow {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  transition: all 0.3s ease;
  border: 1px solid var(--border-color);
}

.achievements-btn:hover .achievements-btn-arrow {
  background: var(--accent-color);
  color: white !important;
  border-color: var(--accent-color);
  transform: translateX(4px);
}

.achievements-btn:hover .achievements-btn-arrow svg {
  color: white !important;
  stroke: white !important;
}

.achievements-btn-arrow svg {
  width: 20px;
  height: 20px;
}

/* ===== DAILY TASKS ===== */
.daily-tasks-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.daily-task {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.daily-task:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
}

.daily-task.completed {
  border-color: var(--accent-color);
  background: rgba(96, 165, 250, 0.05);
}

.task-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.daily-task.completed .task-icon {
  background: var(--accent-color);
  color: white;
}

.task-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.task-info {
  flex: 1;
}

.task-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.task-desc {
  font-size: 11px;
  color: var(--text-tertiary);
}

.task-count {
  font-size: 11px;
  color: var(--accent-color);
  font-weight: 600;
  margin-top: 2px;
}

.task-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: transparent;
}

.task-progress-fill {
  height: 100%;
  background: var(--accent-color);
  width: 0%;
  transition: width 0.5s ease;
}

.achievements-btn-arrow {
  width: 20px;
  height: 20px;
  color: var(--text-tertiary);
  flex-shrink: 0;
  transition: transform 0.2s;
}

.achievements-btn:hover .achievements-btn-arrow {
  transform: translateX(4px);
  color: var(--accent-color);
}

/* ===== ACHIEVEMENTS MODAL ===== */
.achievements-card {
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  background: var(--bg-secondary);
  border-radius: 16px;
  border: 1px solid var(--border-color);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.achievements-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-tertiary);
}

.achievements-header h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  flex: 1;
}

.achievements-header h2 svg {
  width: 24px;
  height: 24px;
  color: var(--accent-color);
}

.achievements-progress {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-color);
  background: rgba(96, 165, 250, 0.1);
  padding: 6px 12px;
  border-radius: 20px;
}

.close-achievements-btn {
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.close-achievements-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-radius: 8px;
}

.achievements-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

/* Badge Categories */
.badge-category {
  margin-bottom: 24px;
}

.badge-category:last-child {
  margin-bottom: 0;
}

.category-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

/* Badges Grid inside modal */
.achievements-content .badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
  gap: 10px;
}

.achievements-content .badge-item {
  padding: 10px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  text-align: center;
  transition: all 0.2s;
  position: relative;
  cursor: pointer;
  opacity: 0.5;
}

.achievements-content .badge-item.earned {
  opacity: 1;
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.1), var(--bg-tertiary));
  border-color: var(--accent-color);
}

.achievements-content .badge-icon {
  width: 32px;
  height: 32px;
  margin: 0 auto 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.achievements-content .badge-icon svg {
  width: 18px;
  height: 18px;
  stroke: white;
}

.achievements-content .badge-name {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.2;
}

/* Badge Tooltip */
/* Global Tooltip (JS positioned) */
.global-tooltip {
  position: fixed;
  /* Fixed to viewport to avoid clipping */
  z-index: 11000;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: 12px;
  width: 200px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  text-align: left;
}

.global-tooltip.visible {
  opacity: 1;
  visibility: visible;
}

.tooltip-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.tooltip-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.tooltip-icon svg {
  width: 22px;
  height: 22px;
  color: white;
}

.tooltip-header-info {
  flex: 1;
}

.tooltip-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0px;
}

.tooltip-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.4;
}

.tooltip-criteria {
  font-size: 11px;
  color: var(--accent-color);
  font-weight: 600;
  background: rgba(96, 165, 250, 0.1);
  padding: 4px 8px;
  border-radius: 6px;
  display: inline-block;
  margin-bottom: 8px;
}

.tooltip-progress {
  width: 100%;
  height: 4px;
  background: var(--bg-secondary);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}

.tooltip-progress-fill {
  height: 100%;
  background: var(--accent-color);
  width: 0%;
}

.tooltip-season {
  font-size: 10px;
  color: var(--text-tertiary);
  margin-top: 6px;
  font-style: italic;
}

/* Mobile Adjustments */
@media (max-width: 480px) {
  .problematic-words-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .problematic-word-item {
    padding: 8px 10px !important;
  }

  .problematic-word-item .word-text {
    font-size: 13px !important;
  }

  .problematic-word-item .word-type {
    font-size: 9px !important;
  }

  #problematicWordsActions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px !important;
  }

  #problematicWordsActions button {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .profile-icon {
    width: 44px;
    height: 44px;
  }
}

/* ===== DAILY CLAIM SECTION ===== */
.daily-claim-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
  border-radius: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--border-color);
}

.daily-claim-streak {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.2);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
}

.streak-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.streak-value {
  font-size: 16px;
  font-weight: 800;
  color: #FF6B6B;
  display: flex;
  align-items: center;
  gap: 4px;
}



@keyframes flamePulse {
  0% {
    transform: scale(1);
    filter: brightness(100%);
  }

  50% {
    transform: scale(1.2);
    filter: brightness(120%);
  }

  100% {
    transform: scale(1);
    filter: brightness(100%);
  }
}

.daily-claim-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
  border: none;
  border-radius: 25px;
  color: #1a1a1a;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

.daily-claim-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 215, 0, 0.5);
}

.daily-claim-btn:disabled {
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
  cursor: not-allowed;
  box-shadow: none;
}

.daily-claim-btn svg {
  width: 16px;
  height: 16px;
}

/* ===== DAILY TASKS LIST ===== */
.daily-tasks-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.daily-task {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.daily-task:hover {
  transform: translateX(4px);
  border-color: var(--accent-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.daily-task.completed {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), var(--bg-tertiary));
  border-color: rgba(16, 185, 129, 0.3);
}

.task-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
  background:
    radial-gradient(circle at 12% -8%, color-mix(in srgb, var(--accent-color) 12%, transparent) 0%, transparent 45%),
    radial-gradient(circle at 88% 110%, color-mix(in srgb, var(--accent-secondary, #3b82f6) 10%, transparent) 0%, transparent 42%),
    var(--bg-primary);
  background-attachment: fixed;
  color: var(--text-tertiary);
  border: 2px solid var(--border-color);
}

.daily-task.completed .task-icon {
  background: #10B981;
  color: white;
  border-color: #10B981;
}

.task-info {
  flex: 1;
}

.task-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.task-desc {
  font-size: 11px;
  color: var(--text-tertiary);
}

.task-count {
  font-size: 10px;
  color: var(--accent-color);
  font-weight: 600;
  margin-top: 2px;
}

.task-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(0, 0, 0, 0.1);
}

.task-progress-fill {
  height: 100%;
  background: var(--accent-color);
  transition: width 0.5s ease;
}

.daily-task.completed .task-progress-fill {
  background: #10B981;
}

/* ===== PUBLIC BADGE INFO MODAL ===== */
#publicBadgeInfoModal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
  z-index: 10500 !important;
  padding: 20px;
}

.badge-info-card {
  background:
    radial-gradient(circle at 12% -8%, color-mix(in srgb, var(--accent-color) 12%, transparent) 0%, transparent 45%),
    radial-gradient(circle at 88% 110%, color-mix(in srgb, var(--accent-secondary, #3b82f6) 10%, transparent) 0%, transparent 42%),
    var(--bg-primary);
  background-attachment: fixed;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 30px;
  max-width: 350px;
  box-shadow: 0 10px 40px var(--shadow-dark);
  position: relative;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.close-badge-info-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 28px;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.close-badge-info-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.badge-info-content {
  text-align: center;
}

.badge-info-icon {
  width: 80px;
  height: 80px;
  margin: 10px auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-tertiary);
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.badge-info-icon svg {
  width: 44px;
  height: 44px;
  stroke-width: 2.5;
}

/* Rarity Backgrounds & Icons for Pop-up */
.badge-info-icon[data-rarity="1"] {
  background: linear-gradient(135deg, #95A5A6, #BDC3C7);
}

.badge-info-icon[data-rarity="2"] {
  background: linear-gradient(135deg, #3498DB, #2980B9);
}

.badge-info-icon[data-rarity="3"] {
  background: linear-gradient(135deg, #9B59B6, #8E44AD);
}

.badge-info-icon[data-rarity="4"] {
  background: linear-gradient(135deg, #F39C12, #E67E22);
}

.badge-info-icon[data-rarity="5"] {
  background: linear-gradient(135deg, #E74C3C, #C0392B);
  animation: mythicGlow 3s infinite alternate;
}

.badge-info-icon[data-rarity="1"] svg {
  color: #f0f4f8;
}

.badge-info-icon[data-rarity="2"] svg {
  color: #e3f2fd;
}

.badge-info-icon[data-rarity="3"] svg {
  color: #f3e5f5;
}

.badge-info-icon[data-rarity="4"] svg {
  color: #fffde7;
  filter: drop-shadow(0 0 2px rgba(255, 179, 0, 0.5));
}

.badge-info-icon[data-rarity="5"] svg {
  color: #ffebee;
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.8));
  animation: mythic-pulsate 2s infinite ease-in-out;
}

@keyframes mythicGlow {
  0% {
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.4), 0 0 20px rgba(231, 76, 60, 0.2);
  }

  100% {
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.8), 0 0 40px rgba(231, 76, 60, 0.4);
  }
}

@keyframes mythic-pulsate {

  0%,
  100% {
    transform: scale(1);
    filter: drop-shadow(0 1px 2px rgba(255, 255, 255, 0.8));
  }

  50% {
    transform: scale(1.1);
    filter: drop-shadow(0 2px 6px rgba(255, 255, 255, 1));
  }
}

.badge-info-card h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 10px 0;
}

.badge-info-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 12px 0;
  line-height: 1.4;
}

.badge-info-stats {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--border-light);
}

.badge-info-criteria {
  margin: 18px 0;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
  border-left: 3px solid var(--accent-color);
}

.criteria-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.criteria-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.criteria-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-color);
  background:
    radial-gradient(circle at 12% -8%, color-mix(in srgb, var(--accent-color) 12%, transparent) 0%, transparent 45%),
    radial-gradient(circle at 88% 110%, color-mix(in srgb, var(--accent-secondary, #3b82f6) 10%, transparent) 0%, transparent 42%),
    var(--bg-primary);
  background-attachment: fixed;
  padding: 4px 10px;
  border-radius: 4px;
  white-space: nowrap;
}

.progress-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.progress-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.progress-bar-small {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4CAF50, #81C784);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-value {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 600;
}

.badge-earned-text {
  font-size: 14px;
  font-weight: 600;
  color: #10B981;
  padding: 10px;
  background: rgba(16, 185, 129, 0.1);
  border-radius: 6px;
}

/* ===== UPDATE NOTIFICATION ===== */
.update-notification {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 4px 12px var(--shadow-dark);
  color: var(--text-primary);
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideInUpdate 0.3s ease-out;
  max-width: 300px;
}

@keyframes slideInUpdate {
  from {
    transform: translateY(100%);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.update-text {
  font-size: 13px;
  font-weight: 500;
}

.compact-username-input.error {
  border-color: var(--error-color);
  animation: shake 0.4s ease-in-out;
  background: rgba(239, 68, 68, 0.05);
}

.update-btn {
  background: var(--button-primary);
  color: var(--button-primary-text);
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.update-btn:hover {
  background: var(--button-primary-hover);
}

.update-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  margin-left: 4px;
  line-height: 1;
}

.update-close:hover {
  color: var(--text-primary);
}

/* ========================================
   HISTORY MODAL - PREMIUM DESIGN
   ======================================== */
#historyModal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 2050;
  /* Higher than profile modal */
  justify-content: center;
  align-items: center;
  padding: 20px;
}

#historyModal.show {
  display: flex;
  animation: fadeIn 0.3s ease;
}

.history-card {
  background: var(--bg-secondary);
  border-radius: 20px;
  padding: 24px;
  width: 100%;
  max-width: 420px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.history-header {
  text-align: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0;
  flex-shrink: 0;
}

.history-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.history-header p {
  font-size: 13px;
  color: var(--text-tertiary);
  margin: 0;
}

.ttg-go-coin-lg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.35));
}

.ttg-xp-star-lg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 4px rgba(59, 130, 246, 0.3));
}

.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg-tertiary);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  transition: transform 0.2s;
}

.history-item:hover {
  transform: translateX(4px);
  border-color: var(--accent-color);
}

.history-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-source {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: capitalize;
}

.history-time {
  font-size: 11px;
  color: var(--text-tertiary);
}

.history-amount {
  font-size: 15px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.history-amount.positive {
  color: var(--success-color);
}

.history-amount.negative {
  color: var(--error-color);
}

.history-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-tertiary);
  font-size: 14px;
}

.close-history-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 10;
}

.close-history-btn:hover {
  color: var(--text-primary);
  transform: scale(1.1);
  background: var(--bg-tertiary);
  border-radius: 8px;
}


/* ========================================
   NEURAL DWELL HEATMAP
   ======================================== */
.heatmap-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px 0;
  overflow-x: auto;
  /* Allow scrolling on very small screens */
}

.heatmap-row {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.heatmap-key {
  width: 40px;
  height: 40px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  /* Rounded squares */
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Roboto Mono', monospace;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-secondary);
  transition: all 0.3s ease;
  user-select: none;
}

/* Key Sizes */
.key-space {
  width: 220px;
}

.key-shift {
  width: 85px;
}

.key-caps {
  width: 40px;
}

/* Simplification */

/* Heat Levels - Matches Neural Dwell Aesthetic (Orange/Brown) */
.heat-0 {
  /* No errors */
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.heat-1 {
  /* Low Error Count */
  background: #ffedd5;
  /* Very Light Orange */
  border-color: #fed7aa;
  color: #c2410c;
}

.heat-2 {
  /* Medium Error Count */
  background: #fdba74;
  /* Orange */
  border-color: #fb923c;
  color: #7c2d12;
  box-shadow: 0 0 10px rgba(253, 186, 116, 0.4);
}

.heat-3 {
  /* High Error Count - Hot! */
  background: #ea580c;
  /* Dark Orange/Red */
  border-color: #c2410c;
  color: white;
  box-shadow: 0 0 15px rgba(234, 88, 12, 0.6);
  transform: scale(1.05);
  /* Pop out slightly */
  z-index: 2;
}

/* Dark Mode Adjustments for Heatmap */
body.dark-mode .heat-1 {
  background: #431407;
  border-color: #7c2d12;
  color: #fdba74;
}

body.dark-mode .heat-2 {
  background: #9a3412;
  border-color: #ea580c;
  color: white;
}

body.dark-mode .heat-3 {
  background: #ea580c;
  border-color: #f97316;
  color: white;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
  .heatmap-key {
    width: 28px;
    height: 32px;
    font-size: 11px;
    border-radius: 4px;
    gap: 3px;
  }

  .heatmap-row {
    gap: 3px;
  }

  .key-space {
    width: 140px;
  }



  @media (max-width: 380px) {
    .heatmap-key {
      width: 24px;
      height: 28px;
      font-size: 10px;
    }
  }
}

/* ===== LOW-END PERFORMANCE MODE ===== */
html.performance-mode #profileModal {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: rgba(0, 0, 0, 0.72) !important;
}

html.performance-mode #profileModal.show,
html.performance-mode .profile-card,
html.performance-mode .improvement-card,
html.performance-mode .badge-item.earned::before,
html.performance-mode .badge-item.earned[data-rarity="5"] .badge-icon,
html.performance-mode .badge-item.earned[data-rarity="5"] .badge-icon svg,
html.performance-mode .achievements-btn::after {
  animation: none !important;
}

html.performance-mode .profile-card,
html.performance-mode .improvement-card,
html.performance-mode .achievements-btn {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

html.performance-mode .profile-card {
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28) !important;
}

html.performance-mode .profile-stat,
html.performance-mode .best-item,
html.performance-mode .improvement-card,
html.performance-mode .badge-item,
html.performance-mode .achievements-btn,
html.performance-mode .daily-task,
html.performance-mode .recent-test-item,
html.performance-mode .profile-btn,
html.performance-mode .cert-btn {
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease !important;
}

html.performance-mode .profile-stat:hover,
html.performance-mode .best-item:hover,
html.performance-mode .improvement-card:hover,
html.performance-mode .badge-item:hover,
html.performance-mode .achievements-btn:hover,
html.performance-mode .daily-task:hover,
html.performance-mode .cert-btn:hover,
html.performance-mode #shareProfileBtn:hover {
  transform: none !important;
  box-shadow: none !important;
}

html.performance-mode .profile-stats-grid,
html.performance-mode .profile-section,
html.performance-mode .recent-tests-list,
html.performance-mode .daily-tasks-list,
html.performance-mode .achievements-content .badge-category {
  content-visibility: auto;
  contain: layout paint style;
}

html.performance-mode .profile-section {
  contain-intrinsic-size: 1px 220px;
}

html.performance-mode .recent-tests-list,
html.performance-mode .daily-tasks-list {
  contain-intrinsic-size: 1px 180px;
}

@media (prefers-reduced-motion: reduce) {

  #profileModal.show,
  .profile-card,
  .improvement-card,
  .badge-item.earned::before,
  .badge-item.earned[data-rarity="5"] .badge-icon,
  .badge-item.earned[data-rarity="5"] .badge-icon svg,
  .achievements-btn::after {
    animation: none !important;
  }

  .profile-stat:hover,
  .best-item:hover,
  .improvement-card:hover,
  .badge-item:hover,
  .achievements-btn:hover,
  .daily-task:hover,
  .cert-btn:hover,
  #shareProfileBtn:hover {
    transform: none !important;
  }
}

/* ========================================
   ACTIVITY HEATMAP & PROGRESS CHART
   ======================================== */

.activity-heatmap-container {
  background: var(--bg-tertiary);
  border-radius: 12px;
  padding: 16px;
  border: 1px solid var(--border-color);
  min-height: 140px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.heatmap-wrapper {
  overflow-x: auto;
  padding-bottom: 8px;
  mask-image: linear-gradient(to right, transparent, black 40px, black calc(100% - 40px), transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 40px, black calc(100% - 40px), transparent);
}

.heatmap-wrapper::-webkit-scrollbar {
  height: 4px;
}

.heatmap-wrapper::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

.heatmap-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.heatmap-grid-container {
  display: flex;
  gap: 12px;
  min-width: max-content;
  padding: 4px 10px;
}

.heatmap-days-labels {
  display: grid;
  grid-template-rows: repeat(7, 1fr);
  gap: 3px;
  font-size: 9px;
  color: var(--text-tertiary);
  padding-top: 18px;
  /* offset for month labels */
  font-weight: 600;
}

.heatmap-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.heatmap-months {
  display: grid;
  grid-template-columns: repeat(53, 11px);
  /* Match heatmap grid */
  gap: 3px;
  font-size: 9px;
  color: var(--text-tertiary);
  height: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}

.heatmap-months span {
  grid-column: span 4;
  /* Default, will be overridden by JS for precise alignment */
  text-align: left;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(53, 11px);
  grid-template-rows: repeat(7, 11px);
  gap: 3px;
  grid-auto-flow: column;
  /* Critical: Fill column by column (Sun-Sat) */
}

.heatmap-day {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  background: var(--bg-secondary);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.heatmap-day:hover {
  transform: scale(1.4);
  z-index: 10;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
  filter: brightness(1.2);
}

.heatmap-day.lvl-0,
.legend-square.lvl-0 {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.heatmap-day.lvl-1,
.legend-square.lvl-1 {
  background: rgba(16, 185, 129, 0.2);
}

.heatmap-day.lvl-2,
.legend-square.lvl-2 {
  background: rgba(16, 185, 129, 0.4);
}

.heatmap-day.lvl-3,
.legend-square.lvl-3 {
  background: rgba(16, 185, 129, 0.7);
}

.heatmap-day.lvl-4,
.legend-square.lvl-4 {
  background: #10b981;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* Space between year selector and legend */
  gap: 12px;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 15px;
  padding: 0 4px;
}

.heatmap-legend-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Custom Year Selector Dropdown - Enhanced Glassmorphism */
.heatmap-year-selector {
  position: relative;
  display: inline-block;
}

.year-dropdown-btn {
  background: rgba(var(--bg-secondary-rgb, 245, 245, 245), 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  padding: 5px 12px;
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.year-dropdown-btn:hover {
  border-color: #f59e0b;
  background: rgba(var(--bg-tertiary-rgb, 232, 232, 232), 0.7);
  transform: translateY(-1px);
}

.year-dropdown-btn::after {
  content: "\25BC";
  font-size: 10px;
  color: #f59e0b;
  transition: transform 0.3s ease;
}

.year-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 2px;
  background: rgba(var(--bg-primary-rgb, 255, 255, 255), 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  min-width: 100px;
  z-index: 1000;
  display: none;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  padding: 4px;
}

.year-dropdown-menu.show {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.year-dropdown-item {
  padding: 10px 14px;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
}

.year-dropdown-item:hover {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.year-dropdown-item.active {
  background: #f59e0b;
  color: #fff;
}

/* Premium Floating Tooltip - Ultimate Glassmorphism */
.heatmap-custom-tooltip {
  position: fixed;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 12px 18px;
  border-radius: 14px;
  color: #fff;
  font-size: 11px;
  pointer-events: none;
  z-index: 9999;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 20px 25px -5px rgba(0, 0, 0, 0.3),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  opacity: 0;
  transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateY(10px) scale(0.95);
  font-family: 'Outfit', sans-serif;
  min-width: 140px;
}

.heatmap-custom-tooltip.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.heatmap-custom-tooltip .tooltip-date {
  font-weight: 700;
  display: block;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.heatmap-custom-tooltip .tooltip-tests {
  color: #f59e0b;
  font-weight: 800;
  font-size: 13px;
}

.legend-square {
  width: 11px;
  /* Match heatmap day size */
  height: 11px;
  border-radius: 2px;
}

.heatmap-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100px;
  color: var(--text-tertiary);
  font-style: italic;
  font-size: 13px;
}

/* Progress Chart Modal */
.progress-chart-card {
  background: var(--bg-secondary);
  border-radius: 24px;
  padding: 32px;
  width: 95%;
  max-width: 1140px;
  max-height: 95vh;
  position: relative;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-color);
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.chart-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  gap: 20px;
  flex-wrap: wrap;
}

.chart-modal-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.chart-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.chart-summary-item {
  background:
    linear-gradient(160deg,
      color-mix(in srgb, var(--bg-tertiary) 92%, transparent) 0%,
      color-mix(in srgb, var(--bg-secondary) 94%, transparent) 100%);
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.chart-summary-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, #f59e0b, #10b981);
  opacity: 0.75;
}

.chart-summary-item:hover {
  transform: translateY(-4px);
  background: var(--bg-secondary);
  border-color: var(--accent-color);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.chart-summary-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  font-weight: 700;
}

.chart-summary-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}

.chart-toggles {
  display: flex;
  gap: 8px;
  background: var(--bg-tertiary);
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.chart-toggle-item {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: color 0.2s, background-color 0.2s;
  padding: 4px 10px;
  border-radius: 9px;
}

.chart-toggle-item input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent-color);
}

.chart-toggle-item input:checked+.toggle-name {
  color: var(--accent-color);
}

.close-chart-modal-btn {
  background: transparent;
  border: none;
  font-size: 28px;
  color: var(--text-tertiary);
  cursor: pointer;
  line-height: 1;
}

.close-chart-modal-btn:hover {
  color: var(--text-primary);
}

.detailed-chart-wrapper {
  height: 430px;
  width: 100%;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--border-color) 85%, transparent);
  background: color-mix(in srgb, var(--bg-tertiary) 52%, transparent);
  padding: 10px 12px 4px;
}

@media (max-width: 768px) {
  .progress-chart-card {
    padding: 16px;
    width: 98%;
    border-radius: 16px;
  }

  .detailed-chart-wrapper {
    height: 300px;
    padding: 8px 8px 4px;
  }

  .chart-modal-header {
    padding-right: 28px;
    gap: 10px;
    margin-bottom: 14px;
  }

  .chart-modal-header h2 {
    font-size: 17px;
    width: 100%;
  }

  .close-chart-modal-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 24px;
  }

  .chart-toggles {
    width: 100%;
    justify-content: center;
    padding: 6px;
    gap: 8px;
  }

  .chart-summary-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
  }

  .chart-summary-item {
    padding: 10px 12px;
  }

  .chart-summary-value {
    font-size: 20px;
  }
}

@media (max-width: 480px) {
  .progress-chart-card {
    padding: 14px;
    width: 97%;
  }

  .chart-modal-header {
    margin-bottom: 10px;
  }

  .chart-modal-header h2 {
    font-size: 16px;
  }

  .chart-toggle-item {
    font-size: 13px;
    padding: 4px 8px;
  }

  .chart-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .chart-summary-item {
    min-height: 70px;
    padding: 9px 11px;
  }

  .chart-summary-item:last-child {
    grid-column: 1 / -1;
  }

  .chart-summary-label {
    font-size: 9px;
  }

  .chart-summary-value {
    font-size: 17px;
  }

  .detailed-chart-wrapper {
    height: 276px;
    padding: 6px 6px 4px;
  }
}

html.performance-mode .activity-heatmap-container {
  contain-intrinsic-size: 1px 140px;
}