* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0a0a0a;
  min-height: 100vh;
  color: #e0e0e0;
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
}

/* Header Styles */
.header {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.logo i {
  font-size: 1.8rem;
  color: #ffd700;
}

.logo h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: #ffffff;
}

.subtitle p {
  font-size: 0.9rem;
  color: #888;
  font-weight: 400;
}

/* Stats Bar */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.stat-card {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-1px);
  border-color: #444;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  background: #333;
  color: #ffd700;
}

.stat-info {
  flex: 1;
}

.stat-value {
  display: block;
  font-size: 1.3rem;
  font-weight: 600;
  color: #ffffff;
}

.stat-label {
  font-size: 0.8rem;
  color: #888;
  font-weight: 400;
}

/* Loading State */
.loading {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #333;
  border-top: 3px solid #ffd700;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 15px;
}

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

@keyframes subtleShine {
  0% {
    left: -100%;
  }
  50% {
    left: 100%;
  }
  100% {
    left: 100%;
  }
}

.loading p {
  font-size: 1rem;
  color: #888;
  font-weight: 400;
}

/* Error State */
.error {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.error i {
  font-size: 2rem;
  color: #ff6b6b;
  margin-bottom: 15px;
}

.error p {
  font-size: 1rem;
  color: #888;
  margin-bottom: 20px;
}

.retry-btn {
  background: #333;
  color: #ffffff;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.retry-btn:hover {
  background: #444;
  border-color: #555;
}

/* Leaderboard */
.leaderboard {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  margin-bottom: 20px;
}

.user-card {
  display: flex;
  flex-direction: column;
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 8px;
  background: #242424;
  border: 1px solid #333;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.user-card-header {
  display: flex;
  align-items: center;
  width: 100%;
  position: relative;
}

.user-card:hover {
  transform: translateY(-1px);
  border-color: #444;
  background: #2a2a2a;
}

/* Gold - 1st Place */
.user-card.rank-1 {
  background: #1a1a1a;
  border: 2px solid #ffd9005b;
  position: relative;
  overflow: hidden;
}

.user-card.rank-1::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.1), transparent);
  animation: subtleShine 3s ease-in-out infinite;
  z-index: 0;
}

.user-card.rank-1.expanded::before {
  animation: none;
}

.user-card.rank-1 .user-card-header {
  background: none;
  position: relative;
  z-index: 1;
}

.user-card.rank-1 .rank {
  color: #ffd700;
  font-weight: 700;
}

.user-card.rank-1 .user-name {
  color: #ffd700;
}

/* Silver - 2nd Place */
.user-card.rank-2 {
  background: #1a1a1a;
  border: 2px solid #c0c0c05b;
  position: relative;
  overflow: hidden;
}

.user-card.rank-2::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(192, 192, 192, 0.08), transparent);
  animation: subtleShine 4s ease-in-out infinite;
  z-index: 0;
}

.user-card.rank-2.expanded::before {
  animation: none;
}

.user-card.rank-2 .user-card-header {
  background: none;
  position: relative;
  z-index: 1;
}

.user-card.rank-2 .rank {
  color: #c0c0c0;
  font-weight: 700;
}

.user-card.rank-2 .user-name {
  color: #c0c0c0;
}

/* Bronze - 3rd Place */
.user-card.rank-3 {
  background: #1a1a1a;
  border: 2px solid #cd803271;
  position: relative;
  overflow: hidden;
}

.user-card.rank-3::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(205, 127, 50, 0.08), transparent);
  animation: subtleShine 5s ease-in-out infinite;
  z-index: 0;
}

.user-card.rank-3.expanded::before {
  animation: none;
}

.user-card.rank-3 .user-card-header {
  background: none;
  position: relative;
  z-index: 1;
}

.user-card.rank-3 .rank {
  color: #cd7f32;
  font-weight: 700;
}

.user-card.rank-3 .user-name {
  color: #cd7f32;
}

.user-card.rank-other {
  background: #242424;
  border: 1px solid #333;
}

.user-card.rank-other .user-card-header {
  background: none;
}

.rank {
  font-size: 1.2rem;
  font-weight: 700;
  width: 40px;
  text-align: center;
  color: #fff;
  margin-right: 8px;
}

.rank-1 .rank {
  color: #ffd700;
}

.rank-2 .rank {
  color: #c0c0c0;
}

.rank-3 .rank {
  color: #cd7f32;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  margin-right: 12px;
  background: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffd700;
  font-weight: 600;
  font-size: 0.9rem;
}

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

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-stats {
  display: flex;
  gap: 12px;
  font-size: 0.75rem;
  color: #888;
  flex-wrap: wrap;
}

.user-points {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
}

.points-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: #ffffff;
}

.points-label {
  font-size: 0.7rem;
  color: #888;
  font-weight: 400;
}

.user-details {
  display: none;
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  background: #1f1f1f;
  border-radius: 8px;
  border: 1px solid #333;
}

.user-card.expanded .user-details {
  display: block;
}

.details-section {
  margin-bottom: 12px;
}

