/* Leaderboard, Podium, and Results */

/* Result */
.result-icon {
  font-size: 5rem;
  margin-bottom: 20px;
}

.result-icon.correct {
  color: var(--secondary);
}

.result-icon.wrong {
  color: var(--danger);
}

.result-text {
  font-size: 2rem;
  font-weight: bold;
  margin-bottom: 10px;
}

.result-streak {
  font-size: 1.2rem;
  color: var(--warning);
  margin-bottom: 10px;
  animation: streakPulse 0.5s ease;
}

@keyframes streakPulse {
  0% { transform: scale(0.8); opacity: 0; }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

.result-points {
  font-size: 2rem;
  font-weight: bold;
  color: var(--secondary);
  margin: 15px 0;
}

.result-total-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 20px;
}

.result-total {
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--primary);
}

/* Leaderboard */
.leaderboard-list {
  text-align: left;
  max-width: 400px;
  margin: 20px auto;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-light);
  border-radius: 8px;
  margin-bottom: 8px;
}

.leaderboard-item:nth-child(1) {
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: var(--bg);
}

.leaderboard-item:nth-child(2) {
  background: linear-gradient(135deg, #E0E0E0, #B0B0B0);
  color: var(--bg);
}

.leaderboard-item:nth-child(3) {
  background: linear-gradient(135deg, #CD7F32, #8C5A2B);
  color: var(--bg);
}

.leaderboard-rank {
  font-size: 1.5rem;
  font-weight: bold;
  width: 40px;
}

.leaderboard-avatar {
  font-size: 1.5rem;
  margin-right: 10px;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif;
  line-height: 1;
}

.leaderboard-name {
  flex: 1;
  font-weight: 600;
}

.leaderboard-score {
  font-weight: bold;
}

/* Podium */
.podium {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 12px;
  margin: 30px 0;
  padding-top: 80px; /* Space for avatars */
}

.podium-place {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  width: 110px;
}

/* Avatar floats above the podium bar */
.podium-avatar {
  font-size: 2.5rem;
  position: absolute;
  top: -70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif;
  line-height: 1;
}

/* The colored podium bar */
.podium-bar-wrapper {
  width: 100%;
  border-radius: 8px 8px 0 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 15px 10px;
  box-sizing: border-box;
}

.podium-place.first .podium-bar-wrapper {
  background: linear-gradient(135deg, #FFD700, #FFA500);
  height: 150px;
}

.podium-place.second .podium-bar-wrapper {
  background: linear-gradient(135deg, #E0E0E0, #B0B0B0);
  height: 110px;
}

.podium-place.third .podium-bar-wrapper {
  background: linear-gradient(135deg, #CD7F32, #8C5A2B);
  height: 80px;
}

.podium-rank {
  font-size: 2rem;
  font-weight: 900;
  color: rgba(0, 0, 0, 0.8);
  line-height: 1;
}

.podium-name {
  font-weight: 700;
  word-break: break-word;
  font-size: 0.85rem;
  color: rgba(0, 0, 0, 0.9);
  margin-top: 8px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.podium-score {
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.7);
  margin-top: 4px;
}

/* Podium reveal animation */
.podium-hidden {
  opacity: 0;
  transform: translateY(50px) scale(0.8);
}

.podium-reveal {
  animation: podiumReveal 0.8s ease forwards;
}

@keyframes podiumReveal {
  0% {
    opacity: 0;
    transform: translateY(50px) scale(0.8);
  }
  50% {
    transform: translateY(-10px) scale(1.05);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* First place gets extra glow */
.podium-place.first.podium-reveal {
  animation: podiumRevealFirst 1s ease forwards;
}

.podium-place.first.podium-reveal .podium-bar-wrapper {
  box-shadow: 0 0 30px rgba(255, 165, 0, 0.6);
}

@keyframes podiumRevealFirst {
  0% {
    opacity: 0;
    transform: translateY(50px) scale(0.8);
  }
  50% {
    transform: translateY(-20px) scale(1.1);
  }
  70% {
    transform: translateY(-5px) scale(1.05);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Light theme adjustments for leaderboard/podium */
body.theme-light .leaderboard-item:nth-child(1),
body.theme-light .leaderboard-item:nth-child(2),
body.theme-light .leaderboard-item:nth-child(3) {
  color: #1e293b;
}

/* Player's own final result */
.final-your-result {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  padding: 25px 40px;
  border-radius: 16px;
  margin: 0 auto 20px;
  max-width: 300px;
  text-align: center;
  animation: yourResultPop 0.6s ease;
}

@keyframes yourResultPop {
  0% { transform: scale(0.8); opacity: 0; }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

.your-result-rank {
  font-size: 3rem;
  font-weight: 900;
  color: white;
  text-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.your-result-score {
  font-size: 1.5rem;
  font-weight: bold;
  color: rgba(255, 255, 255, 0.9);
  margin: 5px 0;
}

.your-result-label {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
}

/* Leaderboard title */
.leaderboard-title {
  text-align: center;
  color: var(--text);
  margin: 20px 0 10px;
  font-size: 1.2rem;
}

/* Highlight current player in leaderboard */
.leaderboard-item.is-me {
  border: 2px solid var(--primary);
  background: var(--primary) !important;
  color: white !important;
  animation: highlightPulse 1s ease;
}

.leaderboard-item.is-me .leaderboard-name,
.leaderboard-item.is-me .leaderboard-score {
  color: white;
}

/* Highlight current player on podium */
.podium-place.is-me .podium-bar-wrapper {
  box-shadow: 0 0 0 4px var(--primary), 0 0 20px rgba(99, 102, 241, 0.5);
}

@keyframes highlightPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

/* Feedback Section */
.feedback-section {
  max-width: 400px;
  margin: 30px auto 20px;
  padding: 20px;
  background: var(--bg-light);
  border-radius: 16px;
  text-align: center;
  opacity: 0;
  animation: feedbackFadeIn 0.5s ease forwards;
  animation-delay: 6.5s;
}

@keyframes feedbackFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.feedback-section h3 {
  color: var(--text);
  margin-bottom: 15px;
  font-size: 1.1rem;
}

.rating-stars {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 15px;
}

.rating-stars .star {
  font-size: 2.2rem;
  color: var(--bg-card);
  cursor: pointer;
  transition: all 0.2s ease;
}

.rating-stars .star:hover,
.rating-stars .star.hover {
  color: var(--warning);
  transform: scale(1.2);
}

.rating-stars .star.active {
  color: var(--warning);
}

.feedback-textarea {
  width: 100%;
  padding: 12px 15px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 0.95rem;
  resize: none;
  height: 80px;
  margin-bottom: 15px;
  transition: border-color 0.2s;
}

.feedback-textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.feedback-textarea::placeholder {
  color: var(--text-muted);
}

.feedback-section .btn {
  width: 100%;
  padding: 12px;
}

.feedback-thanks {
  padding: 15px;
  color: var(--secondary);
  font-weight: 600;
  font-size: 1.1rem;
  animation: thanksPop 0.4s ease;
}

@keyframes thanksPop {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.feedback-section.submitted .rating-stars,
.feedback-section.submitted .feedback-textarea,
.feedback-section.submitted .btn {
  display: none;
}
