/* frame and truss — on top of calc.css */
main.fr .stage-bar { justify-content: flex-start; gap: 8px; flex-wrap: wrap; }
main.fr .stage-bar .hist { margin-left: auto; }
main.fr .card.stage { border: 0; box-shadow: 0 0 0 1px var(--line); }
.tabs.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stage { position: relative; }
#view { display: block; width: 100%; height: auto; flex: none; user-select: none; touch-action: none; }
#view.drawing { cursor: crosshair; }
#view.dragging, #view.dragging * { cursor: grabbing !important; }
#view .hit { fill: transparent; stroke: none; }

/* tool and result chips */
.fr-mode button { min-width: 58px; }
.fr-chips { display: inline-flex; gap: 2px; background: var(--fill-1); border-radius: 8px; padding: 2px; }
.fr-chips button { border: 0; background: none; padding: 4px 9px; border-radius: 6px; cursor: pointer; color: var(--text-3); font-size: 12.5px; font-weight: 500; min-width: 30px; }
.fr-chips button sub { font-size: .72em; vertical-align: -.25em; line-height: 0; }
.fr-chips button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

/* strip above the drawing: what the pointer is on, or the mechanism */
.fr-info { padding: 7px 14px; font-size: 12.5px; color: var(--text-2); border-bottom: 1px solid var(--line); min-height: 34px; line-height: 1.45; }
.fr-info b { font-weight: 600; color: var(--text); }
.fr-info .fr-bad { color: var(--bad); font-weight: 500; }

