/* Shared virtual-lab kit: "clean lab, soft studio". One accent (now / correct), one warm colour (fix this). */
@font-face { font-family: Figtree; src: url(fonts/Figtree-var.woff2) format('woff2'); font-weight: 300 900; font-display: swap; }
:root { --bg: #f4f6f8; --panel: #fff; --ink: #1c2430; --muted: #5b6675; --line: #dde3ea; --accent: #1f8a8a; --accent-soft: #e3f3f2; --warn: #c9622b; --warn-soft: #fdf0e8; --paper: #fffefb; --arial: Arial, Helvetica, sans-serif; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 Figtree, system-ui, sans-serif; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.top { display: flex; align-items: center; gap: 14px; padding: 10px 16px 0; max-width: 1600px; margin: 0 auto; }
.top a { color: var(--accent); font-weight: 700; text-decoration: none; font-size: 14px; white-space: nowrap; }
.top h1 { margin: 0; font-size: 18px; font-weight: 800; flex: 1; min-width: 0; }
.top .sub { color: var(--muted); font-size: 13px; white-space: nowrap; }

/* ---------- workspace: three resizable panels ---------- */
.lab { --c1: 330px; --c3: 360px; max-width: 1600px; margin: 10px auto 16px; display: grid; grid-template-columns: var(--c1) 12px minmax(380px, 1fr) 12px var(--c3); padding: 0 16px; height: calc(100vh - 64px); min-height: 560px; }
.lab.full { max-width: none; position: fixed; inset: 0; margin: 0; height: 100vh; padding: 8px; background: var(--bg); z-index: 50; }
.lab:fullscreen { max-width: none; margin: 0; height: 100vh; padding: 8px; background: var(--bg); }
.panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.ph { display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--line); font: 700 12px Figtree, sans-serif; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; background: #fff; flex: none; }
.ph .tt { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph button { font: 600 13px Figtree, sans-serif; border: 1px solid var(--line); background: #fff; border-radius: 6px; min-width: 30px; height: 28px; cursor: pointer; color: var(--ink); padding: 0 7px; text-transform: none; letter-spacing: 0; white-space: nowrap; }
.ph button:hover, .ph button:focus-visible { border-color: var(--accent); color: var(--accent); outline: none; }
.ph button[aria-pressed=true] { background: var(--accent-soft); border-color: var(--accent); color: #14605f; }
.pb { flex: 1; overflow: auto; min-height: 0; position: relative; }
.split { cursor: col-resize; display: flex; align-items: center; justify-content: center; touch-action: none; }
.split::after { content: ""; width: 4px; height: 44px; border-radius: 2px; background: #c3ccd6; }
.split:hover::after, .split.drag::after { background: var(--accent); }
.panel.min .pb, .panel.min .ph .act { display: none; }
.panel.min .ph { writing-mode: vertical-rl; flex: 1; border: 0; justify-content: flex-start; padding: 10px 0; gap: 10px; cursor: pointer; align-items: center; }
.panel.min .ph .tt { flex: none; overflow: visible; }
.panel.min .ph button { writing-mode: horizontal-tb; }
.lab.focus-bench #pPaper, .lab.focus-bench #pSheet { }

/* ---------- question paper (Arial, like the booklet) ---------- */
.paper-b { background: var(--paper); padding: 12px 16px 18px; font-family: var(--arial); font-size: 14px; line-height: 1.55; }
.zoomtxt .paper-b, .zoomtxt .sheet-b { font-size: 17px; }
.paper-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; font: 600 12px Figtree, sans-serif; color: var(--muted); margin-bottom: 10px; position: sticky; top: -12px; background: var(--paper); padding: 6px 0; z-index: 2; }
.narr { display: inline-flex; gap: 6px; align-items: center; background: var(--accent); color: #fff; border: 0; border-radius: 99px; padding: 4px 11px; font: 700 12px Figtree, sans-serif; cursor: pointer; white-space: nowrap; }
.narr[aria-pressed=false] { background: #e8ecf0; color: var(--ink); }
.narr svg { width: 14px; height: 14px; }
/* every icon is an inline SVG glyph at one size per context */
svg.ic { width: 16px; height: 16px; flex: none; display: inline-block; vertical-align: -3px; }
.ph button, .btn, .top a, .chip, .go { display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.ph button svg.ic { width: 16px; height: 16px; }
.chip svg.ic { width: 14px; height: 14px; }
.btn.small svg.ic { width: 14px; height: 14px; }
.paper-bar { flex-wrap: wrap; }
.nwrap { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.nctl { display: inline-flex; align-items: center; gap: 2px; background: #e8ecf0; border-radius: 99px; padding: 2px; }
.nctl[hidden] { display: none; }
.nctl button { width: 26px; height: 26px; border: 0; background: transparent; border-radius: 50%; display: grid; place-items: center; padding: 0; cursor: pointer; color: var(--ink); }
.nctl button svg.ic { width: 16px; height: 16px; }
.nctl button:hover:not(:disabled), .nctl button:focus-visible { background: #fff; color: var(--accent); outline: none; }
.nctl button:disabled { opacity: .35; cursor: default; }
.nctl button.sp { width: auto; min-width: 38px; border-radius: 99px; font: 700 12px Figtree, sans-serif; font-variant-numeric: tabular-nums; }
.mk-ic { display: inline-flex; vertical-align: -3px; }
.mk-ic svg.ic { width: 15px; height: 15px; }
.mk-ic.ok { color: var(--accent); } .mk-ic.no { color: #b4471a; }
.res li.ok, .res li.no { list-style: none; margin-left: -16px; }
.pq { position: relative; margin: 8px 0; padding: 6px 30px 6px 8px; border-radius: 4px; border-left: 3px solid transparent; }
.pq.cur { background: var(--accent-soft); border-left-color: var(--accent); }
.pq.done { color: #8a939e; }
.pq.done .lbl::before { content: ""; display: inline-block; width: 1em; height: 1em; margin-right: 4px; vertical-align: -.15em; background: var(--accent); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat; }
.pq.future { color: #3c4652; }
.pq .row { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; }
.pq .lbl { font-weight: 700; white-space: nowrap; }
.pq .lbl.plain { font-weight: 400; }
.pq p { margin: 0 0 6px; }
.pq ul { margin: 4px 0 4px; padding-left: 22px; }
.pq .mk { display: block; text-align: right; font-size: 13px; }
.pq .rep { position: absolute; right: 4px; top: 4px; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line); background: #fff; cursor: pointer; display: grid; place-items: center; padding: 0; color: var(--muted); }
.pq .rep:hover { color: var(--accent); border-color: var(--accent); }
.pq .rep svg { width: 13px; height: 13px; }
.pq.done .rep { opacity: .5; }
.fig { margin: 10px 0 4px; text-align: center; }
.fig svg { width: 100%; max-width: 380px; height: auto; font-family: var(--arial); }
.fig .cap { font-weight: 700; font-size: 13px; margin-top: 2px; }
.fig .cap small { font-weight: 400; color: var(--muted); font-size: 11px; }
.credit { font: 11px/1.45 Figtree, sans-serif; color: var(--muted); margin-top: 16px; border-top: 1px solid var(--line); padding-top: 8px; }

/* ---------- bench ---------- */
.stage .pb { overflow: hidden; display: flex; flex-direction: column; }
.benchview { position: relative; flex: 1; min-height: 0; }
.benchview canvas.bench-c { width: 100%; height: 100%; display: block; touch-action: none; }
.nogl { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--muted); background: linear-gradient(#eef1f4, #e2e7ec); }
.hud { position: absolute; left: 10px; top: 10px; z-index: 2; display: flex; gap: 6px; flex-wrap: nowrap; max-width: calc(100% - 20px); pointer-events: none; }
.chip { background: rgba(255,255,255,.94); border: 1px solid var(--line); border-radius: 8px; padding: 4px 9px; font-weight: 700; font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chip.late { color: var(--warn); border-color: var(--warn); }
.chip .k { color: var(--muted); font-weight: 600; }
.cuwrap { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 3; }
.closeup { width: 220px; height: 220px; border-radius: 50%; border: 4px solid #fff; box-shadow: 0 6px 24px rgba(20,30,40,.25); cursor: zoom-in; transition: width .25s, height .25s; background: #f6f8fa; touch-action: none; display: block; }
.closeup.big { width: min(440px, calc(100vw - 60px)); height: min(440px, calc(100vw - 60px)); cursor: zoom-out; }
.cuwrap.off { display: none; }
.cu-l { font-size: 12px; font-weight: 700; color: var(--muted); text-align: center; background: rgba(255,255,255,.9); border-radius: 8px; padding: 2px 8px; max-width: 240px; }
.cu-btns { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.cu-btns button { font: 600 12px Figtree, sans-serif; border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 2px 10px; cursor: pointer; }
.cu-btns button:hover { border-color: var(--accent); color: var(--accent); }
.hint { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); background: var(--ink); color: #fff; border-radius: 12px; padding: 7px 14px; font-weight: 600; font-size: 13px; max-width: calc(100% - 24px); text-align: center; pointer-events: none; z-index: 2; }
.hint.warn { background: var(--warn); }
.hint:empty { display: none; }
.actions { flex: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--line); background: #fbfcfd; min-height: 50px; align-items: center; }
.actions .grp { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.actions .sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 2px; }
.btn { font: 700 13px Figtree, sans-serif; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 12px; cursor: pointer; color: var(--ink); white-space: nowrap; touch-action: none; user-select: none; -webkit-user-select: none; }
.btn:hover:not(:disabled), .btn:focus-visible { border-color: var(--accent); color: var(--accent); outline: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: #187474; color: #fff; }
.btn.hold.on { background: var(--accent-soft); border-color: var(--accent); color: #14605f; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.small { padding: 4px 9px; font-size: 12px; }
.bench-pop { position: absolute; left: 12px; bottom: 56px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 30px rgba(20,30,40,.18); padding: 10px 12px; z-index: 4; max-width: calc(100% - 24px); }
.bench-pop h4 { margin: 0 0 6px; font-size: 13px; }
.bench-pop .grid { display: grid; grid-template-columns: repeat(4, auto); gap: 6px; }
.flipper { width: 220px; height: 56px; border-radius: 28px; background: #eef2f5; border: 1px solid var(--line); position: relative; touch-action: none; user-select: none; }
.flipper .knob { position: absolute; left: 4px; top: 4px; width: 48px; height: 48px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; cursor: grab; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.flipper .lane { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 12px; font-weight: 700; pointer-events: none; }

/* ---------- answer sheet ---------- */
.sheet-b { padding: 12px 16px 24px; font-family: var(--arial); font-size: 14px; }
.sec { margin: 0 0 18px; }
.sec .ql { font-weight: 700; margin: 0 0 4px; }
.sec .qt { margin: 0 0 6px; color: #3c4652; }
.sec.locked-future { opacity: .4; }
.lines { width: 100%; min-height: 84px; border: 0; resize: vertical; font: 15px/28px var(--arial); background: repeating-linear-gradient(transparent 0 27px, #9aa4af 27px 28px); background-attachment: local; padding: 0 2px; color: #111; outline: none; }
.lines:focus { background-color: #fbfdff; }
.lines:disabled { color: #333; }
.mkr { text-align: right; font-size: 13px; }
.tray { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; font-family: Figtree, sans-serif; }
.tray .tl { width: 100%; font-size: 12px; color: var(--muted); font-weight: 600; }
.tray button { font: 600 12.5px Figtree, sans-serif; border: 1px dashed #aab4bf; background: #fff; border-radius: 99px; padding: 4px 10px; cursor: pointer; text-align: left; }
.tray button:hover { border-color: var(--accent); color: var(--accent); }
.checkrow { display: flex; gap: 8px; align-items: center; margin-top: 6px; font-family: Figtree, sans-serif; }
.res { margin-top: 8px; font: 13px/1.5 Figtree, sans-serif; border-radius: 8px; padding: 8px 10px; background: var(--accent-soft); color: #134e4d; }
.res.no { background: var(--warn-soft); color: #7a3a16; }
.res b.sc { font-size: 14px; }
.res ul { margin: 4px 0 0; padding-left: 18px; }
.res li.no { color: #8a3f15; }
.res li.ok::marker { color: var(--accent); }
.t21 { border-collapse: collapse; width: 100%; font-family: var(--arial); }
.t21 caption { font-weight: 700; margin-bottom: 4px; }
.t21 th, .t21 td { border: 1px solid #333; padding: 5px 4px; text-align: center; vertical-align: middle; }
.t21 th { font-weight: 400; font-size: 12.5px; line-height: 1.3; }
.t21 input { width: 100%; max-width: 70px; border: 1px solid var(--line); border-radius: 4px; padding: 4px 2px; text-align: center; font: 15px var(--arial); background: #fbfdff; }
.t21 input.now { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.t21 input.ok { border-color: var(--accent); background: var(--accent-soft); }
.t21 input.bad { border-color: var(--warn); background: var(--warn-soft); }
.field { display: flex; align-items: baseline; justify-content: flex-end; gap: 6px; margin: 10px 0; flex-wrap: wrap; }
.field input { width: 110px; border: 0; border-bottom: 2px dotted #555; font: 16px var(--arial); text-align: center; background: #fbfdff; padding: 2px; }
.field input.ok { border-bottom-color: var(--accent); background: var(--accent-soft); }
.field input.bad { border-bottom-color: var(--warn); background: var(--warn-soft); }
.field .times { font: 700 13px Figtree, sans-serif; border: 1px solid var(--line); border-radius: 6px; background: #fff; padding: 2px 8px; cursor: pointer; }
.working { width: 100%; min-height: 56px; border: 1px dashed #b8c1ca; border-radius: 6px; font: 15px var(--arial); padding: 6px; resize: vertical; }

/* ---------- drawing box ---------- */
.dbox { position: relative; border: 1.5px solid #333; background: #fff; width: 100%; aspect-ratio: 160 / 115; touch-action: none; user-select: none; -webkit-user-select: none; overflow: hidden; }
.dbox canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.dbox .pen-cta { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font: 700 14px Figtree, sans-serif; color: #8a96a3; pointer-events: none; text-align: center; }
.dtools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 6px 0; font-family: Figtree, sans-serif; }
.dtools .btn[aria-pressed=true] { background: var(--accent-soft); border-color: var(--accent); color: #14605f; }
.dnote { font: 12.5px Figtree, sans-serif; color: #7a3a16; background: var(--warn-soft); border-radius: 6px; padding: 4px 8px; margin: 4px 0; }
.dmini { display: flex; gap: 10px; justify-content: center; margin: 8px 0; flex-wrap: wrap; }
.dmini figure { margin: 0; text-align: center; font: 600 11.5px Figtree, sans-serif; color: var(--muted); }
.dmini canvas { width: 150px; height: 150px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 4px 16px rgba(20,30,40,.22); display: block; touch-action: none; background: #fff; }
.selfchk { font: 13.5px/1.45 Figtree, sans-serif; margin: 8px 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfd; }
.selfchk label { display: flex; gap: 8px; align-items: flex-start; margin: 4px 0; cursor: pointer; }
.selfchk input { margin-top: 3px; accent-color: var(--accent); }
.dmark { font: 13px/1.5 Figtree, sans-serif; }
.dmark .pt { display: flex; gap: 6px; align-items: baseline; }
.tag { font-size: 11px; font-weight: 700; border-radius: 4px; padding: 0 6px; background: var(--accent-soft); color: #14605f; white-space: nowrap; }
.tag.unc { background: #eef1f4; color: var(--muted); }
.caveat { font: italic 12.5px Figtree, sans-serif; color: var(--muted); margin-top: 6px; }

/* ---------- overlays (start, results) ---------- */
.overlay { position: fixed; inset: 0; background: rgba(28,36,48,.45); display: grid; place-items: center; z-index: 100; padding: 16px; overflow: auto; }
.card { background: #fff; border-radius: 16px; max-width: 760px; width: 100%; padding: 22px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.25); max-height: calc(100vh - 32px); overflow: auto; }
.card h2 { margin: 0 0 4px; font-size: 22px; }
.card .lead { margin: 0 0 12px; color: var(--muted); }
.card .fine { font-size: 12px; color: var(--muted); line-height: 1.45; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 14px; }
.card .go { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.marks { border-collapse: collapse; width: 100%; font-size: 14px; margin: 8px 0; }
.marks td, .marks th { border-bottom: 1px solid var(--line); padding: 6px 4px; text-align: left; vertical-align: top; }
.marks td.n { text-align: right; white-space: nowrap; font-weight: 700; }
.marks tr.tot td { font-weight: 800; border-bottom: 0; }
.pit { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0; font-size: 13.5px; }
.pit ul { margin: 4px 0; padding-left: 18px; }
.pit h4 { margin: 0; font-size: 13px; }
.trace svg { width: 100%; height: auto; display: block; }

/* ---------- narrow screens: panels stack ---------- */
@media (max-width: 1000px) {
  .lab, .lab.full { grid-template-columns: 1fr; height: auto; gap: 10px; padding: 0 16px; position: static; }
  .split { display: none; }
  .stage { height: 560px; }
  .panel.min .ph { writing-mode: horizontal-tb; }
  .panel.min .pb { display: none; }
  #pPaper .pb { max-height: 60vh; }
  .top .sub { display: none; }
  .closeup { width: 170px; height: 170px; }
  .pit { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .chip .k { display: none; }
  .closeup { width: 140px; height: 140px; }
  .cu-l { max-width: 150px; font-size: 11px; }
}

/* a mistake, shown straight away on the bench */
.errcard { position: absolute; left: 50%; top: 56px; transform: translateX(-50%); width: min(440px, calc(100% - 24px)); background: #fff; border: 1.5px solid #c9622b; border-radius: 12px; box-shadow: 0 8px 28px rgba(20,30,40,.18); padding: 12px 14px; z-index: 5; font: 14px/1.45 Figtree, sans-serif; color: var(--ink); }
.errcard .et { display: flex; align-items: center; gap: 6px; color: #a8461a; font-size: 15px; }
.errcard .et svg.ic { width: 18px; height: 18px; }
.errcard ul { margin: 6px 0 10px; padding-left: 20px; }
.errcard .eb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.errcard .skip { margin-left: auto; border: 0; background: none; padding: 6px 2px; font: 600 12px Figtree, sans-serif; color: var(--muted, #626879); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.errcard .skip:hover, .errcard .skip:focus-visible { color: var(--ink); outline: none; }
