:root {
  --ink: #1b1f24; --muted: #5f6b7a; --line: #e3e7ec; --bg: #f6f7f9; --card: #fff;
  --top: #2f6fde; --bottom: #4a5568; --fric: #e07a1f; --good: #1f9d55; --bad: #d64545; --accent: #6d4aff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); }
button, input, select, textarea { font: inherit; }
.topbar { display: flex; align-items: baseline; gap: 16px; padding: 12px 20px; background: #fff; border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 18px; } .logo { color: var(--accent); }
.tag { color: var(--muted); }
.steps { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 20px; }
.steps button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px; cursor: pointer; }
.steps button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.steps button.done::after { content: " ✓"; color: var(--good); }
.steps button.on.done::after { color: #9ef0bd; }
.steps .sep { color: var(--muted); padding: 5px 4px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; padding: 0 20px 24px; align-items: start; }
@media (max-width: 1000px) { .layout { grid-template-columns: 1fr; } }
.stage, .panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.stage { padding: 14px; }
.problem { margin-bottom: 10px; }
.problem .setup { color: var(--muted); font-size: 14px; }
.problem .ask { font-weight: 600; font-size: 16px; margin-top: 4px; }
.scenewrap { position: relative; }
#scene { width: 100%; height: 330px; display: block; background: linear-gradient(#fbfcfe, #f1f4f8); border-radius: 8px; touch-action: none; }
.readout { position: absolute; left: 10px; top: 8px; font: 12.5px/1.5 ui-monospace, Consolas, monospace; background: rgba(255,255,255,.88); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; }
.readout .st { font-weight: 700; } .readout .stuck { color: var(--good); } .readout .slip { color: var(--fric); }
.banner { position: absolute; left: 50%; bottom: 62px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 8px; max-width: 80%; font-size: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.15); }
.banner button { margin-left: 8px; background: #fff; color: var(--ink); border: 0; border-radius: 6px; padding: 3px 9px; cursor: pointer; }
.controls { display: flex; align-items: center; gap: 10px; margin: 10px 0; flex-wrap: wrap; }
.controls input[type=range] { flex: 1; min-width: 160px; }
.controls.second { margin-top: -4px; }
.controls.second input[type=range] { flex: none; min-width: 0; width: 130px; vertical-align: middle; }
.controls select { border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; background: #fff; }
.camnote { color: var(--muted); font-size: 13px; margin: -4px 0 8px; min-height: 18px; }
/* "where the force goes": your pull split into what each block gets */
.budget { border: 1px solid #e3e7ec; border-radius: 10px; padding: 8px 10px; margin: 0 0 10px; background: #fff; font-size: 13px; }
.budget .bt { font-weight: 700; margin-bottom: 6px; }
.budget .brow { display: grid; grid-template-columns: 210px 1fr 74px; gap: 8px; align-items: center; margin: 3px 0; }
.budget .blab { color: #1b1f24; } .budget .blab small { color: var(--muted); }
.budget .btrack { position: relative; height: 16px; background: #f1f4f8; border-radius: 4px; }
.budget .bseg { position: absolute; top: 0; height: 100%; border-radius: 4px; }
.budget .bcap { position: absolute; top: -4px; height: 24px; border-left: 2px dashed #e07a1f; }
.budget .bcap span { position: absolute; top: -15px; left: -40px; width: 140px; font-size: 11px; color: #b85d10; white-space: nowrap; }
.budget .bval { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.budget .bnote { margin-top: 6px; color: #1b1f24; line-height: 1.45; } .budget .bnote b { color: #8d1279; }
/* the thread of a derivation: why each line is true, and which earlier lines it uses */
.dmeta { display: flex; gap: 8px; align-items: center; margin: 2px 0 2px 26px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.dmeta select { font-size: 12.5px; padding: 2px 4px; border: 1px solid #e3e7ec; border-radius: 6px; max-width: 290px; }
.dmeta .uses { background: #eef3ff; color: #2f4fa8; border-radius: 10px; padding: 1px 8px; }
.dmeta .start { background: #f3f0e6; color: #7a5a12; border-radius: 10px; padding: 1px 8px; }
.dmeta .tagwarn { color: #b85d10; }
/* simple view: only what the student needs now; "⚙ more views" opens the rest; extras appear after the first comparison */
body:not(.detail) #strictdesc, body.simple .topbar .tag { display: none; }
.simpletog { font-size: 13px; color: var(--muted); margin-left: 8px; white-space: nowrap; }
body:not(.simple) #moreBtn { display: none; }
body.simple:not(.more) .controls.second > label.tog:not(.keep), body.simple:not(.more) .controls.second > select#cam, body.simple:not(.more) #camnote { display: none; }
body.simple:not(.extras) #framesBtn, body.simple:not(.extras) #pendBtn, body.simple:not(.extras) #gamesBtn, body.simple:not(.extras) #inventBtn { display: none !important; }
/* the guide: where you are in the problem, and the one thing to do next */
.guide { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 6px; font-size: 12.5px; }
.guide span { padding: 3px 8px; border-radius: 999px; background: #f1f4f8; color: #5f6b7a; cursor: pointer; }
.guide span.done { background: #e9f7ef; color: #1f7a45; } .guide span.now { background: #6d4aff; color: #fff; font-weight: 600; }
.guidenext { font-size: 13.5px; margin: 0 0 10px; color: #1b1f24; } .guidenext b { color: #4b2bd6; }
#bltoast { position: fixed; left: 18px; bottom: 18px; z-index: 70; background: #1b1f24; color: #fff; border-radius: 12px; padding: 10px 14px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.3); max-width: 420px; }
details.more { margin: 4px 0; } details.more > summary { cursor: pointer; color: #4b2bd6; font-size: 13px; list-style: none; } details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: ' ▸'; } details.more[open] > summary::after { content: ' ▾'; } details.more .morebody { margin-top: 4px; }
.dlive { margin: 0 0 2px 26px; font-size: 12.5px; min-height: 0; } .dlive.ok { color: #1f7a45; } .dlive.bad { color: #b42318; } .dlive.other { color: #2f4fa8; }
.cmore { color: #4b2bd6; cursor: pointer; margin-left: 4px; }
.wordtog { border: 0; background: none; cursor: pointer; font-size: 13px; padding: 0 2px; opacity: .7; }
.dhelp { font-size: 12.5px; color: var(--muted); margin: 4px 0 6px; } .dhelp summary { cursor: pointer; color: #4b2bd6; } .dhelp div { margin-top: 3px; }
.dres.words { color: #2f4fa8; } .dres.num { color: #1f7a45; } .dres.hypo { color: #7a5a12; }
.dwords { margin: 2px 0 6px 26px; } .dwords input { width: 100%; box-sizing: border-box; font: 13px system-ui; padding: 4px 8px; border: 1px dashed #cfd6e0; border-radius: 6px; color: #1b1f24; background: #fbfcfe; }
.dline.unused input { opacity: .55; } .dline.answer input { border-color: #1f9d55; box-shadow: 0 0 0 2px rgba(31,157,85,.15); }
.thread { margin-top: 8px; border: 1px solid #dfe6f5; background: #f8faff; border-radius: 10px; padding: 8px 10px; font-size: 13.5px; }
.thread ol { margin: 4px 0 0 18px; padding: 0; } .thread li { margin: 2px 0; } .thread .eq { font-family: "Cambria Math", Cambria, serif; font-size: 15px; }
.thread .grey { color: var(--muted); }
.forcectl { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; padding: 8px 10px; background: #fff7ef; border: 1px solid #f6d7b8; border-radius: 10px; flex-wrap: wrap; }
.forcectl input[type=range] { flex: 1; min-width: 140px; accent-color: #1b1f24; }
.fval { font: 600 16px ui-monospace, Consolas, monospace; min-width: 70px; }
.btn.small { padding: 6px 10px; font-size: 14px; user-select: none; touch-action: none; }
.clock { font: 13px ui-monospace, Consolas, monospace; min-width: 92px; }
.tog { color: var(--muted); font-size: 13px; }
.graphwrap { border-top: 1px solid var(--line); padding-top: 8px; }
.graphbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.seg button { border: 1px solid var(--line); background: #fff; padding: 3px 10px; cursor: pointer; }
.seg button:first-child { border-radius: 6px 0 0 6px; } .seg button:last-child { border-radius: 0 6px 6px 0; }
.seg button.on { background: var(--ink); color: #fff; }
.legend { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 18px; height: 3px; border-radius: 2px; margin-left: 8px; }
.sw.top { background: var(--top); } .sw.bottom { background: var(--bottom); } .sw.dash { background: repeating-linear-gradient(90deg, #999 0 4px, transparent 4px 7px); }
#graph { width: 100%; height: 230px; display: block; margin-top: 6px; touch-action: none; }
#graph.drawing { cursor: crosshair; outline: 2px dashed var(--accent); outline-offset: -2px; border-radius: 6px; }
.sketchbar { margin-top: 6px; font-size: 14px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.sketchbar button { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 3px 10px; cursor: pointer; }
.sketchbar button.on[data-s=top] { background: var(--top); color: #fff; border-color: var(--top); }
.sketchbar button.on[data-s=bottom] { background: var(--bottom); color: #fff; border-color: var(--bottom); }
.panel { padding: 16px; }
.panel h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 8px; }
.panel h2 .n { display: inline-block; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); color: #fff; text-align: center; line-height: 20px; margin-right: 6px; font-size: 12px; }
.card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.card.dim { opacity: .45; }
.q { margin: 0 0 14px; } .q:last-child { margin-bottom: 0; }
.q .ask { font-weight: 600; margin-bottom: 6px; }
.opt { display: block; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; margin: 5px 0; cursor: pointer; }
.opt:hover { border-color: #b9c2cd; }
.opt input { margin-right: 8px; }
.opt.sel { border-color: var(--accent); background: #f4f1ff; }
.num { display: flex; align-items: center; gap: 8px; }
.num input { width: 110px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; }
.btn { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 9px 14px; cursor: pointer; font-weight: 600; }
.btn:disabled { background: #c9c3e6; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.ghost { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; cursor: pointer; }
.ghost:disabled { color: #aab; cursor: not-allowed; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); font-size: 13px; }
table.cmp { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.cmp td, table.cmp th { border-bottom: 1px solid var(--line); padding: 6px 4px; text-align: left; vertical-align: top; }
table.cmp th { color: var(--muted); font-weight: 600; font-size: 12px; }
.ok { color: var(--good); font-weight: 700; } .no { color: var(--bad); font-weight: 700; }
.mis { background: #fff7ef; border: 1px solid #f6d7b8; border-radius: 8px; padding: 8px 10px; margin-top: 8px; font-size: 14px; }
.mis b { color: var(--fric); }
.hint { background: #f4f1ff; border-radius: 8px; padding: 8px 10px; margin-top: 8px; font-size: 14px; }
.hint .lv { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); font-weight: 700; }
textarea { width: 100%; min-height: 96px; border: 1px solid var(--line); border-radius: 8px; padding: 8px; resize: vertical; }
.reply { background: #f2f8ff; border: 1px solid #cfe2fb; border-radius: 8px; padding: 10px; margin-top: 8px; font-size: 14px; }
.chips { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.chip { font-size: 12px; border-radius: 999px; padding: 2px 8px; background: #e9f7ef; color: #17693a; }
.chip.miss { background: #f1f2f4; color: var(--muted); }
.why { background: #f6f7f9; border-radius: 8px; padding: 8px 10px; margin-top: 8px; font-size: 14px; }
.slider { display: grid; grid-template-columns: 1fr 70px; gap: 2px 8px; align-items: center; margin: 6px 0; font-size: 13px; }
.slider input { grid-column: 1 / -1; width: 100%; }
.slider b { text-align: right; font-weight: 600; }
.notation { font-size: 13px; color: var(--muted); margin-top: 6px; background: #f6f7f9; border-radius: 8px; padding: 6px 9px; }
.palette { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
.palette button { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 3px 8px; cursor: pointer; font-size: 14px; min-width: 32px; }
.palette button:hover { border-color: var(--accent); }
.dline { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.dline .lnum { color: var(--muted); font-size: 12px; width: 14px; text-align: right; }
.dline input { flex: 1; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; font: 15px ui-monospace, Consolas, monospace; }
.dline.ok input { border-color: #9fd9b4; background: #f3fbf6; } .dline.bad input, .dline.error input { border-color: #f1b0b0; background: #fff6f6; }
.dline .badge { font-weight: 700; } .dline.ok .badge { color: var(--good); } .dline.bad .badge, .dline.error .badge { color: var(--bad); }
.dprev { margin: 2px 0 0 20px; font-size: 13px; color: var(--ink); font-family: "Cambria Math", Cambria, serif; }
.dres { margin: 3px 0 0 20px; font-size: 13px; } .dres.ok { color: #17693a; } .dres.bad, .dres.error { color: #9b2c2c; }
.whybox { margin: 4px 0 4px 20px; background: #fff6f6; border: 1px solid #f1b0b0; border-radius: 8px; padding: 8px 10px; font-size: 13.5px; line-height: 1.45; }
.whybox > div { margin-bottom: 5px; } .whybox b { color: #9b2c2c; }
.whybox .think { background: #fff; border-radius: 6px; padding: 5px 7px; } .whybox .think b { color: var(--accent); }
.banner b { color: #ffe066; }
.banner.walk { position: static; transform: none; margin: 8px 0 0; max-width: none; text-align: left; line-height: 1.45; }
.banner .wt { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; opacity: .75; margin-bottom: 3px; }
.banner .weq { font: 17px "Cambria Math", Cambria, serif; margin: 6px 0 2px; color: #fff; }
.banner .wv { font-size: 13.5px; opacity: .92; }
.banner .wb { margin-top: 8px; display: flex; gap: 6px; }
.banner .wb button { margin: 0; } .banner .wb button:disabled { opacity: .4; }
.linkbtn { border: 0; background: none; color: var(--accent); text-decoration: underline; cursor: pointer; padding: 0; font-size: 13px; }
.phys { margin-top: 10px; background: #f4f1ff; border-radius: 8px; padding: 8px 10px; font-size: 14px; }
.reveal { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; font-size: 14px; }
.reveal ol { margin: 4px 0 10px; padding-left: 20px; }
.sbs { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; font-size: 13.5px; }
.sbs table { margin-top: 6px; } .sbs .ceq { font-family: "Cambria Math", Cambria, serif; font-size: 14.5px; }
.sbs tr.r-bad td:nth-child(2) { background: #fff6f6; } .sbs tr.r-miss td:nth-child(2) { background: #fafafa; } .sbs tr.r-ok td:nth-child(2) { background: #f3fbf6; }
.sbs .sbw { font-size: 12.5px; color: var(--muted); margin-top: 2px; } .sbs tr.r-bad .sbw { color: #9b2c2c; }
.sbs .ln { display: inline-block; min-width: 14px; color: var(--muted); font-size: 11px; }
.insight { margin-top: 10px; background: #f2f8ff; border: 1px solid #cfe2fb; border-radius: 8px; padding: 8px 10px; font-size: 14px; }
.insight summary { cursor: pointer; font-weight: 600; color: #1d4f91; } .insight p { margin: 6px 0 0; }
.banner .ctitle { font-weight: 700; font-size: 16px; margin: 2px 0 4px; color: #ffe066; }
.banner .cblame { margin-top: 8px; background: rgba(255,255,255,.1); border-radius: 6px; padding: 7px 9px; font-size: 13.5px; }
.banner .cblame b { color: #fff; } .banner .ceq2 { font: 15px "Cambria Math", Cambria, serif; color: #ffe066; }
.banner ul { margin: 4px 0; padding-left: 18px; }
.coachctl { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 14px; flex-wrap: wrap; }
.coachctl select { border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; background: #fff; font-weight: 600; }
.coachctl .muted { max-width: 360px; font-size: 12.5px; } .stats { color: #b7791f; white-space: nowrap; }
.coach { display: flex; gap: 10px; align-items: flex-start; background: #fffbea; border: 1px solid #f3df9a; border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px; line-height: 1.45; }
.coach .av { font-size: 26px; line-height: 1; }
.steps button.locked { color: #9aa5b1; background: #f3f4f6; }
.card.prove { border-color: #f3df9a; background: #fffdf4; }
mark { background: #ffe066; border-radius: 3px; padding: 0 2px; }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid #c9c3e6; border-top-color: var(--accent); border-radius: 50%; animation: sp 0.8s linear infinite; vertical-align: -2px; }
@keyframes sp { to { transform: rotate(360deg); } }
