/* =========================================================
   Copa EPP Refinería · estilos (sitio público + panel admin)
   Identidad: azul de la refinería + dorado de campeón,
   con el trazo de las líneas de la cancha como motivo.
   ========================================================= */
:root {
  --brand: #1347b8;
  --brand-dark: #0a2468;
  --ink: #0b1740;
  --gold: #ffc61a;
  --gold-soft: #fff3c4;
  --red: #e53935;
  --green: var(--brand);
  --green-dark: var(--brand-dark);
  --bg: #f1f4fb;
  --card: #fff;
  --text: #14213d;
  --muted: #5d6a86;
  --line: #dde4f2;
  --shadow: 0 1px 2px rgba(10, 36, 104, .05), 0 8px 20px -12px rgba(10, 36, 104, .2);
  --content: 880px;
  --r: 16px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: radial-gradient(1100px 420px at 50% -160px, #dbe6fb, transparent 70%), var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
}
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ===== Cabecera: azul con las líneas de la cancha ===== */
.top {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='460' height='130' viewBox='0 0 460 130'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.09' stroke-width='2'%3E%3Ccircle cx='230' cy='65' r='44'/%3E%3Cpath d='M230 0v130'/%3E%3Crect x='-2' y='30' width='48' height='70'/%3E%3Crect x='414' y='30' width='48' height='70'/%3E%3C/g%3E%3C/svg%3E") center / auto 100% no-repeat,
    linear-gradient(135deg, var(--brand-dark), var(--brand));
  border-bottom: 3px solid var(--gold);
  color: #fff;
  padding: 14px max(16px, calc((100% - var(--content)) / 2)) 0;
  position: sticky; top: 0; z-index: 5;
  box-shadow: 0 6px 18px rgba(10, 36, 104, .25);
}
.top h1 {
  margin: 0 0 10px; font-size: 1.35rem; text-align: center;
  font-style: italic; font-weight: 900; letter-spacing: .01em;
  text-shadow: 0 2px 0 rgba(6, 26, 73, .45);
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.logo { height: 40px; width: auto; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .35)); }

nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
nav::-webkit-scrollbar { display: none; }
nav::before, nav::after { content: ''; flex: 1 0 0; }
nav a {
  color: #cfdcff; text-decoration: none; padding: 9px 15px;
  border-radius: 10px 10px 0 0; white-space: nowrap; font-weight: 600;
  transition: background .15s, color .15s;
}
nav a:hover { background: rgba(255, 255, 255, .12); color: #fff; }
nav a.active { background: var(--bg); color: var(--brand-dark); box-shadow: inset 0 3px 0 var(--gold); }

main { max-width: var(--content); margin: 0 auto; padding: 20px 16px 8px; }
footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 24px 16px 32px; }

h2 {
  margin: 22px 0 12px; font-size: 1.25rem; font-weight: 800; text-wrap: balance;
  letter-spacing: -.005em; color: var(--ink);
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
}
h2::after {
  content: ''; flex: 1 0 40px; height: 3px; border-radius: 3px; align-self: center;
  background: linear-gradient(90deg, var(--gold), transparent);
}
main > h2:first-child { margin-top: 4px; }

