:root{--ink:#111827;--muted:#667085;--line:#cfd6de;--bg:#e6ebf0;--panel:#fff;--teal:#5d7884;--teal2:#6d8793;--blue:#1e88e5;--orange:#f5a623;--red:#d42b2b;--yellow:#fff200;--shadow:0 8px 28px rgba(15,23,42,.12)}
*{box-sizing:border-box}html,body,#app{height:100%}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Hiragino Sans","Yu Gothic",Meiryo,sans-serif;background:var(--bg);color:var(--ink)}button,a{font:inherit}.portal{max-width:1120px;margin:0 auto;padding:22px}.top{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px}.kicker{font-size:12px;letter-spacing:.13em;color:#536071;font-weight:800}.title{margin:2px 0 0;font-size:30px}.back{display:inline-flex;align-items:center;justify-content:center;text-decoration:none;color:#172033;border:1px solid #ccd3df;background:#fff;border-radius:12px;padding:10px 14px;font-weight:800}.hero{background:linear-gradient(135deg,#17213a,#314a88);color:#fff;border-radius:26px;padding:26px;box-shadow:var(--shadow);display:flex;gap:22px;align-items:center;margin-bottom:18px}.mark{width:72px;height:72px;border-radius:22px;background:rgba(255,255,255,.16);display:grid;place-items:center;font-size:36px;font-weight:900}.hero h2{margin:4px 0 8px;font-size:28px}.hero p{margin:0;line-height:1.7;color:#e6ecff}.grid{display:grid;grid-template-columns:repeat(3,1fr);gap:14px}.card{background:#fff;border:1px solid var(--line);border-radius:22px;padding:20px;text-align:left;box-shadow:0 12px 28px rgba(20,30,55,.08);cursor:pointer;transition:.15s}.card:hover{transform:translateY(-2px);box-shadow:var(--shadow)}.card strong{display:block;font-size:22px;margin-bottom:8px}.card span{color:var(--muted);font-weight:600;line-height:1.5}.notice{background:#fff7e6;border:1px solid #f0d59b;color:#694200;border-radius:18px;padding:14px 16px;margin:14px 0;font-weight:700;line-height:1.65}
.cbtShell{height:100%;display:flex;flex-direction:column;background:#d7dde3}.cbtTop{height:58px;background:#f7f7f7;border-bottom:1px solid #b9c1c8;display:flex;align-items:center;justify-content:space-between;padding:0 10px 0 18px;gap:10px}.examName{font-size:14px;white-space:nowrap;color:#111}.topTools{display:flex;align-items:center;gap:4px}.topTools button{height:34px;min-width:48px;border:0;background:#5b7480;color:#fff;font-size:11px;border-radius:3px;font-weight:700;line-height:1.05}.topTools button:nth-child(2){background:#fff;color:#333;border:1px solid #c5cbd1}.remain{font-size:14px;margin-left:10px;white-space:nowrap}.timer,.remain{color:#111}.remain::first-letter{color:#111}.finish{background:#1e9af0!important;color:#fff!important;border-radius:4px!important;font-size:14px!important;padding:0 18px!important}.exam{flex:1;min-height:0;display:grid;grid-template-columns:46px minmax(0,1fr) 165px;grid-template-rows:minmax(0,1fr) 72px;background:#cfd5db}.tools{grid-row:1/3;background:#e5e9ed;border-right:1px solid #aeb8c0;display:flex;flex-direction:column;align-items:center;padding:8px 5px;gap:4px}.tool{width:31px;height:31px;border:1px solid #8aa1ad;border-radius:3px;background:#5d7884;color:#fff;font-size:14px;font-weight:900;display:grid;place-items:center}.tool.orange{background:#ff9f1a}.tool.yellow{background:#f8e71c;color:#111}.tool.red{background:#e8f2f6;color:#ff1d1d;border-color:#8aa1ad}.tool.mute{background:#a7b7bf;color:#fff}.paperWrap{padding:0 18px 8px 18px;overflow:auto;background:#cfd5db}.paper{width:min(100%,1260px);min-height:820px;background:#fff;border:0;box-shadow:none;margin:0 auto;padding:58px 76px 60px 76px;line-height:1.45;font-size:15px;color:#111}.problemText{max-width:980px;margin:0 auto}.problemText p{margin:0 0 5px}.problemText .qtitle{text-align:left;font-weight:800;margin:0 0 7px}.problemText .label{font-weight:800;margin-top:8px}.problemText .item{padding-left:1.2em;text-indent:-1.2em}.problemText .choice{padding-left:1.6em;text-indent:-1.6em;margin-top:3px}.problemText .para{text-align:left}.side{background:#f6f6f6;border-left:1px solid #aeb8c0;overflow:auto;padding:48px 7px 8px}.ansTable{width:100%;border-collapse:collapse;background:#fff;font-size:13px}.ansTable th,.ansTable td{border:1px solid #bfc5ca;padding:2px 3px;text-align:center;height:20px}.ansTable th{background:#f6f6f6;font-weight:500}.rowBtn{cursor:pointer}.rowBtn.sameQ td:first-child{background:#f7f7f7}.rowBtn.current td{background:#fff200!important}.bottom{grid-column:2/4;background:#f8f8f8;border-top:1px solid #adb7bf;display:grid;grid-template-columns:130px minmax(280px,470px) 150px 1fr;align-items:center;padding:8px 10px;gap:10px}.statusNo{font-size:17px;white-space:nowrap}.answers{display:flex;gap:10px}.ansBtn{width:66px;height:45px;border:1px solid #c5ccd3;border-radius:4px;background:#fff;font-family:Georgia,"Times New Roman",serif;font-weight:900;font-size:30px;color:#111}.ansBtn.on{background:#d8ebff;border:3px solid #1e88e5;color:#000}.reviewBtn{height:45px;border:1px solid #ff9f1a;border-radius:4px;background:#fff;color:#e27b00;padding:0 18px;font-weight:800}.reviewBtn.on{background:#fff0d7;border-width:2px}.navs{display:flex;justify-content:flex-end;gap:10px}.navs button{height:45px;border:0;border-radius:4px;padding:0 20px;font-weight:800}.prevBtn{background:#c9d8df;color:#fff}.nextBtn,.answerPanel{background:#5d7884;color:#fff}.answerPanel{min-width:132px}.result{max-width:980px;margin:0 auto;padding:24px}.resultBox{background:#fff;border-radius:22px;padding:24px;border:1px solid var(--line);box-shadow:var(--shadow)}.resultGrid{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}.stat{background:#f4f6fa;border-radius:16px;padding:14px}.stat strong{display:block;font-size:24px}.small{font-size:13px;color:var(--muted);line-height:1.7}.list{max-height:420px;overflow:auto;margin-top:16px;border:1px solid var(--line);border-radius:14px;background:#fff}.listItem{padding:12px;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;gap:12px}.listItem:last-child{border-bottom:0}.controls{display:flex;gap:10px;flex-wrap:wrap;margin-top:16px}.controls button{border:0;border-radius:12px;padding:12px 14px;font-weight:900;background:#17213a;color:#fff}.controls .ghostBtn{background:#fff;color:#17213a;border:1px solid #cbd3df}
@media(max-width:760px){.portal{padding:14px}.grid{grid-template-columns:1fr}.hero{padding:20px}.title{font-size:24px}.cbtTop{height:auto;min-height:48px;flex-wrap:wrap}.exam{height:auto;min-height:calc(100vh - 48px);grid-template-columns:1fr;grid-template-rows:auto auto auto}.tools{display:none}.paperWrap{padding:10px;min-height:60vh}.paper{font-size:15px;padding:26px 18px;min-height:60vh}.side{border-left:0;border-top:1px solid #b8c2d0;max-height:210px;padding:8px}.bottom{grid-column:1;position:sticky;bottom:0;display:flex;flex-direction:column;align-items:stretch;height:auto}.answers,.navs{justify-content:center;flex-wrap:wrap}.ansBtn{width:54px}.resultGrid{grid-template-columns:repeat(2,1fr)}}
/* v7: CBT toolbar activation */
.topTools button{cursor:pointer}.topTools button.topOn{box-shadow:0 0 0 2px #ffcc66 inset}.topTools .inactiveTop{opacity:.95}.tool{cursor:pointer}.tool.sel{outline:3px solid #1e88e5;outline-offset:1px;filter:brightness(1.08)}
.paper{position:relative;transition:transform .12s ease}.paperWrap.panMode{cursor:grab}.paperWrap.panMode:active{cursor:grabbing}.anno-marker{background:rgba(255,235,59,.72);box-shadow:0 0 0 2px rgba(255,235,59,.25)}.anno-pen{border-bottom:3px solid #ff9800}.anno-strike{text-decoration:line-through;text-decoration-thickness:2px;text-decoration-color:#111}.stamp{position:absolute;transform:translate(-50%,-50%);font-size:34px;font-weight:900;line-height:1;pointer-events:none;text-shadow:0 1px 2px rgba(255,255,255,.7)}.stamp-circle{color:#e51d2f}.stamp-triangle{color:#e51d2f}.stamp-cross{color:#e51d2f}.emptyCell{color:#777;font-size:12px;padding:12px!important}.color-soft .cbtShell{background:#eee7db}.color-soft .exam{background:#e5ded2}.color-soft .paperWrap{background:#e5ded2}.color-soft .paper{background:#fffdf7}.color-soft .side{background:#fbf4e8}.color-dark .cbtShell{background:#151923}.color-dark .exam{background:#1d2430}.color-dark .paperWrap{background:#1d2430}.color-dark .paper{background:#10141c;color:#f4f7fb}.color-dark .cbtTop,.color-dark .bottom{background:#222b38;color:#f4f7fb}.color-dark .side{background:#1b2230}.color-dark .ansTable{background:#10141c;color:#f4f7fb}.color-dark .ansTable th{background:#263243}.color-dark .problemText .choice,.color-dark .problemText .item,.color-dark .problemText .para{color:#f4f7fb}.modalBackdrop{position:fixed;inset:0;background:rgba(10,15,25,.45);z-index:9999;display:grid;place-items:center;padding:20px}.modal{width:min(720px,94vw);background:#fff;color:#111;border-radius:16px;box-shadow:0 24px 80px rgba(0,0,0,.32);padding:22px}.modal h2{margin:0 0 14px;font-size:24px}.memoBox{width:100%;min-height:220px;border:1px solid #cfd6de;border-radius:12px;padding:14px;font-size:16px;line-height:1.6;resize:vertical}.modalActions{display:flex;justify-content:flex-end;gap:10px;margin-top:14px}.modalActions button{border:0;border-radius:10px;background:#17213a;color:#fff;font-weight:900;padding:10px 16px}.modalActions button.ghost{background:#fff;color:#17213a;border:1px solid #cfd6de}.helpText{font-size:15px;line-height:1.75}.helpText p{margin:.45em 0}
@media(max-width:760px){.stamp{font-size:26px}.modal{padding:18px}.memoBox{min-height:180px}.topTools{gap:3px}.topTools button{min-width:42px;font-size:10px}.remain{width:100%;text-align:right}.paper{transition:none}}

/* v8: iMac CBT readability + working pen tool */
.paper,.problemText,.problemText p{
  font-family:-apple-system,BlinkMacSystemFont,"Hiragino Sans","Yu Gothic",Meiryo,sans-serif;
}
.problemText{max-width:1040px;letter-spacing:.01em;}
.problemText p{font-size:15px;line-height:1.55;font-weight:600;margin:0 0 5px;}
.problemText .qtitle{font-size:15px;line-height:1.55;font-weight:600;margin:0 0 8px;}
.problemText .label{font-size:15px;line-height:1.55;font-weight:700;margin:7px 0 4px;}
.problemText .dialogue{display:grid;grid-template-columns:4.8em minmax(0,1fr);column-gap:.25em;align-items:start;margin:0 0 3px;}
.problemText .dialogue .speaker{font-weight:600;white-space:nowrap;}
.problemText .dialogue .dialogueBody{font-weight:600;min-width:0;}
.problemText .item{padding-left:1.8em;text-indent:-1.8em;}
.problemText .choice{padding-left:1.9em;text-indent:-1.9em;margin-top:4px;}
.drawLayer,.liveDrawLayer{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:3;overflow:visible;}
.draw{fill:none;stroke:#ff9800;stroke-width:.22;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke;}
.draw.live{opacity:.95;}
.stamp{z-index:4;}
.paper{user-select:text;}
.paperWrap.panMode .paper{user-select:none;}
.tool.orange.sel{outline-color:#ff9800;}

/* v9: requested minimal CBT fixes */
.paper,.problemText,.problemText p{
  font-family:"Hiragino Kaku Gothic ProN","Hiragino Sans","Yu Gothic",Meiryo,sans-serif;
}
.problemText p{font-weight:500;font-size:14px;line-height:1.48;}
.problemText .qtitle{font-weight:600;font-size:14px;line-height:1.48;}
.problemText .label{font-weight:600;font-size:14px;line-height:1.48;}
.problemText .dialogue .speaker,.problemText .dialogue .dialogueBody{font-weight:500;}
.problemText .dialogue{grid-template-columns:5.4em minmax(0,1fr);column-gap:.4em;}
.draw{stroke-width:2.6px;vector-effect:non-scaling-stroke;}
.liveDrawLayer,.drawLayer{pointer-events:none;}
.paper{touch-action:none;}
.answers{display:flex;gap:10px;align-items:center;}
/* v10: lock CBT problem font to the thinner body style and add pen palette */
.cbtShell .paper .problemText,
.cbtShell .paper .problemText *{
  font-family:"Hiragino Sans","Yu Gothic",Meiryo,-apple-system,BlinkMacSystemFont,sans-serif !important;
  font-weight:400 !important;
  letter-spacing:0 !important;
}
.cbtShell .paper .problemText .qtitle,
.cbtShell .paper .problemText .label{
  font-weight:400 !important;
}
.cbtShell .paper .problemText p{
  font-size:14px !important;
  line-height:1.48 !important;
}
.penToolWrap{position:relative;width:31px;min-height:31px;display:flex;align-items:center;justify-content:center;overflow:visible;}
.penPalette{position:absolute;left:36px;top:3px;display:flex;gap:4px;background:#edf2f5;border:1px solid #9cafb8;border-radius:6px;padding:3px;z-index:20;box-shadow:0 2px 8px rgba(0,0,0,.18)}
.penColor{width:18px;height:18px;border:1px solid #fff;border-radius:50%;padding:0;cursor:pointer;box-shadow:0 0 0 1px rgba(0,0,0,.25)}
.penColor.on{outline:2px solid #ff9f1a;outline-offset:1px}
.paper.penMode{cursor:crosshair;user-select:none;touch-action:none;}
.paper.penMode .problemText{user-select:none;}

/* v12: final CBT layout tweaks only */
.exam{grid-template-columns:46px minmax(0,1fr) 205px;}
.exam.sideHidden{grid-template-columns:46px minmax(0,1fr) 0;}
.side.hide{display:none;}
.ansTable{font-size:16px;}
.ansTable th,.ansTable td{height:28px;padding:3px 5px;}
.ansTable th{font-weight:600;}
.bottom{grid-template-columns:130px minmax(280px,470px) 150px 1fr;}
.paper{width:min(100%,1260px);}
.penPalette{left:36px;top:3px;}

/* v18 minimal fixes */
.topTools{gap:12px;}
.remain{font-size:21px!important;font-weight:800!important;margin-left:0!important;}
.finish{font-size:17px!important;height:42px!important;}
.reviewItem{border:1px solid #d9d9d9;border-radius:10px;background:#fff;margin:10px 0;padding:12px;text-align:left}.reviewHead{display:flex;justify-content:space-between;gap:12px;align-items:center;margin-bottom:8px}.reviewHead span{font-weight:800;color:#8b0000}.reviewTable{width:100%;border-collapse:collapse;margin:8px 0;font-size:14px}.reviewTable th,.reviewTable td{border:1px solid #ddd;padding:6px 8px;text-align:center}.expBox{margin-top:8px;border:1px solid #ddd;border-radius:8px;background:#fafafa;padding:8px}.expBox summary{cursor:pointer;font-weight:700}.expBox pre{white-space:pre-wrap;font-family:inherit;line-height:1.7;font-size:14px;margin:8px 0 0}.expMeta{font-size:12px;color:#666;margin-top:6px}.noExp{font-size:13px;color:#777;margin-top:8px}
.answerSheet{margin-top:16px;border:1px solid #d6dce5;border-radius:14px;background:#fff;overflow:hidden}
.answerSheet h2{font-size:18px;margin:0;padding:12px 14px;background:#f4f6fa;border-bottom:1px solid #d6dce5}
.answerSheet table{width:100%;border-collapse:collapse;font-size:13px}
.answerSheet th,.answerSheet td{border-bottom:1px solid #e5e8ee;padding:7px 8px;text-align:left;vertical-align:top}
.answerSheet th{background:#fafafa;font-weight:800;white-space:nowrap}
.resultList{max-height:none;overflow:visible}
.openExp h3{font-size:16px;margin:0 0 6px;color:#17213a}

/* v25: explanation readability */
.resultBox{max-width:1120px;}
.answerSheet table{font-size:12px;}
.answerSheet th,.answerSheet td{padding:6px 7px;}
.expBox{margin-top:10px;border:1px solid #d8dee8;border-radius:12px;background:#fff;padding:14px 16px;}
.expBox h3{font-size:17px;margin:0 0 8px;color:#17213a;}
.expMeta{font-size:12px;color:#6b7280;margin-bottom:10px;border-bottom:1px solid #edf0f4;padding-bottom:8px;}
.expBody{font-size:15px;line-height:1.85;color:#111827;}
.expBody p{margin:.45em 0;}
.expJudge{font-weight:800;margin:1.1em 0 .35em;padding:.25em .55em;border-left:4px solid #17213a;background:#f5f7fb;}
.expSub{font-weight:800;margin:1em 0 .25em;color:#17213a;}
