/*
 * features.css — styles for the Predict, Solve and Results steps, Compare and the Test panel.
 * Builds on the shared vocabulary in app.css (.btn, .card, .notice, .seg, .stat, .kv…);
 * everything here is prefixed .fx- so it can't clash with other components.
 * Colours come from tokens.css only. Traffic colours use --ok / --warn / --bad.
 */

.fx-panel { --fx-gap: 14px; }
.fx-lead { margin: 0; color: var(--pencil); line-height: 1.55; }
.fx-link {
  background: none; border: 0; padding: 6px 4px; min-height: 32px; cursor: pointer;
  font: 600 .85rem/1.2 var(--font); color: var(--blue); text-decoration: underline; text-underline-offset: 3px;
}
.fx-link:hover { color: var(--blue-d); }
.fx-link:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; border-radius: 6px; }

/* Expandable help ("Need a clue?", "How it works", "Model details") */
.fx-details { border: 1px solid var(--line-light); border-radius: var(--r-fact); background: var(--white); }
.fx-details > summary {
  list-style: none; cursor: pointer; padding: 12px 16px; min-height: 44px; display: flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: .92rem;
}
.fx-details > summary::-webkit-details-marker { display: none; }
.fx-details > summary::before {
  content: "+"; content: "+" / ""; display: grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 50%;
  background: var(--track); font: 700 .9rem/1 var(--mono); color: var(--blue);
}
.fx-details[open] > summary::before { content: "–"; content: "–" / ""; }   /* decorative: empty alt text (UX-9) */
.fx-details > summary:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; border-radius: var(--r-fact); }
.fx-details > :not(summary) { padding: 0 16px 14px; margin: 0; }
.fx-details p { margin: 0; line-height: 1.55; }

/* ---- Stars & tally ------------------------------------------------------------------- */
.fx-stars { display: inline-flex; gap: 1px; font-size: 1rem; line-height: 1; letter-spacing: 0; }
.fx-stars > span { color: var(--field-line); }
.fx-stars > span.on { color: var(--warn); }
.fx-stars-lg { font-size: 1.9rem; gap: 2px; }

.fx-tally { padding: 14px 16px; border-radius: var(--r-fact); background: var(--white); border: 1px solid var(--line-light); }
.fx-tally-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.fx-tally p { margin: 0; }
.fx-tally-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fx-tally-grid > div { display: flex; flex-direction: column; gap: 2px; }
.fx-tally-grid b { font-size: 1.35rem; font-weight: 700; line-height: 1.1; }

/* ---- Predict --------------------------------------------------------------------------- */
.fx-pin-status { display: flex; align-items: flex-start; gap: 10px; }
.fx-pin-icon {
  flex: none; width: 18px; height: 18px; margin-top: 2px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--blue); box-shadow: inset 0 0 0 5px var(--blue), inset 0 0 0 9px #fff;
}
.fx-pin-empty { background: transparent; box-shadow: inset 0 0 0 2px var(--blue); }

/* ---- Solve ----------------------------------------------------------------------------- */
.fx-checklist { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line-light); border-radius: var(--r-fact); background: var(--white); }
.fx-checklist li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; min-height: 52px; }
.fx-checklist li + li { border-top: 1px solid var(--line-light); }
.fx-checklist .grow { display: flex; flex-direction: column; min-width: 0; }
.fx-checklist .label { font-size: .66rem; }
.fx-check-text { font-size: .9rem; overflow-wrap: anywhere; }
.fx-check-icon {
  flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font: 700 .85rem/1 var(--mono); color: #fff;
}
.is-ok .fx-check-icon { background: var(--ok); }
.is-todo .fx-check-icon { background: var(--warn); color: var(--text); }
.is-todo .fx-check-text { color: var(--text); font-weight: 500; }

.fx-seg-3 { display: flex; width: 100%; }
.fx-seg-3 > button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; padding-inline: .5em; }
.fx-seg-3 > button small { font-size: .66rem; font-weight: 500; opacity: .75; }
.fx-seg-3 > button:disabled { cursor: not-allowed; opacity: .6; }

