:root { --reac: var(--steel-650); }   /* reactions: grey, solid head (site arrow standard) */
/* Bolt pattern 3D: page-local styles (shared look comes from calc.css) */
input.clamped { color: var(--bad); }
.legend-dots { flex-wrap: wrap; row-gap: 4px; } .legend-dots span { white-space: nowrap; } .legend-dots span.wrap { white-space: normal; }
.tabs { grid-template-columns: repeat(3, 1fr); }

/* the drawing card (own class: the shared .stage rules copied, so the padding audit's [class*=tag] match stays off it) */
.stg { display: flex; flex-direction: column; min-width: 0; overflow: hidden; position: relative; }

/* stage bar: examples, view toggles, history, help, recommend */
.stage-bar { position: relative; gap: 10px; }
.stage-bar .grow { flex: 1; }
.ex-wrap { position: relative; }
.ex-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 8; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(20, 22, 28, .12); padding: 6px; display: grid; gap: 2px; min-width: 300px; max-width: calc(100vw - 40px); }
.ex-menu[hidden] { display: none; }
.ex-menu button { border: 0; background: none; text-align: left; padding: 7px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--text); display: grid; gap: 1px; font-family: inherit; }
.ex-menu button small { color: var(--text-3); font-size: 11.5px; }
.ex-menu button:hover, .ex-menu button:focus { background: var(--fill-1); outline: none; }
.ex-menu button[aria-current="true"] { background: var(--fill-1); }
.vtog { display: inline-flex; gap: 4px; }
.tog { font: inherit; font-size: 12.5px; padding: 4px 10px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text-2); cursor: pointer; white-space: nowrap; }
.tog:hover { color: var(--text); border-color: var(--text-3); }
.tog[aria-pressed="true"] { background: var(--fill-1); color: var(--text); border-color: var(--text-3); font-weight: 500; }
.tog .sw { display: inline-block; width: 10px; height: 2px; vertical-align: middle; margin-right: 5px; border-radius: 1px; }

.qhelp { position: static; }
.qhelp > summary { list-style: none; cursor: pointer; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-2); color: var(--text-3);
  font-size: 12px; font-weight: 500; display: grid; place-items: center; user-select: none; }
.qhelp > summary::-webkit-details-marker { display: none; }
.qhelp > summary:hover, .qhelp[open] > summary { color: var(--text); border-color: var(--text-2); }
.qhelp-pop { position: absolute; right: 12px; top: calc(100% - 2px); z-index: 9; width: 310px; max-width: calc(100vw - 48px); background: var(--surface);
  border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 4px 16px rgba(0,0,0,.08); padding: 9px 12px; font-size: 12.5px; line-height: 1.45; color: var(--text-2); }
.qhelp-pop p { margin: 0; } .qhelp-pop p + p { margin-top: 5px; }

