/* ==========================================================================
   Tokens
   - Superficies y acentos en pastel (fondos, tiles, podios, celdas).
   - Las series de las gráficas comparativas (--s1..--s4) son la paleta
     validada para daltonismo: NO se cambian por pasteles.
   ========================================================================== */
:root {
  color-scheme: light;
  --plane: #f4f5f9;
  --plane-glow-1: #e6eefc;
  --plane-glow-2: #fcece4;
  --surface: #ffffff;
  --surface-2: #f6f7fa;
  --surface-3: #eef0f5;
  --ink: #161823;
  --ink-2: #4f5466;
  --muted: #8a8fa0;
  --grid: #eceef3;
  --axis: #d3d6df;
  --ring: rgba(22, 24, 35, 0.07);
  --accent: #3f7fd8;
  --accent-ink: #2457a0;
  --accent-soft: #e4eefc;

  --shadow-sm: 0 1px 2px rgba(22, 24, 40, 0.05);
  --shadow: 0 1px 2px rgba(22, 24, 40, 0.04), 0 8px 24px -8px rgba(22, 24, 40, 0.10);
  --shadow-lg: 0 2px 4px rgba(22, 24, 40, 0.04), 0 18px 40px -12px rgba(22, 24, 40, 0.18);

  /* Pasteles: fondo + tinta legible encima */
  --p-blue: #e4eefc;   --p-blue-ink: #2457a0;
  --p-peach: #fde9df;  --p-peach-ink: #a4461c;
  --p-mint: #dcf3ea;   --p-mint-ink: #1d7352;
  --p-lilac: #ece8fb;  --p-lilac-ink: #4a3aa7;
  --p-butter: #fbf1d2; --p-butter-ink: #866000;
  --p-rose: #fbe4ec;   --p-rose-ink: #a3325c;
  --p-gold: #fbefc8;   --p-gold-ink: #7d5a00;
  --p-silver: #eceef2; --p-silver-ink: #4f5466;
  --p-bronze: #f8e1d2; --p-bronze-ink: #8a4520;

  /* Series de gráficas (paleta validada) */
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --gray-line: #cdd0da;
  /* Barras de una sola serie: pastel medio, siempre con su valor rotulado */
  --bar: #8db6ec;
  --bar-pos: #8db6ec;
  --bar-neg: #f2a5b5;

  --win: #3f7fd8;
  --loss: #e0607a;
  --mid: #eef0f5;
  --up: #1d7352;
  --down: #b42850;
  --gold: #e0b43a;
  --silver: #aab0bd;
  --bronze: #d08a5c;
  --radius: 16px;
  --radius-sm: 10px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --plane: #0f1014;
    --plane-glow-1: #161d2b;
    --plane-glow-2: #1f1915;
    --surface: #181a20;
    --surface-2: #1e2028;
    --surface-3: #252833;
    --ink: #f3f4f7;
    --ink-2: #c0c4d0;
    --muted: #8a8fa0;
    --grid: #262935;
    --axis: #353947;
    --ring: rgba(255, 255, 255, 0.07);
    --accent: #5598e7;
    --accent-ink: #9ec5f4;
    --accent-soft: #1d2a3f;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 28px -10px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.35), 0 20px 44px -12px rgba(0, 0, 0, 0.7);
    --p-blue: #1d2a3f;   --p-blue-ink: #9ec5f4;
    --p-peach: #38251c;  --p-peach-ink: #f3a885;
    --p-mint: #17302a;   --p-mint-ink: #7fd3b2;
    --p-lilac: #262340;  --p-lilac-ink: #b8aff2;
    --p-butter: #332b16; --p-butter-ink: #e8c66a;
    --p-rose: #3a1f2a;   --p-rose-ink: #f09ab9;
    --p-gold: #352c12;   --p-gold-ink: #f0cd6a;
    --p-silver: #262833; --p-silver-ink: #c9ccd6;
    --p-bronze: #36231a; --p-bronze-ink: #eaa77e;
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --s4: #c98500;
    --gray-line: #3a3e4c;
    --bar: #5598e7;
    --bar-pos: #5598e7;
    --bar-neg: #e66787;
    --win: #5598e7;
    --loss: #e66787;
    --mid: #2a2d38;
    --up: #5fcf9f;
    --down: #f08aa5;
    --gold: #e7bd45;
    --silver: #9aa1b0;
    --bronze: #d6905f;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --plane: #0f1014;
  --plane-glow-1: #161d2b;
  --plane-glow-2: #1f1915;
  --surface: #181a20;
  --surface-2: #1e2028;
  --surface-3: #252833;
  --ink: #f3f4f7;
  --ink-2: #c0c4d0;
  --muted: #8a8fa0;
  --grid: #262935;
  --axis: #353947;
  --ring: rgba(255, 255, 255, 0.07);
  --accent: #5598e7;
  --accent-ink: #9ec5f4;
  --accent-soft: #1d2a3f;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 28px -10px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.35), 0 20px 44px -12px rgba(0, 0, 0, 0.7);
  --p-blue: #1d2a3f;   --p-blue-ink: #9ec5f4;
  --p-peach: #38251c;  --p-peach-ink: #f3a885;
  --p-mint: #17302a;   --p-mint-ink: #7fd3b2;
  --p-lilac: #262340;  --p-lilac-ink: #b8aff2;
  --p-butter: #332b16; --p-butter-ink: #e8c66a;
  --p-rose: #3a1f2a;   --p-rose-ink: #f09ab9;
  --p-gold: #352c12;   --p-gold-ink: #f0cd6a;
  --p-silver: #262833; --p-silver-ink: #c9ccd6;
  --p-bronze: #36231a; --p-bronze-ink: #eaa77e;
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  --s4: #c98500;
  --gray-line: #3a3e4c;
  --bar: #5598e7;
  --bar-pos: #5598e7;
  --bar-neg: #e66787;
  --win: #5598e7;
  --loss: #e66787;
  --mid: #2a2d38;
  --up: #5fcf9f;
  --down: #f08aa5;
  --gold: #e7bd45;
  --silver: #9aa1b0;
  --bronze: #d6905f;
}

