/* ═══════════════════════════════════════════════════════════════════════════
   MisterIA — «Noche de pachanga»
   Un solo estilo para toda la web. El campo de noche (verde casi negro con las
   franjas del césped recién cortado), las líneas de cal en blanco y un único
   color fuerte: el amarillo de los petos y de las tarjetas.

   Sustituye a theme.css (tema oscuro azul/neón) y a matchday.css (papel crema).
   - En las páginas que usaban theme.css se enlaza DESPUÉS de su <style> propio,
     como hacía theme.css: la página pone la estructura y aquí se fija el aspecto.
   - En las que usaban matchday.css (<html data-theme="matchday">) se enlaza en
     su mismo sitio, ANTES del <style> propio, y conserva sus nombres de clase.
   Los nombres de variables antiguos siguen existiendo (abajo) y apuntan a los
   nuevos, para que los estilos de cada página cambien solos.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── 1. COLORES Y TIPOS ───────────────────────────────────────────────── */
:root {
    /* Campo */
    --fondo:          #07140d;
    --fondo-2:        #0b1c13;
    --superficie:     #10261a;
    --superficie-2:   #163222;
    --superficie-3:   #1e3f2c;
    --borde:          #2a4a37;
    --linea:          rgba(225, 240, 228, 0.10);
    --linea-2:        rgba(225, 240, 228, 0.20);

    /* Cal */
    --tiza:           #eef5ef;
    --tiza-2:         #c6d5ca;
    --gris:           #8fa697;
    --gris-2:         #647c6e;

    /* Peto y tarjetas */
    --amarillo:       #ffd23a;
    --amarillo-2:     #e8b800;
    --amarillo-suave: rgba(255, 210, 58, 0.13);
    --sobre-amarillo: #0a1a10;
    --verde:          #5ddc8c;
    --rojo:           #ff5d4d;
    --rojo-2:         #ff8a7c;
    --whatsapp:       #25d366;

    /* Petos de los dos equipos */
    --peto-negro:     #050b08;
    --peto-blanco:    #f4f7f3;

    --f-titulo: 'Big Shoulders', 'Big Shoulders Display', 'Barlow Condensed', 'Arial Narrow', sans-serif;
    --f-texto:  'Barlow', 'Segoe UI', Roboto, Arial, sans-serif;

    --radio-s:  10px;
    --radio:    14px;
    --radio-l:  20px;
    --sombra:   0 10px 30px rgba(0, 0, 0, 0.35);
    --ease:     cubic-bezier(0.22, 1, 0.36, 1);

    /* ── Nombres del tema oscuro antiguo (theme.css y estilos de cada página) ── */
    --bg-dark: var(--fondo);  --bg: var(--fondo);  --bg-deep: var(--fondo);
    --bg-surface: var(--superficie);  --surface: var(--superficie);  --surface-hover: var(--superficie-2);
    --bg-elevated: var(--superficie-2);  --bg-card: var(--superficie);  --bg-card-hover: var(--superficie-2);
    --primary: var(--amarillo);  --primary-deep: var(--amarillo);  --primary-hover: var(--amarillo-2);
    --accent: var(--amarillo);  --accent-dark: var(--amarillo-2);  --violet: var(--amarillo);
    --danger: var(--rojo);  --rival: var(--rojo);  --success: var(--verde);  --warning: var(--amarillo);
    --text-main: var(--tiza);  --text: var(--tiza);  --text-muted: var(--gris);  --text-dim: var(--gris-2);
    --glass-border: 1px solid var(--linea);  --border: 1px solid var(--linea);
    --radius-sm: var(--radio-s);  --radius-md: var(--radio);  --radius-lg: var(--radio-l);  --radius-xl: 24px;
    --shadow: var(--sombra);  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.5);
    --glow-primary: 0 0 0 transparent;  --glow-accent: 0 0 0 transparent;
    --transition: all 0.25s var(--ease);

    /* ── Nombres del estilo «matchday» (portada, torneo y página del grupo) ── */
    --paper: var(--fondo);  --paper-card: var(--superficie);  --paper-warm: var(--superficie-2);  --grain: transparent;
    --ink: var(--tiza);  --ink-soft: var(--tiza-2);  --ink-mute: var(--gris);  --ink-faint: var(--gris-2);
    --accent-deep: var(--amarillo-2);  --accent-wash: var(--amarillo-suave);  --on-accent: var(--sobre-amarillo);
    --rule: 1px solid var(--linea-2);  --rule-thick: 1px solid var(--linea-2);  --rule-hair: 1px solid var(--linea);
    --pop: var(--sombra);  --pop-accent: var(--sombra);  --pop-sm: 0 4px 14px rgba(0, 0, 0, 0.3);

    color-scheme: dark;
}

