/* =========================================================================
   Fantasy Mundial 2026 — stadium-night theme
   Dark pitch background, vivid floodlight-green accent, warm gold for money.
   Mobile-first; phone opened from a WhatsApp link is the primary device.
   ========================================================================= */

:root {
  /* Surfaces (dark, faintly pitch-green tinted — not the AI cream default) */
  --bg:        oklch(0.165 0.024 168);
  --bg-deep:   oklch(0.135 0.022 168);
  --surface:   oklch(0.205 0.028 168);
  --surface-2: oklch(0.245 0.032 168);
  --line:      oklch(0.32 0.03 168);
  --line-soft: oklch(0.27 0.028 168);

  /* Text */
  --ink:    oklch(0.975 0.012 160);
  --muted:  oklch(0.77 0.022 162);
  --faint:  oklch(0.62 0.02 162);

  /* Brand + roles */
  --primary:     oklch(0.82 0.185 150);   /* floodlit pitch green */
  --primary-dim: oklch(0.66 0.15 150);
  --primary-ink: oklch(0.20 0.05 160);    /* text on primary fills */
  --gold:        oklch(0.84 0.135 86);    /* money / prizes */
  --gold-dim:    oklch(0.72 0.12 86);

  --up:    oklch(0.83 0.17 150);
  --down:  oklch(0.72 0.17 28);
  --same:  oklch(0.66 0.015 162);

  --podium-1: oklch(0.84 0.135 86);   /* gold   */
  --podium-2: oklch(0.86 0.012 230);  /* silver */
  --podium-3: oklch(0.74 0.10 55);    /* bronze */

  /* Spacing rhythm + radii */
  --r-sm: 8px;
  --r:    14px;
  --r-lg: 20px;
  --shadow: 0 6px 24px -12px oklch(0.05 0.02 168 / 0.8);
  --shadow-lg: 0 18px 50px -22px oklch(0.05 0.02 168 / 0.9);

  /* z-index scale */
  --z-sticky: 100;
  --z-nav: 200;
  --z-overlay: 300;
  --z-toast: 400;

  --content-w: 680px;

  --font-display: "Archivo", "Archivo Expanded", system-ui, sans-serif;
  --font-body: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  background:
    radial-gradient(120% 60% at 50% -10%, oklch(0.24 0.05 158 / 0.55), transparent 60%),
    var(--bg);
  color: var(--ink);
  line-height: 1.45;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  overflow-x: hidden;
}

h1, h2, h3 { font-family: var(--font-display); line-height: 1.04; margin: 0; letter-spacing: -0.02em; text-wrap: balance; }
p { margin: 0; }
a { color: inherit; }

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

/* ---- App shell ---------------------------------------------------------- */
.shell {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 16px 16px calc(94px + env(safe-area-inset-bottom));
}

/* ---- Two-tier header ---------------------------------------------------- */
.topstack {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  background: var(--bg-deep);
  box-shadow: 0 1px 0 var(--line-soft), var(--shadow);
}

/* Tier 1 — umbrella bar */
.appbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  max-width: var(--content-w);
  margin: 0 auto;
}
.brandmark { display: flex; align-items: center; gap: 7px; min-width: 0; text-decoration: none; flex: none; }
.crest { flex: none; width: 28px; height: 28px; }
.brandword {
  font-family: var(--font-display); font-weight: 800; font-size: 0.84rem;
  letter-spacing: -0.01em; color: var(--ink); white-space: nowrap;
}

.umbrella-nav {
  margin-left: auto;
  display: inline-flex; gap: 2px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px;
}
.umb {
  text-decoration: none; color: var(--muted);
  font-family: var(--font-display); font-weight: 700; font-size: 0.72rem;
  padding: 6px 10px; border-radius: 999px; white-space: nowrap;
  display: inline-flex; align-items: center; min-height: 32px;
  transition: color 0.16s, background 0.16s;
}
.umb:not([aria-current]):hover { color: var(--ink); }
.umb[aria-current="page"] { background: var(--primary); color: var(--primary-ink); }

