/* CSS Variables for Dark Theme (default) */
:root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #252525;
    --bg-quaternary: rgba(40, 40, 40, 0.8);
    --bg-quinary: rgba(40, 40, 40, 0.5);
    --bg-hover: rgba(91, 163, 255, 0.15);
    --bg-modal: #1a1a1a;
    --bg-modal-header: #2d2d2d;
    --bg-tab-inactive: rgba(60, 60, 60, 0.7);
    --bg-tab-active: #1a1a1a;
    --bg-tab-hover: rgba(80, 80, 80, 0.9);
    --bg-chart: rgba(40, 40, 40, 0.5);
    --bg-chart-blend: #212121;
    --bg-gold: #4a3a1a;
    --bg-silver: #3a3a3a;
    --bg-bronze: #3d2e1a;
    
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-tertiary: #999;
    --text-white: #ffffff;
    --text-accent: #5ba3ff;
    --text-time: #ffffff;
    --text-rank: #5ba3ff;
    --text-error: #ff6b6b;
    --text-success: #27ae60;
    --text-tab-active: #ffffff;
    --text-tab-hover: #ffffff;
    --icon-moon: #2d2d2d;
    --icon-sun: #ffd700;
    
    --border-primary: #404040;
    --border-secondary: #505050;
    --border-accent: #0066cc;
    --border-tab: #0066cc;
    
    --header-gradient-start: #0066cc;
    --header-gradient-end: #003366;
    --header-overlay: rgba(255, 255, 255, 0.1);
    
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-light: rgba(0, 0, 0, 0.1);
}

/* CSS Variables for Light Theme */
[data-theme="light"] {
    --bg-primary: #f5f5f5;
    --bg-secondary: #f0f0f0;
    --bg-tertiary: #f8f8f8;
    --bg-quaternary: rgba(240, 240, 240, 0.95);
    --bg-quinary: rgba(240, 240, 240, 0.5);
    --bg-hover: rgba(91, 163, 255, 0.1);
    --bg-modal: #f5f5f5;
    --bg-modal-header: #f0f0f0;
    --bg-tab-inactive: rgba(230, 230, 230, 0.7);
    --bg-tab-active: #f5f5f5;
    --bg-tab-hover: rgba(220, 220, 220, 0.9);
    --bg-chart: rgba(240, 240, 240, 0.5);
    --bg-chart-blend: #f0f0f0;
    --bg-gold: #fff8e1;
    --bg-silver: #f5f5f5;
    --bg-bronze: #fff3e0;
    
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-tertiary: #888888;
    --text-white: #ffffff;
    --text-accent: #0066cc;
    --text-time: #000000;
    --text-rank: #0066cc;
    --text-error: #d32f2f;
    --text-success: #2e7d32;
    --text-tab-active: #333333;
    --text-tab-hover: #333333;
    --icon-moon: #7ba3ff;
    --icon-sun: #ffa500;
    
    --border-primary: #e0e0e0;
    --border-secondary: #d0d0d0;
    --border-accent: #0066cc;
    --border-tab: #0066cc;
    
    --header-gradient-start: #0066cc;
    --header-gradient-end: #003366;
    --header-overlay: rgba(255, 255, 255, 0.2);
    
    --shadow: rgba(0, 0, 0, 0.15);
    --shadow-light: rgba(0, 0, 0, 0.05);
}

/* Global Scrollbar Styles - Applied to all scrollable elements across the website */
html {
    scroll-behavior: smooth;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: var(--border-accent) var(--bg-primary); /* Firefox: thumb and track */
}

/* Universal scrollbar style for all elements */
*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 4px;
}

*::-webkit-scrollbar-thumb {
    background: var(--border-accent);
    border-radius: 4px;
}

*::-webkit-scrollbar-thumb:hover {
    background: #0052a3;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-tertiary) 100%);
    padding: 20px;
    min-height: 100vh;
    min-width: 360px;
    animation: pageLoad 0.5s ease-out;
    transition: background 0.3s ease;
}

@keyframes pageLoad {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    border-radius: 10px;
    box-shadow: 0 10px 30px var(--shadow);
    overflow: hidden;
    padding-left: 0 !important;
    padding-right: 0 !important;
    animation: containerSlideIn 0.6s ease-out;
    transition: box-shadow 0.08s ease, filter 0.08s ease;
}

/* Blur background when modal is open */
body.modal-open .container {
    filter: blur(4px);
    transition: filter 0.08s ease;
}

/* Ensure modal content is not blurred */
body.modal-open .modal {
    filter: none;
}

@keyframes containerSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Override Bootstrap container padding */
body > .container {
    padding-left: 0;
    padding-right: 0;
}

.header {
    background-image: url('assets/tcmbanner.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: white;
    padding: 30px;
    text-align: center;
    position: relative;
    animation: headerFadeIn 0.8s ease-out;
    transition: background 0.3s ease;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.overall-statistics-jump-btn {
    padding: 8px 18px;
    border: 1px solid var(--border-accent);
    background: var(--bg-quaternary);
    color: var(--text-accent);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9em;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.overall-statistics-jump-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--text-accent);
}

.overall-statistics-jump-btn:focus-visible {
    outline: 2px solid var(--border-accent);
    outline-offset: 2px;
}

#statistics-section {
    scroll-margin-top: 12px;
}

.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 64px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1em;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.3s ease;
    position: relative;
    overflow: hidden;
    transform: translateX(32px);
    color: var(--icon-moon);
}

[data-theme="light"] .theme-icon {
    transform: translateX(0);
    color: var(--icon-sun);
}

[data-theme="light"] .theme-toggle {
    background: rgba(255, 255, 255, 0.25);
}

[data-theme="light"] .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.35);
}


@keyframes headerFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    position: relative;
    z-index: 10;
}

.header h5 {
    position: relative;
    z-index: 10;
}

.header .last-updated {
    font-size: 0.9em;
    opacity: 0.9;
    position: relative;
    z-index: 10;
}

.target-time-table {
    font-size: 1em;
    font-weight: 600;
    padding: 15px 20px;
    color: var(--text-primary);
}

.nav-tabs {
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-tab);
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    padding: 10px 10px 0 10px;
    margin: 0;
    margin-bottom: -2px;
    border-top: none;
    border-left: none;
    border-right: none;
    position: relative;
    box-shadow: inset 0 -2px 0 var(--border-tab);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.nav-tabs .nav-item {
    margin-right: 5px;
    margin-bottom: 0;
}

.nav-tabs .nav-link {
    color: var(--text-primary);
    background: var(--bg-tab-inactive);
    border: none;
    border-radius: 5px 5px 0 0;
    padding: 12px 24px;
    font-weight: 500;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s, transform 0.2s;
    margin-bottom: 0;
    box-shadow: inset 0 -2px 0 var(--border-tab);
}

.nav-tabs .nav-link:hover {
    transform: translateY(-2px);
    background: var(--bg-tab-hover);
    border-color: var(--border-secondary);
    color: var(--text-tab-hover);
    isolation: isolate;
}

.nav-tabs .nav-link.active {
    background: var(--bg-tab-active);
    color: var(--text-tab-active);
    font-weight: 600;
    border: 2px solid var(--border-tab);
    border-bottom: 5px solid var(--bg-tab-active);
    margin-bottom: -5px;
    z-index: 100;
    position: relative;
    box-shadow: none;
    animation: tabActivate 0.3s ease-out;
}

.nav-tabs .nav-link.active:hover {
    transform: none;
}

@keyframes tabActivate {
    from {
        transform: scale(0.95);
    }
    to {
        transform: scale(1);
    }
}

.tab-content {
    position: relative;
    z-index: 1;
    padding: 20px;
    background: var(--bg-primary);
    border-top: none;
    transition: background 0.3s ease;
}

