/* Bench the Bot — shared design system.
   Visual direction from the two Claude Design mockups: dark navy field,
   yellow accent for active state, green/red reserved for point outcomes.
   Chart series palette is CVD-validated (dataviz skill, six checks) against
   the card surface #121e45 — do not eyeball-edit series colors. */

:root {
  --bg: #0b1533;
  --card: #121e45;
  --card-2: #16255a;
  --line: #26356b;
  --line-soft: #1d2c5c;

  --ink: #e9edf8;
  --ink-2: #a7b4d9;
  --muted: #6a7dae;

  --accent: #f2c530;
  --accent-ink: #1a1503;

  /* status text tokens (outcomes, deltas) — text only, never chart marks */
  --pos: #3fd68f;
  --neg: #ff7a72;

  /* validated categorical series (fixed order, never cycled):
     you → ai → top500k → top50k; user/fpl averages are recessive context */
  --s-you: #009878;
  --s-ai: #f0461e;
  --s-500k: #2f7fd6;
  --s-50k: #b98a16;
  --s-ctx-1: #6d7ea8;
  --s-ctx-2: #4e5f86;

  --mono: ui-monospace, "Cascadia Mono", "SF Mono", "JetBrains Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --radius: 4px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.45;
}

a { color: var(--ink-2); }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px 64px; }

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

.site-header {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 26px 0 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 60px;
  flex-wrap: wrap;
  overflow: visible;
}

.wordmark { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; overflow: visible; }
.wordmark a { text-decoration: none; }
.wordmark .brand-link {
  display: flex;
  align-items: center;
  padding-left: 128px;
}
.wordmark .brand-icon {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 120px;
  height: 120px;
  flex-shrink: 0;
  display: block;
}

.wordmark .brand {
  display: block;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink);
}
.wordmark .sub {
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--muted);
  text-transform: uppercase;
}

@media (max-width: 960px) {
  /* Below this width the header wraps to two rows (wordmark, then nav)
     with no vertical gap reserved between them — an overflowing icon
     here would sit on top of the wrapped nav links, so it drops back
     to a normal in-flow size instead of breaking out of the bar. */
  .wordmark .brand-link { padding-left: 0; gap: 8px; }
  .wordmark .brand-icon {
    position: static;
    transform: none;
    width: 40px;
    height: 40px;
  }
}

.header-right { display: flex; align-items: baseline; gap: 18px; }
.gw-indicator {
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--ink-2);
  text-transform: uppercase;
  white-space: nowrap;
}
.site-nav { display: flex; gap: 14px; }
.site-nav a {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  padding: 3px 0;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--ink-2); }
.site-nav a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- cards & sections ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.section-label {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 12px;
  font-weight: 600;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

/* ---------- toggle groups (segmented buttons) ---------- */

.toggle-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.toggle-group button {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 6px 12px;
  background: transparent;
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  cursor: pointer;
}
.toggle-group button:hover { border-color: var(--muted); color: var(--ink); }
.toggle-group button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

.filter-row {
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
  margin: 26px 0 14px;
}
.filter-group .filter-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* ---------- scoreboard ---------- */

.scoreboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: 16px;
  align-items: stretch;
}
@media (max-width: 860px) { .scoreboard-grid { grid-template-columns: 1fr; } }

.chart-host { position: relative; min-height: 280px; }
.chart-host svg { display: block; width: 100%; height: auto; }

/* ---------- world-first badge ----------
   A single top-of-league reference point, not a bar/line series — a real
   individual manager's cumulative total, deliberately styled as a standalone
   trophy-style callout (gold border, own line above the chart) rather than
   folded into the comparison chart's categorical marks. */
