/* IELTS Mock Exam — same look as the CDI test library (red IELTS badge, clean paper) */
:root{
  --c-brand:#c8102e; --c-brand-dk:#a30d25;
  --c-ink:#1f2430; --c-ink-soft:#5b6472;
  --c-bg:#ffffff; --c-surface:#f4f5f7; --c-surface-2:#eceef1;
  --c-line:#d5d9e0; --c-line-2:#b9c0cb; --c-focus:#2563eb;
  --c-ok:#15803d; --c-ok-bg:#e8f6ec; --c-bad:#b91c1c; --c-bad-bg:#fdeceb;
  --c-warn:#b45309; --c-warn-bg:#fff4e0; --c-mark:#fff3a3;
  --sp-1:.25rem; --sp-2:.5rem; --sp-3:.75rem; --sp-4:1rem; --sp-5:1.5rem; --sp-6:2rem;
  --fs-ui:.875rem; --fs-body:1rem; --fs-passage:1.0625rem; --lh:1.6; --lh-passage:1.8; --radius:6px; --split:50%;
  --shadow:0 10px 40px rgba(15,23,42,.18);
  --font:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;
}
*,*::before,*::after{ box-sizing:border-box; }
html,body{ margin:0; }
body{ font-family:var(--font); font-size:var(--fs-body); line-height:var(--lh); color:var(--c-ink); background:var(--c-surface);
  -webkit-text-size-adjust:100%; }
