@font-face{font-family:'Lexend';font-style:normal;font-weight:400 800;font-display:swap;src:url(../fonts/lexend.woff2) format('woff2');}
/* Option A "Notebook": paper ground, white cards, ink text, one accent per course
   (setCourse() sets --accent / --accent-soft from the course). */
:root{
  --paper:#f6f4ee; --card:#ffffff; --line:#e3ded3; --line2:#d6d0c3; --soft:#f3efe6; --soft2:#ebe7dd;
  --ink:#1b2433; --ink2:#3d4757; --muted:#5b6474;
  --accent:#4338ca; --accent-soft:#eceafd;
  --bg1:var(--accent); --bg2:var(--accent);
  --good:#15803d; --bad:#dc2626; --warn:#d97706; --gold:#e0a100;
  --shadow:0 1px 2px rgba(27,36,51,.05),0 6px 18px rgba(27,36,51,.06); --radius:18px;
}
*{box-sizing:border-box; -webkit-tap-highlight-color:transparent}
html,body{margin:0; height:100%}
/* stop iOS Safari enlarging text by itself, which made some labels outgrow their boxes */
html{-webkit-text-size-adjust:100%; text-size-adjust:100%}
body{
  font-family:"Lexend",system-ui,sans-serif;
  color:var(--ink);
  background:var(--paper);
  min-height:100%; overflow-x:hidden; line-height:1.45;
}
.wrap{max-width:880px; margin:0 auto; padding:20px 16px 60px;}
h1,h2,h3{margin:0}
button{font-family:inherit; cursor:pointer; border:none; outline:none; color:inherit}
button:focus-visible,a:focus-visible,input:focus-visible{outline:3px solid var(--accent); outline-offset:2px}
.hidden{display:none !important}
.spacer{flex:1 1 auto}
.overline{font-size:.8rem; font-weight:600; color:var(--muted); text-transform:uppercase; letter-spacing:.06em}
.tdot{display:inline-block; width:10px; height:10px; border-radius:50%; flex:none}