.world-first-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  margin-bottom: 12px;
  padding: 6px 12px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: rgba(242, 197, 48, 0.08);
  font-size: 11.5px;
  color: var(--ink-2);
  width: fit-content;
}
.world-first-badge .wf-icon { font-size: 13px; line-height: 1; }
.world-first-badge .wf-label {
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 10px;
  color: var(--accent);
  font-weight: 700;
}
.world-first-badge .wf-value { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.world-first-badge .wf-sub { color: var(--muted); }

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: #0d1738;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 8px 10px;
  font-size: 11px;
  min-width: 130px;
  z-index: 20;
  display: none;
}
.chart-tooltip .tt-title {
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 10px;
  margin-bottom: 5px;
}
.chart-tooltip .tt-row { display: flex; align-items: center; gap: 7px; padding: 1.5px 0; }
.chart-tooltip .tt-key { width: 12px; height: 0; border-top: 2px solid; flex: none; }
.chart-tooltip .tt-val { font-weight: 700; color: var(--ink); }
.chart-tooltip .tt-name { color: var(--ink-2); }

.chart-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.chart-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .lg .key { width: 14px; border-top: 2px solid; height: 0; }
.chart-legend .lg .key.dashed { border-top-style: dashed; }

.data-table { width: 100%; overflow-x: auto; }
.data-table table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.data-table th, .data-table td {
  text-align: right;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table th {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
}

/* summary card */
.summary-card { display: flex; flex-direction: column; gap: 12px; }
.summary-card h2 { font-size: 17px; margin: 0; line-height: 1.35; letter-spacing: 0.02em; }
.summary-card .pace { color: var(--ink-2); font-size: 12px; }
.summary-card .pace div { padding: 2px 0; }
.summary-card .foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 11px;
}

/* accuracy strip */
.accuracy-strip {
  margin-top: 16px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--card);
  display: flex;
  gap: 10px 28px;
  align-items: baseline;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--ink-2);
}
.accuracy-strip .label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}
.accuracy-strip .stat b { color: var(--ink); font-weight: 700; }

/* ---------- suggestion cards ---------- */

.suggestion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}
.player-card { display: flex; flex-direction: column; gap: 8px; min-height: 168px; }
.player-card .pc-top { display: flex; justify-content: space-between; align-items: baseline; }
.player-card .pc-pos { font-size: 10px; letter-spacing: 0.2em; color: var(--muted); }
.player-card .pc-xpts { font-weight: 700; color: var(--pos); font-size: 15px; }
.player-card .pc-name { font-size: 16px; font-weight: 700; }
.player-card .pc-meta { font-size: 11px; color: var(--muted); }
.player-card .pc-tag {
  align-self: flex-start;
  font-size: 9px;
  letter-spacing: 0.16em;
  padding: 3px 7px;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 2px;
  text-transform: uppercase;
}
.player-card .pc-reason { font-size: 11.5px; color: var(--ink-2); }
.player-card .pc-minutes { font-size: 10.5px; color: var(--muted); }
.player-card .pc-fixtures { display: flex; gap: 6px; flex-wrap: wrap; font-size: 10px; }
.fixture-chip {
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 2px 6px;
  color: var(--ink-2);
  white-space: nowrap;
}
.fixture-chip .d2 { color: var(--pos); font-weight: 700; }
.fixture-chip .d3 { color: var(--muted); font-weight: 700; }
.fixture-chip .d4 { color: var(--neg); font-weight: 700; }

/* ---------- player-card carousel (swipeable top-3-per-position) ---------- */

