/* Computer-delivered test layout for practice tests (js/tests.js).
   Matches the layout of the real computer-delivered IELTS test; only the branding is ours. */
html.exam-on, html.exam-on body { overflow: hidden; }
.exam-split, .exam-only { display: none; }

.exam {
  --split: 50%;
  --bg: #fff; --fg: #222; --muted: #6b6b6b; --line: #cfcfcf; --panel: #f1f1ee; --panel-line: #d6d6d2;
  --btn: #000; --btn-fg: #fff; --btn-off: #ddd; --hl: #ffe66b; --field: #fff; --field-line: #8a8a8a;
  position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column;
  background: var(--bg); color: var(--fg);
  font: 16px/1.5 Arial, Helvetica, sans-serif;
}
.exam.size-l { font-size: 19px; }
.exam.size-xl { font-size: 22px; }
.exam.theme-wb { --bg: #000; --fg: #fff; --muted: #ccc; --line: #555; --panel: #1a1a1a; --panel-line: #555; --btn: #fff; --btn-fg: #000; --btn-off: #444; --hl: #6b5d00; --field: #000; --field-line: #ccc; }
.exam.theme-yb { --bg: #000; --fg: #ffea00; --muted: #e6d200; --line: #665e00; --panel: #1a1a00; --panel-line: #665e00; --btn: #ffea00; --btn-fg: #000; --btn-off: #444; --hl: #5a4f00; --field: #000; --field-line: #ffea00; }
.exam button { font: inherit; color: inherit; }
.exam :focus-visible { outline: 3px solid #2b6fd6; outline-offset: 2px; }

/* ---------- Top bar ---------- */
.exam-top { flex: 0 0 auto; height: 56px; display: flex; align-items: center; gap: 24px; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--bg); }
.exam-brand { display: flex; align-items: center; gap: 8px; font: 700 20px 'Fraunces', Georgia, serif; color: var(--fg); white-space: nowrap; }
.exam-brand .logo-mark { width: 34px; height: 34px; font-size: 18px; }
.exam-brand .accent { color: #ff8a5b; }
.exam-id { align-self: flex-start; padding-top: 6px; font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exam-id span { font-weight: 400; margin-left: 6px; }
.exam-clock { margin: 0 auto; font-weight: 700; font-size: 15px; white-space: nowrap; }
.exam-clock.low { color: #c62828; }
.exam.theme-wb .exam-clock.low, .exam.theme-yb .exam-clock.low { color: inherit; text-decoration: underline; }
.exam-icons { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.exam-clock + .exam-icons { margin-left: 0; }
.exam-ico { display: grid; place-items: center; width: 44px; height: 44px; border: 0; background: none; padding: 0; cursor: pointer; border-radius: 4px; color: var(--fg); }
.exam-ico svg { width: 26px; height: 26px; }
.exam-ico[aria-expanded="true"] { background: var(--panel); }
span.exam-ico { cursor: default; }
span.exam-ico.off { opacity: .35; }

.exam-pop { position: absolute; top: 56px; right: 12px; z-index: 30; width: 300px; background: var(--bg); border: 1px solid var(--line); box-shadow: 0 6px 24px rgba(0,0,0,.18); padding: 14px 16px; }
.exam-pop[hidden] { display: none; }
.exam-pop h3 { margin: 0 0 8px; font-size: 1em; }
.exam-pop fieldset { border: 0; margin: 0 0 12px; padding: 0; }
.exam-pop legend { font-weight: 700; padding: 0; margin-bottom: 4px; }
.exam-pop label { display: block; padding: 3px 0; cursor: pointer; }
.exam-pop p { margin: 0; }

/* ---------- Part bar and content ---------- */
.exam-main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; position: relative; }
.exam-part { flex: 0 0 auto; margin: 16px 16px 0; padding: 12px 16px; background: var(--panel); border: 1px solid var(--panel-line); border-radius: 3px; }
.exam-part b { display: block; }
.exam-part p { margin: 2px 0 0; }
.exam-stage { flex: 1 1 auto; min-height: 0; position: relative; margin-top: 16px; }

.exam .test-task { display: none; margin: 0; height: 100%; }
.exam .test-task.active { display: flex; }
.exam .test-task > .prose { display: none; }
.exam .exam-left { flex: 0 0 var(--split); min-width: 0; overflow: auto; padding: 24px 16px 40px; box-sizing: border-box; }
.exam .exam-right { flex: 1 1 0; min-width: 0; overflow: auto; padding: 40px 56px 120px 18px; box-sizing: border-box; }
.exam .exam-split { display: flex; flex: 0 0 34px; justify-content: center; align-items: center; position: relative; cursor: col-resize; touch-action: none; }
.exam .exam-split::before { content: ""; position: absolute; top: 0; bottom: 16px; left: 50%; width: 2px; margin-left: -1px; background: #555; }
.exam.theme-wb .exam-split::before, .exam.theme-yb .exam-split::before { background: var(--fg); }
.exam-grip { position: relative; width: 34px; height: 34px; padding: 0; border: 2px solid #555; background: var(--bg); cursor: col-resize; display: grid; place-items: center; }
.exam-grip svg { width: 18px; height: 18px; }

/* The task: plain black text, as in the real test. */
.exam .test-prompt { background: none; border: 0; padding: 0; margin: 0; border-radius: 0; box-shadow: none; color: var(--fg); font-weight: 700; }
.exam .test-prompt p { margin: 0 0 1.5em; }
.exam .test-prompt ul { margin: -.8em 0 1.5em; font-weight: 700; }
.exam .test-prompt .exam-hide { display: none; }
.exam .test-prompt .chart-wrap, .exam .test-prompt .test-mark { border: 0; padding: 0; background: none; font-weight: 400; max-width: 600px; margin: 0 0 1.5em; }
.exam .test-prompt .chart-grid-2 { font-weight: 400; gap: 12px; }
.exam .test-prompt .chart-wrap h4 { font: 700 1em Arial, Helvetica, sans-serif; color: var(--fg); }
.exam .test-prompt table { font-weight: 400; }
.exam .test-prompt .flow .box { font-weight: 400; }
.exam.theme-wb .test-prompt svg, .exam.theme-yb .test-prompt svg,
.exam.theme-wb .test-prompt .chart-wrap, .exam.theme-yb .test-prompt .chart-wrap { background: #fff; color: #222; }

/* The answer box. */
.exam .test-task textarea.writing { display: block; width: 100%; min-height: 190px; margin: 0; padding: 8px 10px; box-sizing: border-box; border: 1px solid var(--field-line); border-radius: 0; background: var(--field); color: var(--fg); font: inherit; line-height: 1.5; resize: none; overflow: hidden; box-shadow: none; }
.exam .test-task textarea.writing:focus { outline: 2px solid #2b6fd6; outline-offset: 0; }
.exam .test-task textarea.writing[readonly] { background: var(--panel); }
.exam .test-task .wordcount { text-align: right; margin: 6px 0 0; color: var(--fg); font-size: 1em; }
.exam .submit-box { margin-top: 18px; font-size: 14px; }
.exam .submit-box .btn { font-size: 14px; }

/* Highlights and notes */
mark.exam-hl { background: var(--hl, #ffe66b); color: inherit; padding: 0; cursor: default; }
mark.exam-hl.exam-noted { background: #ffd28a; border-bottom: 2px dotted #b35a00; cursor: pointer; }
.exam.theme-wb mark.exam-hl.exam-noted, .exam.theme-yb mark.exam-hl.exam-noted { background: #7a4a00; }
mark.exam-hl.exam-note-end::after { content: "✎"; font-size: .8em; margin-left: 2px; vertical-align: super; line-height: 0; }
mark.exam-hl.flash { outline: 2px solid #2b6fd6; }

.exam-menu { position: fixed; z-index: 60; display: flex; background: #fff; color: #222; border: 1px solid #bbb; border-radius: 4px; box-shadow: 0 4px 16px rgba(0,0,0,.22); overflow: hidden; font-size: 14px; }
.exam-menu[hidden] { display: none; }
.exam-menu button { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 70px; padding: 8px 10px; border: 0; background: #fff; color: #222 !important; cursor: pointer; }
.exam-menu button + button { border-left: 1px solid #e3e3e3; }
.exam-menu button:hover, .exam-menu button:focus-visible { background: #eef3fb; }
.exam-menu svg { width: 18px; height: 18px; }

/* Notes panel */
.exam-notes { position: absolute; top: 0; right: 0; bottom: 0; z-index: 25; width: 340px; max-width: 100%; display: flex; flex-direction: column; background: var(--bg); border-left: 1px solid var(--line); box-shadow: -6px 0 18px rgba(0,0,0,.12); }
.exam-notes[hidden] { display: none; }
.exam-notes-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.exam-notes-head h2 { margin: 0; font: 700 1.05em Arial, Helvetica, sans-serif; color: var(--fg); }
.exam-notes-head button { border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer; padding: 2px 8px; }
.exam-notes-list { flex: 1; overflow: auto; padding: 12px 14px; }
.exam-notes-empty { color: var(--muted); }
.exam-notes-empty b { display: block; color: var(--fg); margin-bottom: 4px; }
.exam-note { border: 1px solid var(--line); border-radius: 4px; padding: 10px; margin-bottom: 12px; }
.exam-note.flash { border-color: #2b6fd6; box-shadow: 0 0 0 2px #2b6fd6 inset; }
.exam-note-part { font-size: .8em; color: var(--muted); margin: 0 0 4px; }
.exam-note blockquote { margin: 0 0 8px; padding-left: 8px; border-left: 3px solid #ffd28a; font-style: italic; color: var(--muted); font-size: .9em; cursor: pointer; }
.exam-note textarea { width: 100%; box-sizing: border-box; min-height: 64px; font: inherit; font-size: .95em; padding: 6px; border: 1px solid var(--field-line); background: var(--field); color: var(--fg); resize: vertical; }
.exam-note-del { margin-top: 6px; border: 0; background: none; padding: 0; text-decoration: underline; cursor: pointer; font-size: .85em; color: var(--muted) !important; }

/* Arrows and footer */
.exam-arrows { position: absolute; right: 32px; bottom: 16px; z-index: 20; display: flex; gap: 2px; }
.exam-arrow { width: 56px; height: 56px; border: 0; background: var(--btn); color: var(--btn-fg) !important; cursor: pointer; display: grid; place-items: center; padding: 0; }
.exam-arrow svg { width: 28px; height: 28px; }
.exam-arrow:disabled { background: var(--btn-off); cursor: default; }
.exam-foot { flex: 0 0 auto; height: 52px; display: flex; align-items: stretch; border-top: 1px solid var(--line); background: var(--bg); }
.exam-tab { flex: 1 1 0; position: relative; display: flex; align-items: center; gap: 18px; padding: 0 20px; border: 0; background: none; cursor: pointer; text-align: left; white-space: nowrap; }
.exam-tab::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 3px; background: var(--line); }
.exam-tab.done::before { background: #555; }
.exam-tab b { font-weight: 700; }
.exam-tab .cnt { color: var(--muted); }
.exam-tab.active { cursor: default; }
.exam-tab:not(.active) b { font-weight: 400; color: var(--muted); }
.exam-finish { flex: 0 0 76px; border: 0; background: var(--panel); cursor: pointer; display: grid; place-items: center; padding: 0; }
.exam-finish svg { width: 20px; height: 20px; }

/* Start screen and dialogs */
.exam-cover { position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(40,40,40,.86); color: #fff; text-align: center; padding: 24px; }
.exam-cover[hidden], .exam-dialog[hidden] { display: none; }
.exam-cover > div { max-width: 760px; }
.exam-cover svg.big { display: block; width: 96px; height: 96px; margin: 0 auto 14px; }
.exam-cover h2 { margin: 0 0 12px; font: 700 1.3em Arial, Helvetica, sans-serif; color: #fff; }
.exam-cover p { margin: 0 0 14px; }
.exam-start { display: inline-flex; align-items: center; gap: 10px; margin-top: 10px; padding: 12px 22px; border: 0; background: #000; color: #fff !important; font-weight: 700; cursor: pointer; }
.exam-start svg { width: 26px; height: 26px; }
.exam-cover a { color: #fff; display: inline-block; margin-top: 18px; font-size: .9em; }
.exam-dialog { position: absolute; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(0,0,0,.45); padding: 16px; }
.exam-dialog > div { width: 100%; max-width: 480px; background: var(--bg); color: var(--fg); border: 1px solid var(--line); padding: 22px 24px; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.exam-dialog h2 { margin: 0 0 10px; font: 700 1.15em Arial, Helvetica, sans-serif; color: var(--fg); }
.exam-dialog p { margin: 0 0 10px; }
.exam-dialog ul { margin: 0 0 14px; padding-left: 20px; }
.exam-dialog .row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.exam-btn { padding: 10px 18px; border: 2px solid var(--btn); background: var(--btn); color: var(--btn-fg) !important; font-weight: 700; cursor: pointer; }
.exam-btn.ghost { background: transparent; color: var(--fg) !important; }

/* Phones: one column, the task above the answer box. */
@media (max-width: 760px) {
  .exam-top { gap: 10px; padding: 0 8px; }
  .exam-brand .exam-brand-text, .exam-id { display: none; }
  .exam-clock { margin: 0 auto 0 0; }
  .exam-ico { width: 38px; }
  .exam-part { margin: 10px 10px 0; padding: 8px 12px; }
  .exam-stage { margin-top: 6px; overflow: auto; }
  .exam .test-task.active { display: block; height: auto; }
  .exam .exam-split { display: none; }
  .exam .exam-left { padding: 14px 12px 4px; overflow: visible; }
  .exam .exam-right { padding: 0 12px 90px; overflow: visible; }
  .exam-arrows { right: 10px; bottom: 10px; }
  .exam-arrow { width: 46px; height: 46px; }
  .exam-tab { gap: 8px; padding: 0 12px; }
  .exam-finish { flex-basis: 56px; }
  .exam-notes { width: 100%; }
}

/* ---------- Reading and Listening practice tests (js/cbt.js) ---------- */
.cbt-script[hidden] { display: none; }
.exam .cbt-part { display: none; height: 100%; }
.exam .cbt-part.active { display: flex; }
.exam .cbt-part.listen.active { display: block; overflow: auto; }
.exam .cbt-part.listen .cbt-questions { max-width: 1100px; padding: 8px 16px 140px; }
.exam .cbt-passage { font-size: 1em; }
.exam .cbt-passage h2 { font: 700 1.1em Arial, Helvetica, sans-serif; color: var(--fg); margin: 0 0 1em; }
.exam .cbt-passage h3 { font: 700 1em Arial, Helvetica, sans-serif; color: var(--fg); margin: 1em 0 .4em; }
.exam .cbt-passage p { margin: 0 0 1em; }
.exam .cbt-passage .cbt-intro { font-style: italic; color: var(--muted); }
.exam .cbt-passage .cbt-sub { font-style: italic; margin-top: -.6em; }
.exam .cbt-passage .cbt-para b.pl { margin-right: 8px; }
.exam .cbt-passage .cbt-gloss { font-size: .88em; color: var(--muted); border-top: 1px solid var(--line); padding-top: 6px; }
.exam .cbt-questions { color: var(--fg); }
.exam .cbt-right-pad { padding-top: 24px; }

.cbt-group { margin: 0 0 34px; }
.cbt-group > h3 { font: 700 1em Arial, Helvetica, sans-serif; color: var(--fg); margin: 0 0 6px; }
.cbt-instr p { margin: 0 0 8px; }
.cbt-body { margin-top: 12px; }
.cbt-body h4 { font: 700 1.05em Arial, Helvetica, sans-serif; color: var(--fg); margin: 16px 0 8px; }
.cbt-body p, .cbt-body li { line-height: 2.1; }
.cbt-body ul { padding-left: 20px; margin: 4px 0 10px; }
.cbt-body table { border-collapse: collapse; margin: 8px 0 12px; }
.cbt-body th, .cbt-body td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; line-height: 2; }
.cbt-body th { background: var(--panel); }
.cbt-q { margin: 0 0 22px; scroll-margin: 20px; }
.cbt-stem { margin: 0 0 10px; display: flex; gap: 10px; align-items: baseline; }
.cbt-num { display: inline-block; min-width: 26px; padding: 0 4px; text-align: center; font-weight: 700; box-sizing: border-box; border: 2px solid transparent; }
.cbt-q.current .cbt-num, .cbt-gapwrap.current .cbt-gap, .cbt-drop.current { border-color: #2b6fd6; }
.cbt-opts { display: flex; flex-direction: column; gap: 4px; padding-left: 12px; }
.cbt-opts label { display: flex; gap: 10px; align-items: baseline; padding: 6px 8px; cursor: pointer; border-radius: 2px; }
.cbt-opts label:hover { background: var(--panel); }
.cbt-opts input { margin: 0; transform: translateY(1px); }
.cbt-letter { font-weight: 700; min-width: 14px; }
.cbt-gapwrap { display: inline-block; scroll-margin: 40px; }
.cbt-gap { width: 150px; max-width: 60vw; height: 28px; padding: 0 6px; border: 1px solid var(--field-line); background: var(--field); color: var(--fg); font: inherit; text-align: center; box-sizing: border-box; vertical-align: middle; }
.cbt-gap::placeholder { color: var(--fg); font-weight: 700; opacity: 1; }
.cbt-gap:focus::placeholder { color: transparent; }
.cbt-gap:focus { outline: none; border: 2px solid #2b6fd6; }

.cbt-pool { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; padding: 12px; border: 1px solid var(--line); max-width: 640px; }
.cbt-pool h4 { margin: 0 0 4px; font: 700 1em Arial, Helvetica, sans-serif; color: var(--fg); }
.cbt-chip { display: flex; gap: 10px; align-items: baseline; text-align: left; padding: 6px 10px; border: 1px solid var(--field-line); background: var(--bg); color: var(--fg); cursor: grab; font: inherit; line-height: 1.4; }
.cbt-chip b { min-width: 22px; }
.cbt-chip[aria-pressed="true"] { outline: 3px solid #2b6fd6; }
.cbt-chip.used { display: none; }
.cbt-drop { display: inline-flex; align-items: center; justify-content: center; min-width: 170px; min-height: 30px; margin: 2px 0; padding: 0 6px; border: 1px dashed var(--field-line); background: var(--field); font-weight: 700; vertical-align: middle; cursor: pointer; box-sizing: border-box; scroll-margin: 40px; }
.cbt-drop.over { background: #e8f0fd; border-style: solid; }
.cbt-drop.filled { border-style: solid; font-weight: 400; justify-content: flex-start; }
.cbt-drop .cbt-chip { border: 0; padding: 2px 4px; cursor: grab; }
.cbt-figure { margin: 8px 0 16px; max-width: 640px; }
.cbt-figure svg { width: 100%; height: auto; display: block; background: #fff; }

/* Results */
.cbt-mark { display: inline-block; margin-left: 8px; padding: 1px 8px; font-size: .85em; font-weight: 700; border-radius: 3px; vertical-align: middle; line-height: 1.6; }
.cbt-mark.ok { background: #d9f2df; color: #145c2a; }
.cbt-mark.no { background: #fde2e1; color: #8c1d18; }
.cbt-gap.ok, .cbt-drop.ok { border: 2px solid #1f8a3d; }
.cbt-gap.no, .cbt-drop.no { border: 2px solid #c62828; }
.exam-qnum.ok { color: #1f8a3d; font-weight: 700; }
.exam-qnum.no { color: #c62828; font-weight: 700; text-decoration: line-through; }
.cbt-transcript { margin: 10px 0 30px; border: 1px solid var(--line); padding: 12px 16px; }
.cbt-transcript summary { font-weight: 700; cursor: pointer; }
.cbt-transcript p { margin: 8px 0; line-height: 1.6; }
.cbt-transcript p.nar { font-style: italic; color: var(--muted); }
.cbt-score { font-size: 1.4em; font-weight: 700; margin: 4px 0 10px; }

/* Footer question numbers */
.exam-tab.has-nums { flex: 3 1 0; gap: 14px; }
.exam-qnums { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.exam-qnum { position: relative; min-width: 21px; height: 30px; padding: 0 2px; border: 1px solid transparent; background: none; cursor: pointer; font: inherit; color: var(--fg); }
.exam-qnum::before { content: ""; position: absolute; left: 1px; right: 1px; top: -10px; height: 3px; background: var(--line); }
.exam-qnum.done::before { background: #555; }
.exam-qnum.current { border-color: var(--fg); }
.exam-vol { width: 100%; }

@media (max-width: 760px) {
  .exam .cbt-part.active { display: block; height: auto; }
  .exam .cbt-passage { padding-bottom: 20px; border-bottom: 2px solid #555; }
  .exam-tab.has-nums { flex-basis: auto; }
  .cbt-drop { min-width: 120px; }
}
.exam .cbt { height: 100%; }
.exam-stage { overflow: hidden; }
@media (max-width: 760px) { .exam .cbt { height: auto; } .exam-stage { overflow: auto; } }