.lang-toggle {
  flex: none;
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  font-family: var(--font-display); font-weight: 700; font-size: 0.74rem;
  padding: 7px 10px; border-radius: 999px; cursor: pointer; min-height: 38px;
  transition: border-color 0.18s, background 0.18s;
}
.lang-toggle:hover { border-color: var(--primary-dim); }
.lang-toggle .on { color: var(--primary); }
.lang-toggle .sep { color: var(--faint); }

/* Tier 2 — league sub-bar (visually differentiated) */
.leaguebar[hidden] { display: none; }
.leaguebar {
  background:
    linear-gradient(180deg, oklch(0.24 0.045 156 / 0.9), oklch(0.205 0.03 165));
  border-top: 1px solid oklch(0.82 0.185 150 / 0.18);
  box-shadow: inset 0 -1px 0 var(--line);
}
.lb-inner {
  max-width: var(--content-w); margin: 0 auto; padding: 0 14px;
  display: flex; align-items: center; gap: 12px;
}
.lb-context {
  flex: none; display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none; color: inherit; padding: 8px 0;
}
.lb-name { font-family: var(--font-display); font-weight: 800; font-size: 0.98rem; letter-spacing: -0.01em; }
.pill {
  font-family: var(--font-display); font-weight: 800; font-size: 0.6rem;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px;
}
.pill.live { background: oklch(0.82 0.185 150 / 0.2); color: var(--primary); }
.pill.done { background: oklch(0.66 0.015 162 / 0.2); color: var(--muted); }

.lb-tabs {
  margin-left: auto;
  display: flex; gap: 1px; overflow-x: auto; scrollbar-width: none;
}
.lb-tabs::-webkit-scrollbar { display: none; }
.lbtab {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: 0; color: var(--muted);
  font: inherit; font-weight: 700; font-size: 0.78rem;
  padding: 10px 11px; cursor: pointer;
  border-bottom: 2px solid transparent; min-height: 42px;
  transition: color 0.16s, border-color 0.16s;
}
.lbtab .lbt-ic { display: inline-flex; }
.lbtab .lbt-ic svg { width: 16px; height: 16px; }
.lbtab:not([aria-current]):hover { color: var(--ink); }
.lbtab[aria-current="page"] { color: var(--primary); border-bottom-color: var(--primary); }

/* On phones the context line stacks above a full-width tab row where all
   five tabs share the width equally (icon over a small label). */
@media (max-width: 600px) {
  .lb-inner { flex-wrap: wrap; gap: 0; }
  .lb-context { padding: 7px 0 5px; margin-right: auto; }
  .lb-tabs { width: 100%; margin-left: 0; border-top: 1px solid var(--line-soft); overflow: visible; }
  .lbtab {
    flex: 1 1 0; min-width: 0;
    flex-direction: column; gap: 3px;
    padding: 7px 2px 6px; font-size: 0.6rem;
    border-bottom: 0; border-top: 2px solid transparent;
  }
  .lbtab > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .lbtab[aria-current="page"] { border-bottom-color: transparent; border-top-color: var(--primary); }
}

/* ---- Fixed bottom umbrella bar (platform navigation) ------------------- */
.umbrellabar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: var(--z-nav);
  display: flex; justify-content: center;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg-deep) 40%);
  pointer-events: none;
}
.ub-inner {
  pointer-events: auto;
  display: flex; gap: 4px;
  background: oklch(0.2 0.028 168 / 0.94);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 6px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
}
.ubtn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: transparent; border: 0; color: var(--muted);
  font: inherit; font-size: 0.64rem; font-weight: 700;
  padding: 7px 18px; border-radius: 13px; cursor: pointer;
  min-width: 78px; min-height: 50px;
  transition: color 0.16s, background 0.16s;
}
.ubtn .ub-ic svg { width: 22px; height: 22px; }
.ubtn:not([aria-current="page"]):hover { color: var(--ink); }
.ubtn[aria-current="page"] { color: var(--primary-ink); background: var(--primary); }

