/* =============================================
   TSL | TOP SPEED LEAGUE — External Stylesheet
   =============================================
   Organized, deduplicated, and bug-fixed.
   ============================================= */

/* === VARIABLES === */
:root {
    --primary: #e60000;

    /* MODO OSCURO (Charcoal) */
    --bg-body: #0d0d0f;
    --bg-card: rgba(39, 39, 42, 0.55);
    --bg-header: rgba(24, 24, 27, 0.75);
    --bg-hero: rgba(32, 32, 35, 0.45);
    --bg-race-card: rgba(45, 45, 48, 0.55);

    --text-main: #f4f4f5;
    --text-muted: #a1a1aa;
    --hero-text-color: #ffffff;

    --f1-border: rgba(255, 255, 255, 0.08);
    --f1-header-text: #a1a1aa;
    --f1-row-hover: rgba(255, 255, 255, 0.06);
    --f1-pill-bg: rgba(255, 255, 255, 0.08);

    --font-display: 'Kanit', sans-serif;
    --font-body: 'Titillium Web', sans-serif;
    --accent: #ffcc00;

    --glass-blur: blur(12px);
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* MODO CLARO */
body.light-mode {
    --bg-body: #f5f5f7;
    --bg-card: rgba(255, 255, 255, 0.7);
    --bg-header: rgba(255, 255, 255, 0.8);
    --text-main: #111111;
    --text-muted: #666666;
    --bg-hero: rgba(255, 255, 255, 0.6);
    --bg-race-card: rgba(244, 244, 245, 0.7);
    --hero-text-color: #000000;
    --f1-border: rgba(0, 0, 0, 0.06);
    --f1-header-text: #71717a;
    --f1-row-hover: rgba(0, 0, 0, 0.03);
    --f1-pill-bg: rgba(0, 0, 0, 0.05);
}

/* === RESET & BASE === */
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-body);
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    transition: background 0.3s, color 0.3s;
}

/* === BACKGROUND === */
body::before {
    content: "";
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 100vh;
    z-index: -1;
    background-image: url('fondo.png');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center center;
    opacity: 1;
    transition: filter 0.3s ease;
}
body.light-mode::before { filter: invert(1); }

/* === HEADER === */
/* BUG-4 FIX: Added position: sticky; top: 0 for desktop as well */
header {
    background: var(--bg-header);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--primary);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    position: sticky;
    top: 0;
    z-index: 1000;
}
.logo-area { display: flex; align-items: center; gap: 15px; cursor: pointer; transition: opacity 0.2s; }
.logo-area:hover { opacity: 0.8; }
.logo-img { height: 70px; width: auto; }
h1 {
    font-family: var(--font-display);
    font-weight: 800;
    font-style: italic;
    text-transform: uppercase;
    font-size: 1.8rem;
    margin: 0;
    color: var(--text-main);
    letter-spacing: 1px;
    white-space: nowrap;
}
.header-right { display: flex; align-items: center; }
.social-icons-header { display: flex; gap: 15px; margin-right: 25px; align-items: center; }
.social-icons-header a { color: var(--text-main); font-size: 1.3rem; transition: 0.3s; }
.social-icons-header a:hover { color: var(--primary); transform: translateY(-2px); }
#btnTema {
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--f1-border);
    width: 40px; height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: 0.3s;
}
#btnTema:hover { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 10px rgba(230,0,0,0.2); }

/* === NAV === */
nav.main-nav {
    background: var(--bg-header);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    display: flex;
    justify-content: flex-end;
    padding: 0 30px;
    border-bottom: 1px solid var(--f1-border);
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}
nav.main-nav::-webkit-scrollbar { display: none; }
nav.main-nav a {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 20px;
    cursor: pointer;
    font-family: var(--font-display);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 1rem;
    border-bottom: 3px solid transparent;
    transition: 0.2s;
    flex-shrink: 0;
    text-decoration: none;
    display: inline-block;
}
nav.main-nav a:hover { color: var(--text-main); }
nav.main-nav a.activo { color: var(--primary); border-bottom: 3px solid var(--primary); }

