/* Fraction workflow layout. Classroom chrome comes from interactive-tool-shell.css. */
.app { height: 100dvh; min-height: 0; grid-template-rows: auto minmax(0,1fr); }
#fractionCalculationModel { min-height: 0; }
.fce-tool { height: 100%; min-height: 0; display: grid; grid-template-rows: auto minmax(0,1fr); }
.fce-toolbar { flex-wrap: wrap; }
.fce-toolbar .toolbar-group { flex-wrap: nowrap; }
.fce-toolbar .menu-panel { width: 330px; }
.fce-toolbar .fce-calculation-menu { width: min(680px,calc(100vw - 28px)); }
.fce-toolbar .fce-presets-menu button { display: block; width: 100%; margin: 3px 0; text-align: left; }
.fce-toolbar .fce-question-menu { width: min(600px,calc(100vw - 28px)); }
.fce-toolbar .menu-panel button { margin: 3px; }
.fce-toolbar .menu-panel fieldset + fieldset { margin-top: 10px; }
.fce-tool label { display: flex; align-items: center; gap: 8px; }
.fce-tool fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.fce-tool legend { font-weight: 800; }
.fce-tool input[type=radio], .fce-tool input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--blue); }
.fce-tool input[type=text] { width: 90px; }
.fce-choices { display: flex; gap: 8px; flex-wrap: wrap; padding: 6px 0; }
.fce-choices label { padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); min-height: var(--touch); }
.fce-operands { display: flex; gap: 10px; flex-wrap: wrap; }
.fce-tool .fce-fraction-editor { display: flex; align-items: center; gap: 8px; padding: 8px; }
.fce-fraction-editor > label, .fce-stacked-fields label { display: block; font-size: 13px; color: var(--muted); }
.fce-tool .fce-fraction-editor input { width: 76px; display: block; }
.fce-stacked-fields { display: grid; gap: 4px; }
.fce-stacked-fields label:first-child { border-bottom: 2px solid var(--ink); padding-bottom: 4px; }
.fce-workspace { position: relative; grid-template-rows: minmax(0,1fr) auto; gap: 0; }
.fce-model-panel { min-height: 0; display: grid; grid-template-rows: auto auto minmax(0,1fr); }
.fce-question { padding: 10px 16px 2px; text-align: center; }
.fce-question .model-number-sentence { margin: 4px 0 !important; font-size: clamp(28px,2.5vw,38px); }
.fce-question p:not(.model-number-sentence) { margin: 5px 0; }
.fce-answer-space { display: inline-block; vertical-align: middle; width: 145px; height: 52px; border: 2px solid #627887; border-radius: 3px; margin: 0 10px; }
.fce-stage { padding: 8px 16px; min-height: 96px; }
.fce-tool[data-operand-count="3"] .fce-stage { min-height: 96px; }
.fce-stage p { margin: 0 0 8px; font-size: 18px; }
.fce-stage-number { color: #102131; margin-right: 10px; }
.fce-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fce-actions [data-action=undo] { margin-left: auto; }
.fce-units { font-size: 14px; }
.fce-canvas { min-height: 0; min-width: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 8px 16px 16px; }
.fce-canvas .question-visual { margin: 0; width: 100%; height: 100%; display: grid; grid-template-rows: minmax(0,1fr) clamp(76px,7.4vw,92px); min-height: 0; max-width: none; }
.fce-canvas .fraction-calculation-equipment-model--expanded-whole-bank,
.fce-canvas .fraction-calculation-equipment-model:not(:has(.model-number-sentence)) { grid-template-rows: minmax(0,1fr); }
.fce-canvas svg { display: block; min-height: 0; width: 100%; flex: 1; height: 100%; max-height: none; }
.fce-canvas .model-number-sentence { flex: 0 0 auto; min-height: 0; margin-bottom: 0; font-size: clamp(30px,3vw,40px); }
@media screen and (min-width:1024px) and (max-width:1100px) {
  .fce-toolbar > .toolbar-group > details > summary,
  .fce-toolbar > .toolbar-group > button { padding-inline: 10px; }
  .fce-stage { min-height: 116px; }
  .fce-tool[data-operand-count="3"] .fce-stage { min-height: 116px; }
}
.fce-response { display: grid; gap: 10px; margin-bottom: 16px; }
.fce-response form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.fce-response .tool-input { font-size: 20px; }
.fce-response #response-w { font-size: 26px; }
.fce-support { display: flex; gap: 8px; }
.fce-feedback { position: absolute; bottom: 30px; left: 28px; right: 28px; margin: 0; background: #fff; }
.fce-workspace:has(> .fce-feedback:not(:empty)) .fce-canvas .model-number-sentence { visibility: hidden; }
.fce-feedback:empty { display: none; }
.fce-question-menu .fce-response { border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.app:fullscreen { width: 100%; height: 100%; }
@media (max-width:1023px), (max-height:599px) {
  .app { height: auto; min-height: 100dvh; }
  .fce-tool { height: auto; grid-template-rows: auto auto; }
  .fce-model-panel { grid-template-rows: auto auto auto; }
  .fce-canvas { overflow: visible; }
  .fce-canvas .question-visual { height: auto; display: block; }
  .fce-canvas svg { height: auto; min-height: 220px; flex: none; }
  .fce-toolbar .toolbar-group { flex-wrap: wrap; }
  .fce-feedback { position: static; margin: 10px 0 0; }
}
@media (max-width:860px) {
  .fce-toolbar .toolbar-group > button, .fce-toolbar .toolbar-group > details { flex: 1 1 auto; }
  .fce-toolbar .toolbar-group { gap: 8px; }
  .fce-question .model-number-sentence { font-size: 25px; }
  .fce-answer-space { width: 95px; }
  .fce-actions { align-items: stretch; }
  .fce-actions [data-action=undo] { margin-left: 0; }
  .fce-canvas { padding: 8px; }
  .fce-canvas .fraction-calculation-equipment-model svg { min-height: 0; height: auto; flex: none; }
  .fce-canvas .fraction-calculation-equipment-model { height: auto; display: block; }
  .fce-canvas .model-number-sentence { margin-bottom: 10px; }
  .fce-question-menu .fce-fraction-editor input { width: 65px; }
}
@media print {
  @page { size: A4 landscape; margin: 9mm; }
  html, body { background: #fff !important; width: auto !important; height: auto !important; }
  .app, .fce-tool, .fce-workspace, .fce-model-panel { height: auto !important; display: block !important; min-height: 0 !important; padding: 0 !important; }
  .fce-actions { display: none !important; }
  .fce-model-panel { border: 0; }
  .fce-question { padding: 0; }
  .fce-question .model-number-sentence { font-size: 22pt !important; }
  .fce-stage { padding: 2mm 0; }
  .fce-stage, .fce-tool[data-operand-count="3"] .fce-stage { min-height: 0; }
  .fce-stage p { font-size: 12pt; }
  .fce-canvas { border: 0; margin: 0; padding: 0; height: 122mm; overflow: hidden !important; }
  .fce-canvas .question-visual { height: 100%; display: flex; flex-direction: column; }
  .fce-canvas svg { min-height: 0; height: 100%; max-height: 104mm; }
  .fce-canvas .model-number-sentence { font-size: 22pt !important; line-height: 1.2; }
  .fce-workspace .fce-canvas .model-number-sentence { visibility: visible !important; }
  .fce-tool { break-inside: avoid; }
  .fce-question p { font-size: 11pt; }
  .fce-answer-space { height: 12mm; }
}
@media (prefers-reduced-motion:reduce) { .fce-tool * { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