/* ─── 2. EL CAMPO ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* El césped va en <html> para que cubra toda la ventana aunque la página sea corta */
html {
    min-height: 100%;
    background-color: var(--fondo);
    /* Luz de los focos arriba y franjas del césped cortado */
    background-image:
        radial-gradient(120% 55% at 50% -14%, rgba(255, 236, 170, 0.08), transparent 62%),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.022) 0 72px, transparent 72px 144px);
    background-attachment: fixed;
}

body {
    background-color: transparent !important;
    background-image: none !important;
    color: var(--tiza);
    font-family: var(--f-texto);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection { background: var(--amarillo); color: var(--sobre-amarillo); }

/* ─── 3. TIPOGRAFÍA ────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, .display {
    font-family: var(--f-titulo);
    font-weight: 800;
    letter-spacing: 0.01em;
    text-wrap: balance;
}
.mi-gradient-text, .accent-text { color: var(--amarillo); -webkit-text-fill-color: var(--amarillo); background: none; }
a { color: var(--amarillo); }

/* ─── 4. TARJETAS ──────────────────────────────────────────────────────── */
.box, .card {
    background: var(--superficie);
    border: 1px solid var(--linea);
    border-radius: var(--radio-l);
    box-shadow: var(--sombra);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
.box::before, .card::before { content: none; }
.card-hover:hover { background: var(--superficie-2); border-color: var(--linea-2); transform: translateY(-2px); }
.modal-box, .sheet {
    background: var(--superficie);
    border: 1px solid var(--linea-2);
    border-radius: var(--radio-l);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}

/* ─── 5. BOTONES ───────────────────────────────────────────────────────── */
button, .btn, .action-btn {
    font-family: var(--f-titulo);
    font-weight: 800;
    letter-spacing: 0.05em;
    transition: transform 0.12s var(--ease), background 0.2s, border-color 0.2s, color 0.2s, filter 0.2s;
}
button:active, .btn:active, .action-btn:active { transform: scale(0.97); }
button.primary::after, .btn-primary::after, .btn-glow::after { content: none; }

button.primary, .btn-primary, button.vote-btn, .btn-accent {
    background: var(--amarillo);
    color: var(--sobre-amarillo);
    border: none;
    box-shadow: 0 6px 18px rgba(255, 210, 58, 0.18);
}
button.primary:hover, .btn-primary:hover, button.vote-btn:hover, .btn-accent:hover { filter: brightness(1.06); }

button.secondary, .btn-secondary, .btn-ghost {
    background: var(--superficie-2);
    color: var(--tiza);
    border: 1px solid var(--linea-2);
    box-shadow: none;
}
button.secondary:hover, .btn-secondary:hover, .btn-ghost:hover { border-color: var(--amarillo); }

button.outline, .btn-outline {
    background: transparent;
    color: var(--amarillo);
    border: 1px solid rgba(255, 210, 58, 0.45);
    box-shadow: none;
}
button.outline:hover, .btn-outline:hover { background: var(--amarillo-suave); border-color: var(--amarillo); }

button.whatsapp, .btn-whatsapp, .btn-wa { background: var(--whatsapp); color: #062b16; border: none; box-shadow: none; }
.btn-danger { background: transparent; color: var(--rojo); border: 1px solid rgba(255, 93, 77, 0.5); box-shadow: none; }
button:disabled, .btn:disabled { filter: grayscale(0.6); opacity: 0.55; }

/* ─── 6. FORMULARIOS ───────────────────────────────────────────────────── */
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="search"], input[type="tel"], input[type="datetime-local"], input[type="date"],
input:not([type]), select, textarea {
    background-color: var(--fondo-2);
    border: 1px solid var(--borde);
    border-radius: var(--radio-s);
    color: var(--tiza);
    font-family: var(--f-texto);
    transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--amarillo);
    outline: none;
    box-shadow: 0 0 0 3px var(--amarillo-suave);
}
input::placeholder, textarea::placeholder { color: var(--gris-2); }
select {
    background-image:
        linear-gradient(45deg, transparent 50%, var(--amarillo) 50%),
        linear-gradient(135deg, var(--amarillo) 50%, transparent 50%);
    background-position: calc(100% - 20px) calc(50% - 2px), calc(100% - 15px) calc(50% - 2px);
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 38px;
    appearance: none;
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--amarillo); }

