/* ASAS-AI — Exam Mode. Colours come from the chat theme (asas-themes.css),
   so the exam follows whichever of the 12 themes the user has chosen. */
#asas-exam {
  --ax-ok: #4ade80; --ax-bad: #f87171; --ax-okbg: rgba(34,197,94,.14); --ax-badbg: rgba(239,68,68,.14); --ax-flag: #fdba74;
  /* Full-screen modal ABOVE the WordPress admin bar (z-index 99999), as WordPress's own
     media modal does — reserving space under the bar fails on phones, where it scrolls away. */
  position: fixed; inset: 0; z-index: 100050; display: flex; flex-direction: column;
  background: var(--bg, #0a0f1e); color: var(--tx, #e8eaf2);
  font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}
#asas-exam[hidden] { display: none; }
#asas-app[data-theme^="light-"] #asas-exam {
  --ax-ok: #166534; --ax-bad: #b91c1c; --ax-okbg: #dcfce7;   /* #15803d measured 4.3–4.4:1 on light review cards */ --ax-badbg: #fee2e2; --ax-flag: #9a3412;
}
html.asas-exam-open, html.asas-exam-open body { overflow: hidden !important; }
#asas-exam *, #asas-exam *::before, #asas-exam *::after { box-sizing: border-box; }
#asas-exam :focus-visible { outline: 2px solid var(--ac, #D4A847); outline-offset: 2px; border-radius: 6px; }

/* Top bar */
#asas-exam .ax-bar { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--bd, rgba(255,255,255,.1)); background: var(--sb, #111827); flex-shrink: 0; }
#asas-exam .ax-close { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--bd, rgba(255,255,255,.12)); background: var(--sf, #131c2e); color: var(--tx, #e8eaf2); cursor: pointer; }
#asas-exam .ax-title { flex: 1; min-width: 0; margin: 0; padding: 0; border: 0; background: none; box-shadow: none; color: var(--tx, #e8eaf2);
  line-height: 1.3; letter-spacing: 0; text-transform: none; font-family: 'Lora', Georgia, serif; font-weight: 600; font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#asas-exam .ax-plan { font-size: 13px; color: var(--t2, #a3afc6); white-space: nowrap; }
#asas-exam .ax-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 22px 18px 48px; }
#asas-exam .ax-body > * { max-width: 1060px; margin-left: auto; margin-right: auto; }

/* Building blocks */
#asas-exam h3 { padding: 0; border: 0; background: none; line-height: 1.3; letter-spacing: 0; text-transform: none; margin: 0 0 12px; font-family: 'Lora', Georgia, serif; font-weight: 600; font-size: 18px; color: var(--tx, #e8eaf2); }
#asas-exam .ax-lede { font-size: 15.5px; color: var(--t2, #a3afc6); margin: 0 auto 18px; max-width: 1060px; }
#asas-exam .ax-card { background: var(--sf, #131c2e); border: 1px solid var(--bd, rgba(255,255,255,.1)); border-radius: 16px; padding: 18px; margin-bottom: 16px; }
#asas-exam .ax-note { font-size: 13.5px; color: var(--t2, #a3afc6); margin: 6px 0; }
#asas-exam .ax-meta { font-size: 13px; color: var(--t2, #a3afc6); margin: 4px 0 10px; }
#asas-exam .ax-fine { font-size: 12.5px; color: var(--t3, #8e9bb5); margin-top: 18px; }
#asas-exam .ax-busy { padding: 40px 0; text-align: center; color: var(--t2, #a3afc6); }
#asas-exam .ax-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 4px auto 16px; }
#asas-exam .ax-error p { margin: 0 0 12px; }
#asas-exam .ax-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#asas-exam .ax-btn {
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 10px 15px; border-radius: 11px; cursor: pointer;
  border: 1px solid var(--bd, rgba(255,255,255,.14)); background: var(--s2, #1a2540); color: var(--tx, #e8eaf2);
  font: inherit; font-weight: 600; font-size: 14.5px; text-align: left;
}
#asas-exam .ax-btn:hover:not(:disabled) { border-color: var(--ac, #D4A847); }
/* Inactive buttons: no opacity (it fades text and fill together, failing light themes).
   Theme secondary text (--t2, tuned >= 6:1 on every surface), no fill, dashed outline. */