.tab-pane {
    display: none;
    border: none;
    opacity: 0;
    animation: none;
    transition: opacity 0s;
}

.tab-pane.placeholder-tab-pane {
    animation: none;
    transition: opacity 0s;
}

.tab-pane.active,
.tab-pane.show {
    display: block;
    opacity: 1;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Hide borders on elements under active tab */
.tab-pane * {
    border-top: none !important;
}

.tab-content > * {
    border-top: none !important;
}

.table-container {
    overflow-x: auto;
    border-radius: 8px;
}

.iracing-links {
    margin-top: 20px;
    padding: 15px 20px;
    background: var(--bg-quaternary);
    border-radius: 8px;
    border: 1px solid var(--border-primary);
    animation: tableFadeIn 0.5s ease-out;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.iracing-links h3 {
    color: var(--text-primary);
    font-size: 1.1em;
    margin-bottom: 10px;
    font-weight: 600;
}

.iracing-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.iracing-links li {
    margin-bottom: 8px;
    animation: slideInRow 0.4s ease-out backwards;
}

.iracing-links li:nth-child(1) {
    animation-delay: 0.05s;
}

.iracing-links li:nth-child(2) {
    animation-delay: 0.1s;
}

.iracing-links li:nth-child(3) {
    animation-delay: 0.15s;
}

.iracing-links li:nth-child(n+4) {
    animation-delay: 0.2s;
}

.iracing-links a {
    color: var(--text-accent);
    text-decoration: none;
    transition: color 0.2s, transform 0.2s;
    display: inline-block;
}

.iracing-links a:hover {
    color: #7bb3ff;
    text-decoration: underline;
    transform: translateX(5px);
}

/* Driver link styling */
.driver-row {
    cursor: pointer;
    transition: background-color 0.2s;
}

.driver-row:hover {
    background-color: var(--bg-hover) !important;
}

/* Favorite driver row highlighting */
.driver-row.favorite-driver {
    background-color: rgba(245, 158, 11, 0.2) !important;
    border-left: 4px solid #f59e0b;
}

.driver-row.favorite-driver:nth-child(even) {
    background-color: rgba(245, 158, 11, 0.25) !important;
}

.driver-row.favorite-driver:nth-child(odd) {
    background-color: rgba(245, 158, 11, 0.2) !important;
}

.driver-row.favorite-driver:hover {
    background-color: rgba(245, 158, 11, 0.3) !important;
}

/* Smooth transition for favorite status changes */
.driver-row.favorite-transition {
    transition: background-color 0.3s ease, border-left-color 0.3s ease;
}

/* Light theme adjustments for favorite rows */
[data-theme="light"] .driver-row.favorite-driver {
    background-color: rgba(251, 191, 36, 0.15) !important;
    border-left-color: #fbbf24;
}

[data-theme="light"] .driver-row.favorite-driver:nth-child(even) {
    background-color: rgba(251, 191, 36, 0.2) !important;
}

[data-theme="light"] .driver-row.favorite-driver:nth-child(odd) {
    background-color: rgba(251, 191, 36, 0.15) !important;
}

[data-theme="light"] .driver-row.favorite-driver:hover {
    background-color: rgba(251, 191, 36, 0.25) !important;
}

/* Favorite button styling */
.favorite-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-left: 6px;
    color: var(--text-secondary);
    font-size: 0.9em;
    transition: all 0.2s ease;
    vertical-align: middle;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    line-height: 1;
    height: 1.2em;
    width: 1.2em;
    position: relative;
    top: -0.05em;
}

.favorite-btn i {
    display: block;
    line-height: 1;
    font-size: 1em;
}

.favorite-btn:hover {
    opacity: 1;
    transform: scale(1.2);
}

.favorite-btn:hover i.bi-star {
    color: #f59e0b;
}

.favorite-btn i {
    transition: color 0.3s ease, transform 0.3s ease;
}

.favorite-btn:active i {
    transform: scale(1.3);
}

.favorite-btn i.bi-star-fill {
    color: #f59e0b;
    opacity: 1;
}

.favorite-btn i.bi-star {
    color: var(--text-secondary);
}

[data-theme="light"] .favorite-btn i.bi-star-fill {
    color: #fbbf24;
}

[data-theme="light"] .favorite-btn:hover i.bi-star {
    color: #fbbf24;
}

.driver-row:hover .favorite-btn {
    opacity: 1;
}

/* Prevent favorite button from triggering row click */
.favorite-btn:focus {
    outline: 2px solid var(--border-accent);
    outline-offset: 2px;
}

/* Override existing hover styles for driver rows */
tbody tr.driver-row:hover {
    background-color: var(--bg-hover) !important;
}

/* Style rows that fail 107% requirement */
tbody tr.fails-107-requirement {
    background-color: rgba(255, 107, 107, 0.15) !important;
    border-left: 4px solid var(--text-error);
}

tbody tr.fails-107-requirement:nth-child(even) {
    background-color: rgba(255, 107, 107, 0.2) !important;
}

tbody tr.fails-107-requirement:nth-child(odd) {
    background-color: rgba(255, 107, 107, 0.15) !important;
}

tbody tr.fails-107-requirement:hover {
    background-color: rgba(255, 107, 107, 0.25) !important;
}

tbody tr.fails-107-requirement td.time {
    color: var(--text-error);
    font-weight: 700;
}

/* Light theme adjustments for failed rows */
[data-theme="light"] tbody tr.fails-107-requirement {
    background-color: rgba(211, 47, 47, 0.1) !important;
}

[data-theme="light"] tbody tr.fails-107-requirement:nth-child(even) {
    background-color: rgba(211, 47, 47, 0.15) !important;
}

[data-theme="light"] tbody tr.fails-107-requirement:nth-child(odd) {
    background-color: rgba(211, 47, 47, 0.1) !important;
}

[data-theme="light"] tbody tr.fails-107-requirement:hover {
    background-color: rgba(211, 47, 47, 0.2) !important;
}

/* Driver statistics modal */
.driver-stats-modal {
    background: var(--bg-modal);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
    animation: modalFadeIn 0.4s ease-out;
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.driver-stats-modal .modal-header {
    background: var(--bg-modal-header);
    border-bottom: 1px solid var(--border-primary);
    transition: background 0.3s ease, border-color 0.3s ease;
    padding: 0;
}

.driver-stats-modal .driver-stats-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    position: relative;
    background: linear-gradient(135deg, var(--bg-modal-header) 0%, rgba(245, 158, 11, 0.05) 100%);
    border-bottom: 2px solid rgba(245, 158, 11, 0.2);
}

[data-theme="light"] .driver-stats-modal .driver-stats-header {
    background: linear-gradient(135deg, var(--bg-modal-header) 0%, rgba(251, 191, 36, 0.08) 100%);
    border-bottom-color: rgba(251, 191, 36, 0.3);
}

.driver-stats-header-content {
    flex: 1;
    min-width: 0;
}

.driver-stats-header-main {
    display: flex;
    flex-direction: column;
}

.driver-stats-header-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding-right: 3rem; /* Space for close button */
}

.header-stats-toggle-clickable {
    cursor: pointer;
    user-select: none;
    transition: opacity 0.2s ease;
}

.header-stats-toggle-clickable:hover {
    opacity: 0.8;
}

