/* Shared Arabic/English language controls and RTL layout overrides for American Literature 1. */
.aml-global-toggle,
.aml-q-lang {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  border: 1px solid rgba(29,53,87,.34);
  border-radius: 999px;
  padding: 6px 12px;
  background: #fffdf7;
  color: #1d3557;
  font: 800 .84rem Tahoma, Arial, sans-serif;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(26,26,46,.10);
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.aml-global-toggle:hover,
.aml-q-lang:hover { background: #f0e5c9; border-color: #c9a84c; transform: translateY(-1px); }
.aml-global-toggle:focus-visible,
.aml-q-lang:focus-visible { outline: 3px solid rgba(201,168,76,.48); outline-offset: 2px; }
.aml-global-toggle.fixed {
  position: fixed;
  z-index: 9998;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
}
.aml-global-toggle.in-nav {
  position: static;
  min-height: 32px;
  background: rgba(255,255,255,.08);
  color: inherit;
  border-color: rgba(240,229,201,.4);
  box-shadow: none;
  padding: 6px 11px;
}
.quiz-shell-nav .aml-global-toggle.in-nav:hover { background: #f0e5c9; color: #1a1a2e; border-color: #c9a84c; }
.aml-q-lang {
  flex: 0 0 auto;
  min-height: 29px;
  padding: 4px 9px;
  font-size: .76rem;
  box-shadow: none;
}
.q-head .aml-q-lang { margin-inline-start: auto; }
.qh .aml-q-lang { margin-inline-start: auto; }

html[lang="ar"] body,
body.aml-global-ar {
  font-family: Tahoma, Arial, "Noto Naskh Arabic", sans-serif;
  direction: rtl;
}
body.aml-global-ar .q-card[dir="ltr"],
body.aml-global-ar .q[dir="ltr"] { font-family: Georgia, "Times New Roman", serif; }
body.aml-global-ar .q-card[dir="rtl"],
body.aml-global-ar .q[dir="rtl"] {
  font-family: Tahoma, Arial, "Noto Naskh Arabic", sans-serif;
  text-align: right;
}
body.aml-global-ar .q-num,
body.aml-global-ar .q-text,
body.aml-global-ar .q-quote,
body.aml-global-ar .explanation { text-align: right; }
body.aml-global-ar .quiz-shell-nav__inner,
body.aml-global-ar .quiz-shell-nav__links { direction: rtl; }
body.aml-global-ar .quiz-shell-nav__brand { letter-spacing: 0; text-transform: none; }
body.aml-global-ar .part-header { border-left: 1px solid #e0dcd4; border-right: 6px solid var(--gold); border-radius: 8px 0 0 8px; }
body.aml-global-ar .toc { border-left: 1px solid #ddd; border-right: 5px solid var(--gold); }
body.aml-global-ar .q-card.answered-correct { border-left: 1px solid #e0dcd4; border-right: 5px solid var(--green); }
body.aml-global-ar .q-card.answered-wrong { border-left: 1px solid #e0dcd4; border-right: 5px solid var(--crimson); }
body.aml-global-ar .q-quote { border-left: 1px solid #e0dcd4; border-right: 4px solid var(--gold); border-radius: 6px 0 0 6px; }
body.aml-global-ar .brief,
body.aml-global-ar .alert { border-left-width: 1px; border-right: 5px solid var(--blue); }
body.aml-global-ar .alert { border-right-color: var(--gold); }
body.aml-global-ar .part-desc { margin-right: 18px; margin-left: 0; text-align: right; }
body.aml-global-ar .brief ul,
body.aml-global-ar .legend ul { margin-right: 20px; margin-left: 0; }
body.aml-global-ar .brief th,
body.aml-global-ar .brief td,
body.aml-global-ar .alert th,
body.aml-global-ar .alert td,
body.aml-global-ar th,
body.aml-global-ar td { text-align: right; }
body.aml-global-ar .brief th,
body.aml-global-ar .brief td { direction: rtl; }
body.aml-global-ar .q-card[dir="ltr"] .q-quote { text-align: left; }
body.aml-global-ar .filter-panel,
body.aml-global-ar .brief,
body.aml-global-ar .legend,
body.aml-global-ar .box,
body.aml-global-ar .alert { text-align: right; }
body.aml-global-ar .q-card[dir="ltr"] .q-head,
body.aml-global-ar .q[dir="ltr"] .qh { direction: ltr; }
body.aml-global-ar .q-card[dir="rtl"] .q-head,
body.aml-global-ar .q[dir="rtl"] .qh { direction: rtl; }
body.aml-global-ar .opts { direction: rtl; }
body.aml-global-ar .q-card[dir="ltr"] .opts,
body.aml-global-ar .q[dir="ltr"] .opts { direction: ltr; }
body.aml-global-ar .f-label { min-width: 105px; }
body.aml-global-ar .quiz-progress-card { direction: rtl; text-align: right; }
body.aml-global-ar .quiz-progress-sub { direction: rtl; }

.q-card[dir="rtl"],
.q[dir="rtl"] { font-family: Tahoma, Arial, "Noto Naskh Arabic", sans-serif; direction: rtl; text-align: right; }
.q-card[dir="rtl"] .q-num,
.q-card[dir="rtl"] .q-text,
.q-card[dir="rtl"] .q-quote,
.q-card[dir="rtl"] .explanation,
.q[dir="rtl"] .qh,
.q[dir="rtl"] .qt,
.q[dir="rtl"] .exp { text-align: right; }
.q-card[dir="rtl"] .opts,
.q[dir="rtl"] .opts { direction: rtl; }
.q-card[dir="rtl"] .opt-btn,
.q[dir="rtl"] .opt { text-align: right; }
.q-card[dir="rtl"] .q-head,
.q[dir="rtl"] .qh { direction: rtl; }

@media (max-width: 680px) {
  .aml-global-toggle.fixed { top: max(8px, env(safe-area-inset-top)); right: max(8px, env(safe-area-inset-right)); }
  .aml-global-toggle.in-nav { flex: 1 1 auto; }
  .aml-q-lang { padding: 4px 7px; }
}
@media print {
  .aml-global-toggle, .aml-q-lang { display: none !important; }
}