/* Logo pequeño para tablas */
.team-logo-mini {
    height: 24px;
    width: auto;
    vertical-align: middle;
    margin-right: 10px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

/* Bandera pequeña para resultados de carrera */
.driver-flag-mini {
    width: 20px;
    height: auto;
    border-radius: 2px;
    margin-left: 8px;
    vertical-align: middle;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    display: inline-block;
}

/* === SECTIONS & HERO === */
.seccion-contenido {
    display: none;
    max-width: 1300px;
    margin: 40px auto;
    padding: 0 20px;
}
.seccion-contenido.mostrar {
    display: block !important;
    animation: fadeInSection 0.5s ease;
}
@keyframes fadeInSection {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.hero-section {
    background: var(--bg-hero);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    padding: 60px;
    border-radius: 20px;
    border: 1px solid var(--f1-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    gap: 40px;
    box-shadow: var(--card-shadow);
}
.hero-content { flex: 1; color: var(--hero-text-color); }
.hero-content h2 {
    font-family: var(--font-display);
    font-size: 4.5rem;
    font-style: italic;
    font-weight: 800;
    line-height: 0.9;
    margin-bottom: 15px;
    color: var(--primary);
}
.hero-content p.subtitle { font-size: 1.5rem; font-weight: 300; margin-bottom: 40px; opacity: 0.9; }
.hero-buttons { display: flex; gap: 20px; flex-wrap: wrap; }
.hero-btn {
    padding: 15px 35px;
    border-radius: 50px;
    font-weight: 700;
    text-transform: uppercase;
    font-family: var(--font-display);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: 0.3s ease;
}
.btn-discord { background: #5865F2; color: white; border: none; box-shadow: 0 4px 15px rgba(88, 101, 242, 0.3); }
.btn-discord:hover { background: #4752C4; transform: translateY(-2px); box-shadow: 0 8px 25px rgba(88, 101, 242, 0.5); }
.btn-standings { background: transparent; color: var(--hero-text-color); border: 2px solid var(--primary); box-shadow: 0 4px 15px rgba(230, 0, 0, 0.1); }
.btn-standings:hover { background: var(--primary); color: white; transform: translateY(-2px); box-shadow: 0 8px 25px rgba(230, 0, 0, 0.4); }

.next-race-card {
    background: var(--bg-race-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    padding: 35px;
    border-radius: 15px;
    width: 350px;
    border: 1px solid var(--f1-border);
    border-top: 5px solid var(--primary);
    color: var(--hero-text-color);
    box-shadow: var(--card-shadow);
    flex-shrink: 0;
}
.next-race-card h4 { color: var(--primary); font-family: var(--font-display); font-weight: 700; font-size: 0.9rem; margin-bottom: 10px; }
.next-race-header { display: flex; align-items: center; gap: 15px; margin-bottom: 10px; }
.next-race-flag { width: 45px; height: auto; border-radius: 4px; box-shadow: 0 2px 5px rgba(0,0,0,0.5); }
.next-race-card h3 { font-family: var(--font-display); font-style: italic; font-weight: 800; font-size: 1.8rem; margin: 0; line-height: 1.1; }
.next-race-card .round-info { font-size: 0.9rem; margin-bottom: 25px; opacity: 0.6; font-weight: 600; letter-spacing: 1px; }
.info-row { display: flex; align-items: center; gap: 15px; margin-bottom: 20px; }
.info-icon { font-size: 1.2rem; color: var(--primary); width: 25px; text-align: center; }
.info-data span { display: block; }
.info-label { font-size: 0.7rem; font-weight: 700; opacity: 0.5; }
.info-value { font-size: 1.1rem; font-weight: 700; font-family: var(--font-display); text-transform: uppercase; }
.btn-full-calendar { display: block; text-align: center; padding: 15px 0; margin-top: 10px; background: var(--primary); color: #fff; font-family: var(--font-display); font-weight: 700; border-radius: 8px; text-decoration: none; transition: 0.3s; }
.btn-full-calendar:hover { background: #b30000; box-shadow: 0 5px 15px rgba(230, 0, 0, 0.4); }

/* === COUNTDOWN TIMER === */
.countdown-wrapper {
    margin: 18px 0;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--f1-border);
    border-radius: 12px;
    padding: 14px 10px 10px 10px;
}
body.light-mode .countdown-wrapper {
    background: rgba(0,0,0,0.05);
}
.countdown-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--primary);
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 10px;
    display: block;
}
.countdown-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    text-align: center;
}
.countdown-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.countdown-num {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.9rem;
    line-height: 1;
    color: var(--hero-text-color);
    min-width: 44px;
    background: rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 10px 6px 8px 6px;
    display: inline-block;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
/* BUG-10 FIX: Improved contrast for countdown-num in light mode */
body.light-mode .countdown-num {
    background: rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    color: #111111;
}
.countdown-num:hover {
    border-color: var(--primary);
    transform: translateY(-2px) scale(1.05);
    background: rgba(230, 0, 0, 0.1);
    box-shadow: 0 8px 25px rgba(230, 0, 0, 0.25);
}
.countdown-unit-label {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-top: 5px;
    text-transform: uppercase;
}
.countdown-finished {
    text-align: center;
    font-family: var(--font-display);
    font-weight: 800;
    font-style: italic;
    color: var(--primary);
    font-size: 1.1rem;
    padding: 10px 0;
}

/* === QUICK LINKS === */
.quick-links-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 25px; margin-bottom: 40px; }
.quick-link-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    padding: 30px 20px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--f1-border);
    transition: 0.3s ease;
    cursor: pointer;
    box-shadow: var(--card-shadow);
}
.quick-link-card:hover {
    transform: translateY(-7px);
    border-color: var(--primary);
    box-shadow: 0 8px 25px rgba(230, 0, 0, 0.25);
}
.quick-link-icon { font-size: 2.5rem; color: var(--primary); margin-bottom: 15px; }
.quick-link-title { font-weight: 800; font-family: var(--font-display); font-style: italic; text-transform: uppercase; font-size: 1.1rem; }

/* === TEAM GRID (Alineaciones) === */
.grid-teams {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}
.team-card-grid {
    flex: 1 1 300px;
    max-width: 450px;
    width: 100%;
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.2s;
    border: 1px solid var(--f1-border);
}
.team-card-grid:hover {
    transform: translateY(-5px);
    border-color: var(--text-muted);
}
.team-name-display {
    font-family: var(--font-display);
    font-weight: 800;
    text-transform: uppercase;
    font-style: italic;
    font-size: 1.2rem;
    color: white;
    text-shadow: 1px 1px 2px black;
}
.drivers-list { padding: 20px; }
.driver-row-grid {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--f1-border);
}
.driver-row-grid:last-child { border-bottom: none; }
.driver-icon { margin-right: 15px; font-size: 1.2rem; opacity: 0.7; }
.driver-name-grid { font-weight: 700; font-size: 1.1rem; }
.team-logo-img {
    height: 35px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}
.driver-flag-img {
    width: 24px;
    height: auto;
    border-radius: 3px;
    margin-left: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.team-header-grid {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
}

/* === TABLES === */
.card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 25px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--f1-border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.card:hover {
    border-color: rgba(230, 0, 0, 0.25);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    transform: translateY(-2px);
}
body.light-mode .card:hover {
    border-color: rgba(230, 0, 0, 0.15);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}
h2 {
    position: relative;
    padding-bottom: 8px;
    margin-bottom: 30px;
    font-family: var(--font-display);
    font-weight: 800;
    font-style: italic;
    text-transform: uppercase;
    font-size: 2.2rem;
    background: linear-gradient(90deg, var(--text-main) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}
h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: 2px;
    transition: width 0.3s ease;
}
.card:hover h2::after { width: 100px; }
.f1-table-container {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: 12px;
    padding: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--f1-border);
    box-shadow: var(--card-shadow);
    position: relative;
}
.f1-title { font-family: var(--font-display); font-weight: 900; font-size: 1.8rem; text-transform: uppercase; margin-bottom: 20px; font-style: italic; white-space: nowrap; }
.f1-table { width: 100%; border-collapse: collapse; min-width: 800px; }
.f1-table th { text-align: left; padding: 15px; color: var(--f1-header-text); font-family: var(--font-display); font-weight: 600; font-size: 0.9rem; text-transform: uppercase; }
.f1-table td {
    padding: 20px 15px;
    border-bottom: 1px solid var(--f1-border);
    vertical-align: middle;
    white-space: nowrap;
    color: var(--text-main);
}
.f1-table tr:hover td { background-color: var(--f1-row-hover); }
.clickable-row { cursor: pointer; transition: background 0.2s; }
.clickable-row:active { background-color: var(--primary) !important; color: white; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); border: 2px dashed var(--f1-border); border-radius: 12px; margin-top: 20px; }
.empty-state i { font-size: 3rem; margin-bottom: 15px; opacity: 0.5; color: var(--primary); }
.empty-state h3 { margin: 0 0 10px 0; color: var(--text-main); font-family: var(--font-display); font-size: 1.5rem; font-style: italic; text-transform: uppercase; }

