/* 新移动端工作流与渐进式交互样式；始终在 workspace.css 之后加载。 */

/* Mobile-first review: one current question and one task at a time.
   Desktop workbench remains a dual-pane review surface. */
.mobile-review-toolbar{display:none}
@media(max-width:900px){
  body.in-mobile-review .bottom-nav{display:none}
  body.in-mobile-review .page-footer{padding-bottom:18px}
  #review-view.view{padding-top:12px;padding-bottom:calc(100px + env(safe-area-inset-bottom))}
  #review-view .review-heading{margin-bottom:8px}
  #review-view .review-heading h1{font-size:21px;line-height:1.35}
  #review-view .review-meta{gap:6px;font-size:12px}
  #review-view .review-photo-library{display:none}
  #review-view .review-sections{display:none}
  #review-view .review-jump{display:none}
  #review-view .inline-photo-panel{display:none!important}
  #review-view .mobile-review-toolbar{
    display:flex;position:sticky;top:0;z-index:8;flex-direction:column;gap:8px;
    padding:12px 0 11px;margin:4px 0 12px;background:var(--bg);
    border-bottom:1px solid var(--line)
  }
  #review-view .mobile-review-phase{display:flex;align-items:baseline;justify-content:space-between;gap:12px}
  #review-view .mobile-review-phase strong{font-size:17px;line-height:1.4}
  #review-view .mobile-review-phase .fine{font-size:12px;line-height:1.5;text-align:right}
  #review-view .mobile-review-switch{display:grid;grid-template-columns:1fr 1fr;gap:6px;background:var(--light);border-radius:11px;padding:3px}
  #review-view .mobile-review-switch .text-button{font-size:13px;min-height:44px;border-radius:9px;padding:8px}
  #review-view .mobile-review-switch [aria-pressed="true"]{background:var(--paper);color:var(--green);box-shadow:0 1px 5px #00000012;font-weight:650}
  #review-view .mobile-review-navigation{display:grid;grid-template-columns:44px minmax(0,1fr) 44px;align-items:center;gap:8px}
  #review-view .mobile-review-navigation .button{min-width:44px;min-height:44px;font-size:24px;padding:4px}
  #review-view .mobile-review-navigation select{min-width:0;text-overflow:ellipsis;min-height:44px;font-size:16px}
  #review-view .mobile-review-continue{width:100%;min-height:48px}
  #review-view .mobile-review-save{width:100%;min-height:46px}
  #review-view .review-layout{display:block}
  #review-view .review-question-column{min-width:0}
  #review-view .review-task-heading{margin-bottom:8px;justify-content:flex-end}
  #review-view .review-task-heading h2{display:none}
  #review-view .review-question-utilities>summary{font-size:12px}
  #review-view[data-mobile-stage="questions"] #question-attention:not([data-mobile-group-active]),
  #review-view[data-mobile-stage="questions"] .review-question-group:not([data-mobile-group-active]),
  #review-view[data-mobile-stage="questions"] .other-questions:not([data-mobile-group-active]),
  #review-view[data-mobile-stage="questions"] [data-question]:not([data-mobile-active]){
    display:none!important
  }
  #review-view[data-mobile-stage="questions"] .review-group-title,
  #review-view[data-mobile-stage="questions"] #question-attention>p.fine,
  #review-view[data-mobile-stage="questions"] .review-ready,
  #review-view[data-mobile-stage="questions"] .review-question-group>summary,
  #review-view[data-mobile-stage="questions"] .review-question-group>p.fine,
  #review-view[data-mobile-stage="questions"] .other-questions>summary{display:none}
  #review-view[data-mobile-stage="questions"] .review-question-group,
  #review-view[data-mobile-stage="questions"] .other-questions{margin:0;padding:0;border:0;background:transparent}
  #review-view[data-mobile-stage="questions"] .question-card{margin:0;border-radius:15px;box-shadow:var(--shadow)}
  #review-view[data-mobile-stage="questions"] .question-card>summary{padding:14px 15px}
  #review-view[data-mobile-stage="questions"] .question-body{padding:0 15px 20px}
  #review-view[data-mobile-stage="questions"] .question-answer-glance,
  #review-view[data-mobile-stage="questions"] .question-card[open] .question-glance{display:none}
  #review-view .question-photo-shortcut{width:100%;min-height:48px;margin:7px 0 12px}
  #review-view[data-mobile-stage="questions"] .review-sidebar,
  #review-view[data-mobile-stage="questions"] .review-actions{display:none!important}
  #review-view[data-mobile-stage="feedback"] .review-task-heading,
  #review-view[data-mobile-stage="feedback"] .review-question-column,
  #review-view[data-mobile-stage="notes"] .review-task-heading,
  #review-view[data-mobile-stage="notes"] .review-question-column{display:none}
  #review-view[data-mobile-stage="feedback"] .review-sidebar,
  #review-view[data-mobile-stage="notes"] .review-sidebar{display:flex;flex-direction:column;gap:12px}
  #review-view[data-mobile-stage="feedback"] .review-feedback-panel{order:-1;margin:0}
  #review-view[data-mobile-stage="feedback"] .review-secondary-panel{order:1}
  #review-view[data-mobile-stage="notes"] .review-feedback-panel{display:none}
  #review-view[data-mobile-stage="notes"] .review-actions{display:none}
  #review-view[data-mobile-stage="feedback"] .review-actions{
    position:sticky;bottom:0;z-index:9;background:var(--paper);
    padding:12px 14px calc(12px + env(safe-area-inset-bottom));border-radius:13px;
    border:1px solid var(--line);margin-top:16px;box-shadow:0 -4px 22px #0000000e
  }
  #review-view[data-mobile-stage="feedback"] .review-status{margin-bottom:10px}
  #review-view[data-mobile-stage="feedback"] .review-action-buttons{display:flex;flex-direction:column;gap:8px}
  #review-view[data-mobile-stage="feedback"] .review-action-buttons .button{width:100%}
  #review-view[data-mobile-stage="feedback"] .feedback-options{margin:10px 0 0}
  #review-view[data-mobile-stage="feedback"] .review-feedback-panel{padding:16px}
  #review-view[data-mobile-stage="feedback"] .review-feedback-panel textarea{min-height:220px}
  /* 主要操作已是“生成回复”时，隐藏相同的次级付费按钮，避免误点两次。 */
  #review-view[data-mobile-stage="feedback"]:has(.review-actions [data-primary-review][data-action="generate"]) .review-feedback-panel .feedback-options [data-action="generate"]{display:none}
  #review-view .question-card .quick-verdict{gap:9px}
  #review-view .question-card .quick-verdict .button{min-height:50px;font-size:14px}
  #review-view .question-card .quick-verdict-help{font-size:12px}
  #review-view .question-correction-tools>.button,
  #review-view .question-correction-tools>.question-editor>summary{padding:10px 6px;font-size:13px}
  #review-view .question-card .step-review-brief,
  #review-view .question-card .question-image-tools,
  #review-view .question-card [data-related-notes],
  #review-view .question-card .judgment-hint{margin-top:13px}
  /* Upload becomes a short form rather than two long desktop panels. */
  #upload-view.view{padding-top:18px}
  #upload-view .upload-heading{margin-bottom:14px}
  #upload-view .upload-heading .eyebrow{display:none}
  #upload-view .upload-heading h1{font-size:25px}
  #upload-view .upload-heading .muted{font-size:13px;margin-top:3px;line-height:1.5}
  #upload-view .upload-layout{gap:12px}
  #upload-view .upload-layout>.panel{padding:16px;border-radius:13px}
  #upload-view .panel-title{margin-bottom:12px}
  #upload-view .panel-title h2{font-size:15px}
  #upload-view .upload-details-panel .field{margin-top:12px}
  #upload-view .upload-photos-panel .dropzone{min-height:126px}
  #upload-view .photo-grid{gap:8px;margin:10px 0}
  #upload-view .photo-tile p{min-height:0;font-size:11px}
  #upload-view .upload-footer .button{min-height:50px}
  #queue-view .queue-heading .eyebrow{display:none}
  #queue-view .queue-heading .muted{line-height:1.5;margin-top:5px}
  #queue-view .queue-heading{margin-bottom:15px}
  #queue-view .queue-section-heading{margin-bottom:10px}
  #queue-view .job-card-hint{font-size:12px;line-height:1.5}
}

