.stem-shell{max-width:1180px;margin:0 auto}.stem-hero{display:grid;grid-template-columns:minmax(0,1fr) 330px;gap:28px;align-items:end;padding:38px 0 26px}.stem-hero h1{font-size:clamp(42px,5vw,66px);line-height:.98;letter-spacing:-.055em;color:#24105c;margin:18px 0 14px}.stem-hero p{font-size:18px;line-height:1.6;color:#5b687c;max-width:790px}.stem-hero-card{padding:23px;border:1px solid #dfe6f2;border-radius:22px;background:#fff;box-shadow:0 18px 48px rgba(15,23,42,.06)}.stem-hero-card strong{display:block;color:#31116d;font-size:18px}.stem-hero-card p{font-size:13px;margin:7px 0 0}.stem-layout{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:22px;align-items:start}.stem-card{background:#fff;border:1px solid #dfe6f2;border-radius:24px;box-shadow:0 18px 50px rgba(15,23,42,.055);padding:28px}.stem-card h2{font-size:29px;color:#2e1065;letter-spacing:-.035em;margin:0 0 8px}.stem-card h3{color:#31116d;margin:20px 0 10px}.stem-card>p,.stem-help{color:#657187;line-height:1.55}.stem-grid-2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.stem-grid-3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}.stem-field{display:grid;gap:7px;margin-top:15px}.stem-field label{font-size:12px;font-weight:900;color:#344054}.stem-field input,.stem-field select,.stem-field textarea{width:100%;border:1px solid #ccd6e5;border-radius:14px;background:#fff;padding:12px 13px;font:inherit;color:#172033;outline:none}.stem-field textarea{min-height:110px;resize:vertical;line-height:1.5}.stem-field input:focus,.stem-field select:focus,.stem-field textarea:focus{border-color:#7c3aed;box-shadow:0 0 0 3px rgba(124,58,237,.10)}.stem-options{display:flex;gap:9px;flex-wrap:wrap;margin-top:10px}.stem-check{display:flex;gap:8px;align-items:flex-start;padding:10px 12px;border:1px solid #e2e8f0;border-radius:13px;background:#fbfdff;font-size:12.5px;color:#475569;font-weight:750}.stem-check input{margin-top:2px;accent-color:#6d28d9}.stem-submit{width:100%;margin-top:20px;min-height:52px}.stem-status{display:none;margin-top:14px;padding:13px 15px;border-radius:14px;font-size:13.5px;font-weight:800;line-height:1.45}.stem-status.loading,.stem-status.success,.stem-status.error{display:block}.stem-status.loading{background:#eff6ff;border:1px solid #bfdbfe;color:#1e40af}.stem-status.success{background:#ecfdf5;border:1px solid #a7f3d0;color:#047857}.stem-status.error{background:#fff1f2;border:1px solid #fecdd3;color:#9f1239}.stem-side{position:sticky;top:98px}.stem-side .stem-card{padding:23px}.stem-side-list{display:grid;gap:10px;margin-top:14px}.stem-side-list div{padding:12px;border:1px solid #e5eaf2;border-radius:14px;background:#fbfdff}.stem-side-list strong{display:block;font-size:13px;color:#2e1065}.stem-side-list span{font-size:12px;color:#718096;line-height:1.4}.stem-results{display:none;margin-top:22px}.stem-results.show{display:block}.stem-result-grid{display:grid;gap:14px}.stem-file-card{padding:18px;border:1px solid #e1e8f2;border-radius:18px;background:#fbfdff}.stem-file-card strong{display:block;color:#2e1065;margin-bottom:12px}.stem-file-actions{display:flex;gap:9px;flex-wrap:wrap}.stem-output{padding:25px;border:1px solid #dfe6f2;border-radius:22px;background:#fff;box-shadow:0 16px 42px rgba(15,23,42,.05)}.stem-output h2{margin:0;color:#2e1065;font-size:30px}.stem-output h3{color:#31116d;margin:22px 0 8px;font-size:20px}.stem-output ul,.stem-output ol{padding-left:22px;color:#475569;line-height:1.65}.stem-output p{color:#4f5f74;line-height:1.65}.stem-kicker{font-size:11px;font-weight:950;text-transform:uppercase;letter-spacing:.1em;color:#6d28d9}.stem-toolbar{display:flex;gap:10px;flex-wrap:wrap;margin:16px 0}.stem-print-only{display:none}.stem-data-table{width:100%;border-collapse:collapse;margin:16px 0}.stem-data-table th,.stem-data-table td{border:1px solid #d9e1ec;padding:9px;text-align:left;font-size:13px}.stem-data-table th{background:#f6f2ff;color:#31116d}.stem-tabbar{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:18px}.stem-tab{border:1px solid #dce4f0;background:#fff;border-radius:999px;padding:9px 13px;font-weight:850;color:#526076;cursor:pointer}.stem-tab.active{background:#ede9fe;border-color:#c4b5fd;color:#4c1d95}.stem-panel{display:none}.stem-panel.active{display:block}.stem-stage{min-height:390px;border:1px solid #dbe3ee;border-radius:20px;background:linear-gradient(180deg,#fff,#f8fbff);padding:20px;overflow:hidden}.stem-stage svg{width:100%;height:auto;display:block}.stem-control-row{display:flex;gap:10px;flex-wrap:wrap;align-items:end;margin:14px 0}.stem-control-row .stem-field{margin-top:0;min-width:120px;flex:1}.fraction-row{display:grid;gap:8px;margin:16px 0}.fraction-bar{display:flex;height:62px;border:2px solid #334155;border-radius:10px;overflow:hidden;background:#fff}.fraction-piece{flex:1;border-right:1px solid #cbd5e1}.fraction-piece:last-child{border-right:0}.fraction-piece.filled{background:linear-gradient(135deg,#8b5cf6,#2563eb)}.counter-stage{display:flex;gap:10px;flex-wrap:wrap;min-height:220px;align-content:flex-start;padding:18px}.counter{width:48px;height:48px;border-radius:50%;display:grid;place-items:center;color:#fff;font-size:24px;font-weight:950;cursor:pointer;box-shadow:0 6px 16px rgba(15,23,42,.12)}.counter.pos{background:#2563eb}.counter.neg{background:#dc2626}.tile-stage{display:flex;gap:10px;flex-wrap:wrap;min-height:240px;align-content:flex-start}.algebra-tile{display:grid;place-items:center;border:2px solid #334155;font-weight:900;cursor:pointer}.algebra-tile.xpos{width:58px;height:150px;background:#bfdbfe}.algebra-tile.xneg{width:58px;height:150px;background:#fecaca}.algebra-tile.onepos{width:58px;height:58px;background:#dcfce7}.algebra-tile.oneneg{width:58px;height:58px;background:#fde68a}.chart-wrap{overflow:auto;border:1px solid #e1e8f2;border-radius:18px;background:#fff;padding:12px}.chart-wrap svg{min-width:620px;width:100%;height:430px}.analysis-prompts{display:grid;gap:9px;margin-top:16px}.analysis-prompts div{padding:12px 14px;border-left:4px solid #7c3aed;background:#faf8ff;border-radius:10px;color:#475569}.number-talk-card{padding:20px;border:1px solid #dfe6f2;border-radius:18px;background:#fbfdff;margin-top:12px}.number-talk-expression{font-size:clamp(34px,5vw,58px);font-weight:950;color:#1e293b;letter-spacing:-.04em;margin:8px 0 14px}.cer-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.cer-box{padding:16px;border-radius:16px;border:2px solid #dbe3ee;background:#fff}.cer-box.claim{border-color:#a78bfa}.cer-box.evidence{border-color:#60a5fa}.cer-box.reasoning{border-color:#34d399}.phenomenon-hook{font-size:clamp(23px,3vw,38px);line-height:1.2;font-weight:900;color:#17325c;padding:24px;border-radius:20px;background:linear-gradient(135deg,#eff6ff,#f5f3ff);border:1px solid #dbeafe}.tool-hub-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;margin-top:24px}.tool-hub-card{padding:25px;border:1px solid #e0e7f1;border-radius:22px;background:#fff;text-decoration:none;box-shadow:0 14px 38px rgba(15,23,42,.05)}.tool-hub-card:hover{transform:translateY(-2px);box-shadow:0 22px 48px rgba(15,23,42,.09)}.tool-hub-card .icon{font-size:32px}.tool-hub-card h3{margin:10px 0 8px;color:#2e1065;font-size:23px}.tool-hub-card p{margin:0;color:#627086;line-height:1.55}.stem-badge-row{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}.stem-badge-row span{font-size:11px;font-weight:850;padding:6px 9px;border-radius:999px;background:#f8fafc;border:1px solid #e2e8f0;color:#5c687c}
@media(max-width:900px){.stem-hero,.stem-layout,.tool-hub-grid,.cer-grid{grid-template-columns:1fr}.stem-side{position:static}.stem-grid-2,.stem-grid-3{grid-template-columns:1fr}.stem-hero{padding-top:24px}.stem-hero-card{max-width:620px}}
@media(max-width:620px){.stem-card{padding:21px}.stem-hero h1{font-size:41px}.stem-file-actions .btn{width:100%}.stem-stage{padding:12px}.fraction-bar{height:54px}}
@media print{.site-header,.site-footer,.stem-no-print,.stem-toolbar,.stem-submit,.stem-side{display:none!important}.wrap{padding:0!important;max-width:none!important}.stem-output,.stem-card{box-shadow:none!important;border:0!important}.stem-print-only{display:block}.stem-results{display:block!important}}

/* V9.2 mobile containment */
.stem-layout,.stem-card,.stem-side{min-width:0}
@media(max-width:1100px){.stem-layout{grid-template-columns:1fr}.stem-side{position:static}}
@media(max-width:620px){.chart-wrap{margin-left:0;margin-right:0}.chart-wrap svg{min-width:560px}.stem-data-table{font-size:16px}}


/* HQ v3.3 — touch-sized Math Manipulatives controls and earlier access. */
@media (max-width:900px){
 body:has(#fractions) .stem-shell{display:flex;flex-direction:column}
 body:has(#fractions) .stem-shell>.stem-hero{display:contents}
 body:has(#fractions) .stem-shell>.stem-hero>div:first-child{order:0;padding:12px 0 2px}
 body:has(#fractions) .stem-shell>.stem-hero>div:first-child h1{font-size:clamp(30px,4.7vw,45px);line-height:1.09;margin:7px 0}
 body:has(#fractions) .stem-shell>.stem-hero>div:first-child p{font-size:15px;line-height:1.45;margin:4px 0}
 body:has(#fractions) .stem-shell>.stem-card{order:1;margin-top:12px}
 body:has(#fractions) .stem-shell>.stem-hero>.stem-hero-card{order:2;margin-top:14px}
 body:has(#fractions) .stem-tab{min-height:44px;border-radius:13px;padding:9px 12px;font-size:14px;touch-action:manipulation}
 body:has(#fractions) .stem-toolbar .btn,
 body:has(#fractions) .stem-control-row .btn{min-height:44px;touch-action:manipulation}
 body:has(#fractions) .stem-field input, body:has(#fractions) .stem-field select{font-size:16px;min-height:44px}
 body:has(#fractions) .stem-stage{min-width:0}
 body:has(#fractions) .counter, body:has(#fractions) .algebra-tile{touch-action:manipulation}
}
@media (max-width:620px){
 body:has(#fractions) .stem-shell>.stem-hero>div:first-child{padding-top:6px}
 body:has(#fractions) .stem-shell>.stem-hero>div:first-child h1{font-size:32px}
 body:has(#fractions) .stem-shell>.stem-card{padding:14px}
 body:has(#fractions) .stem-tabbar{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}
 body:has(#fractions) .stem-tab{font-size:13px;line-height:1.2}
 body:has(#fractions) .stem-field{min-width:0}
 body:has(#fractions) .stem-control-row .stem-field{min-width:100px}
}


/* HQ v3.4: development preview — K–2 manipulatives and touch usability. */
body:has(#earlyCounting) .stem-tabbar{gap:8px}
body:has(#earlyCounting) .stem-tab{min-height:46px;touch-action:manipulation}
body:has(#earlyCounting) .hq-grade-label{font-size:10px;font-weight:850;color:#6d28d9;opacity:.82;margin-left:4px}
.hq-early-panel{--hq-early-ink:#1e3a8a}
.hq-early-panel .stem-help{font-size:15px}
.hq-early-controls,.hq-place-quick,.hq-place-actions{display:flex;gap:9px;flex-wrap:wrap;align-items:center;margin:14px 0}
.hq-early-controls button,.hq-place-quick button,.hq-place-actions button,.hq-chart-options button{border:1px solid #c7d2fe;background:#f5f3ff;color:#312e81;border-radius:13px;font-size:15px;font-weight:850;min-height:46px;min-width:48px;padding:9px 15px;cursor:pointer;touch-action:manipulation}
.hq-early-controls button.is-active{background:#4f46e5;color:white;border-color:#4f46e5}
.hq-early-controls button:disabled,.hq-place-actions button:disabled{opacity:.4;cursor:not-allowed}
.hq-early-controls .hq-quiet-action{color:#334155;background:#fff;border-color:#cbd5e1}
.hq-early-status{display:flex;gap:16px;align-items:center;color:#1e3a8a;padding:4px 0 10px}
.hq-early-status>span:first-child{font-size:clamp(46px,8vw,76px);line-height:1;font-weight:950;letter-spacing:-.05em}
.hq-early-count-caption{font-size:20px;font-weight:750}
.hq-ten-frame-stage{display:flex;gap:16px;align-items:flex-start;flex-wrap:wrap;background:#eff6ff;border-radius:20px;border:1px solid #bfdbfe;padding:16px;margin:8px 0 16px;min-height:122px}
.hq-five-ten-grid{display:grid;grid-template-columns:repeat(5,minmax(42px,62px));gap:6px;padding:8px;border-radius:14px;border:3px solid #1e40af;background:#fff;max-width:100%}
.hq-five-ten-grid.hq-five-grid{grid-template-rows:1fr}
.hq-count-cell{aspect-ratio:1;border:2px solid #c7d2fe;background:#f8fafc;border-radius:9px;display:grid;place-items:center;cursor:pointer;touch-action:manipulation;padding:5px;min-height:40px}
.hq-count-cell span{width:82%;aspect-ratio:1;border-radius:50%;background:transparent}
.hq-count-cell.filled span{background:#2563eb;box-shadow:inset 0 -4px 0 rgba(0,0,0,.13)}
.hq-count-cell:focus-visible,.hq-place-actions button:focus-visible,.hq-early-controls button:focus-visible,.hq-chart-options button:focus-visible{outline:3px solid #f59e0b;outline-offset:3px}
.hq-early-prompt{font-weight:800;font-size:18px;color:#1e40af;margin:10px 0}
.hq-place-number-row{display:flex;align-items:center;gap:12px;margin:14px 0;flex-wrap:wrap}
.hq-place-number-row label{font-size:18px;font-weight:850;color:#1e3a8a}
.hq-place-number-row input{min-height:50px;max-width:160px;min-width:100px;font-size:25px;font-weight:850;padding:8px 12px;border:2px solid #93c5fd;border-radius:12px;color:#172554}
.hq-place-columns{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.hq-place-column{background:#f8fbff;border:1px solid #cbd5e1;border-radius:15px;padding:11px;min-height:190px;min-width:0}
.hq-place-column h3{font-size:16px;margin:0 0 12px;color:#1e3a8a}
.hq-place-shapes{display:flex;gap:6px;flex-wrap:wrap;align-content:flex-start;align-items:flex-start}
.hq-place-shape.one{background:#fde68a;border:2px solid #d97706;border-radius:3px;width:22px;height:22px}
.hq-place-shape.ten{background:repeating-linear-gradient(0deg,#a7f3d0 0 5px,#059669 5px 6px);border:2px solid #047857;border-radius:3px;width:21px;height:80px}
.hq-place-shape.hundred{background:linear-gradient(90deg,transparent 90%,#2563eb 90%),linear-gradient(0deg,#bfdbfe 90%,#2563eb 90%);background-size:9px 9px;border:2px solid #1d4ed8;border-radius:3px;width:64px;height:64px}
.hq-no-blocks{color:#64748b;font-size:13px;font-weight:750}
.hq-place-equation{background:#dbeafe;border-left:5px solid #2563eb;color:#172554;border-radius:10px;padding:12px;font-weight:850;font-size:17px;line-height:1.4;margin:14px 0}
.hq-place-actions button{flex:1 0 70px}
.hq-line-presets button{min-width:100px}
.hq-coordinate-input{display:flex;gap:8px;align-items:end;flex-wrap:wrap;margin:10px 0 16px}
.hq-coordinate-input label{display:flex;flex-direction:column;gap:5px;font-weight:800;font-size:14px;color:#1e3a8a}
.hq-coordinate-input input{min-height:46px;font-size:16px;border:1px solid #94a3b8;border-radius:10px;padding:8px;width:85px}
body:has(#earlyCounting) .stem-stage svg{touch-action:manipulation}
.hq-graph-example{display:flex;align-items:center;flex-wrap:wrap;gap:12px;margin-top:16px}
.hq-graph-example .btn{min-height:46px;touch-action:manipulation}
.hq-graph-example span{font-size:13px;color:#475569}
.hq-chart-options{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:12px 0;font-size:14px;font-weight:850;color:#334155}
.hq-chart-options button{font-size:13px;min-height:44px;background:#eff6ff;border-color:#bfdbfe}
.chart-wrap.hq-chart-fit svg{min-width:0;width:100%;height:auto;display:block}
.chart-wrap.hq-chart-enlarged svg{min-width:760px;width:760px;height:auto}
@media(max-width:760px){
 .hq-place-columns{grid-template-columns:repeat(2,minmax(0,1fr))}
 .hq-place-column:first-child{grid-column:1/-1;min-height:100px}
 .hq-place-column{min-height:155px}
 .hq-five-ten-grid{grid-template-columns:repeat(5,minmax(0,1fr));width:min(100%,322px)}
 .hq-count-cell{min-height:44px}
}
@media(max-width:470px){
 body:has(#earlyCounting) .stem-tabbar{grid-template-columns:repeat(2,minmax(0,1fr))}
 .hq-ten-frame-stage{padding:9px;gap:9px}
 .hq-five-ten-grid{width:100%;padding:6px;gap:4px}
 .hq-place-columns{gap:7px}
 .hq-place-column{padding:8px}
 .hq-place-shape.hundred{width:47px;height:47px}
 .hq-place-shape.ten{height:67px}
 .hq-early-status>span:first-child{font-size:53px}
 .hq-early-count-caption{font-size:17px}
 .hq-coordinate-input input{width:66px}
 .hq-place-actions button{flex:1 0 64px;padding:7px 10px}
 .hq-chart-options{font-size:12px}
}