/* Top bar */
.topbar{display:flex; flex-direction:column; gap:14px; margin-bottom:22px}
.brandrow{display:flex; align-items:center; gap:14px}
.brand-img{width:48px; height:48px; border-radius:50%; object-fit:cover; background:#fff; border:2px solid #fff; box-shadow:0 0 0 1px var(--line); flex:none}
.brand-text{flex:1 1 auto; min-width:0}
.brand-text .t{font-size:1.35rem; font-weight:700; letter-spacing:-.01em; line-height:1.15}
.brand-text .s{font-size:.82rem; color:var(--muted)}
.toolrow{display:flex; align-items:center; gap:8px; flex-wrap:wrap}
.switches{display:flex; gap:8px; flex-wrap:wrap; flex:1 1 100%}
.courseswitch{display:flex; gap:4px; padding:4px; background:var(--soft2); border-radius:14px}
.cs-btn{min-height:44px; padding:0 20px; border-radius:10px; background:transparent; color:var(--ink2); font-size:.95rem; font-weight:600}
.cs-btn.on{background:var(--accent); color:#fff}
@media(max-width:480px){.cs-btn{padding:0 12px}}
.chip{background:var(--card); border:1px solid var(--line); color:var(--ink); padding:8px 14px; border-radius:999px; font-weight:600; display:flex; gap:6px; align-items:center; white-space:nowrap}
.starchip svg{width:18px; height:18px; fill:var(--gold); stroke:#b07d00; stroke-width:1.5; stroke-linejoin:round}
.iconbtn{background:var(--card); border:1px solid var(--line); color:var(--ink2); width:44px; height:44px; border-radius:12px; transition:opacity .15s; position:relative; display:grid; place-items:center; flex:none}
.iconbtn svg{width:20px; height:20px; display:block}
.iconbtn.off{opacity:.6}
.iconbtn.off::after{content:''; position:absolute; left:50%; top:50%; width:25px; height:2.5px; border-radius:2px; background:var(--ink2); transform:translate(-50%,-50%) rotate(-45deg)}
.iconbtn.playing{animation:notepulse 1.6s ease-in-out infinite}
.iconbtn.on{background:#dcfce7; border-color:#a7e3bd; color:var(--good)}
@keyframes notepulse{0%,100%{transform:scale(1)}50%{transform:scale(1.08)}}
.volslider{width:86px; height:6px; -webkit-appearance:none; appearance:none; background:var(--soft2); border-radius:999px; outline:none; cursor:pointer; accent-color:var(--accent)}
.volslider::-webkit-slider-thumb{-webkit-appearance:none; appearance:none; width:16px; height:16px; border-radius:50%; background:var(--accent); cursor:pointer}
.volslider::-moz-range-thumb{width:16px; height:16px; border:none; border-radius:50%; background:var(--accent); cursor:pointer}
@media(max-width:600px){.volslider{display:none}}

/* Cards / screens */
.screen{animation:pop .35s ease}
@keyframes pop{from{transform:translateY(14px); opacity:0} to{transform:none; opacity:1}}
.panel{background:var(--card); border:1px solid var(--line); border-radius:var(--radius); padding:22px}
.screen-title{font-size:1.4rem; font-weight:700; color:var(--ink)}

/* Home */
.home-top{display:flex; gap:16px; align-items:stretch; margin-bottom:28px}
.continue{flex:1 1 0; min-width:0; background:var(--card); border:1px solid var(--line); border-radius:var(--radius); padding:20px 22px; display:flex; flex-direction:column; gap:6px}
.continue .ctitle{font-size:1.25rem; font-weight:700}
.continue .csub{color:var(--ink2)}
.continue .cbtns{display:flex; gap:10px; flex-wrap:wrap; margin-top:10px}
.exam-card{width:220px; flex:none; text-align:left; background:var(--ink); color:#fff; border-radius:var(--radius); padding:20px 22px; display:flex; flex-direction:column; gap:6px}
.exam-card .overline{color:#c7cdd8}
.exam-card .ebig{font-size:1.9rem; font-weight:700; line-height:1.1}
.exam-card .esub{font-size:.88rem; color:#c7cdd8}
/* The white "Start" pill: an explicit full-width block with its own padding. iPad Safari does not
   reliably stretch a flex child inside a <button>, and the text spilled out of a shrunken pill. */
.exam-card .ego{display:block; align-self:stretch; width:100%; box-sizing:border-box; margin-top:auto; padding:12px 10px; min-height:44px; border-radius:12px; background:#fff; color:var(--ink); font-weight:600; text-align:center; line-height:1.3}
@media(max-width:600px){.home-top{flex-direction:column}.exam-card{width:auto}}
.home-sec{margin-bottom:28px}
.sechead{display:flex; align-items:baseline; gap:10px; flex-wrap:wrap; margin-bottom:14px}
.sechead h2{font-size:1.25rem; font-weight:700}
.sechead span{color:var(--muted); font-size:.9rem}
.grid{display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px}
@media(max-width:560px){.grid{grid-template-columns:minmax(0,1fr)}}
.topic{background:var(--card); border:1px solid var(--line); border-radius:var(--radius); overflow:hidden; display:flex; flex-direction:column; color:var(--ink)}
.topic .img{display:block; width:100%; height:150px; flex:none; padding:0; background:var(--soft) center/cover no-repeat}
.topic .body{padding:16px 18px 14px; display:flex; flex-direction:column; gap:10px; flex:1}
.tmeta{display:flex; align-items:center; gap:8px}
.tnum{font-size:.82rem; font-weight:600; color:var(--muted); flex:1}
.stars{color:var(--gold); letter-spacing:2px}
.topic .ttl{font-size:1.12rem; font-weight:700; line-height:1.25; min-height:2.5em}
.tprog{display:flex; align-items:center; gap:10px; font-size:.82rem; color:var(--muted)}
.tprog .bar{flex:1; height:8px; border-radius:999px; background:var(--soft2); overflow:hidden}
.tprog .bar i{display:block; height:100%; background:var(--accent); border-radius:999px}
.tprog span{min-width:78px; text-align:right}
.tmain{display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px}
.tmain button{min-height:44px; border-radius:12px; font-size:.95rem; font-weight:600}
.tmain .learn{background:var(--card); border:1px solid var(--line2); color:var(--ink)}
.tmain .test{background:var(--accent); color:#fff}
.tmore{display:flex; gap:2px; margin:0 -6px}
.tmore button{flex:1 1 0; min-width:0; min-height:52px; padding:4px 0; background:transparent; color:var(--ink2); font-size:.76rem; font-weight:500; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; border-radius:10px}
.tmore button:hover{background:var(--soft)}
.morelist{background:var(--card); border:1px solid var(--line); border-radius:var(--radius); display:flex; flex-direction:column; overflow:hidden}
.morerow{display:flex; align-items:center; gap:16px; padding:16px 20px; text-align:left; background:transparent; color:var(--ink); border-bottom:1px solid var(--soft2)}
.morerow:last-child{border-bottom:none}
.morerow:hover{background:#fbfaf6}
.morerow > .ic{color:#8a93a3; flex:none}
.mricon{width:44px; height:44px; border-radius:12px; display:grid; place-items:center; flex:none}
.mr-pod .mricon{background:#e8eefc; color:#3451b2}
.mr-words .mricon{background:#f1e9fb; color:#7a3fc0}
.mr-lb .mricon{background:#fdf0dc; color:#a35a00}
.mrtext{display:flex; flex-direction:column; gap:2px; flex:1; min-width:0}
.mrtitle{font-weight:600}
.mrsub{font-size:.88rem; color:var(--muted)}

/* Topic (learn) screen */
.tophead{display:flex; align-items:center; gap:12px; margin-bottom:16px}
.backlink{min-height:44px; padding:0 14px 0 8px; border-radius:12px; border:1px solid var(--line); background:var(--card); color:var(--ink); font-weight:600; display:flex; align-items:center; gap:4px}
.backlink svg{width:20px; height:20px}
.ttlblock{display:flex; flex-direction:column; gap:4px; margin-bottom:14px}
.ttlblock h1{font-size:1.75rem; font-weight:700; letter-spacing:-.01em; line-height:1.2}
.tabs{display:flex; gap:6px; flex-wrap:wrap; border-bottom:1px solid var(--line); padding-bottom:12px; margin-bottom:16px}
.tab{min-height:44px; padding:0 16px; border-radius:12px; background:transparent; color:var(--ink2); font-size:.95rem; font-weight:600}
.tab:hover{background:var(--soft)}
.tab.on{background:var(--accent); color:#fff}
.cardprog{display:flex; align-items:center; gap:12px; margin-bottom:14px; font-size:.9rem; font-weight:600; color:var(--ink2)}
.segs{flex:1; display:grid; gap:6px}
.seg{height:6px; border-radius:999px; background:var(--line)}
.seg.on{background:var(--accent)}
.readbtn{min-height:44px; padding:0 14px; border-radius:12px; border:1px solid var(--line2); background:var(--card); color:var(--ink); font-size:.88rem; font-weight:600; flex:none; margin-left:auto}

/* Quiz */
.progress{height:10px; background:var(--soft2); border-radius:999px; overflow:hidden; margin-bottom:14px}
.progress > i{display:block; height:100%; width:0; background:var(--accent); transition:width .4s}
.qhead{display:flex; justify-content:space-between; align-items:center; gap:10px; flex-wrap:wrap; color:var(--ink); font-weight:700; margin-bottom:12px}
.streak{background:var(--card); border:1px solid var(--line); padding:6px 12px; border-radius:999px; font-size:.85rem}
.qcard{background:var(--card); border-radius:var(--radius); border:1px solid var(--line); padding:24px}
.qtype{display:inline-block; font-size:.72rem; font-weight:800; letter-spacing:.5px; text-transform:uppercase; color:var(--accent); background:var(--accent-soft); padding:4px 10px; border-radius:999px; margin-bottom:10px}
.qtext{font-size:1.3rem; font-weight:700; line-height:1.25; margin-bottom:16px}
.opts{display:grid; gap:12px}
.mc2{grid-template-columns:1fr 1fr}
@media(max-width:560px){.mc2{grid-template-columns:1fr}}
.opt{display:flex; align-items:center; gap:12px; background:var(--soft); border:3px solid transparent; border-radius:16px; padding:14px 16px; font-size:1.08rem; font-weight:700; text-align:left; color:var(--ink); transition:transform .1s, background .15s, border-color .15s}
.opt:hover{background:var(--soft2); transform:translateY(-1px)}
.opt .key{width:30px; height:30px; flex:none; border-radius:8px; background:#fff; display:grid; place-items:center; font-weight:800; color:var(--bg2); box-shadow:0 2px 6px rgba(0,0,0,.08)}
.opt.correct{background:#dcfce7; border-color:var(--good)}
.opt.wrong{background:#fee2e2; border-color:var(--bad)}
.opt.disabled{pointer-events:none; opacity:.85}
.tf{font-size:1.3rem; padding:22px}

/* Sort */
.bins{display:grid; gap:12px; margin-top:6px}
.bin{background:var(--soft); border:2px dashed var(--line2); border-radius:16px; padding:12px; min-height:74px}
.bin h4{font-size:.95rem; color:var(--bg2); margin-bottom:8px; text-align:center; text-transform:uppercase; letter-spacing:.5px}
.bin .drop{display:flex; flex-wrap:wrap; gap:8px; min-height:34px; justify-content:center}
.pool{display:flex; flex-wrap:wrap; gap:10px; justify-content:center; margin:6px 0 4px}
.tok{background:#fff; border:2px solid var(--line2); border-radius:999px; padding:9px 16px; font-weight:800; font-size:1rem; box-shadow:0 3px 8px rgba(0,0,0,.08); transition:transform .1s}
.tok:hover{transform:translateY(-2px)}
.tok.sel{outline:4px solid var(--gold); transform:translateY(-2px)}
.tok.ok{background:#dcfce7; border-color:var(--good)}
.tok.no{background:#fee2e2; border-color:var(--bad)}
.hint-tap{color:var(--muted); font-size:.85rem; text-align:center; margin:8px 0}

/* Order */
.orderlist{display:flex; flex-direction:column; gap:10px}
.ord{display:flex; align-items:center; gap:12px; background:var(--soft); border-radius:16px; padding:10px 12px; font-weight:800; font-size:1.05rem}
.ord .pos{width:30px; height:30px; flex:none; border-radius:50%; background:var(--bg2); color:#fff; display:grid; place-items:center}
.ord .arrows{margin-left:auto; display:flex; gap:6px}
.ord .arrows button{width:38px; height:38px; border-radius:10px; background:#fff; box-shadow:0 2px 6px rgba(0,0,0,.1); font-size:1.1rem; font-weight:800; color:var(--bg2)}
.ord.ok{background:#dcfce7} .ord.no{background:#fee2e2}

/* Blank */
.sentence{font-size:1.25rem; font-weight:800; line-height:1.6; margin-bottom:14px}
.blank{display:inline-block; min-width:120px; border-bottom:4px dotted var(--bg2); padding:0 8px; color:var(--accent)}
.bank{display:flex; flex-wrap:wrap; gap:10px; justify-content:center}

/* Feedback */
.feedback{margin-top:16px; border-radius:16px; padding:14px 16px; font-weight:700; display:none; align-items:flex-start; gap:12px}
.feedback.show{display:flex; animation:pop .3s}
.feedback.good{background:#dcfce7; color:#176a3a}
.feedback.bad{background:#fee2e2; color:#9b1c1c}
.feedback .em{font-size:1.6rem}
.actions{display:flex; justify-content:space-between; gap:10px; margin-top:16px}
.btn{background:var(--accent); color:#fff; font-weight:600; min-height:48px; padding:12px 24px; border-radius:14px; font-size:1rem}
.btn.ghost{background:var(--card); color:var(--ink); border:1px solid var(--line2)}
.btn.go{background:var(--good)}
.btn.big{font-size:1.05rem; padding:14px 30px}
.btn:disabled{opacity:.45; cursor:not-allowed}
.btn.check{background:var(--good)}

/* Results */
.result{text-align:center}
.result .actions{flex-wrap:wrap}
.result .ring{width:170px; height:170px; margin:6px auto 8px; position:relative}
.result .ring svg{transform:rotate(-90deg)}
.result .ring .pct{position:absolute; inset:0; display:grid; place-items:center; font-size:2.2rem; font-weight:800; color:var(--bg2)}
.result h2{font-size:1.8rem; margin:6px 0}
.bigstars{font-size:2.4rem; letter-spacing:6px; color:var(--gold); margin:6px 0}
.badge{display:inline-flex; gap:8px; align-items:center; background:var(--gold); color:#7a5b00; font-weight:800; padding:10px 18px; border-radius:999px; margin:8px 0}
.review{text-align:left; margin-top:18px; display:grid; gap:10px}
.rev{background:var(--soft); border-radius:14px; padding:12px 14px; border-left:6px solid var(--good)}
.rev.miss{border-left-color:var(--bad)}
.rev .q{font-weight:800}
.rev .a{font-size:.92rem; color:var(--muted); margin-top:4px}

/* Confetti */
#confetti{position:fixed; inset:0; pointer-events:none; z-index:60}

/* Mascot pop */
.mascot-pop{position:fixed; left:50%; bottom:26px; transform:translateX(-50%); z-index:55; display:flex; align-items:flex-end; gap:10px; animation:pop .3s}
.mascot-pop img{width:90px; height:90px; border-radius:50%; background:#fff; box-shadow:var(--shadow)}
.mascot-pop .bubble{background:#fff; border-radius:16px; padding:10px 16px; font-weight:800; box-shadow:var(--shadow); max-width:240px}
.shake{animation:shake .5s}
@keyframes shake{0%,100%{transform:translateX(0)}20%{transform:translateX(-8px)}40%{transform:translateX(8px)}60%{transform:translateX(-6px)}80%{transform:translateX(6px)}}
.bounce{animation:bounce .6s}
@keyframes bounce{0%,100%{transform:translateY(0)}30%{transform:translateY(-16px)}60%{transform:translateY(-6px)}}

/* Experiment screen */
.expcard{background:var(--card); border-radius:var(--radius); border:1px solid var(--line); padding:20px; margin-bottom:16px}
.expcard .ehead{display:flex; align-items:center; gap:14px; margin-bottom:8px}
.expcard .eicon{font-size:2.4rem; flex:0 0 auto}
.expcard h2{font-size:1.4rem; line-height:1.15}
.expcard .etop{color:var(--muted); font-weight:600; font-size:.9rem; display:flex; align-items:center; gap:8px; margin-bottom:6px}
.esec{margin-top:16px}
.esec h4{font-size:1.02rem; margin-bottom:8px; display:flex; align-items:center; gap:7px}
.epred{background:#fff7e6; border-radius:12px; padding:12px 14px; font-weight:700}
.ewhy{background:var(--accent-soft); border-radius:12px; padding:12px 14px; font-weight:600}
.eneed{display:flex; flex-wrap:wrap; gap:8px}
.eneed span{background:var(--soft); border-radius:999px; padding:6px 13px; font-weight:700; font-size:.9rem}
.esteps{counter-reset:st; display:flex; flex-direction:column; gap:10px}
.esteps .stp{display:flex; gap:12px; align-items:flex-start; font-weight:600}
.esteps .stp::before{counter-increment:st; content:counter(st); flex:0 0 auto; width:28px; height:28px; border-radius:50%; background:var(--bg2); color:#fff; font-weight:800; display:flex; align-items:center; justify-content:center; font-size:.95rem}
.edone{font-weight:800; color:#16794a; text-align:center; margin-top:6px}
/* Word Lab */
.wlchips{display:flex; flex-wrap:wrap; gap:8px; margin-bottom:16px; justify-content:center}
.wlchip{border:1px solid var(--line2); background:var(--card); border-radius:999px; min-height:40px; padding:6px 15px; font-weight:600; font-size:.9rem; cursor:pointer; color:var(--ink2)}
.wlchip.on{background:var(--accent); border-color:var(--accent); color:#fff}
.wlgrid{display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:12px}
.wcard{perspective:1000px; min-height:120px; cursor:pointer}
.wcard .win{position:relative; width:100%; height:100%; min-height:120px; transform-style:preserve-3d; transition:transform .5s}
.wcard.flipped .win{transform:rotateY(180deg)}
.wface{position:absolute; inset:0; backface-visibility:hidden; border-radius:16px; padding:12px; display:flex; align-items:center; justify-content:center; text-align:center; border:1px solid var(--line)}
.wfront{background:var(--card); font-weight:800; font-size:1.05rem; color:var(--bg2)}
.wback{background:var(--accent-soft); transform:rotateY(180deg); font-weight:600; font-size:.86rem; line-height:1.3}
/* Leaderboard */
.lbchips{display:flex; flex-wrap:wrap; gap:8px; justify-content:center; margin-bottom:14px}
.lbchip{border:1px solid var(--line2); border-radius:999px; min-height:40px; padding:6px 14px; font-weight:600; font-size:.85rem; cursor:pointer; background:var(--card); color:var(--ink2)}
.lbchip.on{background:var(--accent); border-color:var(--accent); color:#fff}
.lblist{display:flex; flex-direction:column; gap:8px}
.lbrow{display:flex; align-items:center; gap:12px; background:var(--soft); border-radius:12px; padding:10px 14px}
.lbrow.me{background:#fff3c4; box-shadow:inset 4px 0 0 #f59e0b}
.lbrk{flex:0 0 auto; width:34px; font-size:1.15rem; font-weight:800; text-align:center}
.lbnm{flex:1; font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.lbval{flex:0 0 auto; font-weight:800; color:var(--bg2)}
.lbnick{width:100%; padding:10px 12px; border:2px solid var(--line2); border-radius:12px; font-weight:700; font-size:1rem; box-sizing:border-box}
.lbname-row label{cursor:pointer}
/* Science Lab (interactive) */
.lab-hero{position:relative; border-radius:18px; overflow:hidden; box-shadow:var(--shadow); margin-bottom:14px; aspect-ratio:16/7; background:linear-gradient(120deg,#1e2a5a,#3b2a6a)}
.lab-hero img{width:100%; height:100%; object-fit:cover; display:block}
.lab-hero-cap{position:absolute; left:16px; bottom:12px; color:#fff; font-weight:800; font-size:1.5rem; text-shadow:0 2px 10px rgba(0,0,0,.6)}
.lab-box{background:radial-gradient(circle at 50% 30%,#16203f,#0b1020); border-radius:18px; overflow:hidden; height:300px; box-shadow:var(--shadow); position:relative}
#labCanvas{width:100%; height:100%; display:block}
.lab-thermo{position:absolute; top:10px; right:12px; color:#fff; font-weight:800; font-size:.95rem; background:rgba(0,0,0,.35); padding:5px 11px; border-radius:999px}
.lab-controls{margin-top:14px}
.lab-temp-row{display:flex; align-items:center; gap:12px; font-weight:800}
.lab-temp-row input{flex:1}
.lab-btns{display:flex; gap:10px; justify-content:center; margin-top:12px; flex-wrap:wrap}
.lab-caption{margin-top:16px; background:var(--card); border-radius:16px; padding:16px 18px; border:1px solid var(--line)}
.lab-state{font-size:1.35rem; font-weight:800}
.lab-desc{font-weight:600; margin-top:6px; color:#3a4252; line-height:1.4}
.plant-slider{display:flex; align-items:center; gap:12px; margin-bottom:9px; font-weight:800}
.plant-slider label{flex:0 0 108px}
.plant-slider input{flex:1}
/* Food-chain builder (Living things lab) */
.fc-chain{display:flex; align-items:center; justify-content:center; gap:2px; flex-wrap:wrap; margin:14px 0 30px}
.fc-slot{width:72px; height:72px; border-radius:16px; border:3px dashed #cbd5e1; display:flex; align-items:center; justify-content:center; font-size:2.1rem; background:#fff; cursor:pointer; position:relative}
.fc-slot.filled{border-style:solid; border-color:#b9c2d6}
.fc-slot.ok{border-color:#22c55e; background:#dcfce7}
.fc-slot.bad{border-color:#ef4444; background:#fee2e2; animation:fcshake .4s}
@keyframes fcshake{0%,100%{transform:translateX(0)}25%{transform:translateX(-5px)}75%{transform:translateX(5px)}}
.fc-lbl{position:absolute; bottom:-19px; left:0; right:0; text-align:center; font-size:.6rem; font-weight:800; color:#64748b}
.fc-arrow{font-size:1.5rem; color:#b9c2d6; padding:0 2px}
.fc-arrow.flow{color:#22c55e; animation:fcpulse 1s infinite}
@keyframes fcpulse{0%,100%{opacity:.4; transform:scale(1)}50%{opacity:1; transform:scale(1.25)}}
.fc-pool{display:flex; gap:10px; flex-wrap:wrap; justify-content:center; min-height:64px}
.fc-chip{font-size:1.9rem; width:64px; height:64px; border-radius:16px; border:2px solid var(--line2); background:var(--soft); cursor:pointer; transition:transform .1s}
.fc-chip:hover{transform:translateY(-3px)}

/* Learn mode */
.lbanner{height:176px; border-radius:20px; background:var(--soft) center/cover no-repeat; margin-bottom:16px}
.lcard{background:var(--card); border-radius:20px; border:1px solid var(--line); padding:26px 28px; min-height:240px; animation:pop .3s}
.lhead{display:flex; align-items:center; gap:14px; margin-bottom:14px}
.licon{width:48px; height:48px; border-radius:14px; background:var(--soft); display:grid; place-items:center; font-size:1.6rem; flex:none}
.ltitle{font-size:1.45rem; font-weight:700; line-height:1.2}
.ltext{font-size:1.2rem; line-height:1.6; color:var(--ink); font-weight:400}
.keys{display:flex; flex-wrap:wrap; gap:8px; margin-top:16px}
.keychip{background:var(--soft); border:1px solid var(--line); color:var(--ink); font-weight:600; padding:7px 14px; border-radius:999px; font-size:.95rem}
.keylabel{font-size:.8rem; color:var(--muted); width:100%; font-weight:600; text-transform:uppercase; letter-spacing:.5px; margin-bottom:-4px}

/* Flip card */
.flip-hint{text-align:center; color:var(--muted); font-weight:600; margin-bottom:10px}
.flipwrap{perspective:1200px}
.flipcard{position:relative; transform-style:preserve-3d; transition:transform .55s; min-height:190px; cursor:pointer}
.flipcard.flipped{transform:rotateY(180deg)}
.face{position:absolute; inset:0; -webkit-backface-visibility:hidden; backface-visibility:hidden; border-radius:18px; padding:22px; display:flex; flex-direction:column; justify-content:center; align-items:center; text-align:center}
.face .fq{font-size:1.25rem; font-weight:800; line-height:1.35}
.face .tag{font-size:.78rem; font-weight:800; text-transform:uppercase; letter-spacing:.5px; margin-bottom:10px; opacity:.7}
.front{background:var(--accent-soft); color:var(--ink)}
.back{background:#dcfce7; color:#176a3a; transform:rotateY(180deg)}

/* Tap activity */
.tapgrid{display:flex; flex-wrap:wrap; gap:11px; justify-content:center; margin-top:16px}
.tapitem{background:#fff; border:2px solid var(--line2); border-radius:14px; padding:12px 18px; font-weight:800; font-size:1.05rem; box-shadow:0 3px 8px rgba(0,0,0,.08); transition:transform .1s}
.tapitem:hover{transform:translateY(-2px)}
.tapitem.ok{background:#dcfce7; border-color:var(--good); color:#176a3a}
.tapitem.no{background:#fee2e2; border-color:var(--bad); color:#9b1c1c}
.tapdone{text-align:center; font-weight:800; color:var(--good); margin-top:14px; display:none}
.tapdone.show{display:block; animation:pop .3s}
.lnav{display:flex; align-items:center; gap:10px; margin-top:18px}

/* Lesson step cards (say / ask) and their pictures (js/lesson.js) */
.lask{font-weight:700; margin-bottom:16px}
.lnum{display:flex; gap:10px; align-items:stretch}
.lnum .write-in{flex:1 1 auto; min-width:0; max-width:260px}
.lnum .btn{flex:none}
.lcard .feedback{margin-top:16px}
.lexplain{font-weight:600; margin-top:4px}
.lvis{margin-top:16px; background:var(--soft); border-radius:16px; padding:14px; overflow:hidden}
.lv-blocks{display:flex; flex-wrap:wrap; align-items:flex-end; justify-content:center; gap:8px}
.lv-blk{display:flex; align-items:center; justify-content:center; min-width:56px; padding:0 12px; border-radius:10px; color:#fff; font-weight:700; font-size:1.1rem}
.lv-p0{background:#2b8a3e} .lv-p1{background:#d9480f} .lv-p2{background:#3b5bdb} .lv-p3{background:#862e9c}
.lv-op{font-size:1.4rem; font-weight:700; color:var(--muted); align-self:center}
.lv-total{font-size:1.9rem; font-weight:700; align-self:center}
.lv-line{display:block; width:100%; max-width:480px; margin:0 auto}
.lv-line text{font-family:inherit; text-anchor:middle}
.lv-axis{stroke:var(--ink); stroke-width:2}
.lv-mark{font-size:12px; font-weight:700; fill:var(--ink)}
.lv-jump{fill:none; stroke:#3b82c4; stroke-width:2.5}
.lv-jl{font-size:13px; font-weight:800; fill:#2f6fae}
.lv-dot{fill:#3b82c4}
.lv-grid{display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); background:#fff; border:2px solid var(--line2); border-radius:12px; overflow:hidden; text-align:center}
.lv-ph{background:var(--accent-soft); padding:4px 0; font-size:.8rem; font-weight:700; color:var(--ink2)}
.lv-dg{border-top:2px solid var(--line2); min-height:56px; display:grid; place-items:center; font-size:1.6rem; font-weight:700; animation:lvslide .35s ease}
.lv-dg + .lv-dg, .lv-ph + .lv-ph{border-left:1px solid var(--line)}
@keyframes lvslide{from{transform:translateX(var(--from,0))}}
.lv-btns{display:flex; flex-wrap:wrap; gap:8px; justify-content:center; margin-top:12px}
.lv-btns .btn{min-height:44px; padding:8px 16px}

/* Progress / stats page */
.pmascot{display:flex; gap:14px; align-items:center; background:var(--card); border-radius:var(--radius); padding:16px 20px; border:1px solid var(--line); margin-bottom:16px}
.pmascot img{width:72px; height:72px; border-radius:18px; flex:none; object-fit:cover}
.pmascot .msg{font-weight:500; color:var(--ink); font-size:1.02rem; line-height:1.4}
.statgrid{display:grid; grid-template-columns:repeat(auto-fit,minmax(120px,1fr)); gap:12px; margin-bottom:16px}
.stat{background:var(--card); border-radius:18px; padding:14px 10px; border:1px solid var(--line); text-align:center}
.stat .v{font-size:1.7rem; font-weight:800; color:var(--bg2); line-height:1}
.stat .l{font-size:.78rem; color:var(--muted); font-weight:800; margin-top:5px}
.pcard{background:var(--card); border-radius:var(--radius); border:1px solid var(--line); padding:18px 20px; margin-bottom:16px}
.pcard h3{font-size:1.2rem; margin-bottom:14px; display:flex; align-items:center; gap:8px}
/* Final Mock Exam highlight card */
.mockcard{background:var(--card); border:1px solid var(--line); position:relative; overflow:hidden}
.mockcard::before{content:"FINAL EXAM"; position:absolute; top:11px; right:-34px; transform:rotate(45deg); background:var(--accent); color:#fff; font-size:.62rem; font-weight:800; letter-spacing:.5px; padding:3px 38px}
.mockrow{display:flex; align-items:center; gap:16px; flex-wrap:wrap; margin-bottom:14px}
.mockbig{text-align:center; min-width:104px}
.mockbig .mv{font-size:2.6rem; font-weight:700; line-height:1; color:var(--accent)}
.mockbig .ml{font-size:.78rem; color:var(--muted); font-weight:800; margin-top:4px}
.mockmeta{flex:1 1 180px; display:flex; flex-direction:column; gap:7px; align-items:flex-start}
.mocklast{color:var(--muted); font-weight:700; font-size:.86rem}
.ritem.mock{background:var(--accent-soft)}
.mastery{display:flex; flex-direction:column; gap:14px}
.mrow{display:flex; align-items:center; gap:10px 12px; flex-wrap:wrap}
.mrow .mname{font-weight:800; flex:1 1 140px; min-width:120px}
.mrow .mname small{display:block; color:var(--muted); font-weight:700; font-size:.74rem}
.mbarwrap{flex:2 1 160px; display:flex; align-items:center; gap:8px; min-width:150px}
.mbar{flex:1; height:12px; background:var(--soft2); border-radius:999px; overflow:hidden}
.mbar > i{display:block; height:100%; width:0; border-radius:999px; transition:width .7s ease}
.mpct{font-weight:800; width:42px; text-align:right; font-size:.95rem}
.mtrend{font-size:.85rem; font-weight:800; width:18px; text-align:center}
.mstatus{font-size:.74rem; font-weight:800; padding:4px 10px; border-radius:999px; white-space:nowrap}
.mact{display:flex; gap:6px; flex:0 0 auto}
.mact button{min-height:40px; padding:7px 12px; border-radius:11px; font-weight:600; font-size:.84rem; color:#fff; background:var(--accent)}
.mact .ml{background:var(--soft); color:var(--ink)}
.focusitem{display:flex; align-items:center; gap:10px; flex-wrap:wrap; padding:10px 0; border-bottom:1px solid var(--soft2)}
.focusitem:last-child{border-bottom:none}
.weakrow{display:flex; align-items:center; gap:12px; flex-wrap:wrap; justify-content:space-between; font-weight:600; color:var(--muted); font-size:.92rem}
.weakrow span{flex:1 1 220px}
.focusbox .weakrow{margin-top:14px; padding-top:14px; border-top:1px solid var(--soft2)}
#grownBody{margin-top:16px}
#grownBody h4{margin:20px 0 10px; font-size:1rem}
.gnote{color:var(--muted); font-weight:600; font-size:.88rem; margin-bottom:12px}
.gsum{display:flex; gap:8px 22px; flex-wrap:wrap; font-weight:600; font-size:.92rem}
.grow{display:flex; align-items:center; gap:4px 10px; flex-wrap:wrap; margin-bottom:12px}
.grow .gname{flex:1 1 100%; min-width:0; font-weight:700; font-size:.92rem}
.grow .gname small{display:block; color:var(--muted); font-weight:600; font-size:.76rem}
.grow .mbar{flex:1 1 40%}
.grow .mpct{width:42px; text-align:right; font-weight:700; font-size:.88rem}
.gtrip{padding:10px 0; border-bottom:1px solid var(--soft2)}
.gtrip:last-child{border-bottom:none}
.gtrip .gq{font-weight:700}
.gtrip .ga{font-weight:600; color:#176a3a; font-size:.9rem; margin-top:2px}
.gtrip .gm{color:var(--muted); font-weight:600; font-size:.78rem; margin-top:2px}
.focusitem .fi-name{font-weight:800; flex:1 1 140px}
.recent{display:flex; flex-direction:column; gap:8px}
.ritem{display:flex; justify-content:space-between; align-items:center; gap:10px; background:var(--soft); border-radius:12px; padding:10px 13px}
.ritem .rl{font-weight:800; font-size:.92rem}
.ritem .rd{color:var(--muted); font-size:.78rem; font-weight:700}
.ritem .rp{font-weight:800; font-size:1rem; padding:3px 11px; border-radius:999px}
.pempty{background:var(--card); border-radius:var(--radius); border:1px solid var(--line); padding:30px 22px; text-align:center}
.pempty .big{font-size:1.3rem; font-weight:800; margin:10px 0 6px}

/* Podcast player */
.podcard{background:var(--card); border-radius:var(--radius); border:1px solid var(--line); padding:22px; max-width:620px; margin:0 auto}
.podhero{display:flex; align-items:center; gap:16px; margin-bottom:18px}
.podart{width:84px; height:84px; flex:none; border-radius:20px; background:#e8eefc; display:grid; place-items:center; font-size:2.6rem}
.podtitle{font-size:1.4rem; font-weight:800; line-height:1.1}
.podsub{color:var(--muted); font-weight:500; margin-top:4px}
.podtime{display:flex; justify-content:space-between; font-weight:800; color:var(--muted); font-size:.9rem}
.podseek{width:100%; height:10px; -webkit-appearance:none; appearance:none; background:var(--soft2); border-radius:999px; outline:none; cursor:pointer; margin:6px 0 4px; accent-color:var(--bg2)}
.podseek::-webkit-slider-thumb{-webkit-appearance:none; appearance:none; width:22px; height:22px; border-radius:50%; background:var(--bg2); box-shadow:0 2px 6px rgba(0,0,0,.25); cursor:pointer}
.podseek::-moz-range-thumb{width:22px; height:22px; border:none; border-radius:50%; background:var(--bg2); box-shadow:0 2px 6px rgba(0,0,0,.25); cursor:pointer}
.podctrls{display:flex; align-items:center; justify-content:center; gap:22px; margin:14px 0 6px}
.playbtn{width:84px; height:84px; border-radius:50%; background:var(--accent); color:#fff; font-size:2rem; display:grid; place-items:center; transition:transform .1s}
.playbtn:hover{transform:scale(1.06)}
.skipbtn{width:58px; height:58px; border-radius:50%; background:var(--soft); color:var(--ink); font-size:1.2rem; font-weight:800; box-shadow:0 3px 8px rgba(0,0,0,.1); position:relative; display:grid; place-items:center; line-height:1}
.skipbtn span{position:absolute; bottom:9px; font-size:.6rem; font-weight:800}
.podextra{display:flex; align-items:center; justify-content:space-between; margin-top:8px; min-height:34px}
.speedbtn{background:var(--soft); color:var(--ink); min-height:40px; font-weight:800; padding:8px 16px; border-radius:999px; font-size:.9rem}
.podresume{color:var(--good); font-weight:800; font-size:.85rem}
.podlist{margin-top:18px; border-top:1px solid var(--soft2); padding-top:14px}
.podlist-h{font-weight:800; margin-bottom:10px}
.podchips{display:flex; flex-wrap:wrap; gap:8px}
.podchip{background:var(--soft); border-radius:999px; padding:8px 14px; font-weight:600; font-size:.86rem; color:var(--ink); cursor:pointer; transition:transform .1s}
.podchip:hover{background:var(--soft2)}
.podchip-t{color:var(--bg2); margin-left:4px; font-size:.78rem}
.podchip.active{background:var(--bg2); color:#fff}
.podchip.active .podchip-t{color:#fff}
.podnow{display:inline-block; background:#e0f2fe; color:#0a5e7a; font-weight:800; padding:6px 14px; border-radius:999px; margin-bottom:12px; font-size:.92rem}
.resultpod{margin:12px auto 2px; display:flex; gap:10px; align-items:center; justify-content:center; flex-wrap:wrap; background:#e0f2fe; border-radius:16px; padding:12px 16px; max-width:480px; color:#0a5e7a; font-weight:700}
.resultpod button{flex:none}
/* Passcode gate */
#gate{position:fixed; inset:0; z-index:200; background:var(--paper); display:flex; align-items:center; justify-content:center; padding:20px}
#gate.hidden{display:none}
.gate-card{background:#fff; border-radius:24px; border:1px solid var(--line); box-shadow:var(--shadow); padding:34px 30px; text-align:center; max-width:360px; width:100%; animation:pop .35s ease}
.gate-img{width:110px; height:110px; border-radius:50%; object-fit:cover; background:#eef3ff}
.gate-title{font-size:1.5rem; font-weight:700; color:var(--ink); margin:12px 0 4px}
.gate-sub{color:var(--muted); font-weight:500; margin:0 0 18px}
.gate-card input{width:100%; padding:14px 16px; border-radius:14px; border:3px solid #dfe4f5; font-size:1.15rem; font-family:inherit; text-align:center; outline:none}
.gate-card input:focus{border-color:#9b7bff}
.gate-btn{margin-top:14px; width:100%; background:var(--accent); color:#fff; font-weight:600; font-size:1.05rem; padding:14px; border-radius:14px; cursor:pointer; border:none; font-family:inherit}
.gate-err{color:#ef4444; font-weight:800; margin-top:12px; min-height:20px}
.gate-shake{animation:shake .5s}
.google-btn{display:flex; align-items:center; justify-content:center; gap:10px; background:#fff; color:#3c4043; border:2px solid #dadce0}
.google-btn:disabled{opacity:.55; cursor:default}
.google-btn .gicon{display:inline-grid; place-items:center; width:24px; height:24px; border-radius:50%; background:conic-gradient(#ea4335 0 25%,#fbbc05 0 50%,#34a853 0 75%,#4285f4 0 100%); color:#fff; font-weight:900; font-size:.95rem}
.gate-status{color:var(--muted); font-weight:500; font-size:.85rem; margin-top:12px; min-height:18px}
.gate-link{display:inline-block; margin-top:14px; min-height:44px; background:none; color:var(--ink2); font-weight:600; text-decoration:underline; font-size:.9rem; cursor:pointer; font-family:inherit; border:none}
.io-modal{position:fixed; inset:0; z-index:210; background:rgba(20,18,50,.55); display:flex; align-items:center; justify-content:center; padding:18px}
.io-modal.hidden{display:none}
.io-card{background:#fff; border-radius:22px; box-shadow:0 20px 50px rgba(40,30,90,.35); padding:22px; max-width:460px; width:100%; animation:pop .3s ease}
.io-card h3{font-size:1.25rem; margin-bottom:6px}
.io-help{color:var(--muted); font-weight:700; font-size:.9rem; margin:0 0 12px}
.io-text{width:100%; height:120px; box-sizing:border-box; border:2px solid var(--line2); border-radius:14px; padding:12px; font-family:monospace; font-size:.82rem; resize:vertical; outline:none}
.io-text:focus{border-color:var(--bg2)}
.io-status{font-weight:800; font-size:.9rem; margin-top:10px; min-height:18px; color:var(--good)}
.io-actions{display:flex; justify-content:flex-end; gap:10px; margin-top:14px}
.verlabel{position:fixed; bottom:6px; right:8px; z-index:1000; font-size:10px; font-weight:800; color:#fff; background:rgba(0,0,0,.3); padding:3px 9px; border-radius:999px; pointer-events:none; font-family:system-ui,sans-serif; letter-spacing:.3px}

/* Circuit lab (Year 4 Electricity) */
.cl-board{background:#f6f4ee; border:1px solid var(--line); border-radius:18px; margin-top:14px; padding:8px}
.cl-board svg{display:block; width:100%; height:auto}
.cl-flow{animation:clflow 1.6s linear infinite}
@keyframes clflow{to{stroke-dashoffset:-48}}
.cl-ctrls{display:flex; flex-wrap:wrap; gap:12px; align-items:center; justify-content:center; margin-top:14px}
.cl-group{display:flex; align-items:center; gap:8px; background:var(--card); border:1px solid var(--line); border-radius:14px; padding:6px 10px}
.cl-group span{font-weight:600; color:var(--ink2); margin-right:4px}
.cl-group .btn{min-height:44px; min-width:44px; padding:0; font-size:1.3rem}
.cl-group b{min-width:20px; text-align:center; font-size:1.15rem}
.mat-tray{display:grid; grid-template-columns:repeat(auto-fill,minmax(110px,1fr)); gap:8px; margin-top:8px}
.mat{min-height:64px; border-radius:14px; border:1px solid var(--line2); background:var(--card); font-size:.82rem; font-weight:600; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; padding:6px}
.mat .me{font-size:1.5rem}
.mat.on{border:2px solid var(--accent); background:var(--accent-soft)}
.mat.done{opacity:.75}
.cl-predict{display:flex; flex-wrap:wrap; gap:10px; align-items:center; justify-content:center; margin-top:14px; text-align:center}
.cl-predict span{flex:1 1 100%; font-weight:600}
.cl-table{margin-top:16px}
.cl-rows{display:flex; flex-direction:column; gap:6px}
.cl-row{display:grid; grid-template-columns:1.4fr 1fr 1.4fr; gap:8px; align-items:center; background:var(--soft); border-radius:10px; padding:8px 12px; font-size:.9rem}
.cl-row .ok{color:var(--good); font-weight:600}
.cl-row .no{color:var(--bad); font-weight:600}
@media(max-width:480px){.cl-row{grid-template-columns:1fr; gap:2px}}

/* Body lab (Year 4 Living things) */
#bodySvg{max-height:520px}
.bone-ask{text-align:center; font-size:1.15rem; margin-top:14px}
.bone-ask span{display:block; font-size:.85rem; color:var(--muted); margin-top:2px}
.bonepart:hover{opacity:.85}
.lab-temp-row input[type=range]{accent-color:var(--accent)}
#rustSvg{max-height:340px}

/* ---- Year 4 unit 2 lab (t2-energy.css) ---- */
/* ---- Energy lab (Year 4 unit 2): energy chains + food chains ---- */
.en-tabs{display:flex; flex-wrap:wrap; gap:8px; justify-content:center; margin-top:12px}
.en-tab{min-height:44px; padding:8px 12px; border-radius:12px; border:1px solid var(--line2); background:var(--card); font-weight:600; font-size:.9rem; color:var(--ink)}
.en-tab.on{border:2px solid var(--accent); background:var(--accent-soft)}
.en-tab.done{color:var(--good)}
.en-board{background:#f6f4ee; border:1px solid var(--line); border-radius:18px; margin-top:14px; padding:16px 10px}
.en-chain{display:flex; align-items:stretch; justify-content:center}
.en-node{flex:1 1 0; min-width:0; max-width:150px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; text-align:center; background:var(--card); border:2px solid var(--c); border-radius:14px; padding:10px 6px; min-height:110px}
.en-node .en-e{font-size:2rem; line-height:1}
.en-node .en-n{font-weight:700; font-size:.9rem; line-height:1.2; overflow-wrap:anywhere}
.en-node .en-f{font-size:.75rem; font-weight:700; color:#fff; background:var(--c); border-radius:999px; padding:2px 8px; line-height:1.3}
.en-node.en-next{border-style:dashed; background:transparent; color:var(--muted)}
.en-node.en-next .en-e{font-weight:800; color:var(--muted)}
.en-node.en-pop{animation:enpop .35s ease}
@keyframes enpop{from{transform:scale(.85); opacity:.3} to{transform:none; opacity:1}}
.en-arrow{position:relative; flex:0 0 36px; align-self:center; height:4px; background:var(--c); margin:0 6px 0 2px; border-radius:2px; opacity:.5}
.en-arrow::after{content:""; position:absolute; right:-7px; top:50%; transform:translateY(-50%); border:7px solid transparent; border-left:9px solid var(--c); border-right:0}
.en-arrow.on{opacity:1}
.en-spark{display:none; position:absolute; top:50%; left:calc(var(--p,0)*100%); width:10px; height:10px; border-radius:50%; background:#fff; border:2px solid var(--c); transform:translate(-50%,-50%)}
.en-arrow.on .en-spark{display:block}
.en-q{font-weight:700; text-align:center; margin-top:14px; line-height:1.4}
.en-forms{display:flex; flex-wrap:wrap; gap:8px; justify-content:center; margin-top:10px}
.en-form{min-height:48px; padding:8px 14px; border-radius:14px; border:2px solid var(--c); background:var(--card); font-weight:700; font-size:.95rem; color:var(--ink); display:inline-flex; align-items:center; gap:8px}
.en-form i{width:14px; height:14px; border-radius:50%; background:var(--c); display:inline-block}
.en-tray{display:grid; grid-template-columns:repeat(auto-fill,minmax(110px,1fr)); gap:8px; margin-top:8px}
.en-org{min-height:64px; border-radius:14px; border:1px solid var(--line2); background:var(--card); font-size:.9rem; font-weight:600; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; padding:6px; color:var(--ink)}
.en-org .en-e{font-size:1.6rem}
.en-org.used{opacity:.35}
.en-meter{margin-top:16px}
.en-meter h3{margin-bottom:10px}
.en-mrow{display:grid; grid-template-columns:1fr 1fr; gap:10px}
.en-mbox{background:var(--soft); border-radius:12px; padding:10px}
.en-mbox.en-out{background:#eef2f7; border:1px dashed var(--line2)}
.en-mlab{font-weight:700; font-size:.85rem; color:var(--ink2); margin-bottom:6px}
.en-blks{display:flex; flex-wrap:wrap; gap:5px; min-height:24px}
.en-blk{width:22px; height:22px; border-radius:5px; background:var(--c); display:inline-block}
.en-out .en-blk{opacity:.55}
.en-none{color:var(--muted); font-size:.85rem}
.en-legend{display:flex; flex-wrap:wrap; gap:12px; margin-top:10px; font-size:.85rem; font-weight:600}
.en-legend span{display:inline-flex; align-items:center; gap:5px}
.en-legend i{width:12px; height:12px; border-radius:3px; background:var(--c); display:inline-block}
.en-mnote{margin-top:8px; font-size:.85rem; color:var(--muted); line-height:1.4}
/* phones: the chain runs top to bottom */
@media(max-width:560px){
  .en-chain{flex-direction:column; align-items:stretch}
  .en-node{max-width:none; flex:none; flex-direction:row; justify-content:flex-start; text-align:left; min-height:56px; padding:8px 12px; gap:10px}
  .en-node .en-e{font-size:1.6rem}
  .en-node .en-f{margin-left:auto; text-align:center}
  .en-arrow{flex:none; width:4px; height:26px; align-self:center; margin:2px 0 8px}
  .en-arrow::after{right:auto; left:50%; top:auto; bottom:-8px; transform:translateX(-50%); border:7px solid transparent; border-top:9px solid var(--c); border-bottom:0}
  .en-spark{left:50%; top:calc(var(--p,0)*100%)}
  .en-mrow{grid-template-columns:1fr}
}

/* ---- Year 4 unit 4 lab (t4-earth.css) ---- */
/* Year 4 · Earth and its habitats lab */
.eh-scenes{display:flex; gap:8px; justify-content:center; flex-wrap:wrap; margin-top:12px}
.eh-scenes .btn{min-height:44px; padding:8px 18px}
.eh-layers{display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin-top:6px}
.eh-layers .btn{min-height:48px; padding:8px 6px}
.eh-habs{display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; margin-top:14px}
.eh-hab{min-height:150px; border-radius:16px; border:2px solid var(--line2); padding:10px 8px; display:flex; flex-direction:column; align-items:center; justify-content:flex-start; gap:8px; color:var(--ink); text-align:center}
.eh-hab.ready{border:2px dashed var(--accent)}
.eh-water{background:#dbeafe}
.eh-grass{background:#fef3c7}
.eh-forest{background:#dcfce7}
.eh-habname{font-weight:700; font-size:1rem; line-height:1.2}
.eh-placed{display:flex; flex-wrap:wrap; gap:6px; justify-content:center}
.eh-chip{display:flex; flex-direction:column; align-items:center; background:rgba(255,255,255,.85); border-radius:12px; padding:4px 6px; font-size:.78rem; font-weight:600}
.eh-chip svg{width:40px; height:27px}
.eh-chip .eh-emo{font-size:1.4rem}
.eh-tray{display:grid; grid-template-columns:repeat(auto-fill,minmax(100px,1fr)); gap:8px; margin-top:8px}
.eh-animal{min-height:72px; border-radius:14px; border:1px solid var(--line2); background:var(--card); color:var(--ink); font-size:.88rem; font-weight:600; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; padding:6px}
.eh-animal .eh-emo{font-size:1.7rem; line-height:36px}
.eh-animal.on{border:2px solid var(--accent); background:var(--accent-soft)}
@media(max-width:480px){
  .eh-layers{grid-template-columns:repeat(2,1fr)}
  .eh-habs{gap:6px}
  .eh-hab{min-height:130px; padding:8px 4px}
  .eh-habname{font-size:.85rem}
}

/* ---- Year 4 unit 5 lab (t5-light.css) ---- */
/* Year 4 Light lab (courses/science-y4/labs/t5-light.js) */
.lt-tilt{margin-top:12px}
.lt-step{min-width:48px; min-height:48px; padding:0; font-size:1.4rem; line-height:1; flex:none}
.lt-earth-row{display:flex; align-items:center; justify-content:center; gap:16px; margin-top:12px; flex-wrap:wrap}
.lt-earth{display:block; width:220px; max-width:100%; height:auto; flex:none}
.lt-time{display:flex; flex-direction:column; align-items:center; gap:2px; min-width:96px}
.lt-time b{font-size:2rem; font-weight:800; font-variant-numeric:tabular-nums}
.lt-time span{font-weight:700; color:var(--muted)}

/* Practice papers: typed answers, tables and bar charts in questions */
.write-wrap{margin-top:4px}
.write-in{width:100%; font:inherit; font-size:1.3rem; font-weight:600; padding:14px 16px; border:2px solid var(--line2); border-radius:14px; background:#fff; color:var(--ink)}
.write-in:focus{outline:none; border-color:var(--accent)}
.write-in.ok{border-color:var(--good); background:#dcfce7}
.write-in.no{border-color:var(--bad); background:#fee2e2}
.write-note{margin-top:8px; font-weight:600; color:var(--ink2); min-height:1.2em}
.qmedia{margin:0 0 16px}
.qtable{border-collapse:collapse; width:100%; max-width:520px; font-size:.95rem; background:#fff}
.qtable th,.qtable td{border:1px solid var(--line2); padding:7px 10px; text-align:left}
.qtable th{background:var(--soft); font-weight:600}
.qchart{display:grid; grid-template-columns:auto 1fr; grid-template-rows:auto auto; gap:6px 10px; max-width:520px}
.qchart-y{writing-mode:vertical-rl; transform:rotate(180deg); font-size:.8rem; color:var(--muted); text-align:center}
.qchart-plot{display:flex; align-items:flex-end; gap:12px; height:170px; border-left:2px solid var(--ink2); border-bottom:2px solid var(--ink2); padding:0 10px}
.qbar{flex:1; display:flex; flex-direction:column; align-items:center; justify-content:flex-end; height:100%; position:relative}
.qbar i{display:block; width:70%; max-width:56px; background:var(--accent); border-radius:6px 6px 0 0}
.qbar-v{font-size:.85rem; font-weight:700; margin-bottom:2px}
.qbar-n{position:absolute; bottom:-24px; font-size:.82rem; font-weight:600; white-space:nowrap}
.qchart-x{grid-column:2; text-align:center; font-size:.8rem; color:var(--muted); margin-top:20px}
.qchart.scaled .qchart-plot{height:260px; margin-left:26px; position:relative}
.qtick{position:absolute; left:0; right:0; border-top:1px solid var(--line2); height:0}
.qtick span{position:absolute; right:100%; margin-right:7px; transform:translateY(-50%); font-size:.72rem; font-weight:600; color:var(--ink2); line-height:1}
.qchart.scaled .qbar i{border-radius:0; min-height:3px}
.qchart.scaled .qbar-n{bottom:auto; top:100%; margin-top:5px; width:100%; white-space:normal; text-align:center; line-height:1.15}
.qchart.scaled .qchart-x{margin-top:40px}
.qpassage{background:#fff; border:1px solid var(--line2); border-left:4px solid var(--accent); border-radius:10px; padding:10px 14px; margin-bottom:12px; max-width:620px; text-align:left}
.qpassage-t{font-weight:700; font-size:.9rem; margin-bottom:4px}
.lbanner.drawn{background-size:contain; background-repeat:no-repeat; background-color:var(--accent-soft)}
.qparticles{display:block; width:100%; max-width:300px; background:#fff; border:1px solid var(--line2); border-radius:12px; margin-bottom:12px}
.qparticles circle{fill:#6d8fe0; stroke:#2f4a94; stroke-width:1.5}
.qhint{display:flex; gap:12px; align-items:flex-start; margin:0 0 14px; padding:14px 16px; border-radius:16px; background:#fef3c7; color:#713f12; border:2px solid #f59e0b; font-weight:600; animation:pop .3s}
.qhint-em{font-size:1.6rem; line-height:1}
.qhint-go{margin-top:4px; font-weight:800}
.opt.tried,.tok.tried{opacity:.4; text-decoration:line-through; pointer-events:none}
.qpassage p{margin:0; font-size:.98rem; line-height:1.5}
.mr-paper .mricon{background:#e0f2ef; color:#0f766e}

/* Label-the-diagram questions and letter-count hints */
.lbl-wrap{display:flex; flex-direction:column; align-items:center}
.lbl-svg{width:100%; max-width:260px; height:auto; background:var(--soft); border-radius:16px}
.lbl-part{cursor:pointer}
.lbl-part.sel .fill,.lbl-part.sel .fill-s{stroke:#c7d2fe} .lbl-part.sel .fill-r{fill:#c7d2fe}
.lbl-part.right .fill,.lbl-part.right .fill-s{stroke:#86efac} .lbl-part.right .fill-r{fill:#86efac}
.lbl-part.wrong .fill,.lbl-part.wrong .fill-s{stroke:#fca5a5} .lbl-part.wrong .fill-r{fill:#fca5a5}
.write-hint{display:flex; align-items:center; gap:4px; margin-bottom:8px; flex-wrap:wrap}
.write-hint span{width:22px; height:26px; border:2px solid var(--line2); border-radius:5px; background:#fff}
.write-hint em{font-style:normal; font-size:.85rem; color:var(--muted); margin-left:6px}
.write-hint span{display:grid; place-items:center; font-weight:700; font-size:.85rem}
.write-hint em.over{color:var(--bad); font-weight:600}

/* Drag & sort: real dragging (finger or mouse), editable placements */
.tok{touch-action:none; -webkit-user-select:none; user-select:none; cursor:grab}
.tok.dragging{opacity:.35}
.drag-ghost{position:fixed; z-index:300; pointer-events:none; transform:translate(-50%,-50%) scale(1.08); box-shadow:0 8px 20px rgba(27,36,51,.25); cursor:grabbing}
.bin.drop-over{border-color:var(--accent); background:var(--accent-soft)}
.pool{min-height:56px; border-radius:14px; padding:6px; transition:background .15s}
.pool.drop-over,.pool.can-drop{background:var(--accent-soft); outline:2px dashed var(--accent)}
.pool-empty{color:var(--muted); font-size:.85rem; align-self:center}

/* Put in order: drag rows (the arrows still work) */
.ord{touch-action:none; -webkit-user-select:none; user-select:none; cursor:grab; position:relative}
.ord::before{content:'⠿'; color:var(--muted); font-size:1.1rem; margin-right:-4px}
.ord.dragging{opacity:.3}
.ord-ghost{position:fixed; z-index:300; pointer-events:none; margin:0; box-shadow:0 10px 24px rgba(27,36,51,.25); background:#fff; cursor:grabbing}
.ord.drop-before{box-shadow:inset 0 4px 0 var(--accent)}
.ord.drop-after{box-shadow:inset 0 -4px 0 var(--accent)}