/* drawing */
.fr-grid { stroke: var(--steel-350); stroke-width: 1.6; stroke-linecap: round; pointer-events: none; }
.fr-mem { cursor: pointer; }
.fr-memhl { stroke: color-mix(in srgb, var(--sel) 22%, transparent); stroke-width: 11; stroke-linecap: round; pointer-events: none; }
.fr-rel { fill: var(--surface); stroke: var(--ink); stroke-width: 1.1; pointer-events: none; }
.fr-rubber { stroke: var(--sel); stroke-width: 2; stroke-dasharray: 5 4; pointer-events: none; }
.fr-ghost { fill: var(--surface); stroke: var(--sel); stroke-width: 1.5; pointer-events: none; }
.fr-ground { stroke: var(--steel-700); stroke-width: 1.2; }
.fr-hatch { stroke: var(--steel-550); stroke-width: .8; }
.fr-block { fill: var(--steel-100); stroke: var(--steel-700); stroke-width: 1; stroke-linejoin: round; }
.fr-roll { fill: var(--surface); stroke: var(--steel-700); stroke-width: 1; }
.fr-spring { fill: none; stroke: var(--steel-700); stroke-width: 1.2; stroke-linejoin: round; }
.fr-sup { pointer-events: none; }
.fr-node { cursor: grab; }
.fr-node:focus { outline: none; }
.fr-joint { fill: var(--surface); stroke: var(--ink); stroke-width: 1.3; }
.fr-rigid { fill: var(--ink); }
.fr-node:hover .fr-joint, .fr-node.sel .fr-joint, .fr-node:focus-visible .fr-joint { stroke: var(--sel); stroke-width: 2; }
.fr-node:hover .fr-rigid, .fr-node.sel .fr-rigid, .fr-node:focus-visible .fr-rigid { fill: var(--sel); }
#view.drawing .fr-node { cursor: crosshair; }
.fr-mechring { fill: color-mix(in srgb, var(--amber) 14%, transparent); stroke: var(--amber); stroke-width: 1.2; pointer-events: none; }
.fr-mech-shape { fill: none; stroke: var(--amber); stroke-width: 1.6; stroke-dasharray: 5 4; pointer-events: none; }
.fr-load { cursor: pointer; }
.fr-load[data-drag] { cursor: ew-resize; }
.fr-arrow { stroke: var(--load); stroke-width: 1.8; fill: none; }
.fr-arrow.thin { stroke-width: 1.1; }
.fr-band { fill: color-mix(in srgb, var(--load) 7%, transparent); stroke: none; }
.fr-bandtop { stroke: var(--load); stroke-width: 1.4; fill: none; }
.fr-load:hover .fr-arrow, .fr-load.sel .fr-arrow, .fr-load:hover .fr-bandtop, .fr-load.sel .fr-bandtop { stroke: var(--rust); }
.fr-load.sel .fr-band, .fr-load:hover .fr-band { fill: color-mix(in srgb, var(--load) 14%, transparent); }
.fr-react { stroke: var(--x-6e7177, #6e7177); stroke-width: 1.8; fill: none; pointer-events: none; }
.fr-defl { fill: none; stroke: var(--sel); stroke-width: 1.8; stroke-dasharray: 6 4; stroke-linejoin: round; pointer-events: none; }
.fr-buck { fill: none; stroke: var(--purple); stroke-width: 1.8; stroke-dasharray: 6 4; stroke-linejoin: round; pointer-events: none; }
.fr-dim { stroke: var(--text-4); stroke-width: .8; fill: none; }
.fr-peak { font-weight: 600; font-variant-numeric: tabular-nums; pointer-events: none; }
.fr-verdict { cursor: pointer; }
.fr-verdict:focus { outline: none; }
.fr-msg { font-size: 13px; fill: var(--bad); font-weight: 500; }

/* pills */
#view .pill rect { fill: var(--surface); stroke: var(--steel-300); }
#view .pill text { font-weight: 500; fill: var(--text-2); font-variant-numeric: tabular-nums; }
#view .pill.load rect { stroke: color-mix(in srgb, var(--load) 40%, transparent); }
#view .pill.load text { fill: var(--rust); font-weight: 600; }
#view .pill.load .lnm { fill: var(--x-8a4a2e, #8a4a2e); font-weight: 500; }
#view .pill.react rect { stroke: var(--x-cfd3d8, #cfd3d8); }
#view .pill.react text { fill: var(--text-2); font-weight: 600; }
#view .pill.defl rect { stroke: color-mix(in srgb, var(--sel) 45%, transparent); }
#view .pill.defl text { fill: var(--x-1e4fbf, #1e4fbf); font-weight: 600; }
#view .pill.dimv rect { stroke: var(--steel-200); }
#view .pill.nv rect { stroke: var(--steel-300); }
#view .pill.nv.t rect { stroke: color-mix(in srgb, var(--sel) 50%, transparent); }
#view .pill.nv.t text { fill: var(--x-1e4fbf, #1e4fbf); }
#view .pill.nv.c rect { stroke: color-mix(in srgb, var(--bad) 50%, transparent); }
#view .pill.nv.c text { fill: var(--x-b3321f, #b3321f); }
#view .pill.nv.z text { fill: var(--text-3); }
#view .pill.nv { cursor: pointer; }
#view .pill.editable { cursor: text; }
#view .pill.editable:hover rect { stroke: var(--sel); stroke-width: 1.4; }
#view .pill.editable:focus { outline: none; }
#view .pill.editable:focus rect { stroke: var(--sel); stroke-width: 1.6; }

/* strips under the drawing */
.fr-live { display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; min-height: 38px; align-items: center; }
.fr-live:empty:not(.wait) { display: none; }   /* .wait: empty until the first results, its space held (layout shift) */
.fr-live b { font-weight: 500; color: var(--text-3); margin-right: 5px; }
.fr-live b sub { font-size: .72em; vertical-align: -.25em; line-height: 0; }
.fr-live select { width: auto; max-width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; font-size: 12.5px; background: var(--surface); }
.fr-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 7px 14px 9px; font-size: 12px; color: var(--text-2); border-top: 1px solid var(--line); }
.fr-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.fr-legend svg { flex: none; }
.fr-scale { display: inline-grid !important; grid-template-columns: auto 230px; column-gap: 10px; row-gap: 1px; align-items: center; }
.fr-scale b { font-weight: 500; color: var(--text-2); grid-row: span 2; }
.fr-grad { display: block; height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--bad), var(--steel-500), var(--sel)); }
.fr-sl { display: flex; justify-content: space-between; gap: 8px; font-size: 10.5px; color: var(--text-3); white-space: nowrap; }
.fr-toast { position: absolute; left: 50%; top: 96px; transform: translateX(-50%); z-index: 9; background: var(--ink); color: var(--on-accent); font-size: 12.5px; padding: 6px 12px; border-radius: 8px; pointer-events: none; transition: opacity .3s; }

