/* -------- Modern Theme Layer (added) -------- */
:root {
    --bg: #0d1116; --bg-alt:#151b22; --surface:#1d252d; --surface-alt:#242f38;
    --text:#e5ecf1; --text-dim:#92a0ac; --accent:#ff2d55; --accent-alt:#ff8a00;
    --border:#2d3943; --border-strong:#3b4954; --radius-sm:6px; --radius-md:12px; --radius-lg:20px;
    --gradient-accent:linear-gradient(135deg,var(--accent),var(--accent-alt));
    /* New subtle neutral highlight gradient for light text */
    --gradient-neutral:linear-gradient(135deg,rgba(255,255,255,.98) 0%,rgba(238,244,248,.95) 35%,rgba(200,215,225,.92) 75%,rgba(180,198,210,.9) 100%);
    --shadow-1:0 4px 12px -2px rgba(0,0,0,.5),0 1px 0 rgba(255,255,255,.04) inset;
    --shadow-2:0 10px 28px -6px rgba(0,0,0,.65),0 2px 0 rgba(255,255,255,.05) inset;
}
body { margin:0; font-family:'Oswald',sans-serif; font-size:16px; line-height:1.55; background:
    radial-gradient(circle at 18% 18%, rgba(255,45,85,.18), transparent 60%),
    radial-gradient(circle at 82% 72%, rgba(255,138,0,.18), transparent 65%),
    var(--bg); color:var(--text); padding-bottom:90px; }

h1,h2,p{margin:0 0 1em 0;}
h1{font-size:clamp(2.2rem,5vw,2.9rem);font-weight:700;letter-spacing:.5px;background:var(--gradient-accent);-webkit-background-clip:text;background-clip:text;color:transparent;}
h2{font-size:.9rem;letter-spacing:2px;font-weight:800;background:var(--gradient-neutral);-webkit-background-clip:text;background-clip:text;color:transparent;margin-bottom:1.2em;text-transform:uppercase;position:relative;filter:drop-shadow(0 1px 2px rgba(0,0,0,.55));}
h2:after{content:"";position:absolute;left:0;bottom:-6px;width:54px;height:3px;background:var(--gradient-accent);border-radius:2px;}
/* Center only the underline under the NEXT RACE h2 */
.next-race h2:after{left:50%;transform:translateX(-50%);} 

/* Utility: apply neutral gradient to any text */
.text-gradient-neutral{background:var(--gradient-neutral);-webkit-background-clip:text;background-clip:text;color:transparent;}

/* --- Mobile tuning for standings & last race list --- */
@media (max-width:600px){
    .last-winner li,.driver-standings li{font-size:.75rem;gap:.25em;padding:.40em 0;}
    .driver-standings .position,.last-winner .position{width:18px;}
    .team-color-box{margin-right:3px;width:11px;height:11px;}
    .driver-standings .points,.last-winner .points{font-size:.66rem;letter-spacing:.3px;}
    .last-winner li span.name,.driver-standings li span.name{margin-right:.25em;}
    .last-winner li span.name.driver-only,.driver-standings li span.name{font-size:.95rem;font-weight:700;}
    .last-winner li.compact-result{gap:.3em;}
}

/* Desktop slight reduction too */
.last-winner li span.name.driver-only,.driver-standings li span.name{font-size:1.05rem;font-weight:700;letter-spacing:.3px;}

