/* FPLSensei — a market terminal for footballers, lit like a night match.
 *
 * Layout is mobile-first and widens in two steps. Below 720px it is the
 * single column it always was, with the tab bar at the thumb. From 720px the
 * content stops stretching and the navigation moves to the top, because a
 * bottom bar on a device held in two hands or sat on a desk is reaching for a
 * thumb that is not there. From 1040px the page splits: the squad stays on
 * the left and the advice moves alongside it, so a laptop shows the pitch and
 * the plan at once instead of making you scroll between them.
 */

:root {
  --ink:      #0E1428;
  --panel:    #19203C;
  --raised:   #232C52;
  --line:     #2E3862;
  --chalk:    #EEF1FA;
  --muted:    #8B97BE;
  --rise:     #4ADE9B;
  --fall:     #FF6B7A;
  --flood:    #FFD24A;
  --accent:   #7C6BFF;

  /* Fixture difficulty, 1 (kind) to 5 (brutal) */
  --fd1: #4ADE9B; --fd2: #8ED98A; --fd3: #6C7AA8; --fd4: #E8748A; --fd5: #FF4D6D;

  --display: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --body: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --gap: 12px;
  --radius: 14px;

  /* Depth. Flat panels on a flat ground read as a wireframe; a little
     elevation separates what is a surface from what is the page. */
  --lift-1: 0 1px 2px rgba(0,0,0,.28);
  --lift-2: 0 4px 16px rgba(0,0,0,.32);
  --lift-3: 0 12px 40px rgba(0,0,0,.42);

  --shell: 1180px;   /* widest the content ever gets */
  --rail: 460px;     /* the advice column on large screens */

  /* One stacking scale, declared once. The pitch rows carry a z-index so the
     shirts sit above the turf markings, and an explicit z-index beats `auto`
     whatever the source order — which is how the squad ended up painting over
     a navigation bar that had never been given a layer of its own. */
  --z-pitch: 1;
  --z-sticky: 5;
  --z-nav: 30;
  --z-sheet: 40;
}

* { box-sizing: border-box; }

/* .tabs sets display:flex, which outranks the user-agent rule for [hidden]
   and left the nav on screen during sign-in. Make hidden win everywhere. */
[hidden] { display: none !important; }

