/* Sixes Director v2 — "The Transfer River"
   Theme: Night Race Telemetry. Tokens are Foundation §6 — the only palette. */

:root {
  --night: #101318;
  --panel: #1a1f27;
  --panel-2: #232a35;
  --text: #eef1f4;
  --text-dim: #8b94a3;
  --jaune: #ffd400;
  --sprint: #2fd575;
  --mtn: #ff5a5a;
  --hilly: #ffab3d;
  --tt: #5b8cff;
  --danger: #ff5a5a;
  --border: #2c3440;

  --radius: 8px;
  --radius-chip: 4px;
  --glow-jaune: 0 0 12px rgba(255, 212, 0, 0.35);
  --glow-danger: 0 0 12px rgba(255, 90, 90, 0.35);

  --lane-h: 56px;
  --col-w: 300px;
  --col-gap: 32px;
  --header-h: 56px;
  --tabbar-h: 56px;

  --font-display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --font-ui: 'Barlow Semi Condensed', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--night);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.num { font-variant-numeric: tabular-nums; }

#app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ---------------- header (telemetry instrument cluster) ---------------- */

#hdr {
  height: var(--header-h);
  flex: none;
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0 14px 0 16px;
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 40;
  background:
    linear-gradient(180deg, rgba(35, 42, 53, 0.35), transparent 60%),
    var(--night);
}
/* atmosphere slot: assets/bg-hero.jpg — missing file = gradient only, no error */
#hdr::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('assets/bg-hero.jpg') center / cover no-repeat;
  opacity: 0.18;
  pointer-events: none;
}
#hdr > * { position: relative; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 18px;
  flex: none;
}
.brand-mark { flex: none; filter: drop-shadow(0 0 6px rgba(255, 212, 0, 0.35)); }
.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.02em;
  color: var(--jaune);
  white-space: nowrap;
}

/* telemetry readouts — instrument panel, hairline-divided */
.telemetry {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  gap: 0;
  overflow: hidden;
}
.stat {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 0 18px;
  border-left: 1px solid var(--border);
  min-width: 0;
  white-space: nowrap;
}
.stat--score { cursor: pointer; transition: background 0.2s ease-out; }
.stat--score:hover { background: rgba(255, 212, 0, 0.06); }
.stat--score:focus-visible { outline: 2px solid var(--jaune); outline-offset: -2px; }
.stat-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  text-transform: uppercase;
}
.stat-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.stat-value .stat-unit {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}
.stat-value .is-dim { color: var(--text-dim); }
.stat-value .pos { color: var(--sprint); }
.stat-value .neg { color: var(--danger); }
.stat--score .stat-value { color: var(--jaune); }
.stat--deadline .stat-label { color: var(--jaune); }
.stat--deadline .stat-value { color: var(--jaune); font-size: 16px; }
.stat--deadline.is-over-race .stat-label,
.stat--deadline.is-over-race .stat-value { color: var(--sprint); }
.stat--deadline { border-left-color: rgba(255, 212, 0, 0.35); }

#menu-btn { align-self: center; margin-left: 14px; }

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-chip);
  border: 1px solid var(--border);
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  transition: border-color 0.2s ease-out, color 0.2s ease-out;
}
.icon-btn:hover { border-color: var(--jaune); color: var(--text); }

/* ---------------- timeline / river ---------------- */

#timeline {
  flex: 1;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: var(--panel-2) var(--night);
}
body.reduced-motion #timeline { scroll-behavior: auto; }

#strip {
  display: flex;
  align-items: stretch;
  gap: var(--col-gap);
  height: 100%;
  min-width: max-content;
  padding: 16px 48px 12px;
  position: relative;
}