.container{max-width:880px;margin:2.4em auto;padding:2.3em clamp(1.2em,3vw,2.5em);background:linear-gradient(145deg,#1d252d,#12171c);border:1px solid var(--border);border-radius:var(--radius-lg);box-shadow:var(--shadow-2);}
.section{margin-bottom:2.6em;position:relative;background:linear-gradient(145deg,#212a33,#14191e);border:1px solid var(--border);border-radius:var(--radius-md);padding:1.4em 1.5em 1.6em;box-shadow:var(--shadow-1);transition:transform .25s ease,box-shadow .25s ease,border-color .18s ease;}
.section.clickable:hover{transform:translateY(-4px);box-shadow:var(--shadow-2);border-color:var(--border-strong);}
.next-race{text-align:center;}
p#next-race-date-simple{font-size:1.05rem;color:var(--text-dim);margin-bottom:.6em;font-weight:500;}
.flag-separator{display:flex;align-items:center;justify-content:center;margin:.55em auto .9em;width:75%;}
.flag-separator::before,.flag-separator::after{content:"";flex-grow:1;height:1px;background:linear-gradient(90deg,rgba(255,255,255,.25),rgba(255,255,255,0));}
.flag-separator .flag-icon{font-size:1.6rem;margin:0 12px;line-height:1;filter:drop-shadow(0 2px 4px rgba(0,0,0,.35));}
.next-race p#next-race-countdown{font-size:1.55rem;font-weight:700;margin-top:.25em;background:var(--gradient-neutral);-webkit-background-clip:text;background-clip:text;color:transparent;letter-spacing:.5px;text-shadow:0 3px 6px rgba(0,0,0,.55);} 
.team-color-box{width:14px;height:14px;border-radius:3px;border:1px solid rgba(255,255,255,.12);box-shadow:0 0 0 1px rgba(0,0,0,.45) inset;}
.last-winner li,.driver-standings li{display:flex;align-items:center;gap:.6em;padding:.65em 0;border-bottom:1px solid var(--border);font-size:.95rem;}
.driver-standings .points,.last-winner .points{color:var(--accent-alt);font-weight:700;font-size:.8rem;letter-spacing:.5px;}
/* Click affordances for clickable sections */
.section.clickable ol li{cursor:pointer;transition:background .18s ease,transform .18s ease;position:relative;border-radius:6px;padding-left:.4em;padding-right:.4em;margin:0 -0.4em;}
.section.clickable ol li:after{content:"";position:absolute;inset:0;border:1px solid rgba(255,255,255,0);border-radius:6px;transition:border-color .25s ease;}
.section.clickable ol li:hover{background:rgba(255,255,255,.05);}
.section.clickable ol li:hover:after{border-color:rgba(255,255,255,.08);} 
.section.clickable ol li:active{background:rgba(255,255,255,.08);transform:translateY(1px);} 
.clickable-footer-link{display:inline-block;margin-top:.55em;font-size:.63rem;letter-spacing:1.2px;text-transform:uppercase;font-weight:700;color:var(--accent-alt);text-decoration:none;opacity:.75;transition:color .25s ease,opacity .25s ease,transform .25s ease;background:linear-gradient(90deg,var(--accent),var(--accent-alt));-webkit-background-clip:text;background-clip:text;color:transparent;}
.clickable-footer-link:hover{opacity:1;transform:translateY(-1px);} 
.clickable-footer-link:focus-visible{outline:2px solid var(--accent-alt);outline-offset:2px;} 
/* -------- End Modern Theme Layer (added) -------- */

h1, h2, p {
    margin: 0 0 1em 0; /* Basic spacing */
}

/* Effective mobile padding reduction (placed after desktop rules so it wins) */
@media (max-width:600px){
    .container{padding:1.0em .55em 1.35em; margin:1.2em auto;}
    .section{padding:1.0em .60em 1.15em;}
}

/* (Original legacy styles retained below for reference; many overridden above) */

/* Legacy h2 block removed (replaced by themed variant above) */

.container {
    max-width: 800px;
    margin: 2em auto;
    padding: 2em;
    background-color: #ffffff; /* White content background */
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border-radius: 8px;
}

/* Final small-screen override: ensure narrow padding not overridden by earlier 768px rule */
@media (max-width:600px){
    .container{padding:1.0em .55em 1.1em !important; margin:1.0em auto !important;}
    .section{padding:.65em .60em .75em !important;}
}

/* Compressed vertical rhythm (approx 50% reduction) */
.section{margin-bottom:1.3em !important;padding:.75em 1.35em .85em;}

.section {
    margin-bottom: 2.5em;
}

/* Next Race Section */
.next-race {
    text-align: center; /* Center align content */
}

.next-race h1 {
    margin-bottom: 0.2em;
}

/* Style for the simple date above the clock */
p#next-race-date-simple {
    font-size: 1.25rem; /* Slightly reduced for balance */
    color: var(--text-dim);
    font-weight: 500;
    text-align: center;
    margin-bottom: 0.6em;
    letter-spacing:.5px;
}

/* Style for the flag separator */
.flag-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.8em;
    width: 80%; /* Adjust width as needed */
    margin-left: auto;
    margin-right: auto;
}

.flag-separator::before,
.flag-separator::after {
    content: '';
    flex-grow: 1;
    height: 1px;
    background-color: #ccc; /* Line color */
}

.flag-separator .flag-icon {
    font-size: 1.8rem; /* Adjust flag size */
    margin: 0 10px; /* Space around the flag */
    line-height: 1; /* Ensure flag aligns well */
}

/* Legacy countdown style removed; themed gradient version defined earlier */

/* Team Color Box */
.team-color-box {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px; /* Slightly rounded square */
    margin-right: 8px;
    vertical-align: middle; /* Align with text */
    border: 1px solid rgba(0,0,0,0.1); /* Subtle border, especially for white teams like Haas */
}

/* Last Winner Section - Now Top 3 List */
.last-winner ol {
    /* Reuse standings list styling */
    list-style: none;
    padding: 0;
    margin: 0;
}

.last-winner li {
    /* Reuse standings item styling */
    display: flex;
    align-items: center;
    padding: 0.8em 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 1.1rem;
}

.last-winner li:last-child {
    border-bottom: none;
}

/* Reuse position, name, team, points styles from driver standings */
.last-winner .position { width: 30px; font-weight: 700; color: #888; flex-shrink: 0; }
.last-winner .team-color-box { /* Reuse from driver standings */ vertical-align: middle; margin-right: 8px; width: 12px; height: 12px; border-radius: 3px; border: 1px solid rgba(0,0,0,0.1); }
.last-winner .name { font-weight: 700; margin-right: 0.5em; }
.last-winner .team-name { color: #666; font-size: 0.9em; flex-grow: 1; margin-right: 1em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.last-winner .points { font-weight: 700; color: var(--text-dim); font-size: 0.9em; flex-shrink: 0; }

/* Driver Standings Section */
.driver-standings ol {
    list-style: none;
    padding: 0;
    margin: 0;
}

.driver-standings li {
    display: flex;
    align-items: center;
    padding: 0.8em 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 1.1rem;
}

.driver-standings li:last-child {
    border-bottom: none;
}

.driver-standings .position {
    font-weight: 700;
    width: 30px;
    color: #888;
    flex-shrink: 0;
}

.driver-standings .name { font-weight:700; margin-right:0.5em; }

/* Added styles for team name */
.driver-standings .team-name {
    color: #666;
    font-size: 0.9em;
    flex-grow: 1; /* Allow team name to fill space */
    margin-right: 1em; /* Space before points */
    /* Optional: control wrapping */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.driver-standings .points {
    font-weight: 700;
    color: var(--text-dim);
    font-size: 0.9em;
    flex-shrink: 0;
}

/* Points Chart Section */
.points-chart .chart-container {
    position: relative;
    height: 300px;
    width: 100%;
    margin-bottom: 1em; /* Add space below chart */
}

/* Custom Chart Legend Styles */
.chart-legend-container {
    display: flex;
    flex-direction: column; /* Stack items vertically */
    align-items: flex-start; /* Align items to the start */
    gap: 0.5em; /* Space between legend items */
}

.legend-item {
    display: flex;
    align-items: center;
    cursor: default; /* Or pointer if you add interaction */
}

.legend-color-box {
    display: inline-block;
    width: 16px; /* Slightly larger box */
    height: 16px;
    margin-right: 8px;
    border: 1px solid rgba(0,0,0,0.1);
    /* Removed border-radius for square look, add back if desired */
}

.legend-label {
    font-size: 1rem; /* Adjust size */
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        margin: 1em;
        padding: 1.5em;
    }

    h1 {
        font-size: 2.2rem;
    }

    .next-race p {
        font-size: 1.4rem;
    }

    .winner-card {
        font-size: 1.1rem;
        align-items: flex-start; /* Keep alignment for potential wrapping */
    }

    .winner-card .winner-team {
        margin-top: 0;
        font-size: 0.85em;
    }

    /* removed empty .driver-standings .name block */

    .team-color-box {
        width: 10px;
        height: 10px;
        margin-right: 6px;
    }
}

/* Make sections look clickable */
.clickable {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.clickable:hover {
    background-color: #f9f9f9; /* Subtle hover effect */
}

/* Styles for Detail Pages */
.page-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, rgba(18,29,41,.92), rgba(8,14,20,.92));
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border-top: 1px solid rgba(255,255,255,.08);
    padding: 0.75em 1.2em;
    box-shadow: 0 -4px 14px rgba(0,0,0,0.35),0 0 0 1px rgba(255,255,255,0.02) inset;
    z-index: 100;
}

/* Remove specific back-link style */
/* .back-link {
    margin-right: 1em;
} */

/* Style anchor tags with .nav-button class */
a.nav-button {
    text-decoration: none; /* Remove underline from link */
    display: inline-block; /* Allow padding etc. like a button */
}

/* Add a class to target the back button specifically if needed */
/* .back-button specific styles can be added here when needed */

.race-nav-buttons {
    display: flex;
    gap: 0.5em;
}

.nav-button {
    padding: .55em 1.05em;
    font-size: .85rem;
    font-weight: 700;
    letter-spacing:.5px;
    background: linear-gradient(145deg,var(--accent) 0%,var(--accent-alt) 90%);
    color: #fff;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    isolation:isolate;
    box-shadow: 0 4px 12px -2px rgba(0,0,0,.5),0 0 0 1px rgba(255,255,255,.06) inset;
    transition: background .35s ease, transform .25s ease, box-shadow .35s ease;
}
.nav-button::after{
    content:"";
    position:absolute;inset:0;
    background: radial-gradient(circle at 30% 20%,rgba(255,255,255,.35),rgba(255,255,255,0) 65%);
    mix-blend-mode: overlay;
    opacity:.35;pointer-events:none;
    transition:opacity .35s;
}
.nav-button:hover:not(:disabled):not([href]),
a.nav-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px -4px rgba(0,0,0,.65),0 0 0 1px rgba(255,255,255,.12) inset;
}
.nav-button:active{
    transform:translateY(0);
    box-shadow:0 3px 10px -2px rgba(0,0,0,.6),0 0 0 1px rgba(255,255,255,.08) inset;
}

.nav-button:hover:not(:disabled):not([href]),
a.nav-button:hover {
    color:#fff;
}

.nav-button:disabled {
    background: linear-gradient(145deg,#353d46,#252d35);
    color: #79828b;
    cursor: not-allowed;
    border-color: rgba(255,255,255,.05);
    box-shadow: none;
}

/* Style for completed schedule items */
.completed-session {
    opacity: 0.6;
}

.completed-session .schedule-item-name,
.completed-session .schedule-item-datetime {
    color: #777; /* Grey out text */
    /* Optional: line-through? */
    /* text-decoration: line-through; */
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding-bottom: 100px;
    }
    .page-navigation {
        padding: 0.5em 1em;
        flex-direction: column;
        align-items: stretch; /* Stretch items to full width */
        gap: 0.5em;
    }
    /* Ensure buttons/link take full width and center text */
    .page-navigation > a.nav-button,
    .page-navigation .race-nav-buttons {
         width: 100%;
         box-sizing: border-box; /* Include padding/border in width */
    }
    .page-navigation > a.nav-button {
        text-align: center; /* Center text for the back button */
    }
    .race-nav-buttons {
        /* Keep space-between for Prev/Next */
        justify-content: space-between;
    }
    .nav-button {
        flex-grow: 1; /* Allow buttons to grow */
        text-align: center;
    }
    /* ... other responsive styles ... */
}

.race-details-header p {
    font-size: 1.05rem;
    color: var(--text-dim);
    font-weight: 500;
    letter-spacing:.3px;
}

.race-countdown p {
     font-size: 1.2rem;
     margin-bottom: 0.5em;
}

#race-detail-countdown {
    font-size: 1.5rem;
    font-weight: 700;
}

.race-schedule .schedule-item {
    display: flex;
    justify-content: space-between;
    padding: 0.6em 0;
    border-bottom: 1px solid #f0f0f0;
}

.schedule-item .schedule-item-name {
    font-weight: 700;
    font-size: 1.05rem;
}

.schedule-item .schedule-item-datetime {
    color: var(--text-dim);
    font-size: 1rem;
}

.race-info .info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); /* Responsive grid */
    gap: 1.5em;
}