body {
  margin: 0;
  padding: 0 16px calc(84px + env(safe-area-inset-bottom));
  /* A faint wash off the top so the page has a light source rather than
     being one flat block of navy. */
  background-image:
    radial-gradient(1200px 520px at 50% -10%, rgba(124,107,255,.10), transparent 70%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  background: var(--ink);
  color: var(--chalk);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* --- Signature: the deadline clock --------------------------------------- */

.clock {
  padding: 22px 0 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.clock__eyebrow {
  font-family: var(--display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
}
.clock__digits {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(34px, 12vw, 52px);
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  color: var(--chalk);
  margin-top: 4px;
}
.clock__digits span {
  font-size: .42em;
  color: var(--accent);
  margin: 0 .5ch 0 .1ch;
}
.clock--urgent .clock__digits { color: var(--flood); }
.clock__meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* --- Onboarding ---------------------------------------------------------- */

.onboard { padding-top: 18vh; max-width: 420px; }
.onboard__title {
  font-family: var(--display);
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -.03em;
  margin: 0;
}
.onboard__lede { color: var(--muted); margin: 6px 0 28px; }

.field { display: block; margin-bottom: 8px; }
.field__label {
  display: block;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.field__input {
  width: 100%;
  padding: 13px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--chalk);
  font-family: var(--mono);
  font-size: 16px;
}
.field__input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hint { font-size: 12px; color: var(--muted); margin: 0 0 18px; }
.hint code { font-family: var(--mono); color: var(--chalk); }

.btn {
  padding: 13px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--raised);
  color: var(--chalk);
  font-family: var(--display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .02em;
  cursor: pointer;
}
.btn--primary { width: 100%; background: var(--accent); border-color: var(--accent); color: #0B0F22; }
.btn:disabled { opacity: .5; cursor: default; }
.btn { transition: transform .12s ease, filter .12s ease; }
@media (hover: hover) {
  .btn:not(:disabled):hover { filter: brightness(1.08); }
  .card:hover { transform: translateY(-1px); box-shadow: var(--lift-2); }
  .spot:not(.spot--empty):hover { transform: translateY(-2px); }
}
.btn:not(:disabled):active { transform: translateY(1px); }
.spot { transition: transform .14s ease; }
.btn:focus-visible { outline: 2px solid var(--flood); outline-offset: 2px; }

.error { color: var(--fall); font-size: 14px; margin-top: 12px; }
.row { display: flex; gap: 8px; margin-bottom: 16px; }
.row .field__input { flex: 1; }

/* --- Sections ------------------------------------------------------------ */

.section-head {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.02em;
  margin: 0 0 14px;
}
.section-head__note {
  display: block;
  font-family: var(--body);
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0;
}

.stack { display: flex; flex-direction: column; gap: var(--gap); }

.manager {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 14px 16px;
  background: var(--panel);
  border-radius: var(--radius);
  margin-bottom: var(--gap);
}
.manager__stat { min-width: 68px; }
.manager__label {
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.manager__value {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

/* --- Player card --------------------------------------------------------- */

.card {
  box-shadow: var(--lift-1);
  border: 1px solid rgba(255,255,255,.04);
  transition: transform .15s ease, box-shadow .15s ease;
  background: var(--panel);
  border-radius: var(--radius);
  padding: 12px 14px;
  border-left: 3px solid transparent;
}
.card--bench { opacity: .62; }
.card--doubt { border-left-color: var(--flood); }
.card--out { border-left-color: var(--fall); }

.card__top { display: flex; align-items: baseline; gap: 8px; }
.card__name { font-family: var(--display); font-weight: 700; font-size: 16px; }
.card__pos {
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--raised);
  color: var(--muted);
  letter-spacing: .06em;
}
.card__badge {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--flood);
  color: #0B0F22;
}
.card__price {
  margin-left: auto;
  font-family: var(--mono);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.card__delta { font-size: 11px; margin-left: 4px; }
.up { color: var(--rise); } .down { color: var(--fall); }

.card__stats {
  display: flex;
  gap: 14px;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.card__news { margin-top: 8px; font-size: 13px; color: var(--flood); }
.card__news--out { color: var(--fall); }

/* Fixture ticker: five blocks, coloured by difficulty */
.ticker { display: flex; gap: 3px; margin-top: 10px; }
.ticker__cell {
  flex: 1;
  padding: 5px 2px;
  border-radius: 5px;
  text-align: center;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  color: #0B0F22;
  letter-spacing: .02em;
}
.ticker__cell[data-fd="1"] { background: var(--fd1); }
.ticker__cell[data-fd="2"] { background: var(--fd2); }
.ticker__cell[data-fd="3"] { background: var(--fd3); color: var(--chalk); }
.ticker__cell[data-fd="4"] { background: var(--fd4); }
.ticker__cell[data-fd="5"] { background: var(--fd5); }
.ticker__cell small { display: block; font-weight: 400; opacity: .75; font-size: 9px; }

/* --- League -------------------------------------------------------------- */

.standing {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: var(--panel);
  border-radius: var(--radius);
}
.standing--you { background: var(--raised); box-shadow: inset 3px 0 0 var(--accent); }
.standing__rank {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 15px;
  min-width: 26px;
  font-variant-numeric: tabular-nums;
}
.standing__names { flex: 1; min-width: 0; }
.standing__team {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.standing__manager { font-size: 12px; color: var(--muted); }
.standing__points { font-family: var(--mono); font-weight: 700; font-variant-numeric: tabular-nums; }
.standing__gw { font-size: 11px; color: var(--muted); text-align: right; }

.empty { color: var(--muted); padding: 28px 0; text-align: center; }

/* --- Tabs ---------------------------------------------------------------- */

.tabs {
  position: fixed;
  inset: auto 0 0;
  display: flex;
  background: rgba(14, 20, 40, .88);
  backdrop-filter: blur(16px) saturate(140%);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: var(--z-nav);
}
.tab {
  flex: 1;
  padding: 14px 4px 16px;
  background: none;
  border: 0;
  color: var(--muted);
  font-family: var(--display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
}
.tab__dot {
  display: block;
  width: 4px; height: 4px;
  margin: 0 auto 6px;
  border-radius: 50%;
  background: transparent;
  transition: background .16s;
}
.tab.is-active { color: var(--chalk); }
.tab.is-active .tab__dot { background: var(--accent); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }

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

/* --- Sign-in alternatives ------------------------------------------------- */

.alt { margin-top: 22px; }
.alt__rule {
  display: flex; align-items: center; gap: 12px;
  color: var(--muted); font-size: 12px; margin-bottom: 16px;
}
.alt__rule::before, .alt__rule::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}
.btn--google {
  display: block; width: 100%; text-align: center;
  text-decoration: none; background: var(--chalk); color: #0B0F22;
  border-color: var(--chalk); margin-bottom: 12px;
}

/* --- Strategy control ---------------------------------------------------- */

.strategy {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 14px 16px 12px;
  margin-bottom: var(--gap);
}
.strategy__top { display: flex; justify-content: space-between; align-items: baseline; }
.strategy__title {
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
}
.strategy__value { font-family: var(--display); font-weight: 700; font-size: 14px; color: var(--accent); }

.strategy__slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px; margin: 14px 0 8px;
  background: linear-gradient(90deg, var(--rise), var(--line) 50%, var(--flood));
  border-radius: 2px;
}
.strategy__slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%;
  background: var(--chalk); border: 3px solid var(--accent); cursor: pointer;
}
.strategy__slider::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--chalk); border: 3px solid var(--accent); cursor: pointer;
}
.strategy__slider:focus-visible { outline: 2px solid var(--flood); outline-offset: 4px; }
.strategy__ends {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--muted);
}
.strategy__note { font-size: 12px; color: var(--muted); margin: 8px 0 0; }

/* --- Plan ---------------------------------------------------------------- */

.plan { display: flex; flex-direction: column; gap: var(--gap); margin-bottom: var(--gap); }

.panel {
  background: var(--panel); border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--lift-2);
  border: 1px solid rgba(255,255,255,.04);
}
.panel__head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 10px;
}
.panel__title {
  font-family: var(--display); font-weight: 700; font-size: 15px;
  letter-spacing: .01em;
}
.panel__meta { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* Captain — the single highest-leverage call of the week */
.captain {
  background: linear-gradient(135deg, var(--raised), var(--panel));
  border: 1px solid var(--flood);
  border-radius: var(--radius);
  padding: 16px;
}
.captain__label {
  font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--flood);
}
.captain__name {
  font-family: var(--display); font-weight: 700; font-size: 26px;
  letter-spacing: -.02em; margin-top: 2px;
}
.captain__line { font-size: 13px; color: var(--muted); margin-top: 4px; }
.captain__line b { color: var(--chalk); font-family: var(--mono); }

/* Formation grid */
.pitch { display: flex; flex-direction: column; gap: 8px; }
.pitch__row { display: flex; gap: 6px; justify-content: center; }
.chip {
  flex: 1; max-width: 92px; padding: 7px 4px;
  background: var(--raised); border-radius: 9px; text-align: center;
}
.chip--armband { box-shadow: inset 0 0 0 1.5px var(--flood); }
.chip__name {
  font-size: 11px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chip__ep {
  font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--accent);
}

/* Transfer suggestion */
.move { background: var(--panel); border-radius: var(--radius); padding: 13px 15px; }
.move__swap {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-family: var(--display); font-weight: 700; font-size: 15px;
}
.move__arrow { color: var(--accent); }
.move__gain {
  margin-left: auto; font-family: var(--mono); font-size: 13px;
  font-weight: 700; color: var(--rise);
}
.move__reason { font-size: 13px; color: var(--muted); margin-top: 6px; }
.move__money { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 6px; }

.verdict {
  border-left: 3px solid var(--accent);
  background: var(--raised);
  border-radius: var(--radius);
  padding: 13px 15px;
  font-size: 14px;
}
.verdict--hold { border-left-color: var(--muted); }

.caveats { font-size: 11px; color: var(--muted); line-height: 1.6; padding: 4px 2px 0; }
.caveats li { margin-bottom: 4px; }

/* --- Draft builder: the pitch -------------------------------------------- */

.draftbar, .squadbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: rgba(14, 20, 40, .97);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 12px 0 10px;
  margin-bottom: 10px;
}
.draftbar__stats { display: flex; align-items: center; gap: 18px; }
.draftbar__stat { min-width: 56px; }
.draftbar__label {
  font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
}
.draftbar__value {
  font-family: var(--mono); font-weight: 700; font-size: 16px;
  font-variant-numeric: tabular-nums; margin-top: 2px;
}
.draftbar__value--over { color: var(--fall); }
.draftbar__value--done { color: var(--rise); }
.draftbar__note { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.draftbar__note--error { color: var(--fall); }
.draftbar__note--ok { color: var(--rise); }

/* Green pitch with the usual markings, drawn rather than fetched. */
.turf {
  position: relative;
  box-shadow: var(--lift-3);
  border-radius: var(--radius);
  padding: 14px 6px 18px;
  background:
    linear-gradient(180deg, #12703F 0%, #0F5F35 100%);
  background-size: 100% 100%;
  overflow: hidden;
}
/* Mown stripes */
.turf::before {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    180deg,
    rgba(255,255,255,.05) 0 14.28%,
    rgba(0,0,0,.04) 14.28% 28.57%);
  pointer-events: none;
}
/* Halfway line and centre circle */
.turf::after {
  content: '';
  position: absolute;
  left: 50%; top: 0;
  width: 74px; height: 74px;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255,255,255,.16);
  border-radius: 50%;
  pointer-events: none;
}