.fx-radio { gap: 6px; }
.fx-radio-item {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; min-height: 44px; border-radius: var(--r-input);
  border: 1px solid var(--line-light); background: var(--paper); cursor: pointer;
}
.fx-radio-item:has(input:checked) { border-color: var(--blue); background: rgba(36, 72, 255, .05); }
.fx-radio-item input { margin-top: 4px; accent-color: var(--blue); width: 18px; height: 18px; flex: none; }
.fx-radio-item b { display: block; font-size: .9rem; font-weight: 600; }
.fx-radio-item small { display: block; font-size: .8rem; line-height: 1.4; }

.fx-estimate .kv { padding: 12px 14px; border-radius: var(--r-fact); background: var(--white); border: 1px solid var(--line-light); }
.fx-estimate p { margin: 0; }
.fx-progress-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-weight: 600; }
.fx-progress-head .row { gap: 10px; font-size: .85rem; }
.fx-solve .progress { height: 12px; }
.fx-stage-msg { margin: 0; min-height: 1.4em; }
.fx-run { font-size: 1.05rem; }

/* ---- Results --------------------------------------------------------------------------- */
.fx-is-stale { opacity: .55; filter: grayscale(.6); }
.fx-tone-ok   { --tone: var(--ok);   --tone-tint: var(--ok-tint); }
.fx-tone-warn { --tone: var(--warn); --tone-tint: var(--warn-tint); }
.fx-tone-bad  { --tone: var(--bad);  --tone-tint: var(--bad-tint); }

.fx-verdict { --k: var(--tone); display: flex; gap: 16px; align-items: flex-start; padding: 22px 20px 20px; }
.fx-verdict-icon { flex: none; width: 64px; height: 64px; color: var(--tone); }
.fx-verdict-icon svg { width: 100%; height: 100%; display: block; }
.fx-verdict-title { margin: 2px 0 4px; font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.fx-verdict p { margin: 0 0 6px; line-height: 1.5; }
.fx-arrow-note { display: flex; align-items: center; gap: 8px; color: var(--pencil); margin: 0 !important; }
.fx-arrow-dot { width: 12px; height: 12px; border-radius: 50%; border: 3px solid var(--bad); flex: none; }

.fx-verdict-line {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-fact);
  background: var(--tone-tint); font-size: .9rem; line-height: 1.45;
}
.fx-verdict-dot { flex: none; width: 12px; height: 12px; margin-top: 4px; border-radius: 50%; background: var(--tone); }
.fx-verdict-line b { font-weight: 700; }
.fx-verdict-line-title { display: block; font-size: 1.05rem; font-weight: 700; margin-bottom: 2px; color: var(--ink); }
.fx-estimate-note { margin: 4px 0 0 !important; }

.fx-tkey { display: grid; gap: 6px; }
.fx-tkey-item { display: flex; gap: 12px; align-items: center; padding: 8px 12px; border-radius: var(--r-input); background: var(--white); border: 1px solid var(--line-light); }
.fx-tkey-swatch { width: 26px; height: 26px; border-radius: 8px; flex: none; }
.fx-tkey-item b { display: block; font-size: .92rem; font-weight: 600; }
.fx-tkey-item small { display: block; font-size: .8rem; color: var(--pencil); line-height: 1.35; }

.fx-score { --k: var(--warn); padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 8px; }
.fx-score-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.fx-score-num { font-size: 2.2rem; font-weight: 700; line-height: 1; }
.fx-score-num small { font-size: .9rem; color: var(--pencil); margin-left: 2px; }
.fx-score p { margin: 0; }
.fx-score-msg { font-weight: 600; line-height: 1.45; }
.fx-score .fx-tally { background: var(--paper); border: 0; }

.fx-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.fx-stats .stat { display: flex; flex-direction: column; min-width: 0; }
.fx-stats .stat-value { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.fx-stats .stat-unit { margin-left: 0; }
.fx-stats .fx-governs { border-color: var(--blue); box-shadow: inset 0 3px 0 var(--blue); }
.fx-stats .fx-fos { background: var(--tone-tint); border-color: transparent; box-shadow: inset 0 3px 0 var(--tone); }
.fx-stats .fx-fos .stat-value { color: var(--text); }
.fx-stats .fx-stat-sharp .fx-sharp-value { font-size: 1.15rem; line-height: 1.25; }

/* Colour bar */
.fx-cbar { display: flex; flex-direction: column; gap: 6px; }
.fx-cbar-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.fx-cbar-unit { font-size: .75rem; color: var(--pencil); }
.fx-cbar-bar { position: relative; height: 16px; border-radius: var(--r-pill); box-shadow: inset 0 0 0 1px rgba(10, 16, 32, .08); }
.fx-cbar-ticks { position: relative; height: 1.2em; font-size: .74rem; color: var(--pencil); font-variant-numeric: tabular-nums; }
.fx-cbar-ticks > span { position: absolute; top: 0; white-space: nowrap; }
.fx-cbar-marker { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1.5px; background: var(--ink); border-radius: 2px; }
.fx-cbar-marker::after {
  content: attr(data-label); position: absolute; bottom: calc(100% + 2px); left: 50%; transform: translateX(-50%);
  font: 700 .62rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink); white-space: nowrap;
}

