/* QUIZ PAGE CLEAN CSS - RESTORED ORIGINAL ALIGNMENT WITH ENHANCED ANIMATIONS */

:root {
  --quiz-gold: #ffd166;
  --quiz-gold-dark: #d4af37;
  --quiz-amber: #ff9f1c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: "Noto Serif Telugu", serif, sans-serif;
  color: white;
  background-color: #0a0502;
  position: relative;
  overflow-x: hidden;
}

/* 3D Sacred Particle Canvas */
#canvas3D {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.85;
}

.quiz-bg {
  position: fixed;
  inset: 0;
  z-index: -10;
  background:
    linear-gradient(rgba(10, 5, 0, 0.78), rgba(10, 5, 0, 0.85)),
    url("../images/quiz-bg.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: opacity 0.5s ease;
}

/* TOP NAVBAR */
.glass-navbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 16px 20px;
  background: rgba(20, 12, 5, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 209, 102, 0.25);
  margin-bottom: 30px;
}

.glass-navbar a,
.glass-navbar button {
  color: #ffd166;
  text-decoration: none;
  font-size: 16px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 25px;
  border: 1px solid rgba(255, 209, 102, 0.3);
  background: rgba(255, 255, 255, 0.05);
  transition: all 0.25s ease;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.glass-navbar a:hover,
.glass-navbar button:hover {
  background: rgba(255, 209, 102, 0.2);
  border-color: #ffd166;
  transform: translateY(-2px);
  box-shadow: 0 0 14px rgba(255, 209, 102, 0.3);
}

.quiz-navbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 22px;
  background: rgba(20, 12, 5, 0.68);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 209, 102, 0.32);
  border-radius: 999px;
  margin-bottom: 28px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.quiz-nav-back,
.quiz-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: rgba(255, 209, 102, 0.12);
  border: 1px solid rgba(255, 209, 102, 0.3);
  border-radius: 999px;
  color: #ffd166;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.25s ease;
}

.quiz-nav-back:hover,
.quiz-nav-btn:hover {
  background: rgba(255, 209, 102, 0.25);
  border-color: #ffd166;
  transform: translateY(-2px);
  box-shadow: 0 0 14px rgba(255, 209, 102, 0.3);
}

.quiz-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #ffffff;
}

.quiz-nav-icon {
  font-size: 1.4rem;
}

.quiz-nav-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffd166;
}

.quiz-nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quiz-page {
  position: relative;
  z-index: 2;
  width: 90%;
  max-width: 1250px;
  margin: 0 auto 80px;
  padding-top: 20px;
}

/* CARDS WITH ORIGINAL GLASS EFFECT & CENTERING */
.quiz-title-box,
.user-lifetime-banner,
.general-quiz-box,
.quiz-category-card {
  background: rgba(20, 12, 5, 0.68);
  border: 1px solid rgba(255, 209, 102, 0.38);
  border-radius: 26px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 0 28px rgba(255, 209, 102, 0.13);
}

/* 1. TITLE BOX */
.quiz-title-box {
  text-align: center;
  padding: 35px 25px;
  margin-bottom: 30px;
  animation: quizCardRise 0.5s ease both;
}

.quiz-title-box h1 {
  color: #ffd166;
  font-size: 46px;
  margin: 0 0 14px;
  font-weight: 800;
  text-shadow: 0 0 20px rgba(255, 209, 102, 0.3);
}

.quiz-title-box p {
  color: white;
  font-size: 18px;
  line-height: 1.7;
  max-width: 800px;
  margin: 0 auto;
}

/* 2. USER LIFETIME PERSONAL SCORE BANNER */
.user-lifetime-banner {
  text-align: center;
  padding: 26px 22px;
  margin-bottom: 30px;
  animation: quizCardRise 0.5s ease 0.05s both;
}

.score-chip {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 209, 102, 0.28);
  border-radius: 20px;
  padding: 8px 18px;
  color: #fff;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.score-chip:hover {
  background: rgba(255, 209, 102, 0.15);
  border-color: #ffd166;
  transform: translateY(-2px);
}

.score-chip strong {
  color: #ffd166;
  font-size: 17px;
}

/* 3. GENERAL QUIZ BOX */
.general-quiz-box {
  text-align: center;
  padding: 35px 25px;
  margin-bottom: 35px;
  animation: quizCardRise 0.5s ease 0.1s both;
}

.general-quiz-box h2,
.quiz-section-title {
  color: #ffd166;
  font-size: 36px;
  text-align: center;
  margin: 0 0 26px;
  font-weight: 800;
  text-shadow: 0 0 18px rgba(255, 209, 102, 0.25);
}