/* Camera and library are separate mobile file-picking paths, with native input semantics. */
.upload-pick-actions{display:none}
@media(max-width:900px){
  #upload-view .upload-pick-actions{display:grid;grid-template-columns:1fr 1fr;gap:9px;margin:4px 0 10px}
  #upload-view .upload-pick-actions .button{min-width:0;min-height:56px;white-space:normal;text-align:center}
  #upload-view .dropzone{display:none}
  #upload-view .upload-locked .upload-pick-actions{pointer-events:none;opacity:.55}
  #upload-view .upload-photos-panel #photo-count{margin:6px 0 10px}
  #upload-view .upload-details-panel .input-row{grid-template-columns:minmax(0,1fr) auto}
  #upload-view .upload-details-panel .field{margin-top:10px}
  #upload-view .upload-privacy{font-size:12px}
  #review-view .quick-verdict .verdict-primary{min-width:0}
  #review-view .question-advanced{margin-top:12px}
  #review-view .question-advanced .question-image-tools .button{min-height:44px}
  #review-view .question-card .quick-verdict{grid-template-columns:minmax(0,1fr) auto;gap:8px}
}

/* Student list: protect destructive commands by disclosing them only on demand. */
#students-view .job-card-footer{gap:8px}
#students-view .student-manage{position:relative}
#students-view .student-manage>summary{cursor:pointer;display:flex;align-items:center;min-height:44px;padding:8px 12px;border-radius:9px;color:var(--muted);font-size:13px;list-style:none}
#students-view .student-manage>summary::-webkit-details-marker{display:none}
#students-view .student-manage>summary:focus-visible{outline:3px solid #93bda5;outline-offset:2px}
#students-view .student-manage[open]>summary{background:var(--light)}
#students-view .student-manage>button{position:absolute;right:0;top:100%;z-index:4;min-width:144px;background:var(--paper);border:1px solid var(--line);box-shadow:var(--shadow)}
@media(max-width:900px){
  #students-view .page-heading .eyebrow{display:none}
  #students-view .page-heading{margin-bottom:16px}
  #students-view .page-heading .muted{font-size:12px;line-height:1.55}
  #students-view .job-card-head{margin-bottom:4px}
  #students-view .job-card-footer{padding-top:8px;margin-top:10px}
}