/* Deform slider */
.fx-deform-row { display: flex; align-items: center; gap: 12px; }
.fx-deform-row input[type="range"] { flex: 1; min-height: 44px; accent-color: var(--blue); padding: 0; border: 0; background: none; box-shadow: none; }
.fx-deform-out { min-width: 4.5em; text-align: right; font-weight: 700; }
.fx-deform-out:empty { display: none; }
.fx-deform-ends { display: flex; justify-content: space-between; align-items: center; margin-top: -6px; }

.fx-btn-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.fx-btn-grid .btn { width: 100%; min-width: 0; padding-inline: .8em; font-size: .88rem; white-space: normal; text-align: center; }
.fx-actions p { margin: 0; }
@media (max-width: 380px) { .fx-btn-grid { grid-template-columns: 1fr; } }

/* ---- Compare modal --------------------------------------------------------------------- */
.modal.fx-cmp { width: min(1080px, 100%); }
.modal.fx-cmp .modal-head > div, .modal.fx-test .modal-head > div { flex: 1; }
.fx-cmp-body { padding: 16px 20px 20px; }
.fx-cmp-grid {
  display: grid; grid-template-columns: minmax(96px, 130px) repeat(var(--cols, 1), minmax(180px, 1fr));
  border: 1px solid var(--line-light); border-radius: var(--r-fact); background: var(--white); overflow: auto;
}
.fx-cmp-grid > div { padding: 10px 12px; border-top: 1px solid var(--line-light); font-size: .9rem; min-width: 0; overflow-wrap: anywhere; }
.fx-cmp-grid > .fx-cmp-first { border-top: 0; }
.fx-cmp-label { color: var(--pencil); background: var(--paper); }
.fx-cmp-label.label { font-size: .66rem; display: flex; align-items: center; }
.fx-cmp-headcell { display: flex; gap: 8px; align-items: center; }
.fx-cmp-name { flex: 1; min-width: 0; font-weight: 700 !important; min-height: 40px; }
.fx-cmp-thumb { display: block; width: 100%; max-width: 320px; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 12px; background: var(--ink); }
.fx-cmp-nothumb { display: grid; place-items: center; color: var(--body-dark); font-size: .8rem; }
.fx-cmp-cell { position: relative; font-variant-numeric: tabular-nums; }
.fx-cmp-best { background: var(--ok-tint); font-weight: 700; }
.fx-cmp-sharp { background: var(--warn-tint); color: var(--text); font-weight: 700; padding: 0 4px; border-radius: 4px; }
.fx-cmp-bestmark { margin-left: 8px; font-size: .6rem; letter-spacing: .1em; color: #136B3D; vertical-align: middle; }

/* ---- Test panel ------------------------------------------------------------------------ */
.modal.fx-test { width: min(1100px, 100%); }
.fx-test-table { overflow-x: auto; }
.fx-table { width: 100%; border-collapse: collapse; font-size: .82rem; background: var(--white); border-radius: 12px; overflow: hidden; }
.fx-table th, .fx-table td { padding: 8px 10px; text-align: left; border-top: 1px solid var(--line-light); vertical-align: top; }
.fx-table thead th { border-top: 0; background: var(--ink); color: var(--tb-text); font: 700 .66rem/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.fx-table tbody th { font-weight: 600; min-width: 220px; }
.fx-table td.mono { white-space: nowrap; font-variant-numeric: tabular-nums; }
.fx-table small { display: block; font-weight: 400; font-size: .74rem; margin-top: 2px; white-space: normal; }

/* Designer verdict: small collapsible FoS guidance under the 3-sentence verdict */
.fx-fos-note { margin-top: 8px; }
.fx-fos-note > summary { font-size: .8rem; padding-block: 6px; }
.fx-fos-note p { margin: 0; padding: 0 12px 10px; }

/* Keyboard face lists (ui/face-list.js) */
.fx-face-pick { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.fx-face-btn[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ---- Break it! (ui/breakit.js) ----------------------------------------------------------- */
.fx-act-row { display: grid; gap: 4px; }
.fx-act[aria-disabled="true"] { background: var(--track); border-color: var(--field-line); color: var(--pencil); cursor: not-allowed; }
.fx-act-why { margin: 0; }
.fx-act-why.is-flash { color: var(--text); font-weight: 600; }
.fx-check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.fx-check input { width: 18px; height: 18px; accent-color: var(--blue); }
.fx-breakit { --k: var(--bad); padding: 16px 18px; display: grid; gap: 10px; border-left: 5px solid var(--bad); }
.fx-breakit-top { display: grid; gap: 2px; }
.fx-breakit-head { margin: 0; font-size: 1.15rem; font-weight: 800; letter-spacing: -.01em; }
.fx-breakit-head:focus { outline: none; }
.fx-breakit-head:focus-visible, .fx-breakit-outcome:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 6px; }
.fx-breakit-body p { margin: 0; line-height: 1.5; }
.fx-breakit-row { gap: 8px; }
.fx-breakit-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.fx-breakit-tile { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 10px; border-radius: 12px;
  border: 1.5px solid var(--field-line); background: var(--white); color: var(--text); font: inherit; font-size: .86rem; text-align: left; cursor: pointer; }
.fx-breakit-tile:hover { border-color: var(--blue); }
.fx-breakit-tile[aria-checked="true"] { border-color: var(--blue); background: #E8ECFF; box-shadow: inset 0 0 0 1.5px var(--blue); font-weight: 600; }
.fx-breakit-tile:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.fx-breakit-tile-icon { font-size: 1.25rem; line-height: 1; }
.fx-breakit-own { margin-left: auto; font-size: .68rem; font-weight: 700; color: var(--pencil); text-transform: uppercase; letter-spacing: .05em; }
.fx-breakit-meter-row { display: flex; align-items: center; gap: 10px; }
.fx-breakit-meter-icon { font-size: 1.4rem; line-height: 1; }
.fx-breakit-meter { position: relative; flex: 1; height: 14px; border-radius: 999px; background: var(--track); overflow: visible; }
.fx-breakit-fill { position: absolute; inset: 0; border-radius: 999px; transform-origin: left center; transform: scaleX(0);
  background: linear-gradient(90deg, var(--ok), var(--warn) 55%, var(--bad)); }
.fx-breakit-tick { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); transform: translateX(-1px); }
.fx-breakit-tick span { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 4px; font-size: .68rem; color: var(--pencil); white-space: nowrap; }
.fx-breakit-readout { margin-top: 14px !important; font-size: .9rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.fx-breakit-outcome { padding: 10px 12px; border-radius: 12px; background: var(--tone-tint); border-left: 4px solid var(--tone); }
.fx-breakit-title { font-size: 1.12rem; font-weight: 800; line-height: 1.3; }
.fx-breakit-sub { font-weight: 600; margin-top: 2px !important; }
.fx-breakit-lines { margin: 0; padding-left: 1.1em; display: grid; gap: 4px; line-height: 1.45; }
.fx-breakit-score { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: var(--paper); }
.fx-breakit-why ul { margin: 0; padding: 0 12px 10px 28px; display: grid; gap: 4px; }
.fx-breakit-key .fx-traffic-key, .fx-breakit-key > div { margin-top: 4px; }
.fx-breakit-err { color: #A31E21; margin: 4px 0 0 !important; }
.vp-breakit { top: auto; bottom: 14px; right: 50%; transform: translateX(50%); background: rgba(198,40,40,.92); color: #fff; border-color: transparent; font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .fx-breakit-fill { transition: none; } }

/* ---- Break it! fix pass (UX-1, UX-5, UX-7, UX-10, UX-4) ---------------------------------- */
/* Narrow layout: when scrolled to, the card/outcome land below the sticky header + step bar. */
.fx-breakit, .fx-breakit-outcome { scroll-margin-top: calc(var(--header-h, 64px) + 64px); }
@media (min-width: 901px) { .fx-breakit, .fx-breakit-outcome { scroll-margin-top: 8px; } }
/* "your load" tick label kept inside the meter near either end. */
.fx-breakit-tick.is-end span { left: auto; right: 0; transform: none; }
.fx-breakit-tick.is-start span { left: 0; transform: none; }
/* Guess tiles: the "your load" badge on its own line, so the label keeps the tile's width. */
.fx-breakit-tile { flex-wrap: wrap; row-gap: 2px; }
.fx-breakit-tile > span:nth-child(2) { flex: 1 1 0; min-width: 0; }
.fx-breakit-tile .fx-breakit-own { flex-basis: 100%; margin-left: calc(1.25rem + 8px); order: 3; width: max-content; max-width: 100%; }
/* Entry point right after the verdict. */
.fx-breakit-jump { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0; }

/* ---- Material race (ui/race.js, Stage 5) -------------------------------------------------- */
.fx-race { padding: 16px 18px; display: grid; gap: 10px; border-left: 5px solid var(--cyan); container-type: inline-size; scroll-margin-top: calc(var(--header-h, 64px) + 64px); }
@media (min-width: 901px) { .fx-race { scroll-margin-top: 8px; } }
.fx-race-top { display: grid; gap: 2px; }
.fx-race-top p { margin: 0; }
.fx-race-head { margin: 0; font-size: 1.15rem; font-weight: 800; letter-spacing: -.01em; }
.fx-race-head:focus { outline: none; }
.fx-race-head:focus-visible, .fx-race-table caption:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 6px; }
.fx-race-body p { margin: 0; line-height: 1.5; }
.fx-race-row { gap: 8px; align-items: center; flex-wrap: wrap; }
.fx-race-picker { border: 0; margin: 0; padding: 0; min-width: 0; }
.fx-race-picker legend { font-weight: 700; margin-bottom: 6px; padding: 0; }
.fx-race-opts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.fx-race-opt { border: 1.5px solid var(--field-line); border-radius: 12px; background: var(--white); padding: 6px 10px; }
.fx-race-opt:has(input:checked) { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.fx-race-opt.is-off { background: var(--paper); color: var(--pencil); }
.fx-race-optlabel { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-height: 32px; cursor: pointer; }
.fx-race-opt.is-off .fx-race-optlabel { cursor: not-allowed; }
.fx-race-optlabel input { width: 20px; height: 20px; accent-color: var(--blue); margin: 0; }
.fx-race-optname { font-weight: 600; }
.fx-race-props { flex-basis: 100%; padding-left: 52px; font-family: var(--mono); font-size: .72rem; }
.fx-race-why { margin: 2px 0 0 52px !important; }
.fx-race-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--line-light); flex: none; vertical-align: -2px; margin-right: 6px; }
.fx-race-mine { font-size: .68rem; }
.fx-race-bar { position: relative; height: 14px; border-radius: 999px; background: var(--track); overflow: hidden; }
.fx-race-fill { position: absolute; inset: 0 auto 0 0; background: var(--blue); border-radius: 999px; transition: width .3s var(--ease); }
.fx-race-fill.no-anim { transition: none; }
@media (prefers-reduced-motion: reduce) { .fx-race-fill { transition: none; } }
.fx-race-status { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.fx-race-status li { padding-left: 1.5em; text-indent: -1.5em; }
.fx-race-sicon { display: inline-block; width: 1.5em; text-indent: 0; text-align: center; font-weight: 700; }
.fx-race-status .is-done .fx-race-sicon { color: var(--ok); }
.fx-race-status .is-running { font-weight: 600; }
.fx-race-status .is-error .fx-race-sicon, .fx-race-status .is-stopped .fx-race-sicon { color: var(--pencil); }
.fx-race-badges { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.fx-race-badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; background: rgba(36,72,255,.08); border: 1px solid rgba(36,72,255,.25); font-size: .8rem; }
.fx-race-bicon { color: var(--blue); font-weight: 700; }
.fx-race-nobest { color: var(--pencil); }
.fx-race-sort { gap: 6px; flex-wrap: wrap; align-items: center; }
.fx-race-sortbtn[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #fff; }
/* Table: the primary accessible view. Narrow containers (the side panel, phones) show one card
   per material with label/value pairs; table roles are set explicitly so they survive. */
.fx-race-tablewrap { max-width: 100%; }
.fx-race-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.fx-race-table caption { text-align: left; font-weight: 700; padding: 4px 0 8px; }
.fx-race-table th, .fx-race-table td { padding: 6px 8px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line-light); }
.fx-race-table thead th { font-family: var(--mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; color: var(--pencil); }
.fx-race-table tr.is-mine th[scope="row"] { color: var(--blue); }
.fx-race-table .c-status { color: var(--pencil); font-style: italic; }
.fx-race-fos { font-weight: 700; font-family: var(--mono); }
.fx-race-fos.fx-tone-bad { color: #A31E21; } .fx-race-fos.fx-tone-warn { color: #7A5100; } .fx-race-fos.fx-tone-ok { color: #136B3D; }
.fx-race-making.is-warn { color: #7A5100; }
.fx-race-large { color: #7A5100; }
.fx-race-status .is-changed .fx-race-sicon { color: #7A5100; }
.fx-race-table tr.is-changed .c-status { color: #7A5100; font-weight: 600; }
.fx-race-strongstiff { font-weight: 600; }
.fx-race-facts { margin: 0 0 4px; }
.fx-race-making.is-pending { color: var(--pencil); font-style: italic; }
.fx-race-dots { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.fx-race-dots .dots i { border-color: var(--blue); }
.fx-race-dots .dots i.on { background: var(--blue); }
.fx-race-dotword { color: var(--pencil); }
.fx-race-show { padding-inline: 0; }
@container (max-width: 760px) {
  .fx-race-table, .fx-race-table tbody, .fx-race-table tr, .fx-race-table td, .fx-race-table th[scope="row"] { display: block; }
  .fx-race-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .fx-race-table caption { display: block; }
  .fx-race-table tr { border: 1.5px solid var(--field-line); border-radius: 12px; padding: 6px 10px 8px; margin-bottom: 8px; background: var(--white);
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 10px; }
  .fx-race-table tr.is-mine { border-color: var(--blue); }
  .fx-race-table th[scope="row"] { grid-column: 1 / -1; border: 0; padding: 2px 0 4px; font-size: .95rem; }
  .fx-race-table td { border: 0; padding: 3px 0; min-width: 0; overflow-wrap: anywhere; }
  .fx-race-table td[data-label]::before { content: attr(data-label); display: block; font-family: var(--mono); font-size: .64rem; text-transform: uppercase; letter-spacing: .04em; color: var(--pencil); }
  .fx-race-table td.c-making, .fx-race-table td.c-status, .fx-race-table td.c-show, .fx-race-table td.c-mode { grid-column: 1 / -1; }
}
.fx-race-charts { margin-top: 4px; }
.fx-race-charts > p { padding: 0 12px; }
.fx-race-fig { margin: 8px 12px 12px; }
.fx-race-fig figcaption { font-size: .85rem; margin-bottom: 4px; }
.rc-svg { display: block; max-width: 440px; overflow: visible; font-family: var(--font); }
.rc-name { font-size: 13px; font-weight: 600; fill: var(--text); }
.rc-val { font-size: 13px; font-family: var(--mono); fill: var(--text); }
.rc-axis { font-size: 12px; fill: var(--pencil); font-family: var(--mono); }
.rc-bar { fill: var(--pencil); fill-opacity: .35; }
.rc-bar.is-lead { fill: var(--blue); fill-opacity: 1; }
.rc-base { stroke: var(--text); stroke-opacity: .4; stroke-width: 1; }
.rc-ref { stroke: var(--pencil); stroke-dasharray: 3 3; stroke-width: 1; }
/* UX-8: the leader's whole row is tinted, its name bold blue (the ▲ tag says it in words too). */
.rc-leadband { fill: var(--blue); fill-opacity: .08; }
.rc-name.is-lead { fill: var(--blue); font-weight: 700; }
/* Stage 5 UX fixes: race jump under the verdict (UX-3), collapsed race summary (UX-2). */
.fx-race-jump { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0; }
.fx-race-summary { display: grid; gap: 6px; }
.fx-race-summary .fx-race-badges { margin: 0; }
.fx-race-choice { padding: 12px 14px; background: var(--paper); display: grid; gap: 6px; }
.fx-race-choose { border: 0; margin: 0; padding: 0; min-width: 0; }
.fx-race-choose legend { font-weight: 700; padding: 0; margin-bottom: 4px; }
.fx-race-radios { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.fx-race-radio { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; cursor: pointer; }
.fx-race-radio input { width: 18px; height: 18px; accent-color: var(--blue); margin: 0; }
.fx-race-choice textarea { width: 100%; box-sizing: border-box; font: inherit; padding: 8px 10px; border-radius: var(--r-input); border: 1.5px solid var(--field-line); resize: vertical; }
.fx-race-saved { color: #136B3D; font-weight: 600; min-height: 1.2em; }
/* Final visual fix: long verdict pills ("Getting close — and bends a lot") must never spill into the
   next cell. Pills in the race table may wrap, and in the stacked card layout the verdict has the whole row. */
.fx-race-table .pill { white-space: normal; max-width: 100%; border-radius: 10px; overflow-wrap: break-word; box-sizing: border-box; }
@container (max-width: 760px) {
  .fx-race-table td.c-verdict, .fx-race-table td.c-fos { grid-column: 1 / -1; }
}

/* ---- 3D printed: Print step (js/ui/print-settings.js, js/ui/orientation.js) ---- */
.print-stepper-row { align-items: center; gap: 8px; flex-wrap: wrap; }
.print-stepper-row .btn { min-width: 44px; }
.print-stepper-val { min-width: 2ch; text-align: center; font-size: 1.05rem; }
.print-orient-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.print-orient-status { font-weight: 600; }
.print-nozzles { flex-wrap: wrap; }

/* 3D print results (Phase 3): failure-kind line under the verdict, and the
   "Overall stress / Stress across layers" switch above the field switch. */
.fx-seg-2, .fx-print-view { display: flex; width: 100%; }
.fx-seg-2 > button, .fx-print-view > button { flex: 1; padding-inline: .5em; }
.fx-print-view + .seg { margin-top: .4rem; }
.fx-print-verdict { margin: .35rem 0 0; }
.fx-print-verdict.fx-print-layer-split b { color: #B0129A; }
.fx-print-second, .fx-print-explain { margin: .2rem 0 0; }

/* ---- 3D printed: "Which way up?" (js/ui/which-way-up.js) ---- */
.fx-wwu { padding: 14px 16px; display: grid; gap: 8px; border-left: 5px solid var(--blue); margin-top: 8px; }
.fx-wwu p { margin: 0; }
.fx-wwu-head { margin: 0; font-size: 1.05rem; }
.fx-wwu-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.fx-wwu-col { display: grid; gap: 3px; align-content: start; justify-items: center; text-align: center; padding: 6px 4px; border: 1.5px solid var(--field-line); border-radius: 10px; background: var(--white); min-width: 0; }
.fx-wwu-col.is-win { border-color: #1f9a55; box-shadow: inset 0 0 0 1px #1f9a55; }
.fx-wwu-col.is-pending { opacity: .7; }
.fx-wwu-col .btn { margin-top: 2px; }
.fx-wwu-pic { max-width: 100%; height: auto; display: block; }
.fx-wwu-badge { font-size: .72rem; font-weight: 700; color: #1f9a55; min-height: 1.1em; }
.fx-wwu-name { font-weight: 600; overflow-wrap: anywhere; }
.fx-wwu-fos { font-size: 1rem; font-weight: 700; }
.fx-wwu-split b, .fx-wwu-split { color: #B0129A; }
.fx-wwu-win { justify-items: center; text-align: center; display: grid; }
.fx-wwu-headline { font-size: 1.05rem; }
.fx-wwu-col p { font-size: .76rem; line-height: 1.25; }
.fx-wwu-col .fx-wwu-fos { font-size: .9rem; }
.fx-wwu-col .btn-sm { padding: 4px 10px; font-size: .78rem; }

/* ---- 3D printed: slice preview + printing checks (js/ui/slice-preview.js) ---- */
.print-slice-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.print-slice-canvas { display: block; width: 100%; border-radius: var(--r-tag); background: var(--ink); image-rendering: auto; }
.print-slice-track { position: relative; padding-bottom: 2px; }
.print-slice-track input[type=range] { width: 100%; }
.print-slice-tick { position: absolute; top: -4px; width: 3px; height: 10px; margin-left: -1px; background: #FF4FD8; border-radius: 2px; pointer-events: none; box-shadow: 0 0 6px #FF4FD8; }
.print-slice-strip { display: block; width: 100%; height: 8px; border-radius: 3px; margin-top: 2px; }
.print-slice-readout { margin: 0; }
.print-slice-bar { display: block; height: 10px; border-radius: 5px; }
.print-slice-ends { display: flex; justify-content: space-between; }
.print-slice.is-big { position: fixed; z-index: 60; right: 24px; top: 84px; width: min(720px, calc(100vw - 420px)); max-height: calc(100vh - 110px); overflow: auto;
  background: var(--paper); padding: 14px 16px; border-radius: var(--r-fact); box-shadow: var(--shadow-window); }
.print-estimate-dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 4px 0; }
.print-estimate-dl dt { color: var(--pencil); }
.print-estimate-dl dd { margin: 0; }
.print-estimate p { margin: 0; }
@media (max-width: 900px) { .print-slice.is-big { left: 16px; right: 16px; width: auto; } }

/* Phase 4 Part E — "Check my mesh" (Engineer; ui/mesh-study.js) */
.fx-ms-table { font-size: .74rem; }
.fx-ms-table td, .fx-ms-table th { white-space: nowrap; padding: 6px 6px; }
.fx-ms-table tbody th { min-width: 0; }
.fx-ms-table tbody th small { display: block; font-weight: 400; }
.fx-ms-table .fx-ms-change th, .fx-ms-table .fx-ms-change td { font-weight: 700; }
.ms-grid { stroke: var(--text); stroke-opacity: .08; stroke-width: 1; }
.ms-line { fill: none; stroke-width: 2; }
.ms-line.is-peak { stroke: var(--blue); }
.ms-line.is-away { stroke: var(--pencil); stroke-dasharray: 4 3; }
.ms-pt.is-peak { fill: var(--blue); }
.ms-pt.is-away { fill: var(--white); stroke: var(--pencil); stroke-width: 1.5; }
.ms-val { font-size: 11px; }
.ms-tag.is-peak { fill: var(--blue); }

/* Phase 4 Part F: Engineer fix types, load cases (ui/engineer-fixes.js, ui/engineer-loads.js, ui/load-cases-results.js) */
.fx-seg-wrap { flex-wrap: wrap; }
.fx-fix-badge { margin-left: 4px; white-space: nowrap; }
.fx-fix-list { list-style: none; margin: 0; padding: 0; }
.fx-fix-group { border-top: 1px solid var(--line, #DCE3F5); padding-top: 6px; }
.fx-fix-group select { max-width: 100%; }
.load-numeric.load-numeric-stack { grid-template-columns: minmax(0, 1fr); }   /* force + pressure cards: the direction box shows its whole label */
#fx-fix-axis, #fx-fix-dir { padding-left: 12px; padding-right: 34px; background-position: right 12px center; }   /* Pinned/Roller fix drafts: whole label shows (phase 4.1) */
select[data-gravity-dir] { min-width: 10rem; max-width: 100%; }   /* self-weight direction: "+Z (to you)" shows whole (phase 4.1) */
.fx-lc-table { width: 100%; border-collapse: collapse; }
.fx-lc-table th, .fx-lc-table td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line, #DCE3F5); vertical-align: top; }
.fx-lc-table td { text-align: right; }
.fx-lc-table thead th { font-weight: 600; }
.fx-lc-gov th, .fx-lc-gov td { font-weight: 700; }
.fx-lc-pill { margin-left: 6px; }

/* Phase 4 Part H — Engineer results tools (ui/engineer-results.js) */
.fx-rt-type { width: 100%; }
.fx-rt-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fx-rt-check { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.fx-rt-bands-n { width: auto; min-width: 9em; }
.fx-rt-section input[type="range"] { width: 100%; }
.fx-rt-probes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.fx-rt-probe { border-left: 3px solid var(--cyan, #4FE3FF); padding-left: 8px; }
.fx-rt-probe-head { display: flex; gap: 8px; align-items: baseline; }
.fx-rt-probe-head .fx-link { margin-left: auto; }
.fx-rt-reactions td, .fx-rt-reactions th { padding: 3px 4px; }
.fx-rt-reactions .fx-rt-sum th, .fx-rt-reactions .fx-rt-sum td { border-top: 1px solid var(--line, rgba(0,0,0,.15)); font-weight: 600; }
.fx-rt-eq.is-ok { color: var(--ok, #1E9E5A); font-weight: 600; }
.fx-rt-eq.is-bad { color: var(--bad, #E5383B); font-weight: 600; }