.header-stats-chevron {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-left: 0.5rem;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.header-stats-chevron.collapsed {
    transform: rotate(-90deg);
}

.driver-stats-modal .modal-title {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.5rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    line-height: 1.2;
    flex: 1;
    min-width: 0;
}

.driver-stats-modal .driver-icon {
    font-size: 1.75rem;
    color: rgba(245, 158, 11, 0.8);
    flex-shrink: 0;
}

[data-theme="light"] .driver-stats-modal .driver-icon {
    color: rgba(251, 191, 36, 0.9);
}

.driver-stats-modal .driver-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.driver-stats-header-stats {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.75rem;
    align-items: center;
    overflow-x: auto;
    min-width: 0;
}

.header-stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    border: 1px solid var(--border-primary);
    transition: all 0.2s ease;
    flex-shrink: 0;
    white-space: nowrap;
    min-height: 2.5rem;
    box-sizing: border-box;
}

.header-stat-item:hover {
    background: var(--bg-hover);
    border-color: rgba(245, 158, 11, 0.3);
}

[data-theme="light"] .header-stat-item:hover {
    border-color: rgba(251, 191, 36, 0.4);
}

.header-stat-icon {
    font-size: 1rem;
    color: rgba(245, 158, 11, 0.9);
    flex-shrink: 0;
}

[data-theme="light"] .header-stat-icon {
    color: rgba(251, 191, 36, 0.9);
}

.header-stat-content {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.header-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.header-stat-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.2rem;
    line-height: 1;
}

.stat-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.1rem 0.3rem;
    background: rgba(245, 158, 11, 0.2);
    color: rgba(245, 158, 11, 1);
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-radius: 3px;
    line-height: 1;
    text-transform: none;
    letter-spacing: 0;
}

[data-theme="light"] .stat-badge {
    background: rgba(251, 191, 36, 0.25);
    color: rgba(251, 191, 36, 1);
    border-color: rgba(251, 191, 36, 0.5);
}

/* Desktop - stats always visible */
@media (min-width: 1025px) {
    .header-stats-collapsible {
        max-height: none !important;
        opacity: 1 !important;
        overflow: visible;
    }
    
    .header-stats-toggle-clickable {
        cursor: default;
    }
    
    .header-stats-toggle-clickable:hover {
        opacity: 1;
    }
    
    .header-stats-chevron {
        display: none !important;
    }
}

@media (max-width: 1024px) {
    .header-stats-collapsible {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
        opacity: 0;
    }
    
    .header-stats-collapsible.expanded {
        max-height: 500px;
        opacity: 1;
    }
    
    .driver-stats-header-stats {
        flex-wrap: wrap;
        gap: 0.5rem;
        overflow-x: visible;
    }
    
    .header-stat-item {
        flex-shrink: 1;
        min-width: auto;
    }
}

@media (max-width: 768px) {
    .driver-stats-modal .driver-stats-header {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }
    
    .driver-stats-modal .modal-title {
        font-size: 1.25rem;
    }
    
    .driver-stats-header-title {
        gap: 0.5rem;
        padding-right: 2.5rem; /* Space for close button on mobile */
    }
    
    .header-stats-chevron {
        font-size: 0.85em;
        margin-left: 0.4rem;
    }
    
    .header-stats-collapsible {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
        opacity: 0;
    }
    
    .header-stats-collapsible.expanded {
        max-height: 500px;
        opacity: 1;
    }
    
    .driver-stats-header-stats {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        overflow-x: visible;
        align-items: stretch;
    }
    
    .driver-stats-header-stats .header-stat-item {
        height: 100%;
    }
    
    .header-stat-item {
        padding: 0.4rem 0.7rem;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        min-height: 2.5rem;
        align-items: center;
    }
    
    .header-stat-value {
        font-size: 1rem;
    }
    
    .header-stat-icon {
        font-size: 0.9rem;
    }
    
    .header-stat-label {
        font-size: 0.6rem;
    }
}

@media (max-width: 480px) {
    .driver-stats-header-stats {
        flex-direction: column;
        align-items: stretch;
    }
    
    .header-stat-item {
        min-width: 100%;
        max-width: 100%;
        width: 100%;
    }
}

.driver-stats-modal .modal-body {
    background: var(--bg-modal);
    transition: background 0.3s ease;
    padding: 1rem;
}

.driver-stats-modal .modal-footer {
    background: var(--bg-modal-header);
    border-top: 1px solid var(--border-primary);
    transition: background 0.3s ease, border-color 0.3s ease;
}

/* Close button styling for driver stats modal */
.driver-stats-modal .driver-stats-header .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.8;
    transition: opacity 0.3s ease, filter 0.3s ease;
    position: absolute;
    top: 1.25rem;
    right: 1.5rem;
    margin: 0;
    padding: 0.5rem;
}

[data-theme="light"] .driver-stats-modal .driver-stats-header .btn-close {
    filter: brightness(0);
    opacity: 0.5;
}

.driver-stats-modal .driver-stats-header .btn-close:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .driver-stats-modal .driver-stats-header .btn-close:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .driver-stats-modal .driver-stats-header .btn-close {
        top: 1rem;
        right: 1rem;
    }
}

.driver-stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 15px;
    animation: fadeIn 0.5s ease-out;
}

.race-stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    animation: fadeIn 0.5s ease-out;
}

/* Default 3-column layout ordering */
.stat-item.stat-order-1 { order: 1; } /* Tracks Participated */
.stat-item.stat-order-2 { order: 4; } /* Best Position */
.stat-item.stat-order-3 { order: 2; } /* Total Laps */
.stat-item.stat-order-4 { order: 5; } /* Worst Position */
.stat-item.stat-order-5 { order: 3; } /* Average Laps per Track */
.stat-item.stat-order-6 { order: 6; } /* Average Position */

.stat-item {
    background: var(--bg-quaternary);
    padding: 12px 15px;
    border-radius: 6px;
    border: 1px solid var(--border-primary);
    animation: slideInRow 0.4s ease-out backwards;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.stat-item:nth-child(1) { animation-delay: 0.05s; }
.stat-item:nth-child(2) { animation-delay: 0.1s; }
.stat-item:nth-child(3) { animation-delay: 0.15s; }
.stat-item:nth-child(4) { animation-delay: 0.2s; }
.stat-item:nth-child(5) { animation-delay: 0.25s; }
.stat-item:nth-child(6) { animation-delay: 0.3s; }

.stat-label {
    display: block;
    color: var(--text-tertiary);
    font-size: 0.85em;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    color: var(--text-accent);
    font-size: 1.2em;
    font-weight: 600;
}

.stat-note {
    display: block;
    color: var(--text-tertiary);
    font-size: 0.8em;
    margin-top: 3px;
}

.stats-section-title {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.1em;
}

/* Driver stats modal view toggle */
.driver-stats-view-toggle {
    margin-bottom: 20px;
}

.driver-stats-tab-content {
    margin-top: 0;
}

.driver-stats-pane {
    display: none;
}

.driver-stats-pane.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

.driver-stats-session-toggle {
    margin-bottom: 20px;
}

.session-stats-section {
    display: none;
}

.session-stats-section.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

/* Expandable practice result rows */
.practice-result-row.expandable {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.practice-result-row.expandable:hover {
    background-color: var(--bg-hover) !important;
}

.practice-result-row.expandable .expand-icon {
    margin-left: 8px;
    font-size: 0.8em;
    color: var(--text-secondary);
    transition: transform 0.3s ease, color 0.2s ease;
}

.practice-result-row.expandable:hover .expand-icon {
    color: var(--text-accent);
}

.progression-row {
    background-color: var(--bg-secondary);
}

.progression-cell {
    padding: 20px !important;
    background-color: var(--bg-secondary);
}

.progression-cell .progression-chart-container {
    margin: 0;
    max-width: 100%;
}

.driver-stats-modal .table-container {
    margin-top: 10px;
    animation: tableFadeIn 0.5s ease-out;
    overflow-x: visible;
    overflow-y: visible;
}

.driver-stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1em;
    border-radius: 8px;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-modal);
    color: var(--text-primary);
    transition: background 0.3s ease, color 0.3s ease;
    table-layout: auto;
}

