/* Area Model — Student Quizzes (shared by the Area Model page and the Area & Perimeter page).
   Same shell and tokens as the other MMT student quizzes (Counting Strategies). */
:root{
  --bg:#f8fafc; --card:#ffffff; --ink:#0f172a; --muted:#64748b; --border:#e2e8f0;
  --shadow:0 18px 45px rgba(15,23,42,.13);
  --blue:#2563eb; --blue-dark:#1d4ed8;
  --green:#22c55e; --green-dark:#15803d;
  --purple:#7c3aed; --purple-dark:#5b21b6;
  --orange:#f97316; --orange-dark:#c2410c;
  --red:#dc2626; --line:#334155; --line-soft:#94a3b8;
  --sweet:#16a34a; --mild:#d97706; --medium:#ea580c; --spicy:#b91c1c;
  --uiFont:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  --mathFont:"STIX Two Math","Cambria Math","Latin Modern Math","Times New Roman",Georgia,serif;
}
*{ box-sizing:border-box; }
html,body{ min-height:100%; }
body{
  margin:0; font-family:var(--uiFont); color:var(--ink);
  background:
    radial-gradient(circle at top left,rgba(37,99,235,.14),transparent 32rem),
    radial-gradient(circle at top right,rgba(124,58,237,.12),transparent 34rem),
    var(--bg);
  overflow-x:hidden;
}
button,input,select{ font:inherit; }
[hidden]{ display:none !important; }
.app{ min-height:100dvh; display:flex; flex-direction:column; }

