/* The page shell is inherited from new.css. This file styles the quiz content only. */

.test-hero {
  padding: 22px 24px 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.test-hero h1,
.section-heading h2,
.quiz-heading h2,
.result-view h2 {
  margin: 0;
  color: var(--brand-dark);
  line-height: 1.2;
}

.test-hero h1 { font-size: 32px; }
.hero-copy { max-width: 650px; margin: 12px 0 0; color: var(--muted); font-size: 16px; line-height: 1.8; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 20px; }
.hero-meta span { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 11px; border: 1px solid #ebe5f1; border-radius: 8px; background: #fcfbfe; color: var(--muted); font-size: 12px; }
.hero-meta b { color: var(--brand); }
.test-mode-switch { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.test-mode-button { min-height: 40px; padding: 0 14px; border: 1px solid #ebe5f1; border-radius: 8px; background: #fcfbfe; color: var(--brand-dark); font-size: 13px; font-weight: 800; }
.test-mode-button:hover { border-color: var(--brand); background: var(--brand-soft); }
.test-mode-button.is-active { border-color: var(--brand); background: var(--brand); color: #fff; }

.levels-view,
.quiz-view { margin-top: 26px; }
.section-heading,
.quiz-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.section-heading h2,
.quiz-heading h2 { font-size: 25px; }
.section-note { display: inline-flex; align-items: center; min-height: 32px; padding: 0 10px; border: 1px solid #ebe5f1; border-radius: 8px; background: #fcfbfe; color: var(--muted); font-size: 12px; }
.level-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }

.level-card {
  min-height: 190px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: right;
  box-shadow: var(--shadow);
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.level-card:hover { border-color: #b99cdd; box-shadow: 0 16px 36px rgba(63,20,120,.12); transform: translateY(-2px); }
.level-card.is-complete { border-color: #9ed5ac; background: var(--green-soft); }
.level-card-top,
.level-card-bottom { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.level-card-copy { width: 100%; }
.level-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; background: var(--brand-soft); color: var(--brand); font-size: 18px; font-weight: 900; }
.level-card.is-complete .level-icon { background: #d9f0df; color: var(--green); }
.completion-label { color: var(--muted); font-size: 11px; font-weight: 800; }
.level-card.is-complete .completion-label { color: var(--green); }
.level-card h3 { margin: 0; color: var(--brand-dark); font-size: 21px; }
.level-card p { min-height: 38px; margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.level-card-bottom { color: var(--brand); font-size: 12px; font-weight: 800; }
.level-card.is-complete .level-card-bottom { color: var(--green); }

.quiz-heading { align-items: center; }
.quiz-heading > div:nth-child(2) { flex: 1; }
.back-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--brand);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}
.back-button { flex: none; }
.back-button:hover,
.secondary-button:hover { border-color: #c9afe9; background: var(--brand-soft); color: var(--brand-dark); }
.live-score { min-width: 104px; padding: 9px 12px; border: 1px solid #ebe5f1; border-radius: 8px; background: #fcfbfe; text-align: center; }
.live-score span,
.live-score strong { display: block; }
.live-score span { color: var(--muted); font-size: 11px; }
.live-score strong { margin-top: 2px; color: var(--brand); font-size: 20px; }

.quiz-progress { margin-bottom: 18px; padding: 14px 17px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
.quiz-progress-copy { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 9px; color: var(--muted); font-size: 13px; }
.quiz-progress-track { height: 7px; overflow: hidden; border-radius: 8px; background: #eee8f4; }
.quiz-progress-track span { display: block; width: 3.34%; height: 100%; border-radius: inherit; background: var(--brand); transition: width .25s ease; }

.test-question-card,
.result-view { border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
.test-question-card { max-width: 820px; margin: 0 auto; padding: 26px; }
.question-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.question-number { display: grid; place-items: center; min-width: 38px; height: 32px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); font-size: 13px; font-weight: 900; direction: ltr; }
.lesson-name { color: var(--muted); font-size: 12px; }
.question-instruction { margin: 24px 0 12px; color: var(--muted); font-size: 14px; }
.test-question-text { min-height: 68px; display: grid; place-items: center; margin: 0 auto 22px; color: var(--brand-dark); font-size: clamp(22px,3vw,30px); line-height: 1.5; text-align: center; direction: ltr; }
.test-question-text.arabic-prompt { direction: rtl; }
.test-question-text .blank { display: inline-block; min-width: 54px; margin: 0 3px; color: var(--brand); border-bottom: 3px solid #b99cdd; }
.test-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.test-option { min-height: 54px; border: 1px solid #ebe5f1; border-radius: 8px; background: #fcfbfe; color: var(--ink); padding: 12px 10px; direction: ltr; font-weight: 700; overflow-wrap: anywhere; transition: border-color .18s ease, background .18s ease; }
.test-option:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-soft); }
.test-option:disabled { cursor: default; }
.test-option.correct { border-color: #9ed5ac; background: var(--green-soft); color: #267443; }
.test-option.wrong { border-color: #e8aaaa; background: var(--red-soft); color: #a94340; }

.next-button,
.primary-button { width: 100%; border: 1px solid var(--brand); border-radius: 8px; background: var(--brand); color: #fff; padding: 13px 16px; font-weight: 800; }
.next-button { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 20px; }
.next-button:disabled { cursor: not-allowed; opacity: .38; }
.next-button:not(:disabled):hover,
.primary-button:hover { background: var(--brand-dark); }
.next-button span { font-size: 20px; line-height: 0; }

.test-feedback { margin-top: 14px; padding: 14px 15px; border: 1px solid; border-radius: 8px; font-size: 13px; line-height: 1.8; }
.test-feedback.good { border-color: #9ed5ac; background: var(--green-soft); color: #267443; }
.test-feedback.bad { border-color: #e8aaaa; background: var(--red-soft); color: #a94340; }
.test-feedback strong { color: inherit; }
.feedback-title { display: block; margin-bottom: 5px; font-size: 15px; }
.feedback-line { margin-top: 4px; }
.feedback-example { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(24,33,47,.12); direction: ltr; text-align: left; }
.feedback-example small { display: block; direction: rtl; text-align: right; }

.result-view { max-width: 620px; margin: 50px auto 0; padding: 34px 26px; text-align: center; }
.result-mark { display: grid; place-items: center; width: 58px; height: 58px; margin: 0 auto 15px; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 28px; font-weight: 900; }
.result-mark.needs-review { background: var(--red-soft); color: var(--red); }
.result-view h2 { font-size: 27px; }
.result-score { margin: 14px 0 4px; color: var(--brand); font-size: 38px; font-weight: 900; direction: ltr; }
.result-message { margin: 0 auto; color: var(--muted); font-size: 14px; line-height: 1.8; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.secondary-button { width: 100%; }

@media (max-width: 900px) {
  .level-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .test-hero { padding: 18px 16px 20px; }
  .test-hero h1 { font-size: 30px; }
  .hero-copy { font-size: 14px; }
  .test-mode-switch { flex-direction: column; }
  .test-mode-button { width: 100%; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .quiz-heading { align-items: center; flex-direction: row; flex-wrap: wrap; }
  .quiz-heading > div:nth-child(2) { min-width: 160px; }
  .live-score { margin-right: auto; }
  .level-grid,
  .result-actions { grid-template-columns: 1fr; }
  .level-card { min-height: 158px; }
  .test-question-card { padding: 20px 16px; }
  .test-options { grid-template-columns: 1fr; }
  .quiz-progress-copy { align-items: flex-start; flex-direction: column; gap: 4px; }
}