.driver-stats-table thead {
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    transition: background 0.3s ease;
}

.driver-stats-table thead tr:first-child th:first-child {
    border-top-left-radius: 8px;
}

.driver-stats-table thead tr:first-child th:last-child {
    border-top-right-radius: 8px;
}

.driver-stats-table thead th {
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-accent);
    font-weight: 600;
    padding: 8px 10px;
    text-align: left;
    font-size: 1em;
}

.driver-stats-table tbody tr {
    transition: background-color 0.2s, transform 0.2s;
    animation: slideInRow 0.4s ease-out backwards;
}

.driver-stats-table tbody tr:nth-child(1) { animation-delay: 0.05s; }
.driver-stats-table tbody tr:nth-child(2) { animation-delay: 0.1s; }
.driver-stats-table tbody tr:nth-child(3) { animation-delay: 0.15s; }
.driver-stats-table tbody tr:nth-child(4) { animation-delay: 0.2s; }
.driver-stats-table tbody tr:nth-child(5) { animation-delay: 0.25s; }
.driver-stats-table tbody tr:nth-child(6) { animation-delay: 0.3s; }
.driver-stats-table tbody tr:nth-child(7) { animation-delay: 0.35s; }
.driver-stats-table tbody tr:nth-child(n+8) { animation-delay: 0.4s; }

.driver-stats-table tbody tr:nth-child(even) {
    background-color: var(--bg-secondary);
}

.driver-stats-table tbody tr:nth-child(odd) {
    background-color: var(--bg-tertiary);
}

.driver-stats-table tbody tr:hover {
    background-color: var(--bg-hover) !important;
}

.driver-stats-table tbody td {
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-primary);
    padding: 8px 10px;
}

.driver-stats-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 8px;
}

.driver-stats-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 8px;
}

.driver-stats-table .driver {
    text-align: left;
    width: auto;
    min-width: 0;
    padding-left: 10px;
    padding-right: 10px;
}

.driver-stats-table .rank {
    text-align: center;
    width: auto;
    min-width: fit-content;
    white-space: nowrap;
    padding-left: 10px;
    padding-right: 10px;
}

.driver-stats-table th.rank,
.driver-stats-table td.rank {
    text-align: center;
}

.driver-stats-table .time {
    text-align: center;
    width: auto;
    min-width: fit-content;
    white-space: nowrap;
    padding-left: 10px;
    padding-right: 10px;
}

.driver-stats-table th.time,
.driver-stats-table td.time {
    text-align: center;
}

.driver-stats-table .total-laps {
    text-align: center;
    width: auto;
    min-width: fit-content;
    white-space: nowrap;
    padding-left: 10px;
    padding-right: 10px;
}

.driver-stats-table .incidents {
    text-align: center;
    width: auto;
    min-width: fit-content;
    white-space: nowrap;
    padding-left: 10px;
    padding-right: 10px;
    color: var(--text-error);
}

.driver-stats-table th.incidents {
    text-align: center;
    color: var(--text-primary);
}

/* Remove medals and special styling from driver stats table - no medals at all */
.driver-stats-table tbody tr:nth-child(1) {
    background-color: var(--bg-tertiary) !important;
    font-weight: 400 !important;
}

.driver-stats-table tbody tr:nth-child(2) {
    background-color: var(--bg-secondary) !important;
    font-weight: 400 !important;
}

.driver-stats-table tbody tr:nth-child(3) {
    background-color: var(--bg-tertiary) !important;
    font-weight: 400 !important;
}

/* Prevent medal styling on all cells in driver stats table */
.driver-stats-table tbody tr:nth-child(1) td,
.driver-stats-table tbody tr:nth-child(2) td,
.driver-stats-table tbody tr:nth-child(3) td {
    text-indent: 0 !important;
    overflow: visible !important;
    position: static !important;
}

.driver-stats-table tbody tr:nth-child(1) td::before,
.driver-stats-table tbody tr:nth-child(2) td::before,
.driver-stats-table tbody tr:nth-child(3) td::before {
    content: none !important;
}