/* value editor and popovers */
.fr-edit { position: absolute; transform: translate(-50%, -50%); z-index: 7; display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1.5px solid var(--sel); border-radius: 9px; padding: 2px 8px 2px 4px; box-shadow: 0 6px 18px rgba(20, 22, 28, .14); }
.fr-edit input { width: 82px; border: 0; outline: none; font: inherit; font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; padding: 3px 2px; }
.fr-edit span { font-size: 11.5px; color: var(--text-3); }
.fr-pop { position: absolute; z-index: 6; width: 272px; max-width: calc(100% - 16px); background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: 0 10px 30px rgba(20, 22, 28, .14); padding: 9px; display: grid; gap: 6px; font-size: 12.5px; }
.fr-pop-h { font-size: 12px; font-weight: 600; color: var(--text); padding: 0 2px; display: flex; justify-content: space-between; gap: 8px; }
.fr-pop-h span + span { font-weight: 400; color: var(--text-3); text-align: right; }
.fr-pop-k { font-size: 11px; color: var(--text-3); padding: 2px 2px 0; }
.fr-pop .seg { width: 100%; display: grid; grid-auto-flow: row; grid-template-columns: repeat(auto-fit, minmax(54px, 1fr)); }
.fr-pop .seg button { padding: 4px 6px; font-size: 12px; white-space: normal; line-height: 1.2; }
.fr-pop .seg button:disabled { opacity: .35; cursor: not-allowed; }
.fr-pop .row { display: grid; grid-template-columns: minmax(0, 1fr) 118px; align-items: center; gap: 8px; color: var(--text-2); }
.fr-pop .row sub { font-size: .72em; vertical-align: -.25em; line-height: 0; }
.fr-pop .row .num input { width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 4px 8px; font-size: 12.5px; text-align: right; outline: none; padding-right: calc(10px + var(--u, 0px)); }
.fr-pop .row select { border: 1px solid var(--line); border-radius: 7px; padding: 4px 6px; font-size: 12.5px; background: var(--surface); }
.fr-pop .check { padding: 2px 0; font-size: 12.5px; }
.fr-pop .why { font-size: 11.5px; color: var(--text-3); line-height: 1.35; margin: 0; }
.fr-pop-load { display: grid; gap: 4px; padding: 6px 0 2px; border-top: 1px solid var(--line); }
.fr-pop-nm { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; align-items: center; }
.fr-pop-nm select { width: auto; border: 1px solid var(--line); border-radius: 7px; padding: 4px 6px; font-size: 12px; background: var(--surface); }
.fr-name { width: 100%; min-width: 0; font-weight: 600; font-size: 12.5px; color: var(--text); border: 1px solid transparent; border-radius: 6px; padding: 3px 6px; background: transparent; outline: none; }
.fr-name:hover { border-color: var(--line); }
.fr-name:focus { border-color: var(--line-2); background: var(--surface); }
.fr-name::placeholder { color: var(--text); opacity: .9; }
.fr-pop-acts { display: flex; flex-wrap: wrap; gap: 4px; padding-top: 4px; border-top: 1px solid var(--line); }
.fr-pop-acts button { font-size: 12px; color: var(--sel); padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer; }
.fr-pop-acts button:hover { border-color: var(--sel); }
.fr-pop-acts .del { color: var(--bad); }
.fr-pop-acts .del:hover { border-color: var(--bad); }