/* ─── 7. PIEZAS DE LA APP ──────────────────────────────────────────────── */
.player-row {
    background: var(--fondo-2);
    border: 1px solid var(--linea);
    border-radius: var(--radio);
}
.player-row:hover { border-color: var(--linea-2); }
.rating-badge {
    background: var(--fondo);
    border: 1px solid rgba(255, 210, 58, 0.45);
    color: var(--amarillo);
    font-family: var(--f-titulo);
    box-shadow: none;
}
.tag, .badge { border-radius: 6px; letter-spacing: 0.06em; }
.avatar { border: 2px solid var(--linea-2); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4); }
.progress-bar, .vote-progress-container { background: var(--superficie-2); overflow: hidden; }
.progress-fill, .vote-progress-bar { background: var(--amarillo); box-shadow: none; }
.share-link-box { background: var(--fondo-2); border: 1px dashed rgba(255, 210, 58, 0.5); border-radius: var(--radio-s); color: var(--amarillo); }
hr, .divider { border-color: var(--linea); }

/* Si Google no tiene anuncio para un hueco, que no quede un rectángulo vacío */
ins.adsbygoogle[data-ad-status="unfilled"] { display: none !important; }

/* El campo de la pizarra: el césped también en la paleta */
.full-field { background-color: #1f6b3d; }

/* ─── 8. VOCABULARIO «MATCHDAY» (portada, torneo y página del grupo) ───── */
:where([data-theme="matchday"]) body { font-family: var(--f-texto); }
:where([data-theme="matchday"]) a { text-decoration: none; }
:where([data-theme="matchday"]) a:hover { text-decoration: underline; }
:where([data-theme="matchday"]) h1 { font-size: clamp(2.8rem, 13vw, 4.8rem); line-height: 0.86; font-weight: 900; }
:where([data-theme="matchday"]) h1, :where([data-theme="matchday"]) h2, :where([data-theme="matchday"]) h3,
:where([data-theme="matchday"]) h4, :where([data-theme="matchday"]) .display { text-transform: uppercase; line-height: 0.95; color: var(--tiza); }

.outline-text { -webkit-text-stroke: 2px var(--tiza); color: transparent; -webkit-text-fill-color: transparent; }
.kicker {
    display: inline-block;
    background: var(--amarillo);
    color: var(--sobre-amarillo);
    font-family: var(--f-texto);
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    padding: 5px 10px;
    border-radius: 4px;
}
.strip {
    background: var(--fondo-2);
    color: var(--gris);
    border-bottom: 1px solid var(--linea);
    font-size: 0.64rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    padding: 8px 18px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}
/* Cabecera de sección: la línea de cal que llena el hueco */
.sec-head { display: flex; align-items: baseline; gap: 12px; margin: 28px 0 12px; }
.sec-head h2, .sec-head h3 { margin: 0; }
.sec-head::after, .sec-head .rule { content: ""; flex: 1; height: 2px; background: var(--linea-2); border-radius: 2px; }
.lead { font-size: 1rem; line-height: 1.5; border-left: 3px solid var(--amarillo); padding-left: 12px; margin: 16px 0 22px; color: var(--tiza-2); }
.text-mute { color: var(--gris); }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.74rem; }
.uppercase { text-transform: uppercase; letter-spacing: 0.1em; }