@media (min-width: 760px) {
  .ubtn { flex-direction: row; gap: 8px; padding: 8px 18px; min-height: 42px; min-width: 0; font-size: 0.82rem; }
  .ubtn .ub-ic svg { width: 18px; height: 18px; }
}

/* ---- Hero --------------------------------------------------------------- */
.hero {
  position: relative;
  margin: 6px 0 18px;
  padding: 22px 20px 20px;
  border-radius: var(--r-lg);
  background:
    radial-gradient(140% 120% at 90% -20%, oklch(0.82 0.185 150 / 0.16), transparent 55%),
    linear-gradient(165deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line-soft);
  overflow: hidden;
}
.hero::after {
  /* subtle pitch lines */
  content: "";
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(90deg, transparent 0 38px, oklch(1 0 0 / 0.018) 38px 39px);
  pointer-events: none;
}
.hero h1 {
  font-weight: 800;
  font-size: clamp(1.7rem, 7vw, 2.5rem);
  margin-bottom: 4px;
}
.hero .tagline { color: var(--muted); font-size: 0.9rem; max-width: 40ch; }
.hero .updated {
  margin-top: 12px;
  font-size: 0.74rem;
  color: var(--faint);
  display: inline-flex; align-items: center; gap: 6px;
}
.hero .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 10px var(--primary); }

.statgrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 18px;
}
.stat {
  position: relative;
  background: oklch(0.16 0.02 168 / 0.55);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  padding: 12px 14px;
}
.stat .k { font-size: 0.7rem; color: var(--muted); text-transform: none; letter-spacing: 0; }
.stat .v { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; margin-top: 2px; }
.stat.leader .v { font-size: 1.05rem; line-height: 1.15; }
.stat .vsub { font-size: 0.72rem; color: var(--muted); }
.stat .v.gold { color: var(--gold); }
.stat .v.green { color: var(--primary); }
@media (min-width: 560px) {
  .statgrid { grid-template-columns: repeat(4, 1fr); }
}

/* ---- Section headings --------------------------------------------------- */
.view { animation: viewIn 0.34s cubic-bezier(0.22,1,0.36,1); }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.sec-head { margin: 4px 2px 12px; }
.sec-head h2 { font-size: 1.3rem; font-weight: 800; }
.sec-head p { color: var(--muted); font-size: 0.86rem; margin-top: 4px; max-width: 60ch; }

/* ---- Callout (biggest mover) ------------------------------------------- */
.callout {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(120deg, oklch(0.82 0.185 150 / 0.14), oklch(0.82 0.185 150 / 0.04));
  border: 1px solid oklch(0.82 0.185 150 / 0.35);
  border-radius: var(--r);
  padding: 12px 14px;
  margin-bottom: 14px;
}
.callout .ico { font-size: 1.3rem; }
.callout .txt { font-size: 0.85rem; }
.callout .txt b { color: var(--primary); }

