:root{font-family:"Microsoft YaHei",Arial,sans-serif;color:#1f2937;background:#f5f7fb;font-synthesis:none}
*{box-sizing:border-box}body{margin:0}button,input,textarea,select{font:inherit}button{cursor:pointer;border:1px solid #c9d2df;border-radius:10px;padding:9px 13px;background:#fff;color:#223044}button:hover{border-color:#426ce4}button:disabled{opacity:.55;cursor:wait}.primary{background:#325fdd;color:#fff;border-color:#325fdd}.primary:hover{background:#224fc9}.quiet{background:#fff}.hidden{display:none!important}
.topbar{height:76px;background:#fff;border-bottom:1px solid #e4e8ef;display:flex;align-items:center;justify-content:space-between;padding:12px 24px;gap:15px}.brand{font-size:23px;font-weight:750;color:#2148b5}.brand span{font-weight:450;color:#2f3a4a}.sub,.muted{color:#697586}.sub{font-size:12px;margin-top:2px}.small{font-size:12px}.top-actions{display:flex;align-items:center;gap:12px;font-size:13px}.badge{background:#e9eefb;border-radius:999px;padding:5px 9px;color:#3456a6}
.auth-view{max-width:440px;margin:70px auto}.panel{background:#fff;border:1px solid #e5e9f0;border-radius:16px;box-shadow:0 6px 22px #1e3b6910}.auth-view .panel{padding:28px}.panel h1{font-size:19px;margin:0 0 8px}.panel h2{font-size:15px;margin:0 0 10px}.panel h3{font-size:14px;margin:8px 0}.panel p{line-height:1.6}.stack{display:flex;flex-direction:column;gap:14px}.compact{gap:9px}.stack label{font-size:13px;font-weight:600;display:flex;flex-direction:column;gap:6px}input,textarea,select{width:100%;border:1px solid #cdd5e0;border-radius:8px;padding:9px 10px;background:#fff;color:#1f2937}textarea{resize:vertical;line-height:1.5}input:focus,textarea:focus,select:focus{outline:2px solid #b8cbff;border-color:#6a8de8}.row{display:flex;gap:8px}.divider{height:1px;background:#e7ebf2;margin:20px 0}
.workspace{display:grid;grid-template-columns:255px minmax(310px,1.05fr) minmax(310px,1fr);gap:12px;padding:14px;min-height:calc(100vh - 76px)}.workspace>.panel{padding:16px;min-height:0}.sidebar{overflow:auto}.paper{display:flex;flex-direction:column;gap:13px}.tutor{display:flex;flex-direction:column}.section-title{display:flex;justify-content:space-between;align-items:flex-start}.section-title p{margin:0}.list{display:flex;flex-direction:column;gap:7px}.list button{text-align:left;width:100%}.list button.active,.page-tabs button.active,.question-list button.active{background:#e9efff;border-color:#7394ee;color:#163c9f}.list small{display:block;color:#738094;margin-top:3px}.page-tabs{display:flex;flex-wrap:wrap;gap:6px}.page-tabs button{font-size:12px;padding:6px 9px}.image-wrap{background:#f0f2f6;border:1px solid #e1e5ec;border-radius:10px;display:flex;justify-content:center;max-height:50vh;overflow:auto}.image-wrap img{max-width:100%;height:auto;object-fit:contain;align-self:flex-start}.question-header{display:flex;align-items:center;justify-content:space-between;margin-top:12px}.question-header h2{margin:0}.question-list{display:flex;flex-direction:column;gap:7px}.question-list button{text-align:left;line-height:1.45}.question-list .snippet{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#67768a;font-size:12px;margin-top:3px}.source{background:#f5f7fc;border:1px solid #e0e6f4;border-radius:10px;padding:11px;white-space:pre-wrap;font-size:13px;line-height:1.55;max-height:175px;overflow:auto}.messages{flex:1;min-height:240px;max-height:60vh;overflow:auto;padding:10px 1px;display:flex;flex-direction:column;gap:11px}.bubble{max-width:92%;border-radius:12px;padding:10px 12px;white-space:pre-wrap;line-height:1.55;font-size:14px;background:#f0f2f6;align-self:flex-start}.bubble.child{background:#e1ebff;align-self:flex-end}.bubble small{display:block;color:#6b7687;font-size:10px;margin-top:5px}.chat-form{display:flex;flex-direction:column;gap:8px;border-top:1px solid #e4e9f1;padding-top:12px}.chat-form button{align-self:flex-end}.callout{background:#fff6df;border:1px solid #f1dc9b;color:#7a5a16;border-radius:10px;padding:10px;font-size:12px;line-height:1.5;margin-top:12px}.event-list{font-size:12px;color:#526176;margin-top:8px}.event{border-bottom:1px solid #ebedf2;padding:7px 0;white-space:pre-wrap}.toast{position:fixed;z-index:10;right:20px;top:84px;max-width:min(460px,90vw);padding:11px 15px;border-radius:10px;background:#263a5e;color:#fff;box-shadow:0 10px 30px #0002;font-size:13px}
.child-workspace{display:grid;grid-template-columns:250px minmax(300px,1.05fr) minmax(300px,1fr);grid-template-rows:auto minmax(0,1fr);gap:12px;padding:14px;height:calc(100vh - 76px);height:calc(100dvh - 76px);min-height:0;overflow:hidden}.child-workspace>.panel{padding:18px;min-width:0;min-height:0}.child-welcome{grid-column:1/-1;display:flex;align-items:center;justify-content:space-between;gap:16px;background:#eaf1ff}.child-welcome h1{font-size:21px;margin:0}.child-welcome p{margin:5px 0 0;color:#4e6483}.child-badge{color:#2653bc;background:#fff;border-radius:999px;padding:7px 12px;white-space:nowrap;font-size:12px}.child-tools{overflow:auto}.child-paper{display:flex;flex-direction:column;gap:11px;overflow:hidden}.child-paper h2{font-size:15px;margin:10px 0 0}.child-tutor{display:flex;flex-direction:column;overflow:hidden}.child-tutor .source{max-height:210px}
.child-paper #childPaperContent{display:flex;flex:1;min-height:0;flex-direction:column;gap:9px;overflow:hidden}.child-paper .image-wrap{flex:0 1 46%;min-height:120px;max-height:none}.child-paper #childQuestions{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain}.child-tutor .messages{flex:1 1 0;min-height:0;max-height:none;overflow-y:auto;overscroll-behavior:contain}.child-tutor .bubble{flex-shrink:0}.child-tutor .chat-form{flex:0 0 auto}
.voice-toolbar{display:flex;flex-wrap:wrap;gap:8px}.voice-toolbar button{align-self:auto}.voice-toolbar button.listening{background:#fff0ed;border-color:#e58d7c;color:#ae3f32}.voice-status{margin:0;line-height:1.4}
.question-header{gap:8px}.question-header .row{flex-wrap:wrap;justify-content:flex-end}.review-form{margin:12px 0;padding:12px;border:1px solid #dfe7f7;border-radius:12px;background:#f8faff}.review-form select[multiple]{min-height:96px}.review-form button{align-self:flex-start}.learning-summary{display:flex;flex-direction:column;gap:6px}.learning-summary .learning-row{padding:7px 8px;border:1px solid #e1e8f5;border-radius:8px;background:#f8faff}.learning-summary .learning-row strong{display:block;color:#263c65}.learning-summary .learning-row small{display:block;margin-top:3px}.child-tutor #nextQuestionBtn{flex:0 0 auto;align-self:flex-end;margin-top:6px}
.knowledge-catalog{margin-top:10px}.knowledge-catalog summary{cursor:pointer;color:#234eaf;font-size:12px}.knowledge-catalog #knowledgeCatalog{max-height:42vh;overflow:auto;margin-top:8px}.knowledge-catalog .learning-row p{font-size:11px;line-height:1.5;margin:5px 0 0}
.evidence-actions{margin-top:6px}.evidence-actions button{font-size:11px;padding:4px 8px}
.image-actions,.child-page-actions{flex-wrap:wrap}.image-actions button,.child-page-actions button{align-self:auto}.chat-image-preview{display:flex;align-items:center;gap:10px;padding:7px;border:1px solid #dce5f3;border-radius:9px;background:#f7faff}.chat-image-preview img{max-width:130px;max-height:90px;object-fit:contain}.chat-image-preview button{align-self:auto}.bubble img{display:block;max-width:min(310px,100%);max-height:230px;object-fit:contain;margin-top:6px;border-radius:8px;cursor:zoom-in}.image-review-result{padding:10px;border:1px solid #cfdbf4;border-radius:9px;background:#f4f8ff;white-space:pre-wrap;font-size:13px;line-height:1.5}
.math-diagram{margin:10px 0 0;white-space:normal}.math-diagram-image{display:block!important;width:min(480px,100%);height:auto;max-width:100%!important;max-height:none!important;background:#fff;border:1px solid #dce5f3;border-radius:8px;cursor:default!important}.math-diagram figcaption{font-size:11px;color:#697586;margin:6px 0}.math-diagram details{font-size:12px;color:#526176}.math-diagram details summary{cursor:pointer}.math-diagram details ul{margin:6px 0;padding-left:22px}.math-diagram-actions{margin-top:8px;align-items:center}.math-diagram-actions a,.math-diagram-actions button{font-size:12px;padding:6px 10px}.math-diagram-actions a{color:#234eaf;text-decoration:none;border:1px solid #c9d2df;border-radius:8px;background:#fff}.math-diagram-error{padding:9px;background:#fff6df;border:1px solid #f1dc9b;border-radius:8px;color:#7a5a16;font-size:12px}.math-drawing-dialog{width:min(620px,94vw);max-height:94vh;overflow:auto;border:1px solid #cbd5e1;border-radius:14px;padding:20px;box-shadow:0 18px 60px #0004}.math-drawing-dialog::backdrop{background:#162032a8}.math-drawing-dialog h2{margin:0;font-size:20px}.math-drawing-parameters{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:10px}.math-drawing-preview{margin-top:14px}.math-drawing-dialog form>button{align-self:flex-start}
.crop-dialog{width:min(1040px,94vw);max-height:94vh;border:1px solid #cbd5e1;border-radius:14px;padding:16px;box-shadow:0 18px 60px #0004}.crop-dialog::backdrop{background:#162032a8}.crop-dialog h2{margin:0}.crop-dialog .row{justify-content:flex-end;margin-top:10px}.crop-scroll{max-height:70vh;overflow:auto;background:#eef2f7;border-radius:8px}.crop-surface{position:relative;width:max-content;max-width:none;line-height:0;cursor:crosshair;touch-action:none}.crop-surface img{display:block;width:min(900px,85vw);height:auto;max-width:none;max-height:none}.crop-selection{position:absolute;border:2px solid #325fdd;background:#325fdd38;pointer-events:none}
.checkbox{display:flex!important;flex-direction:row!important;align-items:flex-start;gap:7px;font-weight:400!important;font-size:12px!important;line-height:1.4}.checkbox input{width:auto;margin:2px 0 0}
@media(max-width:1100px){.workspace{grid-template-columns:220px 1fr}.tutor{grid-column:1/-1}.messages{max-height:360px}}
@media(max-width:940px){.child-workspace{height:auto;min-height:calc(100dvh - 76px);grid-template-columns:220px minmax(0,1fr);grid-template-rows:auto;overflow:visible}.child-paper{height:min(750px,80vh)}.child-tutor{grid-column:1/-1;height:min(650px,80vh);min-height:420px}}
@media(max-width:720px){.topbar{height:auto;padding:11px;align-items:flex-start}.brand{font-size:20px}.workspace,.child-workspace{display:flex;flex-direction:column;padding:8px}.workspace>.panel,.child-workspace>.panel{padding:13px}.child-welcome{align-items:flex-start}.auth-view{margin:24px 10px}.image-wrap{max-height:55vh}.messages{min-height:180px}.child-tutor .messages{min-height:0}.top-actions{flex-wrap:wrap;justify-content:flex-end}}
/* Leave room above and below roots/fractions in one-line question previews. */
.question-list .snippet{line-height:1.9;padding:3px 0}
.question-list .snippet .katex{font-size:1.12em;white-space:nowrap}
.bubble,.source,.image-review-result{overflow-wrap:anywhere}
.katex{white-space:normal}
.bubble .katex-display,.source .katex-display,.image-review-result .katex-display{max-width:100%;overflow-x:auto;overflow-y:hidden;padding:4px 0;margin:8px 0}
/* Child chat: a compact question header, independently scrolling messages and a fixed composer. */
.child-chat-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-shrink:0}
.child-chat-heading h1{margin:0;white-space:nowrap}.child-chat-heading .row{flex-wrap:wrap;justify-content:flex-end;gap:5px}
.child-chat-heading button{font-size:12px;padding:5px 8px}.child-tutor .child-chat-heading #nextQuestionBtn{margin:0;align-self:auto}
.child-tutor #childCurrentQuestion{margin:5px 0;flex-shrink:0}.child-question-preview{margin:0 0 5px;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:1.9!important;flex-shrink:0}
.child-question-preview .katex-display{display:inline-block;margin:0}.child-question-preview .katex{white-space:nowrap}
.child-source-details{flex:0 0 auto;margin-bottom:5px;font-size:12px}.child-source-details>summary{cursor:pointer;color:#3456a6;width:fit-content;padding:3px 0}
.child-source-content{max-height:min(24dvh,200px);overflow:auto;overscroll-behavior:contain;margin-top:5px;border:1px solid #e0e6f4;border-radius:9px;background:#f5f7fc;padding:9px}
.child-source-content .source{padding:0;border:0;border-radius:0;max-height:none;overflow:visible}.child-source-content p{margin:7px 0}.child-source-content button{font-size:12px;padding:6px 9px}
.child-tutor #childResultStatus{flex:0 0 auto;font-size:11px;margin:0 0 5px;line-height:1.5}.child-tutor #childResultStatus:empty{display:none}
.child-tutor .messages{padding:12px 1px;border-top:1px solid #edf0f5;scrollbar-gutter:stable}
.child-tutor .chat-form{gap:7px;padding-top:8px;background:#fff}.child-tutor .chat-tools{align-items:center;gap:6px}
.child-tutor .chat-tools button,.chat-tool-menu>summary{font-size:12px;padding:6px 9px;white-space:nowrap;line-height:1.5}
.chat-tool-menu{position:relative}.chat-tool-menu>summary{list-style:none;cursor:pointer;border:1px solid #c9d2df;border-radius:9px;color:#223044;background:#fff}.chat-tool-menu>summary::-webkit-details-marker{display:none}
.chat-tool-menu>summary:hover,.chat-tool-menu[open]>summary{border-color:#426ce4;background:#f5f8ff}.chat-tool-menu>summary:focus-visible{outline:2px solid #b8cbff}
.tool-popover{position:absolute;z-index:4;bottom:calc(100% + 8px);left:0;display:flex;flex-direction:column;gap:7px;width:max-content;max-width:calc(100vw - 60px);padding:10px;border:1px solid #dce3ef;border-radius:10px;background:#fff;box-shadow:0 7px 24px #1e3b6926;font-size:12px;color:#526176;max-height:45dvh;overflow:auto}
.tool-popover p{margin:0;line-height:1.6}.chat-help-menu{margin-left:auto}.chat-help-menu .tool-popover{left:auto;right:0;width:290px}.tool-popover.image-actions button{width:100%;text-align:left}
.chat-entry{display:flex;gap:8px;align-items:flex-end}.chat-entry textarea{flex:1;min-width:0;height:88px;min-height:0;resize:none;font-size:14px}.child-tutor .chat-entry button{flex:0 0 auto;align-self:flex-end;font-size:13px;padding:9px 11px}
.child-tutor .chat-image-preview{padding:5px 8px}.child-tutor .chat-image-preview img{max-height:55px;max-width:100px}.child-tutor .chat-image-preview button{font-size:12px;padding:5px 8px}
.child-tutor .voice-status{font-size:11px;max-height:44px;overflow:auto}
.mistake-bank-dialog{width:min(1120px,96vw);height:min(840px,94dvh);padding:20px;border:1px solid #d3dcec;border-radius:16px;color:#223044;overflow:hidden}
.mistake-bank-dialog[open]{display:flex;flex-direction:column;gap:12px}.mistake-bank-dialog::backdrop{background:#172d4f88}.mistake-bank-dialog h2{margin:0}.mistake-bank-dialog p{line-height:1.6}.mistake-bank-dialog summary{cursor:pointer;color:#315bb6;padding:7px 0}
.mistake-filters{display:flex;align-items:center;gap:12px;flex-wrap:wrap}.mistake-filters label{font-size:12px;display:flex;align-items:center;gap:6px}.mistake-filters select{width:auto;max-width:190px;padding:6px}.mistake-filters button{font-size:12px;padding:7px 10px}
.mistake-bank-content{display:grid;grid-template-columns:290px minmax(0,1fr);gap:18px;flex:1;min-height:0}.mistake-list,.mistake-detail{overflow:auto;min-height:0;overscroll-behavior:contain}.mistake-list{display:flex;flex-direction:column;gap:8px}.mistake-list>button{text-align:left;flex-shrink:0}.mistake-list>button.active{background:#eaf0ff;border-color:#7796ee}.mistake-list small,.mistake-evidence small{display:block;font-size:11px;color:#697586;margin:5px 0}.mistake-snippet{display:block;font-size:12px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;max-width:100%}
.mistake-tag{display:inline-block;font-size:11px;font-weight:400;padding:2px 7px;border-radius:20px;background:#edf1f7;color:#526176}.mistake-tag.pending{background:#fff4d8;color:#86620c}.mistake-tag.active{background:#e6efff;color:#2454b3}.mistake-tag.archived{background:#e5f4eb;color:#267348}.mistake-detail{padding:0 12px 12px 0;font-size:13px}.mistake-detail h3{margin:8px 0}.mistake-detail .source{margin:10px 0;max-height:230px}.mistake-detail .stack{margin:14px 0;padding:14px;border:1px solid #e1e7f0;border-radius:10px;background:#f8faff}.mistake-detail .stack button{align-self:flex-start}.mistake-notice{padding:9px;border-radius:8px;background:#eff4fd}.mistake-evidence{border-bottom:1px solid #e4e9f3;padding:8px 0}.mistake-evidence p{margin:5px 0}.mistake-detail ul{padding-left:20px;line-height:1.7}.mistake-detail select[multiple]{height:106px}
.mistake-detail .stack>p{margin:0}
@media(max-width:720px){.mistake-bank-dialog{padding:12px}.mistake-bank-content{grid-template-columns:1fr;grid-template-rows:170px minmax(0,1fr)}.mistake-detail{padding-right:3px}}
@media(max-height:760px) and (min-width:941px){.child-workspace>.panel{padding:12px}.child-welcome h1{font-size:18px}.child-welcome p{font-size:12px}.child-tutor .chat-entry textarea{height:72px}.child-source-content{max-height:18dvh}}
@media(max-width:720px){.child-chat-heading{flex-wrap:wrap}.chat-entry{gap:6px}.child-tutor .chat-entry button{padding:9px 8px;font-size:12px}.child-tutor .chat-tools{gap:5px}.child-tutor .chat-tools button,.chat-tool-menu>summary{padding:5px 7px}}
/* Compact task controls preserve the chat viewport. */
.learning-tasks{margin-top:9px;max-height:270px;overflow:auto}.learning-tasks button{font-size:12px;flex-shrink:0}.child-tools>details>summary{cursor:pointer;padding-top:12px;color:#315bb6}.child-task-context{flex-shrink:0;background:#f3f7ff;border-radius:8px;padding:7px 9px;font-size:12px;max-height:24dvh;overflow:auto}.child-task-context>.row{align-items:center;justify-content:space-between}.child-task-context>.row>span{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.child-task-context button{white-space:nowrap;font-size:12px;padding:5px 8px}.child-task-context summary{cursor:pointer;color:#315bb6;margin-top:4px}.child-task-context p{margin:5px 0}

/* Parent page: one primary check action, optional recovery tools. */
.page-actions{align-items:flex-start;flex-wrap:wrap}.page-tools{position:relative}.page-tools>summary{cursor:pointer;list-style:none;border:1px solid #c9d2df;border-radius:10px;padding:10px 14px;background:#fff;color:#253f65;white-space:nowrap}.page-tools>summary::-webkit-details-marker{display:none}.page-tools>summary::after{content:" ▾"}.page-tools>summary:focus-visible{outline:2px solid #426ce4}.page-tools-menu{position:absolute;right:0;top:calc(100% + 7px);z-index:20;width:285px;max-width:calc(100vw - 48px);padding:12px;background:white;border:1px solid #d7dfeb;border-radius:12px;box-shadow:0 8px 24px #21365022}.page-tools-menu button{width:100%;text-align:left}.page-tools-menu p{font-size:12px;color:#64748b;line-height:1.5;margin:5px 2px 12px}.page-tools-menu p:last-child{margin-bottom:0}.question-filters{align-items:center;flex-wrap:wrap;margin:8px 0}.question-filters button{padding:6px 10px;font-size:13px}.question-filters button[aria-pressed="true"]{background:#eaf0ff;border-color:#668bed;color:#214cc1}.question-filters span{margin-left:auto}

.page-tools-menu button.hidden+p{display:none}