/* the drawing, with the selection toolbar, the verdict chip and the bolt card pinned on it */
.vwrap { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.vwrap .selbar { top: 8px; left: 8px; max-width: calc(100% - 16px); }
.vchip { position: absolute; top: 8px; right: 10px; z-index: 1; pointer-events: none; font-size: 12.5px; font-weight: 600; padding: 3px 10px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--line); border-radius: 999px; white-space: nowrap; }
.vchip:empty { display: none; }
.vchip .g { font-weight: 500; color: var(--text-2); }
#view .bolt { cursor: grab; }
#view .bolt .hd { transition: stroke-width .12s; }
#view .bolt:hover .hd { stroke: var(--sel); stroke-width: 1.8; }
#view .bolt.sel .hd { stroke: var(--sel); stroke-width: 2.2; }
#view .bolt .ring { fill: none; stroke: var(--sel); stroke-width: 1.4; opacity: 0; transition: opacity .12s; pointer-events: none; }
#view .bolt:hover .ring { opacity: .45; }
#view .ld .shaft { transition: stroke-width .12s; }
#view .ld:hover .shaft { stroke-width: 3; }
#view .gz { cursor: pointer; }
#view .gz:hover circle.gzb { fill: var(--fill-1); }
#view .gz text { pointer-events: none; }
#view .bolt, #view .handle { touch-action: none; }
.bcard { position: absolute; z-index: 4; pointer-events: none; width: 248px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 28px rgba(20, 24, 30, .14); padding: 9px 11px 10px; font-size: 12px; color: var(--text); font-variant-numeric: tabular-nums; }
.bcard[hidden] { display: none; }
.bcard .bc-h { font-weight: 600; font-size: 12.5px; }
.bcard .bc-s { color: var(--text-3); font-size: 11.5px; margin-top: 1px; }
.bcard table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.bcard td { padding: 2px 0; white-space: nowrap; }
.bcard td:first-child { color: var(--text-2); }
.bcard td + td { text-align: right; }
.bcard tr.gov td { font-weight: 600; }
.bcard tr.sep td { border-top: 1px solid var(--grid); padding-top: 5px; }
.bcard .tag { display: inline-block; font-size: 10.5px; font-weight: 500; color: var(--text-2); background: var(--fill-1); border-radius: 4px; padding: 0 4px; margin-left: 4px; }

.summary { min-height: 104px; }
.sens { font-size: 12px; color: var(--text-2); }
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 8px; }
.chips-row .chip[aria-pressed="true"] { border-color: var(--text-2); color: var(--text); background: var(--fill-1); }
.sens-box { background: var(--surface-2); border: 1px solid var(--steel-150); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; line-height: 1.45; color: var(--text-2); margin-top: 8px; }
.sens-box b { color: var(--text); font-weight: 600; }
.sens-box .lvl { display: inline-block; font-size: 11px; font-weight: 600; border-radius: 4px; padding: 0 5px; margin-left: 4px; }
.lvl.low { background: var(--good-bg); color: var(--good); } .lvl.mid { background: var(--warn-bg); color: var(--warn); } .lvl.high { background: var(--bad-bg); color: var(--bad); }

/* margins: bolt table and face table */
.faces-h { margin-top: 22px; }
#table td[data-pv], #ftable td[data-pv], #table th[data-pvh] { cursor: help; }
#table td[data-pv]:focus-visible, #ftable td[data-pv]:focus-visible { outline: 2px solid var(--sel); outline-offset: -2px; border-radius: 6px; }
.facechip { display: inline-block; min-width: 18px; text-align: center; font-size: 11px; font-weight: 600; color: var(--text-2); background: var(--fill-1); border-radius: 4px; padding: 0 4px; }

