/* Lambda Lab · Math Hub (uses the glass design tokens of chemistry.css and the lab layout of physics.css) */
/* ---------- home ---------- */
.mhero h1{margin:0;font-size:42px;letter-spacing:-.03em;background:linear-gradient(90deg,#0d9488,#4f46e5 50%,#db2777);-webkit-background-clip:text;background-clip:text;color:transparent}
.mhero p{margin:6px 0 0;color:var(--ink2);font-size:15.5px}
.mgrades{margin-top:14px;border-radius:var(--r-m);padding:12px 16px;display:flex;flex-wrap:wrap;align-items:center;gap:8px 14px}
.mgl{font-weight:800;font-size:14px;color:var(--ink2);white-space:nowrap}
.mgchips{display:flex;gap:6px;flex-wrap:wrap}.mgchips .chip{min-width:38px;justify-content:center;cursor:pointer;font-weight:750}
.mgnote{flex-basis:100%;margin:0;font-size:12px;color:var(--ink3);line-height:1.5}
.mrh{flex-basis:100%;font-size:13.5px;color:var(--ink2)}
.mstrands{display:flex;flex-wrap:wrap;column-gap:16px}
.mstrand{margin-top:26px;width:100%}
@media (min-width:1181px){.mstrand{--c:calc((100% - 64px)/5);width:calc(var(--n)*var(--c) + (var(--n) - 1)*16px)}.mstrand .pcards{grid-template-columns:repeat(var(--n),minmax(0,1fr))}}
.mstrand h2{display:flex;align-items:baseline;gap:12px;margin:0 4px;font-size:22px;letter-spacing:-.02em}
.mstrand h2 small{font-size:12.5px;font-weight:700;color:var(--ink3)}
.mstrand .pcards{margin-top:12px}
.mcard p{min-height:34px}
.mcrow{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:10px}.mcrow .popen{margin-top:0}
.mcard.mdim{opacity:.4;filter:saturate(.35)}.mcard.mdim:hover{opacity:.75}
.pcard.soon .pcount{background:rgba(148,163,184,.2);padding:2px 8px;border-radius:99px}
/* grade badge */
.mgb{display:inline-flex;align-items:center;gap:3px;padding:2px 8px;border-radius:999px;font-size:11.5px;font-weight:800;color:#0f766e;background:rgba(20,184,166,.14);border:1px solid rgba(20,184,166,.28);white-space:nowrap;line-height:1.5}
.mgb i{font-style:normal;font-size:11px}
:root[data-theme="dark"] .mgb{color:#5eead4;background:rgba(45,212,191,.14);border-color:rgba(45,212,191,.3)}
.elist button .mgb{justify-self:start;margin-top:3px;display:inline-flex}.elist button .mgb i{width:auto;height:auto;background:none;border-radius:0;display:inline;font-size:11px}.elist button .mgb span{display:inline}.elist button.on .mgb{color:#fff;background:rgba(255,255,255,.2);border-color:rgba(255,255,255,.35)}
.elist button.qout{opacity:.55}
.pres .chip .mgb{margin-inline-start:2px}
/* strands menu */
.mcaret{font-style:normal;font-size:10px;opacity:.6;margin-inline-start:2px}
.mnav-pop{position:absolute;z-index:70;border-radius:20px;padding:8px;display:grid;gap:4px}
.mnav-pop[hidden]{display:none}
.mnav-pop button{display:grid;grid-template-columns:1fr auto;grid-template-rows:auto auto;gap:2px 8px;align-items:center;text-align:start;border:0;background:transparent;border-radius:14px;padding:9px 12px;color:var(--ink);font:inherit;cursor:pointer}
.mnav-pop button:hover,.mnav-pop button:focus-visible{background:var(--glass2);outline:none;box-shadow:var(--shadow-s)}
.mnav-pop .mni-t{font-weight:750;font-size:14px}.mnav-pop small{grid-column:1;font-size:12px;color:var(--ink3)}.mnav-pop .mgb{grid-row:1/3;grid-column:2}
.mnav-pop button.soon .mni-t{color:var(--ink2)}.mnav-pop button.mdim{opacity:.5}
/* ---------- labs ---------- */
.qlab .ebench{aspect-ratio:5/3}
.qstage{--gridc:rgba(100,116,139,.14);background:linear-gradient(180deg,#f8fafc,#e8eef7)!important}
:root[data-theme="dark"] .qstage{background:linear-gradient(180deg,#eef2f8,#dde5f0)!important;box-shadow:inset 0 0 0 1px rgba(255,255,255,.08)}
.qstage svg{cursor:default;outline:none}
/* keyboard: a ring shows when the picture or the search box has the focus */
.qstage svg:focus-visible{outline:3px solid var(--accent);outline-offset:-3px}
.psearch:focus-within{box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 55%,transparent)}
#qSvg,.pcard svg,.qidea [dir=ltr],.qpv{direction:ltr}
.qhit{cursor:pointer}.qhit:focus{outline:none}.qhit:focus-visible{outline:3px solid #6366f1;outline-offset:3px;border-radius:8px}
.qdrag:focus{outline:none}.qdrag:focus-visible{outline:3px solid #6366f1;outline-offset:4px}
#qSvg text{user-select:none;-webkit-user-select:none;pointer-events:none}
.qidea{padding:12px 14px;border-radius:16px;background:var(--glass2);border:1px solid var(--glass-brd);font-size:13.5px;line-height:1.55;color:var(--ink2)}
.qidea p{margin:0 0 8px}.qidea p:last-child{margin-bottom:0}
.qbig{font-size:24px!important;font-weight:850;color:var(--ink)!important;letter-spacing:.01em}
.qsmall{font-size:12.5px;color:var(--ink3)}
.qbonds{display:flex;flex-wrap:wrap;gap:5px}.qbond{padding:3px 8px;border-radius:999px;font-size:12px;font-weight:750;background:rgba(148,163,184,.16);color:var(--ink3)}
.qbond.on{background:linear-gradient(135deg,#ef4444,#eab308);color:#fff}
.qb10k{display:flex;flex-wrap:wrap;gap:5px}.qb10k span{padding:3px 9px;border-radius:10px;font-size:12px;font-weight:750}
.qpv{border-collapse:separate;border-spacing:3px;font-size:13px;margin-top:4px}.qpv th,.qpv td{padding:4px 8px;border-radius:8px;text-align:center}.qpv th{font-size:11px;color:var(--ink3);font-weight:750}
.qpv td{background:rgba(148,163,184,.14);font-weight:800;font-size:16px;color:var(--ink)}.qpv .on{background:#fde68a;color:#92400e}.qpv th.on{background:transparent;color:#b45309}
#qCtl .qnum{width:92px;flex:none;text-align:center;border-radius:12px;border:1px solid var(--glass-brd);background:var(--glass2);color:var(--ink);font:inherit;font-size:17px;font-weight:800;padding:6px 8px;-moz-appearance:textfield}
#qCtl .qnum::-webkit-inner-spin-button,#qCtl .qnum::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.qnumc{min-width:150px;flex:0 1 auto}
#qAns{flex:1;min-width:0;border-radius:12px;border:0;padding:9px 12px;font:inherit;font-size:16px}
.estep .row .btn{flex:none}
@media (max-width:760px){.mhero h1{font-size:32px}.mgrades{padding:10px 12px}.mgchips{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;padding-bottom:2px;max-width:100%}.mgchips::-webkit-scrollbar{display:none}.mstrand h2{font-size:19px}}
@media (prefers-reduced-motion:reduce){.qhit{transition:none}}
/* ---------- “Your turn” bar, typed values and undo (labs from Phase 4 on) ---------- */
.qquest{margin:12px 0 2px;padding:12px 14px;border-radius:20px;background:linear-gradient(135deg,rgba(99,102,241,.10),rgba(236,72,153,.08));border:1px solid rgba(99,102,241,.22)}
.qquest[hidden]{display:none}
.qqh{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px}.qqt{font-size:15.5px;letter-spacing:-.01em}.qqs{font-size:13px;color:var(--ink2);flex:1 1 200px}
.qqlv{flex:none}.qqlv button{padding:5px 11px;font-size:13px}.qqsc{font-size:12.5px;font-weight:800;color:var(--ink3);white-space:nowrap}.qqh [data-qnew]{margin-inline-start:auto}
.qqq{margin:10px 2px 8px;font-size:17px;font-weight:800;line-height:1.45;color:var(--ink)}
.qqa{display:flex;flex-wrap:wrap;gap:8px;align-items:center}.qqa .btn{flex:none}.qqb{font-size:13px;color:var(--ink2);flex:1 1 220px}
#qQa{flex:1 1 140px;min-width:0;max-width:260px;border-radius:12px;border:1px solid var(--glass-brd);background:var(--glass2);color:var(--ink);padding:9px 12px;font:inherit;font-size:17px;font-weight:800}
.qqhint{margin:8px 2px 0;font-size:13.5px;color:#92400e;background:rgba(253,230,138,.45);border-radius:12px;padding:7px 10px}
.qqfb{margin:8px 2px 0;font-size:14px;font-weight:750;border-radius:12px;padding:7px 10px;background:rgba(148,163,184,.14)}.qqfb.ok{color:#166534;background:rgba(134,239,172,.35)}.qqfb.bad{color:#9a3412;background:rgba(253,186,116,.3)}
:root[data-theme="dark"] .qqhint{color:#fde68a;background:rgba(146,64,14,.35)}:root[data-theme="dark"] .qqfb.ok{color:#bbf7d0;background:rgba(22,101,52,.4)}:root[data-theme="dark"] .qqfb.bad{color:#fed7aa;background:rgba(154,52,18,.35)}
#qCtl .qtext{flex:1;min-width:0;border-radius:12px;border:1px solid var(--glass-brd);background:var(--glass2);color:var(--ink);font:inherit;font-size:17px;font-weight:800;padding:6px 10px}
.qtextc{flex:1 1 280px}.qtextc .btn{flex:none;padding:7px 12px}#qCtl .qneg{font-size:14px}
@media (max-width:760px){.qquest{padding:10px}.qqq{font-size:16px}.qqh [data-qnew]{margin-inline-start:0}}


/* On/Off switch (one button, the knob slides; mirrored for Arabic) */
.qswc{align-content:start}
#qCtl .qsw{display:inline-flex;align-items:center;gap:10px;justify-self:start;padding:4px 14px 4px 4px;border:1px solid rgba(15,23,42,.08);border-radius:999px;background:rgba(120,130,160,.12);color:var(--ink2);font:inherit;font-size:13px;font-weight:800;cursor:pointer;min-height:36px;-webkit-tap-highlight-color:transparent}
[dir="rtl"] #qCtl .qsw{padding:4px 4px 4px 14px}
#qCtl .qsw:focus-visible{outline:3px solid var(--accent);outline-offset:2px}
.qsw-t{position:relative;flex:none;width:48px;height:28px;border-radius:999px;background:#cbd5e1;box-shadow:inset 0 1px 3px rgba(15,23,42,.28);transition:background-color .2s}
.qsw-k{position:absolute;top:3px;left:3px;width:22px;height:22px;border-radius:50%;background:linear-gradient(180deg,#fff,#eef2f7);box-shadow:0 2px 4px rgba(15,23,42,.3),0 0 0 .5px rgba(15,23,42,.12);transition:transform .2s cubic-bezier(.3,1.4,.5,1)}
[dir="rtl"] .qsw-k{left:auto;right:3px}
.qsw[aria-checked="true"] .qsw-t{background-color:var(--accent,#4f46e5)}
.qsw[aria-checked="true"] .qsw-k{transform:translateX(20px)}
[dir="rtl"] .qsw[aria-checked="true"] .qsw-k{transform:translateX(-20px)}
.qsw[aria-checked="true"] .qsw-l{color:var(--ink)}
.qsw-l{min-width:3.2em;text-align:start}
.qsw.anim .qsw-k{animation:qswOn .22s cubic-bezier(.3,1.4,.5,1)}.qsw.anim[aria-checked="true"] .qsw-k{animation-name:qswOnR}
[dir="rtl"] .qsw.anim .qsw-k{animation-name:qswOffL}[dir="rtl"] .qsw.anim[aria-checked="true"] .qsw-k{animation-name:qswOnL}
.qsw.anim .qsw-t{animation:qswBg .22s}
@keyframes qswOn{from{transform:translateX(20px)}}@keyframes qswOnR{from{transform:translateX(0)}}
@keyframes qswOffL{from{transform:translateX(-20px)}}@keyframes qswOnL{from{transform:translateX(0)}}
@keyframes qswBg{from{filter:saturate(.3)}}
:root[data-theme="dark"] #qCtl .qsw{border-color:rgba(255,255,255,.08)}:root[data-theme="dark"] .qsw-t{background:#475569}:root[data-theme="dark"] .qsw[aria-checked="true"] .qsw-t{background-color:var(--accent,#6366f1)}
@media (prefers-reduced-motion:reduce){.qsw-k,.qsw.anim .qsw-k,.qsw.anim .qsw-t{transition:none;animation:none}}
/* examples in control labels keep their letters as typed (3n + 1, not 3N + 1) */
.qlab .mcl .mcx{text-transform:none;letter-spacing:0;font-weight:700}

/* ⛶ Full screen: a small button in the corner of the middle column of every lab, game and tool. The column then fills the
   screen (the browser's full-screen mode, or covering the page on iPhone); the picture grows as far as the screen allows while
   the “Your turn” bar stays in view, and the rest scrolls. */
.qfs{position:absolute;top:8px;right:8px;z-index:4;width:34px;height:34px;padding:0;border-radius:10px;border:1px solid rgba(100,116,139,.35);background:rgba(255,255,255,.88);color:#1e293b;display:grid;place-items:center;cursor:pointer;box-shadow:0 2px 8px rgba(15,23,42,.14);-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);opacity:.9;transition:opacity .15s,transform .15s}
.qfs:hover{opacity:1;transform:scale(1.06)}.qfs:focus{outline:none}.qfs:focus-visible{outline:3px solid #6366f1;outline-offset:2px}
.pxmain{position:relative}.pxmain>.qfs{top:22px;right:auto;inset-inline-end:22px}
/* in the tools the button takes a free spot of the first row, without changing its height */
.pxh{display:flex;align-items:center;justify-content:space-between;gap:8px}.pxfs{display:inline-flex;flex:none}.pxfs>.qfs{position:static;width:30px;height:30px;margin-block:-9px;border-radius:9px}
.pxscore{position:relative}.pxscore>.pxfs{position:absolute;top:0;inset-inline-end:0}.pxscore>.pxfs>.qfs{margin:0}.pxcd{position:relative}.pxcd>.pxfs{position:absolute;top:8px;right:8px}.pxcd>.pxfs>.qfs{margin:0;background:rgba(255,255,255,.14);color:#e2e8f0;border-color:rgba(255,255,255,.25)}.pxcalc .pxcd input{padding-right:40px}
.ecenter.qfs-on{display:block;background:var(--bg);overflow:auto;border-radius:0;box-sizing:border-box;width:100vw;height:100vh;max-width:none;margin:0;padding:12px}
.ecenter.mfull{position:fixed;inset:0;z-index:2000;height:100dvh}
html.mfull-page,html.mfull-page body{overflow:hidden}
.qfs-on .qstage{width:min(100%,calc((100vh - 110px) * 5 / 3));margin-inline:auto}
.qfs-on .qstage.qnarrow{width:min(100%,calc((100vh - 110px) * 600 / 804))}
.qfs-on .pxbar{top:0}
.qfs-on #plSvg,.qfs-on #gkSvg{max-width:calc((100vh - 250px) * 1.6);margin-inline:auto}
/* full screen with no scrolling: in a lab or a game the squared picture takes all the room the controls leave (the drawing stays
   whole in its middle); the graph plotter's board is sized so that it fits under its settings */
.elab.mlab:not(.pxlab)>.ecenter.qfs-on{display:flex;flex-direction:column}
.elab.mlab:not(.pxlab)>.ecenter.qfs-on>.qstage{flex:1 1 0;min-height:45vh;width:100%;aspect-ratio:auto!important;margin:0}
.elab.mlab:not(.pxlab)>.ecenter.qfs-on>:not(.qstage){flex:none}
/* on a phone, where the controls can be taller than the room left, the picture keeps a fair size and the controls scroll in their own box */
.elab.mlab:not(.pxlab)>.ecenter.qfs-on>#qCtl{flex:0 1 auto;min-height:0;overflow:auto}
.qfs-on #plSvg{max-width:calc((100vh - 350px) * 5 / 3)}
@media print{.qfs{display:none!important}}
/* the middle column of a lab reaches the bottom of the window, like the list of labs beside it (computers and landscape
   tablets): the squared picture grows taller to fill it, the drawing stays in its middle, and the controls stay right under it */
@media (min-width:901px){.elab.mlab:not(.pxlab)>.ecenter:not(.qfs-on){min-height:calc(100vh - 100px);grid-template-rows:1fr auto auto}
 .elab.mlab:not(.pxlab)>.ecenter:not(.qfs-on)>.qstage{min-height:100%;min-width:0;width:100%}}
/* ---------- Phase 24 · the Math games in the Physics Hub games design (the .games classes of chemistry.css) ---------- */
.mgames .gcard>.mgb{position:absolute;top:18px;inset-inline-end:16px;z-index:1}
.mgames .gcard.gout{opacity:.62}.mgames .gcard.gout:hover,.mgames .gcard.gout:focus-visible{opacity:1}
.mgplay .gbody{padding:12px;min-height:0}
.mgplay .qstage{width:min(100%,calc((100vh - 240px) * 5 / 3));margin-inline:auto}
.mgplay .qstage.qnarrow{width:100%}
.mgplay .gstat b{white-space:nowrap}
.mgres .mgrule{font-size:13px;color:var(--ink3)}
.mgplay.qfs-on{max-width:none;width:100vw;height:100vh;margin:0;padding:12px;box-sizing:border-box;background:var(--bg);overflow:auto;display:flex;flex-direction:column;gap:14px}
.mgplay.mfull{position:fixed;inset:0;z-index:2000;height:100dvh}
.mgplay.qfs-on>.gbody{flex:1 1 auto;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px}
.mgctl{padding:10px 4px 2px}.mgplay.qfs-on .mgctl{width:100%;flex:none}
.mgctl .qnum{width:92px;flex:none;text-align:center;border-radius:12px;border:1px solid var(--glass-brd);background:var(--glass2);color:var(--ink);font:inherit;font-size:17px;font-weight:800;padding:6px 8px;-moz-appearance:textfield}
.mgplay.qfs-on .qstage{width:min(100%,calc((100vh - 150px) * 5 / 3))}
.mgplay.qfs-on .qstage.qnarrow{width:min(100%,calc((100vh - 150px) * 600 / 804))}
/* Phase 24 · the 📝 Exam mode button in the title of the worksheet generator (the Physics Hub button) */
.pxh:has(.pxhr){flex-wrap:wrap;row-gap:8px}.pxhr{display:inline-flex;align-items:center;gap:10px;margin-inline-start:auto}.pxexam{font-size:14px;padding:8px 16px;white-space:nowrap}
.mgctl .mcl .mcx{text-transform:none;letter-spacing:0;font-weight:700;font-size:14px}
.mgctl .mc{min-width:0;flex:1 1 130px}
/* ---------- the grade card in the right-hand column (it replaced the 🎓 badges in the list of labs) ---------- */
.mgr{display:grid;gap:9px;padding:12px 14px;border-radius:16px;background:var(--glass2);border:1px solid var(--glass-brd);box-shadow:var(--shadow-s)}
.mgr-h{display:flex;align-items:center;gap:10px}.mgr-h b{font-size:17px;font-weight:800;color:#0f766e}
.mgr-i{flex:none;width:32px;height:32px;border-radius:11px;display:grid;place-items:center;font-size:17px;background:linear-gradient(135deg,#5eead4,#38bdf8);box-shadow:0 4px 12px rgba(20,184,166,.28),inset 0 1px 0 rgba(255,255,255,.6)}
.mgr-s{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:3px}
.mgr-s span{height:24px;border-radius:7px;display:grid;place-items:center;font-size:11px;font-weight:800;color:var(--ink3);background:rgba(148,163,184,.16)}
.mgr-s span.on{color:#fff;background:linear-gradient(180deg,#2dd4bf,#0d9488);box-shadow:0 2px 6px rgba(13,148,136,.3),inset 0 1px 0 rgba(255,255,255,.35)}
.mgr-s span.me{outline:2px solid var(--accent);outline-offset:1px}
.mgr-n{margin:0;font-size:12.5px;font-weight:750;line-height:1.45;color:#0f766e}.mgr-n.out{color:#b45309}
.mgr-pick a{color:var(--accent);font-weight:650;text-decoration:none}.mgr-pick a:hover{text-decoration:underline}
.mgr-f{margin:0;font-size:11px;line-height:1.4;color:var(--ink3)}
:root[data-theme="dark"] .mgr-h b,:root[data-theme="dark"] .mgr-n{color:#5eead4}:root[data-theme="dark"] .mgr-n.out{color:#fbbf24}:root[data-theme="dark"] .mgr-s span:not(.on){background:rgba(148,163,184,.12)}
/* Phase 25 · a typed-expression box and its Apply button always fit the width of the controls (tablets overflowed by 2 px) */
.qtextc{grid-template-columns:minmax(0,1fr)}