button,input,select,textarea{ font:inherit; color:inherit; }
:focus-visible{ outline:3px solid var(--c-focus); outline-offset:2px; }
[hidden]{ display:none !important; }
.mx-muted{ color:var(--c-ink-soft); }
.mx-brand{ background:var(--c-brand); color:#fff; font-weight:800; letter-spacing:2px; padding:2px 8px; border-radius:3px; font-size:1.0625rem; line-height:1.3; }

/* buttons */
.mx-btn{ background:var(--c-bg); border:1px solid var(--c-line-2); color:var(--c-ink); border-radius:var(--radius);
  padding:10px 18px; font-size:.9375rem; font-weight:600; cursor:pointer; line-height:1.2; white-space:nowrap; }
.mx-btn:hover{ background:var(--c-surface-2); }
.mx-btn--primary{ background:var(--c-brand); border-color:var(--c-brand); color:#fff; font-weight:700; }
.mx-btn--primary:hover{ background:var(--c-brand-dk); }
.mx-btn--sm{ padding:6px 12px; font-size:var(--fs-ui); }
.mx-btn:disabled{ opacity:.55; cursor:not-allowed; }

/* ================= START PAGE ================= */
.mx-top{ display:flex; align-items:center; gap:12px; padding:0 20px; min-height:58px; background:var(--c-bg); border-bottom:2px solid var(--c-line); }
.mx-top__title{ font-weight:700; font-size:1.0625rem; }
.mx-top__org{ margin-left:auto; font-size:var(--fs-ui); color:var(--c-ink-soft); }
.mx-card-wrap{ max-width:620px; margin:0 auto; padding:28px 16px 60px; }
.mx-card{ background:var(--c-bg); border:1px solid var(--c-line); border-radius:12px; padding:26px 28px; box-shadow:0 1px 2px rgba(15,23,42,.04); }
.mx-card h1{ font-size:1.4rem; line-height:1.3; margin:0 0 18px; }
.mx-progress{ display:flex; align-items:center; gap:12px; margin-bottom:20px; font-size:.8125rem; font-weight:700; color:var(--c-ink-soft); }
.mx-bar{ flex:1; height:6px; border-radius:3px; background:var(--c-surface-2); overflow:hidden; }
.mx-bar i{ display:block; height:100%; width:0; background:var(--c-brand); transition:width .25s; }
.mx-choices{ display:grid; gap:10px; }
.mx-choices--grid{ grid-template-columns:repeat(auto-fill,minmax(170px,1fr)); }
.mx-choices--2{ grid-template-columns:1fr 1fr; }
.mx-choice{ position:relative; display:block; cursor:pointer; }
.mx-choice input{ position:absolute; opacity:0; pointer-events:none; }
.mx-choice span{ display:flex; align-items:center; justify-content:center; text-align:center; min-height:52px; padding:10px 12px;
  border:1.5px solid var(--c-line-2); border-radius:10px; background:var(--c-bg); font-weight:600; transition:all .12s; }
.mx-choice--big span{ min-height:64px; font-size:1.0625rem; }
.mx-choice:hover span{ border-color:var(--c-brand); }
.mx-choice input:checked + span{ background:var(--c-brand); border-color:var(--c-brand); color:#fff; }
.mx-choice input:focus-visible + span{ outline:3px solid var(--c-focus); outline-offset:2px; }
.mx-input{ width:100%; padding:13px 14px; font-size:1.0625rem; border:1.5px solid var(--c-line-2); border-radius:10px; background:var(--c-bg); }
.mx-input:focus{ outline:none; border-color:var(--c-focus); box-shadow:0 0 0 3px rgba(37,99,235,.18); }
.mx-summary{ display:flex; flex-wrap:wrap; gap:6px; margin:14px 0; }
.mx-summary span{ font-size:.8125rem; font-weight:600; background:var(--c-surface); border:1px solid var(--c-line); border-radius:999px; padding:3px 10px; }
.mx-rules{ background:var(--c-surface); border-radius:10px; padding:14px 16px; font-size:.9rem; }
.mx-rules ul{ margin:6px 0 0; padding-left:1.15em; } .mx-rules li{ margin:4px 0; }
.mx-error{ color:var(--c-bad); font-weight:600; min-height:1.4em; margin:12px 0 0; font-size:.9375rem; }
.mx-actions{ display:flex; justify-content:space-between; gap:10px; margin-top:8px; }
.mx-actions #next{ margin-left:auto; min-width:140px; }
@media (max-width:520px){
  .mx-card{ padding:20px 16px; }
  .mx-top__org{ display:none; }
  .mx-choices--grid{ grid-template-columns:1fr 1fr; }
  .mx-choices--2{ grid-template-columns:1fr; }
}

/* ================= EXAM SHELL ================= */
body.mx-exam{ height:100dvh; display:grid; grid-template-rows:auto auto 1fr auto; grid-template-columns:minmax(0,1fr); overflow:hidden; background:var(--c-bg); }
.mx-xhead{ display:flex; align-items:center; gap:14px; padding:0 16px; min-height:56px; background:var(--c-bg); border-bottom:2px solid var(--c-line); }
.mx-xhead__who{ min-width:0; line-height:1.25; }
.mx-xhead__name{ font-weight:700; font-size:.9375rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.mx-xhead__sec{ font-size:.8125rem; color:var(--c-ink-soft); white-space:nowrap; }
.mx-xhead__spacer{ flex:1; }
.mx-timer{ display:inline-flex; align-items:center; gap:6px; font-variant-numeric:tabular-nums; font-weight:700; font-size:1.0625rem;
  padding:6px 16px; border-radius:999px; border:2px solid var(--c-line); background:var(--c-surface); white-space:nowrap; }
.mx-timer small{ font-weight:600; font-size:.75rem; color:var(--c-ink-soft); }
.mx-timer[data-state="warn"]{ color:var(--c-warn); border-color:var(--c-warn); }
.mx-timer[data-state="danger"]{ color:#fff; background:var(--c-brand); border-color:var(--c-brand); }
.mx-timer[data-state="danger"] small{ color:#fff; }
.mx-vol{ display:flex; align-items:center; gap:6px; color:var(--c-ink-soft); font-size:.75rem; }
.mx-vol svg{ width:18px; height:18px; fill:currentColor; }
.mx-vol input{ width:90px; accent-color:var(--c-brand); }
.mx-xbar{ display:flex; align-items:center; gap:14px; flex-wrap:wrap; padding:8px 16px; background:var(--c-surface); border-bottom:1px solid var(--c-line); font-size:var(--fs-ui); min-height:44px; }
.mx-xbar:empty{ display:none; }
.mx-xbar b{ font-weight:700; }
.mx-audio{ display:flex; align-items:center; gap:10px; flex:1 1 300px; min-width:0; }
.mx-audio__dot{ width:10px; height:10px; border-radius:50%; background:var(--c-line-2); flex-shrink:0; }
.mx-audio[data-state="playing"] .mx-audio__dot{ background:var(--c-brand); animation:pulse 1.2s infinite; }
@keyframes pulse{ 50%{ opacity:.35; } }
.mx-audio__bar{ flex:0 1 220px; height:6px; border-radius:3px; background:var(--c-surface-2); overflow:hidden; }
.mx-audio__bar i{ display:block; height:100%; width:0; background:var(--c-brand); }
.mx-main{ overflow-y:auto; min-height:0; background:var(--c-surface); position:relative; }
.mx-xfoot{ display:flex; align-items:center; gap:12px; padding:6px 12px; min-height:56px; background:var(--c-bg); border-top:2px solid var(--c-line); }
.mx-nav{ flex:1; overflow-x:auto; min-width:0; display:flex; gap:14px; align-items:center; scrollbar-width:thin; }
.mx-navgrp{ display:flex; align-items:center; gap:4px; flex-shrink:0; }
.mx-navgrp__btn{ font:inherit; font-size:.8125rem; font-weight:700; border:0; background:none; cursor:pointer; padding:6px 6px; white-space:nowrap; color:var(--c-ink-soft); border-radius:6px; }
.mx-navgrp__btn small{ font-weight:500; margin-left:4px; }
.mx-navgrp[data-cur="true"] .mx-navgrp__btn{ color:var(--c-brand); }
.mx-navgrp[data-cur="false"] .mx-pip{ display:none; }
.mx-pip{ width:2rem; height:2rem; border-radius:var(--radius); border:1.5px solid var(--c-line); background:var(--c-bg); color:var(--c-ink);
  font-size:.8125rem; font-weight:700; cursor:pointer; flex-shrink:0; padding:0; }
.mx-pip:hover{ border-color:var(--c-brand); }
.mx-pip.done{ background:var(--c-ink); border-color:var(--c-ink); color:#fff; }
.mx-xfoot__count{ font-size:var(--fs-ui); color:var(--c-ink-soft); white-space:nowrap; }

/* paper (listening) */
.mx-wrap{ max-width:940px; margin:0 auto; padding:20px 16px 40px; }
.mx-paper{ background:var(--c-bg); border:1px solid var(--c-line); border-radius:10px; padding:22px 30px; box-shadow:0 1px 2px rgba(15,23,42,.04); }
.mx-paper__head{ display:flex; align-items:baseline; gap:12px; flex-wrap:wrap; margin:0 0 16px; padding:0 0 12px; border-bottom:1px solid var(--c-line); }
.mx-paper__part{ font-size:.75rem; font-weight:800; letter-spacing:.08em; text-transform:uppercase; color:var(--c-brand); }
.mx-paper__title{ margin:0; font-size:1.25rem; line-height:1.25; }

/* reading split */
.mx-sec.mx-rd{ height:100%; }
.mx-sec .mx-split{ height:100%; }
.mx-sec .mx-split .cdi-pane{ min-height:0; }
.mx-viewtog{ display:none; }

/* writing */
.mx-wsplit{ display:grid; grid-template-columns:var(--split) 10px 1fr; height:100%; }
.mx-wpane{ overflow-y:auto; padding:22px 24px 40px; min-height:0; }
.mx-wpane--prompt{ background:var(--c-bg); }
.mx-wpane--answer{ background:var(--c-surface); display:flex; flex-direction:column; }
.mx-handle{ cursor:col-resize; background:var(--c-surface-2); display:flex; align-items:center; justify-content:center; touch-action:none; }
.mx-handle::after{ content:""; width:2px; height:36px; border-radius:2px; background:var(--c-line); }
.mx-wtask__head{ font-size:.75rem; font-weight:800; letter-spacing:.08em; text-transform:uppercase; color:var(--c-brand); margin:0 0 8px; }
.mx-wprompt p{ margin:0 0 12px; }
.mx-wprompt .mx-box{ border:1.5px solid var(--c-ink); padding:12px 16px; font-weight:600; font-style:italic; }
.mx-wimg{ margin:10px 0 0; }
.mx-wimg img{ max-width:100%; height:auto; border:1px solid var(--c-line); border-radius:6px; cursor:zoom-in; }
.mx-wtext{ flex:1; width:100%; min-height:320px; resize:none; padding:14px 16px; border:1.5px solid var(--c-line-2); border-radius:8px; background:var(--c-bg);
  font-size:1rem; line-height:1.7; }
.mx-wtext:focus{ outline:none; border-color:var(--c-focus); box-shadow:0 0 0 3px rgba(37,99,235,.15); }
.mx-wcount{ display:flex; justify-content:space-between; font-size:var(--fs-ui); color:var(--c-ink-soft); margin-top:8px; }
.mx-wcount b{ color:var(--c-ink); }
.mx-wcount .low{ color:var(--c-warn); }

/* centred screens (ready, done, continue) */
.mx-center{ max-width:600px; margin:0 auto; padding:36px 16px; }
.mx-center .mx-card h1{ margin-bottom:10px; }
.mx-facts{ display:flex; flex-wrap:wrap; gap:6px; margin:10px 0 16px; }
.mx-facts span{ font-size:.8125rem; font-weight:600; background:var(--c-surface); border:1px solid var(--c-line); border-radius:999px; padding:3px 10px; }
.mx-sound{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; background:var(--c-surface); border-radius:10px; padding:12px 14px; margin:14px 0 18px; }
.mx-sound input{ flex:1; min-width:120px; accent-color:var(--c-brand); }
.mx-count{ font-size:3.5rem; font-weight:800; color:var(--c-brand); text-align:center; font-variant-numeric:tabular-nums; line-height:1.1; margin:10px 0; }
.mx-big-ok{ width:64px; height:64px; border-radius:50%; background:var(--c-ok-bg); color:var(--c-ok); display:flex; align-items:center; justify-content:center; font-size:2rem; margin:0 0 14px; }

/* result boxes on the finish screen */
.mx-rboxes{ display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin:14px 0 16px; }
.mx-rbox{ background:var(--c-surface); border-radius:10px; padding:10px 12px; }
.mx-rbox span{ display:block; font-size:.72rem; font-weight:700; text-transform:uppercase; letter-spacing:.04em; color:var(--c-ink-soft); }
.mx-rbox b{ display:block; font-size:1.75rem; line-height:1.2; }
.mx-rbox small{ color:var(--c-ink-soft); font-size:.78rem; }

/* toast + dialogs */
.mx-toast{ position:fixed; left:50%; top:70px; transform:translateX(-50%); z-index:80; background:var(--c-ink); color:#fff; padding:10px 18px;
  border-radius:999px; font-size:.9375rem; font-weight:600; box-shadow:var(--shadow); max-width:92vw; text-align:center; }
.mx-dialog{ border:0; border-radius:12px; padding:0; max-width:min(92vw,480px); width:100%; box-shadow:var(--shadow); color:var(--c-ink); }
.mx-dialog::backdrop{ background:rgba(15,23,42,.55); }
.mx-dialog__body{ padding:22px 22px 6px; }
.mx-dialog__body h2{ margin:0 0 8px; font-size:1.125rem; }
.mx-dialog__body p{ margin:0 0 10px; }
.mx-dialog__foot{ display:flex; gap:10px; justify-content:flex-end; padding:12px 22px 18px; }
.mx-zoom{ max-width:96vw; max-height:94vh; padding:10px; }
.mx-zoom img{ max-width:none; display:block; }

/* highlighter */
.mx-hl{ background:#ffe36e; color:#111; border-radius:2px; -webkit-box-decoration-break:clone; box-decoration-break:clone; }
.mx-hlbar{ position:fixed; z-index:70; display:flex; gap:4px; padding:4px; background:var(--c-bg); border:1px solid var(--c-line-2); border-radius:8px; box-shadow:0 4px 16px rgba(0,0,0,.18); }
.mx-hlbar button{ font:inherit; font-size:.875rem; font-weight:600; padding:6px 12px; border:1px solid var(--c-line-2); border-radius:6px; background:var(--c-surface); cursor:pointer; min-height:36px; }
.mx-hlbar button[data-act="hl"]::before{ content:""; display:inline-block; width:.8em; height:.8em; margin-right:6px; vertical-align:-1px; background:#ffe36e; border:1px solid #c9a800; border-radius:2px; }

.mx-preview-tag{ background:var(--c-warn-bg); color:var(--c-warn); font-weight:700; font-size:.75rem; border-radius:999px; padding:2px 10px; }

/* ================= PHONES / SMALL SCREENS ================= */
@media (max-width:820px){
  .mx-xhead{ flex-wrap:wrap; gap:6px 10px; padding:6px 10px; }
  .mx-xhead__spacer{ display:none; }
  .mx-timer{ margin-left:auto; padding:4px 12px; font-size:1rem; }
  .mx-vol{ order:5; width:100%; } .mx-vol input{ flex:1; }
  #finishBtn{ order:4; }
  .mx-xbar{ padding:6px 10px; gap:8px; }
  .mx-paper{ padding:16px 14px; }
  .mx-wrap{ padding:12px 8px 30px; }
  .mx-xfoot{ padding:6px 8px; gap:8px; }
  .mx-xfoot__count{ display:none; }
  /* reading + writing: one pane at a time, switched with the toggle */
  .mx-viewtog{ display:flex; gap:4px; background:var(--c-surface-2); border-radius:999px; padding:3px; }
  .mx-viewtog button{ border:0; background:none; font-weight:700; font-size:.8125rem; padding:5px 12px; border-radius:999px; cursor:pointer; color:var(--c-ink-soft); }
  .mx-viewtog button[aria-pressed="true"]{ background:var(--c-bg); color:var(--c-ink); box-shadow:0 1px 2px rgba(0,0,0,.12); }
  .mx-sec .mx-split, .mx-wsplit{ display:block !important; }
  .mx-sec .mx-split .cdi-split__handle, .mx-wsplit .mx-handle{ display:none !important; }
  .mx-sec .mx-split .cdi-pane, .mx-wpane{ height:100%; overflow-y:auto !important; border:0 !important; padding:16px 12px 40px !important; }
  [data-view="q"] .cdi-pane--passage, [data-view="q"] .mx-wpane--prompt{ display:none !important; }
  [data-view="p"] .cdi-pane--questions, [data-view="p"] .mx-wpane--answer{ display:none !important; }
  .mx-wtext{ min-height:55vh; }
}
@media (max-width:480px){
  .mx-xhead__sec{ display:none; }
  .mx-brand{ font-size:.9375rem; letter-spacing:1px; }
}
