/* ==========================================================================
   Yappy Park Leagues — Tema oscuro (por defecto) + tema claro
   Acento de marca: #1447E6 (variable --accent / --accent-2)
   ========================================================================== */

:root {
  color-scheme: dark;
  --bg: #0a0f1e;
  --bg-2: #0d1428;
  --card: #111a33;
  --card-2: #16213f;
  --card-3: #0c1326;
  --line: #22305a;
  --line-soft: #1a2547;
  --text: #e9edf7;
  --muted: #8f9bbd;
  --accent: #1447e6;
  --accent-2: #6d9bff;
  --accent-on: #ffffff;
  --gold: #d4af37;
  --gold-2: #f0d67a;
  --silver: #94a3b8;
  --silver-2: #cbd5e1;
  --live: #ef4444;
  --green: #22c55e;
  --yellow: #eab308;
  --live-ink: #fecaca;
  --green-ink: #bbf7d0;
  --yellow-ink: #fde68a;
  --danger-ink: #fca5a5;
  --tint: rgba(255, 255, 255, .05);
  --tint-soft: rgba(255, 255, 255, .035);
  --line-strong: #35446f;
  --btn-hover-bg: #182248;
  --header-bg: rgba(9, 13, 28, .82);
  --header-bg-solid: rgba(9, 13, 28, .94);
  --admin-header-bg: rgba(9, 13, 28, .9);
  --backdrop: rgba(3, 6, 16, .78);
  --backdrop-strong: rgba(3, 6, 16, .8);
  --panel-bg: linear-gradient(180deg, #131c3a, #0a1024);
  --panel-bg-2: linear-gradient(180deg, #16213f, #0a1024);
  --shimmer-a: #111a33;
  --shimmer-b: #1a2547;
  --placeholder: #6d799c;
  --focus-ring: rgba(20, 71, 230, .4);
  --bg-glow-1: rgba(20, 71, 230, .22);
  --bg-glow-2: rgba(109, 155, 255, .09);
  --r: 18px;
  --r-sm: 12px;
  --shadow: 0 24px 50px -28px rgba(0, 0, 0, .95);
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6fb;
  --bg-2: #eef1f7;
  --card: #ffffff;
  --card-2: #f8fafc;
  --card-3: #eef2f8;
  --line: #dde3ec;
  --line-soft: #e8ecf3;
  --text: #0f172a;
  --muted: #5b6675;
  --accent: #1447e6;
  --accent-2: #1447e6;
  --gold: #8a6512;
  --gold-2: #7a5c10;
  --silver: #556273;
  --silver-2: #556273;
  --live: #dc2626;
  --green: #16a34a;
  --yellow: #ca8a04;
  --live-ink: #b91c1c;
  --green-ink: #15803d;
  --yellow-ink: #a16207;
  --danger-ink: #b91c1c;
  --tint: rgba(15, 23, 42, .05);
  --tint-soft: rgba(15, 23, 42, .035);
  --line-strong: #c3ccdb;
  --btn-hover-bg: #e9eef6;
  --header-bg: rgba(255, 255, 255, .85);
  --header-bg-solid: rgba(255, 255, 255, .96);
  --admin-header-bg: rgba(255, 255, 255, .92);
  --backdrop: rgba(15, 23, 42, .45);
  --backdrop-strong: rgba(15, 23, 42, .5);
  --panel-bg: linear-gradient(180deg, #ffffff, #f2f5fa);
  --panel-bg-2: linear-gradient(180deg, #ffffff, #f2f5fa);
  --shimmer-a: #e9edf4;
  --shimmer-b: #f6f8fc;
  --placeholder: #8b95a5;
  --focus-ring: rgba(20, 71, 230, .28);
  --bg-glow-1: rgba(20, 71, 230, .1);
  --bg-glow-2: rgba(148, 163, 184, .16);
  --r: 18px;
  --r-sm: 12px;
  --shadow: 0 24px 50px -32px rgba(15, 23, 42, .4);
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  background:
    radial-gradient(1100px 520px at 12% -8%, var(--bg-glow-1), transparent 60%),
    radial-gradient(900px 480px at 92% -4%, var(--bg-glow-2), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: inherit; text-decoration: none; }

.container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 18px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--header-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.header-inner {
  display: flex; align-items: center; gap: 18px;
  min-height: 68px; padding-top: 10px; padding-bottom: 10px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  position: relative;
  width: 40px; height: 40px; border-radius: 13px;
  display: grid; place-items: center;
  font-weight: 900; font-size: 19px; color: var(--accent-on);
  background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 84%, #fff), var(--accent) 65%);
  box-shadow: 0 8px 22px -10px rgba(20, 71, 230, .8), inset 0 1px 0 rgba(255, 255, 255, .35);
}
/* Logo de la liga (assets/league/logo.webp): si falta o no carga, se ve la "Y" */
.brand-logo {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: contain; border-radius: inherit;
}
.brand-mark.has-logo { color: transparent; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 15.5px; letter-spacing: -.01em; }
.brand-text small { color: var(--muted); font-size: 11.5px; }

.header-right { display: flex; align-items: center; gap: 14px; margin-left: auto; flex-wrap: wrap; }

.main-nav { display: flex; gap: 4px; }
.nav-link {
  padding: 8px 13px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
  color: var(--muted); transition: .15s;
}
.nav-link:hover { color: var(--text); background: var(--tint); }
.nav-link.active {
  color: var(--accent-2); background: color-mix(in srgb, var(--accent) 14%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}

/* ---------- Bottom nav (móvil) ---------- */
.bottom-nav {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--header-bg-solid); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav .nav-link {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10.5px; padding: 7px 2px; text-align: center;
}
.bottom-nav .nav-link span.ic { font-size: 16px; line-height: 1; }

/* ---------- Página / vistas ---------- */
.page { padding: 26px 18px 70px; }
.view { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin: 30px 0 16px; flex-wrap: wrap; }
.section-head:first-child { margin-top: 0; }
.section-head h2 { margin: 0; font-size: 23px; letter-spacing: -.02em; }
.section-head p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.live-status { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }

/* ---------- Selector de división ---------- */
.division-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 26px; }
.division-card {
  position: relative; text-align: left; overflow: hidden;
  background: linear-gradient(160deg, var(--card), var(--card-3));
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px 18px; transition: .18s;
  display: flex; flex-direction: column; gap: 3px;
}
.division-card::after {
  content: ''; position: absolute; inset: 0 auto auto 0; height: 3px; width: 0;
  background: var(--div-accent, var(--accent)); transition: width .3s ease;
}
.division-card .division-tag { font-size: 17px; font-weight: 900; letter-spacing: .16em; color: var(--div-accent, var(--accent)); }
.division-card .division-sub { font-size: 13.5px; color: var(--text); font-weight: 600; }
.division-card .division-meta { font-size: 11.5px; color: var(--muted); }
.division-card:hover { border-color: color-mix(in srgb, var(--div-accent, var(--accent)) 45%, var(--line)); }
.division-card.active { border-color: color-mix(in srgb, var(--div-accent, var(--accent)) 65%, transparent); background: linear-gradient(160deg, color-mix(in srgb, var(--div-accent, var(--accent)) 9%, var(--card)), var(--card-3)); box-shadow: 0 18px 40px -30px var(--div-accent, var(--accent)); }
.division-card.active::after { width: 100%; }
.div-gold { --div-accent: var(--gold); }
.div-silver { --div-accent: var(--silver); }

/* ---------- Cards base ---------- */
.card {
  background: linear-gradient(170deg, var(--card), var(--card-3));
  border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow);
}
.card-pad { padding: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

/* ---------- Pill / badges ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .03em;
  padding: 4px 9px; border-radius: 999px;
  background: var(--tint); border: 1px solid var(--line);
  color: var(--muted); white-space: nowrap;
}
.pill-gold { color: var(--gold-2); background: color-mix(in srgb, var(--gold) 15%, transparent); border-color: color-mix(in srgb, var(--gold) 35%, transparent); }
.pill-silver { color: var(--silver-2); background: rgba(148, 163, 184, .13); border-color: rgba(148, 163, 184, .32); }
.pill-live { color: var(--live-ink); background: rgba(239, 68, 68, .16); border-color: rgba(239, 68, 68, .4); }
.pill-clock { color: var(--live-ink); background: rgba(140, 20, 20, .35); border-color: rgba(239, 68, 68, .35); font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-weight: 800; letter-spacing: .06em; }
.pill-finished { color: var(--green-ink); background: rgba(34, 197, 94, .13); border-color: rgba(34, 197, 94, .3); }
.pill-postponed { color: var(--yellow-ink); background: rgba(234, 179, 8, .14); border-color: rgba(234, 179, 8, .36); }
.pill-cancelled { color: var(--danger-ink); background: rgba(148, 163, 184, .12); border-color: rgba(248, 113, 113, .3); }
[data-theme="light"] .pill-clock { background: rgba(220, 38, 38, .08); border-color: rgba(220, 38, 38, .3); }

.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--live); animation: ping 1.5s infinite; }
@keyframes ping {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .6); }
  70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* ---------- Tarjeta partido en vivo ---------- */
.match-card { padding: 18px; position: relative; overflow: hidden; }
.match-card::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(239, 68, 68, .7), transparent);
}
.match-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.match-top .pills { display: flex; gap: 6px; flex-wrap: wrap; }

.scoreboard { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 6px 0 14px; border-bottom: 1px solid var(--line-soft); }
.team-side { display: flex; align-items: center; gap: 10px; min-width: 0; }
.team-side.away { flex-direction: row-reverse; text-align: right; }
.team-side .t-name { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-side .t-sub { font-size: 11px; color: var(--muted); }
.crest {
  --tc: #334155;
  width: 46px; height: 46px; flex: 0 0 46px; border-radius: 15px;
  display: inline-grid; place-items: center; align-self: center;
  overflow: hidden;
  font-size: 12.5px; font-weight: 900; letter-spacing: .04em; color: #fff;
  background: linear-gradient(145deg, var(--tc), color-mix(in srgb, var(--tc) 42%, #050706));
  border: 1px solid color-mix(in srgb, var(--text) 14%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 10px 22px -14px rgba(0, 0, 0, .8);
}
.crest.sm { width: 34px; height: 34px; flex-basis: 34px; border-radius: 11px; font-size: 10.5px; }
.crest.has-img { padding: 0; }
.crest img { width: 100%; height: 100%; object-fit: contain; object-position: center; display: block; }

.avatar {
  display: inline-block; width: 26px; height: 26px; flex: 0 0 auto;
  border-radius: 50%; overflow: hidden; vertical-align: middle;
  margin-right: 7px; background: var(--tint);
  border: 1px solid rgba(255, 255, 255, .16);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.sm { width: 22px; height: 22px; margin-right: 6px; }
.score { font-size: 34px; font-weight: 900; letter-spacing: .06em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.score .sep, .mc-score .sep { color: var(--muted); margin: 0 5px; font-weight: 600; }

.events { margin-top: 12px; display: flex; flex-direction: column; gap: 7px; min-height: 44px; }
.event-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--tint-soft); border: 1px solid var(--line-soft);
  padding: 8px 11px; border-radius: 11px; font-size: 13px;
}
.event-row .ev-left { display: flex; align-items: center; gap: 9px; min-width: 0; }
.event-row .ev-ic {
  width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center;
  font-size: 12px; background: var(--tint);
}
.event-row .ev-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-row .ev-team { font-size: 10.5px; color: var(--muted); }
.event-row .ev-min { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--accent-2); font-weight: 700; }
.ev-goal .ev-ic { background: rgba(34, 197, 94, .16); }
.ev-yellow .ev-ic { background: rgba(234, 179, 8, .18); }
.ev-red .ev-ic { background: rgba(239, 68, 68, .18); }
.ev-corner .ev-ic { background: rgba(96, 165, 250, .16); }
.ev-assist .ev-ic { background: rgba(251, 146, 60, .16); }
.ev-sub .ev-ic { background: rgba(168, 85, 247, .16); }

.empty-inline { color: var(--muted); font-size: 13px; text-align: center; padding: 14px 6px; }

/* ---------- Estado vacío ---------- */
.empty-state { text-align: center; padding: 40px 22px; }
.empty-state .es-ic { font-size: 34px; }
.empty-state h3 { margin: 12px 0 6px; font-size: 19px; }
.empty-state p { margin: 0 auto; max-width: 520px; color: var(--muted); font-size: 14px; }
.es-actions { margin-top: 18px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- Próximos partidos ---------- */
.next-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.next-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; }
.next-item .ni-when { font-size: 11px; color: var(--muted); }
.next-item .ni-teams { font-size: 13.5px; font-weight: 700; margin-top: 2px; }
.next-item .ni-vs { color: var(--muted); font-weight: 500; font-size: 12px; }

/* ---------- Toolbar / chips ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  padding: 7px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--card); border: 1px solid var(--line); color: var(--muted); transition: .15s;
}
.chip:hover { color: var(--text); }
.chip.active { background: color-mix(in srgb, var(--accent) 15%, transparent); border-color: color-mix(in srgb, var(--accent) 42%, transparent); color: var(--accent-2); }

.search-input {
  background: var(--card); border: 1px solid var(--line); border-radius: 11px;
  padding: 9px 13px; font-size: 13.5px; min-width: 210px; outline: none;
}
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.search-input::placeholder { color: var(--placeholder); }

/* ---------- Fixtures ---------- */
.jornada { margin-bottom: 26px; }
.jornada-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.jornada-head .jh-title { font-size: 13px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-2); }
.jornada-head .jh-line { flex: 1; height: 1px; background: var(--line); }
.fixture {
  display: grid; grid-template-columns: 92px minmax(0, 1fr) auto minmax(0, 1fr) 108px; align-items: center; gap: 12px;
  width: 100%;
  padding: 12px 15px; margin-bottom: 8px;
}
.fixture .fx-when { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.fixture .fx-when b { display: block; color: var(--text); font-size: 12.5px; }
.fx-team { display: flex; align-items: center; gap: 9px; min-width: 0; font-weight: 600; font-size: 14px; }
.fx-team.away { flex-direction: row-reverse; text-align: right; }
.fx-team span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-score {
  min-width: 74px; text-align: center; font-size: 19px; font-weight: 900;
  font-variant-numeric: tabular-nums; letter-spacing: .05em;
}
.fx-score small { display: block; font-size: 10.5px; font-weight: 700; color: var(--muted); letter-spacing: 0; margin-top: 2px; }
.fx-status { text-align: right; }
.fixture.is-live { border-color: rgba(239, 68, 68, .38); background: linear-gradient(170deg, rgba(239, 68, 68, .07), var(--card-3)); }
.fixture.is-stopped { opacity: .72; }

/* ---------- Tabla de posiciones ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* Estadísticas: todas las filas, con scroll interno y cabecera fija */
.table-scroll {
  max-height: min(62vh, 520px); overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
  border-radius: var(--r-sm);
}
.table-scroll:focus-visible { outline: 2px solid var(--accent-2); outline-offset: -2px; }
.table-scroll table.data thead th {
  position: sticky; top: 0; z-index: 1; background: var(--card-2);
  box-shadow: inset 0 -1px 0 var(--line);
}
.table-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.table-scroll::-webkit-scrollbar-track { background: transparent; }
.table-scroll::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 620px; }
table.data th, table.data td { padding: 11px 9px; text-align: center; border-bottom: 1px solid var(--line-soft); }
table.data th { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
table.data td.num { font-variant-numeric: tabular-nums; }
table.data tbody tr:hover { background: var(--tint-soft); }
table.data .cell-team { display: flex; align-items: center; gap: 9px; text-align: left; font-weight: 700; }
table.data .pos {
  width: 26px; height: 26px; border-radius: 8px; display: inline-grid; place-items: center;
  font-size: 12px; font-weight: 800; background: var(--tint);
}
/* Zonas de la tabla (según divisiones[...].zones en js/config.js) — dorado: campeón/ascenso */
tr.z-champ .pos { background: color-mix(in srgb, var(--gold) 22%, transparent); color: var(--gold-2); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gold) 48%, transparent); }
tr.z-title .pos { background: color-mix(in srgb, var(--gold) 14%, transparent); color: var(--gold-2); }
tr.z-mid .pos { background: rgba(148, 163, 184, .16); color: var(--silver-2); }
tr.z-down .pos { background: rgba(239, 68, 68, .16); color: var(--live-ink); }
td.pts { font-weight: 900; color: var(--gold-2); }
.table-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); margin-top: 12px; }
.table-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 5px; vertical-align: middle; }

/* ---------- Equipos / plantillas ---------- */
.teams-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.team-card { overflow: hidden; }
.team-card-head { display: flex; align-items: center; gap: 12px; padding: 15px 16px; width: 100%; text-align: left; }
.team-card-head .tch-meta { flex: 1; min-width: 0; }
.team-card-head .tch-name { font-weight: 800; font-size: 15px; }
.team-card-head .tch-sub { font-size: 11.5px; color: var(--muted); }
.team-card-head .chev { color: var(--muted); transition: transform .2s; }
.team-card.open .chev { transform: rotate(180deg); }
.roster { border-top: 1px solid var(--line-soft); max-height: 340px; overflow-y: auto; }
.roster-row { display: grid; grid-template-columns: 34px 1fr auto auto; align-items: center; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; }
.roster-row:last-child { border-bottom: 0; }
.roster-row .num { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 11.5px; font-weight: 800; background: var(--tint); color: var(--muted); }
.roster-row .pos { font-size: 10.5px; font-weight: 800; letter-spacing: .06em; color: var(--accent-2); background: color-mix(in srgb, var(--accent) 12%, transparent); padding: 2px 7px; border-radius: 6px; }
.roster-row .mini-stats { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 12px; font-size: 13.5px; font-weight: 700;
  background: var(--card-2); border: 1px solid var(--line); transition: .15s; color: var(--text);
}
.btn:hover { border-color: var(--line-strong); background: var(--btn-hover-bg); }
.btn-primary { background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 86%, #fff), var(--accent) 75%); color: var(--accent-on); border-color: transparent; box-shadow: 0 12px 26px -16px color-mix(in srgb, var(--accent) 90%, transparent); }
.btn-primary:hover { filter: brightness(1.06); background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 86%, #fff), var(--accent) 75%); }
.btn-outline { background: transparent; border-color: color-mix(in srgb, var(--accent) 50%, transparent); color: var(--accent-2); }
.btn-outline:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); border-color: var(--accent); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; border-radius: 10px; }
.btn-danger { background: rgba(239, 68, 68, .14); border-color: rgba(239, 68, 68, .4); color: var(--live-ink); }
.btn-danger:hover { background: rgba(239, 68, 68, .22); border-color: var(--live); }
.btn-success { background: rgba(34, 197, 94, .14); border-color: rgba(34, 197, 94, .4); color: var(--green-ink); }
.btn-success:hover { background: rgba(34, 197, 94, .22); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- Centro del partido (modal) ---------- */
.mc { position: fixed; inset: 0; z-index: 90; display: flex; align-items: flex-end; justify-content: center; }
.mc-backdrop { position: absolute; inset: 0; background: var(--backdrop); backdrop-filter: blur(4px); }
.mc-panel {
  position: relative; width: 100%; max-width: 760px; max-height: 92vh; overflow-y: auto;
  background: var(--panel-bg);
  border: 1px solid var(--line); border-bottom: 0;
  border-radius: 24px 24px 0 0; padding: 22px 20px 34px;
  animation: up .28s cubic-bezier(.2, .8, .3, 1);
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.mc-close {
  position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 10px;
  background: var(--tint); border: 1px solid var(--line); font-size: 15px; color: var(--muted);
}
.mc-close:hover { color: var(--text); }
.mc-title { font-size: 12px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.mc-score { font-size: 46px; font-weight: 900; letter-spacing: .05em; font-variant-numeric: tabular-nums; }
.timeline { position: relative; margin-top: 18px; padding-left: 6px; }
.tl-item { display: grid; grid-template-columns: 52px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line-soft); }
.tl-item:last-child { border-bottom: 0; }
.tl-min { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; color: var(--accent-2); font-weight: 800; padding-top: 2px; }
.tl-body { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.tl-body .tl-sub { font-size: 11.5px; color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line-soft); padding: 22px 0 34px; color: var(--muted); font-size: 12px; }
.site-footer .foot-inner { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; }

/* ---------- Acceso restringido ---------- */
.login-screen {
  min-height: calc(100vh - 62px);
  display: flex; align-items: center; justify-content: center;
  padding: 34px 16px 60px;
}
.login-card { width: 100%; max-width: 384px; padding: 30px 26px 26px; text-align: center; }
.login-card .brand-mark { width: 54px; height: 54px; border-radius: 17px; font-size: 25px; margin: 0 auto 14px; }
.login-card h1 { margin: 0 0 5px; font-size: 20px; letter-spacing: -.02em; }
.login-sub { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
#login-form { display: flex; flex-direction: column; gap: 13px; text-align: left; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span {
  font-size: 11px; font-weight: 800; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted);
}
.field input {
  width: 100%; background: var(--card-3); border: 1px solid var(--line);
  border-radius: 12px; padding: 13px 14px; font-size: 15px; color: var(--text); outline: none;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.login-error {
  margin: 0; font-size: 13px; line-height: 1.45; color: var(--live-ink);
  background: rgba(239, 68, 68, .12); border: 1px solid rgba(239, 68, 68, .35);
  padding: 9px 11px; border-radius: 10px;
}
.login-back { display: block; text-align: center; margin-top: 17px; }
#who-am-i { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent) 42%, transparent); background: color-mix(in srgb, var(--accent) 12%, transparent); }

/* ---------- Admin ---------- */
.admin-page { max-width: 720px; margin: 0 auto; padding: 20px 16px 90px; }
.admin-header {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; background: var(--admin-header-bg); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.admin-header .ah-title { font-weight: 800; font-size: 15px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-header .ah-back { font-size: 13px; color: var(--muted); }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px rgba(34, 197, 94, .8); }
.conn-dot.off { background: var(--yellow); box-shadow: 0 0 8px rgba(234, 179, 8, .8); }
.conn-dot.warn { background: #f97316; box-shadow: 0 0 8px rgba(249, 115, 22, .8); }

.admin-card { padding: 16px; margin-bottom: 14px; }
.admin-step { display: flex; align-items: center; gap: 9px; margin-bottom: 13px; }
.admin-step .n {
  width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center;
  font-size: 12px; font-weight: 900; background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent-2);
}
.admin-step h2 { margin: 0; font-size: 14.5px; font-weight: 800; }

.pitch-toggle, .seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg-3 { grid-template-columns: repeat(3, 1fr); }
.toggle-btn {
  padding: 13px; border-radius: 13px; font-weight: 800; font-size: 14px;
  background: var(--card-3); border: 1px solid var(--line); color: var(--muted); transition: .15s;
}
.toggle-btn.active { background: color-mix(in srgb, var(--accent) 15%, transparent); border-color: color-mix(in srgb, var(--accent) 52%, transparent); color: var(--accent-2); }
.toggle-btn.silver.active { background: rgba(148, 163, 184, .13); border-color: rgba(148, 163, 184, .5); color: var(--silver-2); }

.match-picker { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; }
.pick-match {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border-radius: 13px; text-align: left;
  background: var(--card-3); border: 1px solid var(--line);
}
.pick-match .pm-teams { font-size: 14px; font-weight: 800; }
.pick-match .pm-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.pick-match.active { border-color: color-mix(in srgb, var(--accent) 62%, transparent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.pick-match .pm-state { font-size: 11px; font-weight: 800; color: var(--muted); white-space: nowrap; }

.status-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.status-big { font-size: 15px; font-weight: 900; letter-spacing: .02em; }
.clock-box { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 12px 0; }
.clock-btn { width: 52px; height: 52px; border-radius: 16px; font-size: 22px; font-weight: 800; background: var(--card-3); border: 1px solid var(--line); }
.clock-btn:hover { border-color: var(--accent); }
.clock-btn:disabled { opacity: .4; cursor: not-allowed; }
.clock-btn:disabled:hover { border-color: var(--line); }
.clock-val { min-width: 108px; text-align: center; font-size: 34px; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.clock-val small { display: block; font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: .08em; }

.action-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.action-grid .btn { padding: 13px 6px; font-size: 12.5px; flex-direction: column; gap: 4px; }
.action-grid .btn .ic { font-size: 17px; }

.stepper { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin-top: 12px; }
.stepper .side { display: flex; flex-direction: column; gap: 7px; }
.stepper .side .lbl { font-size: 11.5px; color: var(--muted); text-align: center; font-weight: 700; }
.stepper .row { display: flex; gap: 7px; justify-content: center; }
.stepper .row .btn { flex: 1; padding: 11px 4px; font-size: 17px; font-weight: 900; }
.stepper .big-score { text-align: center; font-size: 32px; font-weight: 900; font-variant-numeric: tabular-nums; }
.stepper .big-score small { display: block; font-size: 10.5px; color: var(--muted); letter-spacing: .1em; }

.event-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (min-width: 640px) { .event-grid { grid-template-columns: repeat(5, 1fr); } }
.ev-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  padding: 15px 6px; border-radius: 15px; font-size: 12.5px; font-weight: 800;
  background: var(--card-3); border: 1px solid var(--line); transition: .15s;
}
.ev-btn .ic { font-size: 21px; }
.ev-btn:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.ev-btn.goal { border-color: rgba(34, 197, 94, .35); }
.ev-btn.yellow { border-color: rgba(234, 179, 8, .35); }
.ev-btn.red { border-color: rgba(239, 68, 68, .35); }
.ev-btn.corner { border-color: rgba(96, 165, 250, .35); }
.ev-btn.assist { border-color: rgba(251, 146, 60, .35); }
.ev-btn.sub { border-color: rgba(168, 85, 247, .35); }

.log-list { display: flex; flex-direction: column; gap: 7px; margin-top: 12px; }
.log-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 11px; background: var(--tint-soft); border: 1px solid var(--line-soft); border-radius: 11px; font-size: 13px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 10px; }

/* ---------- Selector de jugadores (hoja inferior) ---------- */
.sheet { position: fixed; inset: 0; z-index: 95; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: var(--backdrop-strong); }
.sheet-panel {
  position: relative; width: 100%; max-width: 560px; max-height: 82vh; overflow: hidden;
  display: flex; flex-direction: column;
  background: var(--panel-bg-2);
  border: 1px solid var(--line); border-bottom: 0; border-radius: 22px 22px 0 0;
  animation: up .24s cubic-bezier(.2, .8, .3, 1);
}
.sheet-head { padding: 16px 18px 12px; border-bottom: 1px solid var(--line-soft); }
.sheet-head h3 { margin: 0 0 4px; font-size: 16px; }
.sheet-head p { margin: 0; font-size: 12.5px; color: var(--muted); }
.sheet-body { padding: 12px 14px calc(18px + env(safe-area-inset-bottom)); overflow-y: auto; }
.sheet-body .search-input { width: 100%; margin-bottom: 10px; }
.pick-team { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.player-list { display: flex; flex-direction: column; gap: 6px; }
.player-item {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px; text-align: left;
  background: var(--card-3); border: 1px solid var(--line); border-radius: 12px; font-size: 14px;
}
.player-item:hover { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.player-item .pi-num { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--tint); color: var(--muted); }
.player-item .pi-name { display: flex; align-items: center; min-width: 0; }
.player-item .pi-pos { margin-left: auto; font-size: 10.5px; font-weight: 800; color: var(--accent-2); }

/* ---------- Tema (claro / oscuro) ---------- */
.theme-toggle { min-width: 38px; padding: 7px 10px; font-size: 15px; line-height: 1; }
.theme-toggle .tt-moon, [data-theme="light"] .theme-toggle .tt-sun { display: none; }
[data-theme="light"] .theme-toggle .tt-moon { display: inline; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  z-index: 120; padding: 11px 18px; border-radius: 999px; font-size: 13.5px; font-weight: 700;
  background: var(--card-3); border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); color: var(--accent-2);
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Skeleton ---------- */
.skeleton { height: 190px; border-radius: var(--r); background: linear-gradient(90deg, var(--shimmer-a) 25%, var(--shimmer-b) 50%, var(--shimmer-a) 75%); background-size: 400% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .main-nav { display: none; }
  .bottom-nav { display: flex; gap: 2px; }
  body { padding-bottom: 66px; }
  .toast { bottom: 82px; }
}
@media (max-width: 720px) {
  .grid-2 { grid-template-columns: 1fr; }
  .division-switch { grid-template-columns: 1fr 1fr; gap: 10px; }
  .division-card { padding: 13px 14px; }
  .division-card .division-tag { font-size: 15px; }
  .fixture { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); grid-template-areas: 'home score away' 'when when status'; row-gap: 8px; }
  .fixture .fx-team.home { grid-area: home; }
  .fixture .fx-score { grid-area: score; }
  .fixture .fx-team.away { grid-area: away; }
  .fixture .fx-when { grid-area: when; }
  .fixture .fx-status { grid-area: status; }
  .score { font-size: 30px; }
  .section-head h2 { font-size: 20px; }
  .search-input { min-width: 0; width: 100%; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .action-grid { grid-template-columns: repeat(2, 1fr); }
  .teams-grid { grid-template-columns: 1fr; }
}
@media (min-width: 721px) {
  .mc { align-items: center; }
  .mc-panel { border-radius: 24px; border-bottom: 1px solid var(--line); max-height: 86vh; }
}
