/* Tipografía sporty self-hosted (sin llamadas a terceros) */
@font-face { font-family: 'Archivo'; src: url('/fonts/archivo-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Archivo'; src: url('/fonts/archivo-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Archivo'; src: url('/fonts/archivo-800.woff2') format('woff2'); font-weight: 800; font-display: swap; }

:root {
  --blanco: #ffffff;
  --hueso: #f4f6fa;
  --azul: #00346b;
  --azul2: #0a5bb5;
  --oro: #d8b24a;
  --oro2: #febe10;
  --texto: #0a1f44;
  --gris: #eef2f7;
  --gris2: #d7e0ec;
  --verde: #1faa59;
  --rojo: #d64545;
  --sombra: 0 4px 16px rgba(10, 31, 68, .10);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Archivo', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-weight: 500; background: var(--hueso); color: var(--texto);
  padding-bottom: 84px; font-size: 17px; line-height: 1.5;
}

/* Header con escudo + dorado */
.top {
  background: linear-gradient(135deg, var(--azul), #0a4a93); color: var(--blanco);
  padding: calc(16px + env(safe-area-inset-top)) 18px 16px; display: flex; align-items: center; gap: 14px;
  position: sticky; top: 0; z-index: 10; border-bottom: 3px solid var(--oro);
}
.escudo { width: 46px; height: 46px; object-fit: contain; filter: drop-shadow(0 2px 4px rgba(0,0,0,.25)); }
.escudo[src=""], .escudo:not([src]) { display: none; }
.brand { display: flex; flex-direction: column; gap: 1px; }
.logo { font-size: 26px; font-weight: 800; letter-spacing: .3px; }
.sub { font-size: 12.5px; opacity: .9; }

.vista { padding: 16px; }
.vista.oculta { display: none; }
.titulo { font-size: 18px; font-weight: 800; margin: 18px 4px 10px; color: var(--azul); }
.ayuda { font-size: 13px; color: #6b7a90; margin: 0 4px 12px; }
.estrella-hint { color: #a8801f; font-weight: 700; }

.card { background: var(--blanco); border-radius: 16px; box-shadow: var(--sombra); }

/* ---- Componente de partido: [Local] [marcador] [Visita] ---- */
.match { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 6px; }
.match .equipo { display: flex; flex-direction: column; align-items: center; gap: 5px; text-align: center; }
.match .equipo .lugar { font-size: 10.5px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: #9aa7b8; }
.match .equipo img { width: 46px; height: 46px; object-fit: contain; }
.match .equipo .no-crest { width: 46px; height: 46px; display: grid; place-items: center; font-size: 24px; }
.match .equipo .nm { font-size: 13px; font-weight: 700; line-height: 1.15; }
.match .equipo.madrid .nm { color: var(--azul); font-weight: 800; }
/* "Ganó" va SOLO bajo el ganador; el perdedor deja el espacio vacío (misma altura) */
.match .equipo .gano-badge { background: #e7f6ee; color: var(--verde); font-size: 11px; font-weight: 800; padding: 2px 10px; border-radius: 999px; }
.match .equipo .gano-slot { height: 19px; }
.match .centro { text-align: center; min-width: 64px; padding-top: 18px; }
.match .centro .score { font-weight: 800; font-size: 28px; color: var(--texto); white-space: nowrap; }
.match .centro .vs { font-weight: 800; font-size: 18px; color: #9aa7b8; }

/* Tarjeta de partido destacado */
.proximo-card { padding: 18px 16px; text-align: center; border-top: 5px solid var(--oro); }
.proximo-card .etiqueta { font-size: 12px; color: #6b7a90; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 12px; }
.proximo-card .comp { display: inline-block; background: var(--gris); border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 700; margin-top: 12px; }
.proximo-card .cuando { font-size: 16px; margin-top: 8px; }
.proximo-card .canal { margin-top: 6px; font-size: 15px; color: var(--azul); font-weight: 800; }

/* Caja "Para pensar" */
.pensar { margin-top: 16px; background: linear-gradient(135deg, #fff8e6, #fff); border: 2px dashed var(--oro); border-radius: 16px; padding: 16px; text-align: left; }
.pensar h3 { font-size: 16px; font-weight: 800; color: #a8801f; margin-bottom: 8px; }
.pensar p { margin: 6px 0; }
.pensar .analogia { font-style: italic; }
.pensar .pregunta { font-weight: 800; color: var(--azul); margin-top: 10px; }

/* Listas */
.lista { display: flex; flex-direction: column; gap: 10px; }
.fila-partido { padding: 14px 14px 10px; }
.fila-partido .meta-row { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--gris); text-align: center; font-size: 12.5px; color: #6b7a90; }

/* Tabla */
table { width: 100%; border-collapse: collapse; background: var(--blanco); border-radius: 14px; overflow: hidden; box-shadow: var(--sombra); }
th, td { padding: 11px 6px; text-align: center; font-size: 15px; }
th { background: var(--azul); color: var(--blanco); font-size: 12.5px; font-weight: 700; }
td.equipo, th.equipo { text-align: left; }
td.equipo { display: flex; align-items: center; gap: 8px; }
td.equipo img { width: 22px; height: 22px; object-fit: contain; }
tr.madrid { background: #fff8e6; font-weight: 800; }

/* Leyenda didáctica de la tabla */
.leyenda { margin-top: 14px; background: var(--blanco); border-radius: 16px; box-shadow: var(--sombra); padding: 16px; }
.leyenda h3 { font-size: 16px; font-weight: 800; color: var(--azul); margin-bottom: 10px; }
.leyenda ul { list-style: none; display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.leyenda li { font-size: 14.5px; }
.leyenda b { color: var(--azul); }
.puntos-regla { display: flex; flex-direction: column; gap: 6px; }
.puntos-regla .r { font-weight: 800; font-size: 14px; padding: 7px 12px; border-radius: 10px; }
.puntos-regla .gano { background: #e7f6ee; color: var(--verde); }
.puntos-regla .empato { background: var(--gris); color: var(--texto); }
.puntos-regla .perdio { background: #fbe9e9; color: var(--rojo); }
.leyenda .nota { margin-top: 12px; font-size: 14px; color: #6b7a90; }

/* ---- Cromos PREMIUM estilo Topps foil (giran al tocar) ---- */
.grid-jugadores { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.cromo { perspective: 1100px; height: 252px; cursor: pointer; }
.cromo-inner { position: relative; width: 100%; height: 100%; transition: transform .6s cubic-bezier(.4,.2,.2,1); transform-style: preserve-3d; }
.cromo.flip .cromo-inner { transform: rotateY(180deg); }
.cara {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 16px; overflow: hidden; box-shadow: var(--sombra);
  display: flex; flex-direction: column;
}

/* Frente base (no estrella): plata/blanco premium */
.cara.frente { background: linear-gradient(160deg, #fdfdff, #e8eef6 58%, #d7e0ec); }
.cara.frente .topbar { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; z-index: 2; }
.cara.frente .topbar .comp { font-size: 16px; }
.cara.frente .topbar .club { width: 26px; height: 26px; object-fit: contain; }
.foto-wrap { flex: 1; display: flex; align-items: flex-end; justify-content: center; position: relative; z-index: 1; }
.foto-wrap img { height: 158px; object-fit: contain; filter: drop-shadow(0 6px 9px rgba(0,0,0,.28)); }
.foto-wrap .monograma { font-size: 64px; font-weight: 800; color: #b9c6d6; margin-bottom: 22px; }
.plate { background: linear-gradient(180deg, rgba(0,52,107,0), #00346b 40%); padding: 22px 12px 12px; color: #fff; z-index: 2; }
.plate .first { display: block; font-size: 12px; font-weight: 700; color: var(--oro2); letter-spacing: .5px; line-height: 1; }
.plate .last { display: block; font-size: 20px; font-weight: 800; text-transform: uppercase; letter-spacing: .3px; line-height: 1.05; }
.plate .stats { display: flex; gap: 6px; margin-top: 6px; font-size: 12px; font-weight: 700; opacity: .95; }

/* Estrella: foil holográfico animado + borde dorado + brillo que recorre */
.cromo.estrella .cara.frente {
  background:
    linear-gradient(160deg, rgba(255,255,255,.55), rgba(255,255,255,0) 38%),
    conic-gradient(from 200deg at 50% 32%, #ffd9f0, #d9ecff, #fff6d9, #d9ffe6, #e8d9ff, #ffd9f0);
  background-size: 100% 100%, 230% 230%;
  animation: foil 7s linear infinite;
  border: 3px solid var(--oro2);
}
@keyframes foil { 0% { background-position: 0 0, 0% 50%; } 100% { background-position: 0 0, 230% 50%; } }
.cromo.estrella .cara.frente::after {
  content: ''; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(115deg, transparent 32%, rgba(255,255,255,.55) 48%, transparent 62%);
  transform: translateX(-120%); animation: sheen 3.8s ease-in-out infinite;
}
@keyframes sheen { 0%, 55% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
.cromo.estrella .star { position: absolute; top: 8px; left: 10px; font-size: 16px; z-index: 3; }
.cromo.estrella .foto-wrap .monograma { color: var(--oro); text-shadow: 0 2px 8px rgba(216,178,74,.55); }
.cromo.estrella .plate { background: linear-gradient(180deg, rgba(0,38,79,0), #00264f 40%); }

/* Dorso premium (azul profundo) */
.cara.dorso { transform: rotateY(180deg); background: linear-gradient(160deg, #04488f, #00264f); color: #fff; padding: 16px; }
.cromo.estrella .cara.dorso { border: 3px solid var(--oro2); }
.cara.dorso .nm { font-weight: 800; font-size: 15px; color: var(--oro2); margin-bottom: 10px; }
.cara.dorso ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.cara.dorso li { font-size: 14px; font-weight: 700; }
.cara.dorso .dato { margin-top: 12px; font-size: 12.5px; font-style: italic; color: #cfe0f2; line-height: 1.4; }
.cara.dorso .toca { position: absolute; bottom: 8px; right: 12px; font-size: 9.5px; color: rgba(255,255,255,.55); }

/* ---- Mini-quiz ---- */
.quiz { background: linear-gradient(135deg, var(--azul), #0a4a93); color: #fff; border-radius: 16px; padding: 16px; margin-bottom: 6px; box-shadow: var(--sombra); }
.quiz .q { font-weight: 800; font-size: 15.5px; margin-bottom: 12px; }
.quiz .ops { display: flex; flex-direction: column; gap: 8px; }
.quiz button { font-family: inherit; font-weight: 700; font-size: 15px; text-align: left; padding: 11px 14px; border: none; border-radius: 10px; background: rgba(255,255,255,.14); color: #fff; cursor: pointer; }
.quiz button.ok { background: var(--verde); } .quiz button.mal { background: var(--rojo); }
.quiz .fb { margin-top: 10px; font-weight: 700; font-size: 14px; min-height: 20px; }
.quiz .otra { background: var(--oro2); color: var(--azul); margin-top: 10px; text-align: center; padding: 9px; border-radius: 10px; }

/* Noticias */
.noticia { background: var(--blanco); border-radius: 14px; box-shadow: var(--sombra); padding: 16px; }
.noticia h3 { font-size: 16px; font-weight: 800; margin-bottom: 6px; color: var(--azul); }
.noticia .fuente { font-size: 12px; color: #6b7a90; margin-top: 8px; }

.vacio { text-align: center; color: #6b7a90; padding: 30px 16px; }
.vacio .emoji { font-size: 40px; display: block; margin-bottom: 8px; }

.tabbar { position: fixed; bottom: 0; left: 0; right: 0; background: var(--blanco); border-top: 1px solid var(--gris2); display: flex; justify-content: space-around; padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); z-index: 10; }
.tab { background: none; border: none; font-size: 22px; color: #9aa7b8; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; flex: 1; font-family: inherit; }
.tab span { font-size: 11px; font-weight: 800; }
.tab.activo { color: var(--azul); }
.cargando { text-align: center; padding: 40px; color: #6b7a90; }