#lanelines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* nav arrows (desktop) */
.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 25;
  width: 40px;
  height: 72px;
  border-radius: var(--radius);
  background: rgba(35, 42, 53, 0.88);
  border: 1px solid var(--border);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s ease-out, color 0.2s ease-out;
}
.nav-arrow:hover:not(:disabled) { border-color: var(--jaune); color: var(--jaune); }
.nav-arrow:disabled { opacity: 0.25; cursor: default; }
.nav-arrow--left { left: 10px; }
.nav-arrow--right { right: 10px; }
body.mode-carousel .nav-arrow { display: none; }

/* ---------------- columns (uniform size) ---------------- */

.col {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  flex: none;
  width: var(--col-w);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  min-width: 0;
}
.col--focus {
  border-color: var(--jaune);
  box-shadow: var(--glow-jaune);
  z-index: 2;
}
.col--focus.has-error {
  border-color: var(--danger);
  box-shadow: var(--glow-danger);
}
.col.is-cascade { border-color: rgba(255, 90, 90, 0.4); }

/* the stage you're looking at stands out — everything else recedes */
.col:not(.col--focus) {
  opacity: 0.55;
  filter: saturate(0.75);
  transition: opacity 0.2s ease-out, filter 0.2s ease-out;
}
.col:not(.col--focus):hover { opacity: 0.85; filter: none; }

/* -------- banner (type-colored header) -------- */

.col-banner {
  flex: none;
  border-radius: var(--radius-chip);
  border: 1px solid rgba(var(--type-rgb), 0.35);
  border-top: 3px solid var(--type-color);
  background:
    linear-gradient(180deg, rgba(var(--type-rgb), 0.24), rgba(var(--type-rgb), 0.07)),
    var(--panel-2);
  padding: 7px 10px 8px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
/* terrain texture slot: assets/tex-<type>.png at ≤15% opacity, graceful */
.col-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.13;
  pointer-events: none;
  background: center / cover no-repeat;
}
.type-flat .col-banner::before { background-image: url('assets/tex-flat.png'); }
.type-hilly .col-banner::before { background-image: url('assets/tex-hilly.png'); }
.type-mountain .col-banner::before { background-image: url('assets/tex-mountain.png'); }
.type-itt .col-banner::before, .type-ttt .col-banner::before { background-image: url('assets/tex-tt.png'); }
.col-banner > * { position: relative; }

.banner-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}
.banner-stage {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--type-color);
  white-space: nowrap;
}
.banner-status {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.banner-status.is-next { color: var(--jaune); }
.banner-status.is-racing { color: var(--sprint); }
.banner-status.is-done { opacity: 0.8; }
.col.has-error .banner-status { color: var(--danger); }

.banner-city {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  line-height: 1.25;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.banner-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text-dim);
}
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sprint);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.col-profile { flex: none; margin: 6px 0 8px; height: 24px; }
.col-profile svg { width: 100%; height: 100%; display: block; }

/* -------- lanes -------- */