.info-item {
    background-color: #f9f9f9;
    padding: 1em;
    border-radius: 4px;
}

.info-item .info-label {
    display: block;
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 0.4em;
    font-weight: 700;
}

.info-item .info-value {
    font-size: 1.1rem;
    font-weight: 500;
}

/* Use standings list styles for previous results */
.previous-results ol {
    list-style: none;
    padding: 0;
    margin: 0;
}
.previous-results li {
    display: flex;
    align-items: center;
    padding: 0.8em 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 1.1rem;
}
.previous-results li:last-child {
    border-bottom: none;
}
/* Reuse position, name, points styles from main standings */
.previous-results .position { width: 30px; font-weight: 700; color: #888; flex-shrink: 0; }
.previous-results .name { flex-grow: 1; font-weight: 700; }
.previous-results .points { font-weight: 700; color: var(--text-dim); font-size: 0.9em; margin-left: 1em; flex-shrink: 0; }

/* Styles for Full Standings Page */
.full-standings ol {
    list-style: none;
    padding: 0;
    margin: 0;
}

.full-standings li {
    display: flex;
    align-items: center;
    gap: .55em;
    padding: 0.65em 0 .65em .15em;
    border-bottom: 1px solid #f0f0f0;
    font-size: 1.02rem;
}

.full-standings li:last-child {
    border-bottom: none;
}

/* Add style for team name */
.full-standings .team-name {
    color: #666;
    font-size: 0.9em;
    margin-left: 1em;
    flex-grow: 1; /* Allow team name to take space */
}

/* Reuse existing styles where possible */
.full-standings .position { width: 30px; font-weight: 700; color: #888; flex-shrink: 0; }
.full-standings .name { font-weight: 700; margin-right: .35em; flex-grow:1; min-width:0; }
.full-standings .points { font-weight: 700; color: var(--text-dim); font-size: 0.85rem; margin-left: auto; flex-shrink: 0; text-align:right; min-width:58px; letter-spacing:.5px; font-variant-numeric:tabular-nums; }

/* Desktop refinement for full standings spacing */
@media (min-width: 700px){
    .full-standings li{padding:.48em 0 .50em .05em;gap:.4em;font-size:.95rem;}
    .full-standings .position{width:26px;}
    .full-standings .team-color-box{margin-right:4px;width:11px;height:11px;}
    .full-standings .name{font-weight:600;letter-spacing:.2px;}
    .full-standings .points{font-size:.78rem;min-width:50px;letter-spacing:.35px;}
}
/* All drivers chart page */
.points-explorer .explainer{margin:-.4em 0 .9em;font-size:.8rem;color:var(--text-dim);letter-spacing:.5px;}
.driver-filter-wrapper{margin:1.1em 0 0;padding:.4em .2em 0;}
.driver-filter-wrapper.below{border-top:1px solid var(--border);}
.driver-filter-list{list-style:none;margin:.2em 0 0;padding:0;font-size:1.05rem;letter-spacing:.35px;font-weight:700;}
.driver-filter-list li{display:flex;align-items:center;gap:.55em;padding:.48em .2em;border-bottom:1px solid var(--border);}
.driver-filter-list li:last-child{border-bottom:none;}
.driver-filter-list li label{cursor:pointer;display:flex;align-items:center;gap:.55em;width:100%;}
.driver-filter-list input[type=checkbox]{
    -webkit-appearance:none;appearance:none;cursor:pointer;width:16px;height:16px;display:inline-grid;place-content:center;
    border:1px solid var(--border-strong);border-radius:4px;background:#1b242c;position:relative;transition:background .25s,border-color .25s,box-shadow .25s;outline:none;
}
.driver-filter-list input[type=checkbox]::after{content:"";width:10px;height:10px;border-radius:2px;background:linear-gradient(135deg,var(--accent),var(--accent-alt));transform:scale(0);transition:transform .25s ease;box-shadow:0 0 4px -1px rgba(255,138,0,.55);} 
.driver-filter-list input[type=checkbox]:checked{border-color:var(--accent-alt);background:#251a1a;box-shadow:0 0 0 1px rgba(255,138,0,.4),0 0 10px -2px rgba(255,138,0,.65);} 
.driver-filter-list input[type=checkbox]:checked::after{transform:scale(1);} 
.driver-filter-list input[type=checkbox]:focus-visible{outline:2px solid var(--accent);outline-offset:2px;} 
.driver-filter-list .swatch{width:16px;height:16px;border-radius:4px;box-shadow:0 0 0 1px rgba(0,0,0,.55),0 0 0 1px rgba(255,255,255,.08) inset;} 
.driver-filter-list li:hover{background:rgba(255,255,255,.04);} 
.points-explorer .chart-container.large{height:520px;margin-top:.3em;} 
.chart-legend-container.compact{display:none;} 
@media (max-width:700px){
    .points-explorer .chart-container.large{height:420px;}
    .driver-filter-list{font-size:.95rem;}
}

/* Ensure team color box alignment is good */
.full-standings .team-color-box {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    margin-right: 8px;
    vertical-align: middle;
    border: 1px solid rgba(0,0,0,0.1);
}

/* Responsive adjustments for detail pages if needed */
@media (max-width: 768px) {
    .race-info .info-grid {
        grid-template-columns: 1fr; /* Stack info items on mobile */
        gap: 1em;
    }
    .full-standings .team-name {
        margin-left: 0.5em;
        font-size: 0.85em;
    }
}

/* Race Details Page Adjustments */
/* .info-list intentionally minimal; list items styled individually */

.info-list-item {
    padding: 0.6em 0;
    border-bottom: 1px solid #f0f0f0;
    display: flex; /* Use flex for label/value alignment */
    justify-content: space-between; /* Push value to the right */
    align-items: center;
}

.info-list-item:last-child {
    border-bottom: none;
}

.info-list-item .info-label {
    /* Remove block display and uppercase from grid version */
    font-size: 1.05rem;
    color: var(--text);
    font-weight: 700; /* Bold label */
    margin-right: 1em;
}

.info-list-item .info-value {
    font-size: 1.05rem;
    font-weight: 400; /* Regular weight value */
    color: var(--text-dim);
    text-align: right;
}

/* Responsive */
@media (max-width: 768px) {
    /* ... existing responsive ... */

    /* Adjust info list for mobile if needed */
    .info-list-item {
        flex-direction: column; /* Stack label and value */
        align-items: flex-start;
    }
    .info-list-item .info-value {
        text-align: left;
        margin-top: 0.2em;
    }
}

/* Style driver links on standings page */
a.driver-link {
    color: inherit; /* Inherit text color */
    text-decoration: none;
    font-weight: 700;
}
a.driver-link:hover {
    text-decoration: underline;
    color: #007bff; /* Optional: highlight on hover */
}

/* Style completed session links */
a.completed-link {
    color: inherit; /* Inherit the greyed-out color */
    text-decoration: none;
    font-weight: 700;
}
a.completed-link:hover {
    text-decoration: underline;
    color: #333; /* Darken slightly on hover */
}

/* Styles for Driver Results Page */
.driver-season-results ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.driver-result-item {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping */
    align-items: center;
    padding: 0.8em 0;
    border-bottom: 1px solid #f0f0f0;
    gap: 0.5em 1em; /* Row and column gap */
}
.driver-result-item:last-child {
    border-bottom: none;
}

.driver-result-item span {
    font-size: 0.95rem;
}
.driver-result-item .round {
    font-weight: 700;
    color: #888;
    width: 40px; /* Slightly wider */
    flex-shrink: 0;
}
.driver-result-item .race-name {
    font-weight: 500;
    flex-basis: 150px; /* Give it some base width */
    flex-grow: 1; /* Allow growing */
}
.driver-result-item .constructor {
    color: #666;
    font-size: 0.9em;
    flex-basis: 100px;
}
.driver-result-item .grid, 
.driver-result-item .position,
.driver-result-item .status {
    color: var(--text-dim);
    font-size: 0.9em;
}

/* Styles for Session Results Page */
.session-full-results ol {
    list-style: none;
    padding: 0;
    margin: 0;
}

#session-subtitle {
    font-size: 1rem;
    color: #666;
    margin-top: -0.8em;
    margin-bottom: 1.5em;
}

.session-result-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 0.7em 0;
    border-bottom: 1px solid #f0f0f0;
    gap: 0.5em 1em;
}
.session-result-item:last-child {
    border-bottom: none;
}

.session-result-item .position { width: 30px; font-weight: 700; color: #888; flex-shrink: 0; }
.session-result-item .name { font-weight: 700; }
.session-result-item .team-name { color: #666; font-size: 0.9em; flex-grow: 1; margin: 0 1em; }
.session-result-item .team-color-box { vertical-align: middle; margin-right: 8px; /* Reuse existing */ }
.session-result-item .result-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em 1em;
    font-size: 0.9em;
    color: var(--text-dim);
    margin-left: auto; /* Push details to the right */
    flex-shrink: 0;
}
.session-result-item .result-details .time {
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .driver-result-item,
    .session-result-item {
        font-size: 0.9rem; /* Slightly smaller on mobile */
    }
    .session-result-item .result-details {
        margin-left: 0; /* Align left below driver/team on mobile */
        width: 100%;
        padding-left: 42px; /* Indent below position number */
    }
    /* ... other responsive rules ... */
}

/* Removed legacy black countdown color overrides */

/* Race Details Page Specific Styles */
.race-details-header h1#race-name {
    margin-bottom: 0.3em; /* Reduced bottom margin */
}

/* .info-list .info-item placeholder (kept for backward compatibility) */

/* Styles for Race Weekend Schedule on Homepage and Race Details Page */
.schedule-item {
    display: flex; /* Use flexbox for layout */
    justify-content: space-between; /* Push name and date to opposite ends */
    align-items: center; /* Vertically align items */
    padding: 5px 0; /* Add some vertical spacing */
    border-bottom: 1px solid #333; /* Optional separator */
}

.schedule-item:last-child {
    border-bottom: none; /* Remove border from last item */
}

.schedule-item-name {
    flex-grow: 1; /* Allow name to take available space */
    margin-right: 15px; /* Add some space between name and date */
}

.schedule-item-datetime {
    white-space: nowrap; /* Prevent date/time from wrapping */
    text-align: right; /* Align text to the right */
    color: #bbb; /* Slightly lighter color for date/time */
}

.completed-session {
    opacity: 0.6; /* Visually dim completed sessions */
}

.completed-session .schedule-item-name a {
    text-decoration: underline;
    color: #00d2be; /* Use a distinct color for links to completed results */
}

.completed-session .schedule-item-name a:hover {
    color: #ffffff;
}

/* Standings Page Specific Styles */
/* ... existing code ... */

/* Race Selector Styles (Homepage) */
/* .race-selector uses generic section styling */

#race-selector-dropdown {
    width: 100%; /* Make dropdown full width */
    padding: 10px 15px;
    background-color: #333; /* Dark background */
    color: #eee; /* Light text */
    border: 1px solid rgba(255,255,255,.15); /* Subtle border on dark */
    border-radius: 5px; /* Rounded corners */
    font-size: 1em; /* Match surrounding text */
    margin-top: 10px; /* Space below the heading */
    cursor: pointer;
    /* Optional: Remove default browser appearance for more control */
    /* appearance: none; */
    /* -webkit-appearance: none; */
    /* -moz-appearance: none; */
    /* If removing appearance, you might need to add a custom arrow */
}