.player-card-carousel {
  position: relative;
  padding-bottom: 32px; /* room for the dot indicator below the content */
}
.pcc-viewport { overflow: hidden; }
.pcc-track {
  display: flex;
  align-items: stretch;
  transition: transform 220ms ease;
  touch-action: pan-y; /* let vertical page scroll through; we handle horizontal */
}
.pcc-slide { flex: 0 0 auto; box-sizing: border-box; padding-right: 2px; }
.pcc-nav {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.pcc-arrow {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.pcc-arrow:hover { border-color: var(--accent); color: var(--accent); }
.pcc-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.pcc-dot {
  width: 6px;
  height: 6px;
  padding: 0;
  border-radius: 50%;
  border: none;
  background: var(--line);
  cursor: pointer;
}
.pcc-dot.is-active { background: var(--accent); }

/* ---------- fixtures view (Scouting page-level toggle) ---------- */

.fx-cell { white-space: nowrap; }
.fx-cell .fx-opp { font-weight: 700; font-size: 10px; }
.fx-cell .fx-xpts { font-variant-numeric: tabular-nums; margin-top: 2px; }

/* Difficulty indicator: a colored pill around the opponent label itself
   (large color surface area, easy to scan) rather than a small dot next to
   it. Background is set inline per-cell (continuous difficulty gradient,
   see scouting.js); text color is also computed inline per-cell for
   contrast against that background. */
.fx-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.fx-blank, .fx-wait { color: var(--muted); }
.fx-locked {
  color: var(--muted);
  filter: blur(2px);
  opacity: 0.55;
  user-select: none;
}
.fx-pro-head { color: var(--accent); white-space: nowrap; }
.fx-total { font-weight: 700; font-variant-numeric: tabular-nums; }

/* Team FDR (Scouting page, team-level view) — a compact strip of
   per-fixture pills reusing the exact fx-pill difficulty treatment, one
   size down since five sit in a row per team. Centered under its own
   "Next N (GWx–y)" header rather than following the table's default
   right/left alignment, since it's a group of marks, not a single value. */
/* .data-table th/td (element+class) outrank a class-only selector, so these
   need the element prefixed to actually win over the default right-align. */
.data-table th.fr-fixtures-head, .data-table td.fr-fixtures-cell { text-align: center; }
.fr-strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.fr-mini { font-size: 9px; padding: 2px 6px; }

.fx-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}
.fx-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.fx-legend .fx-swatch {
  display: inline-block;
  width: 18px;
  height: 10px;
  border-radius: 3px;
}

/* Evidence label next to a player's name in the Scouting table (see
   playerCell() in scouting.js). Deliberately muted, outline-only: it's a
   caveat on the number in the same row, not a status to be scanned for or
   confused with the difficulty pills, which own the color in this table. */
.ev-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: help;
  vertical-align: 1px;
}

/* small hover/focus tooltip — explanatory text out of the visual flow */
.info-tip {
  position: relative;
  cursor: help;
  color: var(--muted);
  font-size: 12px;
}
.info-tip:hover, .info-tip:focus { color: var(--ink-2); outline: none; }
.info-tip::after {
  content: attr(data-tip);
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 10;
  width: 240px;
  padding: 8px 10px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink-2);
  font-size: 10.5px;
  letter-spacing: normal;
  text-transform: none;
  white-space: normal;
  display: none;
}
.info-tip:hover::after, .info-tip:focus::after { display: block; }

/* ---------- personalize CTA ---------- */

.cta-card {
  margin-top: 22px;
  border-style: dashed;
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.cta-card h3 { margin: 0 0 4px; font-size: 14px; letter-spacing: 0.06em; }
.cta-card p { margin: 0; color: var(--muted); font-size: 12px; }
.cta-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cta-form input {
  font-family: var(--mono);
  font-size: 13px;
  background: #0d1738;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 9px 12px;
  width: 170px;
}
.cta-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn-accent {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: 3px;
  padding: 10px 16px;
  cursor: pointer;
}
.btn-accent:hover { filter: brightness(1.08); }
.btn-accent:disabled { opacity: 0.55; cursor: default; }
.cta-error { color: var(--neg); font-size: 12px; width: 100%; }
.cta-success h3 { color: var(--accent); }
.cta-success p { color: var(--accent); }
.cta-consent {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--muted);
  width: 100%;
  cursor: pointer;
}
.cta-consent input { width: auto; margin: 0; flex-shrink: 0; }

/* ---------- dugout ---------- */

.dugout-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px) { .dugout-grid { grid-template-columns: 1fr; } }

