/* SchoolCAD — guided modelling mode.
 * Part workspace layout: tools across the top, feature tree and parts on the left,
 * the model in the middle, and the guided steps on the right like a worksheet. */
:root {
  --sk-free: #2463d9;      /* under-defined sketch geometry (blue, as in Onshape/SOLIDWORKS) */
  --sk-sel: #0f7bff;
  --sk-hi: #e08a00;
  --sk-ref: #d27a2c;       /* model edges to snap to */
  --sk-proj: #8a3ffc;      /* geometry projected into a sketch (purple, as in Fusion) */
  --sk-origin: #c0362b;
  --sk-grid: rgba(60, 70, 90, 0.08);
  --sk-axis: rgba(60, 70, 90, 0.35);
  --sk-dim: #4f5b70;
  --sk-region: rgba(15, 123, 255, 0.16);
  --sk-passive: #6a7a96;
  --sk-plane: #5b8be6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --sk-free: #6fa3ff; --sk-sel: #4fa2ff; --sk-hi: #ffb340; --sk-ref: #f0a060; --sk-origin: #ff7a6b; --sk-proj: #b58cff;
    --sk-grid: rgba(200, 210, 230, 0.07); --sk-axis: rgba(200, 210, 230, 0.32); --sk-dim: #a7b2c6;
    --sk-region: rgba(79, 162, 255, 0.2); --sk-passive: #8fa0bf; --sk-plane: #7d9dff;
  }
}
:root[data-theme="dark"] {
  --sk-free: #6fa3ff; --sk-sel: #4fa2ff; --sk-hi: #ffb340; --sk-ref: #f0a060; --sk-origin: #ff7a6b; --sk-proj: #b58cff;
  --sk-grid: rgba(200, 210, 230, 0.07); --sk-axis: rgba(200, 210, 230, 0.32); --sk-dim: #a7b2c6;
  --sk-region: rgba(79, 162, 255, 0.2); --sk-passive: #8fa0bf; --sk-plane: #7d9dff;
}

body.cad-app { grid-template-rows: auto auto minmax(0, 1fr) auto; }

/* ---------- toolbar ---------- */
.toolbar {
  display: flex; align-items: stretch; gap: 4px; padding: 4px 10px; background: var(--panel); border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: thin; min-height: 52px;
}
.tgroup { display: flex; align-items: stretch; gap: 2px; padding-right: 6px; margin-right: 4px; border-right: 1px solid var(--line); }
.tgroup:last-child, .tgroup.end { border-right: 0; }
.tgroup.end { margin-left: auto; align-items: center; gap: 6px; padding-left: 8px; }
.tool {
  display: grid; justify-items: center; align-content: center; gap: 1px; min-width: 52px; padding: 4px 6px; border: 1px solid transparent; border-radius: 6px;
  background: none; cursor: pointer; color: var(--ink);
}
.tool:hover:not(:disabled) { background: var(--panel-2); border-color: var(--line); }
.tool[aria-pressed="true"] { background: var(--accent-weak); border-color: var(--accent); }
.tool:disabled { opacity: 0.38; cursor: default; }
.tool .ti { width: 22px; height: 22px; display: grid; place-items: center; }
.tool .ti svg { width: 22px; height: 22px; }
.tool .tl { font-size: 11px; color: var(--muted); white-space: nowrap; }
.tool[aria-pressed="true"] .tl { color: var(--ink); }
.tool.con { min-width: 40px; }
.tool .cg { width: 22px; height: 22px; display: grid; place-items: center; font: 700 14px var(--font-ui); border: 1px solid var(--line-strong); border-radius: 5px; background: var(--panel-2); }
.toolbar.sketching { --tb-bg: color-mix(in srgb, var(--accent-weak) 45%, var(--panel)); background: var(--tb-bg); }
/* constraints: a compact two-row palette (names in the tooltip and for screen readers), labels back on very wide screens */
.tgroup.cons { display: grid; grid-template-rows: repeat(2, 22px); grid-auto-flow: column; align-content: center; gap: 2px 3px; }
.tgroup.cons .tool.con { min-width: 0; width: 28px; height: 22px; padding: 0; grid-template-columns: 1fr; }
.tgroup.cons .tool.con .cg { width: 24px; height: 20px; font-size: 12px; }
.tgroup.cons .tool.con .tl { display: none; }
/* Finish / Cancel never scroll out of sight */
.toolbar .tgroup.end { position: sticky; right: -10px; z-index: 2; background: var(--tb-bg, var(--panel)); padding-right: 10px; box-shadow: -10px 0 10px -6px var(--tb-bg, var(--panel)); }
@media (max-width: 1620px) {
  .toolbar.sketching .tool { min-width: 44px; padding: 4px 4px; }
  .toolbar.sketching .tool .tl { font-size: 10px; }
}
.tool .ti.cg-trio { width: auto; font: 700 13px var(--font-ui); letter-spacing: 1px; color: var(--ink); }
/* a tool found with Search tools: where it lives on the toolbar */
.found { border-radius: 8px; box-shadow: 0 0 0 2px var(--accent); animation: found 0.65s ease-in-out 3; }
@keyframes found { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 35%, transparent); } }
@media (prefers-reduced-motion: reduce) { .found { animation: none; } }
/* Search tools: first on the toolbar, in the accent colour so it is easy to spot */
.toolbar [data-tool="search"] .ti { color: var(--accent); }
.toolbar [data-tool="search"] .tl { color: var(--accent); font-weight: 600; }
.fin-short { display: none; }
@media (max-width: 1460px) { .fin-long { display: none; } .fin-short { display: inline; } }
@media (max-width: 1380px) {
  .toolbar.sketching .tool { min-width: 38px; padding: 4px 2px; }
  .toolbar.sketching .tool .tl { font-size: 9.5px; }
  .toolbar.sketching .tgroup { padding-right: 4px; margin-right: 2px; }
  .fin-long { display: none; } .fin-short { display: inline; }
  .toolbar:not(.sketching) .tool { min-width: 46px; padding: 4px 4px; }
  .toolbar:not(.sketching) .tool .tl { font-size: 10.5px; }
}
@media (max-width: 1300px) { .toolbar:not(.sketching) .tool { padding-left: 2px; padding-right: 2px; } .toolbar:not(.sketching) { gap: 2px; } .toolbar:not(.sketching) .tgroup { padding-right: 3px; margin-right: 2px; } }
@media (max-width: 1600px) { .toolbar:not(.sketching) .tool { min-width: 42px; padding-left: 3px; padding-right: 3px; } .toolbar:not(.sketching) .tool .tl { font-size: 10.5px; } }
.ok-btn { background: var(--ok); color: #fff; border-color: var(--ok); font-weight: 600; }
.ok-btn:hover { background: var(--ok); filter: brightness(1.08); }
.tb-hint { align-self: center; color: var(--muted); font-size: 13px; padding-left: 6px; }
.hint-group { border-right: 0; }
/* the hint gives way to the tools (it is in the status bar too) */
.toolbar:not(.sketching) .hint-group { flex: 1 1 0; min-width: 0; overflow: hidden; }
.toolbar:not(.sketching) .tb-hint { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toolbar .tb-overflow .ti { font-size: 18px; line-height: 22px; color: var(--muted); }

/* lesson highlight */
.pulse { position: relative; animation: pulse 1.6s ease-in-out infinite; border-color: var(--sk-hi) !important; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--sk-hi) 55%, transparent); } 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--sk-hi) 0%, transparent); } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; box-shadow: 0 0 0 2px var(--sk-hi); } }