/* ==========================================================================
   Base
   ========================================================================== */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 0% -10%, var(--plane-glow-1), transparent 70%),
    radial-gradient(800px 380px at 100% -5%, var(--plane-glow-2), transparent 70%),
    var(--plane);
  background-repeat: no-repeat;
  color: var(--ink);
  font: 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; }
h3 { font-size: 1.02rem; font-weight: 650; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.small { font-size: 0.85rem; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ==========================================================================
   Cabecera
   ========================================================================== */
header.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--ring);
}
.top-inner { max-width: 1320px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { width: 44px; height: 44px; flex: none; display: block; border-radius: 50%; }
.logo img { width: 44px; height: 44px; display: block; filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.18)); }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand h1 { font-size: 1.02rem; font-weight: 700; white-space: nowrap; }
.brand .sub { color: var(--ink-2); font-size: 0.82rem; white-space: nowrap; }
nav.tabs {
  display: flex; gap: 2px; padding: 4px; margin-left: auto;
  background: var(--surface-3); border-radius: 999px;
  overflow-x: auto; scrollbar-width: none; max-width: 100%;
}
nav.tabs::-webkit-scrollbar { display: none; }
nav.tabs a {
  padding: 7px 9px; border-radius: 999px;
  color: var(--ink-2); white-space: nowrap; font-weight: 550; font-size: 0.88rem;
  transition: background .15s, color .15s, box-shadow .15s;
}
nav.tabs a:hover { color: var(--ink); }
nav.tabs .nav-btn {
  font: inherit; font-size: 0.88rem; font-weight: 550; color: var(--ink-2);
  padding: 7px 9px; border-radius: 999px; border: 0; background: none; cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s, box-shadow .15s;
}
nav.tabs .nav-btn:hover { color: var(--ink); }
nav.tabs .nav-btn[aria-expanded="true"] { background: var(--surface); color: var(--accent-ink); box-shadow: var(--shadow-sm); }
nav.tabs .nav-btn .caret { font-size: 0.7em; margin-left: 2px; display: inline-block; transition: transform .15s; }
nav.tabs .nav-btn[aria-expanded="true"] .caret { transform: rotate(180deg); }
.drop-menu {
  position: fixed; z-index: 60; min-width: 250px; max-width: calc(100vw - 16px); max-height: 70vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--ring); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px;
}
.drop-group {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent-ink); padding: 10px 10px 4px;
}
.drop-group:not(:first-child) { border-top: 1px solid var(--ring); margin-top: 4px; }
.drop-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px;
  color: var(--ink); font-weight: 550; font-size: 0.92rem;
}
.drop-item:hover, .drop-item:focus-visible { background: var(--surface-2); color: var(--ink); outline: none; }
.drop-item .play { width: 30px; height: 22px; flex: none; color: var(--p-rose-ink); }
.drop-item .play svg { width: 100%; height: 100%; fill: var(--p-rose); stroke: none; }
.drop-vacio { padding: 12px; color: var(--muted); font-size: 0.88rem; }
.drop-txt { display: flex; flex-direction: column; min-width: 0; }
.drop-sub { color: var(--muted); font-size: 0.76rem; font-weight: 450; }