:where([data-theme="matchday"]) button, :where([data-theme="matchday"]) .btn {
    font-size: 1.15rem;
    text-transform: uppercase;
    border: none;
    border-radius: var(--radio);
    padding: 15px 18px;
    width: 100%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    background: var(--amarillo);
    color: var(--sobre-amarillo);
    box-shadow: 0 6px 18px rgba(255, 210, 58, 0.16);
    text-decoration: none;
    touch-action: manipulation;
}
:where([data-theme="matchday"]) button:active, :where([data-theme="matchday"]) .btn:active { transform: scale(0.97); box-shadow: none; }
:where([data-theme="matchday"]) button:disabled, :where([data-theme="matchday"]) .btn:disabled {
    background: var(--superficie-2); color: var(--gris-2); box-shadow: none; opacity: 1; filter: none; transform: none;
}
:where([data-theme="matchday"]) .btn-ghost { background: transparent; color: var(--tiza); border: 1px solid var(--linea-2); box-shadow: none; }
:where([data-theme="matchday"]) .btn-wa { background: var(--whatsapp); color: #062b16; }
:where([data-theme="matchday"]) .btn-danger { background: transparent; color: var(--rojo); border: 1px solid rgba(255, 93, 77, 0.5); box-shadow: none; }
.btn-sm, :where([data-theme="matchday"]) .btn-sm {
    font-family: var(--f-texto);
    font-weight: 800;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 8px 12px;
    width: auto;
    background: transparent;
    color: var(--tiza);
    border: 1px solid var(--linea-2);
    border-radius: 8px;
    box-shadow: none;
}
.btn-sm.on, .btn-sm.selected { background: var(--amarillo); color: var(--sobre-amarillo); border-color: var(--amarillo); }
.icon-btn { border-radius: var(--radio-s); }
.btn-row { display: flex; gap: 12px; }
.btn-row > * { flex: 1; }

:where([data-theme="matchday"]) input[type="text"], :where([data-theme="matchday"]) input[type="email"],
:where([data-theme="matchday"]) input[type="password"], :where([data-theme="matchday"]) input[type="number"],
:where([data-theme="matchday"]) input[type="search"], :where([data-theme="matchday"]) input[type="tel"],
:where([data-theme="matchday"]) select, :where([data-theme="matchday"]) textarea {
    font-size: 16px;
    font-weight: 600;
    width: 100%;
    padding: 13px 14px;
}
.field-label {
    display: block;
    font-size: 0.66rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--gris);
    margin: 18px 0 7px;
}
.field-label:first-child { margin-top: 0; }
:where([data-theme="matchday"]) .card, :where([data-theme="matchday"]) .box { padding: 18px; margin-bottom: 22px; }
.card-flat { background: transparent; border: none; box-shadow: none; padding: 0; }
.list-rule > * { border-top: 1px solid var(--linea); padding: 14px 0; }
.list-rule > *:first-child { border-top: none; }
.numeral { font-family: var(--f-titulo); font-weight: 900; font-size: 2.4rem; line-height: 0.8; color: var(--amarillo); }
:where([data-theme="matchday"]) .tag, :where([data-theme="matchday"]) .badge {
    display: inline-block;
    font-family: var(--f-texto);
    font-size: 0.6rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 3px 7px;
    border: 1px solid var(--linea-2);
    background: transparent;
    color: var(--tiza);
}
.tag-solid { background: var(--tiza) !important; color: var(--fondo) !important; border-color: var(--tiza) !important; }
.tag-accent { background: var(--amarillo) !important; color: var(--sobre-amarillo) !important; border-color: var(--amarillo) !important; }
/* Peto de equipo: cuadradito con borde de cal */
.kit {
    width: 13px; height: 13px;
    border: 2px solid var(--tiza);
    border-radius: 3px;
    display: inline-block;
    flex-shrink: 0;
    background: var(--kit-color, #fff);
}
.kit-lg { width: 20px; height: 20px; }

table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
table.data th {
    font-family: var(--f-texto); font-size: 0.62rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: 0.1em; color: var(--gris); text-align: center; padding: 9px 3px; border-bottom: 1px solid var(--linea-2);
}
table.data th:nth-child(2) { text-align: left; }
table.data td { padding: 11px 3px; text-align: center; font-weight: 600; border-bottom: 1px solid var(--linea); color: var(--tiza); }
table.data td:nth-child(2) { text-align: left; }
table.data tr:last-child td { border-bottom: none; }

:where([data-theme="matchday"]) .progress-bar { height: 10px; border: none; border-radius: 99px; }
:where([data-theme="matchday"]) .progress-fill { height: 100%; border-radius: 99px; transition: width 0.5s var(--ease); }
.spinner {
    width: 34px; height: 34px;
    border: 3px solid var(--linea-2);
    border-top-color: var(--amarillo);
    border-radius: 50%;
    animation: mi-giro 0.8s linear infinite;
    margin: 20px auto;
}
@keyframes mi-giro { to { transform: rotate(360deg); } }
.overlay {
    position: fixed; inset: 0; background: rgba(2, 8, 5, 0.78); z-index: 2000;
    display: none; align-items: center; justify-content: center; padding: 18px;
}
.overlay.open { display: flex; }
:where([data-theme="matchday"]) .sheet { width: 100%; max-width: 430px; padding: 20px; }
.toast {
    position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%) translateY(12px);
    background: var(--superficie-3); color: var(--tiza);
    border: 1px solid var(--linea-2); border-left: 4px solid var(--amarillo); border-radius: var(--radio-s);
    box-shadow: var(--sombra); padding: 11px 18px; font-size: 0.86rem; font-weight: 700;
    z-index: 9999; opacity: 0; transition: all 0.25s var(--ease); pointer-events: none; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-left-color: var(--rojo); }

/* ─── 9. SCROLL, MOVIMIENTO Y ACCESIBILIDAD ────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: var(--borde) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--borde); border-radius: 99px; }

@keyframes mi-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.mi-rise, .md-rise { animation: mi-rise 0.5s var(--ease) both; }
.mi-d1 { animation-delay: 0.06s; } .mi-d2 { animation-delay: 0.12s; } .mi-d3 { animation-delay: 0.18s; }
.mi-d4 { animation-delay: 0.24s; } .mi-d5 { animation-delay: 0.30s; }
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.5s var(--ease), transform 0.5s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@keyframes mi-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.mi-live-dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: var(--rojo); animation: mi-pulse 1.4s ease-in-out infinite;
}

:focus-visible { outline: 2px solid var(--amarillo); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; transition: none; }
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