.col-lanes {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.lane-slot { display: flex; flex-direction: column; }

/* uniform, quiet cards — the only highlights are hover and the selected lane */
.lane {
  height: var(--lane-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  background: rgba(16, 19, 24, 0.45);
  border: 1px solid var(--border);
  border-radius: var(--radius-chip);
  position: relative;
  overflow: hidden;
  min-width: 0;
}
.lane.is-editable { cursor: pointer; transition: border-color 0.2s ease-out; }
.lane.is-editable:hover { border-color: var(--jaune); }
.lane.is-selected {
  border-color: var(--jaune);
  box-shadow: var(--glow-jaune);
}

.lane-num {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  opacity: 0.7;
  flex: none;
  width: 18px;
}
.lane-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.lane-team {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lane-main { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.lane-right { flex: none; display: flex; align-items: center; gap: 6px; }

.lane-pts {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}
.lane-pts.pts-pos { color: var(--sprint); }

.lane-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
  flex: none;
}

.swap-btn {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-chip);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  opacity: 0;
  transition: opacity 0.2s ease-out, color 0.2s ease-out;
  flex: none;
}
.lane:hover .swap-btn, body.mode-carousel .swap-btn { opacity: 1; }
.swap-btn:hover { color: var(--jaune); }

/* undo is an explicit, always-visible action on spliced lanes */
.undo-btn {
  flex: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 9px;
  letter-spacing: 0.08em;
  padding: 3px 6px;
  border-radius: var(--radius-chip);
  color: var(--danger);
  border: 1px solid rgba(255, 90, 90, 0.55);
  background: rgba(255, 90, 90, 0.08);
  transition: background 0.2s ease-out;
  white-space: nowrap;
}
.undo-btn:hover { background: rgba(255, 90, 90, 0.22); }

/* incoming rider — replaces the old one in place; ⇄ NEW marks the splice */
.lane.is-in { border-left: 3px solid var(--sprint); }
.lane.is-in .lane-num { color: var(--sprint); opacity: 1; }

.tag {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 9px;
  letter-spacing: 0.1em;
  padding: 1px 4px;
  border-radius: 3px;
}
.tag-in { color: var(--sprint); border: 1px solid rgba(47, 213, 117, 0.5); background: rgba(47, 213, 117, 0.1); }
.tag-dnf { color: var(--danger); border: 1px solid rgba(255, 90, 90, 0.5); }

.lane.is-dnf .lane-name { text-decoration: line-through; color: var(--text-dim); }
.lane.is-error {
  border-color: var(--danger);
  animation: pulse-error 1.5s ease-in-out infinite;
}
@keyframes pulse-error {
  0%, 100% { border-color: rgba(255, 90, 90, 0.5); }
  50% { border-color: var(--danger); box-shadow: 0 0 8px rgba(255, 90, 90, 0.5); }
}

.lane--empty {
  border-style: dashed;
  border-color: var(--border);
  background: transparent;
  justify-content: center;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.1em;
}
.lane--empty.is-editable:hover { border-color: var(--jaune); color: var(--jaune); }
/* the empty slot the next pick will drop into stays lit while the market is open */
.lane--empty.is-selected { border-color: var(--jaune); color: var(--jaune); box-shadow: var(--glow-jaune); }

/* -------- footer panel: budget + transfers (its own inset card) -------- */

.col-foot {
  flex: none;
  margin-top: 10px;
  padding: 8px 10px;
  background: var(--night);
  border: 1px solid var(--border);
  border-radius: var(--radius-chip);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--text);
}
.foot-label { color: var(--text-dim); font-size: 11px; letter-spacing: 0.12em; }
.budget-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.budget-num { font-variant-numeric: tabular-nums; font-size: 15px; }
.budget-sub { font-size: 11px; color: var(--text-dim); letter-spacing: 0.04em; }
.budget-bar {
  margin-top: 5px;
  height: 4px;
  border-radius: 2px;
  background: var(--panel-2);
  overflow: hidden;
}
.budget-fill { height: 100%; background: var(--jaune); border-radius: 2px; }
.warn-pill {
  font-size: 11px;
  font-weight: 700;
  color: var(--danger);
  border: 1px solid rgba(255, 90, 90, 0.5);
  border-radius: var(--radius-chip);
  padding: 1px 6px;
  background: rgba(255, 90, 90, 0.1);
  white-space: nowrap;
}
.col-foot.is-over .budget-num { color: var(--danger); }
.col-foot.is-over .budget-fill { background: var(--danger); }

.xfer-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid var(--border);
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--text);
  text-align: left;
}
button.xfer-row { cursor: pointer; }
button.xfer-row:hover .foot-label { color: var(--jaune); }
.xfer-count { font-size: 15px; color: var(--text-dim); }
.xfer-count.has-some { color: var(--jaune); }
.xfer-count.is-over { color: var(--danger); }
.xfer-row.is-static { color: var(--text-dim); }