.driver-stats-modal .btn-secondary {
    background: var(--border-primary);
    border-color: var(--border-secondary);
    color: var(--text-primary);
    transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.driver-stats-modal .btn-secondary:hover {
    background: var(--border-secondary);
    border-color: var(--border-secondary);
    color: var(--text-white);
}

/* Time progression charts */
.time-progression-charts {
    margin-top: 20px;
    animation: fadeIn 0.5s ease-out;
}

.progression-chart-container {
    padding: 12px 0;
    background: var(--bg-quaternary);
    border-radius: 8px;
    border: 1px solid var(--border-primary);
    height: 300px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideInRow 0.4s ease-out backwards;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.progression-chart-container:nth-child(1) { animation-delay: 0.05s; }
.progression-chart-container:nth-child(2) { animation-delay: 0.1s; }
.progression-chart-container:nth-child(3) { animation-delay: 0.15s; }
.progression-chart-container:nth-child(4) { animation-delay: 0.2s; }
.progression-chart-container:nth-child(5) { animation-delay: 0.25s; }
.progression-chart-container:nth-child(n+6) { animation-delay: 0.3s; }

.chart-title {
    color: var(--text-primary);
    font-size: 1em;
    font-weight: 600;
    margin-bottom: 15px;
    text-align: center;
    flex-shrink: 0;
    animation: fadeIn 0.3s ease-out 0.2s backwards;
}

.progression-chart {
    width: 100% !important;
    max-width: 100% !important;
    height: 250px !important;
    max-height: 250px !important;
    min-height: 250px !important;
    background: transparent !important;
    border-radius: 4px;
    position: relative;
    flex: 1;
    overflow: hidden;
    transition: background 0.3s ease;
}

@keyframes tableFadeIn {
    from {
        opacity: 0;
        transform: scale(0.98);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1em;
    border-radius: 8px;
    overflow: hidden;
    min-width: 520px;
}

thead {
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    transition: background 0.3s ease;
}

thead tr:first-child th:first-child {
    border-top-left-radius: 8px;
}

thead tr:first-child th:last-child {
    border-top-right-radius: 8px;
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-accent);
    font-size: 1em;
}

td {
    padding: 15px;
    border-bottom: 1px solid var(--border-primary);
    color: var(--text-primary);
}

tbody tr {
    transition: background-color 0.2s, transform 0.2s;
    animation: slideInRow 0.4s ease-out backwards;
}

@keyframes slideInRow {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

tbody tr:nth-child(1) {
    animation-delay: 0.05s;
}

tbody tr:nth-child(2) {
    animation-delay: 0.1s;
}

tbody tr:nth-child(3) {
    animation-delay: 0.15s;
}

tbody tr:nth-child(n+4) {
    animation-delay: 0.2s;
}

tbody tr:nth-child(even) {
    background-color: var(--bg-secondary);
}

tbody tr:nth-child(odd) {
    background-color: var(--bg-tertiary);
}

tbody tr:last-child td:first-child {
    border-bottom-left-radius: 8px;
}

tbody tr:last-child td:last-child {
    border-bottom-right-radius: 8px;
}

tbody tr:nth-child(1) {
    background-color: var(--bg-gold);
    font-weight: 600;
}

tbody tr:nth-child(2) {
    background-color: var(--bg-silver);
}

tbody tr:nth-child(3) {
    background-color: var(--bg-bronze);
}

/* Stats tab mini-tables are not podiums — neutral striping */
.stats-mini-table tbody tr:nth-child(odd) {
    background-color: var(--bg-secondary) !important;
    font-weight: 400 !important;
}

.stats-mini-table tbody tr:nth-child(even) {
    background-color: var(--bg-tertiary) !important;
    font-weight: 400 !important;
}

/* Exclude no-time table from medal colors */
.no-time-table tbody tr:nth-child(1),
.no-time-table tbody tr:nth-child(2),
.no-time-table tbody tr:nth-child(3) {
    background-color: var(--bg-tertiary) !important;
    font-weight: 400 !important;
}

.no-time-table tbody tr:nth-child(even) {
    background-color: var(--bg-secondary) !important;
}

.no-time-table tbody tr:nth-child(odd) {
    background-color: var(--bg-tertiary) !important;
}

/* Medal icon styling - maintains same alignment as before */
.medal-icon {
    font-size: 0.9em;
    display: inline-block;
    vertical-align: middle;
    line-height: 1;
}

.medal-gold {
    color: #FFD700;
}

.medal-silver {
    color: #C0C0C0;
}

.medal-bronze {
    color: #CD7F32;
}

/* Practice cutoff line (rank from TARGET_TIME_RANK_BY_TRACK per track; classes set in script.js). Exclude no-time-table. */
table:not(.no-time-table) tbody tr.practice-cutoff-last {
    border-bottom: 3px solid var(--text-error);
}

table:not(.no-time-table) tbody tr.practice-cutoff-first-below {
    border-top: 3px solid var(--text-error);
}

.rank {
    width: 40px;
    padding: 15px 4px 15px 15px;
    text-align: left;
}

th.rank {
    font-weight: 600;
    color: var(--text-primary);
}

td.rank {
    font-weight: 600;
    color: var(--text-rank);
    vertical-align: middle;
}

/* Center medal icons in rank cell to match original emoji alignment */
td.rank.rank-medal {
    text-align: center;
    padding-left: 4px;
    padding-right: 4px;
}

.driver {
    min-width: 160px;
    padding: 15px;
}

th.driver {
    min-width: 160px;
    font-weight: 600;
    color: var(--text-primary);
}

td.driver {
    font-weight: 400;
    color: var(--text-primary);
}

/* Team name and drivers sub-row styling */
.team-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.team-drivers {
    font-size: 0.85em;
    color: var(--text-secondary);
    font-weight: 400;
    line-height: 1.4;
}

.time {
    width: 80px;
    padding: 15px 8px;
    text-align: center;
}

th.time {
    font-weight: 600;
    color: var(--text-primary);
}

td.time {
    font-weight: 600;
    color: var(--text-time);
}

.time-loss {
    width: 80px;
    padding: 15px 8px;
    text-align: center;
}

th.time-loss {
    font-weight: 600;
    color: var(--text-primary);
}

td.time-loss {
    font-weight: 400;
    color: var(--text-error);
}

.total-laps {
    width: 50px;
    padding: 15px 8px;
    text-align: center;
}

th.total-laps {
    font-weight: 600;
    color: var(--text-primary);
}

td.total-laps {
    color: var(--text-secondary);
}

.points {
    width: 50px;
    padding: 15px 8px;
    text-align: center;
}

th.points {
    font-weight: 600;
    color: var(--text-primary);
}

td.points {
    font-weight: 600;
    color: var(--text-success);
}

.pos-change {
    text-align: left;
    font-weight: 600;
    width: 40px;
    padding: 15px 15px 15px 4px;
    vertical-align: middle;
}

.pos-change-up {
    color: var(--text-success);
    white-space: nowrap;
}

.pos-change-down {
    color: var(--text-error);
    white-space: nowrap;
}

.pos-change-new {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--text-rank);
    color: var(--text-white);
    padding: 1px 4px;
    border-radius: 6px;
    font-size: 0.5em;
    font-weight: 600;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    vertical-align: middle;
    line-height: 1.4;
    height: 1.4em;
}

/* AM badge styling for amateur drivers */
.am-badge {
    display: inline-block;
    background-color: var(--text-accent);
    color: var(--text-white);
    padding: 1px 4px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 600;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    vertical-align: baseline;
    margin-right: 6px;
    line-height: 1;
}

/* Penalty badge styling */
.penalty-badge {
    display: inline-block;
    background-color: var(--text-error);
    color: var(--text-white);
    padding: 1px 4px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.3px;
    vertical-align: baseline;
    margin-left: 6px;
    line-height: 1;
}

/* DSQ (Disqualification) badge styling */
.dsq-badge {
    display: inline-block;
    background-color: #dc3545;
    color: #fff;
    padding: 1px 4px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.3px;
    vertical-align: baseline;
    margin-left: 6px;
    line-height: 1;
}

/* Dark mode DSQ badge */
[data-theme="dark"] .dsq-badge {
    background-color: #e74c3c;
    color: #fff;
}

/* Light mode DSQ badge */
[data-theme="light"] .dsq-badge {
    background-color: #dc3545;
    color: #fff;
}

/* Style Bootstrap Icons in position change */
.pos-change-up i,
.pos-change-down i {
    display: inline;
    vertical-align: baseline;
    font-size: 0.85em;
    margin-right: 2px;
    color: inherit;
}

th.pos-change-header,
th.rank-sub {
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    padding: 8px 15px;
    font-size: 0.85em;
}

.no-data {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.no-data h2 {
    margin-bottom: 10px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--border-accent);
    animation: pulse 1.5s ease-in-out infinite;
}

.loading::after {
    content: "...";
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: "."; }
    40% { content: ".."; }
    60%, 100% { content: "..."; }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.footer {
    background: repeating-linear-gradient(
                    0deg,
                    transparent,
                    transparent 40px,
                    var(--header-overlay) 40px,
                    var(--header-overlay) 80px
                ),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 40px,
                    var(--header-overlay) 40px,
                    var(--header-overlay) 80px
                ),
                linear-gradient(135deg, #1e1e1e 0%, #0f0f0f 100%);
    color: white;
    padding: 15px;
    text-align: center;
    position: relative;
    animation: footerFadeIn 0.8s ease-out;
    transition: background 0.3s ease;
}

@keyframes footerFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.footer p {
    margin: 0;
}

.sponsor-logos {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.sponsor-logos a {
    display: inline-block;
    text-decoration: none;
    border: none;
    outline: none;
}

.sponsor-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
    opacity: 1;
    transition: opacity 0.3s ease;
    display: block;
}

.sponsor-logo:hover {
    opacity: 0.9;
}

/* Tablet responsive styles */
@media (min-width: 769px) and (max-width: 992px) {
    .header {
        background-size: cover;
    }
    
    .total-laps {
        width: 50px !important;
        min-width: 50px !important;
        max-width: 50px !important;
        display: table-cell !important;
    }
    
    th.total-laps,
    td.total-laps {
        width: 50px !important;
        min-width: 50px !important;
        max-width: 50px !important;
        display: table-cell !important;
    }
    
    .table-container {
        overflow-x: auto;
    }
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .header {
        padding: 20px 15px;
        /*background-size: contain;
        min-height: auto;*/
    }
    
    
    .theme-toggle {
        top: 10px;
        right: 10px;
        width: 56px;
        height: 28px;
    }
    
    .theme-icon {
        width: 24px;
        height: 24px;
        font-size: 1em;
        transform: translateX(28px);
    }
    
    [data-theme="light"] .theme-icon {
        transform: translateX(0);
    }
    
    .header h1 {
        font-size: 1.8em;
    }
    
    .header h5 {
        font-size: 0.9em;
    }
    
    .nav-tabs {
        padding: 8px 5px 0 5px;
    }
    
    .nav-tabs .nav-link {
        padding: 10px 15px;
        font-size: 0.9em;
    }
    
    .tab-content {
        padding: 15px 10px;
    }
    
    table {
        font-size: 0.8em;
    }
    
    th, td {
        padding: 6px 4px;
    }
    
    .rank, .pos-change {
        width: 35px;
        padding-left: 2px;
        padding-right: 2px;
    }
    
    .rank {
        text-align: center;
    }
    
    .time, .time-loss, .total-laps {
        padding-left: 4px;
        padding-right: 4px;
    }
    
    .total-laps {
        width: 50px !important;
        min-width: 50px !important;
    }
    
    .driver {
        min-width: auto;
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        padding-left: 4px;
        padding-right: 4px;
    }
    
    .driver-stats-table {
        font-size: 0.85em;
    }
    
    .driver-stats-table .driver {
        max-width: none;
        width: auto !important;
        white-space: normal;
        word-wrap: break-word;
        overflow-wrap: break-word;
        line-height: 1.3;
    }
    
    .driver-stats-table .rank {
        width: auto !important;
        min-width: fit-content !important;
    }
    
    .driver-stats-table .time {
        width: auto !important;
        min-width: fit-content !important;
    }
    
    .driver-stats-table .total-laps {
        width: auto !important;
        min-width: fit-content !important;
    }
    
    .driver-stats-summary {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-bottom: 15px;
    }
    
    .stat-item.stat-order-1 { order: 1; }
    .stat-item.stat-order-2 { order: 2; }
    .stat-item.stat-order-3 { order: 3; }
    .stat-item.stat-order-4 { order: 4; }
    .stat-item.stat-order-5 { order: 5; }
    .stat-item.stat-order-6 { order: 6; }
    
    .stat-item {
        padding: 12px 10px;
        border-radius: 4px;
    }
    
    .stat-label {
        font-size: 0.75em;
        margin-bottom: 5px;
    }
    
    .stat-value {
        font-size: 1.1em;
    }
    
    .target-time-table {
        padding: 10px 15px;
        font-size: 0.9em;
    }
    
    .footer {
        padding: 12px;
        font-size: 0.85em;
    }
    
    .sponsor-logos {
        gap: 15px;
        margin-bottom: 12px;
    }
    
    .sponsor-logo {
        height: 35px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    .header {
        padding: 15px 10px;
        /*background-size: contain;
        min-height: auto;*/
    }
    
    
    .theme-toggle {
        top: 8px;
        right: 8px;
        width: 52px;
        height: 26px;
    }
    
    .theme-icon {
        width: 22px;
        height: 22px;
        font-size: 0.9em;
        transform: translateX(26px);
    }
    
    [data-theme="light"] .theme-icon {
        transform: translateX(0);
    }
    
    .header h1 {
        font-size: 1.5em;
    }
    
    .nav-tabs .nav-link {
        padding: 8px 12px;
        font-size: 0.85em;
    }
    
    th, td {
        padding: 5px 2px;
    }
    
    .rank, .pos-change {
        width: 30px;
        padding-left: 1px;
        padding-right: 1px;
    }
    
    .rank {
        text-align: center;
    }
    
    .time, .time-loss, .total-laps {
        padding-left: 3px;
        padding-right: 3px;
    }
    
    .total-laps {
        width: 50px !important;
        min-width: 50px !important;
    }
    
    .driver {
        min-width: auto;
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        padding-left: 3px;
        padding-right: 3px;
    }
    
    .driver-stats-table {
        font-size: 0.8em;
    }
    
    .driver-stats-table .driver {
        max-width: none;
        width: auto !important;
        white-space: normal;
        word-wrap: break-word;
        overflow-wrap: break-word;
        line-height: 1.3;
    }
    
    .driver-stats-table .rank {
        width: auto !important;
        min-width: fit-content !important;
    }
    
    .driver-stats-table .time {
        width: auto !important;
        min-width: fit-content !important;
    }
    
    .driver-stats-table .total-laps {
        width: auto !important;
        min-width: fit-content !important;
    }
    
    .driver-stats-summary {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        margin-bottom: 12px;
    }
    
    .stat-item {
        padding: 6px 8px;
        border-radius: 4px;
    }
    
    .stat-label {
        font-size: 0.7em;
        margin-bottom: 2px;
    }
    
    .stat-value {
        font-size: 0.9em;
    }
}

/* Tabs Row Container */
.tabs-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 15px;
}

/* View Toggle Buttons */
.view-toggle {
    display: inline-flex;
    gap: 5px;
    padding: 5px;
    background: var(--bg-quaternary);
    border-radius: 8px;
    border: 1px solid var(--border-primary);
}

.view-toggle-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.view-toggle-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.view-toggle-btn.active {
    background: var(--border-accent);
    color: var(--text-white);
    font-weight: 600;
}

/* Drop Round Toggle */
.drop-round-toggle {
    display: inline-flex;
    margin-left: 10px;
}

.drop-round-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-accent);
    background: transparent;
    color: var(--text-accent);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.drop-round-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.drop-round-btn.active {
    background: var(--border-accent);
    color: var(--text-white);
    font-weight: 600;
}

.overall-controls-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    width: 100%;
    box-sizing: border-box;
}

