/* winrate — one design language for the site, the workbench and the firm pages.
 *
 * Swiss Modernism: a strict grid, mathematical spacing, high contrast, and exactly one accent
 * colour. The tone is an evidence-led business site rather than a dashboard, because the thing this
 * product has to overcome is not confusion — it is disbelief.
 *
 * Four rules hold it together.
 *
 *   Space does the separating, not boxes. A panel around every group reads as software.
 *
 *   One accent, spent only on what the reader should act on or believe.
 *
 *   Numbers are set in the display serif, large. They are the substance of the argument, so they
 *   read as content rather than as instrumentation.
 *
 *   One dark band, once. A single full-bleed inversion gives the page a spine.
 *
 * The page leads with the tool. An earlier version opened with two screens of argument and put the
 * working product at the bottom, which is the wrong way round for something whose best case is made
 * by using it: a contractor who sees their own trade ranked in front of them has already been
 * persuaded of more than any headline could tell them.
 *
 * Light only, deliberately. This is a brand surface whose job is to look the same to everybody who
 * is sent a link, and a second theme doubles the contrast surface for no reader benefit.
 */

:root {
  /* Contrast pairs are measured, not assumed: --slate on --paper is 7.4:1, --muted 7.0:1,
     --faint 5.4:1, --accent 5.6:1. Every one of those carries small text somewhere. */
  --ink: #020617;
  --navy: #0F172A;
  --slate: #334155;
  --muted: #475569;
  --faint: #5F6C7D;
  --accent: #0369A1;
  --accent-ink: #024E79;
  --accent-wash: #EFF6FB;
  --warn: #9A4B10;
  --warn-wash: #FDF5EC;
  --paper: #FFFFFF;
  --shell: #F8FAFC;
  --line: #E2E8F0;
  --hair: #EDF1F6;

  --display: Newsreader, Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --s1: 4px;  --s2: 8px;   --s3: 12px;  --s4: 16px;  --s5: 24px;
  --s6: 32px; --s7: 48px;  --s8: 64px;  --s9: 96px;

  --head-h: 62px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ---- type ------------------------------------------------------------- */

h1, h2, h3, .display {
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.1;
  margin: 0;
  text-wrap: balance;
}

h1 { font-size: clamp(30px, 4.6vw, 48px); }
h2 { font-size: clamp(24px, 3.2vw, 34px); }
h3 { font-size: 17px; letter-spacing: -0.01em; }

p { margin: 0 0 var(--s4); }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-ink); }

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 var(--s3);
}

.lede { font-size: clamp(16.5px, 1.6vw, 19px); line-height: 1.5; color: var(--muted); }
.note { font-size: 13px; line-height: 1.5; color: var(--muted); }
strong, b { font-weight: 600; }

/* ---- frame ------------------------------------------------------------ */

.wrap { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 var(--s5); }
.narrow { width: 100%; max-width: 680px; margin: 0 auto; padding: 0 var(--s5); }

section { padding: var(--s9) 0; }
section.tight { padding: var(--s7) 0; }
.rule { border: 0; border-top: 1px solid var(--line); margin: 0; }