.squad-block { margin-bottom: 14px; }
.squad-block .sb-head {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 4px 8px;
}
.squad-row {
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px 10px 0;
  margin-bottom: 6px;
}
.squad-row .pos-bar { align-self: stretch; border-radius: 4px 0 0 4px; }
.pos-bar.GK, .pos-bar.DEF { background: var(--s-500k); }
.pos-bar.MID { background: var(--accent); }
.pos-bar.FWD { background: var(--s-ai); }
.squad-row .sp-name { font-weight: 700; font-size: 13.5px; }
.squad-row .sp-name .cap {
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 2px;
  font-size: 9px;
  padding: 1px 4px;
  margin-left: 6px;
  letter-spacing: 0.08em;
  font-weight: 700;
}
.squad-row .sp-name .bench-chip {
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 2px;
  font-size: 9px;
  padding: 1px 4px;
  margin-left: 6px;
  letter-spacing: 0.1em;
}
.squad-row .sp-meta { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.squad-row .sp-stats { font-size: 10.5px; color: var(--muted); text-align: right; }
.squad-row .sp-points { text-align: center; min-width: 64px; }
.squad-row .sp-points .val { font-size: 17px; font-weight: 700; }
.squad-row .sp-points .lbl { font-size: 9px; letter-spacing: 0.12em; color: var(--muted); text-transform: uppercase; }
.squad-row .sp-proj { display: flex; gap: 10px; }
.squad-row .sp-proj .col { text-align: center; min-width: 34px; }
.squad-row .sp-proj .col .val { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.squad-row .sp-proj .col .lbl { font-size: 9px; letter-spacing: 0.1em; color: var(--muted); text-transform: uppercase; }

/* sidebar cards */
.side-card { margin-bottom: 16px; }
.side-card.next-up { border-color: var(--accent); }
.next-up .swap { font-size: 14px; font-weight: 700; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.next-up .swap .out { color: var(--muted); text-decoration: line-through; }
.next-up .swap .gain { color: var(--pos); margin-left: auto; }
.next-up .why { color: var(--ink-2); font-size: 12px; margin-top: 8px; }

.chip-card {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--ink-2);
}
.chip-card .chip-head {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.chip-card .chip-head .k { color: var(--muted); }
.chip-card .chip-head .v { color: var(--accent); font-weight: 700; }

.gw-history { max-height: 560px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.gw-item {
  border: 1px solid var(--line);
  border-left: 3px solid var(--muted);
  border-radius: var(--radius);
  background: var(--card);
  padding: 10px 12px;
  font-size: 11.5px;
}
.gw-item.positive { border-left-color: var(--pos); }
.gw-item.negative { border-left-color: var(--neg); }
.gw-item .gi-head { display: flex; justify-content: space-between; margin-bottom: 5px; }
.gw-item .gi-gw { font-size: 10px; letter-spacing: 0.16em; color: var(--muted); }
.gw-item .gi-delta { font-weight: 700; }
.gw-item .gi-delta.pos { color: var(--pos); }
.gw-item .gi-delta.neg { color: var(--neg); }
.gw-item .gi-line { color: var(--ink-2); padding: 1px 0; }
.gw-item .gi-line b { color: var(--ink); font-weight: 700; }
.gw-item .gi-why {
  margin-top: 6px;
  padding: 6px 8px;
  background: #0d1738;
  border-radius: 3px;
  color: var(--muted);
  font-size: 10.5px;
}

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

.state-panel {
  padding: 38px 24px;
  text-align: center;
  color: var(--ink-2);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
.state-panel h3 { color: var(--ink); margin: 0 0 8px; font-size: 15px; letter-spacing: 0.04em; }
.state-panel p { margin: 4px 0; font-size: 12.5px; }
.state-panel.error { border-color: var(--neg); }
.state-panel .spin { color: var(--accent); letter-spacing: 0.2em; font-size: 11px; text-transform: uppercase; }

.loading-dim { opacity: 0.45; transition: opacity 0.15s; }

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

footer.site-foot {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
