/* --- Quiz Styles --- */
body.quiz-open {
  overflow: hidden;
}

.quiz-modal-container {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: radial-gradient(ellipse at center, rgba(30, 27, 46, 0.95) 20%, rgba(10, 8, 28, 1) 100%);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s 0.3s;
  font-family: 'Times New Roman', serif;
  padding: 1rem;
}

.quiz-modal-container.open {
  display: flex;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease;
}

.quiz-modal-content {
  background: #110f1c;
  border: 1px solid rgba(167, 139, 250, 0.2);
  border-radius: 20px;
  width: 100%;
  max-width: 700px;
  box-shadow: 0 10px 40px rgba(10, 8, 28, 0.5);
  display: flex;
  flex-direction: column;
  max-height: 95vh;
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
}

.quiz-modal-container.open .quiz-modal-content {
  transform: scale(1);
}

.quiz-modal-header {
  display: flex;
  justify-content: flex-end; /* Pushes close button to the right */
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(167, 139, 250, 0.2);
  min-height: 60px; /* To maintain layout consistency */
}

/* Title is removed as per instructions */
.quiz-modal-title {
 display: none;
}

.quiz-modal-close {
  background: transparent;
  border: none;
  color: #a78bfa;
  font-size: 2rem;
  cursor: pointer;
  transition: color 0.2s, transform 0.2s;
  position: absolute;
  top: 10px;
  right: 15px;
  z-index: 10;
}

.quiz-modal-close:hover {
  color: #c4b5fd;
  transform: rotate(90deg);
}

.quiz-modal-body {
  padding: 1.5rem 2rem;
  flex-grow: 1;
  overflow-y: auto;
  text-align: center;
}

.quiz-modal-progress {
  color: #c4b5fd;
  margin-bottom: 1rem;
  font-weight: 500;
  font-size: 1.1rem;
}

.quiz-modal-question-area {
  margin-bottom: 2rem;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quiz-modal-question {
  font-size: 1.6rem;
  line-height: 1.5;
  color: #e2e8f0;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1rem;
  flex-grow: 1;
}

.quiz-modal-loading-spinner {
    color: #c4b5fd;
    margin: 1rem 0;
}

.quiz-modal-answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  margin: 0 auto;
  max-width: 600px;
}

.quiz-answer-btn {
  color: #fff;
  padding: 1.2rem;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  border: 3px solid transparent;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.4);
  font-family: 'Times New Roman', serif;
}

.quiz-answer-btn:before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 9px;
  padding: 3px;
  background: transparent;
  -webkit-mask:
     linear-gradient(#fff 0 0) content-box,
     linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  transition: all 0.2s ease;
}

.quiz-answer-btn:hover:not(.correct):not(.wrong):before {
  padding: 0;
  background: var(--btn-hover-color);
  box-shadow: 0 0 20px var(--btn-hover-color);
}

.quiz-answer-btn:hover:not(.correct):not(.wrong) {
  border-color: var(--btn-hover-color);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
}

.quiz-answer-btn[data-color="blue"] {
  background-color: #3b82f6;
  --btn-hover-color: #60a5fa;
}
.quiz-answer-btn[data-color="yellow"] {
  background-color: #f59e0b;
  --btn-hover-color: #fbbf24;
  color: #1f2937;
  font-weight: 600;
}
.quiz-answer-btn[data-color="red"] {
  background-color: #ef4444;
  --btn-hover-color: #f87171;
}
.quiz-answer-btn[data-color="pink"] {
  background-color: #ec4899;
  --btn-hover-color: #f472b6;
}

.quiz-answer-btn.correct {
  background-color: #16a34a;
  border-color: #4ade80;
  color: white;
  transform: scale(1.05);
}

.quiz-answer-btn.wrong {
  background-color: #b91c1c;
  border-color: #ef4444;
  color: white;
  animation: shake 0.5s;
}

.quiz-modal-feedback {
  margin-top: 1.5rem;
  font-size: 1.2rem;
  font-weight: 600;
  min-height: 25px;
}

.quiz-modal-footer {
  display: none; /* Removed from layout */
}

.quiz-modal-end-screen {
    text-align: center;
    margin-top: 1rem;
}

.quiz-modal-score {
  font-size: 1.8rem;
  font-weight: bold;
  color: #f0eafc;
  margin-bottom: 1.2rem;
}

.quiz-modal-score b {
  color: #c4b5fd;
}

.quiz-modal-continue {
    display: inline-block;
    margin: 0;
    padding: 0.7em 1.5em;
    color: #f4f5fa;
    background: linear-gradient(90deg,#6667ee 10%,#a78bfa 80%);
    border-radius: 13px;
    font-size: 1.2rem;
    font-weight: bold;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quiz-modal-continue:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(167, 139, 250, 0.5);
}

.quiz-tts-btn {
    background: transparent;
    border: 2px solid var(--slideout-accent);
    cursor: pointer;
    margin-left: 1.15em;
    font-size: 1.25rem;
    color: var(--slideout-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    transition: all 0.2s ease;
}

.quiz-tts-btn:hover {
    background: var(--slideout-accent);
    color: #1e1b2e;
    transform: scale(1.1);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-5px); }
}