/* TEMA NOCHE (opción A) — solo se activa en páginas que contienen .tn
   Todo va acotado con body:has(.tn): el resto de páginas no cambia.
   Si el navegador no soporta :has(), simplemente se ve el diseño anterior. */
body:has(.tn){background:#0A0F1E!important;font-family:'Barlow','Segoe UI',sans-serif}
body:has(.tn) header,body:has(.tn) .navegacion,body:has(.tn) .barra-movil{background:#0F1530!important}
body:has(.tn) header{box-shadow:0 1px 0 #232C4D!important}
body:has(.tn) .menu>li>a{color:#E8ECF8}
body:has(.tn) .menu li a:hover{color:#fff}
body:has(.tn) .lang-btn,body:has(.tn) #menu-toggle{color:#27F5EE!important;border-color:rgba(39,245,238,.35)}
body:has(.tn) .lang-btn:hover{background:rgba(39,245,238,.08)}
body:has(.tn) #menu-cerrar{color:#E8ECF8!important}
@media (max-width:900px){
 body:has(.tn) #nav-principal{background-color:#0F1530}
 body:has(.tn) .menu>li{border-bottom-color:#232C4D}
 body:has(.tn) .menu>li>a{color:#E8ECF8}
 body:has(.tn){padding-bottom:calc(76px + env(safe-area-inset-bottom,0px))}
}
body:has(.tn) footer{background:#0F1530!important;border-top:1px solid #232C4D!important}
body:has(.tn) footer a,body:has(.tn) footer div{color:#B8C0DC!important}

/* Contenido */
.tn{color:#E8ECF8}
.tn #intro{color:#E8ECF8!important;font:800 clamp(26px,5vw,38px)/1.05 'Barlow Condensed',sans-serif!important;text-transform:uppercase}
.tn #bloque-seo-index{background:#141B33!important;border:1px solid #232C4D;border-top:3px solid #E3001B!important;color:#B8C0DC!important;box-shadow:none!important}
.tn #bloque-seo-index strong{color:#E8ECF8}
.tn #p1{color:#8B95B5!important}
.tn-duelos{background:#141B33!important;border:1px solid #232C4D;box-shadow:none!important}
.tn-duelos h3{color:#E8ECF8!important;font-family:'Barlow Condensed',sans-serif;text-transform:uppercase;letter-spacing:.06em}
.tn-duelos p{color:#8B95B5!important}
.tn-duelos a{background:#0A0F1E!important;color:#E8ECF8!important;border:1px solid #232C4D!important;box-shadow:none!important}
.tn-duelos a[href="jugadores.php"]{background:#27F5EE!important;color:#0A0F1E!important;border-color:#27F5EE!important}
.tn-busca input[type=text]{background:#141B33!important;color:#E8ECF8;border:1px solid #232C4D!important;border-radius:10px!important;height:40px!important;padding:0 12px!important;font-size:15px}
.tn-busca button{height:40px!important;border-radius:10px!important;background:#27F5EE!important;color:#0A0F1E!important;border:0!important;font-weight:700;padding:0 14px!important}
@media (max-width:900px){
 .tn-busca{padding:0 15px!important;justify-content:stretch!important}
 .tn-busca form{width:100%}
 .tn-busca input[type=text]{width:auto!important;flex:1}
}
.tn .buscador-inicio-form{background:#141B33!important;border:1px solid #232C4D;box-shadow:none!important}
.tn .buscador-inicio-form select{background:#0A0F1E!important;color:#E8ECF8;border:1px solid #232C4D!important}
.tn .buscador-inicio-form input[type=submit]{background:#27F5EE!important;color:#0A0F1E!important}

/* Clasificación */
.tn-card{background:#141B33!important;border:1px solid #232C4D;box-shadow:none!important}
.tn-card>h3{color:#E8ECF8!important;font-family:'Barlow Condensed',sans-serif;text-transform:uppercase;letter-spacing:.06em;font-size:22px}
.tn-tabla thead tr{background:#0F1530!important;border-bottom:1px solid #232C4D!important;color:#8B95B5!important}
.tn-tabla thead th[style*="06367A"]{color:#27F5EE!important}
.tn-tabla tbody tr{background:transparent!important;border-bottom:1px solid #232C4D!important;color:#E8ECF8}
.tn-tabla tbody tr:hover{background:rgba(39,245,238,.06)!important}
.tn-tabla td:nth-child(2) *{color:#E8ECF8!important}
/* Disco claro tras los escudos (los oscuros se pierden sobre el fondo noche) */
.tn .tn-tabla td:nth-child(2) img,.tn .tn-jornada-card img{background:#fff;border-radius:50%;padding:2px;box-sizing:content-box}
.tn-tabla td:nth-child(3){color:#27F5EE!important}
.tn-tabla td:first-child div[style*="transparent"]{color:#8B95B5!important}
.tn-tabla td:last-child[style*="color: green"]{color:#4ade80!important}
.tn-tabla td:last-child[style*="color: red"]{color:#ff6b7a!important}
.tn-tabla td:last-child[style*="#666"]{color:#8B95B5!important}

/* Líderes */
.tn-lider{background:#141B33!important;border-top:1px solid #232C4D;border-right:1px solid #232C4D;border-bottom:1px solid #232C4D;box-shadow:none!important}
.tn-lider div[data-lang]{color:#8B95B5!important}
.tn-lider a{color:#E8ECF8!important;border-bottom-color:#4C5780!important}
.tn-lider div[style*="font-size: 28px"]{color:#27F5EE!important}
.tn-lider div[style*="color: #555"]{color:#B8C0DC!important}

/* Barra inferior estilo app: base (clara) en nav-app.css; aquí solo la piel de noche */
@media (max-width:900px){
 .tn-nav{background:#0F1530;border-top:1px solid #232C4D}
 .tn-nav a{color:#8B95B5!important}
 .tn-nav a.on{color:#27F5EE!important;box-shadow:inset 0 2px 0 #27F5EE}
}

/* ===== Piel genérica para páginas principales (sobrescribe estilos en línea claros) ===== */
.tn [style*=" color: #333"],.tn [style^="color: #333"],.tn [style*=" color: #444"],.tn [style^="color: #444"],.tn [style*=" color: #555"],.tn [style^="color: #555"]{color:#E8ECF8!important}
.tn [style*=" color: #666"],.tn [style^="color: #666"],.tn [style*=" color: #777"],.tn [style^="color: #777"]{color:#B8C0DC!important}
.tn [style*=" color: #888"],.tn [style^="color: #888"],.tn [style*=" color: #999"],.tn [style^="color: #999"]{color:#8B95B5!important}
.tn [style*=" color: #06367A"]:not([style*="background"]),.tn [style^="color: #06367A"]:not([style*="background"]){color:#27F5EE!important}
.tn [style*=" color: #cc0000"],.tn [style*=" color: #E3001B"]:not([style*="background"]){color:#ff6b7a!important}
.tn [style*="background: white"],.tn [style*="background-color: white"],.tn [style*="background: #fff"],.tn [style*="background-color: #fff"]{background:#141B33!important;box-shadow:none!important}
.tn [style*="#f4f7f6"],.tn [style*="#f9f9f9"],.tn [style*="#eef2f5"],.tn [style*="#f0f2f5"],.tn [style*="#fcfcfc"],.tn [style*="#f8f9fa"],.tn [style*="#e0e0e0"]{background:#0F1530!important}
.tn [style*="#e9ecef"],.tn [style*="#eee"]{border-color:#232C4D!important}
.tn select,.tn input[type=text],.tn input[type=number]{background:#0A0F1E!important;color:#E8ECF8!important;border-color:#232C4D!important}
.tn ::placeholder{color:#8B95B5}
.tn option{background:#0A0F1E;color:#E8ECF8}
.tn .titulo-tarjeta{color:#E8ECF8;font-family:'Barlow Condensed',sans-serif;text-transform:uppercase;letter-spacing:.06em}
.tn .grid-botones .buscador-inicio-form{background:transparent!important;border:0}
.tn .grid-botones input[type=submit]{background:#0F1530!important;color:#27F5EE!important;border:1px solid #27F5EE!important}
.tn h1,.tn h2:not(#intro){font-family:'Barlow Condensed',sans-serif;letter-spacing:.03em}
/* Tabla de árbitros */
.tn .tabla-ranking{background:#141B33}
.tn .tabla-ranking th,.tn .tabla-ranking td{border-bottom:1px solid #232C4D;color:#E8ECF8}
.tn .tabla-ranking tbody tr:hover td{background:rgba(39,245,238,.07)!important}
.tn .sticky-arb{background:#141B33!important;border-right:2px solid #232C4D!important;color:#E8ECF8!important}
.tn .head-sticky-arb{background:#0F1530!important;border-right:2px solid #232C4D!important}
.tn .link-arbitro{color:#27F5EE}
.tn td[style*="#f0f7ff"],.tn td[style*="#fff8e1"],.tn td[style*="#fce8e6"]{background:rgba(255,255,255,.04)!important}

/* ===== Páginas secundarias: huecos de la piel genérica ===== */
.tn [style*="#f0f4f8"],.tn [style*="#fdfdfd"],.tn [style*="background:#f4f7f6"]{background:#0F1530!important}
.tn [style*="background:#fff"],.tn [style*="background:white"]{background:#141B33!important;box-shadow:none!important}
.tn [style*=" color: #000"],.tn [style^="color: #000"]{color:#fff!important}
.tn [style*=" color: #aaa"],.tn [style*="color:#aaa"],.tn [style*="color:#888"]{color:#8B95B5!important}
.tn [style*="color: #495057"]{color:#B8C0DC!important}
.tn [style*="color:red"],.tn [style*="color:#cc0000"]{color:#ff6b7a!important}
.tn [style*="#d9e2ec"]{border-color:#232C4D!important}
.tn .rcj-card,.tn .rcj-h2h-container{background:#141B33!important;box-shadow:none}
.tn .rcj-stats-banner,.tn .rcj-dorsal-circle{background:#0F1530!important;color:#B8C0DC}
.tn .rcj-card.p1 .rcj-dorsal-circle{color:#4285F4}
.tn .rcj-card.p2 .rcj-dorsal-circle{color:#EA4335}
.tn .rcj-h2h-row{border-bottom-color:#232C4D}

/* ===== Rankings de jugadores (recibe_goles, amarillas, asistencias...) ===== */
.tn .sticky-1,.tn .sticky-2{background:#141B33!important;border-right-color:#232C4D!important;color:#E8ECF8}
.tn .head-sticky-1,.tn .head-sticky-2{background:#0F1530!important;border-right-color:#232C4D!important}
.tn td[style*="#f0f7ff"]{color:#27F5EE!important}
.tn [style*="#00509E"]{color:#5BA3FF!important}
.tn [style*=" color: red"]{color:#ff6b7a!important}
.tn [style*="#dc3545"]{color:#ff6b7a!important}
.tn [style*="#28a745"]:not([style*="background"]){color:#4ade80!important}

/* ===== Tablas con clases propias (plantilla, históricos, ficha de jugador) ===== */
.tn .tabla-hist-arb,.tn .tabla-plantilla{background:#141B33}
.tn .tabla-hist-arb th,.tn .tabla-hist-arb td,.tn .tabla-plantilla th,.tn .tabla-plantilla td{border-bottom:1px solid #232C4D;color:#E8ECF8}
.tn .tabla-hist-arb tbody tr:hover td,.tn .tabla-plantilla tbody tr:hover td{background:rgba(39,245,238,.07)!important}
.tn .sticky-temp,.tn .col-fija-1,.tn .col-fija-2{background:#141B33!important;border-right-color:#232C4D!important;color:#E8ECF8}
.tn .head-sticky-temp,.tn .head-fija-1,.tn .head-fija-2{background:#0F1530!important;border-right-color:#232C4D!important}
.tn .fila-posicion-fija,.tn .fila-posicion-resto{background:#0F1530!important;border-color:#232C4D!important;color:#27F5EE}
.tn .tabla-historico{background:#141B33;color:#E8ECF8;box-shadow:none}
.tn .tabla-historico td{border-color:#232C4D;color:#E8ECF8}
.tn .tabla-historico th{border-color:#232C4D}
.tn .tabla-historico td:first-child{background:#0F1530;color:#27F5EE}
.tn .tabla-historico tr:nth-child(even){background:#0F1530}
.tn .alerta-mensaje{background:#141B33;color:#E8ECF8;box-shadow:none}
.tn .alerta-mensaje h3{color:#27F5EE}
.tn .dato-nd{color:#8B95B5}
/* Cuadrículas de equipos / temporadas */
.tn .card-equipo,.tn .card-temporada{background:#141B33;border-color:#232C4D;box-shadow:none}
.tn .card-equipo span,.tn .card-temporada span{color:#E8ECF8}
.tn .card-equipo:hover,.tn .card-temporada:hover{border-color:#27F5EE;box-shadow:0 8px 15px rgba(39,245,238,.12)}
.tn .card-equipo img{background:#fff;border-radius:50%;padding:6px;box-sizing:content-box}
/* Colores sueltos de los rankings */
.tn [style*="#2E7D32"],.tn [style*="color: green"]{color:#4ade80!important}
.tn [style*="#c0392b"]{color:#ff6b7a!important}
.tn [style*="#2980b9"]{color:#5BA3FF!important}
.tn td[style*="#fffdf5"],.tn [style*="#fffdf0"]{background:rgba(255,255,255,.04)!important}
.tn [style*="color:#333"],.tn [style*="color:#555"]{color:#E8ECF8!important}
.tn [style*="color:#666"]{color:#B8C0DC!important}
.tn [style*="color:#06367A"]:not([style*="background"]){color:#27F5EE!important}

/* ===== Fichas de equipo (equipos/*.php) ===== */
.tn .descripcion{background:#141B33;color:#E8ECF8;box-shadow:none}
.tn .descripcion td{border-color:#232C4D}
.tn .descripcion td:first-child{background:#0F1530;color:#27F5EE}
.tn .descripcion a{color:#ff6b7a}
.tn .caja-tendencia{background:#141B33}
.tn .caja-tendencia h3{color:#f6ad55}
.tn .caja-tendencia p{color:#B8C0DC}
.tn .tarjeta-stats{background:#141B33;border-color:#232C4D;box-shadow:none}
.tn .tarjeta-stats h4{border-bottom-color:#232C4D}
.tn .fila-stat{border-bottom-color:#232C4D;color:#B8C0DC}
.tn .val-stat{color:#27F5EE}
.tn .equipo-logo{background:#fff;border-radius:50%;padding:12px;box-sizing:content-box}
.tn [style^="color: #E3001B"]{color:#ff6b7a!important}
/* ===== Fase 0: tarjetas árbitro oscurecidas y uniformes (cubre HTML nuevo y cacheado) ===== */
.tn .rar-top-favor{background:#0F2E1F!important;border-bottom:3px solid #28a745!important}
.tn .rar-top-favor div:first-child{color:#4ade80!important}
.tn .rar-top-favor div:last-child{color:#E8ECF8!important}
.tn .rar-top-favor span{color:#4ade80!important}
.tn .rar-top-contra{background:#2E1518!important;border-bottom:3px solid #dc3545!important}
.tn .rar-top-contra div:first-child{color:#ff6b7a!important}
.tn .rar-top-contra div:last-child{color:#E8ECF8!important}
.tn .rar-top-contra span{color:#ff6b7a!important}
.tn [style*="#e6f4ea"]{background:#0F2E1F!important}
.tn [style*="#fce8e6"]{background:#2E1518!important}
.tn [style*="#fff8e1"]{background:#2A2413!important}
.tn [style*="#28a745"]:not([style*="background"]){color:#4ade80!important}
.tn [style*="#D4A017"]:not([style*="background"]){color:#F8CD51!important}
/* ===== Fase 1: SEO plegable + SVG portada ===== */
.tn #bloque-seo-index details{color:#B8C0DC}
.tn #bloque-seo-index summary{color:#27F5EE!important;cursor:pointer;font-weight:700;list-style:none;display:flex;align-items:center;gap:6px}
.tn #bloque-seo-index summary::after{content:'▾';font-size:12px}
.tn #bloque-seo-index details[open] summary::after{content:'▴'}
.tn #bloque-seo-index summary::-webkit-details-marker{display:none}
.tn-duelos h3 svg,.tn-card h3 svg{flex-shrink:0}
.tn-lider svg{flex-shrink:0;display:block}
/* ===== Fase 3: jornada en portada (carrusel CSS-only, sin JS: vale web + app) ===== */
.tn-jornada h3{color:#E8ECF8!important;font-family:'Barlow Condensed',sans-serif;text-transform:uppercase;letter-spacing:.06em}
.tn-jornada-card{background:#141B33!important;border:1px solid #232C4D;box-shadow:none!important}
.tn-jornada-card div[style*="font-size: 11px"]:first-child{color:#8B95B5!important}
.tn-jornada-card div[style*="font-size: 11px"]{color:#E8ECF8!important}
.tn-jornada-card div[style*="background: #f0f2f5"]{background:#0F1530!important;color:#27F5EE!important;border:1px solid #232C4D}
.tn-jornada-track{scrollbar-width:thin;scrollbar-color:#4C5780 transparent}
.tn-jornada-track::-webkit-scrollbar{height:6px}
.tn-jornada-track::-webkit-scrollbar-thumb{background:#4C5780;border-radius:3px}
/* ===== Fase 3: rankings con pódium y pestañas ===== */
.tn h1 svg{flex-shrink:0}
.tn .rk-tab{scroll-snap-align:start}
.tn .rk-tab.on{background:#27F5EE!important;color:#0A0F1E!important;border-color:#27F5EE!important}
.tn a.rk-tab:not(.on){background:#0A0F1E!important;color:#E8ECF8!important;border-color:#232C4D!important}
.tn .rk-card{background:#141B33!important;border-top-width:4px;box-shadow:none!important}
.tn .rk-card a{color:#E8ECF8!important;border-bottom-color:#4C5780!important}
.tn .rk-card div[style*="font-size:11px"]{color:#8B95B5!important}
/* ===== Fase 3: mi equipo (solo localStorage) ===== */
.tn .mieq-card{background:#141B33!important;border:1px solid #232C4D;box-shadow:none!important}
.tn .mieq-card strong{color:#E8ECF8!important}
.tn #mieq-banner div[style*="font-size:16px"]{color:#E8ECF8!important}
#mieq-bell.on{color:#E3001B!important;border-color:#E3001B!important}
.tn #mieq-quitar,.tn #mieq-bell{color:#E8ECF8!important;border-color:#4C5780!important}
.tn #mieq-bell.on{color:#ff6b7a!important;border-color:#ff6b7a!important}
/* ===== Fase 5: favoritos ===== */
.tn #fav-lista>div{background:#141B33!important;box-shadow:none!important}
.tn #fav-lista div[style*="font-size:16px"]{color:#E8ECF8!important}
.tn #fav-vacio{background:#141B33!important;box-shadow:none!important}
.tn #fav-vacio div[data-lang]{color:#B8C0DC!important}
#fav-lista .fav-bell{color:#999}
#fav-lista .fav-bell.on{color:#E3001B;border-color:#E3001B}
.tn #fav-star.on{color:#D4A017!important;border-color:#D4A017!important}
.tn #fav-star{color:#E8ECF8!important}
.tn .fav-bell{color:#8B95B5!important;border-color:#4C5780!important}
.tn .fav-bell.on{color:#ff6b7a!important;border-color:#ff6b7a!important}
/* ===== Fase 4: buscador global ===== */
.tn #bg-drop{background:#0F1530!important;border-color:#232C4D!important}
.tn #bg-drop a{color:#E8ECF8!important}
.tn #bg-drop .bg-grupo{color:#8B95B5!important}
.tn #bg-drop div[data-lang]{color:#8B95B5!important}
