/* Quiz Modal */
.quiz-modal {
  position: fixed;
  z-index: 10001;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  background: var(--black-35);
  display: flex;
  align-items: center;
  justify-content: center;
  /* Ensure modal always fits in viewport */
  max-height: 100vh;
  max-height: 100dvh; /* Dynamic viewport height */
  overflow: hidden; /* Prevent modal from overflowing */
}

.quiz-modal-content {
  background: linear-gradient(
    135deg,
    var(--primary-purple) 0%,
    var(--secondary-purple) 100%
  );
  border-radius: 0;
  padding: 0;
  box-shadow: var(--shadow-heavy), 0 6px 20px var(--black-15);
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  border: none;
  /* Ensure modal fits within actual viewport */
  height: 100dvh; /* Use dynamic viewport height */
  min-height: 100dvh;
  max-height: 100dvh;
}

.quiz-main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 50px 20px 50px; /* Reduced top padding to make room for timer */
  gap: var(--gap-lg); /* Account for team display when active */
  min-height: 0; /* Allow flexbox to shrink */
  overflow: hidden; /* Prevent scrolling */
}

.quiz-timer {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Concert One", Arial, sans-serif;
  font-size: 2.5em;
  font-weight: bold;
  color: #fff;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 0.7em;
  padding: 0.4em 0.8em;
  margin: 1.5em auto 1em auto;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  letter-spacing: 0.04em;
  min-width: 100px;
  width: auto;
  height: auto;
  text-align: center;
  transition: all 0.3s ease;
  order: -1; /* Ensure timer appears first */
}

.quiz-timer.timer-warning {
  color: #fff;
  background: #e53935;
  animation: timerPulse 0.5s alternate;
  box-shadow: 0 4px 20px rgba(229, 57, 53, 0.4);
}
.quiz-question {
  font-size: 3.5em;
  color: #efff15;
  margin: 30 0 50px 0;
  text-align: center;
  font-family: "Concert One", Arial, sans-serif; /* Changed to match setup font */
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8), 0 1px 2px rgba(0, 0, 0, 0.9),
    0 0 10px rgba(239, 255, 21, 0.3);
  width: 100%;
  max-width: 90%;
  min-height: 120px;
  max-height: 180px;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
}

.quiz-answer {
  font-size: 4em;
  color: #fff;
  margin: 0;
  text-align: center;
  font-family: "Concert One", Arial, sans-serif; /* Changed to match setup font */
  font-weight: 700;
  text-shadow: 0 3px 6px rgba(0, 0, 0, 0.5);
  background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
  animation: answerReveal 0.8s ease-out, answerGlow 4s ease-in-out 0.8s;
  padding: 0.5em;
  border-radius: 20px;
  border: 3px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 8px 30px rgba(76, 175, 80, 0.4);
  width: auto;
  max-width: 90%;
  min-width: 200px;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  align-self: center;
}

.quiz-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 25px; /* Reduced gap */
  justify-content: center;
  align-items: stretch; /* Make all choice items same height */
  margin: 5px auto 0 auto;
  width: 100%;
  max-width: 800px;
  box-sizing: border-box;
}

.choice-item {
  background: var(--black-30);
  border: 2px solid #b3b3e6;
  border-radius: 10px;
  padding: 15px 18px;
  color: #fff;
  font-size: 2.5em;
  font-family: "Concert One", Arial, sans-serif; /* Changed to match setup font */
  font-weight: 600;
  text-shadow: 0 2px 8px rgba(44, 62, 80, 0.2), 0 1px 3px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: background 0.2s, border 0.2s;
  width: 40vw;
  box-shadow: 0 2px 12px rgba(44, 62, 80, 0.07);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 100px;
  max-height: 140px;
  height: auto;
  line-height: 1.1;
  -webkit-user-select: none;
  user-select: none;
  word-wrap: break-word;
  overflow-wrap: break-word;
  box-sizing: border-box;
  overflow: hidden;
}