/* ---- Standings / round list rows --------------------------------------- */
.rows { display: flex; flex-direction: column; gap: 6px; }
.row {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  padding: 11px 12px;
  color: inherit;
  cursor: pointer;
  font: inherit;
  transition: transform 0.14s ease, border-color 0.18s, background 0.18s;
  animation: rowIn 0.3s both;
}
.row:not([data-static]):hover { border-color: var(--primary-dim); transform: translateY(-1px); }
.row:not([data-static]):active { transform: translateY(0) scale(0.997); }
@keyframes rowIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.rank {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  background: var(--surface-2);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.rank.p1 { background: oklch(0.84 0.135 86 / 0.22); color: var(--podium-1); border: 1px solid oklch(0.84 0.135 86 / 0.5); }
.rank.p2 { background: oklch(0.86 0.012 230 / 0.18); color: var(--podium-2); border: 1px solid oklch(0.86 0.012 230 / 0.45); }
.rank.p3 { background: oklch(0.74 0.10 55 / 0.2); color: var(--podium-3); border: 1px solid oklch(0.74 0.10 55 / 0.45); }

.who { min-width: 0; }
.who .team {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.who .mgr { display: block; font-size: 0.78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.endcol { display: flex; align-items: center; gap: 12px; justify-content: flex-end; }
.metric { text-align: right; line-height: 1.12; }
.metric .big { display: block; font-family: var(--font-display); font-weight: 800; font-size: 1.02rem; font-variant-numeric: tabular-nums; }
.metric .lbl { display: block; font-size: 0.6rem; color: var(--faint); margin-top: 1px; }
.metric .big.gold { color: var(--gold); }

.move { display: inline-flex; align-items: center; gap: 3px; font-size: 0.8rem; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 34px; justify-content: flex-end; }
.move.up { color: var(--up); }
.move.down { color: var(--down); }
.move.same { color: var(--same); }
.move .arrow { font-size: 0.9em; }

.hint { font-size: 0.76rem; color: var(--faint); margin: 12px 2px 0; text-align: center; }

.showall {
  display: block; width: 100%; margin: 10px 0 2px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); font: inherit; font-weight: 700; font-size: 0.84rem;
  padding: 12px; border-radius: var(--r); cursor: pointer; min-height: 46px;
  transition: border-color 0.16s, background 0.16s;
}
.showall:hover { border-color: var(--primary-dim); background: var(--surface-2); }

/* ---- Chips / selectors -------------------------------------------------- */
.chips {
  display: flex; gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 10px;
  margin: 0 -2px 8px;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  scroll-snap-align: start;
  display: inline-flex; flex-direction: column; align-items: flex-start;
  gap: 1px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  color: var(--ink);
  border-radius: 12px;
  padding: 9px 13px;
  font: inherit;
  cursor: pointer;
  min-height: 44px;
  transition: border-color 0.16s, background 0.16s, transform 0.1s;
}
.chip:hover { border-color: var(--primary-dim); }
.chip[aria-selected="true"] { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.chip .c-main { font-family: var(--font-display); font-weight: 800; font-size: 0.9rem; }
.chip .c-sub { font-size: 0.66rem; opacity: 0.8; }
.chip[aria-selected="true"] .c-sub { color: var(--primary-ink); opacity: 0.75; }
.chip.upcoming { border-style: dashed; color: var(--muted); }
.chip.upcoming .c-main { color: var(--muted); }

.stage-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.72rem;
  color: var(--faint);
  letter-spacing: 0.02em;
  margin: 6px 4px 2px;
  display: flex; align-items: center; gap: 8px;
}
.stage-label::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }

/* round header banner */
.round-banner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  padding: 12px 14px;
  margin-bottom: 12px;
}
.round-banner .rb-title { font-family: var(--font-display); font-weight: 800; font-size: 1.1rem; }
.round-banner .rb-sub { font-size: 0.74rem; color: var(--muted); }
.badge {
  font-size: 0.68rem; font-weight: 800; letter-spacing: 0.03em;
  padding: 4px 9px; border-radius: 999px;
  font-family: var(--font-display);
}
.badge.played { background: oklch(0.82 0.185 150 / 0.18); color: var(--primary); }
.badge.upcoming { background: oklch(0.72 0.02 162 / 0.18); color: var(--muted); border: 1px dashed var(--line); }

.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--r);
}
.empty .big { font-size: 2rem; margin-bottom: 8px; }

