*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.45 "Segoe UI",system-ui,-apple-system,"Helvetica Neue",Arial,sans-serif}
#root{height:100%;display:flex;flex-direction:column}
.center{padding:24px}.err{color:var(--danger)}.muted{color:var(--muted)}
.icon{display:inline-block;width:18px;height:18px;background:currentColor;vertical-align:middle;
  -webkit-mask:var(--icon) center/contain no-repeat;mask:var(--icon) center/contain no-repeat}
button{font:inherit;cursor:pointer;border:1px solid var(--btn-line);background:var(--btn-bg);color:var(--btn-ink);border-radius:8px;padding:6px 14px;font-weight:600;box-shadow:0 3px 0 var(--btn-shadow);transition:transform .1s,box-shadow .1s,background .15s}
button:hover:not(:disabled){background:var(--btn-hover);transform:translateY(-1px)}
button:active:not(:disabled){transform:translateY(2px);box-shadow:0 1px 0 var(--btn-shadow)}
button.primary{background:var(--accent);color:var(--accent-ink);border-color:var(--accent);box-shadow:0 3px 0 #0f1a30}
button.primary:hover:not(:disabled){background:var(--navy-2)}
button.danger{background:var(--danger);color:var(--danger-ink);border-color:var(--danger);box-shadow:0 3px 0 #7b1914}
button:disabled{opacity:.5;cursor:default}
button.iconbtn{padding:4px 6px;line-height:1}
input,select,textarea{font:inherit;color:var(--ink);background:var(--card);border:1px solid var(--line);border-radius:6px;padding:6px 8px;width:100%}
textarea{min-height:80px;resize:vertical}
.topbar{display:flex;align-items:center;justify-content:space-between;background:var(--topbar-bg);color:var(--topbar-ink);padding:0 16px;height:48px;flex:none}
.topbar .left,.topbar .right{display:flex;align-items:center;gap:8px}
.brand{font-weight:700;font-size:22px;margin-right:16px;letter-spacing:2px;text-transform:uppercase}
.tab{background:none;border:0;color:inherit;padding:14px 12px;border-radius:0;opacity:.85;box-shadow:none;transform:none!important}
.tab.active{background:var(--tab-active-bg);opacity:1}
.topbtn{position:relative;background:none;border:0;color:inherit;padding:6px;box-shadow:none}
.badge{position:absolute;top:-2px;right:-4px;background:var(--badge-bg);color:var(--badge-ink);border-radius:10px;font-size:13px;min-width:18px;padding:0 5px;text-align:center}
.menuwrap{position:relative}
.menu{position:absolute;right:0;top:36px;background:var(--card);color:var(--ink);border:1px solid var(--line);border-radius:6px;min-width:160px;box-shadow:0 4px 14px rgba(0,0,0,.2);z-index:10}
.menu button{display:block;width:100%;text-align:left;border:0;border-radius:0;background:none;color:var(--ink);box-shadow:none;font-weight:400}
.menu button:hover:not(:disabled){background:var(--soft);transform:none}
.menu .who{padding:8px 12px;color:var(--muted);border-bottom:1px solid var(--line);font-size:14px}
.content{flex:1;min-height:0;overflow:auto}
.split{display:flex;height:100%}
.nav{flex:none;width:240px;min-width:120px;overflow:auto;background:var(--grey-l);padding:10px}
.divider{flex:none;width:5px;cursor:col-resize;background:var(--line)}
.divider:hover{background:var(--accent)}
.panel{flex:1;min-width:0;overflow:auto;padding:16px}
.navitem{display:flex;align-items:center;gap:6px;padding:6px 10px;cursor:pointer}
.navitem{background:#fff;border-radius:8px;margin-bottom:6px;border-left:6px solid var(--grey);transition:transform .15s,box-shadow .15s,background .15s}
.navitem:hover{transform:translateX(4px);box-shadow:0 4px 12px rgba(27,42,73,.18);background:var(--soft)}
.navitem.sel{background:var(--accent);color:#fff;border-left-color:var(--orange);font-weight:600}
.navitem .label{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.navhead{padding:10px 10px 2px;font-size:13px;text-transform:uppercase;color:var(--muted)}
table{border-collapse:collapse;width:100%;background:var(--card)}
th,td{border-bottom:1px solid var(--line);padding:6px 8px;text-align:left;vertical-align:top}
th{background:var(--soft);font-weight:600;white-space:nowrap}
td.actions{white-space:nowrap}
.head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;margin-bottom:12px}
.head h2{margin:0;font-size:26px}.head .btns{display:flex;gap:8px}
.form{display:grid;grid-template-columns:160px minmax(0,420px);gap:8px 12px;align-items:center;margin-bottom:16px}
.form label{color:var(--muted)}
h3{margin:20px 0 8px}
.overlay{position:fixed;inset:0;background:var(--overlay);display:flex;align-items:center;justify-content:center;z-index:50}
.modal{background:var(--card);border-radius:8px;padding:18px;width:min(460px,92vw)}
.modal h3{margin-top:0}.modal .btns{display:flex;justify-content:flex-end;gap:8px;margin-top:14px}
.toast{position:fixed;bottom:16px;left:50%;transform:translateX(-50%);background:var(--danger);color:var(--danger-ink);padding:8px 14px;border-radius:6px;z-index:60}
button.accent{background:var(--orange);color:var(--orange-ink);border-color:var(--orange)}
.tab.active{box-shadow:inset 0 -3px 0 var(--tab-active-line)}
.navitem.sel{box-shadow:inset 3px 0 0 var(--orange)}
.nav{border-right:0}
th{background:var(--soft)}
.userhead{display:flex;justify-content:space-between;align-items:center;margin:20px 0 8px}
.userhead h3{margin:0}
.placeholder{font-size:42px;font-weight:300;color:var(--muted);text-align:center;padding:15vh 16px}
.link{color:var(--accent);text-decoration:none;font-weight:500}.link:hover{text-decoration:underline}
.whoname{font-weight:600;color:var(--ink)}.menu .who{font-size:15px;color:var(--muted)}
.nowrap{white-space:nowrap}.menu{width:max-content;max-width:90vw}
.split{position:relative}
.split.collapsed>.nav,.split.collapsed>.divider{display:none}
.panelToggle{display:none}.split.collapsed .panelToggle{display:inline-block}
.navtop{display:flex;justify-content:flex-end;padding:0 6px 4px}
.hoveractions{display:none;gap:2px}.navitem:hover .hoveractions{display:flex}
.hoveractions .iconbtn{border:0;background:none;color:var(--accent)}
.navitem.dropok{background:var(--orange-soft);outline:2px dashed var(--orange);outline-offset:-2px}
.chip{font-size:13px;border-radius:10px;padding:0 6px;background:var(--orange-soft);color:var(--orange);border:1px solid var(--orange)}
.chev{width:14px;flex:none;display:inline-block;text-align:center;color:var(--muted);font-size:13px}
.ctx{position:fixed;right:auto;z-index:70}
.ctx button:disabled{opacity:.4;cursor:default}
.ctx button:hover:not(:disabled){background:var(--soft)}
.nav{display:flex;flex-direction:column}
.nav>*{flex:none}
.nav>.navtop{margin-top:auto;padding:8px 6px 2px;justify-content:flex-start}
.split.collapsed .panelToggle{position:absolute;left:8px;bottom:8px}
.crumbs{font-size:14px;color:var(--muted);margin-bottom:8px}.crumbs .link{font-weight:400}
.wbrow{display:flex;margin-top:16px;border-top:1px solid var(--line)}
.wbnav{width:260px;flex:none;padding:8px 0}
.wbcontent{flex:1;min-width:0;padding:12px 16px}
.wbcontent h3.wbtitle{margin:0 0 6px;font-size:22px}
.qrow{border:1px solid var(--line);border-radius:6px;margin-bottom:6px;background:var(--card)}
.qhead{display:flex;justify-content:space-between;gap:12px;padding:8px 10px;cursor:pointer;align-items:baseline}
.qhead:hover{background:var(--soft)}
.qhead .ql{display:flex;gap:10px;align-items:baseline;min-width:0}
.qhead .qtext{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
.qnum{font-weight:700}.qmeta{color:var(--muted);white-space:nowrap}
.qbody{padding:8px 12px 12px;border-top:1px solid var(--line)}
.qbody h4{margin:14px 0 4px;color:var(--muted);font-size:14px;text-transform:uppercase}
.qfig{max-width:100%;max-height:320px;display:block;margin:6px 0;border:1px solid var(--line)}
.pre{white-space:pre-wrap}
.nobreak{white-space:nowrap}
.mathblock{display:block;margin:8px 0;overflow-x:auto;overflow-y:hidden}
.math .katex,.nobreak .katex{white-space:nowrap}
.head .btns{align-items:center}
.optname{display:inline-block;min-width:1.8em;height:1.8em;line-height:1.8em;text-align:center;border-radius:50%}
.optname.correct{background:var(--correct-bg)}
.wbnav{min-height:260px}
.qhead{flex-wrap:wrap}
.qright{display:flex;gap:6px;align-items:center}
.qhead select,.qhead input[type=number]{width:auto;padding:3px 6px}
.ebox{position:relative;border:1px solid transparent;border-radius:6px;padding:6px 40px 8px 8px;margin:6px 0}
.ebox:hover{border-color:var(--accent);background:var(--soft)}
.ebox.changed,.ebox.changed:hover{background:var(--changed-bg)}
.ebox .elabel{font-size:13px;text-transform:uppercase;color:var(--muted);margin-bottom:2px}
.ebox .eswitch{position:absolute;top:4px;right:4px}
select.changed,input.changed{background:var(--changed-bg)}
.optrow{display:flex;gap:6px;margin:4px 0;align-items:flex-start}
.figgrid{display:flex;flex-wrap:wrap;gap:8px}
.figitem{position:relative}
.figitem .qfig{max-height:160px}
.figitem .figremove{position:absolute;top:4px;right:4px;background:var(--card)}
.wbnav{display:flex;flex-direction:column}
.wbnav>*{flex:none}
.wbnav>.navtop{margin-top:auto;justify-content:flex-start;padding:8px 6px 2px 3px}
.wbcontent{display:flex;flex-direction:column}
.wbcontent>*{flex:none}
.wbrow .wbexpand{display:none;margin-top:auto;align-self:flex-start}
.wbrow.collapsed .wbexpand{display:inline-block}
.wbrow.collapsed .wbnav,.wbrow.collapsed .divider{display:none}
/* workbook page fills the panel so the nav/expand buttons can sit at the bottom edge of the visible area */
.wbpage{display:flex;flex-direction:column;min-height:100%}
.wbpage>.wbrow{flex:1}
.wbnav>.navtop,.wbrow .wbexpand{position:sticky;bottom:-8px}
/* all four collapse/expand buttons: 8px from the left and bottom edge of their panel */
.nav>.navtop{padding:8px 0 0 8px}
.wbnav{padding-bottom:0}
.wbnav>.navtop{padding:0;margin-left:-8px}
.wbpage{min-height:calc(100% + 8px);margin-bottom:-8px}
.wbrow .wbexpand{margin-left:-24px;margin-bottom:-12px}
/* both trees collapsed: place the workbook expand button next to the left tree's one instead of over it */
.split.collapsed .wbrow .wbexpand{margin-left:16px}
/* whenever the left tree is collapsed, both workbook tree buttons (collapse and expand) move right to clear the left tree's expand button */
.split.collapsed .wbnav>.navtop{margin-left:32px}

.fignum{position:absolute;top:4px;left:4px;min-width:22px;height:22px;padding:0 5px;box-sizing:border-box;border-radius:11px;background:var(--accent);color:#fff;font:600 15px/22px sans-serif;text-align:center}
.figitem.inlinefig{display:block;margin:6px 0}
.figitem .qfig{margin:0}
/* SVGs without intrinsic size collapse to 0 width in shrink-to-fit grids */
.figitem .qfig{min-width:80px;min-height:40px;width:auto;object-fit:contain}
.figitem:not(.inlinefig) .qfig{height:160px}

.aform{max-width:900px}
.frow{display:flex;gap:12px;align-items:flex-start;margin-bottom:10px}
.frow>label{width:100px;flex:none;padding-top:7px;color:var(--muted)}
.frow>input,.frow>select{flex:1;max-width:360px}
.arow{display:flex;gap:8px;margin-bottom:6px}
.arow select{width:auto;min-width:180px}
.chips{display:flex;flex-wrap:wrap;gap:6px;margin:6px 0}
.achip{display:inline-flex;align-items:center;gap:2px;border:1px solid var(--line);border-radius:12px;padding:1px 4px 1px 10px;background:var(--card)}
.trow{display:flex;align-items:center;gap:8px;padding:6px 4px}
.trow.unit{padding-left:28px}
.trow input[type=checkbox],.tq input[type=checkbox]{width:auto;margin:0}
.qrow.tq{margin-left:52px}

table.results td.ptscell{text-align:center;background:#fff;min-width:44px}
table.results td.ptsfull{background:var(--pts-full-bg)}
table.results td.ptspart{background:var(--pts-part-bg)}
table.results td.ptszero{background:var(--pts-zero-bg)}
table.results th.ptshead{text-align:center;white-space:nowrap}
table.results tr.maxrow th{font-weight:400;text-align:center}
.pbar{position:relative;display:inline-block;width:140px;height:18px;background:#e6ebf2;border-radius:9px;overflow:hidden;vertical-align:middle}
.pfill{position:absolute;left:0;top:0;bottom:0;background:var(--pts-full-bg)}
.ptext{position:relative;display:block;text-align:center;font-size:14px;line-height:18px}
.qframe{border:1px solid var(--line);border-radius:8px;padding:16px 20px;margin-top:14px;background:var(--card);max-width:860px}
.qbig{font-size:42px;font-weight:700;line-height:1.1;margin-bottom:10px}
.qbig .muted{font-size:22px;font-weight:400}.qbig .qpts{font-size:16px;margin-left:14px}
.opts{display:flex;flex-direction:column;gap:6px}
.optrow{display:flex;align-items:center;gap:8px;padding:6px 10px;border:1px solid var(--line);border-radius:6px;cursor:pointer}
.optrow.right{background:var(--pts-full-bg)}
.optrow.wrong{background:var(--wrong-bg)}
.hintbox{margin:8px 0;padding:6px 10px;border-left:3px solid var(--orange)}
.result{margin-top:12px;padding:8px 12px;border-radius:6px;font-weight:600;background:#eef2f8}
.result.right{background:var(--pts-full-bg)}.result.wrong{background:var(--wrong-bg)}
.explbox{margin-top:12px}
.btns2{margin-top:12px}
.qnav{display:flex;justify-content:space-between;margin-top:18px}
.navitem.dead .label{text-decoration:line-through;color:var(--muted)}
.modal.large{width:min(900px,94vw);max-height:88vh;overflow:auto}
.sharebox{border-top:1px solid var(--line);margin-top:14px;padding-top:12px;display:grid;gap:8px}
.sharebox textarea{min-height:70px}
.sharebox .row{display:flex;gap:16px;align-items:center;flex-wrap:wrap}
.sharebox label.inline{display:flex;gap:6px;align-items:center}
.sharebox .res{font-size:15px}.sharebox .res .bad{color:var(--danger)}
.struck{text-decoration:line-through;color:var(--muted)}
tr.dead td{color:var(--muted);text-decoration:line-through}tr.dead td .chip{text-decoration:none;display:inline-block}
.notifs{list-style:none;margin:0;padding:0;max-height:50vh;overflow:auto}.notifs li{padding:8px 0;border-bottom:1px solid var(--line)}
/* quiz: projector view, look taken from the quiz application */
.quizpage,.quizpage body{height:100%;overflow:hidden;margin:0}
.quizroot{position:fixed;inset:0;display:flex;font-size:24px;background:#fff;color:var(--ink)}
.quizroot .quizmain{flex:1;overflow-y:auto;padding:24px 40px;text-align:center;box-sizing:border-box;min-width:0}
.quizroot h1{font-size:52px;letter-spacing:.5px;margin:0 0 16px}
.quizroot h2{font-size:30px;color:var(--grey);font-weight:600;margin:0 0 16px}
.quizroot .info{font-size:26px;margin:8px 0 14px;color:var(--grey)}
.quizroot .btn{font-size:34px;font-weight:700;color:#fff;letter-spacing:1px;background:var(--accent);border:0;border-radius:10px;padding:12px 56px;cursor:pointer;box-shadow:0 6px 0 #0f1a30;transition:transform .1s,box-shadow .1s,background .15s}
.quizroot .btn:hover:not(:disabled){transform:translateY(-3px);background:var(--navy-2)}
.quizroot .btn:active:not(:disabled){transform:translateY(4px);box-shadow:0 2px 0 #0f1a30}
.quizroot .btn:disabled{opacity:.45;cursor:default}
.quizroot .btn-alt{background:var(--grey);box-shadow:0 6px 0 var(--btn-shadow)}.quizroot .btn-alt:hover:not(:disabled){background:var(--btn-hover)}
.quizroot .btn-ok{background:#1f8a4c;box-shadow:0 6px 0 #145c32}.quizroot .btn-ok:hover:not(:disabled){background:#29a35c}
.quizroot .btn-bad{background:#b3261e;box-shadow:0 6px 0 #7b1914}.quizroot .btn-bad:hover:not(:disabled){background:#cc3a31}
.quizroot .qbtn.small{font-size:20px;padding:6px 20px;box-shadow:0 4px 0 var(--btn-shadow)}
.quizroot .actions,.quizroot .qactions{display:flex;flex-wrap:wrap;gap:20px;justify-content:center;margin:16px 0}
.quizroot .qactions .btn{font-size:28px;padding:10px 36px}
/* setup */
.quizroot .unitinfos{display:flex;flex-wrap:wrap;gap:16px;justify-content:center;margin-bottom:24px}
.quizroot .unitinfo{display:flex;flex-direction:column;align-items:center;gap:4px;min-width:220px;padding:16px 22px;background:var(--soft);border:2px solid var(--edge);border-radius:10px;cursor:pointer;animation:pop .45s backwards}
.quizroot .unitinfo input{width:30px;height:30px}
.quizroot .unitinfo b{font-size:26px}.quizroot .unitinfo span{font-size:22px;color:var(--grey)}
.quizroot .unitinfo.off{opacity:.5}.quizroot .unitinfo.none{cursor:default;opacity:.35}
.quizroot .field{font-size:28px;margin:20px 0 8px;display:block}
.quizroot .field.row2{display:flex;gap:16px;align-items:center;justify-content:center}.quizroot .field.row2 input{width:30px;height:30px}
.quizroot .field input[type=number]{font-size:38px;width:170px;text-align:center;padding:6px;border:3px solid var(--accent);border-radius:8px;outline:none;color:var(--ink)}
.quizroot .field input[type=number]:focus{box-shadow:0 0 0 5px rgba(45,67,115,.25)}
.quizroot .field input[type=number]:disabled{opacity:.4}
/* participant and unit boxes */
.quizroot .qpart{display:flex;align-items:center;justify-content:center;gap:28px;margin-bottom:8px}
.quizroot .participant{display:inline-block;font-size:44px;font-weight:700;color:#fff;background:var(--orange);border-radius:12px;padding:6px 36px;animation:pop .5s}
.quizroot .units{display:flex;flex-wrap:wrap;gap:24px;justify-content:center;margin-top:16px}
.quizroot .unit{flex:1 1 280px;max-width:420px;min-height:170px;padding:20px;font:inherit;font-size:36px;font-weight:700;color:#fff;border:0;border-radius:12px;cursor:pointer;box-shadow:0 8px 0 rgba(0,0,0,.2);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;transition:transform .15s,box-shadow .15s;animation:pop .5s backwards}
.quizroot .unit:nth-child(3n+1){background:var(--accent)}.quizroot .unit:nth-child(3n+2){background:var(--grey)}.quizroot .unit:nth-child(3n+3){background:var(--orange)}
.quizroot .unit:not(.empty):hover{transform:translateY(-6px);box-shadow:0 14px 0 rgba(0,0,0,.2)}
.quizroot .unit small{font-size:24px;font-weight:500;opacity:.92}
.quizroot .unit.empty{background:var(--grey-l)!important;color:#8a919b;cursor:default;box-shadow:none}
/* question */
.quizroot .q-label{display:inline-block;font-size:22px;font-weight:700;color:#fff;letter-spacing:2px;text-transform:uppercase;background:var(--orange);border-radius:6px;padding:4px 22px;margin-bottom:12px}
.quizroot .a-label{background:var(--accent)}.quizroot .h-label{background:var(--grey)}.quizroot .e-label{background:var(--orange);font-size:18px}
.quizroot .block{animation:slidein .45s;margin-bottom:16px}
.quizroot .md{font-family:var(--font);font-size:clamp(30px,3.4vw,52px);line-height:1.35;white-space:pre-wrap}
.quizroot .md .katex{font-size:1.1em}
.quizroot .qquestion.compact .qblock .md{font-size:34px}.quizroot .qquestion.compact .qblock .q-label{font-size:17px;padding:2px 16px}
.quizroot .explanation .md{font-size:34px;color:var(--grey)}
.quizroot .answer .md{color:var(--navy-2)}
.quizroot .qmedia.side{display:flex;gap:28px;align-items:center;justify-content:center}
.quizroot .qmedia.side>.md{flex:1 1 50%;min-width:0}
.quizroot .qmedia.side>.figgrid{flex:0 1 auto;flex-direction:column;flex-wrap:nowrap;align-items:center}
.quizroot .figgrid{justify-content:center;margin-top:12px}
.quizroot .qfig,.quizroot .figitem .qfig{border:0;border-radius:6px;box-shadow:0 4px 14px rgba(27,42,73,.2);margin:0 auto;background:#fff}
.quizroot .figitem .qfig{max-height:34vh;height:auto}.quizroot .figitem:not(.inlinefig) .qfig{height:auto;max-height:34vh}
.quizroot .fignum{display:none}
.quizroot .hintitem .md{font-size:34px}
/* options */
.quizroot .optlist{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;max-width:1100px;margin:16px auto 0}
.quizroot .opt{display:flex;align-items:center;gap:18px;min-height:90px;padding:10px 22px;text-align:left;font:inherit;font-weight:400;color:var(--ink);background:var(--soft);border:3px solid var(--edge);border-radius:12px;cursor:pointer;box-shadow:0 6px 0 rgba(27,42,73,.18);transition:transform .15s,box-shadow .15s,background .2s,border-color .2s,opacity .3s}
.quizroot .opt:not(:disabled):hover{transform:translateY(-4px);box-shadow:0 10px 0 rgba(27,42,73,.18);background:#fff;border-color:var(--navy-2)}
.quizroot .opt:disabled{cursor:default;box-shadow:none;color:var(--ink)}
.quizroot .optl{flex:none;display:inline-flex;align-items:center;justify-content:center;width:1.6em;height:1.6em;font-size:32px;font-weight:800;color:#fff;background:var(--accent);border-radius:50%}
.quizroot .opt .optmd{font-size:36px;flex:1;min-width:0;text-align:left}
.quizroot .opt.correct{background:#d9f2e0;border-color:#1f8a4c}.quizroot .opt.correct .optl{background:#1f8a4c}
.quizroot .opt.wrong{background:#fbe0de;border-color:#b3261e}.quizroot .opt.wrong .optl{background:#b3261e}
.quizroot .opt.dim{opacity:.45}
.quizroot .result{display:inline-block;margin:6px 0 16px;padding:8px 28px;font-size:34px;font-weight:700;border-radius:10px;animation:pop .4s}
.quizroot .result.ok{color:#145c32;background:#d9f2e0}.quizroot .result.bad{color:#7b1914;background:#fbe0de}
.quizroot .end{margin-top:3vh;font-size:clamp(56px,9vw,130px);font-weight:800;letter-spacing:6px;text-transform:uppercase;color:var(--accent);animation:bounce 1.6s infinite}
/* results: panel from the right (2/3 of the width), full list at the end */
.quizroot .qrestab{position:fixed;right:0;top:34%;writing-mode:vertical-rl;font-size:20px;font-weight:700;letter-spacing:1px;padding:16px 10px;border-radius:10px 0 0 10px;z-index:5;background:var(--accent);color:#fff;border:0;box-shadow:none}
.quizroot .qrespanel{position:fixed;top:0;right:0;bottom:0;width:66.667vw;background:#fff;border-left:8px solid var(--accent);box-shadow:-12px 0 32px rgba(0,0,0,.35);padding:24px 36px;overflow:auto;box-sizing:border-box;z-index:20;animation:slideleft .3s ease}
.quizroot .final{max-width:900px;margin:16px auto 0}
.quizroot .row{display:grid;grid-template-columns:2em 1fr 7em 8em 5em;column-gap:12px;align-items:baseline;padding:10px 6px;border-bottom:1px solid var(--grey-l);text-align:left;font-size:26px}
.quizroot .final.big .row{font-size:32px}
.quizroot .row.head{font-size:18px;color:var(--grey);font-weight:700;border-bottom:2px solid var(--edge)}
.quizroot .row .rank{color:var(--grey);font-weight:700}.quizroot .row .who{font-weight:600}.quizroot .row .num{text-align:right}.quizroot .row .pts{font-weight:800;color:var(--accent)}
.quizroot .row.curpart{background:var(--orange-soft)}
@keyframes bounce{0%,100%{transform:translateY(0)}50%{transform:translateY(-14px)}}
@keyframes pop{from{transform:scale(.6);opacity:0}to{transform:scale(1);opacity:1}}
@keyframes slidein{from{transform:translateY(30px);opacity:0}to{transform:none;opacity:1}}
@keyframes slideleft{from{transform:translateX(40px);opacity:0}to{transform:none;opacity:1}}

/* look imported from the quiz application: sans-serif UI, Computer Modern for question content */
body,button,input,select,textarea{font-family:"Segoe UI",system-ui,-apple-system,"Helvetica Neue",Arial,sans-serif}
.pre,.qtext,.qbody textarea{font-family:var(--font)}
.pre{font-size:1.15em}
.overlay.lightbox{background:rgba(10,16,30,.85)}
.overlay.lightbox img{background:#fff;border-radius:6px}

.navitem.sel .hoveractions .iconbtn,.navitem.sel .chip{color:#fff}
.navitem.sel .chip{border-color:#fff;background:transparent}
.quizroot input[type=checkbox]{accent-color:var(--accent)}
/* the active tab underline must not be covered by the content below the top bar */
.topbar{position:relative;z-index:8}
.topbar .left{align-self:stretch}
.topbar .tab{align-self:stretch;display:flex;align-items:center;padding-top:0;padding-bottom:0}
/* sharing form: checkbox and select must not stretch to 100% width */
.sharebox .row{gap:28px}
.sharebox label.inline{white-space:nowrap;gap:10px}
.sharebox input[type=checkbox]{width:20px;height:20px;flex:none;accent-color:var(--accent)}
.sharebox select{width:auto;min-width:160px}

/* JSON inspection (operator, key j) */
.jsonbtn{display:none;margin-left:8px;padding:0 7px;font:600 11px/18px ui-monospace,Menlo,Consolas,monospace;border-radius:4px;box-shadow:none;background:#fff;color:var(--accent);border:1px solid var(--accent);flex:none}
body.jsonmode .jsonbtn{display:inline-block}
.navitem.sel .jsonbtn{background:#fff;color:var(--accent)}
.jsonview{margin:0;max-height:62vh;overflow:auto;background:#0f172a;color:#e2e8f0;padding:14px 16px;border-radius:8px;font:13px/1.5 ui-monospace,Menlo,Consolas,monospace;white-space:pre}
.jsonview .jkey{color:#7dd3fc}.jsonview .jstr{color:#86efac}.jsonview .jnum{color:#fdba74}.jsonview .jbool{color:#f9a8d4}.jsonview .jnull{color:#94a3b8}

.quizroot .opt.chosen{border-color:var(--accent);background:#fff;box-shadow:0 6px 0 var(--accent)}
.quizroot .group{margin-bottom:12px}
.groupbox{border:1px solid var(--line);border-radius:8px;padding:6px 10px;margin:6px 0}

/* question description: above the question text, no space when empty (the element is not rendered) */
.qdesc{white-space:pre-wrap;color:var(--muted);margin-bottom:6px;font-size:.95em}
.qframe .qdesc{font-size:max(11px,.575em);margin-bottom:4px}
.quizroot .qdesc{font-family:var(--font);font-size:calc(clamp(30px,3.4vw,52px) / 2);line-height:1.3;margin-bottom:8px}
.quizroot .qquestion.compact .qdesc{font-size:17px}
/* second level (workbook modules and units): grey items on the white background */
.wbnav .navitem{background:var(--grey-l)}
.wbnav .navitem:hover{background:#dbe0e8}
.wbnav .navitem.sel{background:var(--accent)}
.wbnav .navitem.modrow .label{font-weight:700}

/* markdown in question texts */
.mdbody{white-space:normal}
.mdbody>*:first-child{margin-top:0}.mdbody>*:last-child{margin-bottom:0}
.mdbody p{margin:.5em 0}
.mdbody h1,.mdbody h2,.mdbody h3,.mdbody h4,.mdbody h5,.mdbody h6{margin:.7em 0 .3em;line-height:1.25;color:var(--accent)}
.mdbody h1{font-size:1.5em}.mdbody h2{font-size:1.3em}.mdbody h3{font-size:1.15em}.mdbody h4,.mdbody h5,.mdbody h6{font-size:1em}
.mdbody ul,.mdbody ol{margin:.4em 0;padding-left:1.6em}
.mdbody blockquote{margin:.5em 0;padding:.1em .9em;border-left:3px solid var(--edge);color:var(--grey)}
.mdbody hr{border:0;border-top:1px solid var(--edge);margin:.8em 0}
.mdbody code{font-family:ui-monospace,Menlo,Consolas,monospace;font-size:.88em;background:var(--soft);padding:.05em .3em;border-radius:3px}
.mdbody pre{background:var(--soft);padding:.6em .8em;border-radius:4px;overflow:auto;margin:.5em 0}.mdbody pre code{background:none;padding:0}
.mdbody a{color:var(--navy-2)}
.mdbody img.mdimg{max-width:100%}
.mdtablewrap{overflow-x:auto;margin:.5em 0}
.mdtable{border-collapse:collapse;width:auto;max-width:none}
.mdtable th,.mdtable td{border:1px solid var(--edge);padding:.25em .7em;text-align:left;white-space:normal}
.mdtable th{background:var(--grey-l);color:var(--accent);font-weight:700}
.mdtable tbody tr:nth-child(even) td{background:var(--soft)}

/* quiz: no top bar - participant sits in the info line, Next floats over the page, redraws do not move anything */
.quizroot .quizmain.inquestion{padding-top:10px}
.quizroot .qquestion .info{display:flex;align-items:center;justify-content:center;gap:18px;margin:0 0 10px}
.quizroot .participant.sm{font-size:26px;padding:2px 22px;border-radius:10px;animation:none}
.quizroot .qnext{position:fixed;top:14px;right:56px;z-index:6}
.quizroot .qnext .btn{font-size:26px;padding:8px 28px;box-shadow:0 5px 0 #0f1a30,0 8px 24px rgba(0,0,0,.3)}
.quizroot.still *{animation:none!important}
.quizroot .mdtable{margin:0 auto}   /* quiz content is centred; the table is as wide as its content */

/* clickable question status in the ribbon header */
button.chip.statuschip{font:inherit;font-size:13px;line-height:1.5;cursor:pointer;box-shadow:none;text-transform:none;letter-spacing:0;font-weight:400}
button.chip.statuschip:hover{background:var(--orange);color:#fff}
td.rowbtns{white-space:nowrap}td.rowbtns button+button{margin-left:6px}
.nav .navitem.catrow .label{font-weight:700}

/* ---------- tests: pages with questions (the designer) ---------- */
.testpage .ttoolbar{display:flex;align-items:center;gap:10px;margin:10px 0}
.ttoolbar input[type=range]{width:170px;padding:0;border:0}
.ttoolbar label{font-weight:600;color:var(--grey);margin-left:14px}
.ttoolbar .tval{min-width:52px;color:var(--ink)}
.tcanvas{height:68vh;min-height:360px;overflow:auto;border:1px solid var(--edge);background:var(--soft);cursor:grab;position:relative}
.tcanvas.panning{cursor:grabbing;user-select:none}
.tsizer{position:relative}
.tpages{position:absolute;left:0;top:0;display:flex;gap:16px;padding:16px;align-items:flex-start;transform-origin:0 0;width:max-content}
.tpagewrap{flex:none}
.tpagehead{display:flex;align-items:center;justify-content:space-between;height:28px;font-size:14px;color:var(--grey);font-weight:600}
.tpage{position:relative;flex:none;box-sizing:border-box;color:#000;font-family:var(--font);line-height:1.3;box-shadow:0 2px 10px rgba(27,42,73,.3);
  background-color:#d3d6db;background-image:linear-gradient(45deg,#bdc2c9 25%,transparent 25%,transparent 75%,#bdc2c9 75%),linear-gradient(45deg,#bdc2c9 25%,transparent 25%,transparent 75%,#bdc2c9 75%);
  background-size:10mm 10mm;background-position:0 0,5mm 5mm}
.tq,.thead{position:absolute;box-sizing:border-box;background:#fff;padding:1mm 1.5mm}
.tq{cursor:default;user-select:none}
.testpage.editing .tq{cursor:move}
.tq.over{outline:2px dashed #b3261e}
.tq.dragging{box-shadow:0 8px 24px rgba(0,0,0,.4);z-index:6;opacity:.92}
.tqrow{display:flex;gap:.4em}.tqnum{flex:none;font-weight:700}.tqtext{flex:1;min-width:0}
.tqtext .mdbody p{margin:0 0 .3em}.tqtext .mdbody{white-space:normal}
.tqtext .figgrid{display:flex;flex-wrap:wrap;gap:6px}
.tqopts{margin:.3em 0 0 1.4em}.tqopt{margin:.1em 0}
.tqgroups{margin:.3em 0 0 1.4em}.tqgroup{display:flex;gap:1.4em;flex-wrap:wrap;margin:.2em 0}
.tqunavail{color:#8a919b;font-style:italic;font-family:var(--ui,sans-serif);font-size:12px}
.thead{width:calc(100% - 10mm);white-space:pre-wrap;border:0;resize:none;overflow:hidden;font:inherit;color:inherit;line-height:1.3;display:block;margin:0}
textarea.thead{min-height:0;outline:1px dashed var(--edge)}
.tqtools{position:absolute;top:0;right:0;display:none;gap:2px;background:#fff;border:1px solid var(--edge);border-radius:4px;padding:1px;z-index:4}
.tq:hover .tqtools{display:flex}
.tfig{position:relative;display:inline-block;max-width:none;margin:2px 0;vertical-align:top;line-height:0}
.tfig .qfig{border:0;margin:0;max-width:none;max-height:none;min-width:0;min-height:0;display:block;height:auto;object-fit:contain}
.testpage.editing .tfig{cursor:pointer}
.tfig.sel{outline:2px solid var(--orange)}
.tfighandle{display:none;position:absolute;right:-7px;bottom:-7px;width:13px;height:13px;background:var(--orange);border:2px solid #fff;border-radius:2px;cursor:nwse-resize;z-index:3}
.tfig.sel .tfighandle{display:block}
.taddpage{align-self:flex-start;margin-top:28px;flex:none}
/* popup: add questions */
.modal.pk{width:min(1400px,94vw);height:82vh;display:flex;flex-direction:column;max-width:none}
.pk-cols{display:grid;grid-template-columns:1fr 2fr 1.2fr;gap:12px;flex:1;min-height:0;margin:8px 0}
.pk-tree,.pk-mid,.pk-right{overflow:auto;border:1px solid var(--edge);border-radius:6px;background:#fff;min-height:0}
.pk-row{display:flex;align-items:center;gap:6px;padding:5px 8px;cursor:pointer}.pk-row:hover{background:var(--soft)}.pk-row.sel{background:var(--accent);color:#fff}
.pk-title{font-weight:700;padding:8px;color:var(--accent);border-bottom:1px solid var(--grey-l);position:sticky;top:0;background:#fff;z-index:1}
.pk-mod{font-weight:700;padding:8px 8px 2px;color:var(--accent);cursor:pointer}.pk-unit{padding:4px 8px 2px 18px;color:var(--grey);font-weight:600;cursor:pointer}
.pk-mod .chev,.pk-unit .chev{display:inline-block;width:14px}
.pk-q{display:flex;align-items:center;gap:8px;padding:4px 8px 4px 28px;border-bottom:1px solid var(--grey-l)}
.pk-right .pk-q{padding-left:8px}
.pk-q.used{opacity:.45}.pk-q .pk-text{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--font)}
.pk-none{padding:2px 8px 2px 28px}
/* print: only the pages, A4, without the checked pattern */
#printroot{display:none}
@media print{
  @page{size:A4 portrait;margin:0}
  html,body{background:#fff!important;height:auto!important;overflow:visible!important;margin:0!important}
  body.printing>*:not(#printroot){display:none!important}
  body.printing #printroot{display:block}
  body.printing .tpage{break-after:page;page-break-after:always;overflow:hidden;box-shadow:none;margin:0;height:296.6mm!important;background:#fff!important}
  body.printing .tpage:last-child{break-after:auto;page-break-after:auto}
  body.printing .tq,body.printing .thead{background:transparent!important}
  body.printing .tqunavail{visibility:hidden}
}
.adddesc{font-size:13px}
.head:has(+ div > .adddesc){margin-bottom:3px}
/* full screen: only the content panel is shown */
.split.fs>.nav,.split.fs>.divider,.split.fs .wbnav,.split.fs .wbrow>.divider{display:none}
.split.fs .panelToggle,.split.fs .wbexpand{display:none!important}
.split.fs .tcanvas{flex:1 1 auto;height:auto;min-height:360px}
.split.fs .testpage{padding-bottom:8px}
/* full screen: instead of the name/description panel only breadcrumbs (to the unit / test) with the Standard screen button */
.fsbar{display:none}
.split.fs .wbtop>:not(.fsbar){display:none}
.split.fs .wbtop>.fsbar{display:block}
.fsbarbtn{float:right}
.split.fs .wbcontent .head .fsbtn{display:none}
.split.fs .testtop{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:6px}
.split.fs .testtop>.crumbs{margin:0}
.split.fs .testtop>.head{margin:0}
.split.fs .testtop>.head>:first-child,.split.fs .testtop>:not(.crumbs):not(.head):not(.ttoolbar){display:none}
/* full screen test designer: breadcrumbs | zoom and font size | buttons on one line */
.split.fs .testtop>.crumbs{order:1}.split.fs .testtop>.ttoolbar{order:2;margin:0}.split.fs .testtop>.head{order:3}
.modal.otmodal{width:min(900px,94vw);height:82vh;max-width:none;display:flex;flex-direction:column}
.otmodal textarea.otext{height:38%;min-height:120px;resize:vertical;margin:8px 0;font-family:ui-monospace,Menlo,monospace}
.opreviewbox{flex:1;min-height:0;overflow:auto;border:1px solid var(--edge);border-radius:6px;background:#fff;padding:10px}
.opreview{color:#000;font-family:var(--font);line-height:1.3}
.opreview .figgrid{display:flex;flex-wrap:wrap;gap:6px}
.tqtools .iconbtn.on{background:var(--accent);color:#fff}