.choice-item:hover {
  background: linear-gradient(135deg, #e0cfff 0%, #b3e6f9 100%);
  border-color: #667eea;
}
.correct-choice {
  background: #22c55e !important;
  border-color: #22c55e !important;
  color: #ffffff !important;
  box-shadow: 0 0 0 4px #bbf7d0, 0 2px 12px rgba(44, 62, 80, 0.07);
  font-weight: 900;
  z-index: 1;
}
/* Quiz Modal Points Display */
.quiz-points {
  display: inline-block;
  background: linear-gradient(90deg, #ffd700 0%, #ff9800 100%);
  color: #fff;
  font-size: 2em;
  font-weight: 800;
  padding: 0.35em 1.2em;
  border-radius: 0.5em;
  box-shadow: 0 2px 10px rgba(255, 255, 255, 0.18);
  margin: 1em auto 0.5em auto;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 6px #b76e00, 0 1px 2px #fff8;
  border: 2.5px solid #fff3;
  transition: transform 0.2s, box-shadow 0.2s;
  animation: popIn 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.quiz-points:empty {
  display: none;
}

.quiz-footer-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 30px 50px;
  background: var(--black-20);
  border-top: 2px solid var(--white-20);
  border-radius: 0 0 22px 22px;
  gap: 20px;
  /* Ensure footer stays at bottom and is always accessible */
  flex-shrink: 0; /* Don't allow footer to shrink */
  min-height: 80px; /* Minimum height for buttons */
}

.quiz-footer-buttons .quiz-btn {
  flex: 1;
  max-width: 200px;
  font-size: 2em;
  font-weight: 600;
  min-height: 100px; /* Ensure buttons have a consistent height */
}

.quiz-footer-buttons .correct-btn {
  background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
  border: 2px solid #16a34a;
}

.quiz-footer-buttons .correct-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  transform: translateY(-2px);
}

.quiz-footer-buttons .wrong-btn {
  background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
  border: 2px solid #dc2626;
}

.quiz-footer-buttons .wrong-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  transform: translateY(-2px);
}

.quiz-footer-buttons .quiz-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.close-quiz-btn {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 2.2em;
  color: rgba(255, 255, 255, 0.8);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.3s ease;
}

.close-quiz-btn:hover {
  color: #fff;
}

.quiz-actions {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  width: 100%;
}

.action-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.quiz-btn {
  padding: var(--gap-md) 32px;
  border: none;
  border-radius: var(--border-radius-md);
  font-size: 1.2em;
  font-family: "Concert One", cursive;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: var(--shadow-light);
  min-width: 140px;
}

.show-answer-btn {
  background: linear-gradient(
    135deg,
    var(--primary-purple) 0%,
    var(--secondary-purple) 100%
  );
  background-size: 200% 200%;
  animation: showAnswerPulse 3s ease-in-out;
  color: #fff;
  border: 3px solid rgba(255, 255, 255, 0.4);
  min-width: 220px;
  font-size: 1.4em;
  position: relative;
  overflow: hidden;
  text-shadow: 0 2px 4px var(--black-30);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.show-answer-btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--white-20), transparent);
  transition: left 0.5s ease;
}

.show-answer-btn:hover::after {
  left: 100%;
}

.show-answer-btn:hover {
  background: linear-gradient(135deg, #7b68ee 0%, #9932cc 100%);
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 12px 30px rgba(102, 126, 234, 0.5);
  border-color: rgba(255, 255, 255, 0.6);
}

.correct-btn {
  background: linear-gradient(45deg, #4caf50, #66bb6a);
  color: #fff;
  border: 3px solid var(--white-30);
}

.correct-btn:hover {
  background: linear-gradient(45deg, #66bb6a, #81c784);
  transform: translateY(-3px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}

.wrong-btn {
  background: linear-gradient(45deg, #f44336, #ef5350);
  color: #fff;
  border: 3px solid var(--white-30);
}

.wrong-btn:hover {
  background: linear-gradient(45deg, #ef5350, #e57373);
  transform: translateY(-3px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}