#asas-exam .ax-btn:disabled { opacity: 1; cursor: not-allowed; background: transparent; color: var(--t2, #a3afc6); border-style: dashed; }
#asas-exam .ax-primary { background: var(--ac, #D4A847); border-color: var(--ac, #D4A847); color: var(--bg, #0a0f1e); }
#asas-exam .ax-primary .ax-btn-sub { color: inherit; opacity: .85; }
#asas-exam .ax-btn-main { font-weight: 700; }
#asas-exam .ax-btn-sub { font-size: 12.5px; font-weight: 500; color: var(--t2, #a3afc6); }
#asas-exam .ax-locked { border-style: dashed; }
#asas-exam .ax-locked .ax-btn-sub { color: var(--ac, #D4A847); }
#asas-exam .ax-wide { width: 100%; align-items: center; margin-top: 12px; }
#asas-exam .ax-link { background: none; border: 0; padding: 4px 0; color: var(--ac, #D4A847); font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* Home */
#asas-exam .ax-exams { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 8px; }
#asas-exam .ax-exam { margin: 0; display: flex; flex-direction: column; }
#asas-exam .ax-exam h3 { margin-bottom: 4px; font-size: 20px; }
#asas-exam .ax-real { font-size: 13.5px; color: var(--t2, #a3afc6); margin: 0 0 6px; }
#asas-exam .ax-modes { display: grid; gap: 8px; margin-top: auto; padding-top: 8px; }
#asas-exam .ax-modes .ax-btn { width: 100%; }
#asas-exam .ax-resume { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; border-color: var(--ac, #D4A847); }
#asas-exam .ax-resume p { margin: 0; }

/* Plans */
#asas-exam .ax-tablewrap { overflow-x: auto; }
#asas-exam .ax-ladder { width: 100%; border-collapse: collapse; font-size: 14px; }
#asas-exam .ax-ladder th, #asas-exam .ax-ladder td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--bd, rgba(255,255,255,.1)); vertical-align: top; color: var(--tx, #e8eaf2); }
#asas-exam .ax-ladder thead th { font-size: 13px; color: var(--t2, #a3afc6); font-weight: 600; }
#asas-exam .ax-ladder tbody th { font-family: 'Lora', Georgia, serif; font-weight: 600; }
#asas-exam .ax-price { display: block; font-family: 'DM Sans', system-ui, sans-serif; font-weight: 500; font-size: 12.5px; color: var(--t2, #a3afc6); }
#asas-exam .ax-qty { font-weight: 700; white-space: nowrap; }
#asas-exam .ax-you th, #asas-exam .ax-you td { background: var(--ad, rgba(212,168,71,.1)); }