.band { background: var(--navy); color: #F1F5F9; }
.band h2, .band h3 { color: #FFFFFF; }
.band .eyebrow { color: #7D93B0; }
.band .lede, .band .note { color: #B6C4D6; }
.band a { color: #7CC0E8; }

/* ---- header ----------------------------------------------------------- */

.site-head {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, .93);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-head .wrap { display: flex; align-items: center; gap: var(--s5); height: var(--head-h); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--display);
  font-size: 21px;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
}
.brand img { width: 19px; height: 19px; display: block; }
.brand:hover { color: var(--ink); }

.site-nav { display: flex; align-items: center; gap: var(--s5); }
.site-nav a:not(.btn) { font-size: 14px; color: var(--muted); text-decoration: none; padding: var(--s2) 0; }
.site-nav a:not(.btn):hover { color: var(--ink); }
@media (min-width: 721px) { .site-nav .btn { min-height: 38px; padding: 0 var(--s4); font-size: 14px; } }
@media (max-width: 720px) { .site-nav a.hide-sm { display: none; } }

/* ---- lede strip: the whole argument in three lines, above the tool ----- */

.strip { padding: var(--s7) 0 var(--s6); border-bottom: 1px solid var(--line); }
.strip h1 { max-width: 17em; }
.strip .lede { max-width: 38em; margin-top: var(--s4); }

.proof-row { display: flex; flex-wrap: wrap; gap: var(--s6); margin-top: var(--s5); align-items: baseline; }
.proof-row .fig { display: flex; align-items: baseline; gap: var(--s2); }
.proof-row .fig b {
  font-family: var(--display);
  font-size: 30px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.proof-row .fig:first-child b { color: var(--accent); }
.proof-row .fig span { font-size: 13px; color: var(--muted); }
.proof-row .more { font-size: 13.5px; }

/* ---- controls and buttons --------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 44px;
  padding: 0 var(--s5);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}
.btn:hover { border-color: var(--slate); color: var(--ink); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #FFFFFF; }
.btn-sm { min-height: 36px; padding: 0 var(--s3); font-size: 13.5px; }

.field {
  width: 100%;
  min-height: 44px;
  padding: 10px var(--s3);
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.field::placeholder { color: var(--faint); }
.field:focus-visible { border-color: var(--accent); outline-offset: 0; }
textarea.field { resize: vertical; line-height: 1.55; padding-top: var(--s3); }

label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }

.chip {
  display: inline-block;
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.chip.urgent { color: var(--warn); border-color: #E4C9AC; background: var(--warn-wash); }

/* ---- the workbench: the point of the page ------------------------------ */

.workbench { padding: var(--s6) 0 var(--s8); }
.bench { display: grid; gap: var(--s6); align-items: start; }

@media (min-width: 1000px) {
  .bench { grid-template-columns: 330px minmax(0, 1fr); gap: var(--s7); }

  /* Sticky as one piece, and sized to fit rather than to scroll. The previous version made a
     taller-than-viewport rail sticky, which pins nothing until its bottom edge arrives, then gave
     it an inner scroller with a 12px right padding — so page content showed through the gutter
     beside a pinned panel and read as two containers overlapping. Nothing inside this panel is
     sticky, and the panel has no padding on the scrolling edge, so neither fault can recur. */
  .controls {
    position: sticky;
    top: calc(var(--head-h) + var(--s4));
    max-height: calc(100vh - var(--head-h) - var(--s6));
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }
}

.panel { border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.panel > * { padding: var(--s4); }
.panel > * + * { border-top: 1px solid var(--hair); }
.panel h3 { font-family: var(--sans); font-weight: 600; font-size: 14px; margin-bottom: var(--s3); }

/* ---- firm picker ------------------------------------------------------- */

.firms {
  max-height: 194px;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: var(--s3) calc(var(--s2) * -1) 0;
}
.firm {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px var(--s2);
  border: 0;
  border-radius: 5px;
  background: none;
  font: inherit;
  cursor: pointer;
}
.firm:hover { background: var(--shell); }
.firm[aria-pressed="true"] { background: var(--accent-wash); }
.firm b { display: block; font-size: 13.5px; font-weight: 600; line-height: 1.35; }
.firm small { display: block; font-size: 11.5px; color: var(--faint); margin-top: 1px; }

.dot {
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 6px;
  vertical-align: middle;
}
.dot.cold { background: #CBD5E1; }

/* ---- priorities: presets first, sliders for those who want them -------- */

.presets { display: flex; flex-wrap: wrap; gap: var(--s2); }
.preset {
  min-height: 34px;
  padding: 0 var(--s3);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--slate);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}
.preset:hover { border-color: var(--slate); }
.preset[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}

.tune > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  margin-top: var(--s3);
  list-style: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--accent);
}
.tune > summary::-webkit-details-marker { display: none; }
.tune > summary .caret { font-size: 10px; transition: transform .18s ease; }
.tune[open] > summary .caret { transform: rotate(180deg); }

.weight { display: block; margin-top: var(--s3); }
.weight .row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--slate); }
.weight .row i { font-style: normal; color: var(--faint); font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; accent-color: var(--accent); height: 30px; margin: 0; display: block; }
@media (pointer: coarse) { input[type=range] { height: 44px; } }

/* ---- the leaderboard --------------------------------------------------- */

.board-head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: var(--s4);
  border-bottom: 2px solid var(--ink);
}
.board-head h2 { font-size: clamp(21px, 2.4vw, 27px); }
.board-head .count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

.result { padding: var(--s4) 0; border-bottom: 1px solid var(--hair); }

.result-head { display: flex; gap: var(--s3); align-items: baseline; }
.result-head .rank {
  font-family: var(--display);
  font-size: 20px;
  line-height: 1;
  color: var(--faint);
  min-width: 26px;
  font-variant-numeric: tabular-nums;
}
.result:nth-child(-n+4) .result-head .rank { color: var(--accent); }
.result-head .title { flex: 1; font-size: 16px; font-weight: 600; line-height: 1.4; min-width: 0; }
.result-head .value {
  font-size: 14.5px; font-weight: 600; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.result-head .value.absent { color: var(--faint); font-weight: 400; }

.result .body { margin-left: 38px; }
.result .meta {
  font-size: 12.5px; color: var(--muted); margin: var(--s1) 0 0;
  display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center;
}
.result .why { font-size: 14.5px; color: var(--slate); margin: var(--s3) 0 0; }
.result .but { font-size: 13.5px; color: var(--warn); margin: var(--s2) 0 0; }
.result .inc {
  font-size: 13px; color: var(--muted); margin: var(--s3) 0 0;
  padding-left: var(--s3); border-left: 2px solid var(--line);
}
.result .actions { display: flex; flex-wrap: wrap; gap: var(--s4); align-items: center; margin-top: var(--s3); }
.result .go { font-size: 13.5px; font-weight: 500; text-decoration: none; border-bottom: 1px solid var(--line); }
.result .go:hover { border-color: var(--accent); }

/* Recomputed in the browser whenever a weight moves, so the number answers the control as directly
   as the ordering does: a list that reorders says something changed, a number that moves says by
   how much. */
.fit {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-wash);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.fit.weak { background: var(--shell); color: var(--muted); }
.fit i { font-style: normal; font-weight: 500; opacity: .75; }

/* ---- judgment breakdown ------------------------------------------------ */

.breakdown > summary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  list-style: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--accent);
}
.breakdown > summary::-webkit-details-marker { display: none; }
.breakdown > summary .caret { font-size: 10px; transition: transform .18s ease; }
.breakdown[open] > summary .caret { transform: rotate(180deg); }
@media (pointer: coarse) { .breakdown > summary { min-height: 44px; } }

