/* ---------------------------------------------------------------- tokens */
:root {
  --bg: #0d0c1d;
  --bg-glow: #1b0f3b;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-strong: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.1);
  --text: #f3f2fb;
  --text-dim: #a6a3c2;
  --accent: #00ff87;      /* the FPL green */
  --accent-2: #04f5ff;
  --magenta: #e90052;
  --good: #00ff87;
  --bad: #ff5c7a;
  --warn: #ffc848;
  --radius: 16px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --font: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1100px 620px at 50% -12%, var(--bg-glow) 0%, transparent 62%),
    radial-gradient(900px 500px at 88% 8%, rgba(233, 0, 82, 0.16) 0%, transparent 60%),
    var(--bg);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

.stage {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

/* ------------------------------------------------------------------ hero */
/* Centred in the viewport until a player is picked, then it slides up out
   of the way so the report gets the room. */
.hero {
  min-height: 82vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: min-height 0.4s ease, padding 0.4s ease;
}

.hero.is-compact {
  min-height: auto;
  padding: 42px 0 8px;
}

.hero__title {
  margin: 0 0 10px;
  font-size: clamp(2.1rem, 6vw, 3.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(96deg, var(--accent) 0%, var(--accent-2) 55%, #b98bff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__subtitle {
  margin: 0 0 34px;
  color: var(--text-dim);
  font-size: clamp(0.95rem, 2vw, 1.12rem);
}

.hero.is-compact .hero__title { font-size: clamp(1.3rem, 3vw, 1.7rem); }
.hero.is-compact .hero__subtitle { display: none; }
.hero.is-compact { margin-bottom: 10px; }

/* ---------------------------------------------------------------- search */
.search {
  position: relative;
  width: min(680px, 100%);
}

.search__input {
  width: 100%;
  padding: 22px 26px;
  font-size: clamp(1.05rem, 2.6vw, 1.35rem);
  font-family: inherit;
  color: var(--text);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.search__input::placeholder { color: #7d7aa0; }

.search__input:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 4px rgba(0, 255, 135, 0.14), var(--shadow);
}

.search__input:disabled { opacity: 0.55; cursor: progress; }

.search__results {
  position: absolute;
  z-index: 20;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  text-align: left;
  background: #17152e;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 348px;
  overflow-y: auto;
}

.search__result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 11px;
  cursor: pointer;
}

.search__result:hover,
.search__result.is-active {
  background: rgba(0, 255, 135, 0.12);
}

.search__result-name { font-weight: 650; }

.search__result-meta {
  margin-left: auto;
  color: var(--text-dim);
  font-size: 0.85rem;
  white-space: nowrap;
}

.search__status {
  margin-top: 18px;
  min-height: 1.2em;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.search__status.is-error { color: var(--bad); }

.pos-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 3px 8px;
  border-radius: 7px;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
}

.pos-pill[data-pos="GKP"] { background: rgba(255, 200, 72, 0.18); color: var(--warn); }
.pos-pill[data-pos="DEF"] { background: rgba(4, 245, 255, 0.16); color: var(--accent-2); }
.pos-pill[data-pos="MID"] { background: rgba(0, 255, 135, 0.16); color: var(--accent); }
.pos-pill[data-pos="FWD"] { background: rgba(233, 0, 82, 0.2); color: #ff5d8f; }

/* ---------------------------------------------------------------- report */
/* minmax(0, 1fr) keeps the single column from being widened by a stubborn
   child such as the season table. */
.report {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

.card {
  min-width: 0;
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(6px);
}

.card__title {
  margin: 0 0 4px;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.card__note {
  margin: 0 0 16px;
  font-size: 0.82rem;
  color: var(--text-dim);
}

/* The caveats under an imported season. Smaller than the note above the
   numbers, because it qualifies them rather than introducing them. */
.card__footnote {
  margin: 14px 0 0;
  font-size: 0.76rem;
  line-height: 1.55;
  color: var(--text-dim);
  opacity: 0.85;
}

/* -------------------------------------------------------------- identity */
.identity {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
}

.identity__photo {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top center;
  background: var(--surface-strong);
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.identity__name {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.identity__meta {
  margin: 6px 0 0;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.identity__headline {
  margin-left: auto;
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
}

.headline-stat { text-align: right; }
.headline-stat__value { font-size: 1.55rem; font-weight: 800; line-height: 1.1; }
.headline-stat__label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-dim);
}

.status-banner {
  margin-top: 16px;
  width: 100%;
  padding: 11px 15px;
  border-radius: 11px;
  font-size: 0.9rem;
  background: rgba(255, 92, 122, 0.13);
  border: 1px solid rgba(255, 92, 122, 0.32);
  color: #ffd0da;
}

.status-banner[data-tone="warn"] {
  background: rgba(255, 200, 72, 0.12);
  border-color: rgba(255, 200, 72, 0.32);
  color: #ffe6b0;
}

.status-banner[data-tone="info"] {
  background: rgba(94, 234, 212, 0.1);
  border-color: rgba(94, 234, 212, 0.28);
  color: #b8f2e6;
}

/* --------------------------------------------------------------- verdict */
.verdict { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }

.verdict__score {
  --score: 50;
  --wheel: var(--accent);
  position: relative;
  width: 108px;
  height: 108px;
  border-radius: 50%;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background:
    conic-gradient(var(--wheel) calc(var(--score) * 1%), rgba(255, 255, 255, 0.08) 0);
}

/* Five bands of twenty, worst to best, so the colour is read before the
   number. The top band is a deeper green than the one below it — better, not
   just brighter. */
.verdict__score[data-band="red"]        { --wheel: #ff4b57; }
.verdict__score[data-band="orange"]     { --wheel: #ff9130; }
.verdict__score[data-band="yellow"]     { --wheel: #ffc848; }
.verdict__score[data-band="green"]      { --wheel: #00ff87; }
.verdict__score[data-band="dark-green"] { --wheel: #0fae5b; }

.verdict__score::after {
  content: '';
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: #14122b;
}

.verdict__score-value {
  position: relative;
  z-index: 1;
  font-size: 1.9rem;
  font-weight: 800;
}

.verdict__rating { margin: 0; font-size: 1.35rem; font-weight: 750; }
.verdict__summary { margin: 6px 0 0; color: var(--text-dim); max-width: 56ch; }

/* ----------------------------------------------------------------- stats */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(148px, 100%), 1fr));
  gap: 12px;
}

.stat {
  padding: 13px 15px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.stat__value { font-size: 1.32rem; font-weight: 750; }

/* Sits where a number would, so it needs to stop reading like one. */
.stat__value[data-missing="true"] {
  font-size: 0.82rem;
  font-weight: 500;
  font-style: italic;
  color: var(--text-dim);
  letter-spacing: 0;
}

.stat__label {
  margin-top: 3px;
  font-size: 0.73rem;
  color: var(--text-dim);
  line-height: 1.35;
}

/* ------------------------------------------------------------ percentile */
.bar-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.4fr) 3fr auto;
  align-items: center;
  gap: 14px;
  padding: 7px 0;
}

.bar-row__label { font-size: 0.88rem; color: var(--text-dim); }
.bar-row__value {
  font-size: 0.88rem;
  font-weight: 700;
  min-width: 62px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Best in the position — worth catching the eye as you scan the column. */
.bar-row__value[data-best="true"] { color: var(--accent); }

/* The pool size is context, not the number being read. */
.bar-row__of { font-weight: 500; opacity: 0.5; }

/* No data behind the stat, so nothing to rank. It spans the bar and the place
   because neither exists — a blank bar would read as "bad", which is a claim
   the numbers do not support. */
.bar-row__missing {
  grid-column: 2 / -1;
  font-size: 0.82rem;
  font-style: italic;
  color: var(--text-dim);
  opacity: 0.7;
}

.bar {
  min-width: 0;
  height: 9px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.bar__fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width 0.5s ease;
}

.bar__fill[data-tier="low"] { background: linear-gradient(90deg, #ff5c7a, #ff8f6b); }
.bar__fill[data-tier="mid"] { background: linear-gradient(90deg, #ffc848, #d6e05c); }

/* --------------------------------------------------------- pros and cons */
/* min() lets the track drop below 300px once the screen is narrower than
   that, instead of overflowing the page. */
.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 20px;
}

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

.point {
  padding: 12px 15px 12px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  border-left: 3px solid var(--good);
}

.point[data-kind="negative"] { border-left-color: var(--bad); }
.point__title { font-weight: 700; font-size: 0.95rem; }
.point__detail { margin-top: 4px; font-size: 0.86rem; color: var(--text-dim); line-height: 1.5; }
.point-list__empty { color: var(--text-dim); font-size: 0.9rem; }

/* ------------------------------------------------------------- playstyle */
.tags { display: flex; flex-wrap: wrap; gap: 10px; }

.tag {
  padding: 8px 14px;
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 650;
  background: rgba(0, 255, 135, 0.1);
  border: 1px solid rgba(0, 255, 135, 0.26);
  cursor: default;
}

.tag__detail {
  display: block;
  margin-top: 3px;
  font-size: 0.76rem;
  font-weight: 400;
  color: var(--text-dim);
  max-width: 34ch;
}

/* -------------------------------------------------------------- fixtures */
.fixtures { display: flex; gap: 10px; flex-wrap: wrap; }

.fixture {
  flex: 1 1 88px;
  min-width: 88px;
  padding: 12px 10px;
  text-align: center;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.fixture[data-fdr="1"], .fixture[data-fdr="2"] { background: rgba(0, 255, 135, 0.16); border-color: rgba(0, 255, 135, 0.3); }
.fixture[data-fdr="3"] { background: rgba(255, 255, 255, 0.07); }
.fixture[data-fdr="4"] { background: rgba(255, 92, 122, 0.15); border-color: rgba(255, 92, 122, 0.28); }
.fixture[data-fdr="5"] { background: rgba(233, 0, 82, 0.28); border-color: rgba(233, 0, 82, 0.45); }

.fixture__gw { font-size: 0.68rem; letter-spacing: 0.06em; color: var(--text-dim); text-transform: uppercase; }
.fixture__opponent { font-size: 1.02rem; font-weight: 750; margin-top: 3px; }
.fixture__venue { font-size: 0.72rem; color: var(--text-dim); margin-top: 2px; }

/* ------------------------------------------------------------ form chart */
.form-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 132px;
  padding-top: 8px;
}

.form-bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; text-align: center; gap: 5px; }

.form-bar__value { font-size: 0.78rem; font-weight: 700; }

.form-bar__fill {
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, var(--accent), rgba(0, 255, 135, 0.28));
  min-height: 3px;
}

.form-bar__fill[data-tone="blank"] { background: rgba(255, 255, 255, 0.12); }
.form-bar__fill[data-tone="poor"] { background: linear-gradient(180deg, #ff5c7a, rgba(255, 92, 122, 0.3)); }
.form-bar__label { font-size: 0.68rem; color: var(--text-dim); }

/* ----------------------------------------------------------------- table */
.table-wrap { max-width: 100%; overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; min-width: 460px; }

th {
  text-align: right;
  padding: 9px 10px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}

td { text-align: right; padding: 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
th:first-child, td:first-child { text-align: left; }

/* ---------------------------------------------------------------- footer */
.footer {
  padding: 26px 20px 34px;
  text-align: center;
  font-size: 0.78rem;
  color: #6f6c92;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* Credit where the numbers came from — visible, not buried. */
.footer__link {
  color: #8f8cb4;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer__link:hover,
.footer__link:focus-visible { color: var(--accent); }

/* ------------------------------------------------------------ responsive */
@media (max-width: 620px) {
  .identity__headline { margin-left: 0; width: 100%; gap: 18px; }
  .headline-stat { text-align: left; }
  .bar-row { grid-template-columns: 1fr; gap: 5px; }
  .bar-row__value { text-align: left; }
  .bar-row__missing { grid-column: 1; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
