:root{color-scheme:dark;font:16px/1.5 -apple-system,BlinkMacSystemFont,"PingFang SC",sans-serif;background:#0b0e13;color:#f2efe6;--brand:#ff3947;--brand-deep:#f50721;--gold:var(--brand);--muted:#9da8bb;--side:#141821}
*{box-sizing:border-box}body{margin:0}button,input,select,textarea{font:inherit;color:inherit}button{cursor:pointer}button:disabled{opacity:.4;cursor:default}button:focus-visible,select:focus-visible{outline:2px solid var(--gold);outline-offset:2px}[hidden]{display:none!important}
.classroom{display:flex;width:100%;height:100dvh;overflow:hidden}.board-shell{flex:1;min-width:0;display:flex;flex-direction:column;position:relative;background:radial-gradient(130% 105% at 50% -10%,#1e242f,#141821);border:1px solid #2b3444;box-shadow:inset 0 1px 0 #ffffff12,inset 0 0 4vw #0005}
.problem-bar{display:flex;align-items:center;gap:7px;padding:4px 5px 4px 0;background:#ffffff0d;border-bottom:1px solid #f2efe61f;border-left:3px solid var(--gold);flex-shrink:0}.library-button{align-self:stretch;background:#ffb34722;border:1px solid #ffb34788;border-radius:6px;color:var(--gold);font-weight:600;font-size:clamp(13px,1.5vw,21px);padding:0 12px;white-space:nowrap}.problem-tag{font-size:clamp(11px,1.05vw,15px);color:var(--gold)}#problem{flex:1;min-width:0;font-size:clamp(12px,1.3vw,19px);line-height:1.55;max-height:3.1em;overflow:hidden;word-break:normal;overflow-wrap:break-word}#problem.expanded{max-height:28vh;overflow:auto}#expandProblem{align-self:stretch;border:0;background:transparent;color:var(--gold);padding:0 5px;font-size:18px}
main{display:flex;flex:1;min-height:0}.drawing{flex:1;min-width:0;position:relative;display:flex;align-items:center;justify-content:center;overflow:hidden}.figure-stage{position:relative;flex:none}canvas{display:block;background:transparent}#figureOverlay{position:absolute;inset:0;pointer-events:none;overflow:hidden}.figure-box{position:absolute;transform-origin:top left;display:flex;flex-direction:column;justify-content:center;white-space:pre}
.blackboard{flex:0 0 24%;min-width:0;display:flex;flex-direction:column;border-left:2px dashed #f2efe673;margin:8px 0 12px;padding:0 13px}.blackboard h2{flex:none;margin:0 0 10px;font-size:clamp(10px,1.05vw,15px);font-weight:400;color:#f2efe68c;letter-spacing:5px}#board{flex:1;min-height:0;overflow:auto;scrollbar-width:thin;scrollbar-color:#4c5360 transparent;scroll-behavior:auto;padding-bottom:30px}.board-row{font-family:"Kaiti SC","STKaiti","KaiTi","PingFang SC",serif;font-size:clamp(13px,1.48vw,22px);line-height:1.55;margin-bottom:12px;overflow-wrap:break-word;word-break:normal}.board-row.long{font-size:clamp(12px,1.28vw,19px)}.board-row.xlong{font-size:clamp(11px,1.12vw,17px)}.board-row.xxlong{font-size:clamp(11px,.98vw,15px)}.board-row.cont{margin-left:1.6em;margin-top:-5px}.board-row.hl{color:var(--gold)}.board-row.ok,.board-row.ans{color:#7bd88f}.board-row.ans{font-weight:600;border-left:3px solid #7bd88f;padding-left:8px}.board-row.qa{border-left:2px solid #6ec6ff;padding-left:8px}.board-row.ext{color:#8b93a7;border-left:2px dashed #8b93a7;padding-left:8px}.board-row.flash{animation:board-flash .5s ease 3}@keyframes board-flash{50%{opacity:.35}}
aside{flex:0 0 21%;min-width:145px;display:flex;flex-direction:column;background:var(--side);border-left:1px solid #1d2431;min-height:0}.teacher{flex:2 1 0;min-height:0;position:relative;overflow:hidden;background:var(--side)}.teacher img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;object-position:center bottom;display:block}.teacher-panel{flex:1 1 0;min-height:210px;display:flex;flex-direction:column;gap:8px;padding:10px 11px 14px;border-top:1px solid #1d2431;background:#11151d}.teacher-panel button,.chapter-label{border:1px solid #262f3d;border-radius:9px;background:#1a202a;color:#cbd4e1;font-weight:600}.teacher-panel button{padding:9px 5px;font-size:clamp(12px,1.4vw,20px)}#status{font-size:clamp(10px,.95vw,14px);color:#aeb8c9;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-height:1.4em}.hand-button{flex:1.4;min-height:48px;display:flex;align-items:center;justify-content:center;gap:9px;background:linear-gradient(#ffbe5e,#f0a032)!important;border:0!important;color:#2a1c06!important;box-shadow:0 3px 14px #f0a03225}.hand-button svg{width:clamp(18px,2vw,30px);height:clamp(18px,2vw,30px);fill:currentColor}.hand-button span{font-size:clamp(15px,1.75vw,25px);font-weight:700}.controls,.utility-controls{display:flex;gap:7px}.controls button,.utility-controls button{flex:1;min-width:0}.chapter-label{display:flex;align-items:center;gap:6px;padding:6px 8px;margin:0}.chapter-label>span{font-size:11px;white-space:nowrap;color:var(--muted)}#chapters{min-width:0;flex:1;border:0;background:transparent;padding:3px 0;font-size:clamp(12px,1.2vw,17px)}.utility-controls button{font-size:clamp(11px,1vw,14px);color:var(--muted)}#start{background:#ffb34718;border-color:#ffb34766;color:var(--gold)}
#side{position:absolute;inset:5px;background:linear-gradient(#222a37,#1a212c);border:1px solid #34405a;border-top:3px solid #6ec6ff;padding:12px;overflow:auto;z-index:3}#sideTitle{font-size:18px;margin:0 0 10px}#sideNotes{font-family:"Kaiti SC",serif;font-size:18px}#answerForm{position:absolute;bottom:15px;left:50%;transform:translateX(-50%);width:min(470px,90%);padding:14px;border:1px solid #4b5668;border-radius:12px;background:#1b2331f5;box-shadow:0 8px 30px #0007;z-index:5}#answerForm label{color:var(--gold);font-size:14px}.answer-entry{display:flex;gap:8px;margin-top:7px}.answer-entry input{min-width:0;flex:1}.answer-options{display:flex;gap:10px;margin-top:7px}.answer-options button{font-size:11px;padding:4px}
.floating-panel{position:fixed;z-index:20;left:50%;top:50%;transform:translate(-50%,-50%);width:min(620px,calc(100vw - 32px));max-height:calc(100dvh - 40px);overflow:auto;background:#1b2331;border:1px solid #45526a;border-radius:16px;box-shadow:0 30px 100px #000c;padding:22px}.floating-panel:not([open]){display:none}.floating-panel>summary{list-style:none;cursor:default;font-size:20px;font-weight:600;color:#f2efe6;margin-bottom:18px}.floating-panel>summary::marker{display:none}.close-panel{position:absolute;right:14px;top:12px;background:transparent!important;border:0!important;font-size:25px!important;padding:0 6px!important;color:#aeb8c9}.floating-panel header{display:flex;gap:15px;align-items:center;margin-bottom:15px}.floating-panel header strong{color:var(--gold)}#badge,small{font-size:12px;color:var(--muted)}label{display:block;font-size:14px;margin:12px 0}label select,textarea{width:100%}input,select,textarea,form button,.floating-panel button{border:1px solid #45526a;border-radius:7px;padding:8px;background:#111821}pre{font-size:11px;white-space:pre-wrap;overflow-wrap:anywhere}.photo-flow{display:grid;gap:8px}#photoPreview{max-width:100%;max-height:180px;object-fit:contain}#makeProgress{width:100%}#photoStatus,#photoWarnings{white-space:pre-wrap;font-size:14px}#networkError,#error{position:fixed;bottom:10px;left:10px;right:23%;background:#662e2ef5;padding:12px;border-radius:8px;font-size:13px;white-space:pre-wrap;max-height:35vh;overflow:auto;z-index:30}.visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
@media(min-width:601px){body{min-height:100dvh;display:grid;align-items:center}.classroom{height:min(100dvh,56.25vw);min-height:min(360px,100dvh)}.teacher img{object-position:center center}.teacher-panel{flex:0 0 auto;min-height:0;gap:5px;padding:7px 8px}.teacher-panel button{padding:6px 4px}.hand-button{flex:none;min-height:35px}.chapter-label>span{display:none}.utility-controls button{padding:3px;font-size:11px}}
@media(max-height:550px) and (min-width:601px){.teacher-panel{gap:4px;padding:6px}.teacher-panel button{padding:4px}.hand-button{min-height:30px}.teacher-panel #status{font-size:10px}.chapter-label{padding:3px}.blackboard{padding:0 8px}.board-row{margin-bottom:8px}}
@media(max-width:600px){.classroom{height:auto;min-height:100dvh;flex-direction:column;overflow:visible}.board-shell{flex:none;min-height:63dvh}.problem-bar{padding-top:6px;padding-bottom:6px}main{min-height:49dvh}.drawing{min-height:280px}.blackboard{flex-basis:36%;max-height:52dvh;padding:0 8px}.board-row{font-size:15px}aside{flex:none;min-height:220px;flex-direction:row;border-top:1px solid #2b3444}.teacher{flex:0 0 34%;min-height:220px}.teacher-panel{min-height:220px;flex:1}.teacher-panel button{font-size:14px}.hand-button span{font-size:18px}#status{font-size:11px}#problem{font-size:13px}.problem-tag{display:none}.library-button{padding:0 8px;font-size:13px}#networkError,#error{right:10px}.chapter-label>span{display:none}}
@media(max-width:600px){.board-shell{min-height:0;height:calc(100dvh - 235px)}main{flex-direction:column;min-height:0}.drawing{min-height:200px}.blackboard{flex:0 0 140px;max-height:140px;border-left:0;border-top:2px dashed #f2efe650;margin:0 10px;padding:8px 0}.blackboard h2{margin-bottom:4px}.board-row{font-size:16px}aside{height:235px;min-height:235px}.teacher{min-height:0;height:100%}.teacher img{object-position:center center}.teacher-panel{height:100%;min-height:0;gap:4px;padding:7px}.teacher-panel button{font-size:13px;padding:5px}.hand-button{min-height:35px}.hand-button span{font-size:16px}.chapter-label{padding:4px}#status{font-size:10px}}
.floating-panel[role="dialog"]:not([hidden]){display:block}
/* Fill landscape viewports, including the outer same-document classroom host.
   Background reaches the edge; interactive content stays outside cutouts. */
@media(orientation:landscape){body{display:block;min-height:100dvh}.classroom{height:100dvh;min-height:0;flex-direction:row;overflow:hidden}.board-shell{flex:1;min-height:0;height:auto;padding-left:env(safe-area-inset-left,0px)}main{flex-direction:row;min-height:0}.drawing{min-height:0}.blackboard{flex:0 0 24%;max-height:none;border-left:2px dashed #f2efe673;border-top:0;margin:8px 0 12px;padding:0 8px}aside{flex:0 0 23%;height:auto;min-height:0;flex-direction:column;border-top:0;padding-right:0}.teacher{flex:1 1 0;height:auto;min-height:0}.teacher-panel{flex:0 0 auto;height:auto;min-height:0;padding:6px min(12px,max(6px,env(safe-area-inset-right,0px))) max(6px,env(safe-area-inset-bottom,0px));gap:4px}.hand-button{flex:none;min-height:35px}}
.hand-idle,.hand-mic{display:flex;align-items:center;justify-content:center;gap:9px}.hand-button .mic-symbol{width:27px;height:27px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round}.hand-button.is-recording:disabled{opacity:1}.mic-bars{display:flex;align-items:center;gap:4px;height:30px}.mic-bars i{display:block;width:4px;border-radius:3px;background:currentColor;height:calc(7px + var(--mic-level,0)*22px);transition:height .15s ease;animation:mic-listening 1.1s ease-in-out infinite}.mic-bars i:nth-child(2){animation-delay:.15s}.mic-bars i:nth-child(3){animation-delay:.3s}@keyframes mic-listening{50%{transform:scaleY(.55);opacity:.6}}@media(prefers-reduced-motion:reduce){.mic-bars i{animation:none;transition:none}}
@media(max-width:600px) and (orientation:portrait){.board-shell{height:calc(100dvh - 250px)}aside{height:250px;min-height:250px}.teacher{flex:0 0 40%;height:100%}.teacher img{width:110%;left:-5%;object-position:center bottom}.teacher-panel{height:100%;justify-content:center;gap:6px;padding:10px 8px}.hand-button{flex:0 0 52px;height:52px;min-height:52px;max-height:52px}.teacher-panel .controls{flex:none}.teacher-panel .controls button{height:44px}.chapter-label{min-height:42px;flex:none}#qaContinue{flex:none;min-height:38px}.hand-button span{font-size:15px}}
.judge-history{font-size:12px;color:#cbd4e1;flex:none}.judge-history summary{cursor:pointer;color:var(--brand);padding:4px 0}.judge-history[open]{position:fixed;z-index:25;right:12px;bottom:12px;width:min(360px,calc(100vw - 24px));max-height:50vh;overflow:auto;padding:12px;background:#171e29;border:1px solid #ff394766;border-radius:12px;box-shadow:0 5px 24px #0007}.judge-note{color:#aeb8c9;line-height:1.5}.judge-result{border-top:1px solid #ffffff20;padding:8px 0;overflow-wrap:anywhere}.judge-result p{margin:4px 0;line-height:1.5}.judge-question{color:#f2efe6}.judge-verdict{color:#c8d9df}
.problem-bar .library-button{display:grid;place-items:center;flex:0 0 44px;width:44px;min-height:44px;padding:0;background:transparent;border:0;border-radius:8px;color:var(--brand)}.library-button svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.problem-bar .library-button:hover{background:#ff394718}.hand-button{background:linear-gradient(var(--brand),var(--brand-deep))!important;color:#fff6ea!important;box-shadow:0 3px 14px #f5072125}#start{background:#ff394718;border-color:#ff394766}
.cloud-sync-alert{position:fixed;z-index:32;left:12px;bottom:12px;max-width:calc(100vw - 24px);display:flex;align-items:center;gap:10px;background:#1b2331;border:1px solid #ff394766;border-radius:10px;padding:10px 12px;color:#f2efe6;font-size:12px;box-shadow:0 4px 24px #0006}.cloud-sync-alert button{flex:none;background:transparent;border:0;color:#ff3947;font:inherit;cursor:pointer}.cloud-sync-alert span{min-width:0}
.owned-candidate-revoked{max-width:560px;margin:12vh auto;padding:24px;border:1px solid #ffffff26;border-radius:16px;color:#f2efe6;line-height:1.7}.owned-candidate-revoked a{display:inline-block;margin-top:10px;padding:10px 18px;border-radius:10px;background:var(--brand);color:#fff;text-decoration:none}@media(max-width:600px){.owned-candidate-revoked{margin:10vh 16px}}
#classroomEntry:not([hidden]){position:fixed;inset:0;z-index:100;background:#171d27;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:24px;text-align:center;color:#f3f1e8;font-size:18px;gap:18px}#classroomEntry button{background:#ff3045;color:white;border:0;border-radius:12px;padding:12px 20px}

:root .classroom-input-mode{display:flex;align-items:center;gap:6px;margin:0;padding:4px 8px;border:1px solid #262f3d;border-radius:9px;background:#1a202a;color:#aeb8c9;font-size:11px;min-height:32px;flex:none}
.classroom-input-mode select{flex:1;min-width:0;border:0;padding:3px 0;background:transparent;color:#cbd4e1;font-size:13px}
.classroom-input-mode select:disabled{opacity:.6}
#hand[hidden],#duplexGate[hidden],#duplexGateRetry[hidden],.h5-duplex-only #hand,.h5-duplex-only #answerForm,.h5-duplex-only .classroom-input-mode,.h5-duplex-only #checkMic,.h5-duplex-only .dx-close,.h5-duplex-only #dx-toast{display:none!important}
#duplexGate{position:fixed;inset:0;z-index:100000;display:grid;place-items:center;padding:20px;background:rgba(12,18,30,.8);color:#172232}
#duplexGate>div{position:relative;width:min(100%,420px);max-height:calc(100dvh - 40px);overflow:auto;padding:30px 24px 24px;border-radius:20px;background:#fff;color:#172232;color-scheme:light;box-sizing:border-box}
#duplexGate h2{margin:0 30px 12px 0;font-size:22px;line-height:1.4;color:#172232}
#duplexGate p{margin:0 0 22px;color:#526173;line-height:1.7;overflow-wrap:anywhere}
#duplexGate button{appearance:none;-webkit-appearance:none;font:inherit;font-weight:600;min-height:48px;line-height:1.4;border-radius:12px;padding:12px 16px;white-space:normal}
#duplexGateClose{position:absolute;right:10px;top:6px;width:44px;min-height:44px!important;padding:0!important;border:0;background:transparent;color:#647180;font-size:30px!important}
.duplex-gate-actions{display:grid;grid-template-columns:1fr;gap:12px}
#duplexGateRetry{background:#ff2439;color:#fff;border:1px solid #ff2439}
#duplexGateReload{background:#f4f6f8;color:#243449;border:1px solid #dce2e8}
#dx-slot:empty,#duplexQuotaNote[hidden],.h5-duplex-quota #dx-mic .say{display:none!important}

#duplexMicGuide{padding:14px 16px;margin:0 0 18px;max-height:42dvh;overflow:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;background:#f4f6f8;border:1px solid #e0e5eb;border-radius:12px;color:#304257}
#duplexMicGuide h3{margin:0 0 10px;font-size:16px;line-height:1.5}
#duplexMicGuide ol{padding-left:20px;margin:0 0 12px;font-size:14px;line-height:1.7}
#duplexMicGuide li+li{margin-top:10px}
#duplexMicGuide p{margin:0;font-size:13px;color:#596b80}

#duplexGateHelp{display:block;margin:12px auto 0;min-height:40px!important;padding:8px 12px!important;border:0;background:transparent;color:#536b89;font-size:14px!important;text-decoration:underline;text-underline-offset:3px}