.overall-controls-row .drop-round-toggle {
    margin-left: 0;
    margin-top: 0;
}

.overall-controls-row .overall-statistics-jump-btn {
    margin-left: auto;
}

.overall-controls-row--solo {
    justify-content: flex-end;
}

.overall-controls-row--solo .overall-statistics-jump-btn {
    margin-left: 0;
}

/* Dropped Track Indicator */
.dropped-track {
    opacity: 0.5;
    text-decoration: line-through;
}

.dropped-indicator {
    font-size: 0.8em;
    color: var(--text-secondary);
    margin-left: 5px;
}

/* Session Tabs (Qualy, Sprint, Feature, Race) */
.session-tabs {
    display: inline-flex;
    gap: 5px;
    padding: 5px;
    background: var(--bg-quaternary);
    border-radius: 8px;
    border: 1px solid var(--border-primary);
}

.session-tab-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.session-tab-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.session-tab-btn.active {
    background: var(--border-accent);
    color: var(--text-white);
    font-weight: 600;
}

/* Race Results Styles */
.race-section {
    margin-bottom: 30px;
    animation: fadeIn 0.5s ease-out;
}

.race-section-title {
    color: var(--text-primary);
    font-size: 1.4em;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-accent);
}

.race-table-container {
    margin-bottom: 25px;
    animation: tableFadeIn 0.5s ease-out;
    overflow-x: auto;
    border-radius: 8px;
}

.race-table-title {
    color: var(--text-accent);
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 10px;
    padding-left: 5px;
}

/*.race-results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1em;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-primary);
    transition: background 0.3s ease;
    min-width: 520px;
}*/

/*.race-results-table thead {
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    transition: background 0.3s ease;
}*/

/*.race-results-table thead tr:first-child th:first-child {
    border-top-left-radius: 8px;
}

.race-results-table thead tr:first-child th:last-child {
    border-top-right-radius: 8px;
}*/

/*.race-results-table thead th {
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-accent);
    font-weight: 600;
    padding: 12px 10px;
    text-align: center;
    font-size: 0.95em;
}

.race-results-table thead th.driver {
    text-align: left;
}*/

.race-results-table tbody tr {
    transition: background-color 0.2s, transform 0.2s;
    animation: slideInRow 0.4s ease-out backwards;
}