/* === CALENDAR TABLE === */
.tabla-calendario { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 15px; min-width: 600px; }
.tabla-calendario th { background: #111; color: #fff; padding: 15px; text-align: left; }
.tabla-calendario td { padding: 15px; border-bottom: 1px solid var(--f1-border); white-space: nowrap; }
.col-ronda { font-weight: 800; color: var(--primary); font-family: var(--font-display); font-size: 1.2rem; width: 10%; }
.gp-container { display: flex; align-items: center; gap: 15px; }
.img-flag { width: 40px; height: auto; border-radius: 3px; box-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.gp-country { font-size: 1.1rem; font-weight: 900; font-style: italic; text-transform: uppercase; font-family: var(--font-display); display: block; }
.gp-circuit { font-size: 0.9rem; color: var(--text-muted); display: block; }
.col-fecha { text-align: right; font-weight: 700; font-family: var(--font-display); font-size: 1.1rem; }
.sprint-tag { background: var(--accent); color: black; padding: 2px 8px; border-radius: 4px; font-size: 0.7em; font-weight: 800; margin-left: 8px; vertical-align: middle; text-transform: uppercase; font-family: var(--font-display); }

.f1-pos { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; width: 50px; }
.f1-driver { font-family: var(--font-body); font-weight: 700; font-size: 1rem; display: flex; align-items: center; }
.team-line { width: 4px; height: 20px; display: inline-block; margin-right: 10px; border-radius: 2px; flex-shrink: 0; }
.team-rb { background-color: #3671C6; }
.team-ferrari { background-color: #F91536; }
.team-merc { background-color: #6CD3BF; }
.team-mclaren { background-color: #F58020; }
.team-am { background-color: #229971; }
.team-williams { background-color: #64C4FF; }
.team-vcarb { background-color: #1634CB; }
.team-alpine { background-color: #0093CC; }
.team-haas { background-color: #B6BABD; }
.team-sauber { background-color: #52E252; }
.f1-team-name { font-size: 0.8rem; color: var(--text-muted); font-weight: 400; text-transform: uppercase; margin-left: 10px; }
.f1-pts { text-align: right; }
.pts-pill { background-color: var(--f1-pill-bg); padding: 4px 12px; border-radius: 20px; font-family: var(--font-display); font-weight: 700; font-size: 0.9rem; }

/* === BUTTONS & TABS === */
.tabs-control, .sub-nav { display: flex; gap: 15px; margin-bottom: 30px; justify-content: center; flex-wrap: wrap; }
.btn-control {
    padding: 12px 30px;
    border-radius: 50px;
    background: var(--bg-card);
    color: var(--text-muted);
    border: 2px solid transparent;
    font-family: var(--font-display);
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}
.btn-control:hover { color: var(--text-main); border-color: rgba(255, 255, 255, 0.15); box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25); transform: translateY(-2px); }
body.light-mode .btn-control:hover { border-color: rgba(0, 0, 0, 0.08); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05); }
.btn-control.activo { background: var(--primary); color: white; border-color: var(--primary); box-shadow: 0 6px 20px rgba(230, 0, 0, 0.4); }
.btn-control.activo:hover { box-shadow: 0 8px 25px rgba(230, 0, 0, 0.6); transform: translateY(-2px); }
.btn-season {
    padding: 10px 24px;
    border-radius: 50px;
    background: var(--bg-card);
    color: var(--text-muted);
    border: 2px solid transparent;
    font-family: var(--font-display);
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}
.btn-season:hover { color: var(--text-main); border-color: rgba(255, 255, 255, 0.15); box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25); transform: translateY(-2px); }
body.light-mode .btn-season:hover { border-color: rgba(0, 0, 0, 0.08); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05); }
.btn-season.activo { background: var(--primary); color: white; border-color: var(--primary); box-shadow: 0 6px 20px rgba(230, 0, 0, 0.4); }
.btn-season.activo:hover { box-shadow: 0 8px 25px rgba(230, 0, 0, 0.6); transform: translateY(-2px); }
.btn-sub { background: none; border: none; color: var(--text-muted); padding: 12px 25px; cursor: pointer; font-size: 1rem; font-family: var(--font-display); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.btn-sub.activo-sub { color: var(--primary); border-bottom: 3px solid var(--primary); background: linear-gradient(to top, rgba(230,0,0,0.05), transparent); }

.contenido-dinamico, .panel-dato, .race-detail-view { display: none; }
.mostrar-contenido, .mostrar-panel, .show-detail { display: block; animation: fadeIn 0.3s; }
.sesion-data { display: none; }
.show-sesion { display: block; animation: fadeIn 0.3s; }

.btn-back { background: transparent; border: 1px solid var(--text-muted); color: var(--text-main); padding: 10px 20px; border-radius: 5px; cursor: pointer; font-weight: bold; margin-bottom: 20px; display: inline-flex; gap: 10px; align-items: center; }
.race-header { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 1px solid var(--f1-border); padding-bottom: 20px; margin-bottom: 20px; flex-wrap: wrap; gap: 20px; }
.race-title-group h2 { font-size: 2.5rem; margin: 0; line-height: 1; }
.race-date-loc { font-size: 1rem; color: var(--text-muted); margin-top: 5px; text-transform: uppercase; letter-spacing: 1px; }

.social-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 20px; text-align: center; }
.social-card { background: var(--bg-card); padding: 40px 10px; border-radius: 12px; text-decoration: none; color: var(--text-main); border: 1px solid var(--f1-border); transition: 0.3s; display: block; }
.social-card:hover { transform: translateY(-7px); border-color: var(--primary); }
.social-icon { font-size: 3rem; margin-bottom: 15px; display: block; color: var(--primary); }

/* === SEARCH === */
.search-pilot-wrapper { position: relative; margin-bottom: 18px; }
.search-pilot-wrapper i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.95rem;
    pointer-events: none;
}
.search-pilot-input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 16px 12px 38px;
    background: var(--bg-card);
    border: 1px solid var(--f1-border);
    border-radius: 8px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}
.search-pilot-input:focus { border-color: var(--primary); }
.search-pilot-input::placeholder { color: var(--text-muted); }
.search-no-results { text-align: center; padding: 20px; color: var(--text-muted); font-style: italic; display: none; }

/* === BACK TO TOP === */
.btn-back-top {
    position: fixed;
    bottom: 85px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(230,0,0,0.4);
    z-index: 5000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
}
.btn-back-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.btn-back-top:hover { background: #b30000; transform: translateY(-2px); }
@media (min-width: 769px) {
    .btn-back-top { bottom: 30px; }
}

/* === SHARE BUTTON === */
.btn-share-race {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--f1-border);
    border-radius: 8px;
    color: var(--text-muted);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    cursor: pointer;
    transition: 0.2s;
    margin-bottom: 15px;
}
.btn-share-race:hover { border-color: var(--primary); color: var(--primary); }
.btn-share-race.copied { border-color: #34c759; color: #34c759; }

/* === TOAST NOTIFICATION === */
.tsl-toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--f1-border);
    border-radius: 50px;
    padding: 12px 24px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
    z-index: 99999;
    white-space: nowrap;
}
.tsl-toast-visible { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.tsl-toast-success i { color: #34c759; }
.tsl-toast-error i { color: #ff3b30; }
@media (min-width: 769px) { .tsl-toast { bottom: 40px; } }

/* === CURRENT ROUND HIGHLIGHT === */
.ronda-actual td { background: rgba(230, 0, 0, 0.06) !important; }
.ronda-actual .col-ronda { color: var(--primary) !important; }
.ronda-actual .col-fecha::after {
    content: ' ← HOY';
    color: var(--primary);
    font-size: 0.65rem;
    font-weight: 900;
    letter-spacing: 1px;
    vertical-align: middle;
}

/* === FOOTER === */
footer { text-align: center; padding: 50px 20px; color: #666; font-family: var(--font-display); font-size: 0.9rem; }
.tsl-footer {
    background: var(--bg-header);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-top: 1px solid var(--f1-border);
    padding: 40px 20px 30px;
    text-align: center;
    color: var(--text-muted);
    font-family: var(--font-body);
}
.tsl-footer .footer-brand {
    font-family: var(--font-display);
    font-weight: 800;
    font-style: italic;
    font-size: 1.3rem;
    color: var(--primary);
    text-transform: uppercase;
    margin-bottom: 8px;
}
.tsl-footer .footer-tagline {
    font-size: 0.85rem;
    margin-bottom: 20px;
    opacity: 0.7;
}
.tsl-footer .footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.tsl-footer .footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 1.2rem;
    transition: color 0.2s, transform 0.2s;
}
.tsl-footer .footer-links a:hover {
    color: var(--primary);
    transform: translateY(-2px);
}
.tsl-footer .footer-copy {
    font-size: 0.75rem;
    opacity: 0.5;
    margin-top: 15px;
}

/* === SPONSORS === */
.sponsors-container {
    max-width: 850px;
    margin: 40px auto 50px auto;
    text-align: center;
}
.sponsors-title { font-family: var(--font-display); font-weight: 800; font-style: italic; font-size: 1.8rem; color: var(--text-main); text-transform: uppercase; margin-bottom: 30px; letter-spacing: 1px; }
.sponsors-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 25px; }
.sponsor-card { background: var(--bg-card); border: 1px solid var(--f1-border); border-radius: 15px; padding: 30px; display: flex; flex-direction: column; justify-content: space-between; transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s; }
.sponsor-card:hover { transform: translateY(-7px); border-color: var(--primary); box-shadow: 0 10px 20px rgba(0,0,0,0.15); }
.sponsor-logo-container { height: 70px; display: flex; justify-content: center; align-items: center; margin-bottom: 20px; }
.sponsor-logo { max-height: 100%; max-width: 80%; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2)); }
.sponsor-name { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; font-style: italic; color: var(--text-main); margin: 0 0 10px 0; }
.sponsor-desc { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 20px; line-height: 1.4; }
.sponsor-promo { background: var(--bg-body); border: 2px dashed var(--primary); border-radius: 8px; padding: 15px; margin-bottom: 25px; display: flex; flex-direction: column; gap: 5px; }
.promo-discount { color: var(--primary); font-family: var(--font-display); font-weight: 900; font-size: 1.4rem; text-transform: uppercase; }
.promo-code { color: var(--text-main); font-size: 0.9rem; font-weight: 600; }
.promo-code strong { font-family: var(--font-display); font-size: 1rem; letter-spacing: 1px; background: var(--primary); color: white; padding: 2px 8px; border-radius: 4px; margin-left: 5px; }
.sponsor-btn { display: block; background: transparent; color: var(--text-main); border: 2px solid var(--f1-border); padding: 12px; border-radius: 50px; font-family: var(--font-display); font-weight: 700; text-transform: uppercase; text-decoration: none; transition: 0.3s; }
.sponsor-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }

/* === STATS GRID === */
/* Scoped selectors (MEJ-2) to avoid conflicts with pilot card .stat-value / .stat-label */
.stats-grid {
    display: grid;
    width: 100%;
    margin-bottom: 30px;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}
.stat-card {
    background: var(--bg-body);
    border: 1px solid var(--f1-border);
    border-radius: 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 15px 10px;
    min-height: 110px;
}
.stats-grid .stat-value {
    font-family: var(--font-display);
    font-weight: 900;
    color: var(--primary);
    line-height: 1.1;
    margin-bottom: 5px;
    font-size: 1.6rem;
}
.stats-grid .stat-label {
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    line-height: 1.2;
    font-size: 0.7rem;
}

/* === TYRE PILLS === */
.tyre-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 800;
    color: #000;
    margin-right: 4px;
}
.tyre-s { background-color: #ff3b30; border: 2px solid #ff3b30; color: white; }
.tyre-m { background-color: #ffcc00; border: 2px solid #ffcc00; }
.tyre-h { background-color: #f2f2f7; border: 2px solid #d1d1d6; }
.tyre-i { background-color: #34c759; border: 2px solid #34c759; color: white; }
.tyre-w { background-color: #007aff; border: 2px solid #007aff; color: white; }
.stint-info {
    font-size: 0.8rem;
    margin-right: 8px;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
}

/* === PROJECTIONS/CHARTS === */
.proyecciones-wrapper {
    background: var(--bg-body);
    border: 1px solid var(--f1-border);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
}
.chart-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
    gap: 15px;
}
.chart-title-group h4 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.5rem;
    text-transform: uppercase;
    font-style: italic;
    color: var(--text-main);
}
.chart-controls {
    display: flex;
    gap: 10px;
    background: var(--bg-header);
    padding: 5px;
    border-radius: 50px;
    border: 1px solid var(--f1-border);
}
.btn-chart {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: 40px;
    cursor: pointer;
    font-family: var(--font-display);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    transition: 0.3s;
}
.btn-chart.active { background: var(--primary); color: white; }
.chart-canvas-container {
    position: relative;
    height: 400px;
    width: 100%;
}

/* === PILOT CARD MODAL === */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: fadeInModal 0.3s forwards;
}
@keyframes fadeInModal { to { opacity: 1; } }

.tarjeta-piloto {
    background: var(--bg-card);
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 20px;
    position: relative;
    box-shadow: 0 25px 50px rgba(0,0,0,0.6);
    border: 1px solid var(--f1-border);
    transform: translateY(20px);
    animation: slideUpModal 0.3s forwards ease-out;
}
@keyframes slideUpModal { to { transform: translateY(0); } }

.modal-close {
    position: absolute;
    top: 15px; right: 15px;
    background: rgba(0,0,0,0.3);
    color: white;
    border: none;
    width: 35px; height: 35px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 10;
    transition: 0.2s;
    display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: rgba(0,0,0,0.8); transform: scale(1.1); }

.tp-header {
    height: 140px;
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    padding: 20px 25px;
    position: relative;
}
.tp-logo-minimal {
    height: 45px;
    opacity: 0.9;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    z-index: 2;
}
.tp-foto-container {
    position: absolute;
    top: 70px;
    left: 35px;
    display: flex;
    align-items: flex-end;
    gap: 15px;
}
.tp-foto {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    object-fit: cover;
    border: 6px solid var(--bg-card);
    background: var(--bg-card);
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}
.tp-bandera-minimal {
    width: 40px;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    margin-bottom: 20px;
}
.tp-body { padding: 80px 35px 40px 35px; }
.tp-body h2 {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0;
    line-height: 1;
    text-transform: uppercase;
    color: var(--text-main);
    border: none;
    padding: 0;
}
.tp-equipo-tag {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
    margin-top: 5px;
}
.tarjeta-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 40px;
}
.stat-box {
    border-top: 2px solid var(--f1-border);
    padding: 15px 0 0 0;
    text-align: left;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
}
body.light-mode .stat-box { background: transparent; }

/* Scoped selectors for pilot card stats (MEJ-2) */
.tarjeta-stats .stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 5px;
    display: block;
}
.tarjeta-stats .stat-value {
    font-size: 2.5rem;
    font-family: var(--font-display);
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
    display: block;
}

/* Clickable pilot rows */
.fila-piloto { cursor: pointer; transition: all 0.2s ease; }
.fila-piloto:hover { background-color: rgba(255, 255, 255, 0.08); transform: translateX(5px); }
body.light-mode .fila-piloto:hover { background-color: rgba(0, 0, 0, 0.05); }

/* Scroll lock for modal */
body.no-scroll { overflow: hidden !important; }

/* === COMPARATOR === */
.tarjeta-piloto.comparar-mode {
    max-width: 900px;
    width: 95%;
    display: flex;
    flex-direction: column;
}
.comparison-container {
    display: flex;
    width: 100%;
    border-bottom: 1px solid var(--f1-border);
}
.comparison-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}
.comparison-col:first-child { border-right: 1px solid var(--f1-border); }
.comparison-col .tp-header { height: 100px; }
.comparison-col .tp-foto-container { top: 40px; left: 20px; }
.comparison-col .tp-foto { width: 90px; height: 90px; border-width: 4px; }
.comparison-col .tp-body { padding: 45px 20px 20px 20px; }
.comparison-col .tp-body h2 {
    font-size: 1.6rem;
    font-family: var(--font-display);
    font-weight: 800;
    margin: 0;
    line-height: 1;
    text-transform: uppercase;
    color: var(--text-main);
    border: none;
    padding: 0;
}
.comparison-col .tp-equipo-tag {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
    margin-top: 5px;
}
.comparison-col .tp-achievements {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: flex-start;
}
.comparison-col .tp-badge { padding: 4px 8px; font-size: 0.65rem; border-radius: 12px; }
.comparison-stats-table-wrapper { padding: 20px; background: var(--bg-card); }
.comparison-stats-table { width: 100%; border-collapse: collapse; }
.comparison-stats-table th {
    font-family: var(--font-display);
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    padding: 10px;
    border-bottom: 2px solid var(--f1-border);
    text-align: center;
}
.comparison-stats-table td {
    padding: 12px 10px;
    text-align: center;
    border-bottom: 1px solid var(--f1-border);
    font-size: 0.95rem;
    vertical-align: middle;
    color: var(--text-main);
}
.comparison-stats-table tr:last-child td { border-bottom: none; }
.comparison-label {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.8rem;
}
.comparison-val-col {
    width: 35%;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.2rem;
}
.comparison-val-col.winner-val { color: var(--primary); background: rgba(230, 0, 0, 0.05); }
body.light-mode .comparison-val-col.winner-val { background: rgba(230, 0, 0, 0.03); }
.win-badge { color: gold; margin: 0 4px; font-size: 0.85rem; }
.tp-comparar-select {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-body);
    border: 1px solid var(--f1-border);
    border-radius: 6px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    margin-top: 10px;
    cursor: pointer;
}
.btn-comparar-toggle {
    position: absolute;
    bottom: 25px;
    right: 35px;
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-family: var(--font-display);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    cursor: pointer;
    transition: 0.2s;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 10px rgba(230,0,0,0.3);
}
.btn-comparar-toggle:hover { background: #b30000; transform: translateY(-1px); }

/* === ANIMATIONS === */
@keyframes slideUpFade { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulseGreen { 0% { filter: drop-shadow(0 0 0 rgba(52, 199, 89, 0)); } 50% { filter: drop-shadow(0 0 4px rgba(52, 199, 89, 0.8)); } 100% { filter: drop-shadow(0 0 0 rgba(52, 199, 89, 0)); } }
@keyframes pulseRed { 0% { filter: drop-shadow(0 0 0 rgba(255, 59, 48, 0)); } 50% { filter: drop-shadow(0 0 4px rgba(255, 59, 48, 0.8)); } 100% { filter: drop-shadow(0 0 0 rgba(255, 59, 48, 0)); } }

.pos-change { display: inline-block; width: 25px; text-align: center; font-size: 0.85rem; font-weight: 700; margin-right: 5px; }
.pos-up { color: #34c759; animation: pulseGreen 2s infinite; }
.pos-down { color: #ff3b30; animation: pulseRed 2s infinite; }
.pos-same { color: var(--text-muted); opacity: 0.5; }

/* Cascading row animation */
.f1-table tbody tr { animation: slideUpFade 0.4s ease-out forwards; opacity: 0; }
.f1-table tbody tr:nth-child(1) { animation-delay: 0.05s; }
.f1-table tbody tr:nth-child(2) { animation-delay: 0.10s; }
.f1-table tbody tr:nth-child(3) { animation-delay: 0.15s; }
.f1-table tbody tr:nth-child(4) { animation-delay: 0.20s; }
.f1-table tbody tr:nth-child(5) { animation-delay: 0.25s; }
.f1-table tbody tr:nth-child(6) { animation-delay: 0.30s; }
.f1-table tbody tr:nth-child(7) { animation-delay: 0.35s; }
.f1-table tbody tr:nth-child(8) { animation-delay: 0.40s; }
.f1-table tbody tr:nth-child(9) { animation-delay: 0.45s; }
.f1-table tbody tr:nth-child(10) { animation-delay: 0.50s; }
.f1-table tbody tr:nth-child(n+11) { animation-delay: 0.55s; }

/* === BADGES === */
.tp-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 0.72rem;
    text-transform: uppercase;
    border: 1px solid transparent;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    animation: fadeIn 0.3s ease;
}
.badge-champion { background: rgba(255, 215, 0, 0.15); border-color: #ffd700; color: #ffd700; }
.badge-podium { background: rgba(192, 192, 192, 0.15); border-color: #c0c0c0; color: #e4e4e7; }
.badge-consistent { background: rgba(52, 199, 89, 0.15); border-color: #34c759; color: #30d158; }
.badge-defender { background: rgba(90, 200, 250, 0.15); border-color: #5ac8fa; color: #64d2ff; }
.badge-speed { background: rgba(177, 6, 205, 0.15); border-color: #b106cd; color: #d946ef; }
.badge-reserve { background: rgba(230, 0, 0, 0.15); border-color: var(--primary); color: #ff4545; }
.row-top-consistency { background-color: rgba(48, 209, 88, 0.08) !important; }
body.light-mode .row-top-consistency { background-color: rgba(52, 199, 89, 0.12) !important; }

/* === PILOTO DE LA SEMANA === */
.potw-card {
    background: linear-gradient(135deg, rgba(230, 0, 0, 0.08) 0%, var(--bg-card) 50%);
    border: 1px solid rgba(230, 0, 0, 0.2);
    border-radius: 15px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    animation: fadeIn 0.5s ease;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}
.potw-card .potw-photo {
    width: 70px; height: 70px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
    box-shadow: 0 4px 15px rgba(230, 0, 0, 0.3);
}
.potw-card .potw-info { flex: 1; }
.potw-card .potw-label {
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 4px;
}
.potw-card .potw-name {
    font-family: var(--font-display);
    font-weight: 800;
    font-style: italic;
    font-size: 1.4rem;
    text-transform: uppercase;
    color: var(--text-main);
}
.potw-card .potw-stat {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* === SEASON SELECTOR SIDEBAR === */
.season-selector-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    height: 100vh;
    z-index: 2000;
    background: rgba(20, 20, 22, 0.85);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--f1-border);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    padding: 30px 20px;
    box-sizing: border-box;
}

body.light-mode .season-selector-sidebar {
    background: rgba(255, 255, 255, 0.9);
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
}

.season-selector-sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 15px;
}

.sidebar-header h3 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 800;
    font-style: italic;
    text-transform: uppercase;
    color: var(--text-main);
}

.btn-close-sidebar {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s, transform 0.2s;
}

.btn-close-sidebar:hover {
    color: var(--primary);
    transform: scale(1.1);
}

.season-selector-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.season-selector-content .btn-season {
    width: 100%;
    text-align: left;
    padding: 12px 18px;
    font-size: 0.9rem;
    margin: 0;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.btn-season-toggle:hover {
    background-color: #ff1a1a !important;
    transform: scale(1.03);
}

.btn-season-toggle:active {
    transform: scale(0.97);
}

/* === SKELETON LOADERS === */
@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, rgba(255,255,255,0.08) 50%, var(--bg-card) 75%);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
}
.skeleton-row { height: 50px; margin-bottom: 8px; }
.skeleton-title { height: 30px; width: 60%; margin-bottom: 20px; }
body.light-mode .skeleton {
    background: linear-gradient(90deg, #e5e5e5 25%, #f5f5f5 50%, #e5e5e5 75%);
    background-size: 200px 100%;
}

/* === SCROLL INDICATOR === */
.f1-table-container::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 40px; height: 100%;
    background: linear-gradient(to left, var(--bg-card), transparent);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}
.f1-table-container.show-scroll-hint::after { opacity: 1; }

/* === NOTIFICATION BUTTON === */
.btn-notify {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--f1-border);
    border-radius: 20px;
    color: var(--text-muted);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    cursor: pointer;
    transition: 0.2s;
    margin-left: 10px;
}
.btn-notify:hover { border-color: var(--primary); color: var(--primary); }
.btn-notify.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* === ICS BUTTON === */
.btn-ics {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: transparent;
    border: 1px solid var(--f1-border);
    border-radius: 6px;
    color: var(--text-muted);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    cursor: pointer;
    transition: 0.2s;
    text-decoration: none;
}
.btn-ics:hover { border-color: var(--primary); color: var(--primary); }

/* === MOBILE BOTTOM NAV === */
/* BUG-8 FIX: Moved from inline <style> in body to this stylesheet */
.mobile-bottom-nav { display: none; }

/* === RESPONSIVE (Mobile ≤768px) === */
@media (max-width: 768px) {

    /* 1. Header & Navigation */
    header {
        padding: 10px 15px;
        position: sticky;
        top: 0;
        z-index: 1000;
        border-bottom: none;
        box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    }
    nav.main-nav { display: none; }
    .logo-area { gap: 10px; }
    .logo-img { height: 40px; }
    header h1 {
        font-size: 1.4rem !important;
        letter-spacing: 0.5px;
        line-height: 1.1;
        white-space: nowrap;
    }
    .header-right { display: flex !important; }
    .social-icons-header { display: none !important; }

    /* 2. Hero Section Compacta */
    .hero-section {
        display: flex;
        flex-direction: column;
        padding: 40px 20px;
        border-radius: 25px;
        margin-top: 15px;
        margin-bottom: 20px;
        background-position: center;
        align-items: center;
    }
    .hero-content h2 {
        font-size: 3.5rem !important;
        line-height: 0.9;
    }
    .hero-content p.subtitle { font-size: 1rem; margin-bottom: 25px; }
    .hero-buttons { flex-direction: column; width: 100%; }
    .hero-btn {
        width: 90%;
        padding: 10px 10px !important;
        font-size: 0.85rem !important;
    }

    /* 3. Cards & Tables */
    .card { padding: 20px 15px; border-radius: 12px; margin-bottom: 15px; }
    h2 { font-size: 1.6rem; margin-bottom: 20px; }
    .f1-title {
        font-size: 1.3rem !important;
        white-space: normal !important;
        text-align: center;
        line-height: 1.2;
    }
    .tabla-calendario th, .tabla-calendario td {
        padding: 8px 3px !important;
        font-size: 0.7rem !important;
    }
    .gp-container { gap: 8px; }
    .img-flag { width: 32px !important; }
    .sprint-tag {
        font-size: 0.6em !important;
        padding: 1px 3px;
        display: inline-block;
    }
    .f1-table th, .f1-table td {
        padding: 12px 8px;
        font-size: 0.85rem;
    }
    .f1-pos { font-size: 1rem; width: 30px; }
    .team-line { height: 15px; width: 3px; margin-right: 6px; }
    .f1-team-name {
        display: block;
        font-size: 0.7rem;
        margin-left: 0;
        margin-top: 2px;
    }
    .f1-table-container {
        padding: 10px 5px;
        margin: 0 -10px;
        border-radius: 8px;
        background: var(--bg-card);
    }

    /* 4. Charts */
    .chart-canvas-container { height: 360px !important; }
    .chart-header-row { flex-direction: column; align-items: flex-start; gap: 10px; }
    .chart-controls { width: 100%; justify-content: space-between; }
    .btn-chart { flex: 1; padding: 10px 0; font-size: 0.75rem; text-align: center; }

    /* 5. Next Race Card */
    .next-race-card {
        width: 100%;
        padding: 25px;
        margin-top: 20px;
        border-radius: 25px;
    }
    .quick-link-card { border-radius: 25px; }

    /* 6. Tabs (Stacked / Multi-line) */
    .tabs-control, .sub-nav {
        justify-content: center;
        flex-wrap: wrap;
        overflow-x: visible;
        padding-bottom: 10px;
        gap: 10px;
    }
    .btn-control, .btn-sub {
        flex: 1 1 auto;
        min-width: 120px;
        padding: 10px 15px;
        font-size: 0.85rem;
        text-align: center;
    }

    /* 7. Team Grid */
    .grid-teams { justify-content: center; }
    .team-card-grid { max-width: 100%; margin-bottom: 15px; }

    /* 8. Pilot Card Modal (smaller on mobile) */
    /* 8. Pilot Card Modal (Rediseño Estructural UI/UX Mobile-First) */
    .modal-overlay {
        align-items: center !important;
        justify-content: center !important;
        padding: 10px !important;
    }
    .tarjeta-piloto { 
        width: 90% !important; 
        max-height: 85vh !important; 
        overflow-y: auto !important;
        display: flex !important;
        flex-direction: column !important;
        border-radius: 16px !important;
    }
    #tp-individual-view {
        display: flex !important;
        flex-direction: column !important;
        position: relative !important;
    }
    .tp-header { 
        position: relative !important;
        height: 50px !important; 
        padding: 12px 15px !important; 
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        border-bottom: 1px solid var(--f1-border) !important;
    }
    .tp-logo-minimal { 
        height: 35px !important; 
        position: static !important;
    }
    .btn-comparar-toggle {
        position: absolute !important;
        top: 12px !important;
        left: 15px !important;
        bottom: auto !important;
        right: auto !important;
        margin: 0 !important;
        z-index: 2 !important;
    }
    .tarjeta-piloto .modal-close {
        position: absolute !important;
        top: 12px !important;
        right: 15px !important;
        left: auto !important;
        bottom: auto !important;
        margin: 0 !important;
        z-index: 10 !important;
    }
    .tp-foto-container { 
        position: static !important; 
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        margin: 20px auto 10px auto !important;
        gap: 15px !important;
    }
    .tp-foto { 
        width: 110px !important; 
        height: 110px !important; 
        border-width: 4px !important;
        position: static !important;
    }
    .tp-bandera-minimal { 
        width: 32px !important; 
        margin-bottom: 0 !important; 
        position: static !important;
    }
    .tp-body { 
        padding: 15px 20px 25px 20px !important; 
        text-align: center !important;
    }
    .tp-body h2 { 
        font-size: 2.1rem !important; 
        text-align: center !important;
    }
    .tp-equipo-tag {
        text-align: center !important;
    }
    .tp-achievements {
        justify-content: center !important;
    }
    .tarjeta-stats { 
        gap: 20px !important; 
        margin-top: 25px !important; 
    }
    .tarjeta-stats .stat-value { 
        font-size: 2.1rem !important; 
    }
    #tp-tsl { 
        font-size: 2.6rem !important; 
    }
    .modal-swipe-handle { 
        display: block !important; 
        background: rgba(255, 255, 255, 0.4) !important;
        margin: 12px auto 0 auto !important;
    }

    /* 9. Comparator (mobile UI/UX) */
    .tarjeta-piloto.comparar-mode { 
        width: 95% !important; 
        max-height: 90vh !important; 
    }
    .comparison-container { 
        flex-direction: column !important; 
    }
    .comparison-col {
        position: relative !important;
        display: flex !important;
        flex-direction: column !important;
    }
    .comparison-col:first-child { 
        border-right: none !important; 
        border-bottom: 1px solid var(--f1-border) !important; 
        padding-bottom: 20px !important;
    }
    .comparison-col .tp-header {
        position: relative !important;
        height: 50px !important;
        padding: 12px 15px !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        border-bottom: 1px solid var(--f1-border) !important;
    }
    .comparison-col .btn-comparar-toggle {
        position: absolute !important;
        top: 12px !important;
        left: 15px !important;
        right: auto !important;
        bottom: auto !important;
        margin: 0 !important;
        z-index: 2 !important;
    }
    .comparison-col .tp-foto-container { 
        position: static !important; 
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        margin: 15px auto 10px auto !important;
        gap: 12px !important;
    }
    .comparison-col .tp-foto {
        width: 85px !important;
        height: 85px !important;
        border-width: 3px !important;
    }
    .comparison-col .tp-body { 
        padding: 15px !important; 
        text-align: center !important;
    }
    .comparison-col .tp-body h2 {
        text-align: center !important;
    }
    .comparison-col .tp-body .tp-equipo-tag {
        text-align: center !important;
    }
    .comparison-stats-table-wrapper { 
        padding: 10px !important; 
    }
    .comparison-stats-table td { 
        padding: 8px 5px !important; 
        font-size: 0.85rem !important; 
    }
    .comparison-val-col { 
        font-size: 1rem !important; 
    }

    /* 10. Mobile Bottom Nav (BUG-8) */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0; left: 0;
        width: 100%; height: 65px;
        background: var(--bg-header);
        border-top: 1px solid var(--f1-border);
        justify-content: space-around;
        align-items: center;
        z-index: 9999;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
        padding-bottom: env(safe-area-inset-bottom);
    }
    .nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: var(--text-muted);
        font-family: var(--font-display);
        font-size: 0.65rem;
        flex: 1;
        height: 100%;
        transition: 0.2s;
        min-width: 0;
        padding: 5px 0;
    }
    .nav-item i { font-size: 1.2rem; margin-bottom: 4px; }
    .nav-item.active { color: var(--primary); }
    .nav-item.active i { transform: translateY(-2px); }

    /* 11. Active states for mobile touch */
    .fila-piloto:active { background-color: rgba(230, 0, 0, 0.08) !important; }
    .clickable-row:active { background-color: rgba(230, 0, 0, 0.08) !important; }
    .quick-link-card:active { transform: scale(0.97); }
    .social-card:active { transform: scale(0.97); }

    /* 12. POTW card (mobile) */
    .potw-card { padding: 18px; gap: 15px; }
    .potw-card .potw-photo { width: 55px; height: 55px; }
    .potw-card .potw-name { font-size: 1.1rem; }

    /* 13. Footer spacing for bottom nav */
    .tsl-footer { margin-bottom: 65px; }

    /* Body bottom padding for bottom nav */
    body { padding-bottom: 80px; }
}

/* === RESPONSIVE (Desktop ≥992px) === */
@media (min-width: 992px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 30px;
    }
    .stat-card {
        min-height: 180px;
        padding: 30px 20px;
        border: 2px solid var(--f1-border);
    }
    .stats-grid .stat-value {
        font-size: 3rem;
        margin-bottom: 10px;
    }
    .stats-grid .stat-label {
        font-size: 0.95rem;
        letter-spacing: 1px;
    }
}

/* === HARDWARE ACCELERATION === */
.chart-canvas-container canvas {
    transform: translate3d(0, 0, 0);
    will-change: transform;
}
/* BUG-5 FIX: Changed will-change: scroll to will-change: scroll-position */
.f1-table-container {
    will-change: scroll-position;
}