.details-section:last-child {
  margin-bottom: 0;
}

.details-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 8px;
}

.activities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.activity-item-old {
  background: #333;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 6px 8px;
  text-align: center;
  font-size: 0.75rem;
  color: #e0e0e0;
}

.activity-item-old.completed {
  background: #1a4d3a;
  border-color: #2d8659;
  color: #4ade80;
}

.daily-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(35px, 1fr));
  gap: 4px;
  margin-bottom: 10px;
}

.day-cell {
  background: #333;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 4px 2px;
  text-align: center;
  font-size: 0.65rem;
  color: #888;
  position: relative;
  min-height: 35px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.day-cell:hover {
  border-color: #555;
  background: #3a3a3a;
}

.day-cell.active {
  background: #1a4d3a;
  border-color: #2d8659;
  color: #4ade80;
}

.day-cell.active:hover {
  background: #1f5a42;
  border-color: #32965f;
}

.day-cell.selected {
  background: #4a3c1a;
  border-color: #8a7332;
  color: #ffd700;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
}

.day-cell.selected.active {
  background: #3a4a1a;
  border-color: #6a8a32;
  color: #9aff4a;
}

.day-num {
  font-weight: 600;
}

.activity-emojis {
  font-size: 0.4rem;
  line-height: 0.5;
  margin-top: 1px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-count {
  font-size: 0.5rem;
  background: #4ade80;
  color: #000;
  border-radius: 8px;
  padding: 1px 3px;
  margin-top: 1px;
  font-weight: 600;
}

/* Day Details Section */
.day-details {
  margin-top: 15px;
  background: #1a1a1a;
  border: 1px solid #444;
  border-radius: 8px;
  overflow: hidden;
}

.day-details-header {
  background: #2a2a2a;
  padding: 10px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #333;
}

.selected-day {
  font-weight: 600;
  color: #ffd700;
  font-size: 0.9rem;
}

.close-day-details {
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s ease, background 0.2s ease;
}

.close-day-details:hover {
  color: #fff;
  background: #333;
}

.day-details-content {
  padding: 15px;
}

.no-day-selected,
.no-activities {
  text-align: center;
  color: #666;
  padding: 20px;
}

.no-day-selected i,
.no-activities i {
  font-size: 2rem;
  margin-bottom: 10px;
  color: #444;
}

.selected-day-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding: 10px;
  background: #222;
  border-radius: 6px;
  border: 1px solid #333;
}

.day-activities-count {
  color: #4ade80;
  font-weight: 500;
  font-size: 0.9rem;
}

.day-points {
  background: #333;
  color: #ffd700;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Legacy styles - keeping for backward compatibility but not used */
.selected-day-activities {
  display: none;
}

.selected-day-activity {
  display: none;
}

.selected-day-activity .activity-header {
  display: none;
}

.selected-day-activity .activity-emoji {
  display: none;
}

.selected-day-activity .activity-name {
  display: none;
}

.selected-day-activity .activity-notes {
  display: none;
}

.activity-points {
  background: #333;
  color: #4ade80;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 4px;
  display: inline-block;
}

/* Compact activity display */
.day-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 0;
}

.day-stats {
  display: flex;
  gap: 12px;
  font-size: 0.85rem;
  color: #bbb;
}

.day-stats span {
  padding: 6px 10px;
  border-radius: 6px;
  /* border: 1px solid #404040; */
  font-weight: 500;
}

.activities-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.activity-item {
  background: linear-gradient(135deg, #2a2a2a 0%, #242424 100%);
  border: 1px solid #404040;
  border-radius: 6px;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
}

.activity-item:hover {
  transform: translateY(-1px);
  border-color: #555;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.activity-item .activity-name {
  color: #f0f0f0;
  font-weight: 500;
}

.activity-item .activity-points {
  background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
  color: #000;
  font-size: 0.7rem;
  padding: 3px 7px;
  border-radius: 10px;
  font-weight: 600;
  margin-top: 0;
  display: inline-block;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.activities-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 15px 0 10px 0;
  color: #ffd700;
  font-weight: 600;
  font-size: 0.9rem;
  padding-bottom: 6px;
  border-bottom: 1px solid #333;
}

.activity-no-notes {
  color: #666;
  font-size: 0.8rem;
  font-style: italic;
}

.general-day-notes {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 7px;
}

.notes-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  color: #ffd700;
  font-weight: 600;
  font-size: 0.9rem;
}

.notes-content {
  background: #222;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 8px;
  font-size: 0.85rem;
  color: #bbb;
  font-style: italic;
  line-height: 1.4;
}

.daily-activities-container::-webkit-scrollbar {
  width: 6px;
}

.daily-activities-container::-webkit-scrollbar-track {
  background: #1a1a1a;
  border-radius: 3px;
}

.daily-activities-container::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 3px;
}

.daily-activities-container::-webkit-scrollbar-thumb:hover {
  background: #555;
}

.day-activities {
  border-bottom: 1px solid #333;
  padding: 12px;
}