/*.race-results-table tbody tr:nth-child(even) {
    background-color: var(--bg-secondary);
}

.race-results-table tbody tr:nth-child(odd) {
    background-color: var(--bg-tertiary);
}

.race-results-table tbody tr:nth-child(1) {
    background-color: var(--bg-gold);
    font-weight: 600;
}

.race-results-table tbody tr:nth-child(2) {
    background-color: var(--bg-silver);
}

.race-results-table tbody tr:nth-child(3) {
    background-color: var(--bg-bronze);
}

.race-results-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 8px;
}

.race-results-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 8px;
}

.race-results-table tbody td {
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-primary);
    padding: 10px 8px;
    text-align: center;
}

.race-results-table tbody td.driver {
    text-align: left;
    padding-left: 15px;
    min-width: 180px;
}

.race-results-table thead th.driver {
    min-width: 180px;
}

.race-results-table tbody td.rank {
    font-weight: 600;
    color: var(--text-rank);
}

.race-results-table tbody td.time {
    font-weight: 600;
    color: var(--text-time);
}*/

.race-results-table tbody td.time.fastest-lap {
    color: #9633FF;
    font-weight: 700;
}

/*race-results-table .start-pos {
    width: 60px;
    text-align: center;
}*/

.race-results-table .laps-led {
    width: 50px;
    text-align: center;
}

.race-results-table .incidents {
    width: 50px;
    text-align: center;
    color: var(--text-error);
}

.race-results-table .time-loss {
    white-space: nowrap;
    text-align: center;
}

.race-results-table tbody td.time-loss {
    color: var(--text-error);
}

.race-results-table .points {
    white-space: nowrap;
    text-align: center;
}

.race-results-table tbody td.points {
    font-weight: 600;
    color: var(--text-success);
}

.race-results-table .am-points {
    font-weight: 400;
}


/* DNF row styling */
.race-results-table tbody tr.dnf-row {
    opacity: 0.7;
}

.race-results-table tbody tr.dnf-row td {
    color: var(--text-tertiary);
}

.race-results-table tbody tr.dnf-row td.driver {
    color: var(--text-secondary);
}

/* Mobile responsive for race results */
@media (max-width: 768px) {
    .view-toggle {
        flex-wrap: wrap;
        gap: 4px;
        padding: 4px;
    }
    
    .view-toggle-btn {
        padding: 6px 12px;
        font-size: 0.85em;
    }
    
    .session-tabs {
        flex-wrap: wrap;
        gap: 4px;
        padding: 4px;
    }
    
    .session-tab-btn {
        padding: 6px 12px;
        font-size: 0.85em;
    }
    
    .drop-round-toggle {
        margin-left: 0;
        margin-top: 8px;
    }

    .overall-controls-row .drop-round-toggle {
        margin-top: 0;
    }
    
    .drop-round-btn {
        padding: 6px 12px;
        font-size: 0.85em;
    }
    
    .race-section-title {
        font-size: 1.2em;
    }
    
    .race-table-title {
        font-size: 1em;
    }
    
    /*.race-results-table {
        font-size: 0.85em;
    }
    
    .race-results-table thead th,
    .race-results-table tbody td {
        padding: 8px 4px;
    }
    
    .race-results-table tbody td.driver {
        padding-left: 8px;
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }*/
}

@media (max-width: 480px) {
    .view-toggle-btn {
        padding: 5px 10px;
        font-size: 0.8em;
    }
    
    .session-tab-btn {
        padding: 5px 10px;
        font-size: 0.8em;
    }
    
    .drop-round-btn {
        padding: 5px 10px;
        font-size: 0.8em;
    }
    
    /*.race-results-table {
        font-size: 0.75em;
    }
    
    .race-results-table thead th,
    .race-results-table tbody td {
        padding: 6px 3px;
    }
    
    .race-results-table tbody td.driver {
        max-width: 100px;
    }*/
}

/* Overall Tab Styling */
.nav-tabs .nav-link.overall-tab {
    background: linear-gradient(135deg, var(--border-accent) 0%, #003366 100%);
    color: var(--text-white);
    font-weight: 600;
}

.nav-tabs .nav-link.overall-tab:hover {
    background: linear-gradient(135deg, #0077dd 0%, #004488 100%);
}

.nav-tabs .nav-link.overall-tab.active {
    background: linear-gradient(135deg, var(--border-accent) 0%, #003366 100%);
    color: var(--text-white);
    border-color: var(--border-accent);
}

/* Overall Points Table */
/*.overall-table-container {
    animation: fadeIn 0.5s ease-out;
}*/

.overall-table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
}

.overall-points-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
    background: var(--bg-primary);
    transition: background 0.3s ease;
    table-layout: auto;
}

.overall-points-table thead {
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 10;
    transition: background 0.3s ease;
}

.overall-points-table thead tr:first-child th {
    border-bottom: 2px solid var(--border-accent);
    padding: 6px 1px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    white-space: nowrap;
    font-size: 0.85em;
}

.overall-points-table thead tr:first-child th.track-points {
    padding: 6px 0;
}

.overall-points-table thead tr:first-child th.rank {
    text-align: center;
}

.overall-points-table thead tr:first-child th.driver {
    text-align: left;
}

.overall-points-table thead tr:first-child th:first-child {
    border-top-left-radius: 8px;
}

.overall-points-table thead tr:first-child th:last-child {
    border-top-right-radius: 8px;
}

.overall-points-table thead tr.sub-header th {
    padding: 4px 2px;
    font-size: 0.85em;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-primary);
    text-align: center;
    background: var(--bg-tertiary);
}

.overall-points-table thead tr.sub-header th.sub-col {
    width: 22px;
    font-size: 0.8em;
    padding: 4px 1px;
}

.overall-points-table thead tr.sub-header th.sub-col-t {
    font-size: 0.95em;
    width: 32px;
    padding: 4px 2px;
    color: var(--text-primary);
    font-weight: 700;
}

/* Color-coded sub-headers */
.overall-points-table thead tr.sub-header th.sub-col-s {
    color: var(--text-accent);
}

.overall-points-table thead tr.sub-header th.sub-col-f {
    color: var(--text-success);
}

.overall-points-table thead tr.sub-header th.sub-col-t {
    color: var(--text-white);
    font-weight: 700;
}

.overall-points-table tbody tr {
    transition: background-color 0.2s;
    animation: slideInRow 0.4s ease-out backwards;
}

.overall-points-table tbody tr:nth-child(even) {
    background-color: var(--bg-secondary);
}

.overall-points-table tbody tr:nth-child(odd) {
    background-color: var(--bg-tertiary);
}

.overall-points-table tbody tr:nth-child(1) {
    background-color: var(--bg-gold);
    font-weight: 600;
}

.overall-points-table tbody tr:nth-child(2) {
    background-color: var(--bg-silver);
}

.overall-points-table tbody tr:nth-child(3) {
    background-color: var(--bg-bronze);
}

.overall-points-table tbody tr:hover {
    background-color: var(--bg-hover) !important;
}

.overall-points-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 8px;
}

.overall-points-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 8px;
}

.overall-points-table tbody td {
    padding: 6px 2px;
    border-bottom: 1px solid var(--border-primary);
    color: var(--text-primary);
    text-align: center;
    vertical-align: middle;
}

.overall-points-table tbody td.rank {
    font-weight: 600;
    color: var(--text-rank);
    text-align: center;
    width: 40px;
    min-width: 40px;
}

.overall-points-table tbody td.rank.rank-medal {
    text-align: center;
}