/* ---- Tables (money matrix / prize tables) ------------------------------ */
.tablewrap {
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  -webkit-overflow-scrolling: touch;
}
table.grid { border-collapse: collapse; width: 100%; font-size: 0.84rem; }
table.grid th, table.grid td { padding: 10px 12px; text-align: right; white-space: nowrap; }
table.grid thead th {
  position: sticky; top: 0;
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font-display); font-weight: 700; font-size: 0.72rem;
  z-index: 2;
}
table.grid th.stick, table.grid td.stick {
  position: sticky; left: 0;
  text-align: left;
  background: var(--surface);
  z-index: 1;
}
table.grid thead th.stick { z-index: 3; background: var(--surface-2); }
table.grid tbody tr { border-top: 1px solid var(--line-soft); }
table.grid tbody tr:nth-child(odd) td { background: oklch(0.205 0.028 168 / 0.5); }
table.grid tbody tr:nth-child(odd) td.stick { background: var(--surface); }
table.grid .num { font-variant-numeric: tabular-nums; }
table.grid .money { color: var(--gold); font-weight: 700; }
table.grid .zero { color: var(--faint); }
table.grid td.total, table.grid th.total { color: var(--ink); font-weight: 800; background: oklch(0.245 0.032 168 / 0.6); }
table.grid th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
table.grid th.sortable:hover { color: var(--ink); }
table.grid th.sortable.active { color: var(--primary); }
table.grid tr.totalrow td { border-top: 2px solid var(--line); font-weight: 800; }

.mini-name { display: flex; flex-direction: column; line-height: 1.15; }
.mini-name b { font-weight: 700; font-size: 0.84rem; }
.mini-name small { color: var(--muted); font-size: 0.68rem; }

/* ---- Money totals banner ----------------------------------------------- */
.paybar {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-bottom: 14px;
}
.paycard {
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--r); padding: 13px 15px;
}
.paycard .k { font-size: 0.72rem; color: var(--muted); }
.paycard .v { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; margin-top: 2px; }
.paycard .v.gold { color: var(--gold); }
.progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 10px; border: 1px solid var(--line-soft); }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-dim), var(--gold)); border-radius: 999px; }

/* ---- Cards (rules) ------------------------------------------------------ */
.panel {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 12px;
}
.panel h3 { font-size: 1rem; margin-bottom: 10px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line-soft); }
.kv:first-of-type { border-top: 0; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 700; }
.rules-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: 0.9rem; }
.rules-list li { margin: 6px 0; }
.rules-list b { color: var(--ink); }

.prizecells { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 4px; }
@media (min-width: 480px) { .prizecells { grid-template-columns: repeat(8, 1fr); } }
.prizecell {
  text-align: center;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 9px 4px;
}
.prizecell .pos { font-size: 0.66rem; color: var(--muted); }
.prizecell .amt { font-family: var(--font-display); font-weight: 800; font-size: 1rem; color: var(--gold); margin-top: 2px; }
.prizecell.lg .amt { color: var(--primary); }

/* ---- Manager profile ---------------------------------------------------- */
.profhead {
  display: flex; align-items: center; gap: 14px;
  background:
    radial-gradient(120% 140% at 100% 0%, oklch(0.82 0.185 150 / 0.14), transparent 55%),
    var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: 18px;
  margin-bottom: 14px;
}
.avatar {
  flex: none;
  width: 56px; height: 56px;
  border-radius: 16px;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 1.4rem;
  background: linear-gradient(150deg, var(--primary), var(--primary-dim));
  color: var(--primary-ink);
}
.profhead .pn { min-width: 0; }
.profhead .pn .team { font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; line-height: 1.1; }
.profhead .pn .mgr { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }

.proffacts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.fact { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r); padding: 12px; text-align: center; }
.fact .v { font-family: var(--font-display); font-weight: 800; font-size: 1.45rem; }
.fact .v.gold { color: var(--gold); }
.fact .v.green { color: var(--primary); }
.fact .k { font-size: 0.68rem; color: var(--muted); margin-top: 2px; }

.sparkwrap { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r); padding: 14px; margin-bottom: 16px; }
.sparkwrap .k { font-size: 0.72rem; color: var(--muted); margin-bottom: 8px; }
.spark-holder { position: relative; height: 120px; }

.breakdown { display: flex; flex-direction: column; gap: 6px; }
.brow {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-size: 0.88rem;
}
.brow .rname { font-weight: 700; }
.brow .rname small { display: block; color: var(--faint); font-weight: 400; font-size: 0.7rem; }
.brow .bp { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 42px; text-align: right; }
.brow .brank { color: var(--muted); font-size: 0.78rem; min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.brow .bprize { color: var(--gold); font-weight: 700; min-width: 46px; text-align: right; font-variant-numeric: tabular-nums; }
.brow.upcoming { opacity: 0.6; }
.brow.upcoming .bp, .brow.upcoming .brank, .brow.upcoming .bprize { color: var(--faint); }

.backbtn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); border-radius: 999px;
  padding: 8px 14px; font: inherit; font-weight: 600;
  cursor: pointer; margin: 4px 0 14px; min-height: 40px;
}
.backbtn:hover { border-color: var(--primary-dim); }