.judgments {
  display: grid;
  gap: var(--s3) var(--s5);
  margin-top: var(--s2);
  padding: var(--s4);
  background: var(--shell);
  border-radius: 8px;
}
@media (min-width: 620px) { .judgments { grid-template-columns: 1fr 1fr; } }

.judgment { font-size: 12.5px; color: var(--muted); }
.judgment .row { display: flex; justify-content: space-between; gap: var(--s3); }
.judgment .row b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.judgment .track { height: 4px; background: #DCE3EC; border-radius: 2px; margin-top: 5px; overflow: hidden; }
.judgment .fill { height: 100%; background: var(--accent); border-radius: 2px; }
.judgment .said { margin-top: 5px; font-size: 12px; line-height: 1.45; color: var(--muted); }

/* ---- firm profile ------------------------------------------------------ */

.profile { padding-bottom: var(--s5); margin-bottom: var(--s5); border-bottom: 1px solid var(--line); }
.profile h2 { font-size: clamp(22px, 2.6vw, 30px); }
.profile .role { font-size: 13.5px; color: var(--muted); margin-top: var(--s2); }

.tally { display: flex; flex-wrap: wrap; gap: var(--s6); margin-top: var(--s4); }
.tally .stat b {
  display: block;
  font-family: var(--display);
  font-size: 28px;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.tally .stat:first-child b { color: var(--accent); }
.tally .stat span { font-size: 12.5px; color: var(--muted); }

.track-record { margin-top: var(--s4); }
.track-record ul { margin: 0; padding: 0; list-style: none; }
.track-record li { font-size: 13px; color: var(--slate); padding: 4px 0 4px var(--s4); position: relative; }
.track-record li::before {
  content: "";
  position: absolute;
  left: 0; top: 12px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--line);
}

/* ---- receipt ----------------------------------------------------------- */

.receipt { background: var(--shell); border: 1px solid var(--line); border-radius: 10px; padding: var(--s5); }
.receipt h2 { font-size: clamp(20px, 2.2vw, 26px); }

.episodes > summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  list-style: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--accent-ink);
}
.episodes > summary::-webkit-details-marker { display: none; }
.episodes > summary .caret { font-size: 10px; transition: transform .18s ease; }
.episodes[open] > summary .caret { transform: rotate(180deg); }
@media (min-width: 1000px) { .episodes[open] > summary { display: none; } }