/* Links a videos (cuadro, poules, fichas) */
a.vid { display: inline-flex; align-items: center; gap: 6px; }
a.vid .play { width: 22px; height: 16px; flex: none; color: var(--p-rose-ink); display: inline-flex; }
a.vid .play svg { width: 100%; height: 100%; fill: var(--p-rose); }
a.vid.chip { color: var(--ink); }
.match .vid-row {
  display: flex; padding: 4px 9px; border-top: 1px solid var(--grid);
  background: color-mix(in oklab, var(--p-rose) 45%, var(--surface));
  color: var(--p-rose-ink); font-size: 0.74rem; font-weight: 650;
}
.match .vid-row:hover { background: var(--p-rose); color: var(--p-rose-ink); }
table.pool a.pool-vid { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
nav.tabs a.active { background: var(--surface); color: var(--accent-ink); box-shadow: var(--shadow-sm); }
.top-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--ring);
  background: var(--surface); color: var(--ink-2); cursor: pointer;
  display: grid; place-items: center; box-shadow: var(--shadow-sm);
}
.icon-btn:hover { color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .sun { display: none; }
:root[data-theme="dark"] .icon-btn .sun { display: block; }
:root[data-theme="dark"] .icon-btn .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-btn .sun { display: block; }
  :root:not([data-theme="light"]) .icon-btn .moon { display: none; }
}

main { max-width: 1200px; margin: 0 auto; padding: 28px 20px 64px; }
.page-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .grow { flex: 1; min-width: 220px; }
.page-head p { margin: 6px 0 0; color: var(--ink-2); }
.eyebrow { font-size: 0.76rem; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: 6px; }

/* ==========================================================================
   Tarjetas
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--ring);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 20px;
  min-width: 0;
}
.card > h3 { margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.card > h3 .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.card > .desc { margin: 0 0 16px; color: var(--ink-2); font-size: 0.88rem; }
.card.flat { box-shadow: none; background: var(--surface-2); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 20px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; }

/* ==========================================================================
   Tiles (indicadores)
   ========================================================================== */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 20px; }
