:root {
  /* Paleta elmuni.com: azules con acento celeste */
  --bg: #071630;
  --surface: #0d2147;
  --surface-2: #132c5a;
  --border: #1f3e73;
  --text: #eef5ff;
  --muted: #93acd3;
  --primary: #38bdf8;
  --primary-strong: #0ea5e9;
  --celeste: #4fc3f7;
  --navy: #0b2545;
  --win: #34d399;
  --draw: #a3a0aa;
  --loss: #ff6e84;
  --font: "Manrope", system-ui, sans-serif;
  --font-head: "Lexend", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.5; -webkit-font-smoothing: antialiased; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 16px; }
.hidden { display: none !important; }

/* Header blanco con logo elmuni.com */
.topbar { background: #fff; border-bottom: 3px solid var(--celeste); position: sticky; top: 0; z-index: 20; box-shadow: 0 2px 14px rgba(7, 22, 48, .25); }
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.marca { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.marca img { display: block; }
.marca-texto { display: grid; line-height: 1.05; }
.marca-nombre { font-family: var(--font-head); font-weight: 800; font-size: 1.35rem; color: var(--navy); letter-spacing: -.01em; }
.marca-nombre span { color: #0288d1; }
.marca-sub { font-size: .66rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: #5b7aa6; }
.topnav { display: flex; gap: 4px; }
.topnav a { text-decoration: none; color: var(--navy); font-weight: 700; font-size: .9rem; padding: 8px 12px; border-radius: 999px; transition: background .15s, color .15s; }
.topnav a:hover { background: #e6f6fe; color: var(--primary-strong); }
.topnav a.active { background: #0277bd; color: #fff; }
@media (max-width: 720px) {
  .topnav { display: none; }
  .topbar-in { min-height: 56px; justify-content: center; }
  .marca img { width: 34px; height: 34px; }
  .marca-nombre { font-size: 1.2rem; }
}

/* Espacios publicitarios 728x90 */
.ad-slot { margin-top: 22px; }
.ad-slot:empty { display: none; }
.ad-placeholder {
  display: grid; justify-items: center; align-content: center; gap: 4px; text-align: center; text-decoration: none;
  max-width: 728px; min-height: 90px; margin: 0 auto; padding: 14px 16px 0; border-radius: 16px;
  border: 2px dashed rgba(56, 189, 248, .35); background: rgba(56, 189, 248, .03); transition: border-color .2s, background .2s;
}
a.ad-placeholder:hover { border-color: rgba(56, 189, 248, .7); background: rgba(56, 189, 248, .07); }
.ad-label { font-size: .72rem; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.ad-placeholder b { font-family: var(--font-head); font-size: 1.15rem; color: var(--primary); }
.ad-placeholder small { color: var(--muted); font-size: .85rem; }
.ad-chip { font-style: normal; font-weight: 800; color: var(--primary); border: 1.5px solid var(--primary); border-bottom: 0; border-radius: 6px 6px 0 0; padding: 3px 14px; margin-top: 6px; font-size: .85rem; }
.ad-banner { position: relative; max-width: 728px; margin: 0 auto; aspect-ratio: 728 / 90; border-radius: 10px; overflow: hidden; background: var(--surface); }
.ad-item { position: absolute; inset: 0; opacity: 0; transition: opacity .6s; pointer-events: none; }
.ad-item.on { opacity: 1; pointer-events: auto; }
.ad-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Tarjetas de partidos (en vivo / últimos resultados) */
.tarjetas { margin-top: 24px; }
.tarjetas-titulo { font-family: var(--font-head); font-size: .82rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; display: flex; align-items: center; gap: 8px; font-weight: 700; }
.tarjetas.con-vivo .tarjetas-titulo { color: #fb7185; }
.tarjetas-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.mcard { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; }
.mcard.live { border-color: rgba(244, 63, 94, .55); box-shadow: 0 0 0 1px rgba(244, 63, 94, .18) inset, 0 6px 24px -12px rgba(244, 63, 94, .5); }
.mcard header { display: flex; justify-content: space-between; align-items: center; font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.mc-final { color: var(--muted); }
.mc-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; font-weight: 700; font-size: .92rem; }
.mc-row .crest { width: 24px; height: 24px; }
.mc-team { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-goles { font-family: var(--font-head); font-size: 1.2rem; font-variant-numeric: tabular-nums; min-width: 1.4em; text-align: right; }
.mcard.live .mc-goles { color: #fff; }
.mc-row.pierde { color: var(--muted); }
.mcard footer { font-size: .72rem; color: var(--muted); border-top: 1px solid var(--border); padding-top: 6px; margin-top: 2px; }

/* Sponsors oficiales: franja continua de logos */
.sponsors { padding: 24px 0 0; }
.sponsors-titulo { text-align: center; font-family: var(--font); font-size: .78rem; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; color: #a9c4e8; margin: 0 0 16px; }
.logos-viewport {
  overflow: hidden; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  background: #0a1c3d; padding: 22px 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.logos-track { display: flex; width: max-content; animation: logos-scroll var(--dur, 30s) linear infinite; }
.logos-viewport:hover .logos-track { animation-play-state: paused; }
.logos-set { display: flex; align-items: center; }
.logo-item { flex: 0 0 auto; display: grid; place-items: center; height: 64px; padding: 0 34px; }
.logo-item img { max-height: 64px; max-width: 190px; object-fit: contain; filter: grayscale(1) brightness(1.1); opacity: .72; transition: filter .25s, opacity .25s; }
.logo-item:hover img { filter: none; opacity: 1; }
@keyframes logos-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .logos-track { animation: none; width: auto; }
  .logos-set { flex-wrap: wrap; justify-content: center; }
  .logos-set[aria-hidden] { display: none; }
}

/* Layout: contenido + columna lateral con banner vertical */
.layout { max-width: 1280px; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.lateral { position: sticky; top: 16px; padding-top: 22px; }
.ad-slot.vertical { margin-top: 0; }
.ad-slot.vertical .ad-placeholder { max-width: 300px; aspect-ratio: 1 / 2; min-height: 0; padding-top: 0; align-content: center; }
.ad-slot.vertical .ad-banner { max-width: 300px; aspect-ratio: 1 / 2; }
@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  /* En pantallas chicas el banner vertical va al final, más bajo */
  .lateral { position: static; padding-top: 0; }
  .ad-slot.vertical .ad-placeholder { aspect-ratio: auto; min-height: 120px; max-width: 728px; padding-top: 14px; }
  .ad-slot.vertical .ad-banner { max-width: 300px; }
}

/* Zonas */
.zona-titulo { font-family: var(--font-head); font-size: 1rem; margin: 22px 0 10px; }
.zona-titulo:first-child { margin-top: 0; }
tr.clasifica .pos { color: var(--primary); box-shadow: inset 3px 0 0 var(--primary); }
.clasifica-dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; background: var(--primary); margin-right: 4px; }

/* Playoff: llave */
.campeon { display: flex; align-items: center; gap: 10px; padding: 14px 18px; margin-bottom: 16px; border-radius: 12px; background: linear-gradient(90deg, rgba(251, 191, 36, .2), transparent); border: 1px solid rgba(251, 191, 36, .45); font-size: 1.05rem; }
.campeon span { color: #fbbf24; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; }
.bracket { display: grid; grid-template-columns: repeat(var(--rondas), minmax(200px, 1fr)); gap: 18px; overflow-x: auto; padding-bottom: 8px; }
.b-ronda { display: flex; flex-direction: column; min-width: 200px; }
.b-ronda h3 { font-family: var(--font); font-size: .74rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 10px; }
.b-lista { display: flex; flex-direction: column; justify-content: space-around; gap: 12px; flex: 1; }
.b-match { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.b-match.live { border-color: rgba(244, 63, 94, .55); }
.b-team { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 8px 10px; font-weight: 700; font-size: .88rem; }
.b-team + .b-team { border-top: 1px solid var(--border); }
.b-team .crest { width: 22px; height: 22px; }
.b-nombre { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-team.pierde { color: var(--muted); }
.b-team.gana .b-nombre { color: var(--text); }
.b-goles { font-family: var(--font-head); font-variant-numeric: tabular-nums; }
.b-goles small { font-size: .72rem; color: var(--muted); margin-left: 3px; }
.b-meta { font-size: .72rem; color: var(--muted); padding: 5px 10px; border-top: 1px solid var(--border); }

/* Tabs */
.tabs { display: flex; gap: 4px; margin-top: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { background: none; border: 0; color: var(--muted); font: inherit; font-weight: 700; padding: 12px 16px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--primary); }

/* Card + table */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; padding: 12px 10px; border-bottom: 1px solid var(--border); }
td { padding: 11px 10px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: 0; }
.num { text-align: center; font-variant-numeric: tabular-nums; width: 1%; white-space: nowrap; }
.pos { color: var(--muted); font-weight: 700; }
tr.top .pos { color: var(--primary); }
.pts { font-family: var(--font-head); font-weight: 700; font-size: 1rem; }
.team { display: flex; align-items: center; gap: 10px; font-weight: 700; min-width: 0; }
.team span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
img.crest { object-fit: contain; border-radius: 0; background: transparent; border: 0; }
.crest { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; font-size: .66rem; font-weight: 800; color: var(--muted); flex-shrink: 0; }
.forma { display: flex; gap: 3px; }
.forma i { width: 18px; height: 18px; border-radius: 4px; font-style: normal; font-size: .62rem; font-weight: 800; display: grid; place-items: center; color: #071630; }
.forma .G { background: var(--win); }
.forma .E { background: var(--draw); }
.forma .P { background: var(--loss); }
.nota { color: var(--muted); font-size: .75rem; margin: 10px 2px 0; }

/* Partidos */
.fecha-nav { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 16px; }
.fecha-nav select { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 9px 14px; font: inherit; font-weight: 700; }
.btn-icon { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 1.3rem; cursor: pointer; }
.btn-icon:disabled { opacity: .35; cursor: default; }

.grupo-titulo { font-family: var(--font-head); font-size: 1rem; margin: 22px 0 10px; color: var(--muted); font-weight: 600; }
.grupo-titulo:first-child { margin-top: 0; }
.partido { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 14px 16px; }
.partido + .partido { border-top: 1px solid var(--border); }
.partido .local { justify-content: flex-end; text-align: right; }
.marcador { font-family: var(--font-head); font-weight: 800; font-size: 1.25rem; min-width: 74px; text-align: center; background: var(--surface-2); border-radius: 8px; padding: 4px 10px; font-variant-numeric: tabular-nums; }
.marcador.vs { font-size: .8rem; font-weight: 600; color: var(--muted); }
.ganador { color: var(--text); }
.perdedor { color: var(--muted); }
.partido-meta { grid-column: 1 / -1; text-align: center; color: var(--muted); font-size: .78rem; margin-top: -4px; }
.tag { display: inline-block; font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; padding: 1px 8px; border-radius: 999px; border: 1px solid currentColor; color: var(--loss); }

.estado { text-align: center; padding: 50px 16px; color: var(--muted); }
.estado h2 { font-family: var(--font-head); color: var(--text); margin: 0 0 6px; }
.footer { color: var(--muted); font-size: .78rem; margin-top: 36px; padding: 18px 0 26px; border-top: 1px solid var(--border); background: #061229; }
.footer-in { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.footer-marca { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-head); font-weight: 700; color: #d6e6fb; font-size: .9rem; }
.footer-marca b { color: var(--celeste); }

@media (max-width: 640px) {
  /* Tarjetas: fila deslizable con el dedo */
  .tarjetas-lista { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 78%; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; scrollbar-width: none; }
  .tarjetas-lista::-webkit-scrollbar { display: none; }
  .mcard { scroll-snap-align: start; }
  .ad-placeholder { min-height: 0; padding-top: 10px; }
  .ad-placeholder b { font-size: 1rem; }
  .logo-item { padding: 0 22px; height: 48px; }
  .logo-item img { max-height: 48px; max-width: 140px; }
  .hide-sm { display: none; }
  .partido { gap: 8px; padding: 12px; }
  .team { gap: 6px; font-size: .8rem; }
  .crest { width: 24px; height: 24px; }
  .partido .team span { white-space: normal; overflow-wrap: break-word; hyphens: auto; }
  .marcador { min-width: 54px; font-size: 1.05rem; padding: 4px 6px; }
  .partido { padding: 12px 10px; }
}
@media (max-width: 820px) { .hide-md { display: none; } }
