/* HQ touch UI v3.4.1. Versioned to prevent stale /assets/stem-tools-v1.css from hiding new math controls. */
/* 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}
}