.difficulty-buttons {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.difficulty-buttons button,
.start-quiz-btn,
.leaderboard-btn,
.quiz-card-buttons button {
  border: 1px solid rgba(255, 209, 102, 0.4);
  border-radius: 35px;
  padding: 13px 28px;
  cursor: pointer;
  font-weight: bold;
  font-size: 16px;
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
  position: relative;
  overflow: hidden;
}

.difficulty-buttons button,
.leaderboard-btn,
.quiz-leaderboard-btn {
  background: rgba(255, 255, 255, 0.07);
  color: #ffd166;
}

.start-quiz-btn,
.quiz-start-btn {
  background: #d4af37;
  color: #111;
}

.difficulty-buttons button:hover,
.start-quiz-btn:hover,
.leaderboard-btn:hover,
.quiz-card-buttons button:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 0 18px rgba(255, 209, 102, 0.35);
}

.difficulty-buttons button:active,
.start-quiz-btn:active,
.leaderboard-btn:active,
.quiz-card-buttons button:active {
  transform: translateY(-1px) scale(0.97);
}

.selected-difficulty {
  background: #d4af37 !important;
  color: #111 !important;
  box-shadow: 0 0 20px rgba(255, 209, 102, 0.5) !important;
  animation: quizPulse 0.35s ease;
}

/* 4. CATEGORY QUIZ GRID */
.quiz-category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
  width: 100%;
}

.quiz-category-card {
  position: relative;
  overflow: hidden;
  border-radius: 26px;
  min-height: 520px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
  animation: quizCardRise 0.5s ease both;
}

.quiz-category-grid .quiz-category-card:nth-child(1) { animation-delay: 0.05s; }
.quiz-category-grid .quiz-category-card:nth-child(2) { animation-delay: 0.12s; }
.quiz-category-grid .quiz-category-card:nth-child(3) { animation-delay: 0.19s; }
.quiz-category-grid .quiz-category-card:nth-child(4) { animation-delay: 0.26s; }

.quiz-category-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 36px rgba(255, 209, 102, 0.3);
}

.quiz-category-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  z-index: 1;
  transition: transform 0.5s ease, filter 0.5s ease;
}

.quiz-category-card:hover img {
  transform: scale(1.08);
  filter: brightness(1.08);
}

.quiz-category-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.88) 0%,
    rgba(0, 0, 0, 0.55) 35%,
    rgba(0, 0, 0, 0.1) 65%,
    rgba(0, 0, 0, 0) 100%
  );
  z-index: 2;
  transition: background 0.3s ease;
}

.quiz-category-card:hover::before {
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.94) 0%,
    rgba(0, 0, 0, 0.6) 40%,
    rgba(0, 0, 0, 0.15) 70%,
    rgba(0, 0, 0, 0) 100%
  );
}

.quiz-card-overlay {
  position: relative;
  z-index: 3;
  width: 100%;
  padding: 30px 25px;
  text-align: center;
}

.quiz-card-overlay h2 {
  color: #ffd166;
  font-size: 34px;
  margin: 0 0 8px;
  font-weight: 800;
  text-shadow: 0 2px 10px rgba(0,0,0,0.8);
}

.community-score {
  color: white;
  opacity: 0.95;
  margin: 6px 0;
  font-size: 16px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

.quiz-card-overlay span {
  display: block;
  color: #ffd166;
  font-size: 34px;
  font-weight: bold;
  margin-bottom: 20px;
  text-shadow: 0 0 16px rgba(255, 209, 102, 0.4);
}

.quiz-card-buttons {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0;
}

.quiz-card-buttons button {
  flex: 1;
  min-width: 140px;
  max-width: 200px;
}

/* =========================================================
   PLAY QUIZ PAGE & QUESTION CARD (CENTERED & BEAUTIFUL)
   ========================================================= */
.play-quiz-page {
  position: relative;
  z-index: 2;
  width: 90%;
  max-width: 900px;
  margin: 30px auto 70px;
}

.play-quiz-card {
  background: rgba(20, 12, 5, 0.72);
  border: 1px solid rgba(255, 209, 102, 0.38);
  border-radius: 26px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 38px 32px;
  box-shadow: 0 0 35px rgba(255, 209, 102, 0.15);
  animation: quizCardRise 0.45s ease both;
}

.quiz-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.quiz-top h2 {
  color: #ffd166;
  font-size: 26px;
  margin: 0;
  font-weight: 800;
}

#timer {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #d4af37;
  color: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 26px;
  box-shadow: 0 0 18px rgba(255, 209, 102, 0.4);
  transition: background 0.3s ease, transform 0.3s ease;
}

