:root{--navy:#1f2747;--muted:#737c96;--line:#e5eaf4;--paper:#fff;--bg:#f4f7fd;--accent:#6657da;--tint:#eeebff;--good:#149c78;--bad:#d45e65;--shadow:0 18px 50px rgba(46,62,109,.09);font-family:ui-rounded,"Aptos","Segoe UI",system-ui,-apple-system,sans-serif;color:var(--navy);font-synthesis:none}
*{box-sizing:border-box}html,body{width:100%;height:100%;margin:0}body{background:var(--bg);overflow:hidden}button,input{font:inherit}button{cursor:pointer;-webkit-tap-highlight-color:transparent}button:disabled{opacity:.42;cursor:not-allowed}button:focus-visible,input:focus-visible{outline:3px solid #7565e8;outline-offset:3px}svg{display:block}#app{height:100%;height:100dvh;min-height:460px}.startup{padding:3rem;font-weight:700;color:#6657da}.app-shell{height:100%;display:flex;flex-direction:column;overflow:hidden;background:radial-gradient(ellipse at 92% 5%,#dfe8ff 0%,transparent 33%),radial-gradient(ellipse at 8% 100%,#d9fff2 0%,transparent 29%),#f5f7fd}.topbar{height:64px;min-height:64px;padding:0 clamp(16px,3vw,46px);display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid #e8ecf5ac;gap:12px;z-index:5}.brand-wrap,.top-actions,.brand,.eyebrow,.nav-back,.nav-title,.levels-actions,.chip,.btn,.action-group,.level-head,.status-title,.progress-row,.stage-tools,.palette-item,.molecule-panel-title,.equation-row,.page-head,.status-symbol,.outcome-stats,.btn-group{display:flex;align-items:center}.brand-wrap{gap:12px}.brand{gap:10px;font-size:20px;letter-spacing:-.8px;font-weight:850;color:#25305c;white-space:nowrap}.brand-mark{height:32px;width:32px;display:grid;place-items:center;border-radius:11px;background:linear-gradient(145deg,#7566eb,#4d53d8);box-shadow:0 6px 14px #7566eb42}.brand-mark svg{height:22px;width:22px}.brand span small{font-size:.55em;letter-spacing:2px;font-weight:850;color:#8a92ac;margin-left:7px}.top-actions{gap:8px}.icon-button{width:38px;height:38px;display:grid;place-items:center;border:1px solid #e4e9f3;border-radius:12px;background:#ffffffbc;color:#737c96;transition:background .16s,transform .16s}.icon-button:hover{background:white;transform:translateY(-1px)}.icon-button svg,.btn svg,.nav-back svg,.palette-add svg{width:18px;height:18px}.header-tag{font-size:11px;font-weight:900;letter-spacing:1.3px;color:#7c85a0;border:1px solid #e1e8f4;border-radius:30px;padding:9px 12px;background:#ffffffbd}.home{width:min(1210px,calc(100% - 48px));flex:1;min-height:0;margin:auto;display:flex;flex-direction:column;justify-content:center;gap:clamp(14px,2.2vh,26px);padding:14px 0 24px}.hero{display:flex;justify-content:space-between;align-items:center;min-height:160px;gap:20px}.hero h1{font-size:clamp(29px,4.15vw,58px);letter-spacing:-2.5px;line-height:1.05;margin:8px 0 10px}.hero h1 em{font-style:normal;color:#7060e1}.hero p{margin:0;font-size:clamp(13px,1.35vw,18px);color:#737e99;max-width:620px;line-height:1.4}.overline{display:inline-flex;gap:7px;align-items:center;font-size:10px;letter-spacing:2px;font-weight:900;color:#8b83ce;text-transform:uppercase}.hero-art{width:255px;height:160px;flex:none;position:relative}.hero-art:before,.hero-art:after{content:"";position:absolute;inset:18px;border:2px solid #c4bef5;border-radius:50%;transform:rotate(-29deg)}.hero-art:after{transform:rotate(54deg)}.atom-ball{position:absolute;z-index:1;border-radius:50%;box-shadow:inset -7px -7px 12px #0002,inset 5px 5px 8px #fff8,0 9px 20px #36416d28}.hero-art .a{height:74px;width:74px;left:100px;top:43px;background:#7668ec}.hero-art .b{height:28px;width:28px;left:26px;top:82px;background:#ef6b79}.hero-art .c{height:36px;width:36px;right:20px;top:30px;background:#49c5bb}.hero-art .d{height:21px;width:21px;right:44px;bottom:5px;background:#ffc477}.section-header{display:flex;justify-content:space-between;align-items:baseline}.section-header h2{font-size:15px;margin:0;font-weight:900;letter-spacing:-.2px}.section-header span{font-size:12px;color:#8b94aa;font-weight:650}.level-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:14px}.level-card{--card:#7166e6;--soft:#eeedff;appearance:none;min-width:0;min-height:228px;display:flex;flex-direction:column;align-items:flex-start;text-align:left;gap:14px;padding:22px 19px;border:1px solid #e9eaf4;border-radius:22px;background:#fff;box-shadow:0 7px 25px #52639b0d;position:relative;overflow:hidden;transition:transform .17s,box-shadow .17s,border .17s}.level-card:hover{transform:translateY(-4px);box-shadow:0 18px 38px #53619e24;border-color:var(--card)}.level-card:before{content:"";position:absolute;right:-36px;top:-55px;width:120px;height:120px;background:var(--soft);border-radius:50%}.level-card .level-number{width:45px;height:45px;display:grid;place-items:center;font-size:24px;font-weight:850;background:var(--soft);color:var(--card);border-radius:15px;position:relative}.level-card strong{font-size:clamp(14px,1.6vw,19px);letter-spacing:-.45px;line-height:1.2;max-width:175px;z-index:1}.level-card .card-description{font-size:12px;line-height:1.38;color:#7f87a1;min-height:33px}.level-card .level-bottom{display:flex;width:100%;justify-content:space-between;align-items:center;gap:4px;margin-top:auto;color:var(--card);font-size:12px;font-weight:850}.level-bottom .arrow{height:30px;width:30px;background:var(--soft);display:grid;place-items:center;border-radius:10px}.level-progress{margin-top:1px;height:4px;width:100%;background:#eef1f8;border-radius:5px;overflow:hidden}.level-progress>i{display:block;height:100%;background:var(--card);border-radius:5px}.home-bottom{display:flex;justify-content:space-between;align-items:center;color:#919bb1;font-size:12px;gap:10px}.home-bottom strong{color:#62708c}.home-bottom button{border:0;background:transparent;color:#6959c6;font-weight:800}.tiny-dot{display:inline-block;width:7px;height:7px;background:#4db99f;border-radius:50%;margin-right:6px}.game-wrap{flex:1;min-height:0;display:flex;flex-direction:column;width:min(1370px,calc(100% - clamp(22px,5vw,72px)));margin:0 auto;gap:11px;padding:10px 0 13px}.stage-head{display:flex;justify-content:space-between;align-items:center;gap:18px;min-height:40px}.nav-back{gap:7px;border:0;background:transparent;padding:3px;color:#69748f;font-size:13px;font-weight:750}.nav-back:hover{color:var(--accent)}.nav-title{gap:12px;min-width:0}.level-pill{padding:7px 10px;border-radius:10px;background:var(--tint);color:var(--accent);font-weight:900;font-size:11px;letter-spacing:.5px;white-space:nowrap}.level-name{font-weight:900;font-size:14px;color:#354066;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.stage-tools{gap:11px}.question-count{font-size:12px;color:#7b85a1;font-weight:800;white-space:nowrap}.pip-strip{display:flex;gap:4px;align-items:center}.pip{height:8px;width:clamp(7px,1.1vw,15px);border-radius:8px;background:#dce2ed;border:0;padding:0;transition:background .15s,transform .15s}.pip.is-done{background:var(--accent)}.pip.is-current{background:var(--accent);transform:scaleY(1.6)}.pip:focus-visible{outline:2px solid #6657da;outline-offset:3px}.stage{flex:1;min-height:0;display:grid;grid-template-rows:auto minmax(0,1fr) auto;gap:10px}.prompt-card{background:#fff;border:1px solid #e9edf6;border-radius:22px;box-shadow:0 8px 33px #4e5e9520;min-height:110px;padding:17px clamp(14px,2.2vw,30px);display:flex;flex-direction:column;justify-content:center;gap:10px}.page-head{justify-content:space-between;gap:10px}.prompt-text{font-size:12px;letter-spacing:.2px;color:#8690a6;font-weight:750}.reaction-tag{font-size:10px;letter-spacing:.2px;font-weight:850;color:var(--accent);background:var(--tint);padding:7px 10px;border-radius:9px;white-space:nowrap}.equation-row{justify-content:center;flex-wrap:nowrap;gap:clamp(6px,1vw,15px);min-width:0}.equation-group{display:flex;align-items:center;justify-content:center;gap:clamp(6px,1vw,15px);min-width:0}.formula-term{display:inline-flex;align-items:center;gap:5px;font-size:clamp(20px,2.9vw,35px);font-weight:800;letter-spacing:-.6px;white-space:nowrap}.formula-term .coefficient-static{color:var(--accent)}.formula-term .coefficient-unknown{font-size:.75em;color:#9b97c5}.formula{font-variant-numeric:lining-nums;letter-spacing:-.4px}.equation-sep{font-size:clamp(18px,2.4vw,28px);font-weight:600;color:#a1acc1}.equation-sep.arrow{color:#7767db;font-size:clamp(22px,2.8vw,37px);margin-inline:clamp(4px,1.3vw,20px)}.coefficient-input{width:clamp(40px,4.8vw,62px);height:clamp(42px,5.1vw,58px);min-width:0;border:2px solid #dcdff1;border-radius:13px;background:#f8f9ff;text-align:center;font-size:clamp(19px,2.2vw,27px);font-weight:900;color:#5c50bc;padding:3px}.coefficient-input:focus{background:white;border-color:#8573eb;outline:3px solid #8573eb33}.coefficient-input.is-error{border-color:#e57880;background:#fff7f7}.work-area{min-height:0;background:#fff;border:1px solid #e9edf6;border-radius:22px;box-shadow:0 8px 33px #4e5e9517;padding:clamp(10px,1.8vh,18px);position:relative;overflow:hidden}.work-area .area-inner{height:100%;min-height:0;display:flex;flex-direction:column;gap:12px}.panel-heading{font-size:12px;font-weight:850;letter-spacing:.4px;color:#8c95ad;text-transform:uppercase}.level1-layout{height:100%;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,.9fr);gap:13px}.decision{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;background:linear-gradient(145deg,#f6f4ff,#f7faff);border-radius:17px;padding:20px}.decision h2{font-size:clamp(20px,2.45vw,32px);margin:0;letter-spacing:-.8px}.decision p{font-size:12px;color:#7e89a1;text-align:center;margin:-5px 0 0}.decision-buttons{display:grid;grid-template-columns:1fr 1fr;gap:12px;width:min(450px,100%)}.choice{border:2px solid #e1e5f0;background:#fff;border-radius:16px;min-height:85px;padding:14px 12px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;color:#444d6e;font-weight:900;font-size:16px;transition:transform .18s,background .18s,border-color .18s}.choice:hover{transform:translateY(-3px);border-color:#a7a0e9}.choice.is-selected{border-color:var(--accent);background:var(--tint);color:var(--accent)}.choice svg{height:26px;width:26px}.preview-panel{background:#f9fbff;border:1px dashed #e1e5f2;border-radius:18px;min-height:0;overflow:hidden;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:10px;gap:7px}.preview-panel .big-icon{color:#b5addf}.preview-panel h3{font-size:18px;margin:0}.preview-panel p{font-size:12px;max-width:220px;line-height:1.4;text-align:center;color:#919bb1;margin:0}.particles-stack{flex:1;min-height:0;display:grid;grid-template-columns:1fr 1fr;gap:11px}.particle-side{background:#f8faff;border:1px solid #eff1fa;border-radius:17px;display:flex;flex-direction:column;min-width:0;min-height:0;overflow:hidden}.molecule-panel-title{justify-content:space-between;padding:11px 12px 6px;gap:8px}.molecule-panel-title strong{font-size:12px;color:#647089}.molecule-panel-title .meta{font-size:10px;color:#9aa3b8;white-space:nowrap}.molecule-grid{display:flex;flex:1;align-content:center;align-items:center;justify-content:center;gap:8px;flex-wrap:wrap;min-height:0;overflow:hidden;padding:5px}.molecule-set{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:3px 6px;max-width:100%;background:#fff;border:1px solid #edf0f9;border-radius:13px;padding:5px 8px;min-width:68px}.molecule-set-label{width:100%;text-align:center;font-size:11px;color:#65718f;font-weight:800;white-space:nowrap}.molecule-svg{width:clamp(48px,5vw,78px);height:clamp(43px,6vh,67px);flex:none;filter:drop-shadow(0 3px 2px #2b39681a);max-width:100%}.molecule-svg.is-compact{width:clamp(43px,4.3vw,66px);height:clamp(35px,5.5vh,55px)}.atom-count-row{display:flex;flex-wrap:wrap;gap:5px;padding:8px 10px;border-top:1px solid #e9eef9;justify-content:center;align-items:center;min-height:40px}.atom-counter{border-radius:7px;font-size:10px;padding:4px 6px;white-space:nowrap;background:#e7f3ef;color:#138c70;font-weight:800}.atom-counter.bad{background:#fff0f0;color:#cb6570}.atom-counter.muted{background:#ebedf6;color:#7f8ba1}.l2-layout{display:grid;grid-template-columns:minmax(170px,210px) minmax(0,1fr);gap:12px;height:100%;min-height:0}.palette{display:flex;flex-direction:column;gap:7px;overflow:hidden;min-height:0;background:#f5f6ff;border-radius:15px;padding:12px}.palette-grid{display:flex;flex:1;min-height:0;flex-direction:column;gap:6px;justify-content:space-evenly}.palette-item{border:1px solid #dfe3f4;background:#fff;border-radius:12px;padding:6px 10px;justify-content:space-between;gap:4px;color:#536080;min-height:0;flex:1;cursor:grab}.palette-item:active{cursor:grabbing}.palette-item:hover{border-color:#998aea;box-shadow:0 4px 16px #a49bdd35}.palette-item strong{font-size:13px}.palette-item .molecule-svg{width:58px;height:39px}.palette-item svg{pointer-events:none}.palette-add{display:grid;place-items:center;background:#edeaff;color:#6657da;width:26px;height:26px;flex:none;border-radius:8px}.l2-boards{display:grid;grid-template-columns:1fr 1fr;gap:10px;min-width:0;min-height:0}.drop-side{border:1px solid #e8eaf5;background:#fbfcff;border-radius:15px;display:flex;flex-direction:column;min-height:0;padding:10px;overflow:hidden;gap:6px}.drop-title{font-size:12px;font-weight:900;color:#64718f;display:flex;justify-content:space-between;align-items:center}.drop-title span{font-size:10px;color:#a0a7bc}.drop-items{display:flex;flex:1;min-height:0;flex-direction:column;gap:6px;overflow:hidden}.drop-item{background:#fff;border:1px dashed #d9dded;border-radius:11px;display:flex;align-items:center;justify-content:space-between;gap:5px;min-height:0;flex:1;overflow:hidden;padding:5px 8px;transition:background .12s,border-color .12s}.drop-item:hover,.drop-item.is-over{border-color:#7d6dea;background:#f3efff}.drop-item:focus-visible{outline:2px solid #7d6dea}.drop-item>strong{font-size:13px;color:#34415e;flex:none}.drop-item .tiny-mols{flex:1;min-width:0;display:flex;gap:2px;justify-content:center;overflow:hidden;align-items:center}.drop-item .molecule-svg{width:clamp(35px,3.9vw,56px);height:clamp(29px,4.8vh,44px)}.drop-controls{display:flex;align-items:center;gap:3px;flex:none}.qty-button{height:27px;width:27px;border:0;border-radius:8px;background:#eeedfb;color:#6558cb;font-weight:900;display:grid;place-items:center;padding:0}.qty-button:hover{background:#dcd6fc}.qty{min-width:18px;font-weight:900;font-size:15px;text-align:center;color:#6657da}.l3-layout{display:flex;flex-direction:column;gap:8px;min-height:0;height:100%}.l3-layout .particles-stack{flex:1}.support-line{font-size:11px;color:#9ba4b8;text-align:center}.l4-layout{height:100%;display:grid;grid-template-columns:1fr 1fr;gap:14px}.helper-tile{border-radius:16px;background:#f8f9ff;border:1px solid #edf0f9;padding:clamp(14px,2vw,26px);display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center;gap:10px}.helper-tile .helper-icon{background:#edebff;width:72px;height:72px;border-radius:22px;display:grid;place-items:center;color:#7062d4}.helper-tile h3{font-size:clamp(17px,2vw,24px);margin:0;letter-spacing:-.5px}.helper-tile p{font-size:12px;margin:0;color:#8995ab;line-height:1.5;max-width:310px}.rule-tiles{display:grid;grid-template-columns:1fr 1fr;gap:10px;align-content:center}.rule{border:1px solid #e6eafa;border-radius:15px;padding:13px;background:#fff;display:flex;align-items:center;gap:9px;color:#697590;font-size:12px;font-weight:750}.rule i{font-style:normal;font-size:20px}.rule span{line-height:1.25}.l5-layout{height:100%;display:flex;flex-direction:column;gap:clamp(12px,2.5vh,22px);justify-content:center;align-items:center}.l5-layout h3{font-size:clamp(18px,2vw,24px);letter-spacing:-.6px;margin:0}.answer-box{border:2px solid #dcdff0;border-radius:16px;padding:8px 15px;height:clamp(54px,8vh,76px);width:min(780px,100%);background:#fafdff;color:#334061;font-size:clamp(19px,2.6vw,32px);font-weight:700;text-align:center;outline:0;transition:border .1s}.answer-box:focus{background:white;border-color:#9382ef;box-shadow:0 0 0 3px #9382ef25}.answer-box::placeholder{color:#bec7d8;font-weight:500;font-size:clamp(15px,1.9vw,23px)}.keyboard{display:flex;gap:7px;justify-content:center;align-items:center;flex-wrap:wrap}.key{border:1px solid #dce1ee;background:#fff;color:#6e70a0;padding:9px 18px;border-radius:10px;font-size:17px;font-weight:900;min-width:50px}.key:hover{border-color:#8679df;background:#f4f0ff}.key.secondary{font-size:12px;color:#8691a7;font-weight:800}.small-hint{font-size:12px;color:#9ca5ba;text-align:center;max-width:800px}.prompt-card.is-paragraph{min-height:130px}.question-paragraph{font-size:clamp(15px,1.8vw,21px);line-height:1.5;font-weight:680;letter-spacing:-.2px;color:#384363;margin:0;text-align:center}.status-bar{min-height:65px;border-radius:16px;background:#fff;border:1px solid #e7ecf6;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:9px 12px}.status-left{flex:1;min-width:0;display:flex;align-items:center;gap:9px}.status-title{gap:8px;font-size:13px;font-weight:870;line-height:1.3}.status-title svg{flex:none}.status-sub{font-size:11px;color:#8793a9;line-height:1.4;margin-top:3px}.status-left.is-good .status-title{color:#0d9977}.status-left.is-bad .status-title{color:#d15c63}.status-left.is-hint .status-title{color:#7960c1}.action-group{gap:8px;flex:none}.btn{gap:8px;padding:12px 18px;border-radius:12px;border:1px solid #e2e7f2;background:#fff;color:#69738e;font-size:13px;font-weight:900;white-space:nowrap;justify-content:center}.btn:hover{background:#f7f6ff}.btn-primary{background:var(--accent);border-color:var(--accent);color:#fff;box-shadow:0 4px 12px #695ce23a}.btn-primary:hover{filter:brightness(1.055);background:var(--accent)}.btn-success{background:#139f7c;border-color:#139f7c;color:white}.btn-success:hover{background:#0c8d6d}.btn-minimal{border-color:transparent;background:transparent;padding:11px 9px}.btn.disabled{opacity:.4}.modal-layer{position:fixed;inset:0;background:#24325567;z-index:30;display:grid;place-items:center;padding:16px;backdrop-filter:blur(4px)}.modal{width:min(490px,100%);max-height:90dvh;overflow:auto;background:white;border-radius:24px;padding:25px;box-shadow:0 40px 80px #17203e55}.modal-head{display:flex;align-items:center;justify-content:space-between;gap:8px}.modal h2{font-size:25px;letter-spacing:-.8px;margin:0}.modal p{color:#818da4;font-size:13px;line-height:1.6}.setting-row{display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #ecf0f6;padding:14px 0;gap:15px}.setting-row strong{font-size:14px;display:block}.setting-row small{font-size:11px;color:#9ba4ba;display:block;margin-top:4px}.toggle{border:1px solid #dfe3f0;background:#e8eaf2;color:#586484;font-size:12px;font-weight:850;padding:8px 16px;border-radius:30px}.toggle.is-on{background:#e6fff3;border-color:#a3e6d0;color:#168a69}.setting-bottom{display:flex;justify-content:space-between;align-items:center;margin-top:22px;gap:10px}.notice{font-size:11px;color:#9ea6b9}.end-wrap{flex:1;display:grid;place-items:center;padding:20px}.end-card{width:min(700px,95vw);padding:30px;background:#fff;border:1px solid #e8edfa;border-radius:28px;box-shadow:var(--shadow);display:flex;flex-direction:column;gap:15px;align-items:center;text-align:center}.confetti{font-size:50px}.end-card h1{font-size:clamp(27px,4vw,42px);margin:0;letter-spacing:-1px}.end-card p{color:#8190a9;margin:0;font-size:14px}.outcome-stats{gap:20px;padding:14px;justify-content:center}.outcome-stats b{font-size:24px;color:#6456cb;display:block}.outcome-stats small{font-size:11px;font-weight:750;color:#8a95aa}.result-stars{font-size:34px;color:#e4af37;letter-spacing:4px}.visually-hidden{position:absolute!important;height:1px;width:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}.atom-legend{display:flex;gap:8px;flex-wrap:wrap;justify-content:center}.atom-dot{display:inline-block;height:8px;width:8px;border-radius:50%;margin-right:4px}.unrevealed{height:100%;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:9px;color:#9c9dcc}.l1-reveal{display:flex;flex-direction:column;gap:8px;min-height:0;height:100%;width:100%}.l1-reveal .particles-stack{gap:5px}.l1-reveal .molecule-set{padding:2px 5px;min-width:45px}.l1-reveal .molecule-svg{width:clamp(38px,4vw,60px);height:clamp(34px,5vh,48px)}.l1-reveal .molecule-panel-title{padding:7px 8px 2px}.l1-reveal .molecule-grid{gap:3px}.l1-reveal .atom-count-row{min-height:26px;padding:4px}.l1-reveal .atom-counter{font-size:9px;padding:3px 4px}.teacher-badge{color:#694bba;background:#efe8ff;padding:5px 9px;border-radius:9px;font-size:11px;font-weight:800}.answer-reveal{font-size:13px;color:#4f5592;font-weight:800;white-space:normal;max-width:390px}.teacher-answer{color:#6456cf;font-size:11px;font-weight:800;margin:auto 0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:330px}.progress-roundup{display:flex;gap:3px;align-items:center;font-size:12px;color:#808bad}.q-chip{display:grid;place-items:center;width:26px;height:26px;border-radius:8px;background:#f1f3f9;color:#8c96ae;font-size:11px;font-weight:800;border:0}.q-chip.is-complete{background:#e5faef;color:#0a986d}.q-chip.is-active{background:#e8e4ff;color:#5949b4}.tip-toast{position:absolute;bottom:12px;left:50%;transform:translateX(-50%);background:#fff;border:1px solid #dee4f0;border-radius:12px;box-shadow:0 9px 30px #27386528;padding:10px 14px;font-size:12px;color:#666ca1;font-weight:800;z-index:2;pointer-events:none;white-space:nowrap}
@media(max-width:1050px){.game-wrap{width:calc(100% - 28px)}.l2-layout{grid-template-columns:155px minmax(0,1fr)}.palette{padding:9px}.palette-item{padding:4px 6px}.palette-item .molecule-svg{width:42px}.level-card{padding:17px 14px}.level-card strong{font-size:15px}.hero-art{width:190px;transform:scale(.8);transform-origin:right center}.home{width:calc(100% - 40px)}}
@media(max-width:800px){.topbar{height:53px;min-height:53px;padding:0 13px}.brand{font-size:17px}.brand span small,.header-tag{display:none}.home{justify-content:flex-start;gap:10px;padding:12px 0 8px;overflow:hidden}.hero{min-height:100px}.hero h1{font-size:28px;letter-spacing:-1px}.hero p{font-size:12px}.hero-art{display:none}.level-grid{grid-template-columns:repeat(5,minmax(0,1fr));gap:7px}.level-card{min-height:200px;padding:13px 9px;gap:11px;border-radius:16px}.level-card .level-number{height:34px;width:34px;font-size:19px}.level-card strong{font-size:12px}.level-card .card-description{font-size:10px}.level-card .level-bottom{font-size:10px}.home-bottom{font-size:10px}.game-wrap{gap:5px;padding:6px 0}.stage-head{min-height:32px}.level-name{display:none}.stage{gap:6px}.prompt-card{min-height:85px;padding:9px 12px;gap:5px;border-radius:16px}.work-area{border-radius:16px;padding:8px}.status-bar{min-height:58px;border-radius:13px;padding:6px 9px}.status-sub{display:none}.status-title{font-size:11px}.action-group{gap:4px}.btn{padding:9px 10px;font-size:11px;border-radius:9px}.stage-tools .question-count{font-size:10px}.equation-sep.arrow{margin:0}.equation-row,.equation-group{gap:5px}.formula-term{font-size:clamp(16px,2.9vw,24px)}.coefficient-input{width:38px;height:39px;font-size:18px}.l2-layout{grid-template-columns:125px minmax(0,1fr);gap:5px}.l2-boards{gap:5px}.drop-side{padding:5px;gap:3px}.drop-item{padding:3px}.drop-item .molecule-svg{width:31px;height:30px}.drop-controls{gap:1px}.qty-button{width:23px;height:23px}.palette .panel-heading{font-size:10px}.palette-item strong,.drop-item>strong{font-size:11px}.palette-item .molecule-svg{width:35px}.molecule-panel-title{padding:5px 7px}.molecule-grid{gap:4px}.particle-side .molecule-svg{width:42px;height:39px}.atom-count-row{padding:4px;min-height:28px}.rule-tiles{gap:5px}.rule{padding:7px;font-size:10px}.helper-tile{padding:10px}.l5-layout{gap:9px}.prompt-card.is-paragraph{min-height:105px}.question-paragraph{font-size:13px}.answer-box{height:49px}.keyboard{gap:4px}.key{padding:5px 11px;min-width:35px}.small-hint{font-size:10px}}
@media(max-height:690px){.topbar{height:50px;min-height:50px}.home{gap:10px;padding:8px 0}.hero{min-height:97px}.hero h1{font-size:32px;margin:3px 0 5px}.hero p{font-size:12px}.level-card{min-height:190px;gap:9px}.home-bottom{display:none}.game-wrap{padding:5px 0;gap:4px}.stage-head{min-height:30px}.prompt-card{min-height:80px;padding-block:8px;gap:5px}.prompt-card.is-paragraph{min-height:100px}.work-area{padding:8px}.stage{gap:6px}.status-bar{min-height:51px;padding:5px 9px}.choice{min-height:60px}.decision{gap:8px}.decision h2{font-size:21px}.decision-buttons{gap:7px}.palette{gap:3px}.palette-item{padding:3px 7px}.palette-item .molecule-svg{height:30px}.molecule-set{padding:3px}.molecule-svg{height:39px;width:46px}.support-line{display:none}.l5-layout{gap:8px}.answer-box{height:48px}.key{padding:5px 12px}.l1-reveal .molecule-svg{height:30px;width:40px}}
@media(max-width:620px){.level-grid{grid-template-columns:repeat(5,minmax(0,1fr))}.level-card{padding:7px;min-height:182px}.level-card strong{font-size:11px}.level-card .card-description{font-size:9px}.level-bottom .arrow{display:none}.stage-head .pip-strip{gap:2px}.pip{width:7px}.stage-head{gap:5px}.stage-tools{gap:4px}.question-count{display:none}.level-pill{padding:5px 6px}.l2-layout{grid-template-columns:97px minmax(0,1fr)}.palette-item{padding:2px}.palette-item .molecule-svg{display:none}.palette-add{width:22px;height:22px}.drop-item>strong{font-size:10px}.drop-item .molecule-svg{width:23px;height:26px}.qty-button{width:20px;height:21px}.qty{font-size:11px;min-width:10px}.l4-layout{gap:6px}.helper-tile .helper-icon{display:none}.rule-tiles{grid-template-columns:1fr}.action-group .btn-minimal{display:none}.equation-row{gap:2px}.equation-group{gap:3px}.coefficient-input{width:30px;height:34px;font-size:16px;border-radius:7px}.formula-term{font-size:clamp(14px,3.1vw,20px);gap:1px}.equation-sep{font-size:14px}.status-left{gap:4px}.status-title{font-size:10px}.btn{font-size:10px;padding:7px 8px}}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{transition:none!important;animation:none!important}}

.l3-particles{flex:1;min-height:0}.l3-particles>.particles-stack{height:100%;min-height:0}
/* Portrait layouts: preserve meaningful molecule and choice controls without clipping. */
@media(max-width:620px){
  .level1-layout{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(174px,.85fr) minmax(0,1.15fr);gap:7px}
  .decision{padding:9px;gap:7px}
  .decision h2{font-size:21px}
  .decision-buttons{width:min(320px,100%);gap:8px}
  .choice{min-height:58px;font-size:12px;padding:7px 5px;gap:3px;border-radius:12px}
  .choice svg{width:18px;height:18px}
  .decision p{font-size:10px}
  .preview-panel{padding:6px}
  .l2-layout{display:flex;flex-direction:column;gap:6px}
  .palette{height:76px;flex:none;padding:7px;gap:5px}
  .palette .panel-heading{line-height:1}
  .palette-grid{flex-direction:row;gap:5px;justify-content:space-between}
  .palette-item{min-width:0;flex:1;min-height:0;gap:3px;padding:3px 4px;flex-direction:column;justify-content:center}
  .palette-item .molecule-svg{display:block;height:27px;width:37px}
  .palette-item strong{font-size:10px}
  .palette-add{display:none}
  .l2-boards{min-height:0;flex:1;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
  .drop-side{padding:6px;gap:4px}
  .drop-title{font-size:11px}
  .drop-title span{font-size:8px}
  .drop-item{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:24px minmax(0,1fr);padding:5px;gap:4px}
  .drop-item>strong{font-size:11px;grid-column:1;grid-row:1}
  .drop-controls{grid-column:2;grid-row:1;gap:2px}
  .qty-button{width:22px;height:22px}
  .qty{font-size:12px;min-width:14px}
  .drop-item .tiny-mols{grid-column:1/3;grid-row:2;align-content:center;justify-content:center;align-items:center;flex-wrap:wrap;gap:0 3px}
  .drop-item .molecule-svg{width:35px;height:33px}
}

/* Balance Lab v1.1 — larger molecule-first workspace + persistent five-colour breadcrumbs */
:root{--out-green:#1aaf71;--out-blue:#388def;--out-yellow:#e5b12a;--out-red:#e15b65;--out-grey:#c4cad6}
.pip-strip{display:flex;gap:4px;align-items:center}
.pip{position:relative;display:grid;place-items:center;min-width:0;width:clamp(17px,1.6vw,23px);height:23px;border-radius:7px;border:2px solid transparent;transform:none!important;transition:background .14s,box-shadow .14s}
.pip span{font-size:9px;font-weight:900;line-height:1;color:white;letter-spacing:-.25px}
.pip.status-green,.legend-dot.status-green{background:var(--out-green)}
.pip.status-blue,.legend-dot.status-blue{background:var(--out-blue)}
.pip.status-yellow,.legend-dot.status-yellow{background:var(--out-yellow)}
.pip.status-red,.legend-dot.status-red{background:var(--out-red)}
.pip.status-grey,.legend-dot.status-grey{background:var(--out-grey)}
.pip.status-yellow span,.pip.status-grey span{color:#344058}
.pip.is-current{border-color:#263153;box-shadow:0 0 0 2px #fff,0 0 0 4px #2c3555}
.pip:focus-visible{outline:3px solid #4b4c83;outline-offset:3px}
.outcome-legend{display:flex;flex-wrap:wrap;gap:7px 12px;margin-top:8px}
.outcome-legend span,.summary-item{display:inline-flex;gap:5px;align-items:center;font-size:11px;color:#72809a;font-weight:650}
.legend-dot{display:inline-block;width:11px;height:11px;border-radius:4px;flex:none}
.summary-status{display:flex;flex-wrap:wrap;justify-content:center;gap:11px 18px;width:100%;padding:11px;background:#f7f9fe;border-radius:12px}
.summary-item{font-size:12px}.summary-item strong{color:#344263;font-size:15px}
/* horizontal molecule bank, above which the reactant and product diagrams get nearly all the space */
.l2-layout{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) 98px;gap:10px;height:100%;min-height:0}
.l2-boards{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px;min-height:0}
.drop-side{padding:9px 10px;gap:6px;background:#f9fbff;border-radius:15px;min-width:0}
.drop-title{font-size:13px;padding:0 3px;min-height:22px}
.drop-title span{font-size:10px}
.drop-items{min-height:0;display:flex;flex-direction:column;gap:7px;overflow:hidden}
.drop-item{display:flex;flex-direction:column;justify-content:initial;align-items:stretch;min-height:0;gap:2px;flex:1 1 0;padding:6px 8px;border-radius:12px;overflow:hidden}
.drop-item-head{width:100%;display:flex;justify-content:space-between;align-items:center;gap:6px;min-height:31px}
.drop-item-head strong{font-size:15px;letter-spacing:.1px;color:#354567;white-space:nowrap}
.drop-controls{display:flex;align-items:center;gap:5px;flex:none}
.qty-button{width:35px;height:35px;border-radius:10px;font-size:20px;touch-action:manipulation}
.qty{font-size:17px;min-width:20px}
.molecule-display{width:100%;flex:1;min-width:0;min-height:0;display:grid;place-items:center;overflow:hidden}
.molecule-cluster{min-height:0;max-height:100%;min-width:0;width:100%;display:flex;align-content:center;align-items:center;justify-content:center;gap:5px;flex-wrap:wrap}
.molecule-cluster .molecule-svg{width:clamp(68px,8vw,128px);height:clamp(56px,11vh,90px);max-width:100%;flex:none;filter:drop-shadow(0 4px 4px #32487521)}
.molecule-cluster.cluster-large.count-1 .molecule-svg{width:clamp(94px,11vw,165px);height:clamp(63px,13.5vh,122px)}
.molecule-cluster.cluster-large.count-2 .molecule-svg{width:clamp(78px,8vw,120px);height:clamp(53px,10vh,91px)}
.molecule-cluster.cluster-large.count-3 .molecule-svg,
.molecule-cluster.cluster-large.count-4 .molecule-svg{width:clamp(58px,6.4vw,100px);height:clamp(41px,7.5vh,71px)}
.molecule-cluster.cluster-large.count-5 .molecule-svg,
.molecule-cluster.cluster-large.count-6 .molecule-svg,
.molecule-cluster.cluster-large.count-7 .molecule-svg{width:clamp(41px,5vw,68px);height:clamp(31px,6.5vh,56px)}
.extra-molecules{padding:2px 7px;border-radius:8px;background:#eae8fc;color:#695ac3;font-size:12px;font-weight:900}
.empty-molecule{font-size:12px;color:#b0b9cc;font-weight:750;letter-spacing:.1px}
.drop-side .atom-count-row{padding:4px 3px 0;min-height:28px;border-top:1px solid #e7edfb;flex:none}
.drop-side .atom-counter{font-size:12px;padding:4px 8px}
.palette{display:flex;flex-direction:column;gap:5px;padding:8px 11px 9px;background:#f1f3ff;border-radius:14px;min-height:0}
.palette-head{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:14px}
.palette-head .panel-heading{font-size:11px}
.palette-tip{color:#99a4bd;font-size:10px;font-weight:800}
.palette-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;min-height:0;flex:1}
.palette-item{min-width:0;min-height:0;display:flex;align-items:center;justify-content:center;gap:10px;flex-direction:row;padding:4px 8px;border-radius:10px}
.palette-item .molecule-svg{width:clamp(43px,5.6vw,82px);height:clamp(30px,4.4vh,51px);flex:none}
.palette-item strong{font-size:14px;white-space:nowrap}
.palette-item .palette-add{flex:none;margin-left:auto;width:30px;height:30px}
/* supporting diagrams in levels 1 and 3 also become easier to see */
.particle-side .molecule-grid{padding:8px;gap:6px;align-content:center}
.particle-side .molecule-set{background:#fff;padding:8px 7px;gap:4px;max-width:100%}
.particle-side .molecule-set-label{font-size:13px}
.particle-side .molecule-cluster{max-height:100%}
.particle-side .molecule-cluster.count-1 .molecule-svg{width:clamp(90px,9vw,150px);height:clamp(67px,10vh,103px)}
.particle-side .molecule-cluster.count-2 .molecule-svg{width:clamp(70px,7vw,108px);height:clamp(52px,8vh,76px)}
.particle-side .molecule-cluster.count-3 .molecule-svg,.particle-side .molecule-cluster.count-4 .molecule-svg{width:clamp(49px,5vw,84px);height:clamp(37px,6vh,62px)}
.particle-side .molecule-cluster.count-5 .molecule-svg,.particle-side .molecule-cluster.count-6 .molecule-svg,.particle-side .molecule-cluster.count-7 .molecule-svg{width:clamp(37px,4.3vw,65px);height:clamp(28px,5vh,48px)}
.l1-reveal .molecule-set{padding:6px}
.l1-reveal .molecule-cluster.count-1 .molecule-svg{width:clamp(70px,7vw,125px);height:clamp(53px,9vh,86px)}
.l1-reveal .molecule-cluster.count-2 .molecule-svg{width:clamp(55px,6vw,94px);height:clamp(40px,7vh,70px)}
.l1-reveal .molecule-cluster.count-3 .molecule-svg,.l1-reveal .molecule-cluster.count-4 .molecule-svg{width:clamp(37px,4.4vw,64px);height:clamp(30px,5vh,54px)}
/* give extra room to boards by reducing oversized header/prompt padding */
.game-wrap{gap:7px;padding-top:7px;padding-bottom:9px}
.stage{gap:7px}
.prompt-card:not(.is-paragraph){min-height:94px;padding-block:10px;gap:6px}
.work-area{padding:10px}
@media (max-width:1050px){
  .l2-layout{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) 88px;gap:6px}
  .palette{padding:5px 7px;gap:4px}
  .palette-grid{gap:5px}
  .palette-item{padding:3px 5px;gap:5px}
  .palette-item .molecule-svg{width:45px;height:34px}
  .palette-item strong{font-size:12px}
  .palette-item .palette-add{width:25px;height:25px}
  .drop-item-head strong{font-size:13px}
  .drop-controls{gap:4px}
  .qty-button{width:31px;height:31px}
  .qty{font-size:15px;min-width:15px}
}
@media(max-width:800px){
  .stage-head{min-height:38px}
  .stage-tools{gap:6px}
  .pip-strip{gap:3px}
  .pip{width:17px;height:20px;border-radius:5px;border-width:1px}
  .pip span{font-size:8px}
  .pip.is-current{box-shadow:0 0 0 1px white,0 0 0 3px #263153}
  .l2-layout{grid-template-rows:minmax(0,1fr) 80px}
  .drop-side{padding:6px;gap:3px}
  .drop-title{font-size:11px;min-height:18px}
  .drop-title span{font-size:9px}
  .drop-items{gap:4px}
  .drop-item{padding:3px 5px;gap:0}
  .drop-item-head{min-height:27px}
  .qty-button{height:27px;width:27px;font-size:18px;border-radius:7px}
  .qty{font-size:13px;min-width:12px}
  .drop-item-head strong{font-size:12px}
  .molecule-cluster.cluster-large.count-1 .molecule-svg{width:clamp(75px,13vw,130px);height:clamp(53px,9vh,86px)}
  .molecule-cluster.cluster-large.count-2 .molecule-svg{width:clamp(56px,10vw,93px);height:clamp(41px,7vh,70px)}
  .molecule-cluster.cluster-large.count-3 .molecule-svg,.molecule-cluster.cluster-large.count-4 .molecule-svg{width:clamp(45px,7vw,67px);height:clamp(30px,5.5vh,51px)}
  .drop-side .atom-count-row{min-height:23px;padding:3px 0 0;gap:3px}
  .drop-side .atom-counter{font-size:10px;padding:3px 5px}
  .palette-head .panel-heading{font-size:9px}
  .palette-tip{font-size:9px}
  .palette-item .molecule-svg{width:39px;height:28px;display:block}
  .palette-item strong{font-size:11px}
  .palette-item .palette-add{width:23px;height:23px}
  .particle-side .molecule-set{padding:3px}
  .particle-side .molecule-set-label{font-size:10px}
}
@media(max-width:620px){
  .stage-head{flex-wrap:wrap;justify-content:space-between;gap:3px;min-height:43px}
  .stage-tools{margin-left:auto;gap:4px}
  .pip-strip{gap:2px}
  .pip{width:clamp(11px,3.15vw,15px);height:18px;border-radius:4px}
  .pip span{font-size:7px;letter-spacing:-.7px}
  .l2-layout{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) 78px}
  .l2-boards{gap:5px}
  .palette-item .molecule-svg{display:block;width:31px;height:25px}
  .palette-item{flex-direction:column;gap:1px;position:relative;padding:3px 2px}
  .palette-item strong{font-size:10px}
  .palette-item .palette-add{position:absolute;right:2px;top:3px;height:17px;width:17px;border-radius:5px}
  .palette-item .palette-add svg{height:12px;width:12px}
  .drop-title span{display:none}
  .drop-side{padding:4px;gap:2px}
  .drop-item{padding:3px}
  .drop-item-head strong{font-size:11px}
  .drop-controls{gap:2px}
  .qty-button{width:25px;height:26px}
  .qty{min-width:11px;font-size:12px}
  .molecule-cluster.cluster-large.count-1 .molecule-svg{width:clamp(70px,20vw,108px);height:clamp(48px,8vh,76px)}
  .molecule-cluster.cluster-large.count-2 .molecule-svg{width:clamp(48px,13vw,74px);height:clamp(36px,6vh,56px)}
  .molecule-cluster.cluster-large.count-3 .molecule-svg,.molecule-cluster.cluster-large.count-4 .molecule-svg{width:clamp(35px,10vw,54px);height:clamp(27px,5vh,46px)}
  .drop-side .atom-counter{font-size:9px;padding:3px 4px}
  .palette{padding:5px}
  .palette-head{min-height:12px}
  .prompt-card:not(.is-paragraph){min-height:86px}
  .work-area{padding:6px}
}
@media(max-height:680px){
  .l2-layout{grid-template-rows:minmax(0,1fr) 67px;gap:4px}
  .palette{padding:3px 7px;gap:2px}
  .palette-item .molecule-svg{height:21px}
  .palette-head{min-height:11px}
  .drop-item-head{min-height:25px}
  .drop-title{min-height:16px}
  .qty-button{height:24px;width:25px}
  .drop-side .atom-count-row{min-height:20px}
  .molecule-cluster.cluster-large.count-1 .molecule-svg{height:min(64px,10vh)}
  .molecule-cluster.cluster-large.count-2 .molecule-svg{height:min(50px,8vh)}
  .molecule-cluster.cluster-large.count-3 .molecule-svg,.molecule-cluster.cluster-large.count-4 .molecule-svg{height:min(37px,6vh)}
}
/* Use the full board height for molecules on classroom-sized displays. */
@media(min-width:901px){
  .l2-boards .drop-items{flex-direction:row;align-items:stretch}
  .l2-boards .drop-item{flex:1 1 0;min-width:0;width:0}
  .l2-boards .drop-item-head{flex-wrap:wrap;justify-content:center;gap:4px}
  .l2-boards .drop-item-head strong{font-size:16px}
  .l2-boards .molecule-display{flex:1}
  .l2-boards .molecule-cluster{height:100%}
  .l2-boards .molecule-cluster.count-1 .molecule-svg{max-height:min(95%,135px)}
  .l2-boards .molecule-cluster.count-2 .molecule-svg{max-height:min(44%,95px)}
  .l2-boards .molecule-cluster.count-3 .molecule-svg,.l2-boards .molecule-cluster.count-4 .molecule-svg{max-height:min(43%,77px)}
}
@media(max-width:900px){
  .l2-boards .drop-items{flex-direction:column}
  .l2-boards .molecule-cluster{height:100%}
  .l2-boards .molecule-cluster.count-1 .molecule-svg{max-height:100%}
  .l2-boards .molecule-cluster.count-2 .molecule-svg{max-height:95%}
  .l2-boards .molecule-cluster.count-3 .molecule-svg,.l2-boards .molecule-cluster.count-4 .molecule-svg{max-height:51%}
}
.palette-grid{grid-template-columns:repeat(var(--bank-count,4),minmax(0,1fr))}
@media(max-width:620px){
  .level1-layout{grid-template-rows:minmax(154px,.6fr) minmax(0,1.4fr)}
  .l1-reveal .molecule-set{padding:2px 3px;gap:2px}
  .l1-reveal .molecule-grid{gap:2px}
  .l1-reveal .molecule-set-label{font-size:9px}
  .l1-reveal .molecule-cluster.count-1 .molecule-svg{width:55px;height:38px}
  .l1-reveal .molecule-cluster.count-2 .molecule-svg{width:43px;height:34px}
  .l1-reveal .molecule-cluster.count-3 .molecule-svg,.l1-reveal .molecule-cluster.count-4 .molecule-svg{width:32px;height:29px}
}

/* v1.2 — TWO free-form molecule canvases, no individual formula drop slots. */
.l2-layout.free-layout{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) 94px;gap:9px;height:100%;min-height:0}
.l2-boards.free-boards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;min-height:0;height:100%}
.free-board{display:flex;flex-direction:column;gap:6px;padding:9px;border:1px solid #e0e7f5;border-radius:17px;background:#f9fbff;min-width:0;min-height:0;transition:border-color .18s,background .18s}
.free-board.is-over{background:#e9f9f4;border:2px dashed #19a68b}
.free-head{display:flex;justify-content:space-between;align-items:center;min-height:24px;gap:6px;padding:0 3px}
.free-head strong{font-size:15px;color:#304362}
.free-head span{font-size:11px;font-weight:750;color:#99a5bb}
.free-canvas{position:relative;flex:1;min-height:0;min-width:0;display:flex;flex-wrap:wrap;align-items:center;align-content:center;justify-content:center;gap:6px;padding:8px;border:2px dashed #dfe6fa;border-radius:15px;overflow:hidden;background:#fff}
.free-board.is-over .free-canvas{border-color:#19a68b;background:#f4fffa}
.empty-instruction{display:flex;flex-direction:column;gap:8px;justify-content:center;align-items:center;color:#a6b0c8;font-size:13px;font-weight:800;pointer-events:none}
.empty-instruction svg{width:32px;height:32px}
.free-molecule{position:relative;min-width:0;width:clamp(84px,10vw,150px);height:clamp(74px,13vh,114px);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;border:1px solid transparent;border-radius:14px;background:#f6f8fe;touch-action:none;cursor:grab;user-select:none;-webkit-user-select:none;transition:background .16s,border-color .16s}
.free-molecule:active{cursor:grabbing}
.free-molecule:hover,.free-molecule:focus-visible{background:#ebf2ff;border-color:#bacbf3;outline:0}
.free-molecule>.molecule-svg{width:100%;height:70%;min-height:0;max-height:96px;filter:drop-shadow(0 3px 2px rgba(44,59,105,.17));pointer-events:none}
.free-molecule-foot{width:100%;display:flex;align-items:center;justify-content:center;position:relative;gap:5px;min-height:23px}
.free-molecule-foot b{font-size:12px;color:#3b5172}
.unit-remove{position:absolute;right:1px;bottom:-1px;display:grid;place-items:center;border:0;background:#e9e8ff;color:#6757bd;border-radius:7px;width:27px;height:27px;font-size:19px;line-height:1;touch-action:manipulation;cursor:pointer}
.unit-remove:hover{background:#ead1db;color:#ac4263}
.free-canvas:has(.free-molecule:nth-of-type(5)) .free-molecule{width:clamp(65px,7vw,94px);height:clamp(57px,9vh,82px)}
.free-canvas:has(.free-molecule:nth-of-type(9)) .free-molecule{width:clamp(50px,5.3vw,73px);height:clamp(45px,7vh,63px)}
.free-canvas:has(.free-molecule:nth-of-type(15)) .free-molecule{width:clamp(40px,4.4vw,63px);height:clamp(39px,6vh,54px);gap:0}
.free-canvas:has(.free-molecule:nth-of-type(15)) .free-molecule-foot b{font-size:10px}
.free-board>.atom-count-row{border-top:1px solid #e5ebf9;display:flex;gap:4px;flex-wrap:wrap;justify-content:center;align-items:center;padding:5px 2px 0;min-height:33px;flex:none}
.free-palette{height:94px;min-height:0}
.free-palette .palette-grid{display:grid;grid-template-columns:repeat(var(--bank-count,4),minmax(0,1fr));gap:7px;flex:1}
.free-palette .palette-item{touch-action:none;cursor:grab;user-select:none;-webkit-user-select:none}
.free-palette.is-over{outline:2px dashed #e49b9b;background:#fff2f4}
.drag-ghost{position:fixed;left:0;top:0;z-index:99999;pointer-events:none;border-radius:12px;border:2px solid #8f87e7;background:#f1eeffdb;padding:9px;width:90px;height:78px;box-shadow:0 9px 20px #35447b33;transform:translate(-400px,-400px)}
.drag-ghost .molecule-svg{height:100%;width:100%}

/* Responsive, full-screen reaction animation. */
.reaction-layer{position:fixed;inset:0;z-index:120;background:#1d2b52b8;display:flex;align-items:center;justify-content:center;padding:12px;backdrop-filter:blur(6px)}
.reaction-modal{display:grid;grid-template-rows:auto auto minmax(0,1fr) auto;gap:8px;width:min(100%,1010px);height:min(92dvh,640px);min-height:0;padding:16px;border-radius:23px;background:#fff;box-shadow:0 35px 80px #08112a55;overflow:hidden}
.reaction-head{display:flex;align-items:center;justify-content:space-between;gap:12px}
.reaction-head h2{font-size:clamp(17px,2.2vw,25px);margin:1px 0;color:#2a3559}
.reaction-close{border:0;background:#f0f2fa;border-radius:11px;font-size:27px;color:#58668b;width:40px;height:40px;display:grid;place-items:center}
.reaction-steps{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:5px}
.reaction-steps span{font-size:11px;font-weight:850;color:#9da8c0;padding:7px 3px;border-radius:7px;text-align:center;background:#f3f5fa;transition:background .2s,color .2s}
.reaction-layer[data-phase="count"] .reaction-steps span:first-child,
.reaction-layer[data-phase="break"] .reaction-steps span:nth-child(2),
.reaction-layer[data-phase="move"] .reaction-steps span:nth-child(3),
.reaction-layer[data-phase="form"] .reaction-steps span:nth-child(4),
.reaction-layer[data-phase="done"] .reaction-steps span:nth-child(5){background:#e3e9ff;color:#5447bd}
.reaction-figure{min-height:0;display:grid;place-items:center;border-radius:14px;background:#f6f8ff;overflow:hidden;padding:6px}
.reaction-svg{width:100%;height:100%;min-height:0;display:block}
.reaction-svg-box{fill:#fff;stroke:#d8e2f8;stroke-width:1.5;stroke-dasharray:5 5}
.reaction-side-title{fill:#5c6a8e;font-size:15px;font-weight:850;letter-spacing:1px}
.reaction-arrow{stroke:#8c79df;stroke-width:5;stroke-linecap:round;stroke-linejoin:round;fill:none}
.bond{stroke:#99a6b7;stroke-width:4;stroke-linecap:round}
.bond.unmatched-bond{stroke:#e4878e;stroke-dasharray:4 5}
.reactant-bonds,.product-bonds,.ghost-atoms{transition:opacity .4s ease}
.product-bonds,.ghost-atoms{opacity:0}
.reaction-layer[data-phase="break"] .reactant-bonds,.reaction-layer[data-phase="move"] .reactant-bonds,.reaction-layer[data-phase="form"] .reactant-bonds,.reaction-layer[data-phase="done"] .reactant-bonds{opacity:0}
.reaction-layer[data-phase="form"] .product-bonds,.reaction-layer[data-phase="done"] .product-bonds,.reaction-layer[data-phase="done"] .ghost-atoms{opacity:1}
.missing-atom text{fill:#d25369;font-size:13px;font-weight:900}
.atom-label{fill:#192544;font-size:10px;font-weight:900;pointer-events:none;paint-order:stroke;stroke:#ffffff99;stroke-width:1px}
.reaction-layer[data-phase="done"] .unused-atom{filter:drop-shadow(0 0 5px #ebac38)}
.reaction-bottom{display:flex;align-items:center;justify-content:space-between;gap:14px;min-height:100px}
.reaction-message{max-width:66%;min-width:0}
.reaction-progress{font-size:17px;color:#705ec3}
.reaction-done-title{color:#188969;font-size:17px;display:none}
.reaction-result{font-size:13px;line-height:1.45;color:#4a5774;font-weight:650;margin:3px 0;display:none}
.reaction-disclaimer{font-size:10px;color:#96a1b5;margin:4px 0 0}
.reaction-layer:not([data-phase="done"]) .reaction-disclaimer{display:none}
.reaction-layer[data-phase="done"] .reaction-progress{display:none}
.reaction-layer[data-phase="done"] .reaction-done-title,.reaction-layer[data-phase="done"] .reaction-result{display:block}
.reaction-layer.is-incorrect[data-phase="done"] .reaction-done-title{color:#d15a67}
.reaction-layer[data-phase="done"]:has(.reaction-result) .reaction-modal:has(.reaction-done-title){}
.reaction-actions{display:flex;gap:6px;flex-wrap:wrap;justify-content:end;align-items:center}
.reaction-actions .btn{white-space:nowrap}
.reaction-heavy{padding:20px;text-align:center;color:#546389;font-weight:800}
@media(max-width:800px){
  .l2-layout.free-layout{grid-template-rows:minmax(0,1fr) 82px;gap:6px}
  .free-board{padding:6px;gap:3px}
  .free-head{min-height:19px}.free-head strong{font-size:12px}.free-head span{font-size:9px}
  .free-canvas{padding:4px;gap:4px;border-radius:10px}
  .free-molecule{width:clamp(53px,10vw,96px);height:clamp(55px,12vh,86px)}
  .free-palette{height:82px;padding:5px 7px}
  .free-palette .palette-item{gap:3px;padding:2px 5px}
  .free-palette .palette-item strong{font-size:11px}
  .free-palette .palette-item .molecule-svg{width:clamp(32px,5vw,60px);height:32px}
  .free-board>.atom-count-row{min-height:24px;padding-top:2px}
  .free-board .atom-counter{font-size:10px;padding:3px 5px}
  .reaction-modal{height:min(96dvh,680px);padding:10px;gap:5px}
  .reaction-bottom{min-height:92px}
}
@media(max-width:620px){
  .l2-layout.free-layout{height:100%;min-height:0;display:grid;grid-template-rows:minmax(0,1fr) 78px;gap:5px}
  .l2-boards.free-boards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px}
  .free-board{padding:4px;gap:2px;border-radius:10px}
  .free-canvas{padding:2px;gap:2px}
  .free-molecule{width:clamp(46px,13vw,70px);height:clamp(51px,10vh,76px);border-radius:8px}
  .free-molecule>.molecule-svg{height:69%}
  .free-molecule-foot{min-height:19px}
  .free-molecule-foot b{font-size:10px}
  .unit-remove{width:20px;height:20px;font-size:15px;right:0}
  .free-canvas:has(.free-molecule:nth-of-type(5)) .free-molecule{width:46px;height:53px}
  .free-canvas:has(.free-molecule:nth-of-type(9)) .free-molecule{width:37px;height:46px}
  .free-canvas:has(.free-molecule:nth-of-type(15)) .free-molecule{width:33px;height:38px}
  .free-board .atom-count-row{gap:2px;padding:2px 1px 0;min-height:24px}
  .free-board .atom-counter{font-size:9px;padding:2px 3px}
  .empty-instruction{font-size:10px;text-align:center}.empty-instruction svg{width:22px;height:22px}
  .free-palette{height:78px;gap:3px}
  .free-palette .palette-tip{font-size:9px}
  .free-palette .palette-item{padding:1px;flex-direction:column;justify-content:center}
  .free-palette .palette-item .molecule-svg{display:block;width:34px;height:26px}
  .free-palette .palette-item strong{font-size:10px}
  .free-palette .palette-add{display:none}
  .reaction-layer{padding:5px}
  .reaction-modal{height:min(98dvh,760px);width:100%;border-radius:15px;padding:8px;grid-template-rows:auto auto minmax(0,1fr) auto}
  .reaction-head h2{font-size:18px}.reaction-head .panel-heading{font-size:9px}
  .reaction-close{width:30px;height:30px;font-size:22px}
  .reaction-steps span{font-size:8px;padding:5px 2px}
  .reaction-bottom{flex-direction:column;align-items:stretch;min-height:138px;gap:5px}
  .reaction-message{max-width:100%}.reaction-progress,.reaction-done-title{font-size:14px}.reaction-result{font-size:11px}.reaction-disclaimer{font-size:9px}
  .reaction-actions{justify-content:stretch;gap:4px}.reaction-actions .btn{flex:1;padding:7px 4px;font-size:10px}
  .status-bar .btn-replay{display:inline-flex;width:34px;min-width:34px;padding:7px;justify-content:center}.status-bar .btn-replay .replay-label{display:none}
}
@media(prefers-reduced-motion:reduce){.reactant-bonds,.product-bonds,.ghost-atoms{transition:none}}

.reaction-layer.reaction-instant .reactant-bonds,.reaction-layer.reaction-instant .product-bonds,.reaction-layer.reaction-instant .ghost-atoms{transition:none!important}

/* v1.3 — persisted, five-step animation speed control */
.speed-setting{align-items:center;gap:12px}
.speed-heading{min-width:0;flex:1}
.reaction-speed-control{width:min(224px,51%);display:flex;flex-direction:column;gap:4px;flex:none}
.reaction-speed-control output{text-align:center;font-weight:850;color:#6352ca;font-size:13px;font-variant-numeric:tabular-nums}
.reaction-speed-control input[type=range]{display:block;width:100%;margin:2px 0;cursor:pointer;accent-color:#7566eb;height:22px}
.speed-endpoints{display:flex;justify-content:space-between;font-size:10px;color:#8e99b0;font-weight:700}
.reaction-speed-note{display:block;margin-top:1px;font-size:11px;font-weight:800;color:#7060b3;font-variant-numeric:tabular-nums}
/* Timed bond transitions follow the animation clock, not wall-clock fixed timing. */
.reaction-layer .reactant-bonds,.reaction-layer .product-bonds,.reaction-layer .ghost-atoms{transition:opacity var(--reaction-bond-transition,400ms) ease}
@media(max-width:380px){.reaction-speed-control{width:48%}.reaction-speed-control output{font-size:11px}.speed-heading strong{font-size:12px}}
/* Keep the expanded settings panel on one classroom-laptop screen. */
.modal:has(.speed-setting){padding:18px 22px}
.modal:has(.speed-setting) .setting-row{padding:9px 0}
.modal:has(.speed-setting) .setting-bottom{margin-top:12px}