/* failure preview card beside a margin cell (screen only) */
.b3-pv { position: fixed; z-index: 60; width: 220px; padding: 8px 8px 9px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 28px rgba(20, 24, 30, .14); pointer-events: none; font-size: 12px; color: var(--text); }
.b3-pv[hidden] { display: none; }
.b3-pv svg { display: block; width: 204px; height: auto; margin: 4px 0 6px; }
.b3-pv .pv-h { font-weight: 600; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b3-pv .pv-c { color: var(--text-2); line-height: 1.35; }
.b3-pv .pv-m { margin-top: 4px; color: var(--text-3); }
@media print { .b3-pv, .bcard { display: none !important; } }

.rec-progress .rec-bar { height: 6px; background: var(--fill-1); border-radius: 3px; overflow: hidden; }
.rec-progress .rec-bar i { display: block; height: 100%; background: var(--text); transition: width .1s; }

@media (min-width: 1041px) {
  /* the drawing fits the fold so the verdict card shows without scrolling; app3d.js matches the viewBox to this box */
  #view { height: clamp(440px, calc(100vh - 330px), 660px); flex: none; }
  .stage-foot { min-height: 41px; }
}
@media (max-width: 1040px) {
  .work { display: contents; }
  main > * { order: 3; }
  .work > .stg { order: 1; }
  #summary { order: 2; }
  .work > .panel { order: 3; min-height: 420px; }
  #view { aspect-ratio: 1 / 1; }
}
@media (max-width: 560px) {
  .stage-bar { gap: 6px; }
  .stage-bar .grow { display: none; }
  .tog { padding: 4px 8px; }
  .vwrap .selbar { flex-wrap: nowrap; overflow-x: auto; right: 8px; scrollbar-width: none; }
  .vwrap .selbar > * { flex: none; }
  .vchip { font-size: 12px; }
  .vwrap:has(.selbar:not([hidden])) .vchip { display: none; }
  .bcard { width: 228px; }
}
.patform[hidden] { display: none; }

/* clamped stacks: which faces use the stack being edited */
.stk-faces { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 2px 0 8px; font-size: 12.5px; color: var(--text-2); }
.stk-faces > span { color: var(--text-3); margin-right: 2px; }
.check.inline { display: inline-flex; margin: 0; }
.check.inline small { color: var(--text-3); margin-left: 3px; }
/* detail row: joint diagram and the selected bolt's numbers */
.bdetail { font-size: 13px; font-variant-numeric: tabular-nums; margin-top: 6px; }
.bdetail .bc-h, .bdetail .bc-s { display: none; }
.bdetail table { width: 100%; border-collapse: collapse; }
.bdetail td { padding: 5px 0; border-bottom: 1px solid var(--fill-1); white-space: nowrap; }
.bdetail td:first-child { color: var(--text-2); }
.bdetail td + td { text-align: right; }
.bdetail tr.gov td { font-weight: 600; }
.bdetail .tag { display: inline-block; font-size: 11px; font-weight: 500; color: var(--text-2); background: var(--fill-1); border-radius: 4px; padding: 0 6px; margin-left: 6px; }
.panel .sheet-actions { flex-wrap: wrap; } .panel .sheet-actions button { white-space: nowrap; }
.thico { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.thico .ico, .tlink .ico { vertical-align: -2px; color: var(--text-3); }
.tlink { margin: 10px 0 0; font-size: 12.5px; }
.tlink a { color: var(--sel); text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.tlink a:hover { text-decoration: underline; }
/* panel: labels wrap instead of ending in "…"; a select with long choices gets the full width under its label */
.panel .f > label span { white-space: normal; overflow: visible; text-overflow: clip; }
.panel .f.sel.wide { grid-template-columns: minmax(0, 1fr); row-gap: 4px; }
/* phone cards: three coordinates share a line, so their inputs give way instead of pushing into the next label */
@media (max-width: 760px) {
  .sheet.bolts3.cards td.fill, .sheet.loads.cards td.fill { flex: 1 1 0; }
  .sheet.bolts3.cards td input, .sheet.loads.cards td input:not(.name) { width: 0; min-width: 0; }
  .sheet.bolts3.cards td.k2 input.axisin { width: 56px; flex: none; }
}

/* until app.js draws it, the drawing holds its usual size, so nothing under it jumps on load (layout shift) */
#view:empty { aspect-ratio: 800 / 488; }
@media (max-width: 1040px) { #view:empty { aspect-ratio: 1 / 1; } }
/* the bolt-type pill holds "A 3/8-16" with its arrow */
.sheet.bolts3 col.ty { width: 100px; }

/* 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-6e7177: #85827f; --x-7a828b: #70777e; --x-7c3aed: #af9af8; --x-9097a0: #61666d; --x-a16207: #d8a067;
    --x-a1a9b2: #545960; --x-a5acb4: #52575d; --x-cfd3d7: #3e3c38; --x-cfd5dc: #373b40;
  }
}
@media screen {
  :root[data-theme="dark"] {
    --x-6e7177: #85827f; --x-7a828b: #70777e; --x-7c3aed: #af9af8; --x-9097a0: #61666d; --x-a16207: #d8a067;
    --x-a1a9b2: #545960; --x-a5acb4: #52575d; --x-cfd3d7: #3e3c38; --x-cfd5dc: #373b40;
  }
}
/* theme-auto:end */