#race-selector-dropdown:hover {
    background-color: #444;
}

#race-selector-dropdown option {
    background-color: #333; /* Background for options (might vary by browser) */
    color: #eee;
}

/* Match styling of date/time and countdown on race details page to homepage */
.race-details-header #race-detail-date-time { /* More specific selector */
    font-size: 1.8rem; /* Match homepage */
    color: #d9534f;    /* Match homepage accent color */
    font-weight: 700; /* Match homepage */
    margin-bottom: 0.2em; /* Similar spacing to homepage */
}

/* Unified countdown styling handled by themed gradient definitions; legacy override removed */

/* Race Details Page Specific Styles */
/* duplicate placeholder removed */

/* Styles for Race Weekend Schedule on Homepage and Race Details Page */
.schedule-item {
    display: flex; /* Use flexbox for layout */
    justify-content: space-between; /* Push name and date to opposite ends */
    align-items: center; /* Vertically align items */
    padding: 5px 0; /* Add some vertical spacing */
    border-bottom: 1px solid #333; /* Optional separator */
}

.schedule-item:last-child {
    border-bottom: none; /* Remove border from last item */
}

.schedule-item-name {
    flex-grow: 1; /* Allow name to take available space */
    margin-right: 15px; /* Add some space between name and date */
}

.schedule-item-datetime {
    white-space: nowrap; /* Prevent date/time from wrapping */
    text-align: right; /* Align text to the right */
    color: #bbb; /* Slightly lighter color for date/time */
}