.episode {
  display: flex; gap: var(--s5); align-items: baseline;
  padding: var(--s3) 0; border-top: 1px solid var(--line);
}
.episode .place {
  display: flex; align-items: baseline; gap: 6px;
  min-width: 92px; flex: none;
  font-family: var(--display); font-size: 32px; line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.episode .place span { font-size: 11.5px; color: var(--muted); font-family: var(--sans); }
.episode .place.missed { color: var(--warn); }
.episode b { font-size: 14.5px; font-weight: 600; }
.episode small { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.scoreline { margin: var(--s4) 0 0; padding-top: var(--s3); border-top: 1px solid var(--line); font-size: 15px; font-weight: 600; }

/* ---- comparison figures (dark band) ------------------------------------ */

.compare { display: grid; gap: var(--s5); margin-top: var(--s6); }
@media (min-width: 720px) { .compare { grid-template-columns: repeat(3, 1fr); gap: var(--s6); } }

.compare .item { padding-top: var(--s4); border-top: 2px solid rgba(255, 255, 255, .16); }
.compare .item.lead { border-top-color: #38A3DC; }
.compare .figure {
  font-family: var(--display);
  font-size: clamp(42px, 6vw, 62px);
  line-height: .95;
  font-variant-numeric: tabular-nums;
  color: #FFFFFF;
}
.compare .item.lead .figure { color: #7CC0E8; }
.compare .name { font-size: 15px; font-weight: 600; margin-top: var(--s2); color: #E2E8F0; }
.compare .gloss { font-size: 13.5px; line-height: 1.5; color: #A9BACE; margin-top: var(--s1); }

/* ---- steps ------------------------------------------------------------- */

.steps { display: grid; gap: var(--s6); margin-top: var(--s6); counter-reset: step; }
@media (min-width: 760px) { .steps { grid-template-columns: repeat(3, 1fr); } }

.step { counter-increment: step; }
.step::before {
  content: counter(step);
  display: block;
  font-family: var(--display);
  font-size: 28px;
  line-height: 1;
  color: var(--accent);
  margin-bottom: var(--s2);
}
.step h3 { margin-bottom: var(--s2); }
.step p { font-size: 14.5px; color: var(--muted); margin: 0; }

/* ---- prose ------------------------------------------------------------- */

.prose { max-width: 42em; }
.prose h2 { margin: var(--s8) 0 var(--s4); }
.prose h3 { margin: var(--s6) 0 var(--s2); font-family: var(--sans); font-weight: 600; font-size: 16px; }
.prose p, .prose li { color: var(--slate); }
.prose ul { padding-left: var(--s5); margin: 0 0 var(--s4); }
.prose li { margin-bottom: var(--s2); }
.prose dl { margin: 0; }
.prose dt { font-weight: 600; margin-top: var(--s4); }
.prose dd { margin: var(--s1) 0 0; color: var(--slate); }

/* ---- states ------------------------------------------------------------ */

.empty {
  padding: var(--s8) var(--s5);
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  background: var(--shell);
  border-radius: 10px;
}
.empty .spinner {
  display: inline-block; width: 14px; height: 14px; margin-right: var(--s2);
  vertical-align: -2px;
  border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- footer ------------------------------------------------------------ */

footer { padding: var(--s8) 0; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }
footer .cols { display: flex; flex-wrap: wrap; gap: var(--s5) var(--s7); align-items: baseline; }
footer .brand { font-size: 17px; margin-right: 0; }
footer nav { display: flex; flex-wrap: wrap; gap: var(--s5); margin-left: auto; }
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--ink); text-decoration: underline; }
footer .fine { margin-top: var(--s5); font-size: 12.5px; color: var(--faint); max-width: 54em; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: var(--s4); top: -60px;
  z-index: 40; padding: var(--s3) var(--s4);
  background: var(--paper); border: 1px solid var(--accent); border-radius: 6px;
  text-decoration: none; font-size: 14px;
  transition: top .15s ease;
}
.skip:focus { top: var(--s3); }

/* ---- phones and small tablets ------------------------------------------ */

@media (max-width: 999px) {
  section { padding: var(--s7) 0; }
  section.tight { padding: var(--s6) 0; }
  .strip { padding: var(--s6) 0 var(--s5); }
  .proof-row { gap: var(--s5); }
  footer { padding: var(--s7) 0; }
  footer nav { margin-left: 0; width: 100%; }

  /* Controls pinned to the TOP, with the board directly beneath.
   *
   * They were a bottom sheet, and that put the middle of the list above the controls — so a slider
   * moved and the ranks most affected, one through three, were off-screen above. Pinned to the top
   * the first few rows sit immediately under the thumb doing the dragging, which is the only
   * arrangement where the effect of a control is visible while it is being used. */
  .controls {
    position: sticky;
    top: var(--head-h);
    z-index: 20;
    margin: 0 calc(var(--s5) * -1);
    padding: 0 var(--s5);
    background: rgba(255, 255, 255, .97);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 8px 20px rgba(2, 6, 23, .06);
  }
  .controls .panel { border: 0; border-radius: 0; }
  .controls .panel > * { padding: var(--s3) 0; }
  .controls .panel > * + * { border-top: 1px solid var(--hair); }

  /* Capped so the board is never pushed off the screen by its own controls. */
  .controls-scroll { max-height: 46vh; overflow-y: auto; overscroll-behavior: contain; }

  .firms { max-height: 150px; }
  .result .body { margin-left: 0; }
  .episode { gap: var(--s4); }
  .episode .place { min-width: 66px; font-size: 26px; }
  .receipt { padding: var(--s4); }
}

/* ---- rank movement ----------------------------------------------------- */

/* Shown beside the rank when a weighting change moves a contract.
 *
 * The board genuinely re-ranks — twenty of twenty-five positions change between two presets — but
 * from the reader's side a list that quietly rearranges while they are looking at the controls is
 * indistinguishable from a list that did nothing. The arrow is the difference between "something
 * happened" and "this contract climbed eleven places because you said you care about distance". */
.delta {
  display: block;
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
.delta.up { color: #15803D; }
.delta.down { color: var(--faint); }
.delta.new { color: var(--accent); }

@media (prefers-reduced-motion: no-preference) {
  .result { animation: settle .32s ease both; }
  @keyframes settle { from { opacity: .35; } to { opacity: 1; } }
}

/* ---- the firm picker as a disclosure ----------------------------------- */

#pickSummary {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-height: 34px;
  margin-bottom: var(--s3);
  list-style: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
#pickSummary::-webkit-details-marker { display: none; }
#pickSummary .caret { margin-left: auto; color: var(--faint); font-size: 11px; transition: transform .18s ease; }
#pickBox[open] > #pickSummary .caret { transform: rotate(180deg); }

/* Folded shut it names the firm it is holding, so the panel still says whose board this is. */
#pickBox:not([open]) > #pickSummary #pickLabel { color: var(--accent-ink); }
#pickBox:not([open]) > #pickSummary::after {
  content: "change";
  font-weight: 500;
  font-size: 12.5px;
  color: var(--accent);
}
#pickBox:not([open]) > #pickSummary .caret { margin-left: var(--s2); }

/* On a wide screen there is room for it, and hiding a control behind a click costs more than it
   saves — so it stays open and loses the affordance to close. */
@media (min-width: 1000px) {
  #pickSummary { cursor: default; }
  #pickSummary .caret { display: none; }
}

@media (max-width: 999px) {
  /* Compact profile: the board is what was asked for, and every pixel above it is a pixel of
     contracts a weighting change cannot be seen to affect. */
  .profile { padding-bottom: var(--s4); margin-bottom: var(--s4); }
  .profile h2 { font-size: 21px; }
  .tally { gap: var(--s5); margin-top: var(--s3); }
  .tally .stat b { font-size: 23px; }
  .tally .stat span { font-size: 11.5px; }
  .board-head { padding-bottom: var(--s3); }
}

/* ---- "n moved": the visible answer to a weighting change --------------- */

.moved {
  display: inline-block;
  margin-left: var(--s2);
  padding: 1px 8px;
  border-radius: 999px;
  background: #DCFCE7;
  color: #14532D;
  font-size: 11.5px;
  font-weight: 600;
}
@media (prefers-reduced-motion: no-preference) {
  .moved { animation: pop .4s ease both; }
  @keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
}

/* ---- denser rows on a phone -------------------------------------------- */

@media (max-width: 999px) {
  .result { padding: var(--s3) 0; }
  /* Three lines, not five. The sentence still says why this contract fits; the tail of it is worth
     less than another contract being on screen while the weighting is changed. */
  .result .why {
    font-size: 14px;
    margin-top: var(--s2);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .result .actions { margin-top: var(--s2); gap: var(--s4); }
  .result-head .title { font-size: 15.5px; }
}

/* Full targets wherever the pointer is a thumb. These are the controls the page exists to be
   driven by — the presets especially — so they are the last place to economise on height. The ~60px
   it adds to the panel is worth less than a mis-tap on every interaction. */
@media (pointer: coarse) {
  .preset { min-height: 44px; padding: 0 var(--s4); }
  .btn-sm { min-height: 44px; }
  #pickSummary { min-height: 44px; }
  #describeBox > summary { min-height: 44px; display: flex; align-items: center; gap: 6px; }
  .tune > summary { min-height: 44px; }
}