/* A single optional section for teacher-provided grading references. */
.upload-advanced{border-top:1px solid var(--line);margin-top:14px;padding-top:8px}
.upload-advanced>summary{cursor:pointer;list-style:none;min-height:48px;display:flex;align-items:center;gap:8px;color:var(--green);font-size:13px;font-weight:600}
.upload-advanced>summary::-webkit-details-marker{display:none}
.upload-advanced>summary::after{content:'⌄';margin-left:auto;font-size:18px}
.upload-advanced[open]>summary::after{content:'⌃'}
.upload-advanced>summary:focus-visible{outline:3px solid #93bda5;outline-offset:2px}
.upload-advanced-reference{padding:10px 0 2px}
.upload-advanced-reference textarea{width:100%;margin-top:2px}
.upload-advanced .original-upload{margin-top:12px}
.upload-advanced .original-upload>h3{margin-bottom:5px}
.upload-advanced #material-mapping{margin-top:14px}
@media(max-width:900px){
 #upload-view .upload-advanced{margin-top:10px}
 #upload-view .upload-advanced>summary{min-height:44px}
 #upload-view .upload-advanced-reference textarea{min-height:95px}
}
/* Paper navigation is separate from grading and uses the same touch targets. */
@media(max-width:760px){
  .bottom-nav{grid-template-columns:repeat(5,minmax(0,1fr))}
  body.paper-reading .topbar,body.paper-reading .bottom-nav{display:none}
  .paper-workbench{padding-bottom:calc(84px + env(safe-area-inset-bottom))}
  .paper-reader-heading h1{font-size:18px;line-height:1.4}
  .paper-reader-heading>.danger{font-size:14px;background:transparent;border:0;color:var(--red);padding:8px}
  .paper-heading{margin-bottom:10px}
  .paper-layout{grid-template-columns:minmax(0,1fr);grid-template-areas:"solution" "photo";gap:20px}
  .paper-reading-column{display:contents}
  .paper-layout.paper-has-question{grid-template-areas:"stem" "photo" "solution";gap:16px}
  .paper-photo-column{position:static}
  .paper-has-question:not(.paper-locating) .paper-photo-heading{display:none}
  .paper-photo-column{display:flex;flex-direction:column}
  .paper-photo-options{order:2}
  .paper-photo-help{order:3}
  .paper-has-question:not(.paper-locating) .paper-photo-help{display:none}
  .paper-stem-column{scroll-margin-top:72px}
  .paper-recognized{font-size:16px;line-height:1.8;margin:0}
  .paper-has-question .paper-solution{padding:0;border:0;box-shadow:none;background:transparent}
  .paper-answer-block{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 16px}
  .paper-answer-block>.fine{white-space:nowrap}
  .paper-answer{font-size:28px;margin:0;min-width:0;line-height:1.5}
  .paper-answer.paper-answer-long{font-size:18px}
  .paper-solution h3{margin-top:24px}
  .paper-steps{font-size:16px}
  .paper-turner{position:fixed;bottom:0;left:0;right:0;z-index:10;margin:0;padding:12px 20px calc(12px + env(safe-area-inset-bottom));background:var(--bg);border-top:1px solid var(--line)}
  .paper-photo-column,.paper-solution-column{scroll-margin-top:72px}
  .paper-navigation{position:sticky;top:0;z-index:4;gap:6px;margin:10px 0 14px;padding:8px 0;background:var(--bg);border-bottom:1px solid var(--line)}
  .paper-navigation>select{font-size:16px}
  .paper-page-select{font-size:14px;min-width:0}
  .paper-page-select select{min-height:44px;max-width:132px;font-size:16px}
  .paper-workbench input,.paper-workbench textarea,.paper-workbench select{font-size:16px;min-width:0;max-width:100%}
  .paper-workbench button,.paper-workbench .button{min-height:44px}
  .paper-workbench .paper-region{min-height:0}
  .paper-photo-column>.section-heading{gap:8px;align-items:center;flex-wrap:wrap}
  .paper-photo-column .paper-tools{margin:0}
  .paper-photo-column .paper-photo-tools{margin-bottom:12px}
  .paper-answer-pin{font-size:14px}
  .paper-reading-shortcut{display:inline-flex}
  .paper-solution,.paper-editor{padding:18px}
  .paper-steps{line-height:1.8}
  .paper-editor>.button{width:100%;white-space:normal}
  .paper-image-dialog{width:100vw;max-width:100vw;height:100dvh;max-height:100dvh;margin:0;padding:calc(12px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom));border-radius:0}
  .paper-file-actions{gap:6px}
  .paper-upload-meta{grid-template-columns:minmax(0,1fr);gap:8px}
  .paper-library-heading{gap:12px;flex-wrap:nowrap}
  .paper-library-heading>div:first-child{min-width:0}
  .paper-library-heading h1{font-size:26px}
  .paper-library-actions{margin-left:auto;gap:8px}
  .paper-library-actions>.text-button{min-width:44px}
  .paper-library-actions .button{min-height:44px;padding:10px 14px;font-size:14px}
  .paper-list-card{padding:18px}
  .paper-card-preview{gap:14px}
}
@media(max-width:900px){
  .math-diagram .diagram-report{font-size:16px}
  .math-diagram .diagram-actions{align-items:stretch}
  .math-diagram .diagram-actions .button{flex:1 1 180px}
  .math-diagram .diagram-fractions>div{grid-template-columns:52px minmax(0,1fr);gap:8px}
  .math-diagram .diagram-table th,.math-diagram .diagram-table td{padding:10px 3px}
}