#timer.timer-warning {
  background: #e74c3c;
  color: #fff;
  box-shadow: 0 0 24px rgba(231, 76, 60, 0.8);
  animation: quizTimerPulse 0.9s ease-in-out infinite;
}

.progress-container {
  height: 10px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: 24px;
}

.progress-bar {
  height: 100%;
  width: 10%;
  background: linear-gradient(90deg, #d4af37, #ffd166);
  box-shadow: 0 0 10px #ffd166;
  border-radius: 20px;
  transition: width 0.4s ease;
}

.question-count {
  color: #ffd166;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}

.quiz-question {
  color: white;
  text-align: center;
  font-size: 26px;
  line-height: 1.65;
  margin: 20px 0 35px;
  font-weight: 700;
}

.quiz-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.option-btn {
  padding: 20px 22px;
  border-radius: 18px;
  border: 1px solid rgba(255, 209, 102, 0.32);
  background: rgba(255, 255, 255, 0.08);
  color: white;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  line-height: 1.45;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.option-btn:not(:disabled):hover {
  transform: translateY(-2px);
  border-color: #ffd166;
  background: rgba(255, 209, 102, 0.18);
  box-shadow: 0 6px 20px rgba(255, 209, 102, 0.25);
}

.option-selected {
  background: #d4af37 !important;
  color: #111 !important;
  transform: scale(1.02);
  border-color: #ffd166 !important;
  box-shadow: 0 0 20px rgba(255, 209, 102, 0.5) !important;
}

/* =========================================================
   GREEN & RED ANSWER FEEDBACK ANIMATIONS
   ========================================================= */
.option-correct {
  background: linear-gradient(135deg, #1b5e20, #2e7d32, #43a047) !important;
  border: 2px solid #2ecc71 !important;
  color: #ffffff !important;
  box-shadow: 0 0 30px rgba(46, 204, 113, 0.85), inset 0 0 15px rgba(255, 255, 255, 0.25) !important;
  transform: scale(1.04) !important;
  animation: quizCorrectPop 0.55s cubic-bezier(0.175, 0.885, 0.32, 1.275) both !important;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.option-correct::after {
  content: "  ✓";
  font-weight: 900;
  color: #ffffff;
}

.option-wrong {
  background: linear-gradient(135deg, #b71c1c, #c62828, #e53935) !important;
  border: 2px solid #ff4d4d !important;
  color: #ffffff !important;
  box-shadow: 0 0 30px rgba(231, 76, 60, 0.85), inset 0 0 15px rgba(255, 255, 255, 0.2) !important;
  animation: quizShake 0.55s ease both !important;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.option-wrong::after {
  content: "  ✕";
  font-weight: 900;
  color: #ffffff;
}

.option-btn:disabled {
  cursor: default;
}

.quiz-bottom-buttons {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-top: 35px;
}

.quiz-bottom-buttons button {
  flex: 1;
  padding: 15px 30px;
  border-radius: 35px;
  border: none;
  cursor: pointer;
  font-weight: bold;
  font-size: 16px;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.quiz-bottom-buttons button:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

#nextQuestionBtn {
  background: #d4af37;
  color: #111;
  box-shadow: 0 4px 18px rgba(255, 209, 102, 0.35);
}

#quitQuizBtn {
  background: #9b2226;
  color: white;
}

/* =========================================================
   LEADERBOARD & RESULT STYLES
   ========================================================= */
.lb-tabs-wrapper {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.lb-tab-btn {
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid rgba(255, 209, 102, 0.35);
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
}

.lb-tab-btn:hover {
  background: rgba(255, 209, 102, 0.18);
  border-color: #ffd166;
  transform: translateY(-2px);
}

.lb-tab-btn.active {
  background: #d4af37 !important;
  color: #111 !important;
  border-color: #ffd166 !important;
  box-shadow: 0 0 16px rgba(255, 209, 102, 0.4);
}

.lb-podium {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 16px;
  margin: 30px 0 26px;
}

.podium-card {
  flex: 1;
  max-width: 220px;
  border-radius: 22px;
  padding: 22px 14px;
  text-align: center;
  background: rgba(25, 16, 10, 0.85);
  border: 1px solid rgba(255, 209, 102, 0.35);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transition: all 0.3s ease;
}

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

.podium-card.rank-1 {
  order: 2;
  min-height: 230px;
  border-color: #ffd700;
  box-shadow: 0 0 28px rgba(255, 215, 0, 0.35);
  background: linear-gradient(180deg, rgba(45, 28, 12, 0.95), rgba(20, 12, 6, 0.95));
}

.podium-card.rank-2 {
  order: 1;
  min-height: 195px;
  border-color: #c0c0c0;
}

.podium-card.rank-3 {
  order: 3;
  min-height: 175px;
  border-color: #cd7f32;
}

.podium-medal {
  font-size: 34px;
  margin-bottom: 8px;
  display: block;
}

.podium-name {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.podium-score {
  font-size: 20px;
  font-weight: 800;
  color: #ffd166;
}

.lb-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.lb-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 209, 102, 0.2);
  transition: all 0.22s ease;
}

.lb-row:hover {
  background: rgba(255, 209, 102, 0.12);
  border-color: #ffd166;
  transform: translateX(4px);
}

.lb-row-me {
  background: rgba(255, 209, 102, 0.2) !important;
  border-color: #ffd166 !important;
  box-shadow: 0 0 16px rgba(255, 209, 102, 0.3);
}

.lb-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.lb-rank {
  font-size: 20px;
  font-weight: 800;
  color: #ffd166;
  min-width: 32px;
  text-align: center;
}

.lb-name {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
}

.lb-score {
  font-size: 18px;
  font-weight: 800;
  color: #ffd166;
}

.result-card {
  text-align: center;
  animation: quizResultPop 0.5s ease both;
  padding: 40px 28px;
}

.result-card h1 {
  color: #ffd166;
  font-size: 38px;
  margin: 0 0 12px;
}

.result-card h2 {
  font-size: 46px;
  margin: 22px 0;
  color: #fff;
  text-shadow: 0 0 20px rgba(255, 209, 102, 0.4);
}

.result-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin: 24px 0 32px;
}

.result-stat-box {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 209, 102, 0.25);
  border-radius: 18px;
  padding: 14px;
}

.result-stat-label {
  font-size: 14px;
  color: #d4c0a5;
  display: block;
  margin-bottom: 6px;
}

.result-stat-val {
  font-size: 22px;
  font-weight: 800;
  color: #ffd166;
}

/* =========================================================
   KEYFRAME ANIMATIONS
   ========================================================= */
@keyframes quizCardRise {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes quizPulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes quizTimerPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.12); }
}

@keyframes quizCorrectPop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.08); }
  70%  { transform: scale(1.02); }
  100% { transform: scale(1.04); }
}