/* ---------- topbar (shared MMT shell) ---------- */
.mmtTopbar{
  position:relative; z-index:40;
  background:linear-gradient(135deg,#0f172a,#123b7a 55%,#2563eb);
  color:white; padding:14px 24px;
  display:grid; grid-template-columns:auto minmax(0,1fr) auto;
  align-items:center; gap:16px; box-shadow:0 10px 28px rgba(15,23,42,.22);
}
.mmtBrand{ display:flex; align-items:center; gap:12px; justify-self:start;
  text-decoration:none; color:white; border-radius:14px; padding:8px 12px; margin-left:-12px; font-weight:900; }
.mmtBrand:hover{ background:rgba(255,255,255,.12); }
.mmtBrandLogo{ width:44px; height:44px; border-radius:9px; background:white; color:#1d4ed8;
  display:grid; place-items:center; font-weight:1000; letter-spacing:-.08em; flex:0 0 auto; }
.mmtBrandText strong{ display:block; font-size:1.18rem; line-height:1; letter-spacing:-.03em; color:white; }
.mmtBrandText span{ display:block; font-size:.78rem; opacity:.82; font-weight:650; color:white; }
.mmtTopTitle{ font-weight:850; font-size:clamp(1rem,1.7vw,1.36rem); letter-spacing:-.035em; text-align:center; color:white; white-space:nowrap; }
.topActions{ justify-self:end; display:flex; align-items:center; justify-content:flex-end; gap:10px; flex-wrap:nowrap; }
.btn{ appearance:none; border:1px solid rgba(255,255,255,.28); background:rgba(255,255,255,.14);
  color:white; padding:11px 15px; border-radius:14px; font-weight:900; font-size:15px; cursor:pointer; transition:.18s ease; white-space:nowrap; }
.btn:hover:not(:disabled){ background:rgba(255,255,255,.22); transform:translateY(-1px); }
.btn-primary{ background:white; color:#1d4ed8; border-color:white; }
.menuWrap{ position:relative; display:inline-flex; }
.dropMenu{ position:absolute; top:calc(100% + 8px); right:0; min-width:280px; background:#fff; color:var(--ink);
  border:1px solid rgba(226,232,240,.95); border-radius:14px; box-shadow:0 18px 45px rgba(15,23,42,.22);
  padding:7px; display:none; z-index:120; text-align:left; }
.dropMenu.open{ display:grid; gap:4px; }
.toolLink{ display:flex; align-items:center; justify-content:space-between; gap:10px; padding:10px 12px;
  border-radius:10px; color:var(--ink); text-decoration:none; font-weight:900; font-size:.9rem; }
.toolLink::after{ content:'\203A'; color:var(--blue); font-weight:1000; font-size:1.1rem; }
.toolLink:hover{ background:#eef2ff; color:#1d4ed8; }
.toolLink small{ display:block; font-weight:650; font-size:.74rem; color:var(--muted); }

.lvlChip{ font-weight:1000; font-size:.82rem; padding:6px 13px; border-radius:999px;
  background:#fff; border:1px solid rgba(255,255,255,.3); color:var(--blue-dark); white-space:nowrap; }
.lvlChip.sweet{ color:var(--sweet); } .lvlChip.mild{ color:var(--mild); }
.lvlChip.medium{ color:var(--medium); } .lvlChip.spicy{ color:var(--spicy); }

.progressWrap{ height:6px; background:rgba(15,23,42,.10); }
.progressFill{ height:100%; width:0%; background:linear-gradient(90deg,var(--blue),var(--purple)); transition:width .3s ease; }

/* ---------- layout ---------- */
.layout{ flex:1; width:min(1380px,100%); margin:0 auto; padding:14px 20px 18px;
  display:flex; flex-direction:column; gap:11px; min-width:0; }
.headRow{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.qCounter{ font-size:.86rem; font-weight:950; color:var(--muted); white-space:nowrap; }
.promptBar{ flex:1 1 320px; display:flex; align-items:center; gap:12px; padding:9px 16px; border-radius:16px;
  background:linear-gradient(135deg,rgba(37,99,235,.10),rgba(124,58,237,.08));
  border:1px solid rgba(37,99,235,.20); font-weight:850; color:var(--line); font-size:.98rem; min-height:44px; line-height:1.35; }
.promptBar .pIco{ font-size:1.2rem; flex:0 0 auto; }
.promptBar.good{ background:linear-gradient(135deg,rgba(34,197,94,.16),rgba(37,99,235,.06)); border-color:rgba(21,128,61,.28); color:var(--green-dark); }
.promptBar.bad{ background:linear-gradient(135deg,rgba(220,38,38,.13),rgba(249,115,22,.07)); border-color:rgba(185,28,28,.28); color:#991b1b; }
.promptBar.warn{ background:#fffbeb; border-color:#fde68a; color:#92400e; }

.work{ display:grid; grid-template-columns:minmax(330px,0.86fr) minmax(0,1.14fr); gap:12px; align-items:start; }

/* ---------- the question ---------- */
.qCard{ background:var(--card); border:1px solid var(--border); border-radius:22px; box-shadow:var(--shadow);
  padding:16px 18px 14px; display:flex; flex-direction:column; gap:12px; min-width:0; overflow-y:auto; overscroll-behavior:contain; }
.qCard > *{ flex:0 0 auto; }
.part.folded{ gap:5px; padding-top:8px; padding-bottom:8px; }
.doneLine{ font-size:.95rem; font-weight:800; color:var(--green-dark); line-height:1.5; }
.doneLine .eq{ font-size:1.12rem; }
.qText{ font-size:clamp(1.08rem,1.6vw,1.3rem); font-weight:900; line-height:1.38; color:var(--ink); }
.eq{ font-family:var(--mathFont); font-weight:500; white-space:nowrap; }
.qText .eq{ font-size:1.18em; }
.cx{ color:var(--blue-dark); } .cy{ color:var(--orange-dark); }
.qSub{ font-size:.92rem; font-weight:800; color:var(--muted); line-height:1.45; }
.qSub b{ color:var(--line); }
.working{ font-family:var(--mathFont); font-size:1.28rem; color:var(--line); background:#f8fafc; border:1.5px dashed var(--border);
  border-radius:12px; padding:8px 12px; line-height:1.45; }

.part{ border:1.5px solid var(--border); border-radius:16px; padding:11px 13px; display:flex; flex-direction:column; gap:9px; background:#fff; }
.part.current{ border-color:#bfdbfe; box-shadow:0 0 0 4px rgba(37,99,235,.08); }
.part.ok{ border-color:#bbf7d0; background:#f7fdf9; }
.part.no{ border-color:#fecaca; background:#fffafa; }
.stepHead{ display:flex; align-items:center; gap:8px; font-weight:950; font-size:.95rem; color:var(--line); }
.stepNum{ display:inline-grid; place-items:center; width:24px; height:24px; border-radius:8px; background:var(--blue); color:#fff; font-size:.8rem; flex:0 0 auto; }
.part.ok .stepNum{ background:var(--green-dark); }
.part.no .stepNum{ background:var(--red); }
.stepTitle{ min-width:0; }
.stepMark{ margin-left:auto; font-size:.86rem; font-weight:950; white-space:nowrap; }
.part.ok .stepMark{ color:var(--green-dark); }
.part.no .stepMark{ color:var(--red); }
.fix{ font-size:.9rem; font-weight:850; color:#7f1d1d; background:#fef2f2; border-radius:10px; padding:8px 11px; line-height:1.45; }
.fix .eq{ font-size:1.08rem; }
.waitNote{ font-size:.92rem; font-weight:850; color:#1e40af; background:#eff6ff; border:1.5px dashed #bfdbfe; border-radius:12px; padding:10px 12px; line-height:1.45; }

/* number boxes */
.cell{ appearance:none; border:2px solid var(--border); background:#fff; border-radius:12px; padding:6px 6px;
  font-family:var(--mathFont); font-size:1.28rem; color:var(--ink); text-align:center; width:96px; min-width:0; }
.cell:focus-visible{ outline:none; border-color:var(--blue); box-shadow:0 0 0 4px rgba(37,99,235,.16); }
.cell.right{ border-color:var(--green); background:#f0fdf4; color:var(--green-dark); }
.cell.wrong{ border-color:var(--red); background:#fef2f2; color:var(--red); }
.cell.sm{ width:72px; }
.cell::placeholder{ color:#cbd5e1; }

/* one product per piece */
.prodGrid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(178px,1fr)); gap:7px; }
.prodRow{ display:flex; align-items:center; gap:7px; border:1.5px solid var(--border); border-radius:12px; padding:5px 8px; background:#fff; transition:border-color .12s ease; }
.prodRow.hl{ border-color:#0f172a; }
.prodRow .sw{ width:14px; height:14px; border-radius:4px; border:1.5px solid rgba(15,23,42,.2); flex:0 0 auto; }
.prodRow .m{ font-family:var(--mathFont); font-size:1.2rem; white-space:nowrap; }
.prodRow .cell{ width:auto; flex:1 1 60px; font-size:1.18rem; padding:4px 5px; }
.fieldRows{ display:grid; gap:8px; }
.fieldRow{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; font-weight:900; color:var(--line); }
.fieldRow .lab{ font-size:.95rem; min-width:0; }
.fieldRow .lab .eq{ font-size:1.32rem; font-weight:500; }
.fieldRow .m{ font-family:var(--mathFont); font-weight:500; font-size:1.3rem; white-space:nowrap; }
.fieldInline{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; font-family:var(--mathFont); font-size:1.35rem; color:var(--line); }

/* multiple choice */
.mcList{ display:grid; gap:7px; }
.mcOpt{ appearance:none; text-align:left; border:2px solid var(--border); background:#fff; border-radius:14px; padding:9px 13px;
  font-weight:850; font-size:1rem; color:var(--line); cursor:pointer; display:flex; gap:10px; align-items:center; line-height:1.35; }
.mcOpt .eq{ font-size:1.18rem; }
.mcOpt .key{ display:inline-grid; place-items:center; width:26px; height:26px; border-radius:8px; background:#f1f5f9; font-weight:1000; flex:0 0 auto; }
.mcOpt:hover{ border-color:#bfdbfe; }
.mcOpt.on{ border-color:var(--blue); background:#eef2ff; }
.mcOpt.on .key{ background:var(--blue); color:#fff; }
.mcOpt.right{ border-color:var(--green); background:#f0fdf4; }
.mcOpt.wrong{ border-color:var(--red); background:#fef2f2; }

.checkRow{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.checkBtn{ appearance:none; border:none; background:var(--blue); color:#fff; padding:11px 22px;
  border-radius:14px; font-weight:950; font-size:1rem; cursor:pointer; }
.checkBtn:hover:not(:disabled){ background:var(--blue-dark); }

/* ---------- the area model ---------- */
.boardCard{ position:relative; background:var(--card); border:1px solid var(--border); border-radius:22px; box-shadow:var(--shadow);
  padding:10px 12px 8px; display:flex; flex-direction:column; gap:4px; min-width:0; }
.boardHead{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; font-size:.86rem; font-weight:900; color:var(--muted); padding:2px 4px 0; min-height:32px; }
.boardHead .sp{ flex:1 1 auto; }
.viewTag{ display:inline-flex; align-items:center; gap:6px; border-radius:999px; padding:4px 10px; font-weight:950; font-size:.8rem; }
.viewTag.area{ background:#eff6ff; color:var(--blue-dark); }
.viewTag.perim{ background:#f5f3ff; color:var(--purple-dark); }
.miniBtn{ appearance:none; border:1.5px solid var(--border); background:#fff; color:var(--line); border-radius:10px; padding:6px 11px; font-weight:900; font-size:.82rem; cursor:pointer; }
.miniBtn:hover:not(:disabled){ border-color:var(--blue); color:var(--blue-dark); }
.miniBtn:disabled{ opacity:.4; cursor:not-allowed; }
.boardWrap{ position:relative; height:clamp(320px, calc(100dvh - 292px), 600px); }
#board{ position:absolute; inset:0; width:100%; height:100%; display:block; touch-action:none; user-select:none; -webkit-user-select:none; overflow:visible; }
#board text{ font-family:var(--mathFont); font-weight:700; pointer-events:none; }
#board path, #board line, #board polygon{ pointer-events:none; }
#board line.cutHit{ pointer-events:stroke; cursor:ew-resize; }
#board line.cutHit.y{ cursor:ns-resize; }
#board .ruler{ cursor:copy; }
#board .ruler:hover rect.band{ fill:#e0e7ff; }
#board .piece{ cursor:default; }
#board.canPick .piece{ cursor:pointer; }
#board .piece.hl{ stroke:#0f172a; stroke-width:3.5; }
.boardNote{ font-size:.82rem; font-weight:800; color:var(--muted); padding:0 6px 2px; text-align:center; min-height:1.2em; }
.scaleTag{ position:absolute; right:4px; bottom:2px; font-size:.68rem; font-weight:900; letter-spacing:.06em; text-transform:uppercase;
  color:var(--muted); background:#f1f5f9; border:1px solid var(--border); border-radius:999px; padding:3px 8px; pointer-events:none; }

/* ---------- nav ---------- */
.navRow{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.navBtn{ appearance:none; border:1.5px solid var(--border); background:#fff; color:var(--line);
  padding:10px 18px; border-radius:14px; font-weight:900; cursor:pointer; }
.navBtn:hover:not(:disabled){ border-color:var(--blue); color:var(--blue-dark); background:#eef2ff; }
.navBtn.next{ background:var(--blue); color:#fff; border-color:var(--blue); }
.navBtn.next:hover:not(:disabled){ background:var(--blue-dark); color:#fff; }
.navBtn:disabled{ opacity:.4; cursor:not-allowed; }
.spacer{ flex:1 1 auto; }

@keyframes shake{ 0%,100%{transform:translateX(0);} 20%{transform:translateX(-6px);} 40%{transform:translateX(6px);} 60%{transform:translateX(-3px);} 80%{transform:translateX(3px);} }
.shake{ animation:shake .34s; }
.confetti{ position:fixed; inset:0; pointer-events:none; z-index:300; overflow:hidden; }

/* ---------- level chooser + certificate ---------- */
.modalBack{ position:fixed; inset:0; background:rgba(15,23,42,.42); display:none; place-items:center; z-index:200; padding:14px; }
.modalBack.open{ display:grid; }
.modal{ width:min(660px,100%); max-height:calc(100dvh - 28px); overflow:auto; background:#fff;
  border-radius:26px; box-shadow:0 34px 90px rgba(15,23,42,.34); border:1px solid #dbe3ef; padding:22px; }
.modal h2{ margin:0 0 6px; font-size:1.6rem; letter-spacing:-.03em; }
.modal p.sub{ margin:0 0 14px; color:var(--muted); font-weight:800; font-size:.95rem; line-height:1.4; }
.lvlList{ display:grid; gap:9px; }
.lvlRow{ display:grid; grid-template-columns:auto minmax(0,1fr) auto; gap:3px 14px; align-items:center;
  border:2px solid var(--border); border-radius:18px; padding:11px 16px; background:#fff; cursor:pointer;
  text-align:left; font-family:inherit; }
.lvlRow:hover{ border-color:#bfdbfe; background:#f8fbff; }
.lvlIco{ grid-column:1; grid-row:1/3; font-size:1.6rem; }
.lvlRow strong{ grid-column:2; grid-row:1; font-size:1.1rem; font-weight:1000; }
.lvlRow span.d{ grid-column:2; grid-row:2; color:var(--muted); font-weight:800; font-size:.86rem; line-height:1.35; }
.lvlRow .go{ grid-column:3; grid-row:1/3; font-weight:1000; color:var(--blue); font-size:1.3rem; }
.lvlRow.sweet strong{ color:var(--sweet); } .lvlRow.mild strong{ color:var(--mild); }
.lvlRow.medium strong{ color:var(--medium); } .lvlRow.spicy strong{ color:var(--spicy); }
.certBig{ font-size:2.6rem; font-weight:1000; text-align:center; color:var(--blue-dark); letter-spacing:-.03em; }
.certLine{ text-align:center; font-weight:900; color:var(--ink); font-size:1rem; margin-top:4px; }
.certSub{ text-align:center; font-weight:850; color:var(--muted); font-size:.92rem; line-height:1.45; margin-top:8px; }
.certBreak{ margin-top:12px; font-weight:900; font-size:.95rem; line-height:1.7; text-align:center; }
.modalActions{ display:flex; gap:10px; flex-wrap:wrap; margin-top:16px; justify-content:center; }
.modalActions button{ appearance:none; border:1.5px solid var(--border); background:#fff; color:var(--line);
  padding:11px 17px; border-radius:14px; font-weight:900; cursor:pointer; }
.modalActions button.primary{ background:var(--blue); color:#fff; border-color:var(--blue); }

.brandFoot{ text-align:center; font-size:.85rem; font-weight:850; color:var(--muted); padding:0 0 14px; }
.brandFoot a{ color:var(--blue); text-decoration:none; font-weight:1000; }

/* a part that is right is locked: it keeps its look, it just stops responding */
.part.ok .mcOpt:disabled{ cursor:default; opacity:1; color:inherit; }
.part.ok input[readonly]{ cursor:default; }

@media (max-width:1480px){ .mmtBrandText{ display:none; } }
@media (max-width:1180px){
  .mmtTopbar{ padding:12px 16px; gap:12px; }
  .mmtTopTitle{ white-space:normal; font-size:1.05rem; line-height:1.15; }
  .btn{ padding:10px 13px; font-size:14px; }
  .work{ grid-template-columns:minmax(300px,0.9fr) minmax(0,1.1fr); }
}
@media (max-width:980px){
  .work{ grid-template-columns:minmax(0,1fr); }
  .boardWrap{ height:clamp(300px,58vh,480px); }
}
@media (max-width:900px){
  .mmtTopbar{ grid-template-columns:auto minmax(0,1fr); gap:6px 8px; padding:8px 10px; }
  .mmtTopTitle{ grid-column:2; justify-self:start; text-align:left; font-size:1.02rem; white-space:normal; }
  .topActions{ grid-column:1/-1; justify-content:center; flex-wrap:wrap; }
  .dropMenu{ right:auto; left:50%; transform:translateX(-50%); }
  .layout{ padding:10px 10px 18px; }
  .qCard{ padding:14px 12px; }
}
@media (max-width:560px){
  .boardWrap{ height:clamp(260px,50vh,380px); }
  .prodGrid{ grid-template-columns:1fr; }
}
@media (max-height:820px){
  .layout{ gap:9px; padding-top:10px; padding-bottom:12px; }
  .promptBar{ min-height:40px; padding:7px 13px; font-size:.93rem; }
  .qCard{ padding:13px 15px 12px; gap:9px; }
  .part{ padding:9px 11px; gap:8px; }
  .navBtn{ padding:9px 16px; }
  .brandFoot{ padding-bottom:8px; }
}
@media (prefers-reduced-motion: reduce){ *{ animation:none !important; transition:none !important; } }

/* =====================================================================
   2026-10-31 (later): ONE question, ONE answer — the card is the question
   and nothing else. The model beside it is a helper, not a task.
   ===================================================================== */
.work{ align-items:stretch; }
.qCard{ padding:clamp(22px,3.4vw,46px) clamp(20px,3vw,44px); justify-content:center; }
.qBody{ display:flex; flex-direction:column; gap:clamp(18px,2.6vh,28px); max-width:560px; width:100%; margin:0 auto; }
.qText{ font-size:clamp(1.22rem,1.9vw,1.55rem); font-weight:900; line-height:1.35; letter-spacing:-.01em; }
.working{ font-size:clamp(1.25rem,1.8vw,1.5rem); padding:12px 16px; text-align:center; white-space:normal; }
.working .eq{ white-space:normal; }

.answers{ display:flex; flex-direction:column; gap:14px; }
.ansRow{ display:flex; align-items:center; gap:14px; flex-wrap:wrap; }
.ansRow .lab{ font-size:clamp(1.15rem,1.6vw,1.35rem); font-weight:900; color:var(--line); min-width:7.2em; }
.ansRow .cell.ans{ width:min(220px,100%); font-size:clamp(1.5rem,2.3vw,1.9rem); padding:8px 12px; border-radius:16px; border-width:2.5px; }
.ansRow.big{ gap:16px; }
.ansRow.big .lab{ min-width:0; font-size:clamp(2.2rem,4.2vw,3.4rem); font-weight:500; color:var(--ink); }
.ansRow.big .lab .eq{ font-weight:500; }
.ansRow.big .cell.ans{ width:min(240px,100%); font-size:clamp(2rem,3.6vw,2.9rem); padding:6px 12px; }

.mcList{ gap:9px; }
.mcOpt{ padding:12px 15px; font-size:1.05rem; }
.mcOpt .eq{ font-size:1.22rem; white-space:normal; }
.mcOpt:disabled{ cursor:default; opacity:1; color:inherit; }

.checkRow:empty{ display:none; }
.checkBtn{ padding:12px 28px; font-size:1.05rem; }

/* the one quiet line: a pointer to the model, then the feedback */
.fb{ font-size:.98rem; font-weight:800; line-height:1.5; border-radius:14px; }
.fb:empty{ display:none; }
.fb .eq{ font-size:1.12em; white-space:normal; }
.fb.hint{ display:flex; align-items:center; gap:9px; color:var(--muted); font-size:.9rem; }
.fb.hint .hIco{ display:inline-grid; place-items:center; width:26px; height:26px; border-radius:999px; background:#eff6ff; color:var(--blue-dark); font-weight:1000; flex:0 0 auto; }
.fb.good{ color:var(--green-dark); font-size:1.08rem; }
.fb.fixed{ color:#92400e; font-size:1.02rem; }
.fb.bad{ color:#7f1d1d; background:#fef2f2; padding:11px 14px; }
.fb.bad b{ color:var(--red); }
.fb.warn{ color:#92400e; background:#fffbeb; padding:9px 13px; }
.navBtn.next.ready{ box-shadow:0 0 0 4px rgba(37,99,235,.18); }

/* the board's head: one small label, or the Area / Perimeter switch; an icon to clear */
.viewSeg{ display:inline-flex; gap:2px; padding:3px; border-radius:999px; background:#f1f5f9; border:1px solid var(--border); }
.viewSeg button{ appearance:none; border:none; background:transparent; border-radius:999px; padding:5px 13px; font-weight:950; font-size:.82rem; color:var(--muted); cursor:pointer; }
.viewSeg button.on{ background:#fff; color:var(--blue-dark); box-shadow:0 1px 3px rgba(15,23,42,.14); }
.viewSeg button[data-v="perim"].on{ color:var(--purple-dark); }
.iconBtn{ appearance:none; width:36px; height:36px; display:inline-grid; place-items:center; border-radius:11px; border:1.5px solid var(--border);
  background:#fff; color:var(--line); font-size:1.15rem; font-weight:900; cursor:pointer; line-height:1; }
.iconBtn:hover:not(:disabled){ border-color:var(--blue); color:var(--blue-dark); }
.iconBtn:disabled{ opacity:.35; cursor:default; }
.iconBtn[hidden]{ display:none; }

/* jotting boxes over the pieces — the student's own working, never marked */
.jots{ position:absolute; inset:0; pointer-events:none; }
.jot{ position:absolute; pointer-events:auto; appearance:none; box-sizing:border-box; margin:0; padding:0 4px; text-align:center;
  border:1.5px dashed rgba(15,23,42,.32); border-radius:9px; background:rgba(255,255,255,.72); color:#0f172a;
  font-family:var(--mathFont); font-weight:700; outline:none; }
.jot::placeholder{ color:rgba(15,23,42,.45); font-weight:500; }
.jot:focus{ border-style:solid; border-color:var(--blue); background:#fff; box-shadow:0 0 0 3px rgba(37,99,235,.18); }

@media (max-width:980px){
  .qCard{ padding:22px 18px; }
  .qBody{ gap:16px; }
}
@media (max-width:560px){
  .ansRow .lab{ min-width:0; }
  .ansRow.big .lab{ font-size:2rem; }
  .ansRow.big .cell.ans{ font-size:1.8rem; width:150px; }
}

/* =====================================================================
   AREA OF A TRIANGLE QUIZ (2026-11-01) — this file started as a copy of
   area-model-quiz/quiz.css; the rules below are the triangle's own.
   ===================================================================== */
.ansRow .unit{ font-family:var(--mathFont); font-size:clamp(1.2rem,1.7vw,1.45rem); color:var(--line); }
.ansRow .lab{ min-width:6.2em; }
.frac{ display:inline-flex; flex-direction:column; align-items:center; font-size:.7em; line-height:1; vertical-align:middle; margin:0 .06em; }
.frac > span:first-child{ border-bottom:.08em solid currentColor; padding:0 .12em .06em; }
.frac > span:last-child{ padding:.06em .12em 0; }
.stepBox{ display:inline-flex; align-items:center; gap:8px; min-width:0; }
.stepCap{ font-size:.84rem; font-weight:850; color:var(--line); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:24em; }
.stepCap b{ color:var(--muted); font-weight:950; margin-right:3px; }
.mBtn{ appearance:none; border:1.5px solid var(--border); background:#fff; color:var(--line); border-radius:11px; padding:7px 12px;
  font-weight:950; font-size:.88rem; cursor:pointer; white-space:nowrap; }
.mBtn:hover:not(:disabled){ border-color:var(--blue); color:var(--blue-dark); background:#eef2ff; }
.mBtn:disabled{ opacity:.38; cursor:default; }
.mBtn.go{ background:linear-gradient(135deg,var(--green-dark),#0f766e); color:#fff; border-color:transparent; }
.mBtn.go:hover:not(:disabled){ background:linear-gradient(135deg,#166534,#115e59); color:#fff; }
.mBtn.go:disabled{ background:#e2e8f0; color:var(--muted); opacity:.8; }
.mBtn.busy{ pointer-events:none; opacity:.7; }
#board text{ font-family:var(--mathFont); font-weight:700; }
@media (max-width:560px){ .stepCap{ max-width:11em; font-size:.78rem; } .mBtn{ padding:6px 9px; } }

/* =====================================================================
   AREA OF A TRAPEZIUM QUIZ (2026-11-16) — a copy of the triangle quiz's
   css; below, the switch between the model's two stories.
   ===================================================================== */
.methSeg{ flex:0 0 auto; }
.methSeg[hidden]{ display:none; }
.boardHead{ flex-wrap:wrap; row-gap:6px; }
@media (max-width:1280px){ .stepCap{ max-width:14em; } }

/* =====================================================================
   NUMBER GROUPS — COLLECTING LIKE TERMS QUIZ (2026-11-16) — a copy of the
   trapezium quiz's css; below, this quiz's own pieces.
   ===================================================================== */
:root{
  --mathFont:"Cambria Math","STIX Two Math","Latin Modern Math","Asana Math",Cambria,"Palatino Linotype","Book Antiqua",Palatino,"Times New Roman",Georgia,serif;
  --itFont:"Cambria","Times New Roman","STIX Two Text",Georgia,serif;
}
/* letters as Word's equation editor sets them (real maths-italic glyphs), else a serif with a true italic */
.mi{ font-family:var(--mathFont); font-style:normal; }
.mv{ font-family:var(--itFont); font-style:italic; }
#board text{ font-weight:500; }
.working{ font-weight:500; }
/* the answer sits IN the line of maths: 3 × 7 + 2 × 7 = [  ] × 7 */
.ansEq{ display:flex; align-items:center; justify-content:center; flex-wrap:nowrap; gap:10px 12px; max-width:100%; font-family:var(--mathFont); font-weight:500;
  font-size:clamp(1.6rem,2.8vw,2.3rem); color:var(--ink); line-height:1.3; }
.ansEq .eqt{ white-space:nowrap; }
.ansEq .cell.ans{ width:2.8em; flex:0 0 auto; font-size:1em; padding:4px 8px; border-radius:14px; border-width:2.5px; }
.ansEq .cell.ans.wide{ width:8.2em; flex:0 1 auto; min-width:5em; text-align:left; padding-left:12px; }
.ansEq .cell.ans.wide::placeholder{ font-family:var(--uiFont); font-size:.5em; font-weight:800; color:#cbd5e1; }
.ansShow{ text-align:center; font-weight:850; color:var(--green-dark); font-size:1.02rem; }
.ansShow .eq{ font-size:1.35em; }
.qText .eq{ font-weight:500; }
.mcOpt .eq{ font-weight:500; }
.stepCap{ max-width:16em; }
/* Medium and Spicy: no model, so the question takes the whole width */
.app.noModel .work{ grid-template-columns:minmax(0,1fr); }
.app.noModel .boardCard{ display:none; }
.app.noModel .qCard{ max-width:820px; width:100%; margin:0 auto; min-height:min(60vh,520px); }
.app.noModel .qBody{ max-width:700px; }
@media (max-width:560px){ .ansEq{ font-size:1.45rem; } }
/* centre the question when there is room, but never clip its top when there isn't */
.qCard{ justify-content:flex-start; }
.qBody{ margin:auto; }
@media (max-height:820px){ .qBody{ gap:14px; } .mcOpt{ padding:9px 13px; } }
/* multiple choice cards carry the most text: tighter on short screens */
@media (max-height:820px){
  .qCard:has(.mcList){ padding-top:16px; padding-bottom:14px; }
  .qCard:has(.mcList) .qBody{ gap:11px; }
  .qCard:has(.mcList) .qText{ font-size:clamp(1.1rem,1.6vw,1.3rem); }
  .qCard:has(.mcList) .working{ padding:7px 12px; }
  .qCard:has(.mcList) .mcOpt{ padding:7px 12px; font-size:1rem; }
}

/* =====================================================================
   ONE-STEP EQUATIONS — DOUBLE NUMBER LINE QUIZ (2026-11-17) — a copy of the
   Number Groups quiz's css; below, this quiz's own pieces.
   ===================================================================== */
.working.dnlEq{ font-size:clamp(1.7rem,3vw,2.5rem); padding:10px 16px; letter-spacing:.01em; }
.working.dnlEq .frac{ font-size:.78em; }
.ansEq .frac, .qText .frac, .mcOpt .frac, .fb .frac{ font-size:.78em; }
.ansEq .cell.ans{ width:3.6em; }
.qSmall{ font-size:.82em; font-weight:800; color:var(--muted); }
.pillOpt{ display:inline-block; font-family:var(--mathFont); font-weight:600; font-size:1.4rem; line-height:1.15; min-width:3.2em; text-align:center; color:var(--purple-dark,#5b21b6);
  background:#f5f3ff; border:1.8px solid #7c3aed; border-radius:999px; padding:2px 14px; }
.mcOpt.wrong .pillOpt{ color:#991b1b; border-color:#dc2626; background:#fef2f2; }
.mcOpt.right .pillOpt{ color:#14532d; border-color:#15803d; background:#f0fdf4; }
#board{ transform-origin:50% 50%; }
.legendRow{ display:flex; gap:12px; flex-wrap:wrap; justify-content:center; font-size:.76rem; font-weight:850; color:var(--muted); padding:2px 0 6px; }
.legendRow span{ display:inline-flex; align-items:center; gap:5px; }
.legendRow i{ width:16px; height:4px; border-radius:3px; display:inline-block; }
.legendRow em{ font-family:var(--itFont); font-style:italic; font-weight:700; font-size:1.1em; }

/* ---------- languages: the chosen language on top, English beneath (maths and numerals stay LTR) ---------- */
.tl{ display:block; }
.tl[lang="ar"], .tl[lang="fa"]{ font-size:1.04em; line-height:1.6; }
.el{ display:block; font-size:.78em; opacity:.72; font-weight:650; margin-top:1px; }
bdi{ unicode-bidi:isolate; }
.qText .el{ font-size:.66em; font-weight:800; }
.stepTitle{ min-width:0; }
.stepMark .el{ font-size:.8em; }
.checkBtn .el, .navBtn .el, .modalActions button .el{ font-size:.72em; opacity:.85; }
.fillEn{ font-size:.82rem; font-weight:700; color:var(--muted); opacity:.85; margin-top:-2px; }
.numLab{ display:flex; gap:6px; align-items:flex-start; font-weight:850; }
.numLab .nl{ flex:none; }
.numLab > div{ flex:1; min-width:0; }
.elI{ font-weight:700; opacity:.7; font-size:.86em; }
.langTog{ display:inline-flex; border:1px solid rgba(255,255,255,.35); border-radius:12px; overflow:hidden; background:#fff; flex:none; }
.langTog button{ appearance:none; border:none; background:transparent; color:#0f172a; font-weight:900; font-size:13px; padding:8px 11px; cursor:pointer; line-height:1.1; font-family:inherit; }
.langTog button[lang]{ font-size:15px; padding:6px 11px; }
.langTog button.on{ background:#2563eb; color:#fff; }
.modalHeadRow{ display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.modalHeadRow .langTog{ border-color:var(--border); }
.promptBar .tl{ font-size:1em; }
.graphNote .el, .hintLine .el, .qSub .el{ font-size:.9em; }
.eq{ white-space:nowrap; }

/* ===================== MULTI-STEP EQUATIONS QUIZ (2026-11-17) ===================== */
.qText .qSub{ margin-top:6px; }
.origEq{ text-align:center; font-family:var(--mathFont); font-size:clamp(1.7rem,3vw,2.4rem); color:var(--ink); background:#f8fafc; border:1.5px solid var(--border); border-radius:16px; padding:10px 16px; overflow-x:auto; }
.origEq .eq, .ansEq .eq, .wList .eq, .grid .eq, .mLines .eq{ white-space:nowrap; }
.mvPill{ display:inline-block; font-family:var(--mathFont); font-weight:600; font-size:.74em; color:#5b21b6; background:#f5f3ff; border:1.5px solid #c4b5fd; border-radius:999px; padding:1px 10px; white-space:nowrap; min-width:2.6em; text-align:center; }
.mvPill.rw{ font-family:var(--uiFont); font-size:.6em; font-weight:900; font-style:italic; color:#475569; background:#f1f5f9; border-color:#cbd5e1; }
.mvPill.none{ visibility:hidden; }
.mvPill.big{ font-size:1.25rem; padding:2px 14px; }
.wList{ display:flex; flex-direction:column; gap:6px; align-items:center; font-family:var(--mathFont); font-size:clamp(1.25rem,2vw,1.6rem); color:var(--line); }
.wRow{ display:grid; grid-template-columns:5.2em auto; align-items:center; gap:12px; }
.wRow .mvPill{ justify-self:end; }
.fb .wList{ margin-top:10px; font-size:1.2rem; color:#334155; }
.drivePrompt{ text-align:center; font-weight:900; font-size:1.08rem; color:var(--ink); }
.moveOpts{ display:flex; gap:10px; flex-wrap:wrap; justify-content:center; }
.moveOpt{ appearance:none; font-family:var(--mathFont); font-weight:600; font-size:1.5rem; min-width:4.2em; padding:8px 18px; border-radius:999px; border:2.5px solid #c4b5fd; background:#f5f3ff; color:#5b21b6; cursor:pointer; transition:transform .12s ease, background .12s ease; }
.moveOpt:hover:not(:disabled){ background:#ede9fe; transform:translateY(-1px); }
.moveOpt.wrong{ border-color:#fca5a5; background:#fef2f2; color:#b91c1c; text-decoration:line-through; opacity:.7; }
.moveOpt:disabled{ cursor:default; }
.rwRow{ display:flex; justify-content:center; }
.rwBtn{ appearance:none; border:2px solid #cbd5e1; background:#f8fafc; color:#334155; font-weight:900; font-size:1.05rem; padding:10px 18px; border-radius:999px; cursor:pointer; font-family:var(--uiFont); }
.rwBtn:hover:not(:disabled){ border-color:var(--blue); color:var(--blue-dark); background:#eef2ff; }
.driveDone{ text-align:center; font-weight:900; color:var(--green-dark); font-size:1.15rem; }
.driveDone .eq{ font-size:1.3em; }
.ansEq .cell.val{ width:3.4em; font-size:1em; padding:4px 8px; border-radius:14px; border-width:2.5px; }
/* Mild: the working, = under = */
.grid{ display:grid; grid-template-columns:minmax(0,1fr) auto minmax(0,1fr); column-gap:10px; row-gap:4px; align-items:center; font-family:var(--mathFont); font-size:clamp(1.2rem,1.9vw,1.5rem); color:var(--ink); }
.grid .gL{ justify-self:end; } .grid .gR{ justify-self:start; } .grid .gE{ justify-self:center; }
.grid .gp{ min-height:1.6em; }
.grid .cell.g{ width:7.2em; font-size:.95em; padding:3px 8px; border-radius:12px; text-align:center; }
.grid .cell.g.mvIn{ width:4.4em; font-size:.8em; color:#5b21b6; border-color:#c4b5fd; border-style:dashed; background:#faf5ff; border-radius:999px; }
.grid .cell.g.mvIn.right{ border-style:solid; }
.grid .mirror{ display:inline-block; min-width:4.4em; min-height:1.5em; font-size:.8em; color:#7c3aed; border:2px dashed #ddd6fe; border-radius:999px; text-align:center; padding:2px 6px; }
.grid .mirror:empty::before{ content:"\00a0"; }
.gHint{ text-align:center; font-size:.85rem; font-weight:800; color:var(--muted); }
/* spot the mistake */
.mLines{ display:flex; flex-direction:column; gap:6px; padding:10px 16px; border:1.5px dashed #cbd5e1; border-radius:14px; background:#fff; }
.mRow{ display:grid; grid-template-columns:5em auto; gap:12px; align-items:baseline; font-family:var(--mathFont); font-size:clamp(1.15rem,1.8vw,1.4rem); }
.mN{ font-family:var(--uiFont); font-size:.62em; font-weight:1000; letter-spacing:.06em; text-transform:uppercase; color:var(--muted); }
.mRow.bad .eq{ color:#b91c1c; text-decoration:underline wavy #ef4444; text-underline-offset:4px; }
/* the fraction box (Spicy) */
.mfWrap{ display:inline-block; }
math-field.mf{ min-width:140px; border:2.5px solid var(--border); border-radius:14px; padding:6px 12px; font-size:1.5rem; background:#fff; }
math-field.mf.right{ border-color:var(--green); background:#f0fdf4; }
math-field.mf.wrong{ border-color:var(--red); background:#fef2f2; }
math-field.mf::part(menu-toggle){ display:none; }
@media (pointer: fine){ math-field.mf::part(virtual-keyboard-toggle){ display:none; } }
.fracRow{ display:flex; align-items:center; justify-content:center; gap:10px; }
.fracBtn{ border:2px solid var(--border); background:#fff; border-radius:12px; padding:6px 10px; cursor:pointer; }
.fracBtn:hover{ border-color:#2563eb; background:#eef2ff; }
.fracIco{ display:inline-flex; flex-direction:column; align-items:center; line-height:1; font-size:11px; gap:1px; color:#334155; font-weight:900; font-family:var(--uiFont); }
.fracIco span:first-child{ border-bottom:2px solid #334155; padding:0 3px 2px; }
.fracIco span:last-child{ padding:2px 3px 0; }
.fracHint{ font-size:.82rem; font-weight:800; color:var(--muted); }
.qText .tl, .drivePrompt .tl, .fb .tl{ margin-bottom:2px; }
#board .halo{ pointer-events:none; }
@media (max-width:560px){ .moveOpt{ font-size:1.25rem; min-width:3.6em; padding:6px 12px; } .grid .cell.g{ width:5.6em; } .wRow{ grid-template-columns:4.4em auto; } }
.op{ padding:0 .22em; } .frac .op{ padding:0 .12em; }
.grid{ row-gap:2px; }
.grid .cell.g{ padding:2px 8px; border-radius:10px; }
.grid .gp{ min-height:1.35em; }
.grid .cell.g.mvIn, .grid .mirror{ padding:0 6px; }
.grid > .gL:first-child, .grid > .gL:first-child + .gE, .grid > .gL:first-child + .gE + .gR{ font-size:1.25em; }
