:root {
  --navy: #092b63;
  --blue: #1a3fa8;
  --gold: #ffb81c;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --panel: #ffffff;
  --surface: #f0f2f7;
  --ok: #16a34a;
  --danger: #dc2626;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { width: 100%; overflow-x: clip; }
body { width: 100%; min-height: 100vh; overflow-x: clip; background: var(--surface); color: var(--ink); font-weight: 400; padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }

/* ── STICKY HEADER WRAPPER ── */
.sticky-header {
  position: sticky; top: 0; z-index: 30;
}

/* ── TOPBAR ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px clamp(14px,4vw,28px);
  background: var(--navy); border-bottom: 3px solid var(--gold);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { width: 40px; height: 40px; border-radius: 8px; background:#fff; padding:3px; object-fit:contain; }
.brand h1 { color:#fff; font-size:18px; line-height:1.1; font-weight: 650; }
.brand p { color:#9ab0d8; font-size:9.5px; font-weight:600; text-transform:uppercase; letter-spacing:.06em; }
.topbar-right { display:flex; align-items:center; justify-content:flex-end; gap:10px; min-width:0; }
.sync { display:flex; align-items:center; gap:7px; font-size:11.5px; color:#9ab0d8; }
.sync-dot { width:8px; height:8px; border-radius:50%; background:var(--gold); flex-shrink:0; }
.sync-dot.ok { background:var(--ok); }
.sync-dot.error { background:var(--danger); }
.icon-btn { width:32px; height:32px; border:1px solid rgba(255,255,255,.22); border-radius:7px; background:rgba(255,255,255,.08); color:#fff; font-size:17px; cursor:pointer; display:grid; place-items:center; }
.back-link { font-size:12px; font-weight:600; color:rgba(255,255,255,.7); text-decoration:none; padding:5px 10px; border:1px solid rgba(255,255,255,.22); border-radius:6px; white-space:nowrap; }

/* ── SPORT NAV ── */
.sport-nav-wrap {
  max-width: 100%;
  overflow: hidden;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(9, 43, 99, .04);
}
.sport-nav {
  display: flex; gap: 0; width: 100%; max-width: 100vw; overflow-x: auto; overflow-y: hidden; padding: 0 clamp(14px,4vw,28px);
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.sport-nav::-webkit-scrollbar { display:none; }
.sport-btn {
  position: relative;
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  width: 164px;
  min-height: 48px;
  padding: 10px 16px 11px;
  border: 0;
  border-right: 1px solid rgba(229, 231, 235, .86);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  white-space: normal; transition: background .15s, color .15s;
  min-width: 0; scroll-snap-align: start;
  overflow-wrap: anywhere; text-align: left;
}
.sport-btn span,
.sport-btn small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.sport-btn span {
  font-size: 11.5px;
  line-height: 1.18;
  font-weight: 650;
  color: var(--ink);
}
.sport-btn small {
  font-size: 10px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.sport-btn::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: transparent;
}
.sport-btn .sport-icon { font-size: 17px; }
.sport-btn:hover { background: #f8faff; }
.sport-btn.active { background: #fffaf0; color: var(--navy); }
.sport-btn.active span { color: var(--navy); }
.sport-btn.active small { color: #9a6a00; }
.sport-btn.active::after { background: var(--gold); }

/* ── TABS ── */
.tab-bar {
  display: flex; background: var(--panel);
  border-bottom: 1.5px solid var(--line);
  padding: 0 clamp(14px,4vw,28px);
  overflow-x: auto; scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display:none; }
.tab-btn {
  flex-shrink: 0; padding: 13px 18px;
  font-size: 13px; font-weight: 500; color: var(--muted);
  background: none; border: none; cursor: pointer;
  border-bottom: 2.5px solid transparent; margin-bottom: -1.5px;
  transition: color .15s, border-color .15s;
}
.tab-btn:hover { color: var(--navy); }
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }

/* ── CONTENT ── */
.content-area { padding: 16px clamp(14px,4vw,28px) 40px; max-width: 980px; margin: 0 auto; }

/* ── ERROR ── */
.error-bar { background:#fef2f2; border:1px solid #fca5a5; border-radius:10px; padding:12px 16px; color:var(--danger); font-size:13px; margin-bottom:14px; }

/* ── EMPTY ── */
.empty { text-align:center; padding:52px 24px; color:var(--muted); }
.empty .ei { font-size:40px; margin-bottom:12px; }
.empty h3 { color:var(--navy); font-size:17px; font-weight:650; margin-bottom:6px; }
.empty p { font-size:13px; line-height:1.5; }

/* ═══════════════════════════════
   MATCH CARDS  (Resultados / Fixture)
   ═══════════════════════════════ */
.match-list { display:flex; flex-direction:column; gap:10px; }
.date-group { margin-bottom: 6px; }
.date-group-label {
  font-size: 11px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); padding: 14px 2px 8px;
}

.match-card-v2 {
  display: flex; background: var(--panel); border-radius: 14px;
  box-shadow: 0 1px 6px rgba(0,0,0,.08); overflow: hidden;
}

/* fecha + hora a la izquierda */
.mc-date {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 14px 14px; min-width: 56px; border-right: 1px solid var(--line);
  background: #f8faff;
}
.mc-date .md { font-size: 13px; font-weight: 650; color: var(--navy); line-height: 1.2; }
.mc-date .mt { font-size: 11px; color: var(--muted); font-weight: 400; }

/* equipos centro */
.mc-teams { flex: 1; display: flex; flex-direction: column; }
.mc-team {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 14px; flex: 1;
}
.mc-team + .mc-team { border-top: 1px solid var(--line); }
.mc-team img { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; object-fit: cover; }
.mc-team-name { flex: 1; font-size: 14px; font-weight: 500; color: var(--ink); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mc-team-name.muted { color: var(--muted); font-weight: 400; }

/* scores derecha */
.mc-scores {
  display: flex; flex-direction: column;
  border-left: 1px solid var(--line);
  min-width: 44px;
}
.mc-score {
  display: flex; align-items: center; justify-content: center;
  flex: 1; font-size: 22px; font-weight: 700; color: var(--ink); padding: 0 14px;
}
.mc-score + .mc-score { border-top: 1px solid var(--line); }
.mc-score.winner { color: var(--navy); }
.mc-score.loser { color: var(--muted); font-size: 18px; font-weight: 400; }

/* pending (fixture) */
.mc-pending .mc-date { background: var(--surface); }
.mc-pending .mc-score-ph {
  display: flex; align-items: center; justify-content: center;
  flex: 1; padding: 0 12px; color: var(--line);
  font-size: 20px;
}
.mc-pending .mc-score-ph + .mc-score-ph { border-top: 1px solid var(--line); }
.mc-badge {
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 550; color: var(--muted);
  padding: 4px 8px; border-top: 1px solid var(--line);
  letter-spacing: .04em; text-transform: uppercase;
  background: #f8faff;
}

/* ═══════════════════════════════
   STANDINGS
   ═══════════════════════════════ */
.group-section { margin-bottom: 28px; }
.group-lbl {
  font-size: 12px; font-weight: 650; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px; padding: 0 2px;
}
.standings-card { max-width: 100%; background: var(--panel); border-radius: 14px; overflow: hidden; box-shadow: 0 1px 6px rgba(0,0,0,.08); }
.standings-head {
  display: grid; grid-template-columns: 32px minmax(0,1fr) 36px 36px 36px 38px;
  padding: 9px 16px; background: #f1f5ff;
  font-size: 10.5px; font-weight: 650; color: var(--muted); letter-spacing: .07em; text-transform: uppercase;
}
.standings-head span { min-width: 0; }
.standings-head span:nth-child(n+3) { text-align:center; }
.standings-row {
  display: grid; grid-template-columns: 32px minmax(0,1fr) 36px 36px 36px 38px;
  padding: 12px 16px; align-items: center;
  border-top: 1px solid var(--line); font-size: 13.5px;
}
.standings-row:first-of-type { border-top: none; }
.standings-row:nth-child(even) { background: #fafbff; }
.sr-pos { font-weight: 650; font-size: 13px; color: var(--muted); }
.sr-pos.p1 { color: #b8860b; }
.sr-pos.p2 { color: #9ca3af; }
.sr-team { display:flex; align-items:center; gap:8px; font-weight:500; min-width:0; }
.sr-team img { width:26px; height:26px; border-radius:50%; flex-shrink:0; }
.sr-team span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sr-stat { text-align:center; color:var(--muted); font-size:13px; }
.sr-pt { text-align:center; font-weight:650; font-size:15px; color:var(--navy); }

/* ═══════════════════════════════
   BRACKET
   ═══════════════════════════════ */
.final-stage {
  padding: 10px 0 24px;
}

.final-title {
  margin: 4px 0 22px;
  font-size: 24px;
  font-weight: 650;
  letter-spacing: 0;
  color: var(--ink);
}

.bracket-wrap {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 0 20px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(107, 114, 128, .38) rgba(229, 231, 235, .7);
}

.bracket-wrap::-webkit-scrollbar { height: 6px; }
.bracket-wrap::-webkit-scrollbar-track { background: rgba(229, 231, 235, .7); border-radius: 999px; }
.bracket-wrap::-webkit-scrollbar-thumb { background: rgba(107, 114, 128, .38); border-radius: 999px; }

.final-pending-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 18px;
  align-items: stretch;
  max-width: 760px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 14px;
  box-shadow: 0 1px 8px rgba(9, 43, 99, .06);
}

.final-pending-copy {
  display: grid;
  align-content: center;
  gap: 6px;
}

.final-pending-copy h3 {
  font-size: 18px;
  font-weight: 650;
  color: var(--ink);
}

.final-pending-copy p {
  max-width: 420px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.final-pending-list {
  display: grid;
  gap: 8px;
}

.final-pending-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  background: #f8faff;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.final-pending-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.final-pending-item strong {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
}

.asa-bracket {
  position: relative;
  display: grid;
  grid-template-columns: 210px 70px 210px 70px 210px;
  min-width: 770px;
  min-height: 520px;
  align-items: stretch;
}

.asa-bracket.has-quarters {
  grid-template-columns: 210px 70px 210px 70px 210px 70px 210px;
  min-width: 1050px;
}

.asa-round {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 500px;
  padding: 22px 0 28px;
}

.asa-round::before {
  content: "";
  position: absolute;
  inset: 0 8px 0 0;
  background: rgba(226, 232, 242, 0.56);
  z-index: 0;
}

.asa-final::before {
  background: transparent;
}

.asa-round h3 {
  position: relative;
  z-index: 1;
  margin: 0 0 26px;
  padding-left: 18px;
  color: rgba(107, 114, 128, 0.48);
  font-size: 32px;
  font-weight: 300;
  line-height: 1;
}

.asa-round-matches {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  min-height: 390px;
  gap: 72px;
  padding-left: 8px;
}

.asa-final .asa-round-matches {
  justify-content: center;
  padding-left: 0;
}

.asa-connector {
  position: relative;
  min-height: 500px;
}

.asa-connector .line {
  position: absolute;
  display: block;
  background: #9ca3af;
}

.asa-connector .top {
  width: 36px;
  height: 2px;
  left: 0;
  top: 40%;
}

.asa-connector .bottom {
  width: 36px;
  height: 2px;
  left: 0;
  top: 67%;
}

.asa-connector .middle {
  width: 2px;
  height: 27%;
  left: 35px;
  top: 40%;
}

.asa-connector::after {
  content: "";
  position: absolute;
  left: 35px;
  top: var(--mid-pct, 53.5%);
  width: 35px;
  height: 2px;
  background: #9ca3af;
}

.asa-connector-single .line {
  display: none;
}

.asa-connector-single::after {
  left: 0;
  width: 70px;
}

.bm-card {
  width: 176px;
  background: var(--panel);
  border: 1px solid rgba(209, 213, 219, 0.9);
  border-radius: 10px;
  box-shadow: 0 1px 5px rgba(0,0,0,.08);
  overflow: hidden;
  flex-shrink: 0;
}

.bm-empty {
  display: grid;
  min-height: 124px;
  place-items: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
}

.bm-header {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 14px 12px 10px;
}
.bm-team-col { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.bm-team-col img { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); }
.bm-team-col span { max-width: 68px; overflow: hidden; text-align: center; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 400; color: var(--ink); letter-spacing:0; }
.bm-team-col.penalty-winner span {
  color: var(--navy);
  font-weight: 650;
}
.bm-team-col.penalty-winner img {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(255, 184, 28, .32);
}
.bm-score-bar {
  background: #1356b3;
  padding: 9px 12px 10px;
  display: grid;
  gap: 3px;
  justify-items: center;
}
.bm-score-bar.has-penalties {
  background: linear-gradient(180deg, #1356b3 0%, #0f4da3 100%);
}
.bm-score-bar.pending { background: #1356b3; }
.bm-score-txt { font-size: 22px; font-weight: 650; color: #fff; letter-spacing: .04em; line-height: 1; }
.bm-score-bar.pending .bm-score-txt { color: #fff; font-size: 22px; }
.bm-penalty-note {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #ffe7a3;
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.15;
}
.bm-score-date { font-size: 15px; color: rgba(255,255,255,.62); font-weight: 300; }
.bm-score-bar.pending .bm-score-date { color: rgba(255,255,255,.62); }

.champion-card {
  display: grid;
  min-height: 142px;
}

.champion-top {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  padding: 16px 12px 12px;
}

.champion-top img {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line);
}

.champion-top span {
  max-width: 140px;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

.champion-ribbon {
  display: grid;
  place-items: center;
  background: var(--gold);
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  padding: 10px 12px;
}

@media (max-width: 700px) {
  .final-stage {
    padding-top: 14px;
  }

  .final-title {
    margin: 2px 0 18px;
    font-size: 22px;
    font-weight: 600;
  }

  .bracket-wrap {
    overflow: visible;
    padding: 0;
  }

  .asa-bracket,
  .asa-bracket.has-quarters {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    min-width: 0;
    min-height: 0;
  }

  .asa-connector {
    display: none;
  }

  .asa-round {
    min-height: 0;
    padding: 0;
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 1px 8px rgba(9, 43, 99, .06);
  }

  .asa-round::before {
    display: none;
  }

  .asa-round h3 {
    margin: 0;
    padding: 12px 14px;
    background: #f5f8fc;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
    letter-spacing: 0;
    line-height: 1.2;
  }

  .asa-round-matches,
  .asa-final .asa-round-matches {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    justify-items: stretch;
    min-height: 0;
    gap: 10px;
    padding: 12px;
  }

  .bm-card {
    justify-self: stretch;
    width: auto;
    border-radius: 12px;
    box-shadow: 0 1px 5px rgba(9, 43, 99, .08);
  }

  .bm-empty {
    min-height: 92px;
  }

  .bm-team-col span {
    max-width: 118px;
  }

  .champion-card {
    min-height: 0;
  }
}

@media (max-width: 480px) {
  .topbar { align-items: flex-start; gap: 8px; padding: 8px 10px; }
  .brand img { width: 36px; height: 36px; }
  .brand h1 { font-size: 17px; }
  .brand p { font-size: 8.5px; }
  .topbar-right { flex-direction: column; align-items: flex-end; gap: 5px; }
  .sync { max-width: 170px; font-size: 10.5px; }
  #syncText { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .back-link { padding: 4px 8px; font-size: 11px; }
  .sport-nav { padding: 0; }
  .sport-btn { width: 136px; min-height: 46px; padding: 9px 12px 10px; }
  .sport-btn span { font-size: 10.5px; }
  .sport-btn small { font-size: 9.5px; }
  .tab-bar { padding: 0 10px; }
  .tab-btn { padding: 11px 13px; font-size: 12px; }
  .content-area { padding: 14px 10px 32px; }
  .standings-head, .standings-row { grid-template-columns: 24px minmax(0,1fr) 28px 28px 28px 30px; padding: 10px 8px; }
  .sr-team { gap: 6px; }
  .sr-team img { width: 24px; height: 24px; }
  .sr-stat { font-size: 12px; }
  .sr-pt { font-size: 13px; }
  .final-stage { padding-top: 18px; }
  .final-title { margin: 2px 0 18px; font-size: 22px; font-weight: 600; }
  .final-pending-card { grid-template-columns: 1fr; gap: 14px; padding: 16px; border-radius: 12px; }
  .final-pending-copy h3 { font-size: 17px; }
  .final-pending-copy p { font-size: 12.5px; }
  .bracket-wrap { margin: 0; padding-left: 0; }
  .bm-card { width: 100%; border-radius: 12px; }
  .bm-header { gap: 8px; padding: 12px 10px 8px; }
  .bm-team-col img { width: 34px; height: 34px; }
  .bm-team-col span { max-width: 96px; font-size: 12px; }
  .bm-score-txt { font-size: 21px; }
  .bm-score-date { font-size: 14px; }
  .champion-top span { max-width: 124px; font-size: 13px; }
}