.completed-session {
    opacity: 0.6; /* Visually dim completed sessions */
}

.completed-session .schedule-item-name a {
    text-decoration: underline;
    color: #00d2be; /* Use a distinct color for links to completed results */
}

.completed-session .schedule-item-name a:hover {
    color: #ffffff;
}

/* Standings Page Specific Styles */
/* ... existing code ... */

/* Race Selector Styles (Homepage) */
/* duplicate race-selector placeholder removed */

#race-selector-dropdown {
    width: 100%; /* Make dropdown full width */
    padding: 10px 15px;
    background-color: #333; /* Dark background */
    color: #eee; /* Light text */
    border: 1px solid rgba(255,255,255,.15); /* Subtle border on dark */
    border-radius: 5px; /* Rounded corners */
    font-size: 1em; /* Match surrounding text */
    margin-top: 10px; /* Space below the heading */
    cursor: pointer;
    /* Optional: Remove default browser appearance for more control */
    /* appearance: none; */
    /* -webkit-appearance: none; */
    /* -moz-appearance: none; */
    /* If removing appearance, you might need to add a custom arrow */
}

#race-selector-dropdown:hover {
    background-color: #444;
}

#race-selector-dropdown option {
    background-color: #333; /* Background for options (might vary by browser) */
    color: #eee;
}