/* panel */
.panel-body .f > label span { overflow: visible; text-overflow: clip; white-space: normal; }
.fr-seg { margin-bottom: 6px; }
.f.sel.fr-dl { grid-template-columns: minmax(0, 1fr) 128px; }
.f.sel.fr-dl > label { grid-template-columns: 0 minmax(0, 1fr); }
.fr-seg button { white-space: normal; line-height: 1.25; }
.fr-seg button:disabled { opacity: .4; cursor: not-allowed; }
.fr-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.fr-tbl th { font-size: 11.5px; font-weight: 500; color: var(--text-3); text-align: right; padding: 0 3px 4px; white-space: nowrap; }
.fr-tbl th:first-child, .fr-tbl td:first-child { text-align: left; }
.fr-tbl td { padding: 2px 3px; color: var(--text-2); text-align: right; white-space: nowrap; }
.fr-tbl td .num input { padding: 4px 7px; font-size: 12.5px; }
.fr-tbl td select { padding: 3px 4px; font-size: 12.5px; width: auto; min-width: 46px; }
.fr-tbl tr.sel td:first-child { color: var(--sel); font-weight: 600; }
.fr-tbl td:nth-child(2), .fr-tbl td:nth-child(3) { width: 34%; }
.fr-tag { font-size: 10.5px; color: var(--text-3); background: var(--fill-1); border-radius: 999px; padding: 0 6px; white-space: nowrap; }
.fr-list { display: grid; gap: 4px; }
.fr-li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; text-align: left; border: 1px solid var(--line); border-radius: 9px; padding: 6px 9px; background: var(--surface); cursor: pointer; font-size: 12.5px; }
.fr-li:hover { border-color: var(--line-2); }
.fr-li.sel { border-color: var(--sel); box-shadow: inset 0 0 0 1px var(--sel); }
.fr-li-n { display: grid; min-width: 0; line-height: 1.25; }
.fr-li-n b { font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.fr-li-n small { font-size: 11.5px; color: var(--text-3); }
.fr-li-v { color: var(--rust); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.bm-types { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin-bottom: 6px; }
.bm-type { display: grid; justify-items: center; gap: 1px; padding: 5px 6px 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; font-size: 11.5px; color: var(--text-2); }
.bm-type:hover { border-color: var(--line-2); }
.bm-type.on { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); color: var(--text); }
.bm-kv { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 12px; color: var(--text-2); padding: 4px 0 2px; }
.bm-kv sub { font-size: .72em; vertical-align: -.25em; line-height: 0; }
.bm-add-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.bm-add-row button, .fr-x { font-size: 12px; color: var(--sel); padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer; }
.fr-x { color: var(--bad); padding: 1px 7px; margin-left: 4px; }
.bm-add-row button:hover { border-color: var(--sel); }
.bm-combos { width: 100%; border-collapse: collapse; font-size: 12px; }
.bm-combos td { padding: 3px 4px; border-top: 1px solid var(--line); color: var(--text-2); }
.bm-combos tr.gov td { color: var(--text); font-weight: 600; }
.bm-combos td:last-child { text-align: right; white-space: nowrap; }
#panel input.bad { color: var(--bad); }
#panel .num:has(input.bad) input { border-color: var(--bad); }
.small-note sub, .grp-h sub { font-size: .72em; vertical-align: -.25em; line-height: 0; }
.small-note .srcs a, .bm-kv .srcs a { text-decoration: none; color: var(--text-2); font-size: 11px; }

/* summary */
.fr-say { font-size: 12.5px; color: var(--text-2); margin-top: 6px; max-width: 38ch; line-height: 1.4; }
.fr-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.fr-stats .stat .v { white-space: nowrap; }
.fr-stats .stat .k sub { font-size: .72em; vertical-align: -.25em; line-height: 0; }
.fr-stats .stat .s { overflow-wrap: anywhere; }

/* tables */
#checks tr.adv td.l:first-child { color: var(--text-2); }
#checks td.l sub, #mems th sub, #reacts th sub { font-size: .72em; vertical-align: -.25em; line-height: 0; }
.margins td.note { white-space: normal; min-width: 240px; }
.fr-copy { font-size: 12px; color: var(--sel); padding: 2px 8px; margin-left: 6px; }
.fr-mems tbody tr, .fr-reacts tbody tr { cursor: default; }
.fr-mems tbody tr { cursor: pointer; }
.fr-mems td, .fr-mems th, .fr-reacts td, .fr-reacts th { white-space: nowrap; }
.fr-mems td.l:nth-child(2) { white-space: normal; }

@media (max-width: 1200px) {
  .fr-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fr-stats .stat:nth-child(4) { border-left: 0; }
  .fr-stats .stat:nth-child(n+4) { border-top: 1px solid var(--line); }
}
@media (max-width: 640px) {
  .fr-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fr-stats .stat { border-left: 0 !important; border-top: 1px solid var(--line); }
  .fr-stats .stat:nth-child(even) { border-left: 1px solid var(--line) !important; }
  .fr-stats .stat:nth-child(-n+2) { border-top: 0; }
  #checks th:nth-child(4), #checks td.note { display: none; }
  #checks th:nth-child(3), #checks td:nth-child(3) { display: none; }
  .margins td.l { white-space: normal; }
  .margins td, .margins th { padding-left: 5px; padding-right: 5px; }
  .fr-mems th:nth-child(2), .fr-mems td:nth-child(2), .fr-mems th:nth-child(3), .fr-mems td:nth-child(3) { display: none; }
  .fr-live { font-size: 12px; gap: 3px 12px; }
  .fr-chips button { padding: 4px 7px; min-width: 26px; }
  .fr-scale { grid-template-columns: minmax(0, 1fr); }
  .fr-scale b { grid-row: auto; }
  .fr-grad { width: 100%; }
}

/* until app.js draws it, the drawing holds its usual size, so nothing under it jumps on load (layout shift) */
#view:empty { aspect-ratio: 936 / 306; }
#viewChips:empty { width: 167px; height: 30px; }   /* likewise the result chips, the info line and the legend, filled by app.js */
.fr-legend:empty { min-height: 46.2px; }
@media (max-width: 640px) { #viewChips:empty { width: 147px; } }
.fr-live.wait:empty { min-height: 40px; }
@media (max-width: 560px) { #view:empty { aspect-ratio: 380 / 246; } .fr-legend:empty { min-height: 93px; } .fr-live.wait:empty { min-height: 60.4px; } }

/* the panel fades out at an edge it scrolls past (fadePanel in app.js) */
#panel.fade-b { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 32px), transparent); }
#panel.fade-t { -webkit-mask-image: linear-gradient(to bottom, transparent, #000 28px); mask-image: linear-gradient(to bottom, transparent, #000 28px); }
#panel.fade-t.fade-b { -webkit-mask-image: linear-gradient(to bottom, transparent, #000 28px, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to bottom, transparent, #000 28px, #000 calc(100% - 32px), transparent); }

/* theme-auto:start · generated by scripts/theme/hexmap.py: dark values (the rule of scripts/theme/colour.py) for
   colours that are not tokens, written as var(--x-rrggbb, #rrggbb): light is the fallback, unchanged */
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --x-1e4fbf: #749ff5; --x-6e7177: #85827f; --x-8a4a2e: #cd937b; --x-a9adb3: #575552; --x-b3321f: #f08571;
    --x-c4c9cf: #3f4347; --x-cfd3d8: #3e3c38;
  }
}
@media screen {
  :root[data-theme="dark"] {
    --x-1e4fbf: #749ff5; --x-6e7177: #85827f; --x-8a4a2e: #cd937b; --x-a9adb3: #575552; --x-b3321f: #f08571;
    --x-c4c9cf: #3f4347; --x-cfd3d8: #3e3c38;
  }
}
/* theme-auto:end */