/* ---- Chart -------------------------------------------------------------- */
.chartcard { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r); padding: 14px 12px; }
.chartcontrols { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 999px; padding: 3px; }
.seg button { background: transparent; border: 0; color: var(--muted); font: inherit; font-weight: 700; padding: 7px 14px; border-radius: 999px; cursor: pointer; min-height: 36px; }
.seg button[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); }
.chart-holder { position: relative; height: 56vh; min-height: 320px; max-height: 460px; }

.footer { text-align: center; color: var(--faint); font-size: 0.72rem; margin: 26px 8px 8px; line-height: 1.5; }

/* ---- Loading / error ---------------------------------------------------- */
.loading { text-align: center; padding: 60px 20px; color: var(--muted); }
.spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--primary);
  margin: 0 auto 14px; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Motion preferences ------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .view { animation: none; }
}

/* ---- Leagues index ------------------------------------------------------ */
.leaguelist { display: flex; flex-direction: column; gap: 10px; }
.leaguecard {
  text-align: left; width: 100%; cursor: pointer; font: inherit; color: inherit;
  background: linear-gradient(150deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line-soft); border-radius: var(--r); padding: 16px;
  transition: border-color 0.18s, transform 0.14s;
  animation: rowIn 0.3s both;
}
.leaguecard:hover { border-color: var(--primary-dim); transform: translateY(-1px); }
.lc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lc-name { font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; }
.lc-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; color: var(--muted); font-size: 0.84rem; }
.lc-leader { color: var(--ink); }

/* ---- Manager directory avatar ------------------------------------------ */
.avatar.sm {
  width: 34px; height: 34px; border-radius: 10px; font-size: 0.9rem;
}

/* ---- Trophy cabinet ----------------------------------------------------- */
.cabinet { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; }
.tstat {
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--r); padding: 14px 12px; text-align: center;
}
.tstat .v { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; }
.tstat .v.gold { color: var(--gold); }
.tstat .k { font-size: 0.68rem; color: var(--muted); margin-top: 4px; }

/* ---- Career editions (collapsible) ------------------------------------- */
.editions { display: flex; flex-direction: column; gap: 10px; }
.edition {
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--r); overflow: hidden;
}
.edition > summary {
  list-style: none; cursor: pointer; padding: 14px;
  display: flex; align-items: center; gap: 12px;
}
.edition > summary::-webkit-details-marker { display: none; }
.edition .ed-name { font-family: var(--font-display); font-weight: 800; font-size: 1.02rem; flex: none; }
.edition .ed-facts { display: flex; gap: 14px; margin-left: auto; }
.edition .ef { text-align: right; line-height: 1.1; }
.edition .ef b { display: block; font-family: var(--font-display); font-weight: 800; font-size: 0.95rem; }
.edition .ef b.gold { color: var(--gold); }
.edition .ef i { font-style: normal; font-size: 0.6rem; color: var(--faint); }
.edition .chev { color: var(--muted); transition: transform 0.2s; flex: none; }
.edition[open] .chev { transform: rotate(180deg); }
.edition .ed-body { padding: 0 14px 14px; overflow-x: auto; }
@media (max-width: 420px) {
  .edition .ef:nth-child(2) { display: none; } /* hide points fact on very narrow */
}

table.careergrid { font-size: 0.82rem; }
table.careergrid th, table.careergrid td { padding: 8px 10px; }
table.careergrid td.rn, table.careergrid th.stick { text-align: left; }
table.careergrid tr.up td { color: var(--faint); }
table.careergrid .money { color: var(--gold); font-weight: 700; }

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