.tile {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--ring);
  border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow);
}
.tile .ico {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--tone-bg, var(--p-blue)); color: var(--tone-ink, var(--p-blue-ink));
  position: absolute; top: 12px; right: 12px;
}
.tile .label { padding-right: 40px; min-height: 2.4em; }
.tile .ico svg { width: 18px; height: 18px; }
.tile .label { color: var(--ink-2); font-size: 0.8rem; font-weight: 550; }
.tile .value { font-size: 1.65rem; font-weight: 700; margin-top: 2px; letter-spacing: -0.02em; }
.tile .value.sm { font-size: 1.12rem; padding-top: 6px; letter-spacing: -0.01em; }
.tile .foot { color: var(--muted); font-size: 0.78rem; margin-top: 2px; }
.t-blue   { --tone-bg: var(--p-blue);   --tone-ink: var(--p-blue-ink); }
.t-peach  { --tone-bg: var(--p-peach);  --tone-ink: var(--p-peach-ink); }
.t-mint   { --tone-bg: var(--p-mint);   --tone-ink: var(--p-mint-ink); }
.t-lilac  { --tone-bg: var(--p-lilac);  --tone-ink: var(--p-lilac-ink); }
.t-butter { --tone-bg: var(--p-butter); --tone-ink: var(--p-butter-ink); }
.t-rose   { --tone-bg: var(--p-rose);   --tone-ink: var(--p-rose-ink); }
/* Peñarol: amarillo sobre negro, igual en modo claro y oscuro, con un contorno amarillo sutil. */
.t-penarol { --tone-bg: #111111; --tone-ink: #ffcc00; }
.club-pill.t-penarol, .avatar.t-penarol { background: var(--tone-bg); box-shadow: inset 0 0 0 1px rgba(255, 204, 0, 0.55); }

/* ==========================================================================
   Podio / héroe
   ========================================================================== */
.podium { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 16px; margin-bottom: 20px; }
.podium .p {
  position: relative; overflow: hidden;
  border-radius: var(--radius); padding: 16px 18px;
  background: var(--tone-bg); color: var(--tone-ink);
  border: 1px solid var(--ring); box-shadow: var(--shadow);
  display: flex; gap: 14px; align-items: center;
  transition: transform .15s, box-shadow .15s;
}
.podium .p:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.podium .p.m1 { --tone-bg: var(--p-gold);   --tone-ink: var(--p-gold-ink); }
.podium .p.m2 { --tone-bg: var(--p-silver); --tone-ink: var(--p-silver-ink); }
.podium .p.m3 { --tone-bg: var(--p-bronze); --tone-ink: var(--p-bronze-ink); }
.podium .p .big {
  position: absolute; right: 10px; bottom: -18px;
  font-size: 5.5rem; font-weight: 800; line-height: 1; opacity: 0.12; letter-spacing: -0.05em;
  pointer-events: none;
}
.podium .p .pl { font-size: 0.75rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; }
.podium .p .nm { font-weight: 700; font-size: 1.05rem; margin-top: 2px; color: var(--ink); }
.podium .p .nm a { color: inherit; }
.podium .p .meta { font-size: 0.82rem; margin-top: 2px; }
.podium .p .pts { font-size: 1.5rem; font-weight: 750; color: var(--ink); letter-spacing: -0.02em; }

.avatar {
  width: 46px; height: 46px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-weight: 700; font-size: 0.95rem; letter-spacing: 0.02em;
  background: var(--surface); color: var(--tone-ink, var(--accent-ink));
  box-shadow: var(--shadow-sm);
}
.avatar.lg { width: 64px; height: 64px; font-size: 1.25rem; background: var(--tone-bg); }

.profile-head { display: flex; align-items: center; gap: 16px; }

/* ==========================================================================
   Tablas
   ========================================================================== */
.table-wrap { overflow-x: auto; margin: 0 -6px; padding: 0 6px; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.9rem; }
table.data th, table.data td { padding: 9px 10px; text-align: left; white-space: nowrap; }
table.data td { border-bottom: 1px solid var(--grid); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data th {
  color: var(--ink-2); font-weight: 600; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em;
  background: var(--surface-2); position: sticky; top: 0;
}
table.data thead th:first-child { border-radius: 10px 0 0 10px; }
table.data thead th:last-child { border-radius: 0 10px 10px 0; }
table.data td.wrap { white-space: normal; min-width: 180px; }
table.data td.r, table.data th.r { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.c, table.data th.c { text-align: center; font-variant-numeric: tabular-nums; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover td { background: var(--surface-2); }
table.data a { font-weight: 550; }
.delta-up { color: var(--up); font-weight: 650; }
.delta-down { color: var(--down); font-weight: 650; }
.club { color: var(--ink-2); font-size: 0.82rem; }
.pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  background: var(--surface-3); color: var(--ink-2); font-size: 0.75rem; font-weight: 550;
}
.club-pill {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  background: var(--tone-bg); color: var(--tone-ink);
  font-size: 0.76rem; font-weight: 600; white-space: nowrap;
}
.medal { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.medal.m1 { background: var(--gold); } .medal.m2 { background: var(--silver); } .medal.m3 { background: var(--bronze); }
.rank {
  display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 6px;
  border-radius: 9px; font-weight: 700; font-size: 0.85rem; font-variant-numeric: tabular-nums;
  background: var(--surface-3); color: var(--ink-2);
}
.rank.r1 { background: var(--p-gold); color: var(--p-gold-ink); }
.rank.r2 { background: var(--p-silver); color: var(--p-silver-ink); box-shadow: inset 0 0 0 1px var(--ring); }
.rank.r3 { background: var(--p-bronze); color: var(--p-bronze-ink); }
.fcell { display: inline-flex; align-items: baseline; gap: 4px; }
.fcell .pts { color: var(--muted); font-size: 0.78rem; }
.fcell.top { padding: 2px 8px; border-radius: 8px; background: var(--tone-bg); color: var(--tone-ink); font-weight: 650; }
.fcell.top .pts { color: inherit; opacity: 0.75; }
.fcell.desc { opacity: 0.55; text-decoration: line-through; text-decoration-thickness: 1px; }
.fcell.m1 { --tone-bg: var(--p-gold);   --tone-ink: var(--p-gold-ink); }
.fcell.m2 { --tone-bg: var(--p-silver); --tone-ink: var(--p-silver-ink); }
.fcell.m3 { --tone-bg: var(--p-bronze); --tone-ink: var(--p-bronze-ink); }
.pts-big { font-weight: 750; font-size: 0.98rem; }

/* ==========================================================================
   Controles
   ========================================================================== */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: 0.86rem; font-weight: 550; cursor: pointer;
  border: 1px solid var(--ring); background: var(--surface); color: var(--ink-2);
  padding: 7px 14px; border-radius: 999px; box-shadow: var(--shadow-sm);
  transition: background .15s, color .15s, box-shadow .15s;
}
.chip:hover { color: var(--ink); box-shadow: var(--shadow); }
.chip.active { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.chip .chip-sub { color: var(--muted); font-weight: 450; margin-left: 4px; }
.chip.active .chip-sub { color: inherit; opacity: 0.7; }
select.ctl, button.ctl, a.ctl {
  font: inherit; font-size: 0.9rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--ring); border-radius: 12px; padding: 8px 12px;
  max-width: 100%; box-shadow: var(--shadow-sm);
}
button.ctl, a.ctl { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
a.ctl.primary { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
a.ctl:hover { box-shadow: var(--shadow); color: var(--accent-ink); }
.sel-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.sel-slot {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--ring); border-radius: 999px; padding: 5px 6px 5px 12px;
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.sel-slot .key { width: 16px; height: 4px; border-radius: 2px; }
.sel-slot button {
  border: 0; background: var(--surface-3); color: var(--ink-2); cursor: pointer;
  width: 22px; height: 22px; border-radius: 50%; line-height: 1; font-size: 0.95rem;
}
.sel-slot button:hover { color: var(--ink); background: var(--p-rose); }

/* ==========================================================================
   Poules
   ========================================================================== */
.pools { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 640px), 1fr)); gap: 18px; }
.pool-card .table-wrap { margin: 0; padding: 0; }
.pool-card { background: var(--surface-2); border-radius: 14px; padding: 14px 14px 10px; }
.pool-card h3 { margin-bottom: 8px; font-size: 0.95rem; }
table.pool { border-collapse: separate; border-spacing: 3px; font-size: 0.82rem; }
table.pool th { color: var(--muted); font-weight: 550; padding: 2px 4px; }
table.pool td { padding: 5px 6px; text-align: center; border-radius: 7px; font-variant-numeric: tabular-nums; min-width: 30px; }
table.pool td.name { text-align: left; white-space: nowrap; padding-right: 10px; }
table.pool td.V { background: var(--p-blue); color: var(--p-blue-ink); font-weight: 650; }
table.pool td.D { background: var(--p-rose); color: var(--p-rose-ink); opacity: 0.85; }
table.pool td.self { background: var(--surface-3); }
table.pool td.res { color: var(--ink-2); }
table.pool td.res.b { color: var(--p-mint-ink); background: var(--p-mint); font-weight: 700; }

/* ==========================================================================
   Cuadro de eliminación directa
   ========================================================================== */
.bracket { display: flex; gap: 16px; overflow-x: auto; padding: 4px 4px 10px; }
.bracket .col { display: flex; flex-direction: column; min-width: 176px; gap: 8px; }
.bracket .col h4 {
  margin: 0 0 6px; font-size: 0.72rem; color: var(--ink-2); font-weight: 650; text-align: center;
  text-transform: uppercase; letter-spacing: 0.06em;
  background: var(--surface-2); border-radius: 999px; padding: 5px 8px;
}
.bracket .colbody { display: flex; flex-direction: column; justify-content: space-around; flex: 1; gap: 8px; }
.match {
  border: 1px solid var(--ring); border-radius: 10px; background: var(--surface);
  font-size: 0.82rem; overflow: hidden; box-shadow: var(--shadow-sm);
}
.match .f { display: flex; justify-content: space-between; gap: 8px; padding: 5px 9px; }
.match .f + .f { border-top: 1px solid var(--grid); }
.match .f.w { font-weight: 650; background: var(--p-blue); }
.match .f.w a { color: var(--p-blue-ink); }
.match .f.bye { color: var(--muted); font-style: italic; }
.match.solo { border-style: dashed; background: transparent; box-shadow: none; }
.match.solo .f { padding: 3px 9px; }
.match.solo .pasa { color: var(--muted); font-size: 0.72rem; }
.match.champ { background: var(--p-gold); border-color: transparent; box-shadow: var(--shadow); }
.match.champ .f { padding: 10px 12px; font-weight: 700; }
.match.champ a { color: var(--p-gold-ink); }
.match .seed { color: var(--muted); font-size: 0.74rem; margin-right: 5px; font-weight: 450; }
.match .sc { font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Matriz de enfrentamientos
   ========================================================================== */
.h2h-wrap { overflow: auto; max-height: 78vh; }
table.h2h { border-collapse: separate; border-spacing: 3px; font-size: 0.75rem; }
table.h2h th { font-weight: 550; color: var(--ink-2); white-space: nowrap; background: var(--surface); }
table.h2h thead th { position: sticky; top: 0; z-index: 2; height: 124px; vertical-align: bottom; padding: 0 0 6px; }
table.h2h thead th span { writing-mode: vertical-rl; transform: rotate(180deg); display: inline-block; }
table.h2h tbody th { position: sticky; left: 0; z-index: 1; text-align: right; padding-right: 8px; }
table.h2h td {
  width: 32px; min-width: 32px; height: 28px; text-align: center; border-radius: 7px;
  font-variant-numeric: tabular-nums; cursor: pointer; color: var(--ink); font-weight: 550;
  transition: transform .1s;
}
table.h2h td.none { cursor: default; background: transparent; }
table.h2h td.self { background: var(--surface-3); cursor: default; }
table.h2h td:not(.none):not(.self):hover { transform: scale(1.12); box-shadow: var(--shadow); position: relative; z-index: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; font-size: 0.8rem; color: var(--ink-2); margin-top: 12px; }
.legend .sw { display: inline-block; width: 14px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .ln { display: inline-block; width: 16px; height: 4px; border-radius: 2px; margin-right: 6px; vertical-align: 2px; }

/* ==========================================================================
   Gráficas SVG
   ========================================================================== */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart text.lbl { fill: var(--ink-2); font-size: 11.5px; }
.chart text.lbl-strong { fill: var(--ink); font-size: 12px; font-weight: 650; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .axisline { stroke: var(--axis); stroke-width: 1; }
.chart .crosshair { stroke: var(--axis); stroke-width: 1; }
.chart .bump-line { fill: none; stroke: var(--gray-line); stroke-width: 1.5; transition: opacity .15s; }
.chart .bump-line.on { stroke: var(--accent); stroke-width: 2.75; }
.chart.dim .bump-line:not(.on) { opacity: .3; }
.chart.dim text.end:not(.on) { opacity: .3; }
.chart text.end.on { fill: var(--ink); font-weight: 650; }
.chart .hit { fill: none; stroke: transparent; stroke-width: 14; cursor: pointer; pointer-events: stroke; }

.tooltip {
  position: fixed; z-index: 50; pointer-events: none;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--ring); border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 10px 12px; font-size: 0.82rem; max-width: 300px;
  opacity: 0; transform: translateY(2px); transition: opacity .1s, transform .1s;
}
.tooltip.show { opacity: 1; transform: none; }
.tooltip .tt-title { color: var(--ink-2); font-size: 0.76rem; font-weight: 600; margin-bottom: 6px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 7px; line-height: 1.6; }
.tooltip .tt-row b { font-variant-numeric: tabular-nums; }
.tooltip .tt-key { width: 12px; height: 4px; border-radius: 2px; flex: none; }

/* ==========================================================================
   Varios
   ========================================================================== */
details.more summary { cursor: pointer; color: var(--accent-ink); font-size: 0.9rem; font-weight: 550; }
.empty { color: var(--muted); padding: 20px 0; text-align: center; }
.note { font-size: 0.8rem; color: var(--muted); margin-top: 10px; }
.callout {
  display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 14px;
}
.callout .pill-note {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 12px; font-size: 0.85rem;
  background: var(--tone-bg); color: var(--tone-ink);
}
.callout .pill-note a { color: inherit; font-weight: 650; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.h2h-pair { background: var(--surface-2); border-radius: 14px; padding: 14px 16px; }
.h2h-pair .score { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.h2h-pair .score .n { font-weight: 650; }
.h2h-pair .score .big { font-size: 1.4rem; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; white-space: nowrap; }
.h2h-pair table.data td { background: transparent; }
footer.foot { max-width: 1200px; margin: 0 auto; padding: 0 20px 36px; color: var(--muted); font-size: 0.8rem; }

/* ==========================================================================
   Resumen de categorías
   ========================================================================== */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 14px; }
.cat-card {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--surface-2); border: 1px solid var(--ring); border-radius: 14px; padding: 14px 16px;
  color: var(--ink); transition: transform .15s, box-shadow .15s, border-color .15s;
}
.cat-card:hover { color: var(--ink); transform: translateY(-2px); box-shadow: var(--shadow); border-color: transparent; }
.cat-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.cat-edad { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }
.cat-gen { color: var(--ink-2); font-size: 0.85rem; }
.fdots { display: inline-flex; gap: 3px; flex: none; }
.fdots span {
  width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center;
  font-size: 0.62rem; font-weight: 650; color: var(--muted); background: var(--surface-3);
}
.fdots span.on { background: var(--p-blue); color: var(--p-blue-ink); }
.cat-top3 { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.cat-top3 li { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; min-width: 0; }
.cat-top3 .rank { flex: none; min-width: 22px; height: 22px; font-size: 0.72rem; border-radius: 7px; }
.cat-top3 .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-top3 .pts { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.82rem; }
.cat-meta { color: var(--muted); font-size: 0.8rem; margin-top: auto; }
#cat-select { max-width: 190px; }

@media (max-width: 760px) {
  nav.tabs { margin-left: 0; width: 100%; order: 3; }
  .top-actions { margin-left: auto; order: 2; }
  .top-inner { gap: 10px; padding: 10px 16px; }
  main { padding: 20px 16px 48px; }
  h2 { font-size: 1.35rem; }
  .card { padding: 16px; }
  .tile .value { font-size: 1.35rem; }
  .podium .p .pts { font-size: 1.25rem; }
}