/* frozen stage: the day's points, led over the (secondary) budget line */
.score-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.score-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  color: var(--sprint);
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.score-num .stat-unit { font-size: 10px; font-weight: 600; letter-spacing: 0.1em; color: var(--text-dim); }
.score-num.is-dim { color: var(--text-dim); }
.col-foot.is-frozen .budget-row {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-dim);
}
.col-foot.is-frozen .budget-num { font-size: 12px; color: var(--text-dim); }
.col-foot.is-frozen .foot-label { color: var(--text-dim); }

.ref-total td { border-bottom: none; border-top: 1px solid var(--border); font-weight: 700; color: var(--sprint); }
.ref-total td:first-child { color: var(--text); font-family: var(--font-display); }

/* ---------------- carousel (mobile) ---------------- */

body.mode-carousel #timeline {
  scroll-snap-type: x mandatory;
  overflow-y: hidden;
}
body.mode-carousel #strip { padding: 12px 12px calc(var(--tabbar-h) + 12px); gap: 14px; }
body.mode-carousel .col {
  width: calc(100vw - 48px);
  max-width: 420px;
  scroll-snap-align: center;
}

/* ---------------- bottom tab bar (mobile) ---------------- */

#tabbar {
  display: none;
  height: var(--tabbar-h);
  flex: none;
  border-top: 1px solid var(--border);
  background: var(--night);
  z-index: 40;
}
body.mode-carousel #tabbar { display: flex; }
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}
.tab.is-active { color: var(--jaune); }

/* narrow header: shrink the wordmark, drop the last-stage readout, tighten */
body.mode-carousel .brand-name { display: none; }
body.mode-carousel .brand { padding-right: 12px; }
body.mode-carousel .stat { padding: 0 12px; }
body.mode-carousel .stat--last { display: none; }
body.mode-carousel .stat-value { font-size: 17px; }
body.mode-carousel .stat--deadline .stat-value { font-size: 14px; }
@media (max-width: 440px) {
  body.mode-carousel .stat--score .stat-label,
  body.mode-carousel .stat--deadline .stat-label { font-size: 9px; }
  body.mode-carousel .stat { padding: 0 10px; }
}

/* ---------------- empty state ---------------- */

#empty-hero {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 12vh;
  gap: 14px;
  z-index: 20;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center 70%, rgba(16, 19, 24, 0.55), transparent 65%),
    url('assets/empty-road.png') center bottom / contain no-repeat;
}
#empty-hero h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 0.03em;
  margin: 0;
  text-align: center;
  text-shadow: 0 2px 12px rgba(16, 19, 24, 0.9);
}
#empty-hero p { margin: 0; color: var(--text-dim); text-align: center; }

.cta {
  pointer-events: auto;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.06em;
  color: var(--night);
  background: var(--jaune);
  border-radius: var(--radius);
  padding: 10px 26px;
  box-shadow: var(--glow-jaune);
  transition: transform 0.2s ease-out;
}
.cta:hover { transform: translateY(-1px); }

/* finale — race over */
body.race-over #strip::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url('assets/finale.png') center bottom / cover no-repeat;
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}

/* ---------------- market ---------------- */

#market {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 360px;
  max-width: 100vw;
  background: var(--panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 60;
  transform: translateX(100%);
  transition: transform 0.2s ease-out;
  visibility: hidden;
}
#market.is-open { transform: translateX(0); visibility: visible; }
body.mode-carousel #market { width: 100vw; border-left: none; }

.market-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--night);
}
.market-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.04em;
  color: var(--jaune);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.market-context {
  flex: none;
  padding: 8px 14px;
  font-size: 12px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}
.market-context strong { color: var(--text); font-weight: 600; }
.market-context .num { color: var(--jaune); }

.market-tools { flex: none; padding: 10px 14px 8px; display: flex; flex-direction: column; gap: 8px; }
.market-search {
  width: 100%;
  background: var(--night);
  border: 1px solid var(--border);
  border-radius: var(--radius-chip);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  padding: 7px 10px;
  outline: none;
}
.market-search:focus { border-color: var(--jaune); }
.market-search::placeholder { color: var(--text-dim); }