@keyframes quizShake {
  0%, 100% { transform: translateX(0); }
  15%      { transform: translateX(-9px) rotate(-1deg); }
  30%      { transform: translateX(9px) rotate(1deg); }
  45%      { transform: translateX(-7px) rotate(-1deg); }
  60%      { transform: translateX(7px) rotate(1deg); }
  75%      { transform: translateX(-3px); }
  90%      { transform: translateX(3px); }
}

@keyframes quizResultPop {
  0%   { opacity: 0; transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1); }
}

/* =========================================================
   MOBILE RESPONSIVENESS
   ========================================================= */
@media (max-width: 700px) {
  .quiz-page {
    width: 94%;
    margin: 25px auto 60px;
    padding-top: 10px;
  }

  .quiz-title-box {
    padding: 26px 18px;
  }

  .quiz-title-box h1 {
    font-size: 32px;
  }

  .quiz-title-box p {
    font-size: 15px;
  }

  .general-quiz-box {
    padding: 28px 16px;
  }

  .general-quiz-box h2,
  .quiz-section-title {
    font-size: 28px;
  }

  .difficulty-buttons {
    gap: 10px;
  }

  .difficulty-buttons button {
    padding: 11px 16px;
    font-size: 14px;
  }

  .start-quiz-btn,
  .leaderboard-btn {
    width: 220px;
    margin: 8px auto;
    display: block;
  }

  .quiz-category-grid {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .quiz-category-card {
    min-height: 420px;
  }

  .quiz-card-overlay {
    padding: 20px 25px 30px;
  }

  .quiz-category-card h2 {
    font-size: 26px;
  }

  .community-score {
    font-size: 14px;
  }

  .quiz-category-card span {
    font-size: 26px;
  }

  .quiz-card-buttons {
    padding: 0 8px 14px;
    gap: 8px;
  }

  .quiz-card-buttons button {
    min-width: 100%;
    font-size: 14px;
    padding: 11px;
  }

  .play-quiz-page {
    width: 94%;
    margin-top: 20px;
  }

  .play-quiz-card {
    padding: 22px 18px;
  }

  .quiz-top {
    flex-direction: row;
    gap: 12px;
  }

  .quiz-question {
    font-size: 20px;
  }

  .quiz-options {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .quiz-bottom-buttons {
    flex-direction: column;
    gap: 12px;
  }

  .lb-podium {
    flex-direction: column;
    align-items: center;
  }

  .podium-card {
    width: 100%;
    max-width: 100%;
    min-height: auto !important;
    order: unset !important;
  }
}