.turf__row {
  position: relative;
  z-index: var(--z-pitch);
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 14px;
}
.turf__row:last-child { margin-bottom: 0; }
.turf__hint { font-size: 12px; color: var(--muted); text-align: center; margin: 10px 0 0; }

/* A single shirt slot */
.spot {
  /* The captain badge and the availability flag are absolutely positioned
     children. Without this they anchor to .turf__row instead and render over
     a neighbouring player's shirt. */
  position: relative;
  flex: 1 1 0;
  max-width: 82px;
  min-width: 0;
  padding: 0;
  background: none;
  border: 0;
  color: var(--chalk);
  font: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.spot:focus-visible { outline: 2px solid var(--flood); outline-offset: 3px; border-radius: 8px; }

.spot__shirt {
  position: relative;
  width: 46px; height: 46px;
  margin-bottom: 4px;
}

/* Both shirt sizes stack their artwork over the drawn fallback in one cell,
   so the fallback only ever shows when FPL's PNG fails to load.
   Sizes are explicit: `place-items: center` sizes grid items to their content,
   so a percentage width on the image resolves against a box the image is
   itself defining, and the shirt renders at natural size over everything. */
.spot__shirt, .pick__shirt { display: grid; place-items: center; overflow: hidden; }
.spot__shirt > *, .pick__shirt > * { grid-area: 1 / 1; }
.spot__shirt img { width: 46px; height: 46px; object-fit: contain; }
.pick__shirt img { width: 28px; height: 28px; object-fit: contain; }

/* Drawn fallback jersey. */
.spot__jersey {
  border-radius: 5px 5px 7px 7px;
  background: var(--jersey, #6C7AA8);
  box-shadow: inset 0 -5px 0 rgba(0,0,0,.14);
}
.spot__shirt .spot__jersey { width: 34px; height: 34px; }
.pick__shirt .spot__jersey { width: 21px; height: 21px; }

.spot__name {
  width: 100%;
  font-size: 11px; font-weight: 600;
  text-align: center;
  background: var(--chalk);
  color: #0B0F22;
  border-radius: 3px 3px 0 0;
  padding: 2px 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.spot__meta {
  width: 100%;
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  text-align: center;
  background: var(--ink);
  border-radius: 0 0 3px 3px;
  padding: 2px 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Empty slot: dashed outline and a plus. */
.spot--empty .spot__jersey {
  background: rgba(255,255,255,.07);
  border: 1.5px dashed rgba(255,255,255,.4);
  box-shadow: none;
  display: grid; place-items: center;
  color: rgba(255,255,255,.75); font-size: 18px; font-weight: 700;
}
.spot--empty .spot__name { background: rgba(255,255,255,.16); color: var(--chalk); }
.spot--empty .spot__meta { background: rgba(0,0,0,.3); color: rgba(255,255,255,.7); }

/* Availability flag on the shirt, same language as the squad cards. */
.spot__flag {
  position: absolute;
  top: -2px; right: 0;
  width: 15px; height: 15px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 10px; font-weight: 700;
  color: #0B0F22;
  background: var(--flood);
}
.spot__flag--out { background: var(--fall); color: #fff; }

/* --- Player picker sheet -------------------------------------------------- */

.sheet { position: fixed; inset: 0; z-index: var(--z-sheet); }
.sheet__scrim { position: absolute; inset: 0; background: rgba(6, 9, 20, .68); }
.sheet__panel {
  position: absolute;
  inset: auto 0 0;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--ink);
  border-top: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  padding: 8px 16px calc(12px + env(safe-area-inset-bottom));
}
.sheet__grip {
  width: 38px; height: 4px; border-radius: 2px;
  background: var(--line); margin: 2px auto 8px;
}
.sheet__head { display: flex; align-items: center; gap: 10px; }
.sheet__title { font-family: var(--display); font-size: 18px; margin: 0; flex: 1; }
.sheet__close {
  background: none; border: 0; color: var(--muted);
  font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.sheet__close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sheet__controls { display: flex; gap: 8px; margin: 10px 0 8px; }
.sheet__controls .field__input { flex: 1; min-width: 0; }
.sheet__controls select { flex: 0 1 46%; }
.sheet__meta {
  font-family: var(--mono); font-size: 11px; color: var(--muted); padding-bottom: 6px;
}
.sheet__list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: 6px;
  padding-bottom: 8px;
}

/* A row in the picker */
.pick {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 11px; text-align: left;
  background: var(--panel); border: 0; border-left: 3px solid transparent;
  border-radius: 11px; color: var(--chalk); font: inherit; cursor: pointer;
}
.pick--doubt { border-left-color: var(--flood); }
.pick--out { border-left-color: var(--fall); }
.pick--picked { opacity: .45; }
.pick:disabled { cursor: default; }
.pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pick__shirt { width: 28px; height: 28px; flex-shrink: 0; }
.pick__body { flex: 1; min-width: 0; }
.pick__name { font-family: var(--display); font-weight: 700; font-size: 14px; }
.pick__sub { font-size: 11px; color: var(--muted); margin-top: 1px; }
.pick__blocked { font-size: 11px; color: var(--flood); margin-top: 2px; }
.pick__numbers { text-align: right; flex-shrink: 0; }
.pick__ep {
  font-family: var(--mono); font-weight: 700; font-size: 13px; color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.pick__price {
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Banner shown on My team when the squad came from a draft, not from FPL. */
.provenance {
  border-left: 3px solid var(--flood);
  background: var(--raised);
  border-radius: var(--radius);
  padding: 12px 15px;
  font-size: 13px;
  margin-bottom: var(--gap);
}
.provenance b { font-family: var(--display); }
.provenance__cta {
  background: none; border: 0; padding: 0; margin-top: 4px;
  color: var(--accent); font: inherit; text-decoration: underline; cursor: pointer;
}

body.is-locked { overflow: hidden; }

/* --- Bench order ----------------------------------------------------------- */

.benchlist { display: flex; flex-direction: column; gap: 6px; }
.benchrow {
  display: flex; align-items: center; gap: 10px;
  background: var(--raised); border-radius: 9px; padding: 8px 10px;
}
.benchrow--gk { border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 10px; }
.benchrow__order {
  flex-shrink: 0; width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 50%; background: var(--panel);
  font-family: var(--mono); font-size: 10px; font-weight: 700; color: var(--muted);
}
.benchrow--gk .benchrow__order { background: var(--accent); color: #0B0F22; }
.benchrow__name { font-family: var(--display); font-weight: 700; font-size: 13px; flex-shrink: 0; }
.benchrow__pos { font-size: 11px; color: var(--muted); flex: 1; min-width: 0; }
.benchrow__ep {
  font-family: var(--mono); font-weight: 700; font-size: 12px; color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.benchrow__flag {
  font-size: 9px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--flood); border: 1px solid var(--flood); border-radius: 4px;
  padding: 1px 4px; flex-shrink: 0;
}
.benchlist__note { font-size: 11px; color: var(--muted); line-height: 1.5; margin: 8px 2px 0; }

/* --- Signed in, no team yet ------------------------------------------------ */

.signedin {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--raised); border-radius: var(--radius);
  padding: 10px 14px; margin: 0 0 20px; font-size: 13px;
}
.signedin__dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--rise);
  flex-shrink: 0;
}
.signedin b { font-weight: 600; }
.signedin__out {
  margin-left: auto; background: none; border: 0; padding: 0;
  color: var(--muted); font: inherit; text-decoration: underline; cursor: pointer;
}

/* --- Prediction history ---------------------------------------------------- */

.scorecard { display: flex; gap: 18px; flex-wrap: wrap; }
.scorecard__cell { min-width: 88px; }
.scorecard__label {
  font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
}
.scorecard__value {
  font-family: var(--mono); font-weight: 700; font-size: 22px;
  font-variant-numeric: tabular-nums; margin-top: 2px;
}
.scorecard__value.up { color: var(--rise); }
.scorecard__value.down { color: var(--fall); }
.scorecard__foot { font-size: 11px; color: var(--muted); margin-top: 1px; }

.gwrow {
  background: var(--panel); border-radius: var(--radius);
  padding: 12px 14px; border-left: 3px solid var(--accent);
}
.gwrow--pending { border-left-color: var(--line); opacity: .75; }
.gwrow__head {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  font-family: var(--display); font-size: 15px;
}
.gwrow__badge {
  font-size: 10px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--line);
  border-radius: 4px; padding: 2px 6px; white-space: nowrap;
}
.gwrow__badge--up { color: var(--rise); border-color: var(--rise); }
.gwrow__badge--down { color: var(--flood); border-color: var(--flood); }
.gwrow__nums {
  display: flex; gap: 14px; flex-wrap: wrap; margin: 8px 0 6px;
  font-size: 12px; color: var(--muted);
}
.gwrow__nums b { font-family: var(--mono); font-size: 14px; color: var(--chalk); }
.gwrow__line { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* --- Chips ----------------------------------------------------------------- */

.chiprow {
  background: var(--raised); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 6px;
  border-left: 3px solid var(--line);
}
.chiprow--play { border-left-color: var(--rise); }
.chiprow__top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.chiprow__name { font-family: var(--display); font-weight: 700; font-size: 14px; }
.chiprow__verdict {
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--line);
  border-radius: 4px; padding: 2px 6px; white-space: nowrap;
}
.chiprow__verdict--play { color: var(--rise); border-color: var(--rise); }
.chiprow__reason { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.45; }
.chiplist__outlook {
  font-size: 11px; color: var(--muted); line-height: 1.55;
  margin: 10px 0 0; padding-left: 16px;
}

/* The squad a wildcard or free hit would actually build */
.chiprow__build { margin-top: 8px; font-size: 12px; }
.chipsquad {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.chipsquad__head {
  display: flex; flex-wrap: wrap; gap: 4px 10px;
  align-items: baseline; justify-content: space-between;
}
.chipsquad__formation {
  font-family: var(--mono); font-weight: 700; font-size: 12px;
}
.chipsquad__money { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.chipsquad__swaps { font-size: 12px; color: var(--muted); margin: 4px 0 8px; }
.chipsquad__bench { font-size: 11px; color: var(--muted); margin: 8px 0 0; line-height: 1.5; }
.chipsquad__diff { margin-top: 8px; display: grid; gap: 4px; }
.chipsquad__diffrow { font-size: 11px; line-height: 1.5; color: var(--muted); }
.chipsquad__out, .chipsquad__in {
  display: inline-block; min-width: 30px;
  font-family: var(--mono); font-weight: 700; font-size: 10px;
  text-transform: uppercase; letter-spacing: .06em;
}
.chipsquad__out { color: var(--fall); }
.chipsquad__in { color: var(--rise); }
.chipsquad__caveats {
  font-size: 11px; color: var(--muted); line-height: 1.55;
  margin: 10px 0 0; padding-left: 16px;
}
.chiplist__note { font-size: 11px; color: var(--muted); margin: 8px 0 0; }

.draftbar__actions { display: flex; gap: 8px; margin-top: 10px; }
.btn--auto {
  flex: 1;
  padding: 9px 12px;
  font-size: 13px;
  background: var(--accent);
  border-color: var(--accent);
  color: #0B0F22;
  white-space: nowrap;
}
.draftbar__reset { flex-shrink: 0; padding: 9px 14px; font-size: 13px; }

/* --- Live score ------------------------------------------------------------ */

.live {
  background: linear-gradient(135deg, var(--raised), var(--panel));
  box-shadow: var(--lift-2);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: var(--gap);
}
.live--final { border-color: var(--rise); }
.live__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.live__label {
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent);
}
.live--final .live__label { color: var(--rise); }
.live__total {
  font-family: var(--display); font-weight: 700; font-size: 40px;
  line-height: 1; letter-spacing: -.02em; margin-top: 4px;
}
.live__sub { font-size: 12px; color: var(--muted); margin-top: 5px; }
.live__refresh { flex-shrink: 0; padding: 8px 14px; font-size: 13px; }
.live__bar {
  height: 4px; border-radius: 2px; background: var(--line);
  margin-top: 12px; overflow: hidden;
}
.live__fill {
  height: 100%; background: var(--accent); border-radius: 2px;
  transition: width .3s ease;
}
.live--final .live__fill { background: var(--rise); }

/* Shirts mid-gameweek */
.spot--played .spot__meta { background: var(--rise); color: #0B0F22; font-weight: 700; }
.spot--yetto .spot__meta { opacity: .55; }
/* On the bench: a real score, but dimmed to read as "didn't count" rather
   than "blanked" — the shirt itself fades slightly, distinct from a played
   starter (highlighted) or one still to play (meta-only dim). */
.spot--bench .spot__shirt { opacity: .6; }
.spot--bench .spot__meta { opacity: .7; }
.spot__cap {
  position: absolute; top: -2px; left: 0;
  width: 17px; height: 17px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 9px; font-weight: 700;
  background: var(--flood); color: #0B0F22;
}

/* ==========================================================================
   Responsive layout
   ========================================================================== */

/* The shell keeps line lengths readable on wide screens. Without it the
   squad cards stretch to 1900px and the eye has to travel the whole way. */
/* width:100% matters once body becomes a flex column: `margin-inline:auto`
   on a flex item shrink-wraps it to its content and centres that, which
   collapsed the clock into a centred stub instead of a full-width header. */
.clock, #main, .tabs__inner {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
}

/* --- Tablet and up: navigation to the top ---------------------------------
   A fixed bottom bar is right for a thumb and wrong for everything else. */
@media (min-width: 720px) {
  body {
    padding: 0 24px 48px;
    /* The nav sits after <main> in the source, which is right for a phone —
       a bottom bar belongs last. Sticking it to the top on a wider screen
       needs it re-ordered visually, not moved in the markup, so the reading
       order stays sensible for anything not looking at the CSS. */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }
  #tabs  { order: -2; }
  .clock { order: -1; }
  #main  { order: 0; }

  .tabs {
    /* The base rule sets `inset: auto 0 0`, so bottom has to be cleared
       explicitly or the bar stays pinned to the foot of the screen. */
    position: sticky;
    inset: 0 auto auto;
    /* Full-bleed across the viewport while its contents stay on the shell */
    margin-inline: -24px;
    padding-inline: 24px;
    border-top: 0;
    border-bottom: 1px solid var(--line);
    padding-bottom: 0;
    justify-content: flex-start;
    gap: 4px;
    z-index: var(--z-nav);
  }
  .tab {
    flex: 0 0 auto;
    padding: 16px 20px 14px;
    font-size: 13px;
    border-bottom: 2px solid transparent;
  }
  .tab__dot { display: none; }
  .tab.is-active { border-bottom-color: var(--accent); }

  .clock { padding-top: 26px; }
  .clock__digits { font-size: 56px; }

  /* Two-up for the squad cards — 15 of them in one column is a long scroll */
  #squadList {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--gap);
  }
  #squadList .section-head { grid-column: 1 / -1; }

  .sheet__panel {
    inset: auto 50% 0 auto;
    transform: translateX(50%);
    width: min(560px, 92vw);
    border-radius: 18px 18px 0 0;
  }
}

/* --- Laptop: squad and advice side by side -------------------------------- */
@media (min-width: 1040px) {
  #view-team {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--rail);
    grid-template-areas:
      "live    plan"
      "manager plan"
      "pitch   plan"
      "hint    plan"
      "bar     plan"
      "squad   plan";
    column-gap: 24px;
    align-items: start;
  }
  #livePanel   { grid-area: live; }
  #managerBar  { grid-area: manager; }
  #draftPitch  { grid-area: pitch; }
  #pitchHint   { grid-area: hint; }
  #draftBar    { grid-area: bar; position: static; }
  #squadList   { grid-area: squad; }

  /* The advice is one column, and it sticks so it stays beside the squad it
     is about instead of scrolling away from it. */
  .advice {
    grid-area: plan;
    align-self: start;
    position: sticky;
    top: 68px;
    max-height: calc(100vh - 88px);
    overflow-y: auto;
    scrollbar-width: thin;
    padding-right: 4px;
  }
  .advice #planHead { margin-top: 0; }

  #squadList { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .turf { padding: 20px 12px 24px; }
  .spot { max-width: 104px; }
}

/* --- Large desktop: three squad cards abreast ----------------------------- */
@media (min-width: 1400px) {
  #squadList { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Tab bar inner rail, so navigation lines up with the content shell */
.tabs__inner { display: flex; width: 100%; }
@media (max-width: 719px) { .tabs__inner { flex: 1; } }

.onboard__logo {
  display: block;
  width: 72px; height: 72px;
  border-radius: 18px;
  margin-bottom: 18px;
  box-shadow: var(--lift-2);
}

/* The sign-in screen is a landing page, not a column of content — on a wide
   screen an 420px block pinned to the left edge reads as a rendering fault. */
@media (min-width: 720px) {
  #view-signin { display: grid; place-items: center; min-height: 72vh; }
  .onboard { padding-top: 0; text-align: center; }
  .onboard__logo { margin-inline: auto; width: 88px; height: 88px; }
  .onboard__title { font-size: 44px; }
  .onboard .hint, .onboard .field__label { text-align: left; }
}

/* ==========================================================================
   Theme: Broadcast
   --------------------------------------------------------------------------
   Sports-television graphics rather than dashboard: acid yellow on near
   black, italic display numerals, and panels cut on the diagonal the way a
   score bug is. Everything below is either a token swap or a small
   structural flourish — the layout is untouched, so both themes stay in step.
   ========================================================================== */

:root[data-theme="broadcast"] {
  --ink:      #080B14;
  --panel:    #111726;
  --raised:   #182034;
  --line:     #232C45;
  --chalk:    #FFFFFF;
  --muted:    #8494B5;
  --accent:   #E8FF4A;
  --flood:    #E8FF4A;
  --rise:     #48F5A0;
  --fall:     #FF5C72;

  --display: 'Archivo', ui-sans-serif, system-ui, sans-serif;
  --body: 'Archivo', ui-sans-serif, system-ui, sans-serif;

  --fd1: #48F5A0; --fd2: #A8E86A; --fd3: #6C7AA8; --fd4: #FF8A7A; --fd5: #FF4D6D;
}

/* The wash goes yellow, and drops to a whisper — acid yellow at the same
   strength as the purple would tint the whole page. */
:root[data-theme="broadcast"] body {
  background-image:
    radial-gradient(1200px 520px at 50% -10%, rgba(232,255,74,.07), transparent 70%);
}

/* Numerals lean, the way broadcast score bugs do */
:root[data-theme="broadcast"] .clock__digits,
:root[data-theme="broadcast"] .live__total,
:root[data-theme="broadcast"] .captain__name,
:root[data-theme="broadcast"] .onboard__title {
  font-style: italic;
  font-weight: 800;
  letter-spacing: -.03em;
}

/* The live score is the score bug: cut corner, hard rule down the left */
:root[data-theme="broadcast"] .live {
  background: linear-gradient(100deg, #151D33, #0E1424);
  border: 0;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 16px 100%);
  padding-left: 26px;
}
:root[data-theme="broadcast"] .live__total { color: var(--accent); }
:root[data-theme="broadcast"] .live__label { color: var(--accent); }
:root[data-theme="broadcast"] .live--final { border-left-color: var(--rise); }
:root[data-theme="broadcast"] .live--final .live__total,
:root[data-theme="broadcast"] .live--final .live__label { color: var(--rise); }

/* Panels get a colour-bar edge instead of an all-round border */
:root[data-theme="broadcast"] .panel,
:root[data-theme="broadcast"] .manager,
:root[data-theme="broadcast"] .squadbar {
  border: 0;
  border-left: 3px solid var(--line);
  border-radius: 0 var(--radius) var(--radius) 0;
}
:root[data-theme="broadcast"] .captain { border: 1px solid var(--accent); }

/* Yellow on white is unreadable, so anything sitting on the accent flips */
:root[data-theme="broadcast"] .btn--primary,
:root[data-theme="broadcast"] .btn--auto,
:root[data-theme="broadcast"] .spot--played .spot__meta,
:root[data-theme="broadcast"] .spot__cap,
:root[data-theme="broadcast"] .benchrow--gk .benchrow__order {
  background: var(--accent);
  border-color: var(--accent);
  color: #080B14;
}

/* Turf desaturated so it stops competing with the yellow */
:root[data-theme="broadcast"] .turf {
  background: linear-gradient(180deg, #123C22, #0B2616);
}

/* Tabs read as a broadcast strip: the active one is a solid block */
:root[data-theme="broadcast"] .tab.is-active {
  background: var(--accent);
  color: #080B14;
}
:root[data-theme="broadcast"] .tab.is-active .tab__dot { background: #080B14; }
@media (min-width: 720px) {
  :root[data-theme="broadcast"] .tab.is-active { border-bottom-color: var(--accent); }
}

/* --- Theme switch --------------------------------------------------------- */
/* Sits in the header, which is at the top of every layout. Anchored to the
   nav instead it floated over the pitch on a phone, where the nav is at the
   foot of the screen. */
.clock { position: relative; }
.themeswitch {
  position: absolute;
  top: 22px;
  right: 0;
  background: none;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--muted);
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 6px 12px;
  cursor: pointer;
}
.themeswitch:hover { color: var(--chalk); border-color: var(--accent); }
.themeswitch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }


/* --- Projection chart ------------------------------------------------------
   The model's five-gameweek output, drawn instead of summarised. Bars are
   scaled against the best week in the run, so the shape shows the fixture
   swing; the colour is the difficulty of that specific fixture. */
.proj { margin-top: 10px; }
.proj__bars {
  display: flex; align-items: flex-end; gap: 3px;
  height: 30px; padding: 0 1px;
  border-bottom: 1px solid var(--line);
}
/* One colour, one variable. The ticker directly above already encodes
   difficulty, so repeating it here made the chart read as a second ticker
   row rather than as the projection it is. Height carries the meaning; the
   bars are inset from the ticker cells so the two are visibly different
   objects sharing an axis. */
.proj__bar {
  flex: 1; min-height: 3px;
  border-radius: 2px 2px 0 0;
  /* A solid dim colour rather than a faded accent: acid yellow at low opacity
     over navy turns olive, which reads as a different hue rather than a
     quieter one. */
  background: var(--line);
  transform: scaleX(.6);
  transition: background .15s ease;
}
.proj__bar--peak { background: var(--accent); }
@media (hover: hover) { .proj__bar:hover { background: var(--muted); } }
@media (hover: hover) { .proj__bar--peak:hover { background: var(--accent); filter: brightness(1.15); } }

.proj__foot {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 5px;
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted);
}
.proj__foot b {
  font-family: var(--mono); font-size: 13px;
  letter-spacing: 0; text-transform: none; color: var(--accent);
}

/* ==========================================================================
   Density and rhythm
   --------------------------------------------------------------------------
   Every surface was the same rounded rectangle: same radius, same fill, same
   padding, top to bottom. The eye had nothing to grab, so a long screen read
   as one undifferentiated stack. These rules give the page three tiers rather
   than one — a hero, ordinary panels, and quiet inset rows — which does more
   for perceived quality than any change of hue.
   ========================================================================== */

/* Tier 1 — the hero. Bigger radius, more air, the strongest elevation. */
.live {
  border-radius: 20px;
  padding: 20px 22px;
}
.live__total { font-size: 52px; }

/* Tier 2 — ordinary panels. Unchanged, but now clearly not the hero. */

/* Tier 3 — quiet rows. Inset, flatter, no shadow: these are lists, not cards. */
.benchrow, .chiprow, .move {
  box-shadow: none;
  background: color-mix(in srgb, var(--panel) 70%, transparent);
}

/* Section headings earn space above them so panels group under a label
   instead of running together. */
.section-head { margin-top: 26px; }
.section-head:first-child { margin-top: 0; }

/* The captain is the single highest-leverage call of the week and should not
   look like the transfer list. */
.captain { padding: 20px 22px; border-radius: 18px; }
.captain__name { font-size: 30px; }

/* Squad cards tighten up: they are a scannable list, not a set of documents */
.card { padding: 12px 14px; }
.card__stats { font-size: 11px; }

@media (min-width: 720px) {
  .live { padding: 24px 26px; }
  .live__total { font-size: 60px; }
  .captain__name { font-size: 34px; }
}

/* --- What moved since the last look ---------------------------------------
   Driven by diffing one refresh against the previous response, so it costs
   nothing when nobody is looking. The flash runs once on render rather than
   looping: a permanently pulsing shirt stops being a signal. */
@keyframes spotGain {
  0%   { box-shadow: 0 0 0 0 var(--rise); transform: translateY(0); }
  35%  { box-shadow: 0 0 0 3px var(--rise); transform: translateY(-4px); }
  100% { box-shadow: 0 0 0 0 transparent; transform: translateY(0); }
}
.spot--gained .spot__shirt {
  border-radius: 8px;
  animation: spotGain 1.5s ease-out 1;
}
.spot__gain {
  position: absolute;
  top: -4px; right: -2px;
  background: var(--rise);
  color: #06210F;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  animation: gainPop 1.5s ease-out 1 both;
}
@keyframes gainPop {
  0%   { opacity: 0; transform: translateY(6px) scale(.8); }
  20%  { opacity: 1; transform: translateY(0) scale(1); }
  80%  { opacity: 1; }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.live__sub--gained { color: var(--rise); }

@media (prefers-reduced-motion: reduce) {
  .spot--gained .spot__shirt, .spot__gain { animation: none; }
}

/* --- Team sections --------------------------------------------------------- */

.segbar {
  display: flex;
  gap: 4px;
  background: var(--panel);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: var(--gap);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}
.seg {
  flex: 1;
  padding: 9px 6px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--muted);
  font-family: var(--display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .04em;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.seg.is-active { background: var(--accent); color: #0B0F22; }
.seg:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Above the split, the grid already shows everything side by side, so the
   panes must stop being boxes or they would each become a grid cell. */
@media (min-width: 1040px) {
  .segbar { display: none; }
  .pane { display: contents; }
}

/* ==========================================================================
   Theme: Stadium
   --------------------------------------------------------------------------
   The Live screen gives itself over to the pitch. No panels, no cards: the
   score and the captain float above the grass as a heads-up display, the way
   a broadcast overlays a match rather than boxing it.
   Plan and Squad keep the conventional layout — they are reading tasks, and a
   heads-up display is a poor place to compare fifteen players — so only the
   palette carries across to them.
   ========================================================================== */

:root[data-theme="stadium"] {
  --ink:      #06120C;
  --panel:    #0C1C13;
  --raised:   #12291C;
  --line:     #1E3A28;
  --chalk:    #F2FBF5;
  --muted:    #8FB39D;
  --accent:   #E8FF4A;
  --flood:    #FFD24A;
  --rise:     #5BF2A0;
  --fall:     #FF6B7A;

  --display: 'Archivo', ui-sans-serif, system-ui, sans-serif;
  --body: 'Inter', ui-sans-serif, system-ui, sans-serif;
}
:root[data-theme="stadium"] body {
  background-image:
    radial-gradient(900px 420px at 50% -8%, rgba(91,242,160,.10), transparent 70%);
}
/* A compact header buys the pitch the room it needs. The full countdown is
   still on Plan, which is where a deadline actually matters. */
:root[data-theme="stadium"] .clock { padding: 12px 0 10px; margin-bottom: 10px; }
:root[data-theme="stadium"] .clock__digits { font-size: 28px; }
:root[data-theme="stadium"] .clock__digits span { font-size: 13px; }
:root[data-theme="stadium"] .clock__meta { display: none; }
:root[data-theme="stadium"] .segbar { margin-bottom: 0; }

:root[data-theme="stadium"] .clock__digits,
:root[data-theme="stadium"] .live__total,
:root[data-theme="stadium"] .dock__name {
  font-style: italic; font-weight: 800; letter-spacing: -.03em;
}

/* --- The pitch takes the screen ------------------------------------------- */
:root[data-theme="stadium"] .pane--live { position: relative; }

:root[data-theme="stadium"] .turf {
  /* Escapes the body gutter so the grass runs to both edges */
  margin-inline: -16px;
  border-radius: 0;
  /* Sized to what is actually left after the header, the section control and
     the tab bar, so the whole pitch — heads-up display and dock included —
     lands inside one screen instead of hiding the dock under the nav. */
  min-height: calc(100dvh - 234px);
  /* Top clears the heads-up display, bottom clears the dock. Traded against
     each other rather than added, so the pitch still fits one screen. */
  padding: 122px 10px 104px;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  background:
    radial-gradient(120% 70% at 50% 0%, #1B5E33 0%, #0D3A20 48%, #06180E 100%);
}
/* Full markings rather than a single centre circle */
:root[data-theme="stadium"] .turf::after {
  content: '';
  position: absolute;
  inset: 14px;
  border: 2px solid rgba(255,255,255,.16);
  border-radius: 2px;
  transform: none;
  width: auto; height: auto;
  background:
    linear-gradient(rgba(255,255,255,.16), rgba(255,255,255,.16)) center/100% 2px no-repeat,
    radial-gradient(circle at 50% 50%, transparent 58px, rgba(255,255,255,.16) 58px,
                    rgba(255,255,255,.16) 60px, transparent 60px);
  pointer-events: none;
}
:root[data-theme="stadium"] .turf__row { margin-bottom: 0; }

/* --- Score and refresh float as a heads-up display ------------------------ */
:root[data-theme="stadium"] .live {
  position: absolute;
  top: 14px; left: 6px; right: 6px;
  background: none;
  border: 0;
  box-shadow: none;
  padding: 0;
  z-index: 4;
}
:root[data-theme="stadium"] .live__head > div:first-child {
  background: rgba(4,12,7,.72);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 16px;
  padding: 9px 15px;
}
:root[data-theme="stadium"] .live__total { font-size: 38px; color: var(--accent); }
:root[data-theme="stadium"] .live__label { color: var(--rise); }
:root[data-theme="stadium"] .live__sub { font-size: 11px; }
:root[data-theme="stadium"] .live__refresh {
  background: rgba(4,12,7,.72);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.14);
}
:root[data-theme="stadium"] .live__bar { display: none; }

/* Manager identity is not a matchday concern; it lives on Plan instead */
:root[data-theme="stadium"] .pane--live #managerBar { display: none; }

/* --- Captain dock --------------------------------------------------------- */
.dock {
  display: none;
  width: 100%;
  text-align: left;
  border: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
:root[data-theme="stadium"] .dock {
  display: block;
  position: absolute;
  left: 12px; right: 12px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  background: rgba(4,12,7,.80);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 18px;
  padding: 12px 16px;
  z-index: 4;
}
.dock__label {
  display: block;
  font-size: 9px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--rise);
}
.dock__name { display: block; font-size: 21px; margin-top: 2px; }
.dock__row {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 6px; font-size: 11px; color: var(--muted);
}
.dock__more { color: var(--accent); font-weight: 700; }

/* Shirts need to hold their own against the grass */
:root[data-theme="stadium"] .spot__shirt img { filter: drop-shadow(0 6px 10px rgba(0,0,0,.55)); }
:root[data-theme="stadium"] .spot__name {
  background: none; color: var(--chalk); text-shadow: 0 1px 3px rgba(0,0,0,.9);
  font-size: 11px;
}
:root[data-theme="stadium"] .spot__meta {
  background: none; color: var(--accent);
  text-shadow: 0 1px 3px rgba(0,0,0,.9); font-weight: 700;
}
:root[data-theme="stadium"] .spot--played .spot__meta { background: none; color: var(--rise); }
:root[data-theme="stadium"] .turf__hint { display: none; }

/* Buttons on the accent need dark text, same as Broadcast */
:root[data-theme="stadium"] .btn--primary,
:root[data-theme="stadium"] .btn--auto,
:root[data-theme="stadium"] .seg.is-active,
:root[data-theme="stadium"] .spot__cap { background: var(--accent); border-color: var(--accent); color: #06120C; }
:root[data-theme="stadium"] .tab.is-active { color: var(--accent); }
:root[data-theme="stadium"] .tab.is-active .tab__dot { background: var(--accent); }

@media (min-width: 720px) {
  :root[data-theme="stadium"] .turf { margin-inline: -24px; }
}
/* On the wide split the pitch shares the row with the advice column, so it
   goes back to being a panel rather than taking the whole screen. */
@media (min-width: 1040px) {
  :root[data-theme="stadium"] .turf {
    margin-inline: 0; border-radius: var(--radius);
    min-height: 0; padding: 20px 12px 24px;
  }
  :root[data-theme="stadium"] .live { position: static; }
  :root[data-theme="stadium"] .dock { position: static; margin-top: var(--gap); }
  :root[data-theme="stadium"] .pane--live #managerBar { display: flex; }
}

/* --- Score breakdown tooltip ----------------------------------------------
   The panel keeps the number; this holds everything that explains it. Worth
   the extra tap: the live score is glanced at constantly and read closely
   rarely, so the detail should not be paying rent on the face of the panel. */
.live__totalrow { display: flex; align-items: center; gap: 9px; }

.info {
  width: 21px; height: 21px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: none;
  color: var(--muted);
  font-family: var(--display);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.info:hover, .info[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); }
.info:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.info__pop {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: min(300px, calc(100vw - 44px));
  z-index: 20;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 15px;
  box-shadow: var(--lift-3);
  font-size: 12px;
}
.live { position: relative; }

.info__title {
  font-family: var(--display); font-weight: 700; font-size: 13px;
  margin-bottom: 9px;
}
.info__row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 3px 0; color: var(--muted);
}
.info__row b { font-family: var(--mono); color: var(--chalk); font-weight: 700; }
.info__row b.up { color: var(--rise); }
.info__head {
  font-size: 9px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted);
  margin: 10px 0 4px; padding-top: 8px;
  border-top: 1px solid var(--line);
}
.info__names { color: var(--muted); line-height: 1.5; }
.info__note {
  margin: 10px 0 0; padding-top: 9px;
  border-top: 1px solid var(--line);
  font-size: 11px; color: var(--muted); line-height: 1.45;
}

/* On the pitch the popover has to sit above the grass, not inside the chip */
:root[data-theme="stadium"] .info__pop {
  background: rgba(4,12,7,.94);
  backdrop-filter: blur(18px);
  border-color: rgba(255,255,255,.16);
}

.linkbtn {
  background: none; border: 0; padding: 0;
  color: var(--accent); font: inherit; font-weight: 600;
  text-decoration: underline; cursor: pointer;
}
.linkbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
:root[data-theme="stadium"] .turf__hint { display: block; margin-top: 10px; }

/* Help markers sit inline with the label they belong to */
.info--sm {
  width: 16px; height: 16px;
  font-size: 10px;
  vertical-align: middle;
  margin-left: 5px;
  position: relative;
  top: -1px;
}
.info__pop--help {
  left: 0; right: 0;
  width: auto;
  top: calc(100% - 6px);
}
.info__pop--help p { margin: 0 0 8px; color: var(--muted); line-height: 1.5; }
.info__pop--help p:last-child { margin-bottom: 0; }
.info__pop--help b { color: var(--chalk); }
.info__pop--help i { color: var(--chalk); font-style: italic; }
.panel, .strategy, .card { position: relative; }

/* --- First-run pointer ----------------------------------------------------
   One line, dismissed once. A guided tour would arrive before there is a
   squad on screen, when none of the numbers mean anything yet. */
.firstrun {
  display: flex; align-items: center; gap: 10px;
  background: var(--raised);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 10px 12px 10px 14px;
  margin-bottom: var(--gap);
  font-size: 13px;
}
.firstrun__q {
  display: inline-grid; place-items: center;
  width: 17px; height: 17px; border-radius: 50%;
  border: 1px solid var(--accent); color: var(--accent);
  font-size: 10px; font-weight: 700;
  vertical-align: middle;
}
.firstrun__x {
  margin-left: auto; flex-shrink: 0;
  background: none; border: 0; color: var(--muted);
  font-size: 22px; line-height: 1; cursor: pointer; padding: 0 2px;
}
.firstrun__x:hover { color: var(--chalk); }

/* --- Glossary -------------------------------------------------------------- */
.gloss {
  background: var(--panel);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
  padding: 13px 15px;
}
.gloss__t { font-family: var(--display); font-weight: 700; font-size: 15px; }
.gloss__b { margin: 5px 0 0; font-size: 13px; color: var(--muted); line-height: 1.55; }

@media (min-width: 720px) {
  #glossaryBody { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: var(--gap); }
}

/* The instruction, ahead of the reasoning */
.verdict__use {
  display: block;
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
  color: var(--chalk);
  margin-bottom: 3px;
}
.verdict--hold .verdict__use { color: var(--muted); }

/* --- Planner --------------------------------------------------------------- */
.planner { margin-bottom: var(--gap); }
.planner__head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  margin-bottom: 10px;
}
.planner__title { font-family: var(--display); font-size: 20px; margin: 0; }
.planner__sub { font-size: 12px; color: var(--muted); margin: 3px 0 0; }
.planner__reset { flex-shrink: 0; padding: 7px 12px; font-size: 12px; }
.turf--plan { min-height: 0; padding: 14px 8px 16px; }
:root[data-theme="stadium"] .turf--plan {
  margin-inline: 0;
  border-radius: var(--radius);
  min-height: 0;
  padding: 14px 8px 16px;
}
:root[data-theme="stadium"] .turf--plan::after { inset: 8px; }

/* --- Sign-in: Google first ------------------------------------------------- */
.primary { margin-bottom: 18px; }
.alt {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 14px;
  margin-top: 4px;
}
.alt[open] { padding-bottom: 14px; }
.alt__summary {
  cursor: pointer;
  padding: 13px 0;
  font-size: 13px;
  color: var(--muted);
  list-style: none;
}
.alt__summary::-webkit-details-marker { display: none; }
.alt__summary::after { content: ' ▾'; }
.alt[open] .alt__summary::after { content: ' ▴'; }
.alt__summary:hover { color: var(--chalk); }
.hint--warn { color: var(--flood); }

.sheet__note {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--flood);
  line-height: 1.45;
}

.strategy__split { height: 1px; background: var(--line); margin: 16px 0 14px; }
.strategy__slider--horizon {
  background: linear-gradient(90deg, var(--flood), var(--line) 50%, var(--accent));
}
.strategy__foot {
  font-size: 11px; color: var(--muted); line-height: 1.5;
  margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line);
}
.strategy__foot b { color: var(--chalk); }

.sheet__remove {
  width: 100%;
  margin: 10px 0 0;
  border-color: var(--fall);
  color: var(--fall);
  font-size: 13px;
}
.sheet__remove:hover { background: rgba(255,107,122,.1); }

/* Changes already made on the planner, shown beside the advice so a
   recommendation to "use 2 more" is never mistaken for the first two. */
.committed {
  background: var(--raised);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.committed__count {
  display: block;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--chalk);
  margin-bottom: 3px;
}