.overall-points-table tbody td.driver {
    text-align: left;
    padding-left: 6px;
    min-width: 130px;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.overall-points-table tbody td.track-points {
    width: 22px;
    font-size: 0.8em;
    padding: 6px 1px;
}

.overall-points-table tbody td.track-points.track-total-pts {
    font-size: 0.9em;
    width: 32px;
    padding: 6px 2px;
}

/* Better width for track columns in teams table (showing totals only) */
.team-row td.track-points {
    width: 50px;
    min-width: 50px;
    font-size: 0.95em;
    font-weight: 500;
    color: var(--text-primary);
    padding: 6px 4px;
}

/* Better width for track column headers when teams table is shown */
.overall-points-table:has(.team-row) thead tr:first-child th.track-points {
    width: 50px;
    min-width: 50px;
    padding: 6px 2px;
}

.overall-points-table tbody td.track-points.sprint-pts {
    color: var(--text-accent);
    font-weight: 500;
}

.overall-points-table tbody td.track-points.feature-pts {
    color: var(--text-success);
    font-weight: 500;
}

.overall-points-table tbody td.track-points.track-total-pts {
    color: var(--text-primary);
    font-weight: 700;
    border-right: 1px solid var(--border-accent);
}

.overall-points-table tbody td.total-points {
    font-weight: 700;
    font-size: 1em;
    color: var(--text-white);
    min-width: 40px;
    width: 40px;
    background: linear-gradient(135deg, var(--border-accent) 0%, #003366 100%);
    border-left: 2px solid var(--border-accent);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    padding: 6px 4px;
}

/* Total column header styling */
.overall-points-table thead tr:first-child th.total-header {
    background: linear-gradient(135deg, var(--border-accent) 0%, #003366 100%);
    color: var(--text-white);
    font-weight: 700;
    border-left: 2px solid var(--border-accent);
    min-width: 40px;
    width: 40px;
    padding: 8px 4px;
}

.overall-points-table thead tr:first-child th.championship-gap-header {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.85em;
    min-width: 38px;
    width: 42px;
    padding: 8px 4px;
    border-left: 1px solid var(--border-primary);
}

.overall-points-table tbody td.gap-to-p1 {
    font-weight: 600;
    font-size: 0.9em;
    color: var(--text-secondary);
    min-width: 38px;
    width: 42px;
    padding: 6px 4px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-primary);
}


/* Mobile responsive for overall table */
@media (max-width: 768px) {
    .overall-points-table {
        font-size: 0.8em;
    }
    
    .overall-points-table thead tr:first-child th {
        padding: 6px 2px;
    }
    
    .overall-points-table thead tr.sub-header th {
        padding: 3px 1px;
        font-size: 0.75em;
    }
    
    .overall-points-table thead tr.sub-header th.sub-col {
        min-width: 24px;
        width: 24px;
    }
    
    .overall-points-table tbody td {
        padding: 5px 1px;
    }
    
    .overall-points-table tbody td.driver {
        min-width: 100px;
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .overall-points-table tbody td.track-points {
        min-width: 24px;
        width: 24px;
        font-size: 0.85em;
        padding: 5px 1px;
    }
    
    /* Teams table track columns on tablet */
    .team-row td.track-points {
        width: 40px;
        min-width: 40px;
        font-size: 0.9em;
        padding: 5px 2px;
    }
    
    .overall-points-table:has(.team-row) thead tr:first-child th.track-points {
        width: 40px;
        min-width: 40px;
    }
    
    .overall-points-table tbody td.total-points {
        min-width: 35px;
        width: 35px;
        font-size: 0.95em;
    }
    
    .overall-points-table tbody td.gap-to-p1 {
        min-width: 32px;
        width: 34px;
        font-size: 0.85em;
    }
}

@media (max-width: 480px) {
    .overall-points-table {
        font-size: 0.7em;
    }
    
    .overall-points-table thead tr:first-child th {
        padding: 5px 1px;
    }
    
    .overall-points-table thead tr.sub-header th {
        padding: 2px 1px;
        font-size: 0.7em;
    }
    
    .overall-points-table thead tr.sub-header th.sub-col {
        min-width: 20px;
        width: 20px;
    }
    
    .overall-points-table tbody td {
        padding: 4px 1px;
    }
    
    .overall-points-table tbody td.driver {
        min-width: 80px;
        max-width: 100px;
    }
    
    .overall-points-table tbody td.track-points {
        min-width: 20px;
        width: 20px;
        font-size: 0.8em;
        padding: 4px 1px;
    }
    
    /* Teams table track columns on mobile */
    .team-row td.track-points {
        width: 35px;
        min-width: 35px;
        font-size: 0.85em;
        padding: 4px 2px;
    }
    
    .overall-points-table:has(.team-row) thead tr:first-child th.track-points {
        width: 35px;
        min-width: 35px;
    }
    
    .overall-points-table tbody td.total-points {
        min-width: 30px;
        width: 30px;
        font-size: 0.85em;
    }
    
    .overall-points-table tbody td.gap-to-p1 {
        min-width: 28px;
        width: 30px;
        font-size: 0.8em;
    }
}

/* Stats tab */
.stats-page {
    padding: 0.5rem 0 1.5rem;
    max-width: 900px;
    margin: 0 auto;
}

.stats-page-title {
    font-size: 1.35rem;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
}

.stats-section {
    margin-bottom: 2rem;
}

.stats-section-title {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--text-accent);
    border-bottom: 1px solid var(--border-primary);
    padding-bottom: 0.35rem;
}

.stats-subtitle {
    font-size: 0.95rem;
    margin: 1rem 0 0.5rem;
    color: var(--text-secondary);
}

.stats-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 0.75rem 1rem;
}

.stat-card-wide {
    grid-column: 1 / -1;
}

@media (min-width: 600px) {
    .stat-card-wide {
        grid-column: span 2;
    }
}

.stat-card-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
    margin-bottom: 0.35rem;
}

.stat-card-value {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stat-card-small {
    font-size: 0.95rem;
    font-weight: 500;
}

.stat-card-hint {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 0.35rem;
    line-height: 1.35;
}

.stat-leader {
    margin-top: 0.25rem;
}

.stat-leader-name {
    font-weight: 600;
    color: var(--text-primary);
}

.stat-leader-pts {
    color: var(--text-accent);
    margin-left: 0.35rem;
}

.stat-gap {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.35rem;
}

.stats-muted {
    color: var(--text-tertiary);
    font-size: 0.95rem;
}

.stats-movers-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 1rem 0 0.35rem;
}

.stats-movers-list {
    margin: 0;
    padding-left: 1.25rem;
    color: var(--text-primary);
    line-height: 1.5;
}

.stats-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
}

.stats-mini-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.stats-mini-table th,
.stats-mini-table td {
    padding: 0.5rem 0.65rem;
    text-align: left;
    border-bottom: 1px solid var(--border-primary);
}

.stats-mini-table th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
}

.stats-sort-th {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    color: inherit;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    text-decoration: underline;
    text-decoration-color: transparent;
}

.stats-sort-th:hover,
.stats-sort-th:focus-visible {
    color: var(--text-accent);
    text-decoration-color: var(--text-accent);
    outline: none;
}

.stats-mini-table tbody tr:last-child td {
    border-bottom: none;
}

.stats-chart-wrap {
    height: 360px;
    max-width: 100%;
    background: var(--bg-chart);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 0.85rem;
}

.stats-charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-top: 0.5rem;
}

.stats-chart-card-title {
    font-size: 0.95rem;
    margin: 0 0 0.5rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.stats-chart-wrap--tall {
    height: 440px;
}

@media (max-width: 960px) {
    .stats-chart-wrap {
        height: 320px;
    }

    .stats-chart-wrap--tall {
        height: 360px;
    }
}

.overall-stats-embed {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-primary);
}

.stats-practice-lede {
    margin-bottom: 0.75rem;
}

.stats-practice-table th,
.stats-practice-table td {
    vertical-align: top;
}

.stats-practice-track {
    max-width: 200px;
    word-wrap: break-word;
}

.stats-spread-cell {
    font-size: 0.82rem;
    line-height: 1.35;
    white-space: normal;
    vertical-align: top;
    min-width: 6.5rem;
}

.stats-practice-detail {
    font-size: 0.85rem;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .stats-practice-detail {
        white-space: normal;
    }
}

