/* ---------- start card ---------- */
.psc-start{margin:1.2rem 0;border-radius:18px;padding:1.4rem;color:#fff;background:linear-gradient(135deg,#0f1f3d,#17407a);box-shadow:0 8px 24px rgba(15,31,61,.25)}
.psc-start .ps-tag{display:inline-block;font-size:.72rem;letter-spacing:.12em;font-weight:800;background:#f5a623;color:#2b1d00;border-radius:6px;padding:.15rem .6rem}
.psc-start h2{margin:.6rem 0 .3rem;font-size:1.4rem;color:#fff}
.psc-start p{margin:0;opacity:.88;font-size:.95rem}
.ps-stats{list-style:none;display:grid;grid-template-columns:repeat(4,1fr);gap:.6rem;margin:1.1rem 0;padding:0}
.ps-stats li{background:rgba(255,255,255,.1);border-radius:12px;padding:.7rem .4rem;text-align:center}
.ps-stats b{display:block;font-size:1.4rem;line-height:1.2}
.ps-stats span{font-size:.75rem;opacity:.8}
.ps-actions{display:flex;gap:.6rem;flex-wrap:wrap;align-items:center}
.ps-btn{border:0;border-radius:10px;padding:.7rem 1.3rem;font:inherit;font-weight:700;cursor:pointer;text-decoration:none!important;display:inline-block}
.ps-btn.primary{background:#f5a623;color:#2b1d00}.ps-btn.primary:hover{background:#ffb93f}
.ps-btn.ghost{background:rgba(255,255,255,.14);color:#fff}.ps-btn.ghost:hover{background:rgba(255,255,255,.24)}
.ps-info{flex-basis:100%;margin:0 0 .2rem;font-weight:600}
.ps-note{margin-top:.9rem!important;font-size:.82rem!important;opacity:.7!important}
@media(max-width:520px){.ps-stats{grid-template-columns:repeat(2,1fr)}}

/* ---------- exam overlay ---------- */
body.pe-lock{overflow:hidden}
.pe{position:fixed;inset:0;z-index:99999;background:#eef1f6;display:flex;flex-direction:column;font-family:inherit;color:#17231d}
.pe *{box-sizing:border-box}
.pe-top{flex:none;display:flex;align-items:center;gap:.8rem;background:#0f1f3d;color:#fff;padding:.55rem 1rem;box-shadow:0 2px 8px rgba(0,0,0,.25)}
.pe-title{flex:1;min-width:0;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pe-timer{font:700 1.35rem/1 ui-monospace,Menlo,Consolas,monospace;background:#1e3a68;border-radius:10px;padding:.5rem .9rem;letter-spacing:.04em;min-width:7.5rem;text-align:center}
.pe-timer.warn{background:#b7791f}
.pe-timer.danger{background:#c53030;animation:pe-pulse 1s infinite}
@keyframes pe-pulse{50%{opacity:.55}}
.pe-tb{border:0;border-radius:8px;padding:.5rem .9rem;font:inherit;font-weight:700;cursor:pointer;background:rgba(255,255,255,.14);color:#fff}
.pe-tb.submit{background:#16a05a}.pe-tb.submit:hover{background:#13894d}
.pe-tb.pal{display:none}
.pe-body{flex:1;min-height:0;display:flex}
.pe-main{flex:1;overflow:auto;padding:1.2rem;max-width:860px;margin:0 auto;width:100%}
.pe-card{background:#fff;border-radius:16px;padding:1.3rem;box-shadow:0 1px 3px rgba(0,0,0,.08)}
.pe-qhead{display:flex;justify-content:space-between;gap:1rem;font-size:.85rem;color:#5d6b63;margin-bottom:.7rem}
.pe-qno{font-weight:800;color:#0f1f3d;font-size:.95rem}
.pe-qtext{font-size:1.12rem;line-height:1.7;font-weight:600;margin:0 0 1rem;white-space:pre-line}
.pe-opts{display:grid;gap:.6rem}
.pe-opt{display:flex;gap:.8rem;align-items:flex-start;width:100%;text-align:left;background:#f7f9fc;border:2px solid #d9e0ec;border-radius:12px;padding:.8rem .9rem;font:inherit;cursor:pointer;transition:.12s}
.pe-opt:hover{border-color:#17407a;background:#eef3fb}
.pe-opt b{flex:none;width:1.9rem;height:1.9rem;border-radius:50%;display:grid;place-items:center;background:#fff;border:2px solid #b8c4d9;font-size:.85rem}
.pe-opt.sel{border-color:#17407a;background:#e4edfb}
.pe-opt.sel b{background:#17407a;border-color:#17407a;color:#fff}
.pe-actions{display:flex;gap:.5rem;flex-wrap:wrap;margin-top:1.2rem}
.pe-btn{border:2px solid #cdd6e4;background:#fff;border-radius:10px;padding:.6rem 1rem;font:inherit;font-weight:700;cursor:pointer;color:#17231d}
.pe-btn:hover:not(:disabled){border-color:#17407a}
.pe-btn:disabled{opacity:.4;cursor:default}
.pe-btn.primary{background:#17407a;border-color:#17407a;color:#fff;margin-left:auto}
.pe-btn.review.on{background:#7b4bd8;border-color:#7b4bd8;color:#fff}
.pe-btn.green{background:#16a05a;border-color:#16a05a;color:#fff}
.pe-hint{font-size:.78rem;color:#7b8794;margin-top:.8rem}

/* palette */
.pe-pal{flex:none;width:290px;background:#fff;border-left:1px solid #d9e0ec;overflow:auto;padding:1rem}
.pe-pal h4{margin:0 0 .6rem;font-size:.95rem}
.pe-legend{display:grid;grid-template-columns:1fr 1fr;gap:.3rem .6rem;font-size:.78rem;margin-bottom:.9rem}
.pe-legend i{display:inline-block;width:.8rem;height:.8rem;border-radius:3px;margin-right:.35rem;vertical-align:-1px}
.pe-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:.4rem}
.pe-n{height:2.3rem;border:0;border-radius:8px;font:inherit;font-weight:700;font-size:.85rem;cursor:pointer;background:#e3e8f0;color:#44505e;position:relative}
.pe-n.vis{background:#f4c7c7;color:#7d2323}
.pe-n.ans{background:#16a05a;color:#fff}
.pe-n.mk{background:#7b4bd8;color:#fff}
.pe-n.mk.ans::after{content:"";position:absolute;right:3px;bottom:3px;width:8px;height:8px;border-radius:50%;background:#2fe58c}
.pe-n.cur{outline:3px solid #f5a623;outline-offset:1px}
.pe-i-un{background:#e3e8f0}.pe-i-vis{background:#f4c7c7}.pe-i-ans{background:#16a05a}.pe-i-mk{background:#7b4bd8}

/* modal + toast */
.pe-modal{position:absolute;inset:0;background:rgba(10,20,40,.6);display:grid;place-items:center;padding:1rem;z-index:5}
.pe-dialog{background:#fff;border-radius:16px;padding:1.4rem;max-width:420px;width:100%}
.pe-dialog h3{margin:0 0 .8rem}
.pe-sum{display:grid;gap:.35rem;margin:0 0 1.1rem;padding:0;list-style:none}
.pe-sum li{display:flex;justify-content:space-between;background:#f4f6fa;border-radius:8px;padding:.45rem .7rem}
.pe-dialog .pe-actions{margin-top:0}
.pe-toast{position:absolute;left:50%;bottom:28px;transform:translateX(-50%);background:#0f1f3d;color:#fff;padding:.7rem 1.2rem;border-radius:14px;max-width:min(92vw,560px);text-align:center;line-height:1.4;font-weight:600;z-index:6;box-shadow:0 4px 14px rgba(0,0,0,.3)}

/* result */
.pe-res{display:grid;gap:1.1rem}
.pe-hero{background:#fff;border-radius:16px;padding:1.4rem;display:flex;gap:1.5rem;align-items:center;flex-wrap:wrap}
.pe-ring{--p:0;--c:#16a05a;width:140px;height:140px;border-radius:50%;background:conic-gradient(var(--c) calc(var(--p)*1%),#e3e8f0 0);display:grid;place-items:center;flex:none}
.pe-ring div{width:106px;height:106px;border-radius:50%;background:#fff;display:grid;place-items:center;text-align:center;line-height:1.1}
.pe-ring strong{font-size:1.7rem}.pe-ring small{display:block;color:#5d6b63;font-size:.75rem}
.pe-verdict h2{margin:0 0 .3rem;font-size:1.4rem}.pe-verdict p{margin:0;color:#5d6b63}
.pe-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(110px,1fr));gap:.6rem}
.pe-stat{background:#fff;border-radius:12px;padding:.8rem;text-align:center}
.pe-stat b{display:block;font-size:1.4rem}.pe-stat span{font-size:.78rem;color:#5d6b63}
.pe-stat.g b{color:#16a05a}.pe-stat.r b{color:#d64545}.pe-stat.a b{color:#b7791f}
.pe-tabs{display:flex;gap:.4rem;flex-wrap:wrap}
.pe-tab{border:2px solid #cdd6e4;background:#fff;border-radius:999px;padding:.3rem .9rem;font:inherit;font-weight:700;font-size:.85rem;cursor:pointer}
.pe-tab.on{background:#0f1f3d;border-color:#0f1f3d;color:#fff}
.pe-rq{background:#fff;border-radius:14px;padding:1rem 1.1rem;margin-bottom:.8rem;border-left:5px solid #cdd6e4}
.pe-rq.ok{border-left-color:#16a05a}.pe-rq.no{border-left-color:#d64545}.pe-rq.sk{border-left-color:#f5a623}
.pe-rq h5{margin:0 0 .5rem;font-size:1rem;line-height:1.6;white-space:pre-line}
.pe-rq .pe-opt{cursor:default;padding:.5rem .7rem;margin-bottom:.4rem;font-size:.95rem}
.pe-rq .pe-opt:hover{background:#f7f9fc;border-color:#d9e0ec}
.pe-rq .pe-opt.right{background:#e3f6ea;border-color:#16a05a}.pe-rq .pe-opt.right b{background:#16a05a;border-color:#16a05a;color:#fff}
.pe-rq .pe-opt.wrong{background:#fdecec;border-color:#d64545}.pe-rq .pe-opt.wrong b{background:#d64545;border-color:#d64545;color:#fff}
.pe-tag{font-size:.72rem;font-weight:800;border-radius:6px;padding:.1rem .5rem;margin-left:.4rem;vertical-align:middle}
.pe-tag.ok{background:#e3f6ea;color:#0b5c39}.pe-tag.no{background:#fdecec;color:#9b2c2c}.pe-tag.sk{background:#fff1d6;color:#8a5a00}
.pe-exp{font-size:.9rem;color:#44505e;background:#f4f6fa;border-radius:8px;padding:.5rem .7rem;margin-top:.4rem;white-space:pre-line}

@media(max-width:820px){
  .pe-tb.pal{display:inline-block}
  .pe-tb .lbl,.pe-saved .lbl{display:none}
  .pe-pal{position:absolute;right:0;top:0;bottom:0;transform:translateX(100%);transition:.2s;z-index:4;box-shadow:-6px 0 20px rgba(0,0,0,.2)}
  .pe-pal.open{transform:none}
  .pe-title{display:none}.pe-top{justify-content:space-between}
  .pe-tb.exit{display:none}
  .pe-btn.primary{margin-left:0}
}

.pe-saved{font-size:.78rem;opacity:.85;white-space:nowrap}
.pe-saved .ck{color:#2fe58c;font-weight:800}
.pe-saved.work{color:#ffd37a}
.pe-tb.draft{background:rgba(255,255,255,.2)}
@media(max-width:820px){.pe-saved{order:5}.pe-top{gap:.45rem;flex-wrap:wrap}.pe-timer{min-width:6rem;font-size:1.15rem;padding:.45rem .6rem}}

.pe-cancel{background:#fff1d6;border:1px solid #f0c36d;color:#8a5a00;border-radius:10px;padding:.55rem .8rem;margin:0 0 1rem;font-weight:600;font-size:.92rem}
.pe-n.cx{text-decoration:line-through;opacity:.7;box-shadow:inset 0 0 0 2px #f5a623}
.pe-rq.cx{border-left-color:#9aa5b1;opacity:.92}
.pe-tag.cx{background:#e8ebef;color:#44505e}

.pe-imgs{margin:0 0 1rem}
.pe-imgs img{max-width:100%;max-height:340px;height:auto;border-radius:10px;border:1px solid #e3e8f0}
.pe-oimg{display:block;max-width:240px;max-height:170px;height:auto;margin-top:.35rem;border-radius:6px}

.pe-kw{font-size:.82rem;color:#0b5c39;margin:-.2rem 0 .6rem}

/* match-the-following tables inside question text */
.psc-table{border-collapse:collapse;margin:.7rem 0;font-weight:500;font-size:.98rem;max-width:100%}
.psc-table th,.psc-table td{border:1px solid #cfdad3;padding:.45rem .8rem;text-align:left;vertical-align:top}
.psc-table th{background:#e3f6ea;color:#0b5c39;font-weight:800}
.psc-table tr:nth-child(even) td{background:#f7faf8}

.pe-lb{display:flex;flex-wrap:wrap;gap:.6rem;align-items:center;background:#fff8e8;border:1px solid #f1d9a0;border-left:5px solid #f5a623;border-radius:12px;padding:.8rem 1rem;margin:1rem 0;color:#5b4200;font-weight:600}
.pe-lb .pe-btn{margin:0;text-decoration:none}

.pe-evnote{color:#5d6b63;margin:.8rem 0 .5rem;font-size:.9rem}
.pe-ev{display:grid;gap:.6rem}
.pe-evrow{background:#fff;border-radius:12px;padding:.8rem 1rem}
.pe-evh{display:flex;justify-content:space-between;gap:.8rem;align-items:baseline}
.pe-evh b{min-width:0;overflow-wrap:anywhere}
.pe-evm{white-space:nowrap;color:#5d6b63}.pe-evm strong{font-size:1.25rem;color:#0f1f3d}
.pe-evbar{height:9px;background:#e7ecf3;border-radius:99px;overflow:hidden;margin:.5rem 0 .4rem}
.pe-evbar i{display:block;height:100%;border-radius:99px}
.pe-evs{font-size:.8rem;color:#5d6b63}
.pe-evrow.total{background:#0f1f3d;color:#fff}.pe-evrow.total .pe-evm,.pe-evrow.total .pe-evm strong{color:#fff}
.pe-evtip{background:#fff8e6;border-radius:10px;padding:.7rem 1rem;font-size:.9rem;margin:.8rem 0}

.pe-note{margin:.7rem 0 0;padding:.5rem .8rem;background:#eef2ff;border-radius:10px;font-size:.85rem;color:#334155}.pe-note a{font-weight:700;color:#1e3fb8}
.pe-note+.pe-note{margin-top:.4rem}
.pe-bn{flex:none;display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:.2rem .6rem;padding:.4rem .8rem;background:linear-gradient(90deg,#1e3fb8,#2f6bff);color:#fff;text-align:center;font-size:.88rem;line-height:1.4;font-weight:600}
.pe-bn a{color:#fff;text-decoration:none}.pe-bn-nb{white-space:nowrap}.pe-bn-tag{font-size:.62rem;letter-spacing:.06em;text-transform:uppercase;background:rgba(255,255,255,.22);border-radius:4px;padding:.05rem .35rem}
.pe-bn-ph{background:#fff;color:#1e3fb8!important;border-radius:999px;padding:.1rem .7rem;font-weight:800;white-space:nowrap}
@media(max-width:600px){.pe-bn{font-size:.78rem;padding:.3rem .5rem}}
.ps-sizes{display:flex;flex-wrap:wrap;align-items:center;gap:.45rem;width:100%;margin:0 0 .8rem}.ps-sizes-l{font-weight:700;margin-right:.3rem}
.ps-chip{border:1.5px solid #c7d2fe;background:#fff;color:#1e3fb8;border-radius:999px;padding:.4rem .9rem;font:inherit;font-size:.9rem;font-weight:700;cursor:pointer}.ps-chip.on{background:#1e3fb8;color:#fff;border-color:#1e3fb8}
.ps-sizes-n{flex-basis:100%;font-size:.85rem;color:#475569}
.pe-st{background:#e0e7ff;color:#1e3fb8;border-radius:6px;font-size:.74rem;font-weight:800;padding:.12rem .55rem;margin:0 .4rem}
.pe-ad{background:#fff7e0;border:1px solid #fde4a0}.pe-ad a{color:#7a4a00}.pe-ad-ph{white-space:nowrap;background:#fff;border-radius:999px;padding:.05rem .6rem}.pe-wa{background:#e8f8ee}

.pe-bn-nb{white-space:normal!important;display:inline-block;max-width:100%}.pe-note,.pe-bn{max-width:100%;overflow-wrap:anywhere}.pe-main{min-width:0}.pe-qhead{flex-wrap:wrap}.pe-card,.pe-qtext,.pe-opt{overflow-wrap:anywhere;min-width:0}
html:has(body.pe-lock){overflow:hidden}
.pe{width:100%;max-width:100vw;overflow:hidden;touch-action:pan-y}.pe-bn-tag{flex:none}.pe-qhead>span{min-width:0}
@media(max-width:480px){.pe-qhead{gap:.4rem .6rem}.pe-st{margin:0;font-size:.7rem;padding:.1rem .45rem}.pe-card{padding:1rem}.pe-main{padding:.8rem}}