.day-activities:last-child {
  border-bottom: none;
}

.day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #2a2a2a;
}

.day-number {
  font-weight: 600;
  color: #4ade80;
  font-size: 0.9rem;
}

.day-points {
  background: #333;
  color: #ffd700;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

.activities-list-vertical {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.activity-detail {
  background: #242424;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 8px;
}

.activity-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.activity-emoji {
  font-size: 1rem;
}

.activity-name {
  font-weight: 500;
  color: #e0e0e0;
  font-size: 0.85rem;
}

.activity-notes {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 6px;
  margin-top: 4px;
  font-size: 0.8rem;
  color: #bbb;
  font-style: italic;
  line-height: 1.4;
}

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

.bonus-item {
  background: #2a1a2a;
  border: 1px solid #4a2a4a;
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.bonus-points {
  background: #4a1a4a;
  color: #e879f9;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  min-width: 50px;
  text-align: center;
}

.bonus-reason {
  flex: 1;
  color: #e0e0e0;
  font-size: 0.85rem;
}

.bonus-date {
  color: #888;
  font-size: 0.75rem;
  white-space: nowrap;
}

.expand-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #888;
  font-size: 1rem;
  padding: 6px;
  border-radius: 6px;
  transition: color 0.2s ease, background 0.2s ease;
}

.expand-btn:hover {
  background: #333;
  color: #ffd700;
}

/* Footer */
.footer {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 15px 20px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  margin-bottom: 20px;
}

.footer p {
  color: #888;
  font-weight: 400;
  font-size: 0.85rem;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .container {
    padding: 12px;
  }

  .header {
    padding: 15px;
  }

  .logo {
    flex-direction: column;
    gap: 8px;
  }

  .logo h1 {
    font-size: 1.6rem;
  }

  .subtitle p {
    font-size: 0.85rem;
  }

  .stats-bar {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .stat-card {
    padding: 12px;
  }

  .stat-value {
    font-size: 1.1rem;
  }

  .user-card {
    padding: 10px;
  }

  .user-card-header {
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }

  .rank {
    font-size: 1rem;
    width: 35px;
    margin-right: 4px;
  }

  .user-avatar {
    margin-right: 8px;
  }

  .user-info {
    flex: 1;
    min-width: 0;
  }

  .user-points {
    margin-left: auto;
  }

  .user-stats {
    gap: 6px;
    font-size: 0.7rem;
  }

  .activities-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }

  .daily-grid {
    grid-template-columns: repeat(auto-fill, minmax(30px, 1fr));
  }

  .day-details-content {
    padding: 10px;
  }

  .activities-list {
    gap: 4px;
  }

  .activity-item {
    font-size: 0.75rem;
    padding: 3px 6px;
    gap: 4px;
  }

  .activity-item .activity-points {
    font-size: 0.65rem;
    padding: 2px 5px;
  }

  .day-stats {
    gap: 8px;
    flex-wrap: wrap;
  }

  .day-stats span {
    font-size: 0.8rem;
    padding: 4px 8px;
  }

  .selected-day-activity {
    padding: 8px;
  }

  .selected-day-activity .activity-header {
    gap: 6px;
  }

  .selected-day-activity .activity-emoji {
    font-size: 1rem;
  }

  .selected-day-activity .activity-name {
    font-size: 0.85rem;
  }

  .selected-day-activity .activity-notes {
    font-size: 0.75rem;
    padding: 6px;
  }

  .selected-day-stats {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .day-points {
    align-self: flex-end;
  }

  .footer {
    text-align: center;
  }
}

@media (max-width: 480px) {
  .logo h1 {
    font-size: 1.4rem;
  }

  .stat-card {
    padding: 10px;
    gap: 10px;
  }

  .stat-icon {
    width: 35px;
    height: 35px;
    font-size: 0.9rem;
  }

  .leaderboard {
    padding: 13px;
  }

  .user-card {
    padding: 8px;
  }

  .user-card-header {
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
  }

  .rank {
    font-size: 0.9rem;
    width: 30px;
    margin-right: 2px;
  }

  .user-avatar {
    width: 28px;
    height: 28px;
    font-size: 0.7rem;
    margin-right: 6px;
  }

  .user-info {
    flex: 1;
    min-width: 0;
  }

  .user-name {
    font-size: 0.85rem;
    margin-bottom: 1px;
  }

  .user-stats {
    gap: 4px;
    font-size: 0.65rem;
    flex-wrap: wrap;
  }

  .user-points {
    margin-left: auto;
    min-width: 20px;
    max-width: 55px;
  }

  .points-value {
    font-size: 0.9rem;
  }

  .points-label {
    font-size: 0.5rem;
  }

  .activities-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  }

  .daily-grid {
    grid-template-columns: repeat(auto-fill, minmax(25px, 1fr));
  }

  .day-cell {
    min-height: 30px;
    font-size: 0.6rem;
  }

  .daily-activities-container {
    max-height: 250px;
  }

  .bonus-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .bonus-points {
    align-self: flex-end;
  }
}