/* Removed styles for button.next-race-btn as it now uses .nav-button */

/* Style for the Go to Next Race button */
/* Removed deprecated .next-race-btn styles (replaced by .nav-button) */

/* Specific styling for the Next Race button on homepage */
#next-race-schedule-button {
    margin-top: 25px; /* Increased top margin */
}

/* --- Flip Clock Styles --- */
.flip-clock-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0.8em auto; /* Center horizontally */
    perspective: none;
    max-width: 280px; /* Limit overall width */
}

.flip-unit {
    display: flex;
    margin: 0 0.1em;
}

.flip-card {
    position: relative;
    width: 55px; /* Reduced from 60px */
    height: 90px;
    font-size: 4rem;
    font-weight: 700;
    margin: 0 2px; /* Reduced from 3px */
    transform-style: preserve-3d;
    perspective: 600px;
}

/* Card faces - completely rewritten */
.flip-card .card-face {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    backface-visibility: hidden;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Front face */
.flip-card .card-face.top.front {
    z-index: 2;
    background: radial-gradient(circle at 30% 25%, #2b3d4d 0%, #13202b 70%);
    color: var(--text);
    text-shadow: 0 2px 4px rgba(0,0,0,.65),0 0 6px rgba(255,135,31,.35);
    border:1px solid rgba(255,255,255,.08);
}

/* Back face - initially rotated */
.flip-card .card-face.top.back {
    z-index: 1;
    background: radial-gradient(circle at 30% 25%, #2b3d4d 0%, #13202b 70%);
    color: var(--text);
    text-shadow: 0 2px 4px rgba(0,0,0,.65),0 0 6px rgba(255,135,31,.35);
    border:1px solid rgba(255,255,255,.08);
    transform: rotateX(180deg);
}

/* Hide other faces that were causing stacking */
.flip-card .card-face.bottom.front,
.flip-card .card-face.bottom.back {
    display: none;
}

/* Animation */
.flip-card.animate-flip .card-face.top.front {
    animation: flip-front 0.6s ease-in-out forwards;
}

.flip-card.animate-flip .card-face.top.back {
    animation: flip-back 0.6s ease-in-out forwards;
}

@keyframes flip-front {
    0% {
        transform: rotateX(0deg);
        z-index: 2;
    }
    50% {
        transform: rotateX(90deg);
        z-index: 2;
    }
    100% {
        transform: rotateX(180deg);
        z-index: 1;
    }
}

@keyframes flip-back {
    0% {
        transform: rotateX(180deg);
        z-index: 1;
    }
    50% {
        transform: rotateX(90deg);
        z-index: 1;
    }
    100% {
        transform: rotateX(0deg);
        z-index: 2;
    }
}

/* Separator Style */
.flip-separator {
    font-size: 3.5rem;
    font-weight: 700;
    background: linear-gradient(180deg,var(--accent),var(--accent-alt));
    -webkit-background-clip:text; background-clip:text; color:transparent;
    text-shadow:0 3px 8px rgba(0,0,0,.55);
    margin: 0 0.2em; /* Reduced from 0.5em to make it more compact */
    align-self: center;
}
/* --- End Flip Clock Styles --- */

/* Race Details Header Styles for Flip Clock */
.race-details-header {
    text-align: center;
}

.race-details-header h1#race-name {
    margin-bottom: 0.2em;
}

.race-details-header #race-detail-date-simple {
    font-size: 1.15rem;
    color: var(--text-dim);
    margin-bottom: 0.6em;
    letter-spacing:.4px;
}

/* Race details countdown below flip clock */
.race-details-header #race-detail-countdown {
    font-size: 1.4rem;
    font-weight: 600;
    margin-top: 0.5em;
    background:var(--gradient-neutral);
    -webkit-background-clip:text; background-clip:text; color:transparent;
    text-shadow:0 3px 6px rgba(0,0,0,.55);
}