/* ===== Tarjetas ===== */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--shadow);
  overflow: hidden;
}
.card h3 { margin: 0 0 4px; font-size: 1.08rem; text-wrap: balance; }
.card p { margin: 6px 0 0; white-space: pre-wrap; }
.pin { display: inline-block; background: var(--gold-soft); color: #7a5b00; font-size: .75rem; padding: 2px 8px; border-radius: 99px; margin-left: 6px; vertical-align: middle; }
.muted { color: var(--muted); font-size: .9rem; }

/* Noticias */
.card.news { padding-top: 16px; }
.card.news h3 { font-size: 1.22rem; line-height: 1.25; margin-bottom: 6px; }
.card.news p { max-width: 68ch; margin-top: 10px; }
.card.news.pinned { border-left: 4px solid var(--gold); }

.news-img {
  display: block; width: calc(100% + 32px); max-width: none; max-height: 380px;
  margin: -14px -16px 12px; object-fit: cover; object-position: center;
  background: #eef2f9; border-radius: var(--r) var(--r) 0 0;
}
.news-thumb {
  display: block; max-width: 180px; max-height: 120px; object-fit: cover; object-position: center;
  background: #eef2f9; border-radius: 8px; margin: 0 auto 8px;
}

/* ===== Carga de imágenes: fondo animado + aparición suave ===== */
@keyframes shimmer { to { background-position: -200% 0; } }
.mosaic figure, .collage figure, .thumbs figure {
  background: linear-gradient(100deg, #e1e8f6 30%, #f3f6fc 50%, #e1e8f6 70%) 0 0 / 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.mosaic figure.ok, .collage figure.ok, .thumbs figure.ok { animation: none; background: #dfe6f3; }
.mosaic figure.bad, .collage figure.bad, .thumbs figure.bad { animation: none; background: #e9edf6; }
.mosaic figure.bad::after, .collage figure.bad::after, .thumbs figure.bad::after {
  content: '⚠'; position: absolute; inset: 0; display: grid; place-items: center; color: #8b97b3; font-size: 1.4rem;
}
.mosaic img, .collage img, .thumbs img { opacity: 0; transition: opacity .35s ease; }
.mosaic img.ld, .collage img.ld, .thumbs img.ld { opacity: 1; }

/* ===== Collage de noticias (1-4 imágenes) ===== */
.collage {
  display: grid; gap: 3px;
  width: calc(100% + 32px); margin: -16px -16px 14px;
  border-radius: var(--r) var(--r) 0 0; overflow: hidden; background: #0d1a3a;
}
.collage figure { margin: 0; position: relative; overflow: hidden; cursor: zoom-in; min-height: 0; min-width: 0; }
.collage img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; transition: opacity .35s ease, transform .5s ease; }
@media (hover: hover) { .collage figure:hover img { transform: scale(1.04); } }
.collage.n1 { grid-template-columns: 1fr; aspect-ratio: 16 / 10; max-height: 440px; }
.collage.n2 { grid-template-columns: 1fr 1fr; aspect-ratio: 16 / 9; }
.collage.n3 { grid-template-columns: 1.4fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 4 / 3; }
.collage.n3 figure:first-child { grid-row: span 2; }
.collage.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 1 / 1; max-height: 540px; }
.collage .more {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(6, 14, 34, .55); color: #fff; font-size: 1.9rem; font-weight: 800;
  pointer-events: none; z-index: 2;
}

/* Miniaturas en el admin */
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumbs:empty { display: none; }
.thumbs figure { margin: 0; position: relative; width: 84px; height: 84px; border-radius: 8px; overflow: hidden; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumbs .x, .mosaic.flat .x {
  position: absolute; top: 4px; right: 4px; z-index: 2; width: 24px; height: 24px; padding: 0;
  border-radius: 50%; line-height: 1; font-size: .75rem; display: grid; place-items: center;
}
.thumbs label.rm { position: absolute; inset: auto 0 0 0; display: flex; align-items: center; gap: 4px; padding: 2px 5px; background: rgba(179, 38, 30, .88); color: #fff; font-size: .7rem; cursor: pointer; }
.thumbs .rm input { width: auto; margin: 0; }
.thumbs figure.rm-on img { opacity: .3; }

/* ===== Escudos ===== */
.crest { width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
img.crest { object-fit: contain; background: #fff; border: 1px solid var(--line); padding: 3px; }
.crest.sm { width: 28px; height: 28px; font-size: .62rem; }
.crest.ph { background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff; font-weight: 800; font-size: .85rem; border: 0; padding: 0; }
.tn { display: inline-flex; align-items: center; gap: 10px; }

/* ===== Partidos: marcador tipo cartelera ===== */
.mcard { padding: 16px 14px 12px; }
.match { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; text-align: center; }
.match .t { display: flex; flex-direction: column; align-items: center; gap: 7px; min-width: 0; font-weight: 600; line-height: 1.25; }
.match .t span:last-child { overflow-wrap: anywhere; }
.match .sc { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 84px; }
.match .score {
  min-width: 0; text-align: center; white-space: nowrap;
  font-size: 1.55rem; font-weight: 900; letter-spacing: .02em; line-height: 1;
  background: var(--ink); color: var(--gold);
  padding: 9px 16px; border-radius: 12px;
  box-shadow: inset 0 -3px 0 rgba(255, 198, 26, .25), 0 6px 14px -8px rgba(10, 36, 104, .6);
}
.match .vs {
  min-width: 84px; text-align: center; color: var(--muted); font-weight: 800; font-size: .9rem;
  padding: 6px 0; border-radius: 99px; background: var(--bg); border: 1px solid var(--line);
}
.match .t.win span:last-child { font-weight: 800; color: var(--brand-dark); }
.match .t.win .crest { box-shadow: 0 0 0 3px var(--gold); }
.match .t.lose { opacity: .62; }
.match .pens { color: #a32320; font-weight: 700; font-size: .72rem; white-space: nowrap; }
.meta { text-align: center; margin-top: 12px; padding-top: 9px; border-top: 1px dashed var(--line); }
.m-top { display: flex; justify-content: center; gap: 6px; margin-bottom: 10px; }
.badge { padding: 2px 10px; border-radius: 99px; background: #eaf0fc; color: var(--brand-dark); font-size: .72rem; font-weight: 700; letter-spacing: .03em; }
.badge.pen { background: #fde7e6; color: #a32320; }

/* ===== Tabla de posiciones ===== */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { padding: 10px 8px; text-align: center; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: var(--ink); color: #cfdcff; font-size: .78rem; font-weight: 700; }
th:last-child { color: var(--gold); }
td.name, th.name { text-align: left; padding-left: 12px; font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tr:nth-child(even) td { background: #fafbfe; }
tr:hover td { background: #f1f5ff; }
td.pts { font-weight: 800; color: var(--brand); font-size: 1rem; }
td.pos { width: 44px; }
td.pos b {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  font-size: .82rem; font-weight: 800; color: var(--muted);
}
tr.top1 td { background: #fffaf0; }
tr.top1 td.pos b { background: var(--gold); color: var(--ink); }
tr.top1 td:first-child { box-shadow: inset 4px 0 0 var(--gold); }
tr.top2 td.pos b { background: #dfe5f1; color: var(--ink); }
tr.top3 td.pos b { background: #f0d9c4; color: #5b3414; }

/* ===== Formularios ===== */
.form { display: grid; gap: 10px; position: relative; }
.form label { font-size: .85rem; color: var(--muted); display: grid; gap: 3px; }
.form input, .form textarea { font: inherit; padding: 10px 11px; border: 1px solid var(--line); border-radius: 10px; width: 100%; background: #fff; color: var(--text); }
.form input:focus, .form textarea:focus { border-color: var(--brand); outline: 3px solid rgba(19, 71, 184, .15); }
.form textarea { min-height: 90px; }
.form button { font: inherit; font-weight: 700; padding: 12px; border: 0; border-radius: 12px; background: var(--brand); color: #fff; cursor: pointer; transition: background .15s, transform .15s; }
.form button:hover { background: var(--brand-dark); transform: translateY(-1px); }
.form button:disabled { opacity: .6; cursor: wait; transform: none; }

/* ===== Galería ===== */
.mosaic {
  display: grid; gap: 8px; margin: 0 0 18px;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  grid-auto-rows: 132px; grid-auto-flow: dense;
}
.mosaic figure {
  margin: 0; position: relative; overflow: hidden; border-radius: 14px; cursor: zoom-in;
  box-shadow: 0 2px 6px rgba(10, 36, 104, .08);
  transition: box-shadow .25s;
  content-visibility: auto;
}
.mosaic figure:nth-child(9n+1) { grid-column: span 2; grid-row: span 2; }
.mosaic figure img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity .35s ease, transform .5s ease; }
@media (hover: hover) {
  .mosaic figure:hover { box-shadow: 0 12px 24px -10px rgba(10, 36, 104, .5); }
  .mosaic figure:hover img { transform: scale(1.06); }
}
#sentinel { height: 1px; }
#gal-more, .center {
  display: block; margin: 0 auto 18px; padding: 10px 22px; border: 0; border-radius: 99px;
  background: var(--brand); color: #fff; font: inherit; font-weight: 700; cursor: pointer;
}
#gal-more:hover { background: var(--brand-dark); }

/* Admin: cuadrícula uniforme con botón de borrar */
.mosaic.flat { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); grid-auto-rows: auto; gap: 8px; }
.mosaic.flat figure { aspect-ratio: 1; cursor: default; content-visibility: visible; }
.mosaic.flat figure:nth-child(9n+1) { grid-column: auto; grid-row: auto; }
.mosaic.flat figure:hover img { transform: none; }
.mosaic.flat figure.sel { outline: 3px solid var(--gold); outline-offset: -3px; }
.pick { position: absolute; top: 6px; left: 6px; z-index: 2; background: rgba(255, 255, 255, .92); border-radius: 6px; padding: 3px; display: flex; }
.pick input { width: 18px; height: 18px; margin: 0; }
.filebtn { display: inline-block; padding: 5px 10px; border-radius: 8px; font-size: .85rem; font-weight: 600; cursor: pointer; background: #e9eeea; color: var(--text); }
.filebtn:hover { background: #dde5df; }

/* Barra de progreso de subida (admin) */
.upl { display: grid; gap: 6px; }
.upl[hidden] { display: none; }
.upl .bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.upl .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), #ffe27a); transition: width .2s ease; }
.upl span { font-size: .85rem; color: var(--muted); }

/* ===== Visor de fotos ===== */
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(6, 14, 34, .94);
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out; animation: lb-in .2s ease;
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }

.lightbox .lb-stage {
  display: grid; place-items: center;
  max-width: 94vw; max-height: 84vh; width: max-content; height: max-content;
}
.lightbox img {
  max-width: 94vw; max-height: 84vh; object-fit: contain; cursor: default;
  border-radius: 8px; background: #0a1024;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .7);
  filter: blur(2px); transform: scale(1.01);
  transition: filter .2s ease, transform .2s ease;
}
.lightbox img.loaded { filter: none; transform: none; }

.lightbox .lb-x, .lightbox .lb-nav {
  position: absolute; border: 0; border-radius: 50%; cursor: pointer; color: #fff; line-height: 1;
  background: rgba(255, 255, 255, .14); display: grid; place-items: center; padding: 0;
  transition: background .15s, transform .15s;
}
.lightbox .lb-x:hover, .lightbox .lb-nav:hover { background: rgba(255, 255, 255, .3); }
.lightbox .lb-x { top: 14px; right: 14px; width: 42px; height: 42px; font-size: 1.1rem; }
.lightbox .lb-x:hover { transform: rotate(90deg); }
.lightbox .lb-nav { top: 50%; transform: translateY(-50%); width: 48px; height: 48px; font-size: 1.8rem; }
.lightbox .lb-nav.prev { left: 14px; }
.lightbox .lb-nav.next { right: 14px; }
.lightbox .lb-count {
  position: absolute; top: 20px; left: 50%; transform: translateX(-50%);
  color: #cfdcff; font-size: .85rem; font-weight: 600; letter-spacing: .04em;
}
.lightbox .lb-cap {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  max-width: 90vw; text-align: center; color: #fff; font-size: .9rem;
  background: rgba(0, 0, 0, .45); padding: 6px 14px; border-radius: 99px;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.lightbox .lb-cap:empty { display: none; }

/* ===== Móvil ===== */
@media (max-width: 720px) {
  .lightbox .lb-nav { width: 40px; height: 40px; font-size: 1.4rem; }
  .lightbox .lb-nav.prev { left: 6px; }
  .lightbox .lb-nav.next { right: 6px; }
  .lightbox img { max-width: 98vw; max-height: 80vh; }
}
@media (max-width: 520px) {
  .top h1 { font-size: 1.12rem; }
  .logo { height: 32px; }
  nav a { padding: 8px 11px; font-size: .92rem; }
  .crest { width: 40px; height: 40px; }
  .crest.sm { width: 24px; height: 24px; }
  .match .score, .match .vs, .match .sc { min-width: 70px; }
  .match .score { font-size: 1.3rem; padding: 8px 12px; }
  table { font-size: .85rem; }
  th, td { padding: 9px 5px; }
  td.pos { width: 36px; }

  .mosaic { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 116px; gap: 6px; }
  .mosaic.flat { grid-template-columns: repeat(3, 1fr); grid-auto-rows: auto; }

  .card { padding: 12px; }
  .news-img { width: calc(100% + 24px); margin: -12px -12px 10px; border-radius: 12px 12px 0 0; }
  .collage { width: calc(100% + 24px); margin: -12px -12px 12px; border-radius: 12px 12px 0 0; }
  .collage.n1 { aspect-ratio: 4 / 3; }
  .collage.n2 { aspect-ratio: 4 / 3; }
  .collage.n3 { aspect-ratio: 1 / 1; }
}

@media (prefers-reduced-motion: reduce) {
  .mosaic figure, .collage figure, .thumbs figure { animation: none; }
  .mosaic img, .collage img, .thumbs img, .lightbox, .lightbox img, .form button { transition: none; animation: none; }
}

/* ===== Pantalla de carga ===== */
#splash {
  position: fixed; inset: 0; z-index: 100; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px 16px; text-align: center;
  background:
    linear-gradient(0deg, rgba(27, 127, 59, .30), transparent 28%),
    radial-gradient(120% 90% at 50% 0%, #1d5bd6 0%, #0b2f86 45%, #061a49 100%);
  transition: opacity .6s ease, visibility .6s;
  animation: splash-fallback .6s ease 12s forwards;
}
#splash.out { opacity: 0; visibility: hidden; pointer-events: none; }
@keyframes splash-fallback { to { opacity: 0; visibility: hidden; pointer-events: none; } }

.sp-glow {
  position: absolute; inset: 0;
  background:
    radial-gradient(40% 30% at 20% 25%, rgba(255, 210, 31, .20), transparent 70%),
    radial-gradient(45% 35% at 80% 70%, rgba(90, 160, 255, .28), transparent 70%);
  animation: drift 6s ease-in-out infinite alternate;
}
@keyframes drift { to { transform: scale(1.15) translate(2%, -2%); } }

#splash::after {
  content: ''; position: absolute; inset: -50%; pointer-events: none;
  background: linear-gradient(115deg, transparent 42%, rgba(255, 255, 255, .14) 50%, transparent 58%);
  transform: translateX(-70%);
  animation: sweep 1.6s ease 1.6s forwards;
}
@keyframes sweep { to { transform: translateX(70%); } }

.sp-inner, .sp-bar, .sp-tag { position: relative; z-index: 1; }
.sp-inner { display: flex; flex-direction: column; align-items: center; }

.sp-kicker {
  margin: 0 0 14px; color: var(--gold); font-weight: 700;
  font-size: clamp(.7rem, 2.6vw, .95rem); letter-spacing: .28em; text-transform: uppercase;
  padding-left: .28em;
  animation: fadeup .7s ease .1s both;
}

#splash-text {
  display: flex; flex-direction: column; align-items: center; gap: .04em;
  font-size: clamp(2.3rem, 12vw, 4.4rem); font-weight: 900; font-style: italic;
  line-height: 1; letter-spacing: .02em;
}
.sl-line {
  display: flex; justify-content: center;
  filter: drop-shadow(0 .05em 0 #0a2a80) drop-shadow(0 .12em .25em rgba(0, 0, 0, .45));
}
.sp-space { display: inline-block; width: .32em; }
.sl {
  display: inline-block; padding: 0 .06em;
  background: linear-gradient(180deg, #fff7b8 0%, #ffd21f 48%, #f29a00 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  animation: letter .6s cubic-bezier(.2, .8, .2, 1) both;
  animation-delay: calc(.3s + var(--i) * 60ms);
}
@keyframes letter {
  from { opacity: 0; transform: translateY(36px) scale(.7); filter: blur(10px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}

.sp-edition {
  margin-top: 12px; padding: 4px 16px 4px calc(16px + .2em); border-radius: 99px;
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .3);
  color: #fff; font-weight: 700; font-size: .8rem; letter-spacing: .2em; text-transform: uppercase;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: fadeup .6s ease 1.7s both;
}

#splash-logo {
  width: min(34vw, 150px); margin-top: 18px; opacity: 0;
  animation:
    logo .9s cubic-bezier(.2, .9, .3, 1.3) 2s forwards,
    glow 1.6s ease-in-out 3s infinite;
}
@keyframes logo { from { opacity: 0; transform: scale(.6) rotate(-8deg); } to { opacity: 1; transform: none; } }
@keyframes glow {
  0%, 100% { filter: drop-shadow(0 0 14px rgba(255, 210, 31, .35)); }
  50%      { filter: drop-shadow(0 0 30px rgba(255, 210, 31, .85)); }
}

.sp-bar {
  width: min(70vw, 360px); height: 6px; margin-top: 34px;
  border-radius: 99px; background: rgba(255, 255, 255, .18);
}
.sp-fill {
  position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, #ffc61a, #fff3a0);
  animation: fill 3.9s cubic-bezier(.4, .1, .2, 1) .1s forwards;
}
.sp-ball {
  position: absolute; top: 50%; left: 0; font-size: 20px; line-height: 1;
  transform: translate(-50%, -50%);
  animation: roll 3.9s cubic-bezier(.4, .1, .2, 1) .1s forwards;
}
@keyframes fill { to { width: 100%; } }
@keyframes roll { to { left: 100%; transform: translate(-50%, -50%) rotate(720deg); } }

.sp-tag {
  margin: 18px 0 0; max-width: 34ch; color: #cfdcff; font-size: .85rem; letter-spacing: .04em;
  animation: fadeup .8s ease 2.4s both;
}

@keyframes fadeup { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  #splash *, #splash::after { animation-duration: .01s !important; animation-delay: 0s !important; }
}

/* =========================================================
   Barra de edición / vista
   ========================================================= */
.edition-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  margin: 0 0 16px;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.edition-label {
  font-size: .85rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.edition-name {
  font-weight: 800;
  color: var(--brand-dark);
}
.edition-pick {
  font: inherit;
  font-weight: 700;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--brand-dark);
  cursor: pointer;
  min-width: 180px;
}
.edition-pick:focus {
  outline: 3px solid rgba(19, 71, 184, .2);
  border-color: var(--brand);
}
/* ✅ NUEVO: select deshabilitado */
.edition-pick:disabled {
  background: #f3f5fa;
  color: var(--muted);
  cursor: not-allowed;
  opacity: .85;
}
/* ✅ NUEVO: hint al lado del select */
.edition-bar .hint {
  font-size: .78rem;
  color: var(--muted);
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.edition-bar .hint::before {
  content: '●';
  color: #e53935;
  animation: pulse-live 1.4s ease-in-out infinite;
}

.match-details {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-size: .85rem;
  color: var(--muted);
  white-space: pre-wrap;
  font-style: italic;
}

/* ===== Vista pública de un partido ===== */
.mv-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.badge-live {
  display: inline-block; padding: 3px 10px; background: #e53935; color: #fff;
  font-size: .72rem; font-weight: 800; border-radius: 99px; letter-spacing: .06em;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }

.mv-score {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px;
  align-items: center; text-align: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 20px 16px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.mv-team { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.mv-team .crest { width: 64px; height: 64px; }
.mv-team strong { font-size: 1.05rem; }
.mv-center { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.mv-numbers { display: flex; align-items: baseline; gap: 6px; }
.mv-num { font-size: 2.4rem; font-weight: 900; color: var(--ink); }
.mv-dash { font-size: 1.6rem; color: var(--muted); }
.mv-minute { font-size: .9rem; font-weight: 800; color: #e53935; }
.mv-meta { font-size: .85rem; }

.mv-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin-bottom: 14px;
}
@media (max-width: 640px) { .mv-stats { grid-template-columns: repeat(2, 1fr); } }
.mv-stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 10px; text-align: center; box-shadow: var(--shadow);
}
.mv-stat span { display: block; font-size: .8rem; color: var(--muted); margin-bottom: 4px; }
.mv-stat div { font-size: 1.1rem; }

.mv-players {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px; margin-bottom: 14px; box-shadow: var(--shadow);
}
@media (max-width: 640px) { .mv-players { grid-template-columns: 1fr; } }
.mv-players h3 { margin: 0 0 6px; font-size: .95rem; color: var(--ink); }
.mv-player {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 5px 0; border-bottom: 1px solid var(--line); font-size: .88rem;
}
.mv-player:last-child { border-bottom: 0; }
.mv-player-badge {
  background: #eef2fb; color: var(--ink); border-radius: 6px;
  padding: 1px 6px; font-size: .75rem; font-weight: 700;
}

.mv-event {
  padding: 6px 0; border-bottom: 1px solid var(--line); font-size: .88rem;
}
.mv-event:last-child { border-bottom: 0; }

.m-foot { margin-top: 10px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.m-link {
  display: inline-block; font-size: .85rem; font-weight: 700;
  color: var(--brand); text-decoration: none;
}
.m-link:hover { text-decoration: underline; }

.mcard.live { border-left: 4px solid #e53935; }

/* ===== En vivo en Programación ===== */
.live-section-title {
  color: #e53935;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.live-section-title::before {
  content: '';
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #e53935;
  animation: pulse-live 1.4s ease-in-out infinite;
}
@keyframes pulse-live {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

.mcard.live {
  border-left: 4px solid #e53935;
  box-shadow: 0 0 0 3px rgba(229, 57, 53, .1), var(--shadow);
}
.mcard .live-clock {
  color: #e53935;
  font-weight: 800;
  font-size: .8rem;
  margin-top: 2px;
}
.live-now {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
}
.live-now .live-section-title {
  color: #b91c1c;
  margin-top: 0;
}
.live-now .live-cat-title {
  margin: 10px 0 6px;
  font-size: .95rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.live-group + .live-group {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px dashed #fca5a5;
}

/* =========================================================
   ✅ NUEVO: Botones y utilidades
   ========================================================= */
/* Botón fantasma / secundario (Ir a renovar, Cerrar sesión, etc.) */
.ghost,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--brand-dark);
  font: inherit;
  font-weight: 600;
  font-size: .9rem;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .15s;
}
.ghost:hover,
.btn-ghost:hover {
  background: #f4f7fd;
  border-color: var(--brand);
  color: var(--brand);
}
.ghost:active,
.btn-ghost:active {
  transform: translateY(1px);
}
.ghost:disabled,
.btn-ghost:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
}

/* Botón primario sólido */
.btn,
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: 0;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: .92rem;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, transform .15s, box-shadow .15s;
  box-shadow: 0 2px 6px rgba(19, 71, 184, .18);
}
.btn:hover,
.btn-primary:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(10, 36, 104, .25);
}
.btn:active,
.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(10, 36, 104, .2);
}
.btn:disabled,
.btn-primary:disabled {
  opacity: .55;
  cursor: wait;
  transform: none;
}

/* Botón de peligro / rojo (para "Ver en vivo", eliminar, etc.) */
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border: 0;
  border-radius: 10px;
  background: #e53935;
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: .88rem;
  cursor: pointer;
  transition: background .15s, transform .15s, box-shadow .15s;
  box-shadow: 0 2px 6px rgba(229, 57, 53, .25);
  animation: live-btn-pulse 2.4s ease-in-out infinite;
}
.btn-danger:hover {
  background: #b91c1c;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(229, 57, 53, .35);
  animation: none;
}
.btn-danger:active {
  transform: translateY(0);
}
@keyframes live-btn-pulse {
  0%, 100% {
    box-shadow: 0 2px 6px rgba(229, 57, 53, .25), 0 0 0 0 rgba(229, 57, 53, .6);
  }
  50% {
    box-shadow: 0 2px 6px rgba(229, 57, 53, .25), 0 0 0 6px rgba(229, 57, 53, 0);
  }
}

/* Variante pequeña */
.btn-sm,
.ghost.btn-sm {
  padding: 5px 10px;
  font-size: .82rem;
  border-radius: 8px;
}

/* Botón "Compartir" en tarjetas de partido y noticias */
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 999px;
  background: #f1f4fb;
  border: 1px solid var(--line);
  color: var(--brand-dark);
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.share-btn::before {
  content: '↗';
  font-size: .95em;
  line-height: 1;
}
.share-btn:hover {
  background: var(--gold-soft);
  border-color: var(--gold);
  color: #7a5b00;
}
.share-btn:active {
  transform: translateY(1px);
}

/* Utilidades de layout */
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 8px; }

/* Etiquetas / chips / código */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  background: #eaf0fc;
  color: var(--brand-dark);
  font-size: .78rem;
  font-weight: 700;
}
.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 4px;
  background: var(--gold-soft);
  color: #7a5b00;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .02em;
}
code, kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .85em;
  background: #eef2f9;
  color: var(--ink);
  padding: 1px 6px;
  border-radius: 6px;
}
kbd {
  border: 1px solid var(--line);
  box-shadow: 0 1px 0 var(--line);
}

/* Enlaces que se ven como botón pero siguen siendo <a> */
a.linkbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: .9rem;
  text-decoration: none;
  transition: background .15s, transform .15s;
}
a.linkbtn:hover { background: var(--brand-dark); transform: translateY(-1px); }

/* Mejora responsive de los nuevos botones */
@media (max-width: 520px) {
  .btn, .btn-primary, .btn-danger, .ghost, .btn-ghost {
    font-size: .85rem;
    padding: 8px 12px;
  }
  .edition-bar { gap: 6px; padding: 8px 10px; }
  .edition-label { font-size: .78rem; }
  .edition-pick { min-width: 140px; padding: 6px 10px; font-size: .88rem; }
  .edition-bar .hint { margin-left: 0; width: 100%; }
  .share-btn { padding: 4px 10px; font-size: .78rem; }
}

@media (prefers-reduced-motion: reduce) {
  .btn-danger { animation: none; }
  .edition-bar .hint::before { animation: none; }
}

/* ===== Animación de gol ===== */
.goal-anim {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: radial-gradient(60% 60% at 50% 50%, rgba(255, 198, 26, .15), rgba(6, 14, 34, .92));
  color: #fff;
  pointer-events: none;
  animation: goalIn .3s ease;
}
.goal-anim.out { animation: goalOut .6s ease forwards; }
@keyframes goalIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes goalOut { from { opacity: 1; } to { opacity: 0; } }

.goal-inner {
  text-align: center;
  display: grid;
  gap: 8px;
  animation: goalPunch .5s cubic-bezier(.2, .9, .3, 1.3);
}
@keyframes goalPunch {
  0% { transform: scale(.6); opacity: 0; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}

.goal-crest { display: grid; place-items: center; margin-bottom: 6px; }
.goal-crest .crest, .goal-crest img.crest { width: 96px; height: 96px; }

.goal-text {
  font-size: clamp(3rem, 14vw, 8rem);
  font-weight: 900;
  font-style: italic;
  letter-spacing: .02em;
  background: linear-gradient(180deg, #fff7b8 0%, #ffd21f 48%, #f29a00 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 .05em 0 #0a2a80) drop-shadow(0 .12em .25em rgba(0, 0, 0, .45));
  animation: goalShine .8s ease .2s both;
}
@keyframes goalShine {
  0% { transform: translateY(20px); filter: blur(8px); }
  100% { transform: none; filter: blur(0) drop-shadow(0 .05em 0 #0a2a80) drop-shadow(0 .12em .25em rgba(0, 0, 0, .45)); }
}

.goal-team {
  font-size: clamp(1rem, 3vw, 1.6rem);
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .3);
}
.goal-minute {
  font-size: .9rem;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: .06em;
}

.goal-confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.goal-confetti span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 12px;
  background: var(--gold);
  border-radius: 2px;
  transform-origin: center;
  animation: confetti 1.4s ease-out forwards;
  animation-delay: calc(.05s * var(--i));
}
.goal-confetti span:nth-child(3n) { background: #fff; }
.goal-confetti span:nth-child(3n+1) { background: #e53935; }
@keyframes confetti {
  0% { transform: translate(-50%, -50%) rotate(0) scale(0); opacity: 0; }
  20% { opacity: 1; }
  100% {
    transform: translate(
      calc(-50% + (var(--i) - 10) * 6vw),
      calc(-50% + 40vh)
    ) rotate(720deg) scale(1);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .goal-anim, .goal-inner, .goal-text, .goal-confetti span { animation: none !important; }
}