/* Runner */
#asas-exam .ax-run { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 16px; align-items: start; }
#asas-exam .ax-qpanel { margin: 0; padding: 22px; }
#asas-exam .ax-qmeta { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13.5px; color: var(--t2, #a3afc6); margin-bottom: 12px; }
#asas-exam .ax-qtext { font-size: 18px; line-height: 1.6; margin: 0 0 18px; max-width: 70ch; }
#asas-exam .ax-opts { display: grid; gap: 10px; }
#asas-exam .ax-opt { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; align-items: center; width: 100%; text-align: left; padding: 12px 14px; border-radius: 12px;
  background: var(--s2, #1a2540); border: 1.5px solid transparent; color: var(--tx, #e8eaf2); font: inherit; font-size: 15.5px; cursor: pointer; }
#asas-exam .ax-opt:hover { border-color: var(--bd, rgba(255,255,255,.18)); }
#asas-exam .ax-bub { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; border: 1.5px solid var(--t3, #8e9bb5); color: var(--t2, #a3afc6); }
#asas-exam .ax-opt[aria-checked="true"] { border-color: var(--ac, #D4A847); background: var(--ad, rgba(212,168,71,.12)); }
#asas-exam .ax-opt[aria-checked="true"] .ax-bub { background: var(--ac, #D4A847); border-color: var(--ac, #D4A847); color: var(--bg, #0a0f1e); }
#asas-exam .ax-qnav { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
#asas-exam .ax-flag[aria-pressed="true"] { color: var(--ax-flag); border-color: var(--ax-flag); }

#asas-exam .ax-sheet { margin: 0; position: sticky; top: 0; }
#asas-exam .ax-sheethead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
#asas-exam .ax-sheethead h3 { margin: 0; font-size: 16px; }
#asas-exam .ax-timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 20px; }
#asas-exam .ax-timer.ax-low { color: var(--ax-bad); }
#asas-exam .ax-sheetwrap summary { cursor: pointer; font-size: 13.5px; color: var(--t2, #a3afc6); margin: 10px 0 8px; }
#asas-exam .ax-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; max-height: 52vh; overflow-y: auto; }
#asas-exam .ax-sheetrow { display: grid; grid-template-columns: 26px repeat(4, 24px) 12px; gap: 6px; align-items: center; width: 100%; padding: 4px 6px; border-radius: 9px;
  border: 1px solid transparent; background: none; cursor: pointer; color: var(--tx, #e8eaf2); font: inherit; }
#asas-exam .ax-sheetrow:hover { background: var(--s2, #1a2540); }
#asas-exam .ax-sheetrow.ax-cur { border-color: var(--ac, #D4A847); }
#asas-exam .ax-n { font-size: 12.5px; color: var(--t2, #a3afc6); text-align: right; font-variant-numeric: tabular-nums; }
#asas-exam .ax-dot { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 10.5px; font-weight: 700;
  border: 1.5px solid var(--bd, rgba(255,255,255,.18)); color: var(--t2, #a3afc6); }
#asas-exam .ax-dot.ax-on { background: var(--ac, #D4A847); border-color: var(--ac, #D4A847); color: var(--bg, #0a0f1e); }
#asas-exam .ax-fl { width: 10px; height: 10px; border-radius: 2px; }
#asas-exam .ax-fl.ax-on { background: var(--ax-flag); }

/* Results */
#asas-exam .ax-reshead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
#asas-exam .ax-score { font-family: 'Lora', Georgia, serif; font-size: clamp(38px, 7vw, 58px); line-height: 1; margin: 0; }
#asas-exam .ax-score small { font-family: 'DM Sans', system-ui, sans-serif; font-size: 18px; color: var(--t2, #a3afc6); margin-left: 10px; }
#asas-exam .ax-verdict { margin: 8px 0 0; font-size: 15.5px; }
#asas-exam .ax-pass { color: var(--ax-ok); font-weight: 700; }
#asas-exam .ax-fail { color: var(--ax-bad); font-weight: 700; }
#asas-exam .ax-resgrid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
#asas-exam .ax-marked { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 14px; }
#asas-exam .ax-marked li { display: grid; grid-template-columns: 22px repeat(4, 24px); gap: 5px; align-items: center; position: relative; }
#asas-exam .ax-dot.ax-right { background: var(--ax-ok); border-color: var(--ax-ok); color: var(--bg, #06210f); }
#asas-exam .ax-dot.ax-wrong { background: var(--ax-bad); border-color: var(--ax-bad); color: var(--bg, #2a0606); }
#asas-exam .ax-dot.ax-key { border-color: var(--ax-ok); border-width: 2px; color: var(--ax-ok); }
#asas-exam .ax-legend { display: flex; gap: 6px 14px; flex-wrap: wrap; align-items: center; font-size: 12.5px; color: var(--t2, #a3afc6); margin: 12px 0 0; }
#asas-exam .ax-legend .ax-dot { width: 14px; height: 14px; vertical-align: -2px; }
#asas-exam .ax-review { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
#asas-exam .ax-rv { border: 1px solid var(--bd, rgba(255,255,255,.1)); border-radius: 14px; padding: 14px; background: var(--bg, #0a0f1e); }
#asas-app[data-theme^="light-"] #asas-exam .ax-rv { background: var(--s2, #f1f4f8); }
#asas-exam .ax-rvtop { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--t2, #a3afc6); margin-bottom: 6px; }
#asas-exam .ax-rvq { margin: 0 0 10px; font-size: 15.5px; }
#asas-exam .ax-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
#asas-exam .ax-pair > div { border-radius: 10px; padding: 9px 11px; font-size: 14px; }
#asas-exam .ax-pair small { display: block; font-size: 12px; color: var(--t2, #a3afc6); margin-bottom: 2px; }
#asas-exam .ax-okbg, #asas-exam .ax-keybox { background: var(--ax-okbg); }
#asas-exam .ax-badbg { background: var(--ax-badbg); }
#asas-exam .ax-exp { border-left: 3px solid var(--ac, #D4A847); padding: 2px 0 2px 12px; font-size: 14px; }
#asas-exam .ax-exp p { margin: 0 0 4px; }
#asas-exam .ax-ref { font-size: 12.5px; color: var(--t2, #a3afc6); }
#asas-exam .ax-explocked { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; color: var(--t2, #a3afc6); }
#asas-exam .ax-rvact { margin: 8px 0 0; gap: 16px; }
#asas-exam .ax-ta { width: 100%; border-radius: 10px; padding: 10px; border: 1px solid var(--bd, rgba(255,255,255,.14)); background: var(--sf, #131c2e); color: var(--tx, #e8eaf2); font: inherit; font-size: 14px; resize: vertical; margin-top: 8px; }
#asas-exam .ax-ta::placeholder { color: var(--t3, #8e9bb5); opacity: 1; }
#asas-exam .ax-next { border-color: var(--ac, #D4A847); }
#asas-exam .ax-next p { font-size: 14.5px; margin: 0 0 12px; }
#asas-exam .ax-meter { margin: 0 0 12px; }
#asas-exam .ax-track { display: block; height: 10px; border-radius: 6px; background: var(--s2, #1a2540); overflow: hidden; }
#asas-exam .ax-track i { display: block; height: 100%; background: var(--ac, #D4A847); min-width: 3px; }
#asas-exam .ax-cap { display: block; font-size: 12.5px; color: var(--t2, #a3afc6); margin-top: 6px; }
#asas-exam .ax-topics { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
#asas-exam .ax-topics li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 14px; }
#asas-exam .ax-pbar { grid-column: 1 / -1; display: block; height: 8px; border-radius: 6px; background: var(--s2, #1a2540); overflow: hidden; }
#asas-exam .ax-pbar i { display: block; height: 100%; border-radius: 6px; }
#asas-exam .ax-band { font-size: 12.5px; color: var(--t2, #a3afc6); }

/* History */
#asas-exam .ax-hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
#asas-exam .ax-histrow { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: center; width: 100%; text-align: left; padding: 14px 16px;
  border-radius: 12px; border: 1px solid var(--bd, rgba(255,255,255,.1)); background: var(--sf, #131c2e); color: var(--tx, #e8eaf2); font: inherit; cursor: pointer; }
#asas-exam .ax-histrow:hover { border-color: var(--ac, #D4A847); }
#asas-exam .ax-histname { font-weight: 600; }

/* Dialog */
#asas-exam .ax-dlg { position: fixed; inset: 0; z-index: 2; display: grid; place-items: center; padding: 20px; background: rgba(5,8,16,.6); }
#asas-exam .ax-dlg[hidden] { display: none; }
#asas-exam .ax-dlgbox { width: 100%; max-width: 440px; background: var(--sf, #131c2e); border: 1px solid var(--bd, rgba(255,255,255,.12)); border-radius: 16px; padding: 22px; box-shadow: 0 24px 60px -24px rgba(0,0,0,.7); }
#asas-exam .ax-dlgbox p { color: var(--t2, #a3afc6); margin: 0 0 16px; }
#asas-exam .ax-dlgacts { justify-content: flex-end; margin: 0; }

/* Chat suggestion card */
#asas-app .ax-suggest { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; max-width: 760px; margin: 6px auto 14px;
  padding: 12px 14px; border-radius: 14px; border: 1px dashed var(--ac, #D4A847); background: var(--ad, rgba(212,168,71,.08)); color: var(--tx, #e8eaf2); font-size: 14px; }
#asas-app .ax-suggest .ax-btn { display: inline-flex; padding: 9px 14px; border-radius: 10px; cursor: pointer; font: inherit; font-weight: 700;
  background: var(--ac, #D4A847); border: 1px solid var(--ac, #D4A847); color: var(--bg, #0a0f1e); }

/* Phones and small tablets */
@media (max-width: 860px) {
  #asas-exam .ax-run, #asas-exam .ax-resgrid { grid-template-columns: minmax(0, 1fr); }
  #asas-exam .ax-sheet { position: static; order: -1; }
  #asas-exam .ax-run { gap: 12px; }
}
@media (max-width: 560px) {
  #asas-exam .ax-bar { padding: 10px 12px; }
  #asas-exam .ax-plan { display: none; }
  #asas-exam .ax-body { padding: 16px 12px 40px; }
  #asas-exam .ax-qpanel { padding: 16px; }
  #asas-exam .ax-qtext { font-size: 16.5px; }
  #asas-exam .ax-pair { grid-template-columns: 1fr; }
  #asas-exam .ax-qnav .ax-btn { flex: 1 1 auto; align-items: center; }
  #asas-exam .ax-histrow { grid-template-columns: minmax(0, 1fr) auto; }
  #asas-exam .ax-histrow .ax-meta { grid-column: 1 / -1; margin: 0; }
}
@media (prefers-reduced-motion: reduce) { #asas-exam * { transition: none !important; animation: none !important; } }

/* The title receives focus programmatically on each screen change so screen readers
   announce it; it is not reachable with Tab, so no focus ring is drawn on it. */
#asas-exam .ax-title:focus, #asas-exam .ax-title:focus-visible { outline: none; box-shadow: none; }