.market-team {
  width: 100%;
  background: var(--night);
  border: 1px solid var(--border);
  border-radius: var(--radius-chip);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  padding: 7px 28px 7px 10px;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%238b94a3' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.market-team:focus { border-color: var(--jaune); }
.market-team.is-set { border-color: rgba(255, 212, 0, 0.5); color: var(--jaune); }
.market-team option { background: var(--panel); color: var(--text); }

/* cost range — two overlaid native sliders; only the thumbs catch pointer events */
.cost-filter { display: flex; flex-direction: column; gap: 4px; }
.cost-filter-head { display: flex; justify-content: space-between; align-items: baseline; }
.cost-filter-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}
.cost-filter-val {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.cost-filter.is-set .cost-filter-val { color: var(--jaune); }

.cost-slider { position: relative; height: 20px; }
.cost-track, .cost-range {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 4px;
  border-radius: 2px;
  pointer-events: none;
}
.cost-track { left: 0; right: 0; background: var(--panel-2); }
.cost-range { background: var(--jaune); }
.cost-slider input[type="range"] {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 20px;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  pointer-events: none;
}
.cost-slider .cost-min { z-index: 3; }
.cost-slider .cost-max { z-index: 2; }
.cost-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  pointer-events: auto;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--jaune);
  border: 2px solid var(--night);
  box-shadow: 0 0 0 1px var(--border);
  cursor: pointer;
}
.cost-slider input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--jaune);
  border: 2px solid var(--night);
  box-shadow: 0 0 0 1px var(--border);
  cursor: pointer;
}
.cost-slider input[type="range"]::-webkit-slider-runnable-track { background: transparent; height: 20px; }
.cost-slider input[type="range"]::-moz-range-track { background: transparent; }
.cost-slider input[type="range"]:focus { outline: none; }
.cost-slider input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px rgba(255, 212, 0, 0.45); }

.chip-row { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chip-row::-webkit-scrollbar { display: none; }
.role-chip {
  flex: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text-dim);
  transition: border-color 0.2s ease-out, color 0.2s ease-out;
}
.role-chip.is-active { border-color: var(--jaune); color: var(--jaune); }

.market-sortrow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}
.market-sortrow .num { color: var(--jaune); font-weight: 600; }
.market-sortrow .num.is-over { color: var(--danger); }
.sort-btn { color: var(--text-dim); font-size: 11px; letter-spacing: 0.04em; }
.sort-btn:hover { color: var(--text); }
.sort-btn strong { color: var(--text); }

.market-list { flex: 1; overflow-y: auto; padding: 4px 8px 16px; }
.market-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: var(--radius-chip);
  border: 1px solid transparent;
  text-align: left;
  transition: border-color 0.15s ease-out;
}
.market-row:hover:not(:disabled) { border-color: rgba(255, 212, 0, 0.5); }
.market-row:disabled { opacity: 0.45; cursor: not-allowed; }
.market-row.in-squad { border-color: rgba(47, 213, 117, 0.35); }

.role-badge {
  flex: none;
  width: 34px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-align: center;
  padding: 3px 0;
  border-radius: var(--radius-chip);
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--role-color, var(--text-dim));
}
.market-row .r-main { flex: 1; min-width: 0; }
.market-row .r-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.market-row:disabled .r-name { text-decoration: line-through; color: var(--text-dim); }
.market-row .r-team { font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.market-row .r-right { flex: none; display: flex; align-items: center; gap: 8px; }
.market-row .r-cost {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}
.market-row .r-pts { font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.market-row .r-fit { font-size: 11px; color: var(--fit-color, var(--text-dim)); font-weight: 600; }
.reason-pill {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--danger);
  background: var(--panel-2);
  border-radius: var(--radius-chip);
  padding: 2px 6px;
  white-space: nowrap;
}
.insquad-pill {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--sprint);
  background: var(--panel-2);
  border-radius: var(--radius-chip);
  padding: 2px 6px;
  white-space: nowrap;
}

