:root { --b: #0052B4; --bd: #00428f; --g: #2F8D47; --gd: #26763a; --t: #242424; --m: #4b4b4b; --ln: #DCE3EE; --lt: #F4F7FB; --hd: #232A74; --warn: #C0392B; }
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 400 16px/1.6 Inter, system-ui, sans-serif; color: var(--t); background: var(--lt); }
h1, h2, h3, h4 { font-family: Roboto, Inter, sans-serif; color: var(--t); letter-spacing: -.2px; }
button { font: inherit; }
.app { min-height: 100vh; display: flex; flex-direction: column; }
.boot { margin: auto; color: var(--m); }

/* header bar (exam-centre look: navy bar, section name, timer) */
.xh { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px; background: var(--hd); color: #fff; }
.xh-l { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { display: inline-flex; align-items: center; height: 40px; padding: 3px 10px; border-radius: 8px; background: #fff; flex-shrink: 0; }
.logo img { display: block; height: 34px; width: auto; }
.logo.txt { width: 38px; height: 30px; padding: 0; justify-content: center; color: var(--b); font: 800 13px Roboto; }
.xh-t { font: 600 15px Inter; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xh-r { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.qc { font: 600 14px Inter; color: #cfd8f2; }
.timer { font: 700 18px/1 'Roboto Mono', ui-monospace, Menlo, monospace; background: rgba(255,255,255,.12); padding: 7px 12px; border-radius: 8px; min-width: 78px; text-align: center; }
.timer.warn { background: var(--warn); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .75; } }
.tabs { display: flex; gap: 4px; }
.tab { border: 1px solid rgba(255,255,255,.35); background: transparent; color: #fff; padding: 5px 12px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.tab.on { background: #fff; color: var(--hd); font-weight: 700; }
.xlink { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; font-size: 14px; }
.xh .xlink { color: #cfd8f2; }

/* buttons */
.xb { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 22px; border: 1px solid transparent; border-radius: 8px; font: 700 15px Inter; cursor: pointer; text-decoration: none; transition: background .15s; }
.xb:disabled { opacity: .45; cursor: not-allowed; }
.xb-g { background: var(--g); color: #fff; }
.xb-g:hover:not(:disabled) { background: var(--gd); }
.xb-b { background: var(--b); color: #fff; }
.xb-b:hover:not(:disabled) { background: var(--bd); }
.xb-ghost { background: #fff; color: var(--b); border-color: var(--ln); }
.xb-ghost:hover:not(:disabled) { border-color: var(--b); }

/* welcome / intro / contact */
.wel, .intro, .res { flex: 1; padding: 40px 20px 60px; }
.wel-c, .intro-c { max-width: 720px; margin: 0 auto; background: #fff; border: 1px solid var(--ln); border-radius: 14px; padding: 32px; box-shadow: 0 8px 30px rgba(0,40,100,.06); }
.wel-c.narrow { max-width: 560px; }
.eyebrow { margin: 0 0 6px; color: var(--g); font: 700 13px Inter; letter-spacing: .08em; text-transform: uppercase; }
h1 { font-size: clamp(26px, 3vw, 34px); line-height: 1.2; margin: 0 0 10px; }
.lead { color: var(--m); margin: 0 0 20px; }
.picks { display: grid; gap: 8px; margin: 0 0 8px; }
.pick { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 12px; padding: 12px 14px; border: 1px solid var(--ln); border-radius: 10px; cursor: pointer; }
.pick:has(input:checked) { border-color: var(--b); background: #F2F7FF; }
.pick input { width: 18px; height: 18px; accent-color: var(--b); }
.pk-n { font-weight: 600; }
.pk-n small { display: block; font-weight: 400; color: var(--m); font-size: 13px; }
.pk-m { color: var(--m); font-size: 14px; }
.pick em { grid-column: 2 / -1; font-style: normal; font-size: 13px; color: #a15c00; }
.pick.dis { opacity: .6; cursor: not-allowed; }
.total { font-weight: 600; margin: 8px 0 16px; }
.rules { margin: 0 0 24px; padding-left: 20px; color: var(--m); font-size: 15px; }
.rules li { margin: 6px 0; }
.intro-c .meta { font-weight: 600; color: var(--b); margin: 0 0 14px; }
.intro-c ul { padding-left: 20px; margin: 0 0 24px; color: var(--m); }
.intro-c li { margin: 6px 0; }
.mic-check { background: var(--lt); border-radius: 10px; padding: 12px 16px; margin: 0 0 22px; font-size: 15px; }
.mic-check p { margin: 0; }
.mic-check .warn { color: #a15c00; }

form label { display: block; font-weight: 600; font-size: 14.5px; margin: 0 0 14px; }
form label em { font-weight: 400; font-style: normal; color: var(--m); }
form input[type=email], form input[type=tel], form input[name=name], form select { display: block; width: 100%; margin-top: 6px; padding: 11px 12px; border: 1px solid #c6d0de; border-radius: 8px; font: 400 16px Inter; background: #fff; }
form input:focus, form select:focus { outline: 2px solid var(--b); outline-offset: 0; border-color: var(--b); }
.ph { display: flex; gap: 8px; }
.ph select { width: 44%; }
.ph input { flex: 1; }
.chk { display: flex !important; gap: 10px; align-items: flex-start; font-weight: 400 !important; font-size: 14px !important; color: var(--m); }
.chk input { margin-top: 4px; width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--g); }
.chk a { color: var(--b); }
.err { color: var(--warn); font-weight: 600; margin: 0 0 12px; }
.grading { display: flex; gap: 14px; align-items: center; margin-top: 20px; padding: 14px 16px; background: var(--lt); border-radius: 10px; }
.grading p { margin: 0; color: var(--m); font-size: 15px; }
.spin { width: 26px; height: 26px; border: 3px solid #c9d6ea; border-top-color: var(--b); border-radius: 50%; animation: spin .8s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* multiple choice */
.mcq, .ee, .eo { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; min-height: 0; }
.mcq.two, .ee, .eo { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.doc { background: #fff; border-right: 1px solid var(--ln); overflow: auto; max-height: calc(100vh - 124px); }
.doc-c { padding: 26px 30px; max-width: 760px; }
.cpara { margin: 0 0 12px; font-size: 15.5px; }
.cpara.big { font-size: 17px; }
.crow { display: grid; gap: 12px; margin: 0 0 12px; }
.crow.c2 { grid-template-columns: 1fr 1fr; }
.crow.c3 { grid-template-columns: repeat(3, 1fr); }
.crow.c4 { grid-template-columns: repeat(4, 1fr); }
.cell { border: 1px solid var(--ln); border-radius: 8px; padding: 10px 12px; font-size: 14.5px; background: var(--lt); }
.qp { padding: 26px 30px 30px; overflow: auto; max-height: calc(100vh - 124px); }
.mcq:not(.two) .qp { max-width: 820px; width: 100%; margin: 0 auto; }
.grp { margin: 0 0 14px; font: 600 13px Inter; color: var(--b); text-transform: uppercase; letter-spacing: .04em; }
.grp span { text-transform: none; letter-spacing: 0; color: var(--m); font-weight: 500; }
.stem { font-size: 19px; line-height: 1.4; margin: 0 0 16px; }
.qn { color: var(--b); }
.opts { display: grid; gap: 10px; margin-top: 14px; }
.opt { display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 12px 14px; background: #fff; border: 1.5px solid var(--ln); border-radius: 10px; cursor: pointer; font-size: 15.5px; color: var(--t); }
.opt:hover { border-color: #9fb6da; }
.opt.on { border-color: var(--b); background: #EEF4FF; }
.ol { flex-shrink: 0; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid #9fb6da; font: 700 13px Inter; color: var(--b); }
.opt.on .ol { background: var(--b); border-color: var(--b); color: #fff; }
.graphs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.graphs figure { margin: 0; border: 1px solid var(--ln); border-radius: 8px; padding: 8px; background: #fff; }
.graphs img { width: 100%; height: auto; display: block; }
.graphs figcaption { text-align: center; font: 600 13px Inter; color: var(--m); margin-top: 4px; }
.drawings { margin: 10px 0; border: 1px solid var(--ln); border-radius: 10px; background: #fff; padding: 10px; }
.drawings img { width: 100%; height: auto; display: block; max-width: 640px; margin: 0 auto; }

.audio { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 12px; background: #fff; border: 1px solid var(--ln); margin: 0 0 18px; }
.au-i { width: 38px; height: 38px; border-radius: 50%; background: var(--b); flex-shrink: 0; position: relative; }
.au-i::after { content: ''; position: absolute; left: 14px; top: 11px; border-left: 13px solid #fff; border-top: 8px solid transparent; border-bottom: 8px solid transparent; }
.audio.playing .au-i { background: var(--g); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(47,141,71,.18); } }
.au-t { font-weight: 600; font-size: 15px; }
.au-s { font-size: 13.5px; color: var(--m); }

/* footer */
.xf { position: sticky; bottom: 0; z-index: 4; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px; background: #fff; border-top: 1px solid var(--ln); }
.xf-r { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.xf .xlink { color: var(--m); }
.hint { font-size: 13.5px; color: var(--m); }

/* writing */
.tintro p { margin: 0 0 10px; font-size: 15px; color: var(--m); }
.tdoc { margin-top: 14px; border: 1px solid var(--ln); border-radius: 10px; padding: 16px 18px; background: var(--lt); }
.tdoc p { margin: 0 0 8px; font-size: 15px; }
.tdoc p.h { font: 700 17px Roboto; }
.tdoc p.ctr { text-align: center; }
.wr { display: flex; flex-direction: column; padding: 20px 24px; min-height: 0; }
.wr-l { font-weight: 600; margin-bottom: 8px; }
.wr textarea { flex: 1; min-height: 340px; width: 100%; padding: 14px 16px; border: 1px solid #c6d0de; border-radius: 10px; font: 400 16px/1.65 Inter; resize: none; background: #fff; }
.wr textarea:focus { outline: 2px solid var(--b); }
.wc { margin-top: 8px; font-size: 14px; color: var(--m); }
.wc .ok { color: var(--g); font-weight: 700; }

/* speaking */
.chat { display: flex; flex-direction: column; min-height: 0; max-height: calc(100vh - 124px); padding: 16px 20px; }
.log { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 2px 12px; min-height: 200px; }
.msg { max-width: 86%; padding: 10px 14px; border-radius: 14px; font-size: 15.5px; background: #fff; border: 1px solid var(--ln); align-self: flex-start; }
.msg.me { align-self: flex-end; background: #E6EFFD; border-color: #c8dafa; }
.who { display: block; font: 700 11.5px Inter; text-transform: uppercase; letter-spacing: .05em; color: var(--m); margin-bottom: 2px; }
.dots i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #9fb6da; margin-right: 4px; animation: dot 1s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 50% { opacity: .3; } }
.live { margin: 6px 0; padding: 10px 14px; border-radius: 10px; background: #FFF8E6; border: 1px dashed #e2b65a; font-size: 15px; color: var(--t); }
.micbox { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 8px; }
.mic { display: flex; align-items: center; gap: 12px; padding: 14px 26px; border-radius: 999px; border: 0; background: var(--b); color: #fff; font: 700 16px Inter; cursor: pointer; }
.mic .dot { width: 14px; height: 14px; border-radius: 50%; background: #fff; }
.mic.on { background: var(--warn); }
.mic.on .dot { animation: pulse2 1s ease-in-out infinite; }
@keyframes pulse2 { 50% { transform: scale(1.4); opacity: .6; } }
.micbox .xlink { color: var(--m); }
.typebox { display: flex; gap: 8px; align-items: flex-end; padding-top: 8px; }
.typebox textarea { flex: 1; padding: 10px 12px; border: 1px solid #c6d0de; border-radius: 10px; font: 400 15.5px Inter; resize: none; }

/* modal + toasts */
.mod { position: fixed; inset: 0; z-index: 20; background: rgba(10,20,40,.45); display: grid; place-items: center; padding: 20px; }
.mod-c { background: #fff; border-radius: 14px; padding: 24px; max-width: 460px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.mod-c p { margin: 0 0 18px; }
.mod-b { display: flex; gap: 8px; justify-content: flex-end; }
.pal { max-width: 560px; }
.pg { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; margin-bottom: 18px; }
.pg button { aspect-ratio: 1; border: 1.5px solid var(--ln); background: #fff; border-radius: 6px; cursor: pointer; font: 600 13px Inter; position: relative; }
.pg button.a { background: #E6EFFD; border-color: #9fb6da; }
.pg button.f::after { content: ''; position: absolute; top: 2px; right: 2px; width: 7px; height: 7px; border-radius: 50%; background: #E49B0F; }
.pg button.cur { outline: 2px solid var(--b); }
.lg { font-size: 13px; color: var(--m); margin-left: 10px; }
.lg i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin: 0 4px 0 10px; vertical-align: -1px; }
.lg i.a { background: #E6EFFD; border: 1px solid #9fb6da; }
.lg i.f { background: #E49B0F; border-radius: 50%; }
.toast { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); z-index: 30; background: var(--hd); color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 15px; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.fsbar { position: fixed; top: 0; left: 0; right: 0; z-index: 40; background: #FFF3D6; color: #6b4500; text-align: center; padding: 8px; font-size: 14px; }
.fsbar button { margin-left: 8px; border: 1px solid #c9952a; background: #fff; border-radius: 6px; padding: 3px 10px; cursor: pointer; }

/* results */
.res-c { max-width: 920px; margin: 0 auto; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 8px 0 22px; }
.rc { background: #fff; border: 1px solid var(--ln); border-top: 4px solid var(--b); border-radius: 12px; padding: 16px; }
.rc:nth-child(even) { border-top-color: var(--g); }
.rk { display: block; font: 600 13px Inter; color: var(--m); text-transform: uppercase; letter-spacing: .04em; }
.rc b { display: block; font: 800 26px Roboto; color: var(--t); margin: 4px 0 2px; }
.rs { font-size: 13.5px; color: var(--m); }
.cta2 { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; background: var(--b); color: #fff; border-radius: 14px; padding: 18px 22px; margin: 0 0 22px; }
.cta2 b { display: block; font-size: 17px; }
.cta2 span { color: #dbe6f7; font-size: 14.5px; }
.rv { background: #fff; border: 1px solid var(--ln); border-radius: 12px; margin: 0 0 12px; }
.rv summary { cursor: pointer; padding: 14px 18px; font-weight: 700; }
.tw { overflow-x: auto; padding: 0 18px 16px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--ln); vertical-align: top; }
th { color: var(--m); font-weight: 600; }
tr.ok td:last-child { color: var(--g); font-weight: 700; }
tr.ko td:last-child { color: var(--warn); font-weight: 700; }
.ai { padding: 0 18px 18px; }
.sw { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 10px 0 16px; }
.sw ul { margin: 6px 0 0; padding-left: 18px; color: var(--m); font-size: 15px; }
.at { border-top: 1px solid var(--ln); padding-top: 12px; margin-top: 12px; }
.at h4 { margin: 0 0 8px; font-size: 16px; }
.crit { list-style: none; padding: 0; margin: 0 0 10px; }
.crit li { display: grid; grid-template-columns: 200px 44px 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--ln); font-size: 14.5px; }
.cn { font-weight: 600; }
.cs { font-weight: 700; color: var(--b); }
.cc { color: var(--m); }
.corr p { margin: 0 0 8px; font-size: 14.5px; }
.corr s { color: var(--warn); }
.corr small { color: var(--m); }
.fine { font-size: 13px; color: var(--m); margin-top: 18px; }

@media (max-width: 860px) {
  .mcq.two, .ee, .eo { grid-template-columns: 1fr; }
  .doc { border-right: 0; border-bottom: 1px solid var(--ln); max-height: 46vh; }
  .qp, .chat { max-height: none; }
  .doc-c, .qp { padding: 18px 16px; }
  .crit li { grid-template-columns: 1fr 44px; }
  .crit .cc { grid-column: 1 / -1; }
  .sw { grid-template-columns: 1fr; }
  .crow.c3, .crow.c4 { grid-template-columns: 1fr 1fr; }
  .pg { grid-template-columns: repeat(8, 1fr); }
  .xh-t { font-size: 13.5px; }
  .xf { flex-wrap: wrap; }
}
@media (max-width: 520px) {
  .crow.c2, .crow.c3, .crow.c4, .graphs { grid-template-columns: 1fr; }
  .wel-c, .intro-c { padding: 22px 18px; }
  .xb { padding: 10px 14px; }
  .qc { display: none; }
}
.back2mic { align-self: center; margin-top: 6px; color: var(--m); }
@media (max-width: 520px) {
  .xf { padding: 8px 12px; gap: 6px; }
  .xf-r { width: 100%; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
  .xf .xb { padding: 10px 6px; font-size: 13.5px; min-height: 42px; }
}
.more { margin: -8px 0 20px; font-size: 15px; } .more a { color: var(--b); font-weight: 600; }
@media (max-width: 520px) { .logo { height: 34px; padding: 2px 8px; } .logo img { height: 29px; } }
.rtimer { display: inline-flex; align-items: center; gap: 6px; background: #E49B0F; color: #fff; font: 600 13px Inter; padding: 6px 10px; border-radius: 8px; }
.rtimer b { font: 700 16px/1 'Roboto Mono', ui-monospace, Menlo, monospace; }
.readbar { margin: 0 0 10px; padding: 10px 14px; border-radius: 10px; background: #FFF3D6; border: 1px solid #f0cf86; color: #6b4500; font-size: 14.5px; }
.readbar b { font-family: 'Roboto Mono', ui-monospace, Menlo, monospace; }
.wr textarea:disabled { background: #F4F7FB; cursor: not-allowed; }
