/* تحسينات إضافية آمنة للواجهة — اربط هذا الملف بعد style.css الحالي */
:root {
  --focus-ring: #8aa8ff;
  --surface-hover: #f8faff;
}

::selection { color: #12233f; background: #dce7ff; }
a, button, input, select { -webkit-tap-highlight-color: transparent; }
button, .topic-card, .option, .primary, .secondary, .text-button { touch-action: manipulation; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
.topic-card:focus-visible,
.option:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.topic-card, .option, .primary, .secondary, .search-box, .filter-panel select {
  transition: background-color .18s ease, border-color .18s ease,
    box-shadow .18s ease, transform .18s ease;
}
.topic-card:hover:not(:disabled), .option:hover:not(:disabled) {
  background-color: var(--surface-hover);
}
.search-box input:focus-visible { outline: none; }
.filter-panel select { max-width: 100%; cursor: pointer; }
.question-text, .feedback, .solution { overflow-wrap: anywhere; }
.question-card img, .result-card img { max-width: 100%; height: auto; }

@media (max-width: 600px) {
  .actions .primary, .actions .secondary { min-height: 44px; }
  .option { min-height: 46px; align-items: flex-start; }
  .filter-panel select { min-height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media (forced-colors: active) {
  .topic-card, .option, .question-card, .result-card, .dashboard, .stat-card {
    border: 1px solid CanvasText;
  }
  button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
    outline: 2px solid Highlight;
  }
}


/* مؤشر بصري لمعدل الإجابات الصحيحة في كل بحث */
.topic-mastery {
  display: block;
  height: 5px;
  margin-top: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf5;
}
.topic-mastery > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2457d6, #4b83f4);
  transition: width .25s ease;
}
body.dark-mode .topic-mastery { background: #34445d; }
@media (prefers-reduced-motion: reduce) {
  .topic-mastery > span { transition: none; }
}

/* Keep elements marked hidden invisible even when component styles set display:grid. */
[hidden] {
  display: none !important;
}

/* Explicitly preserve the hidden state of all collapsible student tools. */
#bookmark-list[hidden],
#guided-question-list[hidden],
#review-plan[hidden],
#progress-report[hidden],
#exam-clock[hidden],
#exam-submit[hidden] {
  display: none !important;
  visibility: hidden !important;
}


/* المرحلة التالية: صقل الواجهة التعليمية دون تغيير منطق الأسئلة */
:root {
  --ui-radius: 18px;
  --ui-shadow: 0 14px 36px rgba(19, 40, 73, .07);
}
body { -webkit-font-smoothing: antialiased; }
.top { border-bottom: 1px solid rgba(226,232,240,.8); }
.brand { letter-spacing: -.2px; }
.install-app-button { transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.install-app-button:hover { background: #f5f8ff; border-color: #9eb5fa; transform: translateY(-1px); }
.dashboard, #student-tools, #exam-tools, .question-card, .result-card { box-shadow: var(--ui-shadow); }
#student-tools {
  margin-top: 22px;
  padding: clamp(16px, 2.5vw, 24px);
  border-radius: var(--ui-radius);
  background: linear-gradient(145deg, #fff, #fbfcff);
}
#student-tools > h3 { display: flex; align-items: center; gap: 9px; }
#student-tools > h3::before {
  content: "✦";
  display: inline-grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 10px;
  background: #edf2ff;
  color: #315edb;
  font-size: 15px;
}
#student-tools .tools-actions { gap: 9px; }
#student-tools .tools-actions button {
  min-height: 42px;
  border-radius: 11px;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease;
}
#student-tools .tools-actions button:hover {
  border-color: #b7c8f7;
  background: #f7f9ff;
  box-shadow: 0 5px 14px rgba(49,94,219,.07);
  transform: translateY(-1px);
}
#student-tools .tools-actions button:active { transform: translateY(0); }
#exam-tools {
  margin-top: 20px;
  padding: clamp(16px, 2.5vw, 22px);
  border-radius: 16px;
  border-color: #dce5f5;
  background: linear-gradient(145deg, #f9fbff, #f1f5ff);
}
#exam-tools .exam-tools-heading .eyebrow { margin-bottom: 3px; }
#exam-tools .exam-tools-heading h3 { font-size: 20px; }
#exam-tools .exam-config { margin-top: 16px; gap: 12px; }
#exam-tools .exam-config label { min-width: 150px; flex: 1; }
#exam-tools select { width: 100%; min-height: 44px; }
#exam-tools button { min-height: 44px; }
#exam-tools .exam-note { margin-top: 12px; color: #6b7b94; font-size: 12px; }
.topic-card { box-shadow: 0 4px 16px rgba(25,48,86,.035); }
.topic-card:focus-visible { outline-offset: 4px; }
.search-box, .filter-panel, .stat-card { transition: border-color .18s ease, box-shadow .18s ease; }
.search-box:focus-within { box-shadow: 0 0 0 4px rgba(49,94,219,.09); }
#quiz .question-card { border-radius: 20px; }
#quiz .options { gap: 12px; }
#quiz .option { border-radius: 14px; padding: 14px 16px; }
#quiz .option:hover:not(:disabled) { transform: translateX(-2px); }
#results .result-card { border-radius: 22px; }
footer { border-top: 1px solid #e8edf5; }
footer a { color: #315edb; text-underline-offset: 3px; }
footer a:hover { color: #173da7; }
body.dark-mode #student-tools { background: linear-gradient(145deg, #182438, #111d30); }
body.dark-mode #exam-tools { background: linear-gradient(145deg, #182438, #111d30); border-color: #34445d; }
body.dark-mode #student-tools .tools-actions button:hover { background: #22324b; border-color: #526b95; }
body.dark-mode #exam-tools .exam-note { color: #a7b5ca; }
@media (max-width: 600px) {
  #student-tools { margin-top: 16px; }
  #student-tools .tools-actions button { flex: 1 1 145px; padding: 9px 10px; }
  #exam-tools .exam-config { display: grid; grid-template-columns: 1fr 1fr; }
  #exam-tools .exam-config label { min-width: 0; }
  #exam-tools .exam-config button { grid-column: 1 / -1; width: 100%; }
  #exam-tools .exam-tools-heading h3 { font-size: 18px; }
  #quiz .question-card { padding: 18px 15px; }
}
@media (prefers-reduced-motion: reduce) {
  .install-app-button, #student-tools .tools-actions button, #quiz .option { transition: none; }
  #quiz .option:hover:not(:disabled) { transform: none; }
}


/* Quick navigation cards: direct access to the three main learning paths */
.quick-start {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 22px;
}
.quick-start-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 15px;
  border: 1px solid #e3e9f4;
  border-radius: 16px;
  background: #fff;
  color: var(--ink, #19263b);
  text-decoration: none;
  box-shadow: 0 5px 18px rgba(25,48,86,.035);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.quick-start-card:hover {
  transform: translateY(-2px);
  border-color: #b7c8f7;
  box-shadow: 0 12px 25px rgba(49,94,219,.08);
}
.quick-start-card:focus-visible { outline: 3px solid #9eb5fa; outline-offset: 3px; }
.quick-start-icon {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  font-size: 21px;
  font-weight: 800;
}
.training-icon { background: #edf2ff; color: #315edb; }
.exam-icon { background: #e9f8f0; color: #168252; }
.review-icon { background: #fff5df; color: #a76b0a; }
.quick-start-copy { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.quick-start-copy strong { font-size: 13px; line-height: 1.6; }
.quick-start-copy small { color: #718096; font-size: 10px; line-height: 1.7; }
.quick-start-arrow { margin-inline-start: auto; color: #8a9ab4; font-size: 17px; transition: transform .18s ease; }
.quick-start-card:hover .quick-start-arrow { transform: translateX(-3px); color: #315edb; }
body.dark-mode .quick-start-card { background: #182438; border-color: #34445d; color: #e7edf8; }
body.dark-mode .quick-start-copy small { color: #a7b5ca; }
body.dark-mode .quick-start-arrow { color: #a7b5ca; }
@media (max-width: 760px) {
  .quick-start { grid-template-columns: 1fr; gap: 9px; margin: 14px 0 18px; }
  .quick-start-card { padding: 12px 14px; }
  .quick-start-icon { flex-basis: 38px; width: 38px; height: 38px; border-radius: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .quick-start-card, .quick-start-arrow { transition: none; }
  .quick-start-card:hover { transform: none; }
}


/* Topic cards: clearer hierarchy and visible topic-level progress */
.topic-grid { align-items: stretch; gap: 16px; }
.topic-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 205px;
  padding: 18px;
  overflow: hidden;
  text-align: right;
  border: 1px solid #e2e9f4;
  border-radius: 19px;
  background: linear-gradient(155deg, #fff 0%, #fbfcff 100%);
  box-shadow: 0 7px 22px rgba(25,48,86,.045);
}
.topic-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, #315edb, #8bb4ff);
  opacity: .8;
}
.topic-card:hover:not(:disabled) {
  transform: translateY(-3px);
  border-color: #b9caf5;
  box-shadow: 0 15px 30px rgba(49,94,219,.10);
}
.topic-card-top { display:flex; align-items:center; justify-content:space-between; margin-bottom:17px; }
.topic-number {
  display:grid; place-items:center; min-width:38px; height:34px; padding:0 8px;
  border-radius:11px; background:#edf2ff; color:#315edb; font-size:12px; font-weight:800;
}
.topic-arrow { display:grid; place-items:center; width:30px; height:30px; border-radius:9px; background:#f3f6fb; color:#8291aa; transition:transform .18s ease, color .18s ease; }
.topic-card:hover:not(:disabled) .topic-arrow { transform:translate(-2px,-2px); color:#315edb; }
.topic-card-content { display:flex; flex-direction:column; gap:7px; flex:1; }
.topic-title { font-size:16px; line-height:1.8; font-weight:800; color:#1c2d48; }
.topic-meta { font-size:12px; color:#718096; }
.topic-card-bottom { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:8px; margin-top:18px; padding-top:12px; border-top:1px solid #edf1f7; }
.topic-status { font-size:11px; color:#667792; }
.topic-start { font-size:12px; font-weight:800; color:#315edb; }
.topic-mastery { display:block; height:5px; margin-top:12px; overflow:hidden; border-radius:999px; background:#edf1f7; }
.topic-mastery > span { display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg,#315edb,#6ea1ff); transition:width .25s ease; }
.topic-card:focus-visible { outline:3px solid #8aa8ff; outline-offset:3px; }
.topic-card:disabled { opacity:.58; cursor:not-allowed; }
body.dark-mode .topic-card { background:linear-gradient(155deg,#182438,#142033); border-color:#34445d; }
body.dark-mode .topic-title { color:#e7edf8; }
body.dark-mode .topic-number { background:#243653; color:#b8ccff; }
body.dark-mode .topic-arrow { background:#22324b; color:#a7b5ca; }
body.dark-mode .topic-card-bottom { border-color:#34445d; }
body.dark-mode .topic-status, body.dark-mode .topic-meta { color:#a7b5ca; }
body.dark-mode .topic-mastery { background:#34445d; }
@media (max-width:600px) {
  .topic-grid { gap:11px; }
  .topic-card { min-height:180px; padding:15px; border-radius:16px; }
  .topic-title { font-size:15px; }
  .topic-card-top { margin-bottom:12px; }
  .topic-card-bottom { margin-top:13px; }
}
@media (prefers-reduced-motion:reduce) {
  .topic-card, .topic-arrow, .topic-mastery > span { transition:none; }
  .topic-card:hover:not(:disabled) { transform:none; }
}


/* لوحة متابعة تقدّم الطالب */
.learning-progress {
  margin: 16px 0 20px;
  padding: clamp(16px, 2.5vw, 22px);
  border: 1px solid #e2e9f4;
  border-radius: 18px;
  background: linear-gradient(145deg, #fff, #f8faff);
}
.learning-progress-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.learning-progress-heading h3 { margin:0 0 5px; font-size:18px; }
.learning-progress-heading p:not(.eyebrow) { margin:0; color:#718096; font-size:12px; line-height:1.8; }
.learning-progress-heading .eyebrow { margin:0 0 4px; }
.learning-progress-total { display:flex; flex-direction:column; align-items:center; min-width:90px; padding:10px 14px; border-radius:14px; background:#edf2ff; color:#315edb; }
.learning-progress-total strong { font-size:26px; line-height:1.3; }
.learning-progress-total span { font-size:11px; }
.learning-progress-track { height:9px; margin-top:17px; overflow:hidden; border-radius:999px; background:#e8edf5; }
.learning-progress-track > span { display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg,#315edb,#65a1ff); transition:width .3s ease; }
.learning-progress-caption { margin:9px 0 0; color:#667792; font-size:12px; line-height:1.8; }
body.dark-mode .learning-progress { background:linear-gradient(145deg,#182438,#111d30); border-color:#34445d; }
body.dark-mode .learning-progress-heading p:not(.eyebrow), body.dark-mode .learning-progress-caption { color:#a7b5ca; }
body.dark-mode .learning-progress-total { background:#243653; color:#b8ccff; }
body.dark-mode .learning-progress-track { background:#34445d; }
@media(max-width:600px) {
  .learning-progress-heading { align-items:flex-start; }
  .learning-progress-heading h3 { font-size:16px; }
  .learning-progress-total { min-width:72px; padding:8px 10px; }
  .learning-progress-total strong { font-size:22px; }
}
@media(prefers-reduced-motion:reduce) { .learning-progress-track > span { transition:none; } }


/* اجعل خاصية hidden موثوقة حتى لا تظهر اللوحات المغلقة بسبب أي قاعدة display أخرى. */
[hidden],
#student-tools[hidden],
#exam-tools[hidden],
#bookmark-list[hidden],
#guided-question-list[hidden],
#progress-report[hidden],
#review-plan[hidden] { display: none !important; }

/* تحسين عرض المعادلات الطويلة على الهاتف والشاشات الضيقة. */
.question-text, .feedback, .solution, .exam-review-question,
.exam-review-solution, .bookmark-list {
  min-width: 0;
  overflow-wrap: anywhere;
}
mjx-container[display="true"] {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-block: .2em;
}
mjx-container { max-width: 100%; }
@media (max-width: 600px) {
  .question-text mjx-container { font-size: 1em !important; }
  .exam-review-item mjx-container { font-size: .96em !important; }
}


/* رسومات رياضية مرافقة للأسئلة التي كانت تحيل إلى شكل مفقود. */
.question-diagram {
  margin: 14px 0 10px;
  padding: 12px;
  border: 1px solid var(--border, #d7deea);
  border-radius: 14px;
  background: var(--card, #fff);
  overflow: hidden;
}
.question-diagram figcaption {
  margin: 0 0 10px;
  color: var(--text-secondary, #52627a);
  font-size: .92rem;
  line-height: 1.7;
}
.question-diagram svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 460px;
  margin-inline: auto;
}
@media (max-width: 520px) {
  .question-diagram { padding: 7px; margin-block: 10px; }
  .question-diagram figcaption { font-size: .85rem; }
}


.joint-table-scroll { width: 100%; overflow-x: auto; }
.joint-probability-table {
  width: 100%;
  min-width: 300px;
  border-collapse: collapse;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--text, #172b4d);
}
.joint-probability-table caption {
  caption-side: top;
  padding: 4px 0 9px;
  font-weight: 700;
}
.joint-probability-table th,
.joint-probability-table td {
  padding: 8px 10px;
  border: 1px solid var(--border, #d7deea);
}
.joint-probability-table thead th,
.joint-probability-table tbody th {
  background: var(--surface-hover, #f1f5fb);
  font-weight: 700;
}
.joint-probability-table .joint-table-total {
  font-weight: 700;
  background: var(--surface-hover, #f1f5fb);
}


/* رموز بصرية تساعد الطالب على تمييز أبحاث المنهاج بسرعة */
.topic-subject-icon {
  display: inline-grid;
  place-items: center;
  align-self: flex-start;
  min-width: 44px;
  min-height: 44px;
  margin-bottom: 3px;
  padding: 4px 9px;
  border: 1px solid #dce6ff;
  border-radius: 14px;
  background: linear-gradient(145deg, #edf2ff, #f7f9ff);
  color: #315edb;
  font-size: 23px;
  font-weight: 800;
  line-height: 1.3;
  direction: ltr;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.85);
}
.topic-card-content { gap: 6px; }
.topic-title { overflow-wrap: anywhere; }
body.dark-mode .topic-subject-icon {
  background: linear-gradient(145deg, #243653, #1b2b43);
  border-color: #405579;
  color: #b8ccff;
  box-shadow: none;
}
@media (max-width: 600px) {
  .topic-subject-icon { min-width: 40px; min-height: 40px; font-size: 21px; border-radius: 12px; }
}


/* تغطية بنك الأسئلة: عدّ الأسئلة الفريدة دون احتساب إعادة المحاولة مرتين. */
.question-coverage {
  margin: 0 0 20px;
  padding: clamp(16px, 2.5vw, 22px);
  border: 1px solid #e2e9f4;
  border-radius: 18px;
  background: linear-gradient(145deg, #fff, #f8faff);
}
.question-coverage-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.question-coverage-heading h3 { margin:0 0 5px; font-size:18px; }
.question-coverage-heading p:not(.eyebrow) { margin:0; color:#718096; font-size:12px; line-height:1.8; }
.question-coverage-heading .eyebrow { margin:0 0 4px; }
.question-coverage-total { display:flex; flex-direction:column; align-items:center; min-width:90px; padding:10px 14px; border-radius:14px; background:#edf2ff; color:#315edb; }
.question-coverage-total strong { font-size:26px; line-height:1.3; }
.question-coverage-total span { font-size:11px; }
body.dark-mode .question-coverage { background:linear-gradient(145deg,#182438,#111d30); border-color:#34445d; }
body.dark-mode .question-coverage-heading p:not(.eyebrow) { color:#a7b5ca; }
body.dark-mode .question-coverage-total { background:#243653; color:#b8ccff; }
.topic-start { white-space:normal; }
@media(max-width:600px) {
  .question-coverage-heading { align-items:flex-start; }
  .question-coverage-heading h3 { font-size:16px; }
  .question-coverage-total { min-width:72px; padding:8px 10px; }
  .question-coverage-total strong { font-size:22px; }
}


/* الانتقال من تحليل المحاكاة إلى تدريب مباشر على البحث المحدد */
.exam-topic-result-heading { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.exam-topic-practice { display:inline-flex; align-items:center; justify-content:center; gap:8px; margin-top:10px; padding:8px 12px; border:1px solid #cbd8f8; border-radius:10px; background:#f2f5ff; color:#315edb; font:inherit; font-size:12px; font-weight:700; cursor:pointer; transition:background .18s ease, border-color .18s ease, transform .18s ease; }
.exam-topic-practice:hover { background:#e6edff; border-color:#9bb3f5; }
.exam-topic-practice:focus-visible { outline:3px solid #8ca9ff; outline-offset:2px; }
.exam-topic-practice:active { transform:translateY(1px); }
body.dark-mode .exam-topic-practice { background:#243653; color:#c5d4ff; border-color:#405579; }
body.dark-mode .exam-topic-practice:hover { background:#2b4164; }
@media(max-width:600px) { .exam-topic-practice { width:100%; } .exam-topic-result-heading { align-items:flex-start; flex-wrap:wrap; } }


/* عرض الحلول التفصيلية ومفتاح الفكرة بصورة واضحة في واجهة السؤال. */
.solution-key-idea {
  margin: 10px 0 12px;
  padding: 11px 13px;
  border-inline-start: 4px solid #5478d8;
  border-radius: 10px;
  background: #eef3ff;
  color: #243b69;
  line-height: 1.9;
}
.solution-key-idea > strong { display:block; margin-bottom:4px; }
.solution-steps { margin: 8px 0 2px; padding-inline-start: 1.6rem; }
.solution-steps li { padding: 4px 3px; line-height: 1.95; }
.solution-steps li::marker { color: #315edb; font-weight: 800; }
body.dark-mode .solution-key-idea {
  background: #20314d;
  border-inline-start-color: #9bb4ff;
  color: #e2eaff;
}
body.dark-mode .solution-steps li::marker { color: #b8ccff; }


/* Keep supplemental figures visually separate from the bold question prompt. */
.question-text > .question-diagram {
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.7;
}
.question-text > .question-diagram figcaption {
  font-weight: 400;
}
.question-text > .question-diagram .joint-probability-table {
  font-size: .95rem;
  font-weight: 400;
}
@media (max-width: 520px) {
  .question-text > .question-diagram .joint-probability-table th,
  .question-text > .question-diagram .joint-probability-table td {
    padding: 6px 7px;
  }
}


/* رابط تجاوز المحتوى لتحسين التنقل بلوحة المفاتيح وقارئات الشاشة */
.skip-link {
  position: fixed;
  z-index: 10000;
  top: 8px;
  right: 8px;
  transform: translateY(calc(-100% - 16px));
  padding: 10px 14px;
  border: 2px solid currentColor;
  border-radius: 10px;
  background: var(--card-bg, #fff);
  color: var(--text, #12233f);
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 4px 16px rgb(0 0 0 / 18%);
}
.skip-link:focus {
  transform: translateY(0);
}
#main-content:focus { outline: none; }


/* Keep the brand and install action usable on narrow phone headers. */
@media (max-width: 600px) {
  .top {
    height: auto;
    min-height: 62px;
    padding: 8px 14px;
    gap: 10px;
  }
  .top-actions {
    min-width: 0;
    gap: 8px;
  }
  .privacy-note { display: none; }
  .install-app-button {
    min-height: 40px;
    padding: 7px 9px;
    white-space: nowrap;
  }
}
@media (max-width: 420px) {
  .top { padding-inline: 12px; }
  .top .tag { display: none; }
  .brand { min-width: 0; gap: 7px; font-size: 14px; }
  .brand-symbol { flex: 0 0 34px; width: 34px; height: 34px; }
  .install-app-button { font-size: 12px; }
}


/* Compact mobile shortcuts: two primary paths, with review spanning the row. */
@media (max-width: 600px) {
  .quick-start {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }
  .quick-start-card {
    min-height: 76px;
    padding: 10px 11px;
    gap: 8px;
  }
  .quick-start-card:nth-child(3) {
    grid-column: 1 / -1;
  }
  .quick-start-card:nth-child(3) .quick-start-copy small {
    font-size: 11px;
  }
}


/* Clear-search control: visible only while the topic filter has text. */
.search-clear {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: #edf2ff;
  color: #3154b5;
  font: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.search-clear:hover { background: #dfe8ff; }
.search-clear:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
body.dark-mode .search-clear { background: #263958; color: #e7edf8; }
body.dark-mode .search-clear:hover { background: #344b70; }
.search-clear[hidden] { display: none !important; }


/* بطاقة العودة إلى آخر بحث تدريبي، مع عرض واضح على الهاتف والوضع الليلي. */
.resume-session {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  margin:0 0 20px;
  padding:18px 20px;
  border:1px solid #cbd8f8;
  border-radius:16px;
  background:linear-gradient(135deg,#f2f6ff,#fff);
  color:#172b4d;
}
.resume-session[hidden] { display:none !important; }
.resume-session-copy { min-width:0; }
.resume-session .eyebrow { margin:0 0 4px; }
.resume-session h3 { margin:0 0 5px; font-size:18px; }
.resume-session p:not(.eyebrow) { margin:0; color:#64748b; font-size:13px; line-height:1.7; }
.resume-session p strong { color:#315edb; }
.resume-topic-button {
  flex:0 0 auto;
  min-height:44px;
  padding:10px 15px;
  border:0;
  border-radius:11px;
  background:#315edb;
  color:#fff;
  font:inherit;
  font-size:13px;
  font-weight:700;
  cursor:pointer;
}
.resume-topic-button:hover { background:#254bb8; }
.resume-topic-button:focus-visible { outline:3px solid #8ca9ff; outline-offset:3px; }
body.dark-mode .resume-session {
  border-color:#405579;
  background:linear-gradient(135deg,#20314d,#182438);
  color:#e7edf8;
}
body.dark-mode .resume-session p:not(.eyebrow) { color:#a7b5ca; }
body.dark-mode .resume-session p strong { color:#b8ccff; }
@media(max-width:600px) {
  .resume-session { align-items:stretch; flex-direction:column; padding:15px; gap:12px; }
  .resume-session h3 { font-size:16px; }
  .resume-topic-button { width:100%; }
}


/* سجل آخر الأبحاث التي تدرب عليها الطالب. */
.recent-activity {
  margin: 0 0 22px;
  padding: 18px 20px;
  border: 1px solid #d9e3f2;
  border-radius: 16px;
  background: #fff;
  color: #172b4d;
}
.recent-activity[hidden] { display: none !important; }
.recent-activity-heading h3 { margin: 0 0 5px; font-size: 18px; }
.recent-activity-heading p:not(.eyebrow) { margin: 0; color: #64748b; font-size: 13px; line-height: 1.7; }
.recent-activity-heading .eyebrow { margin: 0 0 4px; }
.recent-activity-list { display: grid; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.recent-activity-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid #e5ebf4;
  border-radius: 12px;
  background: #f8faff;
}
.recent-activity-details { display: grid; gap: 3px; min-width: 0; }
.recent-activity-details strong { color: #1e3558; font-size: 14px; }
.recent-activity-details span,
.recent-activity-details time { color: #64748b; font-size: 12px; }
.recent-activity-button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid #cbd8f8;
  border-radius: 10px;
  background: #fff;
  color: #3154b5;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.recent-activity-button:hover { background: #edf2ff; }
.recent-activity-button:focus-visible { outline: 3px solid #8ca9ff; outline-offset: 2px; }
body.dark-mode .recent-activity { border-color: #405579; background: #182438; color: #e7edf8; }
body.dark-mode .recent-activity-heading p:not(.eyebrow),
body.dark-mode .recent-activity-details span,
body.dark-mode .recent-activity-details time { color: #a7b5ca; }
body.dark-mode .recent-activity-item { border-color: #34445d; background: #202f47; }
body.dark-mode .recent-activity-details strong { color: #e7edf8; }
body.dark-mode .recent-activity-button { border-color: #52698d; background: #263958; color: #dbe7ff; }
body.dark-mode .recent-activity-button:hover { background: #344b70; }
@media(max-width:600px) {
  .recent-activity { padding: 15px; }
  .recent-activity-item { align-items: stretch; flex-direction: column; gap: 9px; }
  .recent-activity-button { width: 100%; }
}


/* مخطط مبسّط لتغيّر دقة الإجابات خلال الأسبوع الأخير. */
.performance-trend {
  margin: 0 0 22px;
  padding: 18px 20px;
  border: 1px solid #d9e3f2;
  border-radius: 16px;
  background: #fff;
  color: #172b4d;
}
.performance-trend[hidden] { display: none !important; }
.performance-trend-heading h3 { margin: 0 0 5px; font-size: 18px; }
.performance-trend-heading p:not(.eyebrow) { margin: 0; color: #64748b; font-size: 13px; line-height: 1.7; }
.performance-trend-heading .eyebrow { margin: 0 0 4px; }
.performance-trend-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: end;
  gap: 10px;
  min-height: 178px;
  margin: 18px 0 0;
  padding: 12px 0 0;
  list-style: none;
  border-bottom: 1px solid #dfe7f2;
}
.performance-trend-day {
  display: grid;
  grid-template-rows: 20px 104px auto auto;
  align-items: end;
  justify-items: center;
  gap: 5px;
  min-width: 0;
}
.performance-trend-rate { color: #3154b5; font-size: 11px; }
.performance-trend-track {
  display: flex;
  align-items: end;
  justify-content: center;
  width: min(100%, 30px);
  height: 100%;
  overflow: hidden;
  border-radius: 8px 8px 3px 3px;
  background: #edf2fa;
}
.performance-trend-fill {
  display: block;
  width: 100%;
  min-height: 0;
  border-radius: 7px 7px 2px 2px;
  background: linear-gradient(180deg, #6488ed, #3154b5);
  transition: height .25s ease;
}
.performance-trend-label { color: #334155; font-size: 12px; font-weight: 700; }
.performance-trend-count { color: #64748b; font-size: 10px; white-space: nowrap; }
.performance-trend-summary { margin: 12px 0 0; color: #64748b; font-size: 13px; text-align: center; }
body.dark-mode .performance-trend { border-color: #405579; background: #182438; color: #e7edf8; }
body.dark-mode .performance-trend-heading p:not(.eyebrow),
body.dark-mode .performance-trend-summary,
body.dark-mode .performance-trend-count { color: #a7b5ca; }
body.dark-mode .performance-trend-rate { color: #b8ccff; }
body.dark-mode .performance-trend-track { background: #293a55; }
body.dark-mode .performance-trend-fill { background: linear-gradient(180deg, #91aaff, #5276d6); }
body.dark-mode .performance-trend-label { color: #e7edf8; }
body.dark-mode .performance-trend-chart { border-color: #405579; }
@media(max-width:600px) {
  .performance-trend { padding: 15px; }
  .performance-trend-chart { gap: 5px; min-height: 165px; }
  .performance-trend-day { grid-template-rows: 18px 96px auto auto; gap: 4px; }
  .performance-trend-count { font-size: 9px; }
}


/* حالة واضحة وملخص إجابات مختصر داخل كل بطاقة بحث. */
.topic-card-top { display: flex; align-items: center; gap: 8px; }
.topic-state {
  display: inline-flex;
  align-items: center;
  max-width: calc(100% - 82px);
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.5;
}
.topic-state.not-started { background: #f1f4f8; color: #64748b; }
.topic-state.in-progress { background: #edf3ff; color: #3154b5; }
.topic-state.covered { background: #e9f7ef; color: #247447; }
.topic-card-performance {
  display: block;
  margin-top: 8px;
  color: #64748b;
  font-size: 11px;
  line-height: 1.7;
}
body.dark-mode .topic-state.not-started { background: #29384d; color: #b6c2d4; }
body.dark-mode .topic-state.in-progress { background: #263b61; color: #c1d2ff; }
body.dark-mode .topic-state.covered { background: #1f4939; color: #a9e4c3; }
body.dark-mode .topic-card-performance { color: #a7b5ca; }
@media(max-width:600px) {
  .topic-state { font-size: 9px; padding: 4px 6px; }
  .topic-card-performance { font-size: 10px; }
}


/* اقتراح البحث الأقل أداءً: يظهر فقط بعد وجود نتائج فعلية. */
.weak-topic-recommendation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 18px 0;
  padding: 18px 20px;
  border: 1px solid #d9e3f2;
  border-radius: 16px;
  background: #f7f9ff;
  color: #172b4d;
}
.weak-topic-recommendation[hidden] { display: none !important; }
.weak-topic-copy { min-width: 0; }
.weak-topic-copy .eyebrow { margin: 0 0 4px; }
.weak-topic-copy h3 { margin: 0 0 6px; font-size: 17px; }
.weak-topic-name { margin: 0 0 4px; font-weight: 800; }
.weak-topic-detail { margin: 0; color: #64748b; font-size: 12px; line-height: 1.8; }
.weak-topic-action { display: grid; justify-items: center; gap: 5px; flex: 0 0 auto; }
.weak-topic-action strong { font-size: 25px; line-height: 1.2; color: #3154b5; }
.weak-topic-action span { color: #64748b; font-size: 10px; }
.weak-topic-action button {
  margin-top: 4px;
  padding: 9px 12px;
  border: 0;
  border-radius: 9px;
  background: #3154b5;
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.weak-topic-action button:focus-visible { outline: 3px solid #8da9f4; outline-offset: 3px; }
body.dark-mode .weak-topic-recommendation { background: #182438; border-color: #405579; color: #e7edf8; }
body.dark-mode .weak-topic-detail, body.dark-mode .weak-topic-action span { color: #a7b5ca; }
body.dark-mode .weak-topic-action strong { color: #b8ccff; }
@media(max-width:600px) {
  .weak-topic-recommendation { align-items: stretch; flex-direction: column; padding: 15px; gap: 12px; }
  .weak-topic-action { grid-template-columns: auto 1fr; justify-items: start; align-items: center; }
  .weak-topic-action button { grid-column: 1 / -1; width: 100%; min-height: 44px; }
}


/* مستوى إتقان البحث: مستقل عن مؤشر تغطية الأسئلة. */
.topic-mastery-status {
  display: inline-flex;
  align-self: flex-start;
  margin-top: 7px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.5;
  background: #f1f4f8;
  color: #64748b;
}
.topic-mastery-status.practice { background: #fff4df; color: #98600b; }
.topic-mastery-status.good { background: #edf3ff; color: #3154b5; }
.topic-mastery-status.mastered { background: #e9f7ef; color: #247447; }
body.dark-mode .topic-mastery-status { background: #29384d; color: #b6c2d4; }
body.dark-mode .topic-mastery-status.practice { background: #49391f; color: #ffd58a; }
body.dark-mode .topic-mastery-status.good { background: #263b61; color: #c1d2ff; }
body.dark-mode .topic-mastery-status.mastered { background: #1f4939; color: #a9e4c3; }
@media(max-width:600px) { .topic-mastery-status { font-size: 10px; } }

/* تقويم النشاط الدراسي: عرض الأيام النشطة دون تعديل سجل التقدم الأصلي. */
.activity-calendar { margin:0 0 22px; padding:clamp(16px,2.5vw,22px); border:1px solid #e2e9f4; border-radius:18px; background:linear-gradient(145deg,#fff,#f8faff); }
.activity-calendar-heading h3 { margin:0 0 5px; font-size:18px; }
.activity-calendar-heading p:not(.eyebrow) { margin:0; color:#718096; font-size:12px; line-height:1.8; }
.activity-calendar-heading .eyebrow { margin:0 0 4px; }
.activity-calendar-grid { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:7px; margin:16px 0 10px; padding:0; list-style:none; }
.activity-calendar-day { display:grid; place-items:center; min-width:0; aspect-ratio:1; border:1px solid #e3e9f4; border-radius:9px; background:#f1f4f9; color:#748198; font-size:12px; font-weight:700; font-variant-numeric:tabular-nums; }
.activity-calendar-day.level-1, .activity-calendar-legend .level-1 { background:#dce8ff; border-color:#c6d8ff; color:#315edb; }
.activity-calendar-day.level-2, .activity-calendar-legend .level-2 { background:#a9c4ff; border-color:#9ab8fa; color:#173d91; }
.activity-calendar-day.level-3, .activity-calendar-legend .level-3 { background:#638fe8; border-color:#638fe8; color:#fff; }
.activity-calendar-day.level-4, .activity-calendar-legend .level-4 { background:#315edb; border-color:#315edb; color:#fff; }
.activity-calendar-legend { display:flex; align-items:center; justify-content:flex-end; gap:5px; color:#718096; font-size:10px; }
.activity-calendar-legend i { display:inline-block; width:13px; height:13px; border:1px solid #e3e9f4; border-radius:4px; background:#f1f4f9; }
.activity-calendar-summary { margin:12px 0 0; color:#52627a; font-size:13px; font-weight:700; }
body.dark-mode .activity-calendar { background:linear-gradient(145deg,#182438,#111d30); border-color:#34445d; }
body.dark-mode .activity-calendar-heading p:not(.eyebrow), body.dark-mode .activity-calendar-summary, body.dark-mode .activity-calendar-legend { color:#a7b5ca; }
body.dark-mode .activity-calendar-day.level-0, body.dark-mode .activity-calendar-legend .level-0 { background:#24324a; border-color:#34445d; color:#a7b5ca; }
body.dark-mode .activity-calendar-day.level-1, body.dark-mode .activity-calendar-legend .level-1 { background:#294779; border-color:#355b96; color:#e7edf8; }
body.dark-mode .activity-calendar-day.level-2, body.dark-mode .activity-calendar-legend .level-2 { background:#3768b7; border-color:#4778c8; color:#fff; }
body.dark-mode .activity-calendar-day.level-3, body.dark-mode .activity-calendar-legend .level-3 { background:#5687d8; border-color:#5687d8; color:#fff; }
body.dark-mode .activity-calendar-day.level-4, body.dark-mode .activity-calendar-legend .level-4 { background:#83aaff; border-color:#83aaff; color:#10264c; }
@media(max-width:600px){.activity-calendar-heading h3{font-size:16px}.activity-calendar-grid{gap:5px}.activity-calendar-day{border-radius:7px;font-size:11px}}

/* إنجازات الطالب: شارات خفيفة تُحسب مباشرة من التقدم المحفوظ. */
.achievement-section { margin:0 0 22px; padding:clamp(16px,2.5vw,22px); border:1px solid #e2e9f4; border-radius:18px; background:#fff; }
.achievement-heading { display:flex; align-items:flex-end; justify-content:space-between; gap:14px; }
.achievement-heading h3 { margin:0 0 5px; font-size:18px; }
.achievement-heading p:not(.eyebrow) { margin:0; color:#718096; font-size:12px; line-height:1.8; }
.achievement-heading .eyebrow { margin:0 0 4px; }
.achievement-heading > strong { flex:0 0 auto; color:#3154b5; font-size:12px; }
.achievement-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; margin:16px 0 0; padding:0; list-style:none; }
.achievement-card { display:flex; align-items:center; gap:10px; min-width:0; padding:11px; border:1px solid #e5eaf2; border-radius:13px; background:#f8faff; }
.achievement-card.is-locked { opacity:.72; background:#f7f8fa; }
.achievement-icon { display:grid; place-items:center; flex:0 0 38px; width:38px; height:38px; border-radius:11px; background:#e7efff; font-size:20px; }
.achievement-copy { display:grid; gap:2px; min-width:0; flex:1; }
.achievement-copy strong { color:#243653; font-size:12px; }
.achievement-copy span { color:#64748b; font-size:10px; line-height:1.6; }
.achievement-copy small { color:#3154b5; font-size:10px; font-weight:700; }
.achievement-status { flex:0 0 auto; padding:4px 7px; border-radius:999px; background:#edf1f6; color:#64748b; font-size:9px; font-weight:800; }
.achievement-card.is-unlocked { border-color:#cfe7d8; background:#f4fbf6; }
.achievement-card.is-unlocked .achievement-icon { background:#e1f3e7; }
.achievement-card.is-unlocked .achievement-status { background:#e2f4e8; color:#247447; }
body.dark-mode .achievement-section { background:#182438; border-color:#34445d; }
body.dark-mode .achievement-heading p:not(.eyebrow) { color:#a7b5ca; }
body.dark-mode .achievement-heading > strong, body.dark-mode .achievement-copy small { color:#b8ccff; }
body.dark-mode .achievement-card, body.dark-mode .achievement-card.is-locked { background:#202f46; border-color:#34445d; }
body.dark-mode .achievement-card.is-unlocked { background:#1b3a32; border-color:#35614f; }
body.dark-mode .achievement-copy strong { color:#e7edf8; }
body.dark-mode .achievement-copy span { color:#a7b5ca; }
body.dark-mode .achievement-icon { background:#2b4164; }
body.dark-mode .achievement-card.is-unlocked .achievement-icon { background:#28513f; }
body.dark-mode .achievement-status { background:#29384d; color:#b6c2d4; }
body.dark-mode .achievement-card.is-unlocked .achievement-status { background:#28513f; color:#a9e4c3; }
@media(max-width:600px){.achievement-heading{align-items:flex-start;flex-direction:column}.achievement-heading h3{font-size:16px}.achievement-list{grid-template-columns:1fr}.achievement-card{padding:10px}}


/* نسبة إنجاز الأسئلة داخل جلسة التدريب */
#quiz .quiz-head { flex-wrap:wrap; }
#quiz .progress-percent { flex:0 0 auto; color:#3154b5; font-size:12px; font-weight:800; font-variant-numeric:tabular-nums; }
#quiz .progress-track { overflow:hidden; }
#quiz .progress-track > #progress-bar { min-width:0; transition:width .22s ease; }
body.dark-mode #quiz .progress-percent { color:#b8ccff; }
@media(max-width:600px){#quiz .quiz-head{align-items:center;gap:8px}#quiz .progress-percent{margin-inline-start:auto}}
@media(prefers-reduced-motion:reduce){#quiz .progress-track > #progress-bar{transition:none}}


/* ملخص أرقام جلسة التدريب الحالية. */
.session-progress-summary { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:9px; margin:10px 0 18px; }
.session-progress-summary > div { display:flex; align-items:center; justify-content:space-between; gap:8px; min-width:0; padding:10px 12px; border:1px solid #e2e9f4; border-radius:12px; background:#f8faff; }
.session-progress-summary span { color:#718096; font-size:11px; }
.session-progress-summary strong { color:#243653; font-size:13px; font-variant-numeric:tabular-nums; white-space:nowrap; }
body.dark-mode .session-progress-summary > div { background:#202f46; border-color:#34445d; }
body.dark-mode .session-progress-summary span { color:#a7b5ca; }
body.dark-mode .session-progress-summary strong { color:#e7edf8; }
@media(max-width:600px) { .session-progress-summary { gap:6px; } .session-progress-summary > div { flex-direction:column; align-items:flex-start; padding:9px; } .session-progress-summary span { font-size:10px; } .session-progress-summary strong { font-size:12px; } }


/* ملخص نهاية الجلسة وإعادة تدريب أخطائها فقط. */
.session-result-review { margin:18px 0; padding:16px; border:1px solid #e2e9f4; border-radius:14px; background:#f8faff; text-align:right; }
.session-result-review h3 { margin:0 0 12px; color:#243653; font-size:16px; }
.session-mistake-list { display:grid; gap:9px; margin:0 0 14px; padding-inline-start:24px; }
.session-mistake-list li { padding:9px 11px; border:1px solid #e5eaf2; border-radius:10px; background:#fff; }
.session-mistake-list li strong { display:block; color:#3154b5; font-size:12px; }
.session-mistake-list li p { margin:5px 0 0; color:#52627a; font-size:12px; line-height:1.8; overflow-wrap:anywhere; }
#retry-session-mistakes { min-height:42px; }
body.dark-mode .session-result-review { background:#182438; border-color:#34445d; }
body.dark-mode .session-result-review h3 { color:#e7edf8; }
body.dark-mode .session-mistake-list li { background:#202f46; border-color:#34445d; }
body.dark-mode .session-mistake-list li p { color:#a7b5ca; }
@media(max-width:600px){.session-result-review{padding:12px}.session-mistake-list{padding-inline-start:20px}#retry-session-mistakes{width:100%}}


/* ورقة أسئلة محاكاة الامتحان: تنقّل سريع وعلامات مراجعة واضحة. */
.exam-question-nav { margin:14px 0 18px; padding:13px; border:1px solid #dbe4f2; border-radius:13px; background:#f7f9fd; }
.exam-question-nav[hidden] { display:none !important; }
.exam-nav-toolbar { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:11px; }
.exam-nav-toolbar p { margin:0; color:#52627a; font-size:12px; font-weight:700; line-height:1.7; }
#exam-mark-question { flex:0 0 auto; min-height:40px; padding:7px 10px; border:1px solid #cbd8f8; border-radius:9px; background:#fff; color:#3154b5; font:inherit; font-size:12px; font-weight:700; cursor:pointer; }
#exam-mark-question[aria-pressed="true"] { background:#fff5d9; border-color:#e8c66e; color:#825b08; }
.exam-nav-grid { display:grid; grid-template-columns:repeat(10,minmax(0,1fr)); gap:7px; }
.exam-nav-number { position:relative; min-width:0; min-height:38px; border:1px solid #d8e0ec; border-radius:9px; background:#fff; color:#40516a; font:inherit; font-size:12px; font-weight:800; cursor:pointer; }
.exam-nav-number.is-answered { background:#e9f6ee; border-color:#b8ddc5; color:#247447; }
.exam-nav-number.is-marked::after { content:""; position:absolute; inset-block-start:4px; inset-inline-end:4px; width:6px; height:6px; border-radius:50%; background:#d39a22; }
.exam-nav-number.is-current { outline:3px solid #8ca9ff; outline-offset:1px; border-color:#3154b5; }
#options .option.exam-selected { outline:3px solid #6488ed; outline-offset:1px; border-color:#3154b5; }
.exam-answer-skipped { color:#98600b; font-weight:800; }
body.dark-mode .exam-question-nav { background:#111d30; border-color:#405579; }
body.dark-mode .exam-nav-toolbar p { color:#a7b5ca; }
body.dark-mode #exam-mark-question { background:#202f46; border-color:#405579; color:#c5d4ff; }
body.dark-mode #exam-mark-question[aria-pressed="true"] { background:#49391f; border-color:#8a6b32; color:#ffd58a; }
body.dark-mode .exam-nav-number { background:#202f46; border-color:#405579; color:#e7edf8; }
body.dark-mode .exam-nav-number.is-answered { background:#1f4939; border-color:#35614f; color:#a9e4c3; }
body.dark-mode .exam-nav-number.is-current { border-color:#91aaff; }
body.dark-mode #options .option.exam-selected { border-color:#91aaff; }
body.dark-mode .exam-answer-skipped { color:#ffd58a; }
@media(max-width:600px) {
  .exam-question-nav { padding:10px; }
  .exam-nav-toolbar { align-items:stretch; flex-direction:column; }
  #exam-mark-question { width:100%; }
  .exam-nav-grid { grid-template-columns:repeat(5,minmax(0,1fr)); gap:6px; }
  .exam-nav-number { min-height:42px; }
}


/* حقول الإجابة للأسئلة الرقمية والنصية */
.typed-answer-form {
  display: grid;
  gap: 10px;
  max-width: 520px;
  margin: 12px auto;
  text-align: right;
}
.typed-answer-form label {
  font-weight: 700;
  color: inherit;
}
.typed-answer-form input {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  color: #17243b;
  font: inherit;
  font-size: 16px;
}
.typed-answer-form input:disabled {
  opacity: .75;
  cursor: not-allowed;
}
.typed-answer-submit {
  justify-self: start;
  min-height: 44px;
}
body.dark-mode .typed-answer-form input {
  border-color: #40516b;
  background: #182438;
  color: #e7edf8;
}

/* الآلة الحاسبة العلمية */
.scientific-calculator {
  margin: 18px 0 26px; padding: 20px; border: 1px solid var(--line);
  border-radius: 16px; background: var(--card-bg, #fff); color: var(--text, #17243b);
  box-shadow: var(--ui-shadow);
}
.scientific-calculator[hidden] { display: none !important; }
.calculator-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; }
.calculator-heading h3 { margin:0 0 5px; font-size:19px; }
.calculator-heading p:not(.eyebrow) { margin:0 0 14px; color:var(--muted); font-size:13px; line-height:1.7; }
.calculator-heading .eyebrow { margin:0 0 4px; }
#calculator-angle, .calculator-keys button, .calculator-history-item {
  min-height:44px; padding:9px 12px; border:1px solid var(--line); border-radius:10px;
  background:var(--card-bg, #fff); color:inherit; font:inherit; cursor:pointer;
}
#calculator-angle { flex:0 0 auto; font-size:12px; font-weight:700; }
.calculator-display-label { display:block; margin:8px 0 6px; font-size:13px; font-weight:700; }
.calculator-display {
  width:100%; min-height:54px; padding:12px 14px; border:1px solid var(--line);
  border-radius:11px; background:var(--page-bg, #f8fafc); color:inherit;
  font:inherit; font-size:18px; direction:ltr; text-align:left;
}
.calculator-display:focus-visible, .calculator-keys button:focus-visible, #calculator-angle:focus-visible {
  outline:3px solid var(--focus-ring, #6488ed); outline-offset:2px;
}
.calculator-help { margin:7px 0 12px; color:var(--muted); font-size:12px; line-height:1.7; }
.calculator-output { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 14px; border-radius:11px; background:var(--soft-bg, #edf2ff); }
.calculator-output span { color:var(--muted); font-size:13px; }
.calculator-output strong { direction:ltr; overflow-wrap:anywhere; font-size:23px; }
.calculator-message { min-height:22px; margin:6px 0; color:var(--muted); font-size:12px; }
.calculator-keys { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; margin-top:10px; }
.calculator-keys button { min-width:0; font-weight:700; }
.calculator-keys button:hover, #calculator-angle:hover, .calculator-history-item:hover { background:var(--soft-bg, #edf2ff); }
.calculator-keys .calculator-clear { grid-column:span 2; }
.calculator-keys .calculator-equals { grid-column:1/-1; background:var(--primary, #315edb); color:#fff; border-color:transparent; }
.calculator-history-wrap { margin-top:14px; }
.calculator-history-wrap h4 { margin:0 0 7px; font-size:14px; }
.calculator-history { display:grid; gap:6px; margin:0; padding:0; list-style:none; }
.calculator-history-item { width:100%; text-align:left; direction:ltr; overflow-wrap:anywhere; font-size:12px; }
body.dark-mode .scientific-calculator { border-color:#405579; background:linear-gradient(145deg,#182438,#111d30); }
body.dark-mode .calculator-display { border-color:#405579; background:#101827; }
body.dark-mode .calculator-output { background:#243653; }
body.dark-mode .calculator-keys button, body.dark-mode #calculator-angle, body.dark-mode .calculator-history-item { border-color:#405579; background:#202f47; color:#e7edf8; }
body.dark-mode .calculator-keys .calculator-equals { background:#315edb; }
@media(max-width:600px) {
  .scientific-calculator { padding:14px; }
  .calculator-heading { flex-direction:column; }
  #calculator-angle { width:100%; }
  .calculator-keys { gap:6px; }
  .calculator-keys button { min-height:48px; padding:7px 4px; }
}


/* Interactive function plotter */
.function-plotter {
  margin:18px 0 26px;padding:18px;border:1px solid var(--border,#d9e1ed);
  border-radius:16px;background:var(--card-bg,#fff);color:var(--text,#17243b);
}
.function-plotter[hidden] { display:none !important; }
.plotter-heading h3 { margin:0 0 6px;font-size:19px; }
.plotter-heading p:not(.eyebrow) { margin:0 0 14px;color:var(--muted);font-size:13px;line-height:1.7; }
.plotter-heading .eyebrow { margin:0 0 4px; }
.plotter-controls { display:grid;grid-template-columns:minmax(0,1fr) auto minmax(76px,.3fr) auto minmax(76px,.3fr) auto minmax(110px,.4fr) auto;align-items:end;gap:9px; }
.plotter-controls label { font-size:12px;font-weight:700; }
.plotter-controls input,.plotter-controls select {
  min-width:0;width:100%;min-height:42px;padding:8px 10px;border:1px solid var(--border,#d9e1ed);
  border-radius:9px;background:var(--input-bg,#fff);color:inherit;font:inherit;
}
.plotter-controls #plotter-expression { grid-column:1/-1;direction:ltr;text-align:left;font-family:ui-monospace,monospace;font-size:16px; }
.plotter-controls button { min-height:42px;padding:8px 15px;border:0;border-radius:9px;background:var(--primary,#315edb);color:#fff;font:inherit;font-weight:700;cursor:pointer; }
.plotter-controls button:focus-visible,.plotter-controls input:focus-visible,.plotter-controls select:focus-visible { outline:3px solid #91aaff;outline-offset:2px; }
.plotter-help,.plotter-message { color:var(--muted);font-size:12px;line-height:1.7; }
.plotter-help { margin:9px 0 12px; }
.plotter-message { min-height:22px;margin:8px 0 0; }
.plotter-graph-wrap { width:100%;overflow:hidden;border:1px solid var(--border,#d9e1ed);border-radius:12px;background:var(--plot-bg,#fbfcff); }
#function-plotter-graph { display:block;width:100%;height:auto;min-height:220px; }
.plotter-grid-line { stroke:var(--plot-grid,#e4eaf3);stroke-width:1; }
.plotter-axis { stroke:var(--muted,#64748b);stroke-width:1.6; }
.plotter-axis-label { fill:var(--muted,#64748b);font-size:11px; }
.plotter-axis-title { fill:var(--text,#17243b);font-size:14px;font-weight:700; }
.plotter-function-line { fill:none;stroke:var(--primary,#315edb);stroke-width:3;stroke-linecap:round;stroke-linejoin:round; }
body.dark-mode .function-plotter { background:linear-gradient(145deg,#182438,#111d30);border-color:#405579;color:#e7edf8; }
body.dark-mode .plotter-controls input,body.dark-mode .plotter-controls select { background:#101827;border-color:#405579;color:#e7edf8; }
body.dark-mode .plotter-graph-wrap { background:#101827;border-color:#405579; }
body.dark-mode .plotter-grid-line { stroke:#293a55; }
body.dark-mode .plotter-axis-label { fill:#a7b5ca; }
body.dark-mode .plotter-axis-title { fill:#e7edf8; }
@media(max-width:760px) {
  .function-plotter { padding:14px; }
  .plotter-controls { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .plotter-controls #plotter-expression { grid-column:1/-1; }
  .plotter-controls button { grid-column:1/-1;width:100%;min-height:48px; }
  #function-plotter-graph { min-height:180px; }
}
@media(prefers-reduced-motion:reduce) { .plotter-function-line { transition:none; } }

.geometry-tools{margin:18px 0 26px;padding:18px;border:1px solid var(--border,#d9e1ed);border-radius:16px;background:var(--card-bg,#fff);color:var(--text,#17243b)}
.geometry-tools[hidden]{display:none!important}.geometry-controls{display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin:12px 0}.geometry-controls label{font-size:13px;font-weight:700}.geometry-controls select,.geometry-controls button{font:inherit;min-height:42px;padding:8px 12px;border:1px solid var(--border,#d9e1ed);border-radius:9px;background:var(--input-bg,#fff);color:inherit}.geometry-controls button{background:var(--primary,#315edb);color:#fff;border:0;cursor:pointer}
.geometry-board-wrap{width:100%;overflow:hidden;border:1px solid var(--border,#d9e1ed);border-radius:12px;background:var(--plot-bg,#fbfcff)}#geometry-board{display:block;width:100%;height:auto;touch-action:pan-y}.geometry-grid{stroke:var(--plot-grid,#e4eaf3);stroke-width:1}.geometry-shape{fill:rgba(49,94,219,.12);stroke:var(--primary,#315edb);stroke-width:3;stroke-linejoin:round}.geometry-radius{stroke:#d97706;stroke-width:2;stroke-dasharray:6 4}.geometry-handle{fill:#d97706;stroke:#fff;stroke-width:3;cursor:grab;touch-action:none}.geometry-metrics{margin:12px 0 4px;font-weight:700;line-height:1.8}.geometry-message{margin:0;color:var(--muted);font-size:12px}
body.dark-mode .geometry-tools{background:#182438;border-color:#405579;color:#e7edf8}body.dark-mode .geometry-controls select{background:#101827;border-color:#405579;color:#e7edf8}body.dark-mode .geometry-board-wrap{background:#101827;border-color:#405579}body.dark-mode .geometry-grid{stroke:#293a55}
@media(max-width:600px){.geometry-tools{padding:14px}.geometry-controls{display:grid;grid-template-columns:1fr 1fr}.geometry-controls label{grid-column:1/-1}.geometry-controls select,.geometry-controls button{width:100%;min-width:0;min-height:46px}.geometry-metrics{font-size:13px}}

/* Mathematics formula library */
.formula-library{margin:18px 0 26px;padding:18px;border:1px solid var(--border,#d9e1ed);border-radius:16px;background:var(--card-bg,#fff);color:var(--text,#17243b)}
.formula-library[hidden]{display:none!important}.formula-library-heading{display:flex;justify-content:space-between;align-items:center;gap:12px}.formula-library-heading h3{margin:0 0 6px;font-size:19px}.formula-library-heading p:not(.eyebrow){margin:0;color:var(--muted);font-size:13px;line-height:1.7}.formula-count{white-space:nowrap;font-size:12px;color:var(--muted)}
.formula-filters{display:grid;grid-template-columns:minmax(0,2fr) minmax(150px,1fr);gap:8px 12px;margin:16px 0}.formula-filters label{font-size:13px;font-weight:700}.formula-filters input,.formula-filters select{width:100%;min-width:0;min-height:44px;padding:9px 12px;border:1px solid var(--border,#d9e1ed);border-radius:9px;background:var(--input-bg,#fff);color:inherit;font:inherit}.formula-filters label:nth-of-type(2){grid-column:2;grid-row:1}.formula-filters select{grid-column:2;grid-row:2}.formula-filters input{grid-column:1;grid-row:2}
.formula-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,280px),1fr));gap:12px}.formula-card{min-width:0;padding:14px;border:1px solid var(--border,#d9e1ed);border-radius:12px;background:var(--surface,#f9fbff)}.formula-card-heading{display:flex;justify-content:space-between;align-items:flex-start;gap:8px}.formula-card h4{margin:0;font-size:15px;line-height:1.6}.formula-category-tag{flex:none;padding:3px 8px;border-radius:20px;background:var(--surface-hover,#edf2ff);font-size:11px;color:var(--muted)}.formula-expression{overflow-x:auto;padding:14px 4px;text-align:center;font-size:18px;direction:ltr}.formula-note{margin:4px 0 12px;color:var(--muted);font-size:12px;line-height:1.8}.formula-copy{min-height:38px;padding:7px 12px;border:1px solid var(--border,#d9e1ed);border-radius:8px;background:var(--card-bg,#fff);color:inherit;font:inherit;font-size:12px;cursor:pointer}.formula-status{min-height:18px;margin:4px 0 8px;color:var(--muted);font-size:12px}.formula-empty{grid-column:1/-1;text-align:center;padding:20px;color:var(--muted)}
body.dark-mode .formula-library{background:#182438;border-color:#405579;color:#e7edf8}body.dark-mode .formula-card{background:#101827;border-color:#405579}body.dark-mode .formula-filters input,body.dark-mode .formula-filters select,body.dark-mode .formula-copy{background:#101827;border-color:#405579;color:#e7edf8}
@media(max-width:600px){.formula-library{padding:14px}.formula-filters{grid-template-columns:1fr}.formula-filters label:nth-of-type(2),.formula-filters select,.formula-filters input{grid-column:1;grid-row:auto}.formula-library-heading{align-items:flex-start}.formula-expression{font-size:16px}}

/* حاسبة الأشكال والمجسمات الهندسية */
.geometry-tools{padding:clamp(14px,2.5vw,22px);border:1px solid var(--border,#d9e1ed);border-radius:16px;background:var(--card-bg,#fff);color:var(--text,#17243b)}
.geometry-tools[hidden]{display:none!important}.geometry-heading h3{margin:0 0 7px;font-size:20px}.geometry-heading p:not(.eyebrow){margin:0;color:var(--muted,#64748b);font-size:13px;line-height:1.7}
.geometry-calculator-layout{display:grid;grid-template-columns:minmax(230px,.8fr) minmax(0,1.4fr);gap:18px;margin-top:16px}.geometry-input-panel,.geometry-output-panel{min-width:0;padding:14px;border:1px solid var(--border,#d9e1ed);border-radius:13px;background:var(--surface,#f9fbff)}
.geometry-input-panel>label{display:block;margin-bottom:6px;font-weight:700;font-size:13px}.geometry-input-panel select{width:100%;min-height:46px;padding:9px 12px;border:1px solid var(--border,#d9e1ed);border-radius:9px;background:var(--input-bg,#fff);color:inherit;font:inherit}
.geometry-fields{display:grid;gap:10px;margin:14px 0}.geometry-field{display:grid;gap:5px;font-size:13px;font-weight:600}.geometry-field input{width:100%;min-height:43px;padding:8px 10px;border:1px solid var(--border,#d9e1ed);border-radius:8px;background:var(--input-bg,#fff);color:inherit;font:inherit;direction:ltr;text-align:right}
.geometry-input-panel button{width:100%;min-height:43px;margin-top:8px;font:inherit;cursor:pointer}.geometry-message{min-height:35px;margin:10px 0 0;color:var(--muted,#64748b);font-size:12px;line-height:1.7}
.geometry-board-wrap{width:100%;overflow:hidden;border:1px solid var(--border,#d9e1ed);border-radius:11px;background:var(--plot-bg,#fff)}#geometry-board{display:block;width:100%;height:auto;min-height:190px}
.geometry-flat-shape{fill:rgba(49,94,219,.14);stroke:var(--primary,#315edb);stroke-width:4;stroke-linejoin:round}.geometry-solid-shape{fill:rgba(49,94,219,.15);stroke:var(--primary,#315edb);stroke-width:3;stroke-linejoin:round}.geometry-solid-detail{fill:rgba(217,119,6,.08);stroke:#d97706;stroke-width:2;stroke-dasharray:6 4}.geometry-dimension{stroke:#d97706;stroke-width:2;stroke-dasharray:6 4}.geometry-axis{stroke:var(--border,#d9e1ed);stroke-width:1}.geometry-drawing-label{fill:var(--text,#17243b);font-size:13px;font-weight:700}
.geometry-metrics{display:grid;grid-template-columns:repeat(auto-fit,minmax(145px,1fr));gap:8px;margin-top:12px}.geometry-result{display:grid;gap:5px;padding:11px;border:1px solid var(--border,#d9e1ed);border-radius:10px;background:var(--card-bg,#fff)}.geometry-result strong{font-size:12px;color:var(--muted,#64748b)}.geometry-result span{font-size:16px;font-weight:800;direction:ltr;text-align:right;overflow-wrap:anywhere}
.geometry-laws{margin-top:12px;padding:12px;border-radius:10px;background:var(--card-bg,#fff);border:1px solid var(--border,#d9e1ed)}.geometry-laws h4{margin:0 0 8px;font-size:14px}.geometry-laws p{margin:6px 0;font-size:13px;line-height:1.8}.geometry-laws .geometry-note{color:var(--muted,#64748b);font-size:12px}
body.dark-mode .geometry-tools,body.dark-mode .geometry-input-panel,body.dark-mode .geometry-output-panel{background:#182438;border-color:#405579;color:#e7edf8}body.dark-mode .geometry-input-panel select,body.dark-mode .geometry-field input,body.dark-mode .geometry-result,body.dark-mode .geometry-laws{background:#101827;border-color:#405579;color:#e7edf8}body.dark-mode .geometry-board-wrap{background:#101827;border-color:#405579}body.dark-mode .geometry-drawing-label{fill:#e7edf8}
@media(max-width:720px){.geometry-calculator-layout{grid-template-columns:1fr}.geometry-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.geometry-board-wrap{max-width:100%}}

/* بطاقات تعليمية تفاعلية */
.flashcards{margin:18px 0 26px;padding:clamp(14px,2.5vw,22px);border:1px solid var(--border,#d9e1ed);border-radius:16px;background:var(--card-bg,#fff);color:var(--text,#17243b)}
.flashcards[hidden]{display:none!important}.flashcards-heading h3{margin:0 0 7px;font-size:20px}.flashcards-heading p:not(.eyebrow){margin:0;color:var(--muted,#64748b);font-size:13px;line-height:1.8}
.flashcards-controls{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:16px 0}.flashcards-controls label{font-size:13px;font-weight:700}.flashcards-controls select{min-height:44px;min-width:190px;padding:8px 12px;border:1px solid var(--border,#d9e1ed);border-radius:9px;background:var(--input-bg,#fff);color:inherit;font:inherit}.flashcards-controls span{margin-inline-start:auto;color:var(--muted,#64748b);font-size:12px}
.flashcard{min-height:220px;display:grid;place-items:center;padding:24px;border:2px solid var(--primary,#315edb);border-radius:16px;background:linear-gradient(145deg,var(--surface,#f8faff),var(--card-bg,#fff));text-align:center;cursor:pointer;outline-offset:4px}.flashcard:focus-visible{outline:3px solid var(--primary,#315edb)}.flashcard-face{width:100%;display:grid;justify-items:center;gap:12px}.flashcard-face[hidden]{display:none}.flashcard-kicker,.flashcard-hint{font-size:12px;color:var(--muted,#64748b)}.flashcard-face h4{margin:0;font-size:clamp(19px,3vw,26px);line-height:1.7}.flashcard-category{padding:4px 10px;border-radius:20px;background:var(--surface-hover,#edf2ff);font-size:12px}.flashcard-formula{max-width:100%;overflow-x:auto;padding:10px;font-size:clamp(17px,3vw,23px)}.flashcard-face p{margin:0;color:var(--muted,#64748b);font-size:13px;line-height:1.8}
.flashcard-actions,.flashcard-navigation{display:flex;gap:9px;flex-wrap:wrap;margin-top:12px}.flashcard-actions button,.flashcard-navigation button,.flashcard-reset{flex:1;min-width:120px;min-height:44px;padding:9px 12px;border:1px solid var(--border,#d9e1ed);border-radius:9px;background:var(--input-bg,#fff);color:inherit;font:inherit;cursor:pointer}.flashcard-actions button[aria-pressed=true]{border-color:var(--primary,#315edb);background:var(--surface-hover,#edf2ff);font-weight:800}.flashcard-navigation button:disabled{opacity:.45;cursor:not-allowed}.flashcard-progress{margin:14px 0 4px;font-size:13px;font-weight:700}.flashcard-status{min-height:22px;margin:4px 0;color:var(--muted,#64748b);font-size:12px}.flashcard-reset{flex:none;min-width:0;min-height:38px;font-size:12px}
body.dark-mode .flashcards{background:#182438;border-color:#405579;color:#e7edf8}body.dark-mode .flashcards-controls select,body.dark-mode .flashcard,body.dark-mode .flashcard-actions button,body.dark-mode .flashcard-navigation button,body.dark-mode .flashcard-reset{background:#101827;border-color:#405579;color:#e7edf8}body.dark-mode .flashcard-category{background:#293a55}
@media(max-width:600px){.flashcards{padding:14px}.flashcards-controls{display:grid;grid-template-columns:1fr}.flashcards-controls select{width:100%}.flashcards-controls span{margin:0}.flashcard{min-height:200px;padding:18px}.flashcard-actions,.flashcard-navigation{display:grid;grid-template-columns:1fr 1fr}.flashcard-actions button:first-child{grid-column:1/-1}.flashcard-actions button,.flashcard-navigation button{min-width:0;width:100%;min-height:46px}}
@media(prefers-reduced-motion:reduce){.flashcard{scroll-behavior:auto}}

/* توسيع مكتبة القوانين: مرشحات المستوى والوحدة وبيانات المصدر */
.formula-filters{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:9px;align-items:end}
.formula-filters label{display:grid;gap:5px;font-size:13px;font-weight:700}
.formula-filters input,.formula-filters select{width:100%;min-height:44px;padding:9px 11px;border:1px solid var(--border,#d9e1ed);border-radius:9px;background:var(--input-bg,#fff);color:inherit;font:inherit}
.formula-meta{margin:4px 0 10px;color:var(--muted,#64748b);font-size:11px;line-height:1.7}
.formula-conditions,.formula-example,.formula-source{margin:8px 0;color:var(--muted,#64748b);font-size:12px;line-height:1.8}
.formula-conditions{padding:8px 10px;border-inline-start:3px solid var(--primary,#315edb);background:var(--surface,#f8fafc);border-radius:6px}
.formula-example{color:var(--text,#334155)}
.formula-source{font-size:10px;opacity:.85}
body.dark-mode .formula-filters input,body.dark-mode .formula-filters select{background:#101827;border-color:#405579;color:#e7edf8}
body.dark-mode .formula-conditions{background:#101827;color:#d5dfef}
@media(max-width:600px){.formula-filters{grid-template-columns:1fr}.formula-filters input,.formula-filters select{min-height:46px}}

.formula-library-sources{margin:10px 0 14px;padding:10px 12px;border:1px solid var(--border,#d9e1ed);border-radius:9px;color:var(--muted,#64748b);font-size:11px;line-height:1.9}
.formula-library-sources a{color:var(--primary,#315edb);text-decoration:underline;text-underline-offset:2px}
body.dark-mode .formula-library-sources{border-color:#405579;color:#c1cde0}


/* Visible keyboard focus for links and form controls */
a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,[role="button"]:focus-visible{outline:3px solid #9eb5fa;outline-offset:3px}


/* Progressive, accessible hints shown before submitting a quiz answer. */
.question-hints{display:grid;justify-items:start;gap:9px;margin:12px 0;padding:12px;border:1px solid var(--border,#d9e1ed);border-radius:10px;background:var(--soft-bg,#f4f7fc)}
.question-hints[hidden],.question-hint-text[hidden]{display:none!important}
.hint-button{min-height:42px;padding:9px 14px;border:1px solid var(--primary,#315edb);border-radius:9px;background:transparent;color:var(--primary,#315edb);font:inherit;font-weight:700;cursor:pointer}
.hint-button:disabled{opacity:.65;cursor:default}
.question-hint-text{margin:0;font-size:13px;line-height:1.95;white-space:pre-wrap}
body.dark-mode .question-hints{background:#101827;border-color:#405579}
body.dark-mode .hint-button{color:#b8ccff;border-color:#7898ef}

/* Optional similar practice from the existing bank; it never affects quiz scoring. */
.similar-practice-start{display:inline-flex;align-items:center;justify-content:center;min-height:42px;margin-top:12px;padding:9px 14px;border:1px solid var(--primary,#315edb);border-radius:9px;background:var(--primary,#315edb);color:#fff;font:inherit;font-weight:700;cursor:pointer}
.similar-practice-card{display:grid;gap:10px;margin-top:14px;padding:14px;border:1px solid var(--border,#d9e1ed);border-radius:12px;background:var(--surface,#f8fafc)}
.similar-practice-card h4{margin:0;font-size:15px}
.similar-practice-note{margin:0;color:var(--muted,#64748b);font-size:12px;line-height:1.8}
.similar-practice-question{margin:0;font-weight:700;line-height:1.9}
.similar-practice-options{display:grid;gap:8px}
.similar-practice-options .option{width:100%;text-align:start}
.similar-practice-form{display:flex;gap:8px;flex-wrap:wrap}
.similar-practice-form input{flex:1 1 180px;min-height:42px;padding:8px 10px;border:1px solid var(--border,#d9e1ed);border-radius:8px;background:var(--input-bg,#fff);color:inherit;font:inherit}
.similar-practice-form button{min-height:42px;padding:8px 14px}
.similar-practice-feedback,.similar-practice-solution{margin:0;padding:9px 11px;border-radius:8px;line-height:1.9}
.similar-practice-feedback.good{background:#e8f7ef;color:#176b43}
.similar-practice-feedback.bad{background:#fff2e8;color:#9a4b12}
.similar-practice-solution{background:var(--soft-bg,#f4f7fc);white-space:pre-wrap}
.similar-practice-card [hidden]{display:none!important}
body.dark-mode .similar-practice-card{background:#101827;border-color:#405579}
body.dark-mode .similar-practice-form input{background:#101827;border-color:#405579;color:#e7edf8}
body.dark-mode .similar-practice-feedback.good{background:#123b2a;color:#b9efd0}
body.dark-mode .similar-practice-feedback.bad{background:#482b1d;color:#ffd3ad}
@media(max-width:600px){.similar-practice-form{display:grid}.similar-practice-form button,.similar-practice-start{width:100%}}
