/* 4x4 Systems Explained. Colours follow psyphin.co.za (css/style.css there);
   based on the SA Towing Check stylesheet, so the tools look the same: the navy
   "deep space" look shared by every PsyPhin site since 2026-10-18. */
:root {
  --bg: #040817;
  --surface: #0b1330;
  --surface-2: #101a3c;
  --glass: rgba(11, 19, 48, 0.58);
  --glass-2: rgba(16, 26, 60, 0.6);
  --border: rgba(120, 170, 255, 0.16);
  --text: #eaf2ff;
  --text-muted: #a8b7d6;
  --accent: #4cc9ff;
  --accent-strong: #2f6bff;
  --accent-glow: rgba(76, 201, 255, 0.35);
  --violet: #7c5cff;

  /* anything the visitor can change: blue box, blue value, pencil (worked-out figures stay plain) */
  --input-bg: color-mix(in srgb, var(--accent) 12%, var(--surface-2));
  --input-border: color-mix(in srgb, var(--accent) 70%, var(--border));
  --pencil: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%234cc9ff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11.2 2.3l2.5 2.5-8.4 8.4-3.2.7.7-3.2z'/%3E%3Cpath d='M9.6 3.9l2.5 2.5'/%3E%3C/svg%3E");

  /* traffic light */
  --pass: #2ee6a6;
  --warn: #ffc857;
  --fail: #ff5d73;
  --info: #4cc9ff;
  --incomplete: #7487ad;

  /* panel accents */
  --legal: #4cc9ff;
  --maker: #c084fc;

  /* chart series (validated for colour-blind separation on --surface-2) */
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #9085e9;
  --series-4: #d55181;
  --series-neutral: #7487ad;

  /* under construction banner */
  --construction: #fbbf24;
  --construction-ink: #1a1405;

  --radius: 14px;
  --max-width: 1100px;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Sora", "Inter", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* elements with display rules below must still hide (modes, trailer fields) */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Fixed layers behind the whole page, the same on every PsyPhin site (change them
   together): a glowing circuit board and slow-drifting pools of blue and violet
   light. js/circuit.js (identical on every site) draws the circuit on two canvases
   (.circuit-fx) and adds .fx-circuit to <html>, which hides the static fallback
   tile in body::before. Here (owner's request, 2026-10-19) both are dimmer than
   on the other sites and still: the pages set <html data-circuit="still">, so
   circuit.js draws the board once with no pulses, and the light doesn't drift,
   so nothing moves behind the text. */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

body::before {
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' fill='none'%3E%3Cfilter id='g' filterUnits='userSpaceOnUse' x='-20' y='-20' width='220' height='220'%3E%3CfeGaussianBlur stdDeviation='1.8' result='b'/%3E%3CfeMerge%3E%3CfeMergeNode in='b'/%3E%3CfeMergeNode in='SourceGraphic'/%3E%3C/feMerge%3E%3C/filter%3E%3Cg filter='url(%23g)'%3E%3Cg stroke='%233fb6ff' stroke-opacity='0.18' stroke-width='1.1'%3E%3Cpath d='M0 40h46l18 18h44M108 58v42l18 18h54M24 180v-44l18-18h34M180 22h-34L124 0M76 118v-20l-14-14H0M146 180v-26l12-12h22'/%3E%3C/g%3E%3Cg stroke='%235cc8ff' stroke-opacity='0.38'%3E%3Ccircle cx='108' cy='58' r='2.6'/%3E%3Ccircle cx='76' cy='118' r='2.6'/%3E%3Ccircle cx='146' cy='22' r='2.6'/%3E%3Ccircle cx='146' cy='154' r='2.6'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.fx-circuit body::before {
  display: none;
}

body::after {
  z-index: -2;
  inset: -20%;
  background:
    radial-gradient(38% 32% at 82% 8%, rgba(47, 107, 255, 0.18), transparent 70%),
    radial-gradient(30% 28% at 10% 40%, rgba(124, 92, 255, 0.1), transparent 70%),
    radial-gradient(34% 30% at 70% 85%, rgba(0, 180, 255, 0.07), transparent 70%);
}

.circuit-fx {
  position: fixed;
  top: 0;
  left: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.5;
}

::selection {
  background: rgba(76, 201, 255, 0.35);
  color: #fff;
}

a {
  color: var(--accent);
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  line-height: 1.15;
  margin: 0;
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px;
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 16px;
  top: 16px;
  z-index: 10;
  background: var(--surface);
  padding: 8px 12px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.muted {
  color: var(--text-muted);
}

/* ------------------------------------------------------------ header / footer */
.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(2, 2, 3, 0.92);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(6px);
}

.site-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* back link pill: same design as fuel.psyphin.co.za's header link */
.back-link {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 8px 16px 8px 12px;
  border: 1px solid rgba(76, 201, 255, 0.35);
  border-radius: 999px;
  background: rgba(10, 20, 52, 0.55);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.back-link-arrow {
  color: var(--accent);
  font-size: 17px;
  transition: transform 0.15s ease;
}

.back-link-domain {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13px;
}

.back-link:hover {
  background: rgba(76, 201, 255, 0.14);
  border-color: var(--accent);
  box-shadow: 0 0 22px rgba(76, 201, 255, 0.3);
}

.back-link:hover .back-link-arrow {
  transform: translateX(-3px);
}

.back-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* phones: the pill, page links and shield share one row, so drop the domain,
   keep the pill on one line and shorten it to "← PsyPhin tools" */
@media (max-width: 480px) {
  .back-link-domain {
    display: none;
  }

  .back-link {
    flex-wrap: nowrap;
    white-space: nowrap;
  }
}

@media (max-width: 420px) {
  .back-link-more {
    display: none;
  }

  .back-link {
    padding: 7px 12px 7px 10px;
    gap: 8px;
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .back-link,
  .back-link-arrow {
    transition: none;
  }
}

.nav {
  display: flex;
  gap: 18px;
}

/* page links + PsyPhin shield (a copy of psyphin.co.za's brand-64.png), top right */
.header-end {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: block;
  flex: none;
  border-radius: 6px;
}

.brand img {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: 6px;
}

.brand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 420px) {
  .site-header-inner {
    gap: 12px;
  }

  .header-end,
  .nav {
    gap: 12px;
  }

  .nav a {
    font-size: 1rem;
  }

  .brand img {
    width: 28px;
    height: 28px;
  }
}

@media (max-width: 350px) {
  .site-header-inner {
    padding-left: 12px;
    padding-right: 12px;
  }

  .site-header-inner,
  .header-end,
  .nav {
    gap: 8px;
  }

  .back-link {
    padding: 6px 10px 6px 8px;
    gap: 6px;
  }
}

.nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.nav a[aria-current="page"],
.nav a:hover {
  color: var(--accent);
}

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 48px;
  padding: 20px 0 32px;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.site-footer p {
  margin: 4px 0;
}

/* ------------------------------------------------------------ intro */
.intro {
  padding: 28px 0 8px;
}

.intro h1 {
  font-size: clamp(2rem, 6vw, 2.8rem);
  color: var(--text);
}

.lede {
  max-width: 62ch;
  margin: 10px 0 6px;
  color: var(--text);
}

.privacy {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ------------------------------------------------------------ modes */
.modes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-top: 20px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 760px;
}

/* phones: two rows of two */
@media (max-width: 560px) {
  .modes {
    grid-template-columns: 1fr 1fr;
  }
}

.mode-button small {
  display: block;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.8;
}

.mode-button {
  font: inherit;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.15;
  min-height: 44px;
  padding: 6px 8px;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
}

.mode-button:hover {
  color: var(--text);
}

.mode-button[aria-pressed="true"] {
  color: #031022;
  background: var(--accent);
}

.mode-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.mode-hint {
  margin: 8px 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.jump-link {
  white-space: nowrap;
}

.results {
  scroll-margin-top: 64px; /* clear the sticky header */
}

@media (min-width: 900px) {
  .jump-link {
    display: none;
  }
}

/* ------------------------------------------------------------ layout */
.layout {
  display: grid;
  gap: 24px;
  margin-top: 20px;
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: minmax(300px, 380px) 1fr;
    align-items: start;
  }
}

/* ------------------------------------------------------------ form */
.inputs fieldset {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  margin: 0 0 16px;
  padding: 14px 16px 6px;
  min-width: 0;
}

.inputs legend {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  padding: 0 6px;
  color: var(--accent);
}

.field {
  margin-bottom: 14px;
}

.field > label,
.field > .label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.hint {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

input[inputmode],
select {
  width: 100%;
  font: inherit;
  font-size: 1rem; /* 16px stops iOS zooming on focus */
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 44px;
}

input[inputmode]:focus,
select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.unit-input {
  display: flex;
  align-items: stretch;
}

.unit-input input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.unit-input span {
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-left: 0;
  border-radius: 0 10px 10px 0;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.choice label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.3;
  padding: 10px 12px;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  cursor: pointer;
  font-weight: 500;
}

.choice label small {
  display: block;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 400;
  margin-top: 2px;
}

.choice .choice-wide {
  grid-column: 1 / -1;
}

.field > .label small {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.choice label:has(input:checked) {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.choice input {
  accent-color: var(--accent);
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
}

.help {
  margin-top: 8px;
  font-size: 0.875rem;
}

.help summary {
  cursor: pointer;
  color: var(--accent);
}

.help-body {
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 10px;
}

.help-body p {
  margin: 0 0 6px;
}

.help-body > ul {
  margin: 0 0 6px;
  padding-left: 1.2em;
}

.help-body li {
  margin-bottom: 3px;
}

.fieldset-hint {
  margin: 0 0 12px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 10px;
}

.field-row > .field > label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.field-row-hint {
  margin: -8px 0 14px;
}

.fieldset-details > summary {
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--accent);
  margin-bottom: 8px;
}

.fieldset-details > summary small {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* if the heading wraps, "(optional)" goes with the last word, never alone */
.summary-tail {
  white-space: nowrap;
}

/* phones: keep "(optional)" on the heading's line */
@media (max-width: 420px) {
  .fieldset-details > summary {
    font-size: 1.05rem;
  }

  .fieldset-details > summary small {
    font-size: 0.75rem;
  }
}

.inputs fieldset:has(> .fieldset-details) {
  padding-top: 12px;
}

/* load list builder */
.load-list {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.load-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 6px 8px;
  align-items: end;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.load-row input[type="text"] {
  grid-column: 1 / -1;
}

.load-row input {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  min-height: 44px;
}

.load-row input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.load-num span {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.load-remove {
  min-width: 44px;
  min-height: 44px;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.load-remove:hover {
  color: var(--fail);
  border-color: var(--fail);
}

.load-add {
  display: flex;
  gap: 8px;
}

.load-add select {
  flex: 1;
  min-width: 0;
}

.load-total {
  margin: 10px 0 12px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.load-total strong {
  color: var(--text);
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.button {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 10px;
  cursor: pointer;
}

.button--ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
}

.button--ghost:hover {
  border-color: var(--accent);
}

.button--primary {
  background: var(--accent);
  color: #031022;
  border: 1px solid var(--accent);
}

.button--primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ------------------------------------------------------------ results */
.overall {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  font-weight: 600;
  margin-bottom: 16px;
  --tone: var(--incomplete);
  border-left: 5px solid var(--tone);
}

.overall--pass,
.overall--info {
  --tone: var(--pass);
}

.overall--warn {
  --tone: var(--warn);
}

.overall--fail {
  --tone: var(--fail);
}

.status-icon {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--tone);
  color: #031022;
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1;
}

.panel {
  border: 1px solid var(--border);
  border-top: 4px solid var(--panel-color);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.panel--legal {
  --panel-color: var(--legal);
}

.panel--maker {
  --panel-color: var(--maker);
}

.panel h2 {
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.panel-tag {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--panel-color);
  border: 1px solid var(--panel-color);
  border-radius: 999px;
  padding: 2px 8px;
}

.panel > p {
  margin: 10px 0 0;
}

.checks {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.check {
  --tone: var(--incomplete);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 5px solid var(--tone);
  border-radius: 12px;
  padding: 12px 14px;
}

.check--pass { --tone: var(--pass); }
.check--warn { --tone: var(--warn); }
.check--fail { --tone: var(--fail); }
.check--info { --tone: var(--info); }

.check-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* the title wraps beside its icon (never leaving the icon alone); a long
   status label drops to its own line only when both won't fit */
.check-head h3 {
  font-size: 1.15rem;
  flex: 1 1 9rem;
  min-width: 0;
}

.status-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--tone);
  text-align: right;
}

.check-reason {
  margin: 8px 0 0;
}

.check-notes {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.check-notes li + li {
  margin-top: 2px;
}

/* a card's explanatory notes, folded away */
.more-detail {
  margin-top: 8px;
  font-size: 0.85rem;
}

.more-detail > summary {
  cursor: pointer;
  width: fit-content;
  color: var(--accent);
}

.more-detail > .check-notes {
  margin-top: 4px;
}

/* one outcome per vehicle type, when the type was left blank */
.variants {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.variant {
  --tone: var(--incomplete);
  padding: 8px 10px;
  border-left: 3px solid var(--tone);
  border-radius: 8px;
  background: var(--surface);
}

.variant--pass { --tone: var(--pass); }
.variant--warn { --tone: var(--warn); }
.variant--fail { --tone: var(--fail); }
.variant--info { --tone: var(--info); }

.variant-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.variant-head .status-icon {
  width: 20px;
  height: 20px;
  font-size: 0.75rem;
}

.variant-head strong {
  flex: 1 1 9rem;
  min-width: 0;
}

.variant-head .status-label {
  margin-left: auto;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--tone);
}

.variant p {
  margin: 4px 0 0;
}

/* meter: fill carries the status; the track is a dim step of the same colour */
.meter {
  --tone: var(--incomplete);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.meter--pass { --tone: var(--pass); }
.meter--warn { --tone: var(--warn); }
.meter--fail { --tone: var(--fail); }
.meter--info { --tone: var(--info); }

.meter-track {
  flex: 1;
  height: 10px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--tone) 22%, var(--surface-2));
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--tone);
}

.meter-text {
  flex: none;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.panel-intro {
  font-size: 0.875rem;
}

.panel-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 0;
  font-weight: 600;
  --tone: var(--incomplete);
}

.panel-summary.overall--pass { --tone: var(--pass); }
.panel-summary.overall--warn { --tone: var(--warn); }
.panel-summary.overall--fail { --tone: var(--fail); }

.table-wrap {
  overflow-x: auto;
  margin-top: 12px;
}

.limit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.limit-table th,
.limit-table td {
  text-align: left;
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.limit-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.limit-table .num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.limit-table tr.is-binding td {
  font-weight: 600;
  background: var(--surface-2);
}

.limit-table tr.is-binding td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

/* tables stay tables on phones; .table-wrap scrolls the wide ones */

/* compact citations on the checker: plain rule names linking to the sources page */
.rule-links {
  margin: 10px 0 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.rule-links-label {
  margin-right: 6px;
}

.rule-links ul {
  display: inline;
  list-style: none;
  margin: 0;
  padding: 0;
}

.rule-links li {
  display: inline;
}

.rule-links li + li::before {
  content: "\00B7";
  margin: 0 6px;
  color: var(--text-muted);
}

.rule-links a {
  font-weight: 600;
}

.rule-ref {
  font-weight: 400;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.4;
  padding: 1px 7px;
  border-radius: 999px;
  white-space: nowrap;
  vertical-align: 1px;
}

.badge--unverified {
  color: var(--warn);
  border: 1px dashed var(--warn);
}

.badge--verified {
  color: var(--pass);
  border: 1px solid var(--pass);
}

.disclaimer {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.disclaimer strong {
  color: var(--text);
}

.disclaimer {
  scroll-margin-top: 72px; /* clear the sticky header when jumped to */
}

.disclaimer h2 {
  font-size: 1.05rem;
  color: var(--text);
  margin: 0 0 6px;
}

.disclaimer p {
  margin: 0;
}

.disclaimer p + p {
  margin-top: 6px;
}

/* "Legal disclaimer" link, top of the page */
.disclaimer-link {
  margin: 0 0 6px;
  font-size: 0.85rem;
}

.disclaimer-link a {
  color: var(--text-muted);
}

.disclaimer-link a:hover {
  color: var(--accent);
}

.explainer {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 12px;
}

.explainer summary {
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
}

.explainer ol {
  padding-left: 20px;
}

.explainer ol > li + li {
  margin-top: 10px;
}

.example {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 10px 12px;
}

/* ------------------------------------------------------------ sources page */
.source-group {
  margin-top: 28px;
}

.source-group > h2 {
  font-size: 1.5rem;
  margin-bottom: 12px;
}

.source-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.source-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}

.source-item h3 {
  font-size: 1.15rem;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.source-item p {
  margin: 6px 0 0;
}

.source-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.source-meta a {
  overflow-wrap: anywhere;
}

.source-item {
  scroll-margin-top: 70px;
}

.source-item:target,
.source-item:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.source-group {
  scroll-margin-top: 70px;
}

.sources-summary {
  width: 100%;
  margin-top: 20px;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.sources-summary th,
.sources-summary td {
  text-align: left;
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
}

.sources-summary thead th {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sources-summary .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.open-questions {
  padding-left: 22px;
}

.open-questions li + li {
  margin-top: 8px;
}

.oq-rules {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* the key figures, before the cards */
.figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

/* worked out, not typed: plain figures, no box (a box means you can change it) */
.figure {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 12px;
  border-left: 2px solid var(--border);
}

.figure-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.figure-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.9rem;
  line-height: 1.1;
}

.figure-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ------------------------------------------------------------ print */
/* ------------------------------------------------------------ print */
.results-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

/* one column: the form's Print summary button sits just above, so don't repeat it */
@media (max-width: 899px) {
  .results-actions {
    display: none;
  }
}

.print-only {
  display: none;
}

@media print {
  :root {
    --bg: #fff;
    --surface: #fff;
    --surface-2: #f4f5f6;
    --border: #bbb;
    --text: #000;
    --text-muted: #444;
    --accent: #0645ad;
    --legal: #0645ad;
    --maker: #6b21a8;
    --pass: #15803d;
    --warn: #b45309;
    --fail: #b91c1c;
    --info: #1d4ed8;
    --incomplete: #6b7280;
  }

  @page {
    margin: 14mm;
  }

  body {
    font-size: 10.5pt;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .site-header,
  .modes,
  .mode-hint,
  .inputs,
  .results-actions,
  .explainers,
  .help,
  .more-detail,
  .skip-link {
    display: none !important;
  }

  .intro .lede,
  .intro .privacy {
    display: none;
  }

  .intro {
    padding-top: 0;
  }

  .layout {
    display: block;
    margin-top: 0;
  }

  .print-only {
    display: block;
    margin-bottom: 14px;
  }

  .check-notes.print-only {
    margin-bottom: 0;
  }

  .status-icon {
    color: #fff;
  }

  .panel,
  .limit-tile,
  .overall,
  .disclaimer {
    border-color: var(--border);
  }

  .check,
  .tow-card,
  .tow-speed,
  .limit-tile,
  .rig-figure,
  .print-table,
  tr {
    break-inside: avoid;
  }

  .panel h2,
  .limit-tile h2 {
    break-after: avoid;
  }

  a {
    color: var(--text);
  }

  .site-footer {
    margin-top: 16px;
  }
}

.print-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-top: 10px;
}

.print-table caption {
  text-align: left;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  padding-bottom: 4px;
}

.print-table th,
.print-table td {
  text-align: left;
  vertical-align: top;
  padding: 5px 8px;
  border: 1px solid var(--border);
}

.print-table tbody th {
  width: 34%;
  font-weight: 600;
}

.write-in-table .write-in {
  width: 30%;
  height: 2.2em;
}

.print-meta {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}


/* ------------------------------------------------------------ header
   The same header as fuel.psyphin.co.za (.brand-bar in its style.css): navy
   band with blue/violet glow and a glowing bottom edge, the PsyPhin logo, a cyan
   eyebrow, the title and a one-line description. Here js/fx.js draws the winching
   hologram on canvas.hero-fx behind it. Keep the sites in step. */
.brand-bar {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(ellipse 55% 90% at 82% 40%, rgba(47, 107, 255, 0.22), transparent 65%),
    radial-gradient(ellipse 40% 70% at 0% 0%, rgba(124, 92, 255, 0.14), transparent 60%),
    linear-gradient(180deg, #030614, rgba(3, 6, 20, 0.72));
  color: #ffffff;
  padding-top: env(safe-area-inset-top, 0px);
}

/* Glowing line along the bottom edge, with a spark running along it. */
.brand-bar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background:
    linear-gradient(90deg, transparent 0 40%, rgba(255, 255, 255, 0.95) 50%, transparent 60% 100%) no-repeat,
    linear-gradient(90deg, transparent, rgba(76, 201, 255, 0.7) 30%, rgba(124, 92, 255, 0.7) 70%, transparent);
  background-size: 30% 100%, 100% 100%;
  background-position: -40% 0, 0 0;
  box-shadow: 0 0 14px rgba(76, 201, 255, 0.55);
}

.hero-fx {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.brand-nav {
  max-width: 1120px;
  margin: 0 auto;
  padding: 14px 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.brand-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px 28px;
}

/* A taller header with room on the right for the winching hologram. */
.brand-bar--hero .brand-inner {
  min-height: 330px;
  padding-top: 28px;
  padding-bottom: 48px;
}

.brand-bar--hero .brand-text {
  flex: 0 1 560px;
}

.brand-logo-link {
  flex-shrink: 0;
  display: block;
  border-radius: 8px;
}

.brand-logo-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* The logo sits on black; "lighten" drops the black so it floats on the navy. */
.brand-logo {
  width: 168px;
  height: auto;
  display: block;
  mix-blend-mode: lighten;
}

.brand-text {
  flex: 1 1 360px;
  min-width: 0;
}

.brand-text > * {
  animation: rise 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.brand-text > :nth-child(2) { animation-delay: 0.08s; }
.brand-text > :nth-child(3) { animation-delay: 0.16s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
}

.brand-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

.brand-eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent));
  box-shadow: 0 0 8px var(--accent);
}

.brand-bar h1,
.brand-title {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: clamp(26px, 3.6vw, 40px);
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #ffffff;
  background: linear-gradient(100deg, #ffffff 0%, #d6ecff 40%, #7fd6ff 75%, #8f7bff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-bar .subtitle {
  margin: 0;
  color: var(--text-muted);
  max-width: 62ch;
  font-size: 15px;
  line-height: 1.6;
}

@media (max-width: 760px) {
  .brand-nav {
    padding: 10px 16px 0;
  }

  .brand-inner {
    padding: 16px;
    gap: 14px 18px;
  }

  .brand-bar--hero .brand-inner {
    min-height: 0;
    padding-top: 16px;
    padding-bottom: 28px;
  }

  .brand-logo {
    width: 112px;
  }

  .brand-text {
    flex-basis: 200px;
  }

  .brand-bar .subtitle {
    font-size: 14px;
  }
}

@media print {
  .brand-bar,
  body::before,
  body::after,
  .circuit-fx {
    display: none;
  }
}


/* ============================================================ Shared tool parts (as on the winching page) */

/* ------------------------------------------------------------ under construction (same as the tyre calculator) */
.construction {
  background: repeating-linear-gradient(-45deg, var(--construction) 0 18px, #f59e0b 18px 36px);
  color: var(--construction-ink);
  text-align: center;
  padding: 10px 16px;
  font-size: 0.95rem;
  line-height: 1.4;
}

.construction strong {
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-right: 4px;
}

.intro .lede {
  max-width: 70ch;
  margin: 0 0 6px;
}

.intro .privacy a {
  color: var(--text-muted);
}

/* ------------------------------------------------------------ the stage: one card holding everything */
.stage {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  overflow: hidden;
}

.try {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.try-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-right: 2px;
}

.try-chip {
  font: inherit;
  font-size: 0.85rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  min-height: 34px;
  cursor: pointer;
}

.try-chip:hover {
  border-color: var(--accent);
}

/* the key to inputs vs worked-out figures; after the chips (they're added by app.js) */
.try-hint {
  order: 1;
  flex-basis: 100%;
  margin: 2px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.try-key {
  flex: none;
  width: 26px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid var(--input-border);
  background: var(--input-bg) var(--pencil) no-repeat right 3px center / 10px;
}

/* ------------------------------------------------------------ scene */
.scene {
  position: relative;
  background: #060c22;
}

.scene-pic {
  position: relative;
  aspect-ratio: 800 / 380;
}

.scene-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
/* overlays: typed fields and labels sit on the picture */
.scene-field,
.scene-tag {
  position: absolute;
  transform: translate(-50%, -50%);
  transition: left 0.7s cubic-bezier(0.3, 0.7, 0.2, 1), top 0.7s cubic-bezier(0.3, 0.7, 0.2, 1);
  z-index: 2;
}

.scene-field {
  display: grid;
  gap: 2px;
  padding: 7px 10px 8px;
  border-radius: 12px;
  background: rgba(6, 12, 32, 0.82);
  border: 1px solid var(--accent);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  min-width: 132px;
  max-width: 160px;
  cursor: text;
}

.scene-field.is-unclear { border-color: var(--warn); }

.sf-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.sf-input {
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.sf-input input {
  width: 100%;
  min-width: 0;
  background: var(--input-bg) var(--pencil) no-repeat right 6px center / 13px;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  color: var(--accent);
  font: inherit;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  line-height: 1.1;
  padding: 2px 24px 2px 6px;
}

.sf-input input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.sf-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.scene-field.is-unclear .sf-hint { color: var(--warn); }

/* phones: the typed fields drop below the picture; the labels stay on it */
@media (max-width: 860px) {
  /* app.js moves .scene-fields out of the picture on narrower screens */
  .scene > .scene-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 10px 12px 0;
    background: var(--surface);
  }

  .scene > .scene-fields .scene-field {
    position: static;
    transform: none;
    min-width: 0;
    max-width: none;
  }

  .scene > .scene-fields .scene-field--anchor { grid-column: 1 / -1; }
  .scene > .scene-fields .scene-field--anchor .sf-input input { width: 5em; }

  .scene-tag { font-size: 0.62rem; padding: 2px 6px; }
  .scene-tag strong { font-size: 0.85rem; }
}

/* ------------------------------------------------------------ controls under the scene */
.controls {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 14px 22px;
  padding: 16px;
}

/* the rope angle sits in the rope section, above the top view */

.ctl-label small {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

@media (min-width: 900px) {
  .controls { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .controls { grid-template-columns: 1fr; }
}

.ctl-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: inherit;
  font-size: 0.85rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 11px 5px 7px;
  min-height: 36px;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}

.chip:hover { border-color: var(--text-muted); }

.chip[aria-checked="true"] {
  border-color: var(--accent);
  background: rgba(76, 201, 255, 0.12);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.chip:focus-visible,
.pick:focus-visible,
.seg button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chip sup { color: var(--warn); }

.chip-swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid;
  flex: none;
}

.seg {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.seg button {
  font: inherit;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
  padding: 5px 10px;
  min-height: 32px;
  cursor: pointer;
  white-space: nowrap;
}

.seg button[aria-checked="true"] {
  background: var(--accent);
  color: #031022;
  font-weight: 600;
}

/* ------------------------------------------------------------ verdict and balance */
.verdict {
  --tone: var(--incomplete);
  margin: 0 16px 16px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 5px solid var(--tone);
}

.verdict--pass { --tone: var(--pass); }
.verdict--warn { --tone: var(--warn); }
.verdict--fail { --tone: var(--fail); }
.verdict--info { --tone: var(--info); }

.verdict-top {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.verdict-top .status-icon { width: 30px; height: 30px; font-size: 1rem; margin-top: 2px; }

.verdict-head {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.15;
}

.verdict-detail {
  margin: 4px 0 0;
  color: var(--text);
}

.verdict-sub {
  margin: 10px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.fix {
  margin-top: 10px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: #031022;
  background: var(--accent);
  border: 0;
  border-radius: 10px;
  padding: 8px 14px;
  min-height: 40px;
  cursor: pointer;
}

.fix:hover { background: var(--accent-strong); }

.balance { margin-top: 14px; display: grid; gap: 8px; }

.bal-row {
  display: grid;
  grid-template-columns: minmax(0, 13em) minmax(0, 1fr) 6.5em;
  align-items: center;
  gap: 10px;
}

.bal-name { font-size: 0.85rem; color: var(--text-muted); }
.bal-name small { display: block; font-size: 0.75rem; }

.bal-val {
  font-family: var(--font-display);
  font-size: 1.15rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.bal-bar {
  position: relative;
  display: flex;
  gap: 2px;
  height: 18px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--border) 60%, transparent);
}

.bal-seg {
  height: 100%;
  transition: width 0.6s cubic-bezier(0.3, 0.7, 0.2, 1);
}

.bal-seg:first-child { border-radius: 4px 0 0 4px; }
.bal-seg:last-of-type { border-radius: 0 4px 4px 0; }
.bal-winch { background: var(--text); border-radius: 4px !important; }

.bal-tick {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  background: var(--text);
  transition: left 0.6s cubic-bezier(0.3, 0.7, 0.2, 1);
}

.seg-1 { background: var(--series-1); }
.seg-2 { background: var(--series-2); }
.seg-3 { background: var(--series-3); }
.seg-4 { background: var(--series-4); }
.seg-margin { background: repeating-linear-gradient(45deg, var(--series-neutral) 0 3px, transparent 3px 7px); box-shadow: inset 0 0 0 1px var(--series-neutral); }

.bal-legend {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.bal-legend li { display: flex; align-items: center; }

.swatch {
  display: inline-block;
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 6px;
}

@media (max-width: 560px) {
  .bal-row { grid-template-columns: minmax(0, 1fr) auto; }
  .bal-bar { grid-column: 1 / -1; grid-row: 2; }
  .verdict-head { font-size: 1.3rem; }
}

/* ------------------------------------------------------------ parts of the stage */
.part {
  border-top: 1px solid var(--border);
  padding: 16px;
}

.part-label {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
}

/* rope picker */
.picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.pick {
  --tone: var(--incomplete);
  display: grid;
  justify-items: center;
  gap: 2px;
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 6px 10px;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}

.pick:hover { border-color: var(--text-muted); }

.pick[aria-checked="true"] {
  border-color: var(--accent);
  background: rgba(76, 201, 255, 0.1);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.pick--pass { --tone: var(--pass); }
.pick--warn { --tone: var(--warn); }
.pick--fail { --tone: var(--fail); }

.thumb-svg { width: 100%; max-width: 150px; height: auto; }

.pick-name { font-weight: 600; font-size: 0.9rem; }

.pick-sub {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

@media (max-width: 420px) {
  .pick-name { font-size: 0.8rem; }
  .pick-sub { font-size: 0.68rem; }
}

.mini-field input {
  width: calc(3.4em + 22px);
  min-height: 0;
  padding: 2px 22px 2px 6px;
  font: inherit;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--accent);
  text-align: center;
  background: var(--input-bg) var(--pencil) no-repeat right 5px center / 12px;
  border: 1px solid var(--input-border);
  border-radius: 6px;
}

/* typed figures: no spinner arrows over the pencil (arrow keys still step them) */
.sf-input input[inputmode],
.mini-field input[inputmode] { -moz-appearance: textfield; appearance: textfield; }
.sf-input input::-webkit-inner-spin-button,
.sf-input input::-webkit-outer-spin-button,
.mini-field input::-webkit-inner-spin-button,
.mini-field input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.mini-field input:focus { outline: 2px solid var(--accent); outline-offset: 0; }

/* ------------------------------------------------------------ play: a chart with a playhead, a dial, live readouts */
.play {
  display: grid;
  gap: 16px;
}

.box-title {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.gauge-box {
  margin: 0;
  padding: 12px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.mini-field {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.gauge-svg { display: block; width: 100%; max-width: 260px; margin: 0 auto; height: auto; }

.gauge-box figcaption {
  display: grid;
  justify-items: center;
  margin-top: -2px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.gauge-box figcaption strong {
  font-family: var(--font-display);
  font-size: 1.9rem;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.play-main { min-width: 0; }

.chart-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 0 0 2px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.key { display: inline-block; width: 16px; height: 0; border-top: 2.5px solid; margin: 0 4px 0 8px; }
.key:first-child { margin-left: 0; }

.chart-svg { display: block; max-width: 100%; height: auto; }
.ch-grid { stroke: var(--border); stroke-width: 1; }
.ch-tick, .ch-axis, .ch-unit { fill: var(--text-muted); font-family: var(--font-body); font-size: 11.5px; }
.ch-unit { font-weight: 600; }
.ch-label { fill: var(--text); font-family: var(--font-body); font-size: 12px; }
.ch-line { fill: none; stroke-width: 2; stroke-linejoin: round; }

.ch-playhead { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.ch-dot { stroke: var(--surface); stroke-width: 2; }

.play-empty { padding: 24px 0; }

.play-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-top: 10px;
}

.play-button {
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  color: #031022;
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  padding: 8px 18px;
  min-height: 42px;
  cursor: pointer;
}

.play-button:hover { background: var(--accent-strong); }
.play-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.readouts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 14px;
}

/* worked out, not typed: plain figures, no box (a box means you can change it) */
.readout {
  display: grid;
  align-content: start;
  gap: 1px;
  padding: 2px 12px;
  border-left: 2px solid var(--border);
}

.readout-label { font-size: 0.75rem; color: var(--text-muted); }
.readout--live .readout-value { font-variant-numeric: tabular-nums; }
.readout-value { font-family: var(--font-display); font-size: 1.6rem; line-height: 1.1; }
.readout-sub { font-size: 0.75rem; color: var(--text-muted); }

.readout-note {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ------------------------------------------------------------ charts' tooltip */
.viz-tip {
  position: absolute;
  z-index: 20;
  pointer-events: none;
  display: grid;
  gap: 1px;
  max-width: 260px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.viz-tip strong { color: var(--text); }

/* ------------------------------------------------------------ explainers, sources page */
.explainers { margin-top: 16px; }
.faq-title { font-size: 1.3rem; margin: 24px 0 12px; }
.explainer-body p, .explainer-body ul { margin: 8px 0 0; }
.explainer-body ul { padding-left: 18px; }
.explainer-body li + li { margin-top: 6px; }
.disclaimer { margin-top: 16px; }

.source-quote {
  margin: 8px 0 0;
  padding: 6px 12px;
  border-left: 3px solid var(--border);
  color: var(--text-muted);
  font-style: italic;
}

.tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 999px;
  padding: 1px 8px;
  white-space: nowrap;
  border: 1px solid currentColor;
  vertical-align: 1px;
  font-style: normal;
}

.tag--method { color: var(--accent); }
.tag--maker { color: var(--maker); }
.tag--standard { color: var(--pass); }
.tag--engineering { color: #5eead4; }
.tag--calc { color: var(--warn); border-style: dashed; }

/* ------------------------------------------------------------ motion off when asked */
@media (prefers-reduced-motion: reduce) {
  .scene-svg *,
  .bal-seg,
  .bal-tick,
  .scene-field,
  .scene-tag,
  .ga-needle {
    animation: none !important;
    transition: none !important;
  }
}

@media print {
  .construction,
  .try,
  .play-bar,
  .viz-tip {
    display: none !important;
  }
}

/* ------------------------------------------------------------ danger: information only, judge it on the scene */
.danger {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--fail) 55%, var(--border));
  border-left: 5px solid var(--fail);
  background: color-mix(in srgb, var(--fail) 9%, var(--surface));
  font-size: 0.92rem;
}

.danger p { margin: 4px 0 0; max-width: 90ch; }

.danger .danger-title {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--fail);
}

.danger-icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--fail);
  color: #031022;
  font-size: 0.85rem;
}

.danger-more { margin-top: 4px; }
.danger-more > summary { cursor: pointer; width: fit-content; color: var(--accent); font-size: 0.85rem; }
.danger-more p { font-size: 0.88rem; }

/* ------------------------------------------------------------ deep space finish
   Screen only, so the print sheet keeps its plain light layout. The same finish
   as the towing checker and the winching page: a glass stage with HUD corner brackets, defined part
   headings with a glowing rule, the verdict lit in its colour, gradient controls
   and focus glow. Nothing here moves on its own: the background is still
   (<html data-circuit="still">) and the only continuous animation is the header
   hologram (js/fx.js). The explainers fade in once as they scroll into view.
   Everything stops under prefers-reduced-motion (end of file). */
@media screen {
  /* -------- glass */
  .stage,
  .explainer {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.008)), var(--glass);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    backdrop-filter: blur(14px) saturate(140%);
    box-shadow: 0 24px 48px -24px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  }

  .try-chip,
  .chip,
  .seg,
  .verdict,
  .pick,
  .gear-item,
  .gauge-box,
  .size,
  .your-winch,
  .tree-draw {
    background-color: var(--glass-2);
  }

  .stage {
    position: relative;
  }

  .explainer {
    position: relative;
    border-radius: 18px;
  }

  /* -------- HUD corner brackets */
  .stage::after,
  .explainer::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    --c: rgba(76, 201, 255, 0.75);
    background:
      linear-gradient(var(--c), var(--c)) top left / 14px 1px,
      linear-gradient(var(--c), var(--c)) top left / 1px 14px,
      linear-gradient(var(--c), var(--c)) top right / 14px 1px,
      linear-gradient(var(--c), var(--c)) top right / 1px 14px,
      linear-gradient(var(--c), var(--c)) bottom left / 14px 1px,
      linear-gradient(var(--c), var(--c)) bottom left / 1px 14px,
      linear-gradient(var(--c), var(--c)) bottom right / 14px 1px,
      linear-gradient(var(--c), var(--c)) bottom right / 1px 14px;
    background-repeat: no-repeat;
    filter: drop-shadow(0 0 4px rgba(76, 201, 255, 0.8));
    opacity: 0.7;
    transition: opacity 0.3s;
  }

  .explainer:hover::after {
    opacity: 1;
  }

  /* -------- the stage's parts: defined headings with a glowing rule */
  .part {
    border-top-color: rgba(76, 201, 255, 0.14);
  }

  .part-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #fff;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(76, 201, 255, 0.35);
    text-shadow: 0 0 18px rgba(76, 201, 255, 0.55);
  }

  .part-label::before {
    content: "";
    flex: none;
    width: 4px;
    height: 1.1em;
    border-radius: 2px;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
  }

  .ctl-label,
  .box-title,
  .try-label {
    color: color-mix(in srgb, var(--accent) 55%, var(--text-muted));
    letter-spacing: 0.12em;
  }

  .explainer summary {
    font-size: 1.05rem;
    font-weight: 600;
    transition: color 0.2s, text-shadow 0.2s;
  }

  .explainer summary:hover {
    text-shadow: 0 0 12px var(--accent-glow);
  }

  .explainer[open] > :not(summary) {
    animation: open-down 0.35s ease;
  }

  @keyframes open-down {
    from { opacity: 0; transform: translateY(-4px); }
  }

  .nav a {
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    transition: color 0.2s, text-shadow 0.2s;
  }

  .nav a[aria-current="page"],
  .nav a:hover {
    text-shadow: 0 0 12px var(--accent-glow);
  }

  /* -------- the scene: a lit frame */
  .scene {
    box-shadow: inset 0 -1px 0 rgba(76, 201, 255, 0.25);
  }

  .scene-field {
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    box-shadow: 0 0 22px -10px var(--accent);
  }

  /* -------- verdict: lit in its colour */
  .verdict {
    box-shadow: inset 6px 0 22px -12px var(--tone), 0 0 34px -18px var(--tone);
  }

  .verdict-head {
    font-size: 1.3rem;
    font-weight: 600;
    text-shadow: 0 0 22px color-mix(in srgb, var(--tone) 45%, transparent);
  }

  .status-icon {
    box-shadow: 0 0 12px -1px var(--tone);
  }

  .your-winch {
    box-shadow: inset 4px 0 18px -10px var(--tone), 0 0 26px -16px var(--tone);
  }

  /* -------- controls */
  .try-chip,
  .chip,
  .pick {
    transition: border-color 0.2s, box-shadow 0.25s, background-color 0.2s;
  }

  .try-chip:hover,
  .chip:hover,
  .pick:hover {
    border-color: var(--accent);
    box-shadow: 0 0 18px -6px var(--accent);
  }

  .chip[aria-checked="true"] {
    background: rgba(76, 201, 255, 0.14);
    box-shadow: inset 0 0 0 1px var(--accent), 0 0 20px -6px var(--accent);
  }

  .seg button[aria-checked="true"],
  .play-button {
    color: #031022;
    background: linear-gradient(100deg, var(--accent-strong), var(--accent));
    box-shadow: 0 0 20px -4px rgba(76, 201, 255, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  }

  .play-button {
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.2s;
  }

  .play-button:hover {
    background: linear-gradient(100deg, var(--accent-strong), var(--accent));
    box-shadow: 0 0 0 1px rgba(76, 201, 255, 0.5), 0 10px 36px -6px rgba(76, 201, 255, 0.75);
  }

  /* a sheen sweeps across on hover */
  .play-button::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -60%;
    width: 40%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.45), transparent);
    transform: skewX(-20deg);
    transition: left 0.6s ease;
    pointer-events: none;
  }

  .play-button:hover::before {
    left: 120%;
  }

  /* -------- entries glow when they have focus */
  input[inputmode],
  input[type="text"],
  select {
    transition: border-color 0.2s, box-shadow 0.25s;
  }

  input[inputmode]:focus,
  input[type="text"]:focus,
  select:focus {
    box-shadow: 0 0 0 3px rgba(76, 201, 255, 0.18), 0 0 22px -4px var(--accent);
  }

  /* -------- fade-ins (explainers) */
  .fx-reveal .explainer {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  .fx-reveal .explainer.is-visible {
    opacity: 1;
    transform: none;
  }

  /* -------- footer */
  .site-footer {
    position: relative;
    border-top: 0;
  }

  .site-footer::before {
    content: "";
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(76, 201, 255, 0.4), rgba(124, 92, 255, 0.35), transparent);
  }
}

@media (prefers-reduced-motion: reduce) {
  .brand-text > *,
  .explainer[open] > :not(summary) {
    animation: none !important;
  }

  .play-button::before {
    display: none;
  }
}

/* ============================================================ 4x4 Systems Explained
   Built for a PC screen (owner, 2026-10-30): the live drivetrain in the middle,
   the vehicle and the ground on the left, the dash switches on the right. Below
   1100 px the three columns stack. */
.sys-page { --max-width: 1400px; }
.sys-page .brand-inner { padding-top: 10px; padding-bottom: 18px; }
.sys-page .brand-logo { width: 110px; }
.sys-page .brand-bar--compact .brand-inner { padding-top: 6px; padding-bottom: 14px; }
.sys-page .brand-text { flex: 1 1 600px; }
.sys-page .subtitle { max-width: 95ch; }
.sys-page .bench { margin-top: 16px; }

.bench {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr) 290px;
  gap: 16px;
  align-items: start;
  margin-top: 12px;
}

.side { display: grid; gap: 14px; }

.panel {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.008)), var(--glass);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
}

.panel-title {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.panel .ctl-label { margin-top: 14px; }
.panel .hint { margin: 8px 0 0; font-size: 0.82rem; }

/* the vehicle and the ground: a list of big pick buttons */
.pick-list { display: grid; gap: 6px; }

.pick {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  column-gap: 10px;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}

.pick--terrain { grid-template-columns: auto 1fr; padding: 6px 10px; }
.pick:hover { border-color: var(--text-muted); }

.pick[aria-checked="true"] {
  border-color: var(--accent);
  background: rgba(76, 201, 255, 0.12);
  box-shadow: inset 0 0 0 1px var(--accent), 0 0 16px rgba(76, 201, 255, 0.2);
}

.pick-name { font-weight: 600; font-size: 0.9rem; }
.pick-sub { font-size: 0.75rem; color: var(--text-muted); }

.terrain-swatch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.terrain-swatch i { display: block; }

/* ------------------------------------------------------------ the centre: status and picture */
.centre {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.008)), var(--glass);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  overflow: hidden;
}

.status {
  --tone: var(--info);
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 16px;
  min-height: 96px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--tone) 10%, transparent);
  box-shadow: inset 4px 0 0 var(--tone);
  transition: background-color 0.3s;
}

.status--move { --tone: var(--pass); }
.status--spin { --tone: var(--fail); }
.status--bog { --tone: var(--warn); }

.status-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--tone);
  color: #031022;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: 0 0 18px color-mix(in srgb, var(--tone) 70%, transparent);
}

.status-head {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--tone);
}

.status-sub { margin: 2px 0 0; color: var(--text); font-size: 0.92rem; max-width: 80ch; }

.status-fix {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.status-fix:empty { display: none; }
.fix-label { font-size: 0.82rem; color: var(--text-muted); margin-right: 2px; }

.fix {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: #031022;
  background: linear-gradient(135deg, #7fdcff, var(--accent));
  border: 0;
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(76, 201, 255, 0.35);
}

.fix:hover { filter: brightness(1.1); }

.view-box {
  display: flex;
  justify-content: center;
  background: #040817;
}

#view { display: block; touch-action: manipulation; }

.legend {
  list-style: none;
  margin: 0;
  padding: 10px 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.legend li { display: inline-flex; align-items: center; gap: 6px; }
.key { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.key--grip { background: #3ef08a; box-shadow: 0 0 8px #3ef08a; }
.key--spin { background: #ff5d73; box-shadow: 0 0 8px #ff5d73; }
.key--brake { background: #ffb347; box-shadow: 0 0 8px #ffb347; }
.key--idle { background: #7487ad; }
.key--lock { background: transparent; border: 3px solid #ffc857; border-radius: 50%; box-shadow: 0 0 8px #ffc857; }
.key--flow { width: 22px; height: 6px; background: #4cc9ff; box-shadow: 0 0 8px #4cc9ff; }

/* ------------------------------------------------------------ the dash switches */
.lever {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 6px;
  border-radius: 12px;
  background: #050a1c;
  border: 1px solid var(--border);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6);
}

.lever button {
  display: grid;
  justify-items: center;
  gap: 4px;
  font: inherit;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-muted);
  background: linear-gradient(180deg, #1a2547, #0e1633);
  border: 1px solid rgba(120, 170, 255, 0.2);
  border-radius: 8px;
  padding: 8px 4px 10px;
  cursor: pointer;
  transition: color 0.15s, box-shadow 0.15s, transform 0.08s;
}

.lever button:active:not([disabled]) { transform: translateY(1px); }

.lever button[aria-checked="true"] {
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 0 14px rgba(76, 201, 255, 0.45), inset 0 0 12px rgba(76, 201, 255, 0.25);
}


.lever button[disabled] { opacity: 0.3; cursor: not-allowed; }

.switches {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.lever-led, .switch-led {
  width: 18px;
  height: 4px;
  border-radius: 2px;
  background: #26314f;
}

.lever button[aria-checked="true"] .lever-led { background: var(--accent); box-shadow: 0 0 8px var(--accent); }

.switch {
  display: grid;
  justify-items: center;
  gap: 4px;
  font: inherit;
  color: var(--text-muted);
  background: linear-gradient(180deg, #1a2547, #0c1430);
  border: 1px solid rgba(120, 170, 255, 0.2);
  border-radius: 12px;
  padding: 8px 6px 10px;
  cursor: pointer;
  box-shadow: 0 3px 0 #050a1c, 0 4px 10px rgba(0, 0, 0, 0.4);
  transition: color 0.15s, box-shadow 0.15s, transform 0.08s, border-color 0.15s;
}

.switch:hover:not([disabled]) { border-color: var(--text-muted); }
.switch:active:not([disabled]) { transform: translateY(2px); box-shadow: 0 1px 0 #050a1c, 0 2px 6px rgba(0, 0, 0, 0.4); }
.switch[disabled] { opacity: 0.35; cursor: not-allowed; }

.switch-icon svg {
  width: 40px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.switch-name { font-size: 0.78rem; font-weight: 600; color: var(--text); line-height: 1.2; text-align: center; }
.switch-state { font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; text-align: center; }

.switch[aria-pressed="true"] {
  color: var(--warn);
  border-color: var(--warn);
  box-shadow: 0 1px 0 #050a1c, 0 0 16px rgba(255, 200, 87, 0.35), inset 0 0 14px rgba(255, 200, 87, 0.15);
  transform: translateY(2px);
}

.switch[aria-pressed="true"] .switch-led { background: var(--warn); box-shadow: 0 0 10px var(--warn); }
.switch[data-id="trc"][aria-pressed="true"] { color: #ffb347; }

/* a switch that would get it moving: a slow pulse */
.switch.suggest, .lever button.suggest { animation: suggest 1.4s ease-in-out infinite; }

@keyframes suggest {
  0%, 100% { box-shadow: 0 0 0 0 rgba(76, 201, 255, 0); border-color: rgba(120, 170, 255, 0.2); }
  50% { box-shadow: 0 0 0 3px rgba(76, 201, 255, 0.55), 0 0 18px rgba(76, 201, 255, 0.5); border-color: var(--accent); }
}

.switch:focus-visible, .lever button:focus-visible, .pick:focus-visible, .fix:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* under each wheel: laid out like the wheels */
.wheel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.wheel-pick { display: grid; gap: 3px; font-size: 0.75rem; color: var(--text-muted); }

.wheel-pick select {
  font: inherit;
  font-size: 0.85rem;
  color: var(--accent);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  padding: 6px 8px;
}

.cautions:empty { display: none; }

.caution {
  margin: 0 0 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--warn) 50%, var(--border));
  border-left: 4px solid var(--warn);
  background: color-mix(in srgb, var(--warn) 9%, var(--surface));
  font-size: 0.85rem;
}

.note-illustrative {
  margin: 14px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.note-illustrative a { color: var(--accent); }

/* ------------------------------------------------------------ how each one works */
.setups { margin-top: 28px; }

.setups-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin: 0 0 12px;
}

.setup-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.setup {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: var(--glass);
  font-size: 0.88rem;
}

.setup h3 {
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 1rem;
}

.setup p { margin: 0; color: var(--text-muted); }
.setup strong { color: var(--text); }
.setup-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.setup-dot--flow { background: #4cc9ff; box-shadow: 0 0 8px #4cc9ff; }
.setup-dot--lock { background: #ffc857; box-shadow: 0 0 8px #ffc857; }
.setup-dot--lsd { background: #b49bff; box-shadow: 0 0 8px #b49bff; }
.setup-dot--brake { background: #ffb347; box-shadow: 0 0 8px #ffb347; }
.setup-dot--idle { background: #7487ad; }

/* ------------------------------------------------------------ smaller screens: stack (PC first) */
@media (max-width: 1100px) {
  .bench { grid-template-columns: 1fr 1fr; }
  .centre { grid-column: 1 / -1; order: -1; }
  .setup-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .bench { grid-template-columns: 1fr; }
  .setup-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .switch.suggest, .lever button.suggest { animation: none; box-shadow: 0 0 0 3px rgba(76, 201, 255, 0.55); }
}

/* ------------------------------------------------------------ the 3D view (owner, 2026-10-30) */
.view-box {
  position: relative;
  display: block;
  background:
    radial-gradient(ellipse 70% 60% at 50% 45%, rgba(47, 107, 255, 0.16), transparent 70%),
    #040817;
  overflow: hidden;
}

#view { display: block; width: 100%; }

.views {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  z-index: 2;
}

.views button {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(11, 19, 48, 0.78);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 11px;
  cursor: pointer;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.views button:hover { color: var(--text); border-color: var(--text-muted); }

.views button[aria-pressed="true"] {
  color: #031022;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(76, 201, 255, 0.45);
}

.views button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.view-hint {
  position: absolute;
  right: 12px;
  bottom: 8px;
  margin: 0;
  font-size: 0.75rem;
  color: rgba(168, 183, 214, 0.75);
  pointer-events: none;
  z-index: 2;
}

/* labels pinned to parts of the 3D drawing (placed by diagram3d.js) */
.tags3d {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.tag3d {
  position: absolute;
  left: 0;
  top: 0;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(4, 8, 23, 0.72);
  border: 1px solid rgba(76, 201, 255, 0.3);
  color: var(--text);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  white-space: nowrap;
  will-change: transform;
}

.tag3d--small { font-size: 0.62rem; color: var(--text-muted); border-color: rgba(120, 170, 255, 0.18); }
.tag3d.is-lock { color: var(--warn); border-color: rgba(255, 200, 87, 0.6); box-shadow: 0 0 10px rgba(255, 200, 87, 0.3); }

.tag3d--wheel { display: grid; gap: 1px; text-align: center; padding: 3px 8px; }
.tag3d-surface { font-size: 0.62rem; color: var(--text-muted); letter-spacing: 0.08em; text-transform: uppercase; }
.tag3d-state { font-size: 0.72rem; }
.tag3d-state--grip { color: var(--pass); }
.tag3d-state--spin { color: var(--fail); }
.tag3d-state--brake { color: #ffb347; }
.tag3d-state--idle, .tag3d-state--air { color: #8796b8; }

.key--passive { background: #6b7ea8; }
.key--idle { background: #323a52; border: 1px solid #4a5574; }
.key--heat { background: #ff8a3c; box-shadow: 0 0 8px #ff8a3c; }
.setup-dot--heat { background: #ff8a3c; box-shadow: 0 0 8px #ff8a3c; }

.lever button { font-size: 1.05rem; }

.lever button[data-low][aria-checked="true"] {
  border-color: var(--warn);
  box-shadow: 0 0 14px rgba(255, 200, 87, 0.45), inset 0 0 12px rgba(255, 200, 87, 0.2);
}

.lever button[data-low][aria-checked="true"] .lever-led { background: var(--warn); box-shadow: 0 0 8px var(--warn); }

.setup-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

@media (max-width: 1100px) {
  .setup-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .setup-grid { grid-template-columns: 1fr; }
  .view-hint { display: none; }
}

.tags3d.is-far .tag3d--small { display: none !important; }
.tag3d--tc { display: grid; gap: 1px; text-align: center; }
.tag3d-sub { font-size: 0.6rem; color: var(--text-muted); letter-spacing: 0.06em; }
.tag3d.is-lock .tag3d-sub { color: var(--warn); }

/* ------------------------------------------------------------ under each wheel: three buttons per wheel, laid out like the wheels */
.wheel-hint { margin: -4px 0 10px; }
.wheel-grid { grid-template-columns: 1fr 1fr; gap: 10px 8px; }
.wheel-pick { display: grid; gap: 4px; align-content: start; }
.wheel-pick-name { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }

.ground {
  display: flex;
  align-items: center;
  gap: 7px;
  font: inherit;
  font-size: 0.78rem;
  text-align: left;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 7px;
  min-height: 30px;
  cursor: pointer;
}

.ground:hover { border-color: var(--text-muted); color: var(--text); }

.ground[aria-checked="true"] {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(76, 201, 255, 0.12);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.ground:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ground-swatch { flex: none; width: 18px; height: 18px; border-radius: 4px; }
.ground--tar .ground-swatch { background: linear-gradient(90deg, transparent 44%, #e8e4d6 44% 56%, transparent 56%) center / 100% 60% no-repeat, #2a2f3b; }
.ground--mud .ground-swatch { background: radial-gradient(circle at 30% 35%, #a08a70 0 2px, transparent 3px), radial-gradient(circle at 70% 65%, #8a7660 0 2.5px, transparent 3.5px), radial-gradient(circle at 65% 25%, #7a6550 0 1.5px, transparent 2.5px), #5a3f26; }
.ground--air .ground-swatch { background: #03050c; border: 1px dashed rgba(76, 201, 255, 0.7); }
.ground--ice .ground-swatch { background: linear-gradient(135deg, transparent 45%, rgba(255,255,255,0.9) 46% 52%, transparent 53%), linear-gradient(160deg, #d6ecf8, #9fc6e0); }

/* the slope: three choices, the degrees under each name */
.seg--slope { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
.seg--slope button { display: grid; justify-items: center; gap: 1px; white-space: normal; line-height: 1.2; padding: 5px 4px; min-width: 0; }
.seg--slope small { opacity: 0.75; font-size: 0.72rem; }
.bench > .side { min-width: 0; }