/* Track Diagram Styles */
.track-diagram-wrapper{
    display:flex;
    justify-content:center;
    align-items:center;
    margin:.6em auto 1.1em;
    max-width:520px;
    padding:.75em 1em;
    background:linear-gradient(145deg,#262f38,#1a2128);
    border:1px solid var(--border);
    border-radius:14px;
    box-shadow:0 4px 14px -4px rgba(0,0,0,.55),0 1px 0 rgba(255,255,255,.04) inset;
    min-height:140px;
}
.track-diagram-wrapper img.track-diagram,.track-diagram-wrapper svg.track-diagram-svg{max-width:100%;height:auto;filter:drop-shadow(0 4px 8px rgba(0,0,0,.55)) brightness(1.05);mix-blend-mode:normal;}
.track-diagram-wrapper svg.track-diagram-svg path{stroke-linecap:round;stroke-linejoin:round;filter:drop-shadow(0 0 4px rgba(255,90,31,.55)) drop-shadow(0 0 10px rgba(255,120,40,.45));}
/* subtle animated glow pulse */
@keyframes trackGlowPulse{0%,100%{filter:drop-shadow(0 0 4px rgba(255,90,31,.55)) drop-shadow(0 0 10px rgba(255,120,40,.45));}50%{filter:drop-shadow(0 0 6px rgba(255,120,50,.75)) drop-shadow(0 0 14px rgba(255,140,60,.6));}}
.track-diagram-wrapper.glow-animate svg.track-diagram-svg path{animation:trackGlowPulse 4s ease-in-out infinite;}
.track-diagram-loading{font-size:.75rem;letter-spacing:1px;color:var(--text-dim);animation:pulse 1.4s ease-in-out infinite;}
@keyframes pulse{0%,100%{opacity:.35}50%{opacity:1}}
@media (max-width:600px){.track-diagram-wrapper{padding:.55em .8em;min-height:120px;}}

/* Simple single-color track override */
.single-color-track svg.track-diagram-svg *{stroke:#f0491f !important; fill:#f0491f !important; stroke-width:5 !important;}
.single-color-track img.track-diagram-fallback{
  filter: 
    sepia(1) 
    saturate(3) 
    hue-rotate(5deg) 
    brightness(0.9) 
    contrast(1.2);
}