/* ---------- layout ---------- */
.cad { display: grid; grid-template-columns: 240px minmax(0, 1fr) 330px; min-height: 0; }
.ftree { background: var(--panel); border-right: 1px solid var(--line); overflow: auto; display: flex; flex-direction: column; min-height: 0; }
.tree-sec { padding: 8px 0; }
.tree-sec + .tree-sec { border-top: 1px solid var(--line); }
.tree-sec h2 { margin: 0 12px 4px; font: 600 11px var(--font-ui); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.tree-sec h2 span { font-weight: 400; letter-spacing: 0; }
.features, .parts { list-style: none; margin: 0; padding: 0; }
.features li, .parts li { display: flex; align-items: center; gap: 7px; padding: 4px 12px; font-size: 13px; cursor: default; user-select: none; min-height: 28px; }
.features li .ti, .parts .ti { width: 18px; height: 18px; flex: none; color: var(--muted); }
.features li .ti svg { width: 18px; height: 18px; }
.features li.fixed { color: var(--muted); cursor: pointer; }
.features li.fixed:hover, .features li.feat:hover, .parts li:hover { background: var(--panel-2); }
.features li.sel, .parts li.sel { background: var(--accent-weak); }
.features li.editing { background: var(--accent-weak); box-shadow: inset 3px 0 0 var(--accent); font-weight: 600; }
.features li.feat { cursor: pointer; }
.features li.rolled { opacity: 0.45; }
.features li.supp .fname { text-decoration: line-through; color: var(--muted); }
.features li.err .fname { color: var(--err); }
.features li.warn .fname { color: var(--warn); }
.features li .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.features li .badge { font: 700 12px var(--font-mono); color: var(--sk-free); }
.features li .slow { font-size: 12px; color: var(--muted, #6a7a96); margin-left: 4px; cursor: help; }
.features li .st { font-weight: 700; font-size: 12px; width: 16px; height: 16px; display: grid; place-items: center; border-radius: 50%; }
.features li .st.err { background: var(--err); color: #fff; }
.features li .st.warn { color: var(--warn); }
.features li.drop { box-shadow: inset 0 -2px 0 var(--accent); }
.features li.drop-above { box-shadow: inset 0 2px 0 var(--accent); }
/* history tree: what the selected feature uses (parents, amber) and what uses it (children, blue) */
.features li.parent { box-shadow: inset 3px 0 0 var(--warn); }
.features li.child { box-shadow: inset 3px 0 0 var(--accent); }
.features li.feat[draggable="true"] { cursor: grab; }
/* folders in the feature tree (Onshape and SOLIDWORKS) */
.features li.folder { cursor: pointer; font-weight: 600; }
.features li.folder:hover { background: var(--panel-2); }
.features li.folder .caret { width: 10px; flex: none; color: var(--muted); font-size: 11px; margin-left: -4px; }
.features li.folder .fcount { font: 11px var(--font-mono); color: var(--muted); }
.features li.feat.in-folder { padding-left: 26px; }
.features li.folder + li.feat.in-folder, .features li.feat.in-folder + li.feat.in-folder { border-left: 0; }
.features li.rename-row input.rename, .features li.folder input.rename { flex: 1; min-width: 0; }
.features li.feat-msg { display: block; min-height: 0; padding: 4px 12px 8px 37px; font-size: 12px; line-height: 1.4; color: var(--ink); background: color-mix(in srgb, var(--warn) 9%, var(--panel)); cursor: default; }
.features li.feat-msg.err { background: color-mix(in srgb, var(--err) 9%, var(--panel)); }
.features li.feat-msg span { display: block; margin-bottom: 5px; }
.fd-hist { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 8px; display: grid; gap: 6px; }
.fd-down { margin: 0; color: var(--ink); font-size: 12.5px; background: color-mix(in srgb, var(--warn) 14%, var(--panel)); border-radius: 6px; padding: 6px 8px; line-height: 1.4; }
.fd-down strong { font-weight: 600; }
.features li.rollback { padding: 0 8px; min-height: 12px; cursor: grab; position: relative; }
.features li.rollback::before { content: ""; flex: 1; height: 4px; border-radius: 2px; background: var(--accent); opacity: 0.75; }
.features li.rollback:hover::before { opacity: 1; height: 5px; }
.features li.rollback .roll-end { flex: none; margin-left: 8px; border: 1px solid var(--accent); background: var(--panel); color: var(--accent); border-radius: 10px; font: 600 11px var(--font-ui); padding: 1px 8px; cursor: pointer; }
.features li.rollback .roll-end:hover { background: var(--accent); color: #fff; }
.features input.rename, .parts input.rename { flex: 1; min-width: 0; font-size: 13px; padding: 2px 5px; border: 1px solid var(--accent); border-radius: 4px; background: var(--panel); }
.parts li { gap: 6px; padding-left: 6px; cursor: pointer; }
.parts li.empty { color: var(--muted); cursor: default; padding-left: 12px; }
/* sub-assembly folders in the parts list (a STEP file's tree, or made by the student) */
.parts li.pfolder { font-weight: 600; }
.parts li.pfolder .caret { width: 10px; flex: none; color: var(--muted); font-size: 11px; cursor: pointer; }
.parts li.pfolder .ti { display: inline-flex; width: 16px; height: 16px; flex: none; color: var(--muted); }
.parts li.pfolder .ti svg { width: 16px; height: 16px; }
.parts li.pfolder .pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.parts li.pfolder .fcount { font: 11px var(--font-mono); color: var(--muted); }
.parts .eye { width: 24px; height: 24px; padding: 3px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 4px; flex: none; }
.parts .eye:hover { background: var(--line); color: var(--ink); }
.parts .eye svg { width: 18px; height: 18px; }
.pswatch { position: relative; width: 14px; height: 14px; border-radius: 3px; flex: none; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18); cursor: pointer; overflow: hidden; }
.pswatch:hover { box-shadow: 0 0 0 2px var(--accent); }
.pswatch input[type=color] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.parts .pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.parts .psize { font: 11px var(--font-mono); color: var(--muted); white-space: nowrap; }

/* ---------- viewport ---------- */
.viewport { position: relative; background: radial-gradient(ellipse at 50% 35%, color-mix(in srgb, var(--panel) 70%, var(--stage)), var(--stage)); min-height: 0; overflow: hidden; }
.viewport > canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#ov { outline: none; touch-action: none; }
.viewnav { position: absolute; top: 8px; right: 10px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; z-index: 3; }
.vcube { width: 128px; height: 128px; display: block; touch-action: none; margin: -6px -6px -4px 0;
  --vc-face: #fbfcfd; --vc-bevel: #edf0f4; --vc-line: #d5dbe4; --vc-edge: #a9b2c0; --vc-text: #3b4250; --vc-hot: #b9d5f7; --vc-ctl: #b8bfca; --vc-ctl-hot: var(--accent); }
.viewcube { display: flex; align-items: center; gap: 2px; padding: 3px; background: color-mix(in srgb, var(--panel) 92%, transparent); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.viewcube button { border: 0; background: none; padding: 4px 7px; border-radius: 5px; font-size: 12px; cursor: pointer; color: var(--ink); display: inline-grid; place-items: center; min-height: 26px; }
.viewcube button:hover { background: var(--accent-weak); }
.viewcube button[aria-pressed="true"] { background: var(--accent-weak); color: var(--accent); }
.viewcube select { border: 0; background: none; font: inherit; font-size: 12px; color: var(--ink); padding: 3px 2px; border-radius: 5px; cursor: pointer; max-width: 118px; }
.viewcube select:hover { background: var(--accent-weak); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .vcube { --vc-face: #343d4f; --vc-bevel: #2a3240; --vc-line: #485366; --vc-edge: #6e7b92; --vc-text: #e6ebf4; --vc-hot: #3d5f91; --vc-ctl: #6f7c92; } }
:root[data-theme="dark"] .vcube { --vc-face: #343d4f; --vc-bevel: #2a3240; --vc-line: #485366; --vc-edge: #6e7b92; --vc-text: #e6ebf4; --vc-hot: #3d5f91; --vc-ctl: #6f7c92; }
.explode { position: absolute; right: 10px; bottom: 10px; padding: 5px 8px; background: color-mix(in srgb, var(--panel) 92%, transparent); border: 1px solid var(--line); border-radius: 8px; }
.nav-hint { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); font-size: 12px; color: var(--muted); background: color-mix(in srgb, var(--panel) 88%, transparent); padding: 4px 10px; border-radius: 999px; pointer-events: none; transition: opacity 1s; }
.nav-hint.fade { opacity: 0; }
.vstatus { position: absolute; left: calc(50% - 60px); top: 10px; transform: translateX(-50%); font-size: 13px; padding: 5px 12px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); max-width: calc(100% - 260px); text-align: center; }
.vstatus.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); }
.vstatus.warn { color: var(--sk-free); }
.vstatus.err { color: var(--err); border-color: var(--err); }

/* feature dialog (top-left of the view, like Onshape) */
.fdialog { position: absolute; left: 10px; top: 10px; width: 290px; max-height: calc(100% - 20px); overflow: auto; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: var(--shadow); z-index: 5; }
.fd-head { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 10px; border-bottom: 1px solid var(--line); background: var(--panel-2); border-radius: 8px 8px 0 0; }
.fd-head .ti { width: 20px; height: 20px; color: var(--accent); flex: none; }
.fd-head .ti svg { width: 20px; height: 20px; }
.fd-name { flex: 1; min-width: 0; border: 1px solid transparent; background: none; font-weight: 600; padding: 3px 4px; border-radius: 4px; }
.fd-name:hover, .fd-name:focus { border-color: var(--line); background: var(--panel); }
.fd-ok, .fd-cancel { width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--line); cursor: pointer; font-weight: 700; font-size: 15px; flex: none; }
.fd-ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.fd-cancel { background: var(--panel); color: var(--err); }
.fd-help { width: 22px; height: 22px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-strong); color: var(--muted); font: 700 12px var(--font-ui); text-decoration: none; margin-right: 2px; }
.fd-help:hover { color: var(--accent); border-color: var(--accent); }
.fd-body { padding: 10px; display: grid; gap: 9px; }
.fd-body .seg { width: 100%; }
.fd-body .seg button { flex: 1; }
.fd-row { display: grid; grid-template-columns: 86px minmax(0, 1fr); align-items: center; gap: 8px; }
.fd-row > label { font-size: 12.5px; color: var(--muted); }
.fd-ctl { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fd-ctl select, .fd-ctl input[type=text] { flex: 1; min-width: 0; padding: 5px 7px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel-2); }
.fd-num { flex: 1; min-width: 0; padding: 5px 7px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel-2); font: 13px var(--font-mono); }
.fd-num.bad { border-color: var(--err); }
.fd-ctl .unit { font-size: 12px; color: var(--muted); }
.fd-ctl .seg.seg-dir, .fd-ctl .seg.seg-fill { display: flex; width: 100%; }
.fd-ctl .seg.seg-dir button, .fd-ctl .seg.seg-fill button { flex: 1; min-width: 0; padding: 5px 0; }
.fd-sub { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 2px; }
.fd-parts { display: grid; gap: 3px; max-height: 160px; overflow: auto; }
.chk { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.chk input { accent-color: var(--accent); }
.fd-error { margin: 0; color: var(--err); font-size: 12.5px; background: color-mix(in srgb, var(--err) 9%, var(--panel)); border-radius: 6px; padding: 6px 8px; }
.help.small { font-size: 12px; }
.btn.small { padding: 4px 8px; font-size: 12.5px; }

/* inline dimension value */
.val-edit { position: absolute; z-index: 8; display: grid; grid-template-columns: auto 90px 30px; gap: 4px 6px; align-items: center; padding: 6px 8px; background: var(--panel); border: 1px solid var(--accent); border-radius: 8px; box-shadow: var(--shadow); }
.val-edit label { font-size: 12px; color: var(--muted); }
.val-edit input { width: 90px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 5px; font: 14px var(--font-mono); background: var(--panel-2); }
.val-edit .ok { height: 28px; border: 0; border-radius: 5px; background: var(--ok); color: #fff; font-weight: 700; cursor: pointer; }
.val-edit .err { grid-column: 1 / -1; color: var(--err); font-size: 12px; max-width: 230px; }
.val-edit .err:empty { display: none; }

.ctx-menu { position: fixed; z-index: 40; min-width: 190px; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); max-height: calc(100vh - 16px); overflow-y: auto; }
.ctx-menu button { display: block; width: 100%; text-align: left; padding: 6px 10px; border: 0; background: none; border-radius: 5px; cursor: pointer; font-size: 13px; white-space: pre; }
.ctx-menu button:hover { background: var(--accent-weak); }
.ctx-menu button.danger { color: var(--err); }
.ctx-menu .menu-head { padding: 6px 10px 4px; font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.ctx-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* ---------- lesson ---------- */
.lesson { background: var(--panel); border-left: 1px solid var(--line); overflow: auto; padding: 0 14px 18px; display: flex; flex-direction: column; gap: 10px; }
.lesson > * { flex-shrink: 0; }
.lesson-head { position: sticky; top: 0; background: var(--panel); display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 0 8px; border-bottom: 1px solid var(--line); z-index: 1; }
.lesson-head b { display: block; font-family: var(--font-display); font-size: 15px; }
.lesson-head small { color: var(--muted); font-size: 12px; }
.lesson-prog { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.lesson-prog button { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--panel); font: 600 11px var(--font-ui); cursor: pointer; color: var(--muted); padding: 0; }
.lesson-prog li.done button { background: var(--ok); color: #fff; border-color: var(--ok); }
.lesson-prog li.cur button { box-shadow: 0 0 0 2px var(--accent); color: var(--ink); }
.lesson-title { margin: 4px 0 0; font: 600 17px var(--font-display); }
.lesson-title span { color: var(--muted); }
.lesson-intro { margin: 0; font-size: 13.5px; }
.lesson-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lesson-steps li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 8px; padding: 8px; border-radius: 8px; border: 1px solid transparent; font-size: 13px; }
.lesson-steps li.cur { border-color: var(--accent); background: color-mix(in srgb, var(--accent-weak) 55%, var(--panel)); }
.lesson-steps li.ok { color: var(--muted); }
.lesson-steps li.ok b { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--ok) 70%, transparent); }
.lesson-steps .mark { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 600 11px var(--font-ui); border: 1px solid var(--line-strong); background: var(--panel); }
.lesson-steps li.ok .mark { background: var(--ok); border-color: var(--ok); color: #fff; }
.lesson-steps li.cur .mark { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.lesson-steps .how { margin-top: 4px; color: var(--ink); line-height: 1.5; }
.lesson-steps .how ul { margin: 4px 0 0; padding-left: 18px; }
.lesson-steps .how li { display: list-item; padding: 0; border: 0; font-size: 13px; }
.nudge { margin: 6px 0 0; color: var(--warn); font-size: 12.5px; }
.lesson-done { border-radius: 8px; padding: 10px 12px; background: color-mix(in srgb, var(--ok) 12%, var(--panel)); border: 1px solid color-mix(in srgb, var(--ok) 45%, var(--line)); font-size: 13px; }
.lesson-done b { color: var(--ok); }
.lesson-done p { margin: 4px 0 0; }
.lesson-bar { display: flex; gap: 6px; margin-top: auto; padding-top: 8px; position: sticky; bottom: -18px; background: var(--panel); padding-bottom: 6px; }
.lesson-bar .btn:last-child { margin-left: auto; }
table.cut { border-collapse: collapse; margin-top: 6px; font-size: 12.5px; width: 100%; }
table.cut th, table.cut td { border-bottom: 1px solid var(--line); padding: 3px 4px; text-align: left; }
table.cut td:last-child { font-family: var(--font-mono); white-space: nowrap; }
/* a choice of what Show me builds (a starting shape, a blank size) */
.lesson-choice { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.lesson-choice select { flex: 1; min-width: 0; font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line-strong); border-radius: 6px; padding: 4px 6px; }
/* design checks written from the model (Fix / Check / Tip) */
.hp-issues { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.lesson-steps .how .hp-issues li { display: block; padding: 5px 8px; border-radius: 6px; font-size: 12.5px; line-height: 1.4; border: 1px solid var(--line); }
.lesson-steps li.ok .how b { text-decoration: none; }
.hp-issues li b { display: inline-block; min-width: 42px; font: 700 10.5px var(--font-ui); letter-spacing: 0.06em; text-transform: uppercase; }
.hp-issues .hp-bad { border-color: color-mix(in srgb, var(--err) 45%, var(--line)); background: color-mix(in srgb, var(--err) 8%, var(--panel)); }
.hp-issues .hp-bad b { color: var(--err); }
.hp-issues .hp-warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); background: color-mix(in srgb, var(--warn) 8%, var(--panel)); }
.hp-issues .hp-warn b { color: var(--warn); }
.hp-issues .hp-tip b, .hp-issues .hp-ok b { color: var(--ok); }
.hp-issues .hp-ok { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); background: color-mix(in srgb, var(--ok) 8%, var(--panel)); }
.lesson.collapsed { gap: 0; }
.cad:has(.lesson.collapsed) { grid-template-columns: 240px minmax(0, 1fr) 190px; }

/* ---------- small screens ---------- */
@media (max-width: 1180px) { .cad { grid-template-columns: 210px minmax(0, 1fr) 290px; } .who input { width: 110px; } }
@media (max-width: 900px) {
  body.cad-app { overflow: auto; height: auto; display: block; }
  .cad { display: flex; flex-direction: column; }
  .viewport { height: 62vh; min-height: 360px; order: 1; }
  .lesson { order: 2; border-left: 0; border-top: 1px solid var(--line); max-height: none; }
  .ftree { order: 3; border-right: 0; border-top: 1px solid var(--line); }
  .modes { order: 3; }
  .tool .tl { display: none; }
  .tool { min-width: 40px; }
  .vstatus { max-width: calc(100% - 20px); top: 52px; }
  .fdialog { width: min(290px, calc(100% - 20px)); }
  .nav-hint { display: none; }
}

/* measure & section panels */
.vpanel { position: absolute; z-index: 4; background: color-mix(in srgb, var(--panel) 95%, transparent); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); font-size: 13px; }
.section-panel { right: 10px; bottom: 66px; display: flex; align-items: center; gap: 8px; padding: 6px 8px; }
.section-panel input[type=range] { width: 160px; accent-color: var(--accent); }
.section-panel .sect-val { font: 12px var(--font-mono); white-space: nowrap; }
.section-panel .sect-off { width: 58px; font: 12px var(--font-mono); padding: 3px 5px; text-align: right; }
.measure-panel { left: 10px; bottom: 10px; width: 250px; max-height: 50%; overflow: auto; padding: 8px 10px; display: grid; gap: 3px; }
.measure-panel .mp-head { display: flex; justify-content: space-between; align-items: center; }
.measure-panel .msub { margin-top: 6px; font-weight: 600; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; }
.draft-panel .dswatch { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; border: 1px solid rgba(0, 0, 0, 0.25); }
.draft-panel .seg button { padding: 2px 8px; }
.measure-panel .mrow { display: flex; justify-content: space-between; gap: 10px; }
.measure-panel .mrow b { font: 600 12.5px var(--font-mono); text-align: right; }
.flat-panel { left: 10px; bottom: 10px; max-width: min(460px, calc(100% - 20px)); max-height: 45%; overflow: auto; padding: 8px 10px; display: grid; gap: 4px; }
.flat-panel .mp-head { display: flex; justify-content: space-between; align-items: center; }
.flat-panel .ft-part { margin-top: 4px; }
.flat-panel .ft-part .warn { color: var(--warn, #b45309); font-weight: 600; }
.flat-panel .ft-table { border-collapse: collapse; font: 12px var(--font-mono); }
.flat-panel .ft-table th { font: 600 11px var(--font); color: var(--muted); text-align: right; padding: 2px 6px; border-bottom: 1px solid var(--line); }
.flat-panel .ft-table td { text-align: right; padding: 2px 6px; }
.flat-panel .ft-table th:first-child, .flat-panel .ft-table td:first-child { text-align: left; }
.flat-panel .ft-table td.up { color: #2563eb; } .flat-panel .ft-table td.down { color: #dc2626; }
.parts li.totals { cursor: default; font-weight: 600; border-top: 1px solid var(--line); margin-top: 4px; padding-left: 12px; }
.parts li.totals span:first-child { flex: 1; }

/* parameters */
.tree-filter { display: flex; gap: 4px; margin: 0 12px 6px; }
.tree-filter input { flex: 1; min-width: 0; font: 13px var(--font-ui); padding: 3px 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); color: var(--ink); }
.tree-find { margin-right: 10px; color: var(--muted) !important; }
.tree-find svg { width: 13px; height: 13px; vertical-align: -2px; }
.tree-find:hover { color: var(--accent) !important; }
.features li.tree-none { color: var(--muted); font-style: italic; }
.tree-add { float: right; border: 0; background: none; color: var(--accent); font: 600 11px var(--font-ui); cursor: pointer; text-transform: none; letter-spacing: 0; padding: 0; }
.params { list-style: none; margin: 0; padding: 0; }
.params li { display: flex; align-items: center; gap: 4px; padding: 2px 8px 2px 12px; font-size: 12.5px; }
.params li.empty { color: var(--muted); font-size: 12px; }
.params input { min-width: 0; border: 1px solid transparent; background: none; border-radius: 4px; padding: 2px 4px; font: 12.5px var(--font-mono); }
.params input:hover, .params input:focus { border-color: var(--line); background: var(--panel); }
.params .pname-in { width: 64px; font-weight: 600; }
.params .pexpr-in { flex: 1; }
.params .pexpr-in.bad { border-color: var(--err); }
.params .eq, .params .pval { color: var(--muted); font: 11.5px var(--font-mono); }
.params li.err .pval { color: var(--err); font-weight: 700; }
.params .pdel { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 0 2px; }
.params .pdel:hover { color: var(--err); }

.lesson.collapsed .lesson-head { flex-direction: column; align-items: flex-start; }

/* drawing dialog */
dialog.wide { width: fit-content; max-width: calc(100vw - 32px); }
.drawing-dlg { width: min(1100px, calc(100vw - 32px)); }
.drawing-dlg .dr-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
.drawing-dlg .dr-opts { display: grid; gap: 9px; }
.drawing-dlg .fd-row { display: grid; grid-template-columns: 78px minmax(0, 1fr); align-items: center; gap: 8px; font-size: 13px; }
.drawing-dlg .fd-row > span { color: var(--muted); }
.drawing-dlg input[type=text], .drawing-dlg input[type=number], .drawing-dlg select { padding: 5px 7px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel-2); min-width: 0; width: 100%; }
.drawing-dlg .dr-cut { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11.5px; line-height: 1.25; }
.drawing-dlg .dr-cut input { width: 64px; flex: none; color: var(--ink); font-size: 13px; }
.drawing-dlg .fd-row[hidden], .drawing-dlg .help[hidden] { display: none; }
.drawing-dlg .dr-preview img.pick { cursor: crosshair; }
.drawing-dlg .seg { width: 100%; }
.drawing-dlg .seg button { flex: 1; }
.drawing-dlg .dr-preview { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 6px; }
.drawing-dlg .dr-preview img { width: 100%; height: auto; display: block; aspect-ratio: 1.414; }
@media (max-width: 800px) { .drawing-dlg .dr-grid { grid-template-columns: 1fr; } }

/* face pickers in dialogs, laser dialog */
.fd-pick { display: block; width: 100%; white-space: normal; text-align: left; padding: 7px 9px; border: 1px dashed var(--line-strong); border-radius: 6px; font-size: 12.5px; color: var(--muted); background: var(--panel-2); }
.fd-pick.set { border-style: solid; color: var(--ink); }
.fd-pick.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-weak); color: var(--ink); }
/* Decal: the picture, on a checkerboard so see-through parts show */
.fd-decal { display: flex; align-items: center; gap: 8px; }
.fd-decal-img { max-width: 76px; max-height: 52px; border-radius: 4px; border: 1px solid var(--line); background: repeating-conic-gradient(#d9dde3 0 25%, #fff 0 50%) 0 0 / 10px 10px; }
#fdialog input[type="range"][data-field="opacity"] { flex: 1; min-width: 0; }
.ls-wh { display: flex; align-items: center; gap: 4px; }
.ls-wh input { width: 70px !important; }
.ls-preview { min-height: 200px; display: grid; place-items: center; }

/* documents */
.doc-name { display: block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 0; background: none; padding: 0; color: var(--muted); font: inherit; font-size: 12px; cursor: text; text-align: left; }
.doc-name:hover { color: var(--ink); text-decoration: underline dotted; }
.docs-btn { display: inline-flex; align-items: center; gap: 6px; }
.cad:has(> .lesson[hidden]) { grid-template-columns: 240px minmax(0, 1fr); }
@media (max-width: 1180px) { .cad:has(> .lesson[hidden]) { grid-template-columns: 210px minmax(0, 1fr); } }
.docs-dlg { width: min(980px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto; }
.docs-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
.docs-head h2 { margin: 0 0 2px; }
.docs-sec { margin-top: 14px; }
.docs-sec h3 { margin: 0 0 4px; font-size: 14px; }
.docs-bar { display: flex; gap: 8px; }
.doc-cards { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.doc-cards li { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); display: grid; grid-template-rows: auto 1fr; transition: box-shadow .15s, border-color .15s; }
.doc-cards li:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.doc-cards li.cur { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-weak); }
.doc-cards li.empty { padding: 16px; color: var(--muted); grid-template-rows: auto; }
.doc-thumb { aspect-ratio: 16 / 10; width: 100%; display: block; object-fit: cover; background: radial-gradient(ellipse at 50% 40%, #ffffff, #dfe5ee); border: 0; padding: 0; cursor: pointer; }
.doc-thumb.none { display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.doc-card-body { display: grid; gap: 2px; padding: 8px 10px 10px; }
.doc-card-body b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.doc-card-body small { color: var(--muted); font-size: 12px; }
.doc-card-body .doc-acts { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.doc-cards.samples .doc-card-body .blurb { font-size: 12px; color: var(--muted); line-height: 1.35; }
.doc-open { flex: 1; min-width: 0; display: grid; text-align: left; border: 0; background: none; padding: 6px; border-radius: 6px; cursor: pointer; color: var(--ink); font: inherit; }
.tut-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.btn.danger { color: var(--err); }
.tut-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; max-width: 640px; }
.tut-list li b, .tut-list li small, .tut-list li .muted { grid-column: 1; }
.tut-list li small { color: var(--muted); }
.tut-list li button { grid-column: 2; grid-row: 1 / span 3; align-self: center; }
.tut-list li.school { border-color: var(--accent); background: var(--accent-weak); }


/* guide (scaffolding for free modelling) */
.guide-levels { margin: 2px 0 4px; }
.guide-term { margin-bottom: 0; }
.guide-aka { margin: 0; font-size: 12px; color: var(--muted); }
.guide-tool { font-size: 13px; padding: 8px 10px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); }
.guide-hint { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 6; max-width: min(640px, calc(100% - 300px)); padding: 7px 12px; border-radius: 8px; background: var(--panel); border: 1px solid var(--accent); box-shadow: var(--shadow); font-size: 13px; }
.guide-hint span { color: var(--muted); }
.statusbar .about-link + .about-link { margin-left: 12px; }

/* exact-geometry engine indicator (status bar) */
.about-link.engine { display: inline-flex; align-items: center; gap: 6px; }
.about-link.engine::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.about-link.engine[data-state="on"]::before { background: #2f9e57; }
.about-link.engine[data-state="busy"]::before { background: #e0a020; animation: engine-pulse 1s ease-in-out infinite alternate; }
.about-link.engine[data-state="off"]::before { background: var(--err, #c8463a); }
@keyframes engine-pulse { from { opacity: .35; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .about-link.engine[data-state="busy"]::before { animation: none; } }
.fd-pick.engine-wait { font-style: italic; }


/* plane show/hide in the feature tree */
.features li .eye { margin-left: auto; width: 24px; height: 22px; display: grid; place-items: center; border: 0; background: none; color: var(--muted); border-radius: 4px; cursor: pointer; opacity: 0; padding: 0; }
.features li .eye svg { width: 16px; height: 16px; }
.features li:hover .eye, .features li:focus-within .eye, .features li .eye.off { opacity: 1; }
.features li .eye:hover { background: var(--panel-2); color: var(--ink); }
.features li .eye.off { color: var(--line-strong); }
@media (hover: none) { .features li .eye { opacity: 1; } }

/* parts list: a width that is not a standard board (needs ripping) */
.psize.nonstd { text-decoration: underline dotted var(--warn, #c77700); text-underline-offset: 3px; }

/* render picture dialog */
.picture-dlg { width: min(900px, calc(100vw - 32px)); }
.pic-grid { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 18px; align-items: start; }
.pic-opts { display: grid; gap: 10px; }
.pic-preview { border: 1px solid var(--line); border-radius: 8px; padding: 8px; display: grid; place-items: center; min-height: 260px;
  background-color: var(--panel-2); background-image: linear-gradient(45deg, rgba(0,0,0,.05) 25%, transparent 25%, transparent 75%, rgba(0,0,0,.05) 75%), linear-gradient(45deg, rgba(0,0,0,.05) 25%, transparent 25%, transparent 75%, rgba(0,0,0,.05) 75%); background-size: 16px 16px; background-position: 0 0, 8px 8px; }
.pic-preview img { max-width: 100%; max-height: 52vh; display: block; }
@media (max-width: 700px) { .pic-grid { grid-template-columns: 1fr; } }

/* configurations (named sets of parameter values) */
.params .cfg-row { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px; padding: 2px 12px 8px; }
.params .cfg-lab { font-size: 12px; color: var(--muted); }
.params .cfg-sel { font: inherit; font-size: 12.5px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); min-width: 0; }

/* versions */
.versions-dlg { width: min(980px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto; }
.doc-cards li .ver-tag { position: absolute; top: 8px; left: 8px; font-size: 11px; padding: 2px 7px; border-radius: 999px; background: color-mix(in srgb, var(--panel) 88%, transparent); border: 1px solid var(--line); color: var(--muted); }
.doc-cards li .ver-tag.named { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.doc-cards li.ver-new { border-style: dashed; border-color: var(--accent); }
.doc-cards li.ver-new input { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); margin-top: 4px; }

/* header: stay on one row on laptop screens (1280 px and up), so the model gets the height */
@media (max-width: 1500px) {
  .cad-app .who input { width: 116px; }
  .cad-app .who input#student-class { width: 70px; }
  .cad-app .docs-btn .lbl { display: none; }
  .cad-app .docs-btn { padding-left: 9px; padding-right: 9px; }
  .cad-app .topbar { flex-wrap: nowrap; gap: 10px; }
  .cad-app .topbar .i18n-btn-label { display: none; }
}
@media (max-width: 1380px) {
  .cad-app .who input { width: 96px; }
  .cad-app .who input#student-class { width: 58px; }
  .cad-app .topbar .actions { gap: 4px; }
}
#btn-open .open-ic { display: none; }
/* 1280 px: Open file and Render as icons (their names stay in the tooltip and for screen readers) */
@media (max-width: 1330px) {
  .cad-app #btn-open, .cad-app #btn-render { font-size: 0; padding-left: 9px; padding-right: 9px; }
  .cad-app #btn-open .open-ic { display: inline; }
  .cad-app #btn-open svg, .cad-app #btn-render svg { width: 16px; height: 16px; }
}
@media (max-width: 1240px) { .cad-app .topbar { flex-wrap: wrap; } }
.cad-app .topbar.hdr-wrap { flex-wrap: wrap; }

/* share link */
.share-row { display: flex; gap: 8px; margin: 10px 0 4px; }
.share-row input { flex: 1; min-width: 0; font: 12px var(--font-mono); padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); color: var(--ink); }

#dr-info.bad { color: var(--err); font-weight: 600; }
/* Joint dialog: the joint types as picture buttons */
.joint-kinds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 2px 0 10px; }
.joint-kinds button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 4px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); font: inherit; font-size: 11.5px; line-height: 1.15; cursor: pointer; text-align: center; }
.joint-kinds button:hover { border-color: var(--accent); }
.joint-kinds button[aria-pressed="true"] { background: var(--accent-weak); border-color: var(--accent); font-weight: 600; }
.joint-kinds .jk-ic { width: 26px; height: 26px; display: block; color: var(--accent); }
.joint-kinds .jk-ic svg { width: 100%; height: 100%; display: block; }
/* Design check */
.check-panel { left: 10px; bottom: 10px; width: 300px; max-height: calc(100% - 90px); overflow: auto; padding: 8px 10px 10px; display: grid; gap: 6px; }
.check-panel .mp-head { display: flex; justify-content: space-between; align-items: center; }
.check-panel .ck-sum { font-weight: 600; padding: 6px 8px; border-radius: 6px; font-size: 13px; }
.check-panel .ck-sum.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.check-panel .ck-sum.warn { background: color-mix(in srgb, #d08a00 16%, transparent); color: #9a6400; }
.check-panel .ck-sum.bad { background: color-mix(in srgb, var(--err) 12%, transparent); color: var(--err); }
.check-panel .ck-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.check-panel .ck { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 6px; align-items: start; }
.check-panel .ck-ic { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font: 700 11px var(--font-ui); color: #fff; margin-top: 1px; }
.check-panel .ck.ok .ck-ic { background: var(--ok); }
.check-panel .ck.warn .ck-ic { background: #d08a00; }
.check-panel .ck.bad .ck-ic { background: var(--err); }
.check-panel .ck.info .ck-ic { background: var(--muted); font-style: italic; font-family: Georgia, serif; }
.check-panel .ck.ok b { font-weight: 500; }
.check-panel .ck-d { color: var(--muted); font-size: 12px; line-height: 1.35; margin-top: 1px; }
.check-panel .ck-acts { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .check-panel .ck-sum.warn { color: #ffbf47; } }
:root[data-theme="dark"] .check-panel .ck-sum.warn { color: #ffbf47; }
/* keyboard shortcuts sheet */
#dlg-keys { width: min(980px, calc(100vw - 32px)); }
.keys-dlg .keys-style { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0 0 12px; }
.keys-dlg .keys-style > span:first-child { font-weight: 600; font-size: 13.5px; }
.keys-dlg .keys-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 28px; max-height: min(68vh, 640px); overflow: auto; }
.keys-dlg h3 { margin: 4px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.keys-dlg dl.keys { display: grid; grid-template-columns: max-content 1fr; gap: 5px 12px; margin: 0 0 12px; align-items: center; font-size: 13.5px; }
.keys-dlg dd { margin: 0; }
.keys-dlg .kk { display: inline-flex; gap: 3px; align-items: center; color: var(--muted); font-size: 12px; }
.keys-dlg kbd { font: 600 12px var(--font-mono); min-width: 22px; padding: 2px 6px; text-align: center; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--panel-2); color: var(--ink); }
@media (max-width: 800px) { .keys-dlg .keys-grid { grid-template-columns: 1fr; } }
/* Cutting plan and shopping list */
#dlg-plan { width: min(860px, calc(100vw - 32px)); }
.plan-dlg .plan-opts { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.plan-dlg .plan-opts input { width: 64px; margin: 0 4px; }
.plan-dlg .plan-opts .help { flex-basis: 100%; margin: 0; }
.plan-dlg .plan-body { max-height: min(60vh, 560px); overflow: auto; display: grid; gap: 6px; align-content: start; padding-right: 4px; }
.plan-dlg h3 { margin: 10px 0 2px; font-size: 13.5px; }
.plan-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.plan-table th { text-align: left; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; border-bottom: 1px solid var(--line); padding: 4px 6px; }
.plan-table td { padding: 5px 6px; border-bottom: 1px solid var(--line); }
.plan-table .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.plan-table tfoot td { font-weight: 700; border-bottom: 0; }
.plan-warn { background: color-mix(in srgb, var(--err) 10%, transparent); color: var(--err); border-radius: 6px; padding: 4px 10px; font-size: 13px; }
.plan-warn p { margin: 4px 0; }
.plan-row { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 8px; align-items: center; }
.plan-row .pr-lab { font-size: 13px; white-space: nowrap; }
.plan-board { width: 100%; height: auto; display: block; }
.plan-sheets { display: flex; flex-wrap: wrap; gap: 10px; }
.plan-sheet { width: 300px; max-width: 100%; height: auto; }
.pb-board { fill: color-mix(in srgb, var(--timber, #d79a79) 14%, var(--panel)); stroke: var(--line-strong); stroke-width: 1; }
.pb-cut { fill: color-mix(in srgb, var(--timber, #d79a79) 45%, var(--panel)); stroke: color-mix(in srgb, var(--timber, #d79a79) 70%, var(--ink)); stroke-width: 1; }
.pb-cut.rip { fill: color-mix(in srgb, var(--timber, #d79a79) 62%, var(--panel)); }
.pb-name { font: 600 11px var(--font-ui); fill: var(--ink); text-anchor: middle; }
.pb-len { font: 10px var(--font-mono); fill: var(--muted); text-anchor: middle; }
.pb-spare { font: italic 10.5px var(--font-ui); fill: var(--muted); text-anchor: middle; }
.parts li.plan-link { border: 0; padding-top: 0; }
.linkish { background: none; border: 0; padding: 2px 0; color: var(--accent); font: inherit; font-size: 12.5px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.linkish:hover { color: var(--ink); }
.measure-panel .mnote { margin: 2px 0 0; font-size: 12.5px; color: var(--ink); }
.measure-panel .mnote.bad { color: var(--err); font-weight: 600; }
/* video */
#dlg-video { width: min(520px, calc(100vw - 32px)); }
.video-dlg .fd-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 8px; }
.video-dlg .seg { width: 100%; } .video-dlg .seg button { flex: 1; }
.vd-progress { height: 8px; border-radius: 4px; background: var(--panel-2); overflow: hidden; border: 1px solid var(--line); }
.vd-progress > div { height: 100%; width: 0; background: var(--accent); transition: width 0.2s linear; }
.joint-kinds.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fd-pair { display: inline-flex; align-items: center; gap: 4px; }
.fd-pair .fd-num { width: 52px; }
/* settings (the gear in the top bar) */
#dlg-settings { width: min(780px, calc(100vw - 32px)); }
.settings-dlg .st-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.settings-dlg .st-head p { margin: 0; }
.st-grid { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 18px; min-height: 430px; }
.st-tabs { display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--line); padding-right: 10px; }
.st-tabs button { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; cursor: pointer; font: inherit; font-size: 13.5px; color: var(--ink); }
.st-tabs button:hover { background: var(--panel-2); }
.st-tabs button[aria-selected="true"] { background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--accent); font-weight: 600; }
.st-panel { display: flex; flex-direction: column; gap: 10px; max-height: min(64vh, 560px); overflow: auto; padding: 2px 6px 2px 0; }
.st-panel > * { flex: none; }
.st-row { display: grid; grid-template-columns: 148px minmax(0, 1fr); align-items: center; gap: 10px; font-size: 13px; }
.st-label { color: var(--muted); }
.st-ctl { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.st-ctl select { padding: 5px 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); color: var(--ink); font: inherit; font-size: 13px; min-width: 210px; }
.st-chk { align-items: flex-start; }
.st-chk input { margin-top: 2px; }
.st-chk span { display: grid; gap: 1px; }
.st-chk small { color: var(--muted); font-size: 12px; }
.st-note { margin: -4px 0 2px; }
.st-map { border-collapse: separate; border-spacing: 0; font-size: 13px; width: 100%; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
.st-map th, .st-map td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.st-map tr:last-child th, .st-map tr:last-child td { border-bottom: 0; }
.st-map th { font-weight: 500; color: var(--muted); width: 38%; }
.st-range { display: inline-flex; align-items: center; gap: 8px; }
.st-range input { width: 190px; accent-color: var(--accent); }
.st-val { min-width: 44px; font-variant-numeric: tabular-nums; }
.settings-dlg .bar .sp { flex: 1; }
.settings-dlg .bar { justify-content: space-between; }
.vcube[hidden] { display: none; }
.keys .kk-text { font-size: 12.5px; }
@media (max-width: 680px) {
  .st-grid { grid-template-columns: 1fr; min-height: 0; }
  .st-tabs { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 8px; }
  .st-row { grid-template-columns: 1fr; gap: 4px; }
}
.st-ways, .st-what { display: grid; gap: 2px; }
.st-what-note { font-size: 12px; color: var(--muted); opacity: 0.85; }
.keys .st-ways { gap: 1px; }
/* Search tools (` or Alt+C): roomy rows, plain left-aligned text, no italics, and the highlighted tool's words in
   full, so it is easy to read for every student, including those with dyslexia */
.palette { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); width: min(520px, calc(100% - 24px)); z-index: 20; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; }
.palette .pal-in { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.palette input { display: block; flex: 1; min-width: 0; box-sizing: border-box; border: 0; padding: 12px 12px; font: 16px/1.3 var(--font-ui); letter-spacing: 0.01em; background: var(--panel); color: var(--ink); outline: none; }
.palette .pal-mic { flex: none; width: 36px; height: 36px; margin-right: 6px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--panel); color: var(--accent); cursor: pointer; }
.palette .pal-mic:hover, .palette .pal-mic:focus-visible { border-color: var(--accent); }
.palette .pal-mic.on { background: var(--accent); color: #fff; border-color: var(--accent); animation: pal-listen 1.2s ease-in-out infinite; }
@keyframes pal-listen { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 25%, transparent); } }
@media (prefers-reduced-motion: reduce) { .palette .pal-mic.on { animation: none; } }
.palette .pal-note { padding: 8px 12px; font-size: 13.5px; line-height: 1.4; color: var(--ink); background: color-mix(in srgb, var(--accent) 8%, var(--panel)); border-bottom: 1px solid var(--line); }
.palette .pal-fams { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 8px; border-bottom: 1px solid var(--line); }
.palette .pal-fam { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); font: 12.5px/1.25 var(--font-ui); text-align: center; cursor: pointer; }
.palette .pal-fam:hover, .palette .pal-fam:focus-visible { border-color: var(--accent); }
.palette .pal-fam.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--panel)); }
.palette .pf-ic svg { width: 24px; height: 24px; display: block; }
@media (max-width: 520px) { .palette .pal-fams { grid-template-columns: repeat(2, 1fr); } }
.palette ul { list-style: none; margin: 0; padding: 4px; max-height: min(400px, 58vh); overflow: auto; }
.palette li { display: flex; align-items: center; gap: 8px; padding: 8px 8px; border-radius: 6px; cursor: pointer; font-size: 14.5px; line-height: 1.35; letter-spacing: 0.01em; color: var(--ink); }
.palette li.on { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.palette li.off { opacity: 0.5; cursor: default; }
.palette li.none { display: block; color: var(--muted); cursor: default; }
.palette .pi { width: 22px; flex: none; color: var(--muted); font-weight: 600; text-align: center; }
.palette .pi svg { width: 20px; height: 20px; display: block; margin: auto; }
.palette .pl { flex: 1; min-width: 0; }
.palette .pv { margin-left: 8px; color: var(--accent); font-size: 12px; } /* "Fusion: Press Pull": the name that matched */
.palette .pw { display: block; margin-top: 2px; font-size: 13px; line-height: 1.4; color: var(--ink); opacity: 0.8; } /* what the highlighted tool does */
.palette .pg { color: var(--muted); font-size: 12px; }
.palette .pr { font-size: 11.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 6px; }
.palette .pb { font-size: 11px; color: var(--accent); border: 1px solid currentColor; border-radius: 999px; padding: 0 6px; }
.palette .ps { flex: none; width: 26px; height: 26px; box-sizing: border-box; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--accent); cursor: pointer; padding: 0; }
.palette .ps:hover, .palette .ps:focus-visible, .palette .ps.playing { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--panel)); }
.palette .ph { flex: none; width: 24px; height: 24px; cursor: pointer; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 600; text-decoration: none; }
.palette .ph:hover, .palette .ph:focus-visible { border-color: var(--accent); color: var(--accent); }
.guide-help { margin: 10px 0 0; font-size: 13px; }
.guide-help a::after { content: " ↗"; }
.palette kbd { font: 11px var(--font-mono, monospace); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; color: var(--muted); }
/* Standard / Advanced */
.toolbar .mode-group { align-items: center; border-right: 0; padding-left: 4px; }
@media (max-width: 1400px) { .toolbar .tool-mode button { padding: 4px 6px; font-size: 12px; } .toolbar .mode-group { padding-left: 2px; } }
.tool-mode button { font-size: 12px; padding: 4px 9px; }
/* a sketch tool with more ways to draw under ▾ */
.tool-split { display: inline-flex; align-items: stretch; }
.tool-split .tool { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.tool-more { width: 24px; padding: 0; border: 0; background: none; color: var(--muted); font-size: 10px; cursor: pointer; border-radius: 0 6px 6px 0; }
.tool-more:hover { background: var(--panel-2); color: var(--ink); }
/* isolate (Onshape's part menu) */
.iso-bar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 6; display: flex; align-items: center; gap: 10px; padding: 5px 6px 5px 12px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 12%, var(--panel)); border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); font-size: 13px; box-shadow: var(--shadow); max-width: calc(100% - 300px); }
.iso-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.parts li.isoout { opacity: 0.45; }
.parts li.clear .pname { font-style: italic; }
/* named views */
#dlg-views { width: min(460px, calc(100vw - 32px)); }
.nv-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.nv-list li { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; }
.nv-list .nv-go { flex: 1; text-align: left; font-size: 14px; }
.nv-save { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.nv-save input { flex: 1; min-width: 160px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel-2); color: var(--ink); font: inherit; }
.nv-save .err { color: var(--err); font-size: 12.5px; }
/* Advanced-only items in menus (Standard leaves them out; Search tools still finds them) */
body:not(.tools-advanced) [data-adv] { display: none; }

/* Export menu: two groups side by side (one above the other on a narrow screen), kept inside the window */
.menu-list.export-menu { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 0 4px; left: 0; right: auto; width: min(600px, calc(100vw - 16px)); max-height: calc(100vh - 110px); overflow-y: auto; overscroll-behavior: contain; }
.menu-list.export-menu[hidden] { display: none; }
.export-menu .menu-group { display: flex; flex-direction: column; min-width: 0; }
.export-menu .menu-group + .menu-group { border-left: 1px solid var(--line); padding-left: 4px; }
.export-menu .menu-head { font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); padding: 6px 10px 4px; }
@media (max-width: 519px) { .export-menu .menu-group + .menu-group { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 2px; } }

/* Bend: one compact row per bend line (tick, angle, up/down) */
.fd-row.bend-line { align-items: center; }
.fd-row.bend-line .fd-ctl { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fd-row.bend-line .fd-num { width: 58px; flex: none; }
.fd-row.bend-line .seg { flex: 1 1 110px; }

/* a choice of four in a narrow dialog (the hole types): two rows of two */
.fd-body .seg.seg-grid { display: grid; grid-template-columns: 1fr 1fr; }
.fd-body .seg.seg-grid button + button { border-left: 0; }
.fd-body .seg.seg-grid button:nth-child(even) { border-left: 1px solid var(--line); }
.fd-body .seg.seg-grid button:nth-child(n+3) { border-top: 1px solid var(--line); }
/* Import from Onshape (js/cad/onshape.js) */
.os-dlg { gap: 12px; }
.os-dlg .os-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.os-dlg .os-row label { font-weight: 600; font-size: 13.5px; }
.os-dlg .os-row input[type="url"] { flex: 1; min-width: 220px; }
.os-dlg input[type="url"], .os-dlg input[type="text"] { font: 14px var(--font-ui); padding: 6px 9px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--panel); color: var(--ink); }
.os-dlg .os-steps { margin: 0; padding-left: 22px; display: grid; gap: 8px; line-height: 1.45; }
.os-dlg .os-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 12px; }
@media (max-width: 720px) { .os-dlg .os-grid { grid-template-columns: minmax(0, 1fr); } }
.os-dlg .os-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; max-height: 46vh; overflow: auto; }
.os-dlg .os-doc { display: flex; flex-direction: column; gap: 4px; align-items: stretch; text-align: left; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); font: 13px var(--font-ui); cursor: pointer; }
.os-dlg .os-doc:hover, .os-dlg .os-doc:focus-visible { border-color: var(--accent); }
.os-dlg .os-thumb { display: block; aspect-ratio: 30 / 17; border-radius: 5px; background: var(--panel-2); overflow: hidden; }
.os-dlg .os-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.os-dlg .os-tabs h3 { margin: 0 0 6px; font-size: 14px; }
.os-dlg .os-tab { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.os-dlg .os-tab b { flex: 1; min-width: 0; }
.os-dlg .os-kind { font-size: 11.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 6px; }
.os-dlg .os-status:empty { display: none; }
.os-dlg input[type="checkbox"] { width: 20px; height: 20px; margin: 3px; }
.os-dlg .linkish { display: inline-block; min-height: 24px; padding: 2px 0; }
.sw-preview { display: block; max-width: 100%; max-height: 220px; margin: 0 auto; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.sw-missing { margin: 0; padding-left: 20px; max-height: 30vh; overflow: auto; font-size: 13px; columns: 2; }
@media (max-width: 600px) { .sw-missing { columns: 1; } }
/* Equation curve dialog */
#dlg-eq .eq-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin: 10px 0; }
#dlg-eq .eq-f { display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
#dlg-eq .eq-f.wide { grid-column: 1 / -1; }
#dlg-eq .eq-f input { font: 14px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; padding: 6px 8px; min-height: 32px; }
#dlg-eq select { width: 100%; min-height: 32px; }
#dlg-eq .eq-prev { width: 100%; max-width: 360px; height: auto; display: block; margin: 4px auto; background: var(--panel-2, #f4f6fa); border-radius: 6px; }
#dlg-eq .eq-axes { stroke: currentColor; opacity: .25; stroke-width: .6; fill: none; }
#dlg-eq .eq-curve { stroke: var(--accent, #2a55c9); stroke-width: 1.6; fill: none; stroke-linejoin: round; }
#dlg-eq .eq-err { min-height: 1.3em; font-size: 13px; margin: 2px 0 8px; }
@media (max-width: 520px) { #dlg-eq .eq-grid { grid-template-columns: 1fr 1fr; } }


/* Flat-pack DXF to 3D assembly (flatpack-ui.js) */
#dlg-flatpack .dlg { gap: 10px; }
#dlg-flatpack .row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
#dlg-flatpack .fp-files { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); max-height: 7em; overflow: auto; }
#dlg-flatpack input[type="text"] { font: 14px var(--font-ui); padding: 6px 9px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--panel); color: var(--ink); min-width: 260px; }
#dlg-flatpack .fp-facts { margin: 0; padding-left: 18px; }
#dlg-flatpack .fp-views { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
#dlg-flatpack .fp-views figure { margin: 0; text-align: center; font-size: 12.5px; color: var(--muted); }
#dlg-flatpack .fp-views svg { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; display: block; }
#dlg-flatpack .fp-face { fill: var(--timber, #c8956f); fill-opacity: 0.18; stroke: var(--ink); stroke-width: 0.6; stroke-opacity: 0.7; }
#dlg-flatpack .fp-floor { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 4 3; }

/* keeping work safe (modeller.js: renderSaved, renderSafety, lock bar, recovery copies) */
#status-saved { cursor: pointer; border-radius: 4px; padding: 0 4px; }
#status-saved:hover, #status-saved:focus-visible { background: var(--accent-weak); }
#status-saved.warn { color: var(--err, #b42318); font-weight: 600; }
.docs-safety { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: color-mix(in srgb, var(--accent) 4%, var(--panel)); }
.docs-safety p { margin: 6px 0; font-size: 13px; line-height: 1.45; }
.docs-safety p.ok { color: var(--ok, #157f3b); }
.docs-safety .err { color: var(--err, #b42318); }
.docs-safety .btn.small { margin-left: 2px; }
.lock-bar { top: 52px; background: color-mix(in srgb, #f59e0b 16%, var(--panel)); border-color: color-mix(in srgb, #f59e0b 55%, var(--line)); }
.ver-recovery { margin-top: 14px; }
.ver-recovery summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.ver-recovery .doc-thumb.none { font-size: 12px; }
/* a STEP file being read in the worker (modeller.js renderStepBar) */
.step-bar { top: 52px; }
.step-bar .step-prog { flex: 0 0 90px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.step-bar .step-prog i { display: block; height: 100%; background: var(--accent); transition: width .3s; }