/* ---------------- sheets ---------------- */

#sheet-root { position: fixed; inset: 0; z-index: 70; pointer-events: none; }
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 19, 24, 0.7);
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.2s ease-out;
}
.sheet {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 8px);
  width: min(540px, 100vw);
  max-height: 82dvh;
  background: var(--panel);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}
#sheet-root.is-open .sheet-backdrop { opacity: 1; }
#sheet-root.is-open .sheet { opacity: 1; transform: translate(-50%, 0); }

.sheet-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.sheet-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.03em;
  margin: 0;
}
.sheet-body { padding: 14px 16px 20px; overflow-y: auto; }
.sheet-note { font-size: 12px; color: var(--text-dim); margin: 0 0 12px; }
.sheet-note .warn { color: var(--jaune); }

.swap-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-chip);
  margin-bottom: 6px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
}
.swap-chip.has-error { border-color: var(--danger); }
.swap-chip .s-out { color: var(--danger); text-decoration: line-through; }
.swap-chip .s-arrow { color: var(--text-dim); }
.swap-chip .s-in { color: var(--sprint); }
.swap-chip .s-cost { margin-left: auto; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.swap-chip .x-btn {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-chip);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
}
.swap-chip .x-btn:hover { color: var(--danger); }
.swap-err { font-size: 11px; color: var(--danger); margin: -2px 0 8px 2px; }

.add-transfer {
  width: 100%;
  padding: 9px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-chip);
  color: var(--jaune);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.06em;
  margin-top: 4px;
  transition: border-color 0.2s ease-out;
}
.add-transfer:hover { border-color: var(--jaune); }

.lane-choice {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-chip);
  margin-bottom: 6px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  text-align: left;
  transition: border-color 0.15s ease-out;
}
.lane-choice:hover { border-color: var(--jaune); }
.lane-choice .lc-cost { margin-left: auto; color: var(--text-dim); font-variant-numeric: tabular-nums; }

.err-banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--danger);
  border-radius: var(--radius-chip);
  margin-bottom: 12px;
  font-size: 13px;
}
.err-banner strong { display: block; font-family: var(--font-display); font-size: 15px; }
.err-banner .e-icon { color: var(--danger); flex: none; margin-top: 1px; }

/* scoring / detail tables */
.ref-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 14px; }
.ref-table th {
  text-align: left;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}
.ref-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); }
.ref-table td.num { text-align: right; font-family: var(--font-display); font-weight: 600; }
.climb-list { margin: 0 0 12px; padding-left: 18px; font-size: 13px; color: var(--text-dim); }
.climb-list li { margin-bottom: 3px; }

.menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: var(--radius-chip);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  text-align: left;
  transition: background 0.15s ease-out;
}
.menu-item:hover { background: var(--panel-2); }
.menu-item.is-danger { color: var(--danger); }

.io-area {
  width: 100%;
  min-height: 140px;
  background: var(--night);
  border: 1px solid var(--border);
  border-radius: var(--radius-chip);
  color: var(--text);
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 12px;
  padding: 8px;
  resize: vertical;
}
.io-row { display: flex; gap: 8px; margin-top: 8px; }
.btn {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.04em;
  padding: 8px 16px;
  border-radius: var(--radius-chip);
  border: 1px solid var(--border);
  background: var(--panel-2);
  transition: border-color 0.2s ease-out;
}
.btn:hover { border-color: var(--jaune); }
.btn--primary { background: var(--jaune); color: var(--night); border-color: var(--jaune); }
.btn--danger { color: var(--danger); border-color: rgba(255, 90, 90, 0.5); }
.io-msg { font-size: 12px; margin-top: 6px; min-height: 16px; }
.io-msg.ok { color: var(--sprint); }
.io-msg.bad { color: var(--danger); }

/* ---------------- motion restraint ---------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
body.reduced-motion *, body.reduced-motion *::before, body.reduced-motion *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}
