/* CSS Custom Properties / Variables */
:root {
    --accent-primary: #FF6600; /* F1 Orange */
    --accent-secondary: #DC2626; /* Red */
    --accent-tertiary: #2563EB; /* Blue 600 - more vibrant */
    --bg-light: #FFFFFF; /* Pure White */
    --bg-medium: #F3F4F6; /* Gray 100 */
    --bg-lightest: #FFFFFF; /* White */
    --text-light: #4B5563; /* Gray 600 - darker for better contrast */
    --text-lightest: #FFFFFF; /* White */
    --text-muted: #6B7280; /* Gray 500 - less muted */
    --border-color: #E5E7EB; /* Gray 200 */
}

/* Who Has You? tooltip: body font, normal size, white text (not header font) */
#matchups-root .who-has-you-tooltip {
    font-family: ui-sans-serif, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;
    font-size: 14px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    color: #fff !important;
    background: #1a1a1a !important;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
#matchups-root .who-has-you-tooltip::after {
    border-color: #1a1a1a transparent transparent transparent;
}

/* Player row tooltips: full opacity when row is grayed (highlighted-common) so text stays readable */
.driver-row.highlighted-common .tooltip-content,
.constructor-row.highlighted-common .tooltip-content {
    opacity: 1 !important;
    background: #1a1a1a !important;
    color: #fff !important;
}
.driver-row.highlighted-common .tooltip-content::after,
.constructor-row.highlighted-common .tooltip-content::after {
    border-color: #1a1a1a transparent transparent transparent;
}

/* Restore native dropdown carets (overrides fm_theme / global appearance:none) */
#matchups-root select,
.fm-league select {
    appearance: auto !important;
    -webkit-appearance: menulist !important;
    -moz-appearance: menulist !important;
}

/* Custom "anchored" round selector: list overlays so current row lines up with the trigger */
.round-select-custom {
    position: relative;
    z-index: 2;
}
.round-select-custom.round-select-is-open {
    z-index: 10050;
}
.round-select-panel {
    position: fixed;
    z-index: 10051;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-y: auto;
    overflow-x: hidden;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.2);
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
.round-select-custom .round-select-chevron {
    transition: transform 0.15s ease;
    flex-shrink: 0;
}
.round-select-custom.round-select-is-open .round-select-chevron {
    transform: rotate(180deg);
}
.round-select-option {
    display: flex;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    padding: 0.5rem 0.75rem;
    min-height: var(--round-select-row-height, 2.75rem);
    font-size: 1rem;
    line-height: 1.35;
    white-space: normal;
    word-break: break-word;
    color: #1f2937;
    background: #fff;
    border: none;
    /* Inset shadow avoids extra layout height vs. borders (keeps row grid aligned to trigger). */
    box-shadow: inset 0 -1px 0 #f3f4f6;
    cursor: pointer;
    font-family: inherit;
}
.round-select-option:last-child {
    box-shadow: none;
}
.round-select-option:hover,
.round-select-option:focus {
    background: #eff6ff;
    outline: none;
}
.round-select-option.is-current {
    background: #2563eb;
    color: #fff;
}
.round-select-option.is-current:hover,
.round-select-option.is-current:focus {
    background: #1d4ed8;
    color: #fff;
}

/* Matchup page container improvements */
.container.mx-auto.px-4.py-8 {
    max-width: 1400px;
    padding: 2rem;
}

/* Layout for matchup cards - responsive grid */
.matchup-grid-flex {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 370px));
    gap: 15px;
    margin-top: 2rem;
    justify-content: center;
}

.matchup-block {
    background-color: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    width: 100%;
    max-width: 475px;
    min-width: 300px;
    box-sizing: border-box;
    padding: 1rem;
    margin-bottom: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s ease;
    color: #6b7280; /* text-gray-600 equivalent */
}

.matchup-block:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Ensure team logos are perfectly square and not squished */
.team-column img,
.team-column .h-24 {
    width: 96px !important;
    height: 96px !important;
    object-fit: cover;
    border-radius: 5px;
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
}

@media (max-width: 640px) {
    .container.mx-auto.px-4.py-8 {
        padding: 1rem;
    }
    .matchup-grid-flex {
        gap: 1.5rem;
    }
}

/* Enhanced Turbo/Mega Driver Styling */
.turbo-driver-indicator {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 9px;
    font-weight: bold;
    color: white;
    margin-left: -17px;
}

.mega-driver-indicator {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 9px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: bold;
    color: white;
    margin-left: -17px;
    z-index: 1;
}

/* Rotated badges */
.rotated-badge {
    transform: rotate(-90deg);
    transform-origin: center;
}

/* Row backgrounds */
.driver-row, .constructor-row {
    background-color: #f3f4f6; /* gray-100 */
    transition: background-color 0.2s ease;
}

/* Special gradient backgrounds for turbo and mega drivers */
.driver-row.turbo-driver-row {
    background: linear-gradient(to right, #8B5CF6 0%, #f9fafb 80%, #f9fafb 100%);
    border: 2px solid #8B5CF6;
    border-radius: 6px;
    box-sizing: border-box;
    animation: turbo-pulse 1s infinite;
    color: white;
}

.driver-row.mega-driver-row {
    background: linear-gradient(to right, #EC4899 0%, #f9fafb 80%, #f9fafb 100%);
    border: 2px solid #EC4899;
    border-radius: 6px;
    box-sizing: border-box;
    animation: mega-pulse 1s infinite;
    color: white; /* Ensure text is readable on colored background */
}

.driver-row.final-fix-row {
    background: linear-gradient(to right, var(--accent-primary) 0%, #f9fafb 80%, #f9fafb 100%);
    border: 2px solid var(--accent-primary);
    border-radius: 6px;
    box-sizing: border-box;
    animation: mega-pulse 1s infinite;
    color: white; /* Ensure text is readable on colored background */
margin: 0px;
    padding: 0px;
}


@keyframes turbo-pulse {
    0%, 100% { box-shadow: 0 2px 4px rgba(139, 92, 246, 0.3); }
    50% { box-shadow: 0 2px 8px rgba(139, 92, 246, 0.6), 0 0 16px rgba(139, 92, 246, 0.2); }
}

@keyframes mega-pulse {
    0%, 100% { box-shadow: 0 2px 4px rgba(220, 38, 38, 0.3); }
    50% { box-shadow: 0 2px 8px rgba(233, 27, 199, 0.6), 0 0 16px rgba(220, 38, 38, 0.2); }
}

/* Player row tooltips - applied to entire row */
.player-row-tooltip {
    position: relative;
    cursor: help;
}

.player-row-tooltip .tooltip-content {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 100%;
    right: 8px; /* Align tooltip above the score */
    transform: translateY(-5px);
    background: #1a1a1a;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 2000 !important;
    transition: opacity 0.3s, visibility 0.3s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    pointer-events: none;
    filter: none !important;
    text-align: right;
    /* Force tooltip isolation from parent effects */
    contain: layout style paint;
    isolation: isolate;
}

.player-row-tooltip .tooltip-content::after {
    content: "";
    position: absolute;
    top: 100%;
    right: 12px; /* Align arrow with score position */
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: #1a1a1a transparent transparent transparent;
}

.player-row-tooltip:hover .tooltip-content {
    visibility: visible;
    opacity: 1;
}

/* Tooltip title chip inside content */
.tooltip-content .tooltip-title {
    display: inline-block;
    border-radius: 3px;
    padding: 0px 4px;
    font-weight: 700;
    margin-bottom: 4px;
}



/* NEW sticker positioning over badge for horizontal lineups*/
.new-sticker {
    position: absolute;
    left: -5px;
    top: -10px;
    background: #ffeb3b;
    color: #d7263d;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 1px 4px;
    border-radius: 2px;
    transform: rotate(-12deg);
    z-index: 7;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
    width: fit-content;
    padding-right: 1px;
}

/* Ensure proper layout alignment */
.driver-row, .constructor-row {
    min-height: 28px;
    max-height: 36px;
}

/* Team lineup containers should not have overflow issues */
.team-lineup {
    position: relative;
    z-index: 1;
}

/* Ensure tooltips appear above everything */
.player-row-tooltip:hover {
    z-index: 2000 !important;
}

.player-row-tooltip:hover .tooltip-content {
    z-index: 9999 !important;
}

/* Enhanced player row styling */
.driver-row, .constructor-row {
    transition: all 0.2s ease;
    padding: 0.25rem 0.5rem; /* Reduce horizontal padding */
}

/* Checkbox and controls styling */
.form-checkbox {
    width: 1rem;
    height: 1rem;
    border-radius: 0.25rem;
    border: 2px solid #d1d5db;
    background-color: #ffffff;
    transition: all 0.15s ease-in-out;
}

.form-checkbox:checked {
    background-color: #2563eb;
    border-color: #2563eb;
}

.form-checkbox:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

/* Fix logo aspect ratio on mobile */
@media (max-width: 640px) {
    .h-24.w-24 {
        min-width: 6rem;
        aspect-ratio: 1;
        object-fit: cover;
    }
}

.driver-row:hover, .constructor-row:hover {
    background-color: #545454 !important;
    transform: translateX(2px);
}

/* Round Navigation Container */
.round-navigation-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    overflow: visible;
}

/* Arrow Navigation Buttons */
.round-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.round-arrow:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: var(--text-lightest);
    transform: translateY(-50%) scale(1.1);
}

.round-arrow.hidden {
    opacity: 0;
    pointer-events: none;
}

.round-arrow-left {
    left: 10px;
}

.round-arrow-right {
    right: 10px;
}

.round-arrow svg {
    width: 16px;
    height: 16px;
}

/* Round navigation wrapper - ensure arrow visibility */
.w-full.overflow-x-auto.mb-4.round-navigation {
    overflow-y: visible !important;
    overflow-x: auto !important;
    padding-bottom: 15px !important;
    max-width: 100%;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
}

/* Round Navigation List */
.round-navigation {
    scroll-behavior: smooth;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
    padding: 0 60px 0 60px; /* Space for arrows, no bottom padding that could interfere */
    margin-left: auto;
    margin-right: auto;
    display: inline-flex;
    justify-content: center;
    overflow: visible; /* Ensure arrow is visible */
    max-width: calc(100% - 20px); /* Prevent overflow beyond container with some margin */
    box-sizing: border-box;
}

.round-navigation::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* Round Navigation Items */
.round-link {
    text-decoration: none;
    margin: 0 4px;
    border-radius: 5px;
    border: 2px solid #fff; /* White border for all */
    font-weight: 500;
    font-size: 13px;
    transition: all 0.3s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    line-height: 1;
    height: 28px;
    position: relative;
    min-width: 40px;
    text-align: center;
    box-shadow: none;
}

.round-link.round-current,
.round-link.round-selected,
.round-link:hover {
    border: 2px solid var(--accent-tertiary) !important;
    box-shadow: 0 0 0 3px #fff, 0 2px 8px rgba(0, 162, 255, 0.15);
    z-index: 2;
}

.round-link.round-current {
    background: var(--accent-tertiary);
    color: var(--text-lightest);
    font-weight: 600;
    position: relative;
}

/* Debug: Show all round link classes */
.round-link::before {
    content: attr(class);
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    color: #fff;
    padding: 2px 4px;
    font-size: 8px;
    border-radius: 2px;
    white-space: nowrap;
    z-index: 10000;
}

/* Floating "CURRENT ROUND" indicator above current round */
.round-link.round-current::after {
    content: "CURRENT\A ROUND";
    position: absolute;
    top: -45px;
    left: 50%;
    transform: translateX(-50%);
    color: #dc2626;
    font-size: 8px;
    font-weight: bold;
    text-align: center;
    line-height: 1.1;
    white-space: pre;
    z-index: 1000;
    pointer-events: none;
}

/* Rotated arrow pointing down to current round */
.round-link.round-current::before {
    content: "";
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%) rotate(180deg);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 10px solid #dc2626;
    z-index: 1000;
    pointer-events: none;
}

/* Active round class for the round being viewed */
.round-link.round-active {
    background: #fbbf24 !important;
    color: #000 !important;
    font-weight: 700;
    border: 2px solid #f59e0b !important;
    box-shadow: 0 0 0 3px #fff, 0 2px 8px rgba(251, 191, 36, 0.3) !important;
}

/* Playoff rounds styling */
.round-link.round-playoff {
    color: #dc2626 !important;
    font-weight: 600;
}

.round-link.round-playoff.round-current {
    background: #dc2626 !important;
    color: white !important;
}

.round-link.round-playoff.round-past {
    background: #fecaca;
    color: #dc2626 !important;
    border: 2px solid #fecaca;
}

.round-link.round-playoff.round-future {
    background: var(--bg-lightest);
    color: #dc2626 !important;
    border: 2px solid #dc2626;
}

.round-link.round-selected {
    background: var(--bg-medium);
    color: var(--text-light);
    font-weight: 600;
}

.round-link.round-past {
    background: var(--bg-medium);
    color: var(--text-light);
    font-weight: 600;
    border: 2px solid var(--text-light);
}

.round-link.round-future {
    background: var(--bg-lightest);
    color: var(--text-muted);
    border: 2px solid var(--text-muted);
}

/* Progress bar container fix: ensure it matches the width of the round buttons */
.round-navigation-bar-bg {
    position: absolute;
    left: 0; right: 0; top: 50%;
    transform: translateY(-50%);
    height: 8px;
    width: 100%;
    background: #e5e7eb;
    border-radius: 4px;
    z-index: 0;
    pointer-events: none;
}
.round-navigation-bar-fill {
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    height: 8px;
    background: var(--accent-tertiary);
    border-radius: 4px;
    z-index: 1;
    pointer-events: none;
    transition: width 0.3s;
}

/* Round Navigation Centering */
.round-navigation {
    scroll-behavior: smooth;
}

/* Custom scrollbar for round navigation */
.round-navigation::-webkit-scrollbar {
    height: 6px;
}

.round-navigation::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.round-navigation::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.round-navigation::-webkit-scrollbar-thumb:hover {
    background: #555;
}






/* ===================================================
   Custom CSS for the Matchups / Results page
   =================================================== */

   
    .team-name {
        font-size: 0.9rem; /* Smaller base font size */
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Narrow sans-serif – full team names (capped at 24 chars), no truncation */
    .team-name.team-name-narrow,
    .team-name-narrow {
        font-family: 'Barlow Condensed', sans-serif;
        font-size: 13px;
        font-weight: 600;
        letter-spacing: 0.01em;
        max-width: 100%;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: unset !important;
        word-break: break-word;
    }

    /* Responsive font sizing based on team name length (legacy classes kept for BYE etc) */
    .team-name-long {
        font-size: 0.8rem;
    }
    .team-name-very-long {
        font-size: 0.75rem;
    }
    
    /* Make sure VS stays in center */
    .matchup-container {
        display: flex;
        justify-content: center;
        gap: 0px;
        padding: 1rem 0;
    }
    
    .team-column {
        flex: 1 1 0;
        text-align: center;
        align-items: flex-start;
        min-width: 0;
            padding: 0.5rem 0.5rem;
    }
    
    .vs-column {
        flex: 0 0 auto;
        min-width: 60px;
        text-align: center;
        margin: 0 1rem;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: bold;
        font-size: 1.8rem;
        color: var(--text-muted);
    }

    /* Grayed look via badge styling only; no opacity on row so tooltips stay full opacity */
    .highlighted-common {
        filter: none !important;
        opacity: 1 !important;
        background: none !important;
   }
    
    /* Ensure all badge elements in highlighted rows have consistent gray appearance */
    .highlighted-common .mobile-badge-d,
    .highlighted-common .mobile-badge-c, 
    .highlighted-common .badge-driver,
    .highlighted-common .badge-constructor {
        background: #9ca3af !important; /* Use background instead of background-color to override gradient */
        color: #374151 !important; /* Dark gray text */
        filter: none !important; /* Override any other filters */
        border-color: #9ca3af !important; /* Match border to background */
    } 

/* Gray only the badges in common rows so tooltips stay crisp */
.driver-row.highlighted-common .driver-badge,
.driver-row.highlighted-common .mobile-badge-d,
.driver-row.highlighted-common .badge-driver,
.constructor-row.highlighted-common .constructor-badge,
.constructor-row.highlighted-common .mobile-badge-c,
.constructor-row.highlighted-common .badge-constructor {
    background: none !important; /* Use background instead of background-color to override gradient */
    color: #95a0ad !important;
    border-color: #95a0ad !important;
    border-style: dashed !important;
    border-width: 2px;
    filter: none !important;
    opacity: 1 !important;
}

.highlighted-common .driver-badge span,
.highlighted-common .constructor-badge span {
    color: inherit !important;
}


    .badge-wrapper { position: relative; display: inline-block; }

    .rank-badge {
        position: absolute;
        top: -12px;
        left: -15px;
        background: #fff;
        color: #000;
        width: 26px;
        height: 26px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 11px;
        font-weight: 600;
        box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
        border-radius: 10px;
        border-color: #101827;
        border-width: 2px;
    }

    /* Seed badge for playoff rounds - orange with white text */
    .seed-badge-matchup {
        position: absolute;
        top: -6px;
        right: -6px;
        background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
        color: #fff;
        width: 28px;
        height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 12px;
        font-weight: 800;
        box-shadow: 0 2px 6px rgba(249, 115, 22, 0.4);
        border-radius: 50%;
        border: 2px solid #fff;
        z-index: 10;
    }

    .team-column.winner-side {
        background: #e0f2fe;
        border-radius: 8px;
        animation: winner-pulse 2s ease-in-out;
    }

    @keyframes winner-pulse {
        0% { box-shadow: 0 0 0 0 rgba(96,165,250,0.7); }
        70% { box-shadow: 0 0 0 10px rgba(96,165,250,0); }
        100% { box-shadow: 0 0 0 0 rgba(96,165,250,0); }
    }

    .team-column.loser-side {
        background: #f3f4f6;
        border-radius: 8px;
    }

    .team-column.leader-side {
        background: #fef3c7;
        border-radius: 8px;
    }

    .team-column.tie-side {
        background: #1b2231;
        border-radius: 8px;
        border: 2px solid #764b03;
        animation: tie-pulse 2s ease-in-out;
    }

    @keyframes tie-pulse {
        0% { box-shadow: 0 0 0 0 rgba(245,158,11,0.7); }
        70% { box-shadow: 0 0 0 10px rgba(245,158,11,0); }
        100% { box-shadow: 0 0 0 0 rgba(245,158,11,0); }
    }

    .result-indicator {
        display: inline-block;
        margin-top: 4px;
        padding: 2px 6px;
        border-radius: 4px;
        font-weight: 600;
        font-size: 0.75rem;
    }

    .result-indicator.winner {
        background: #3b82f6;
        color: #fff;
    }

    .result-indicator.loser { display:none; }

    .result-indicator.tie {
        background: #fcc25f;
        color: #000;
    }

    .result-indicator.leader {
        background: #FACC15;
        color: #000000;
    }
    .drivers-constructors-gap { height: 2.2rem; } /* Increased gap for clarity */
    .chip-announcement {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin-bottom: 0.5rem !important;
        min-height: 2.2rem !important;
        width: 100% !important;
    }

    .penalty-announcement-inner {
        background-color: #dc2626;
        color: #fff;
        padding: 2px 6px;
        border-radius: 4px;
        font-weight: bold;
        font-size: 14px;
    }

    .chip-announcement-inner {
        font-weight: bold !important;
        font-size: 14px !important;
        border-radius: 1.2rem !important;
        box-shadow: 0 2px 8px rgba(124, 58, 237, 0.12) !important;
        letter-spacing: 0px !important;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.10) !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        animation: none !important;
        position: relative !important;
    }

    .chip-effect {
        margin-left: 0.5rem !important;
        font-size: 12px !important;
        font-weight: 700 !important;
        display: inline-flex !important;
        align-items: center !important;
    }

    @keyframes pop-chip {
        0% { transform: scale(0.7); opacity: 0; }
        80% { transform: scale(1.1); opacity: 1; }
        100% { transform: scale(1); }
    }

    /* Ping animation for chips */
    .chip-ping {
        animation: ping-animation 1.5s cubic-bezier(0, 0, 0.2, 1) infinite !important;
    }

    @keyframes ping-animation {
        0% {
            transform: scale(1);
            opacity: 1;
        }
        75%, 100% {
            transform: scale(1.5);
            opacity: 0;
        }
    }

@media (max-width: 1024px) {
  .matchup-grid-flex {
    grid-template-columns: repeat(auto-fit, minmax(300px, 425px));
    gap: 1rem;
  }
  .matchup-block {
    min-width: 300px;
    max-width: 425px;
    width: 100%;
    margin-bottom: 1.5rem;
  }
  .matchup-container {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0 !important;
  }
    .team-column, .vs-column { width:auto !important; min-width:0 !important; text-align:center !important; margin-bottom:0 !important; display:block !important; }
  .vs-column {
    order: 2;
    margin: 0 0.5rem;
  }
  .team-column:first-of-type {
    order: 1;
  }
  .team-column:last-of-type {
    order: 3;
  }
}
@media (max-width: 640px) {
  .container.mx-auto.px-4.py-8 {
    padding: 0.5rem !important;
  }
  .matchup-grid-flex {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .matchup-block {
    min-width: 100% !important;
    max-width: 100% !important;
    width: 100% !important;
    margin-bottom: 1.25rem !important;
    padding: 0.5rem !important;
    border-radius: 4px !important;
    box-sizing: border-box;
  }
  .matchup-container {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0 !important;
  }
  .team-column, .vs-column {
    width: auto !important;
    min-width: 0 !important;
    text-align: center !important;
    margin-bottom: 0 !important;
    display: block !important;
  }
  .vs-column {
    order: 2;
    margin: 0 0.5rem;
  }
  .team-column:first-of-type {
    order: 1;
  }
  .team-column:last-of-type {
    order: 3;
  }
  .team-name, .team-name-long, .team-name-very-long {
    max-width: 100% !important;
    word-break: break-word !important;
  }
  .mobile-badge-d, .mobile-badge-c {
    margin-right: 0.3rem !important;
  }
  .drivers-constructors-gap {
    height: 1.2rem !important;
  }
  /* Smaller logos on mobile but still square */
  .team-column img,
  .team-column .h-24 {

    aspect-ratio: 1 / 1;
  }
}


/* --- Responsive Matchup Grid (unified with above) --- */
@media (max-width: 900px) {
    .matchup-grid-flex { 
        grid-template-columns: repeat(auto-fit, minmax(280px, 380px));
        gap: 1rem; 
    }

  /* Better mobile typography - badges only now */
  
  /* Mobile-friendly indicators */
  .turbo-driver-indicator,
  .mega-driver-indicator {
    min-width: 20px;
    height: 18px;
  }
  
  /* Adjust mobile badge sizes */
  .mobile-badge-d,
  .mobile-badge-c {
    min-width: 32px;
    padding: 2px 4px;
  }
}

@media (max-width: 600px) {
  .vs-column p {
    font-size: 1.5rem;
  }
  
  /* Compact spacing on very small screens */
  .driver-row,
  .constructor-row {
    padding: 0.5rem;
    gap: 0.25rem;
  }
  
  .mobile-badge-d,
  .mobile-badge-c {
    min-width: 28px;
   }
}
@media (max-width: 640px) {
    .matchup-grid-flex { gap:0.75rem; }
  .matchup-container {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0 !important;
  }
  .team-column, .vs-column {
    width: auto !important;
    min-width: 0 !important;
    text-align: center !important;
    margin-bottom: 0 !important;
    display: block !important;
  }
  .vs-column {
    order: 2;
    margin: 0 0.5rem;
  }
  .team-column {
    order: 1;
  }
}

/* Round navigation styling */
.round-navigation { padding:0 0 12px 0; overflow-x:auto !important; -webkit-overflow-scrolling:touch; }
.round-navigation-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 0;
    max-width: 100%;
}
.round-link-container {
    gap: 0.25rem;
    flex-wrap: nowrap;
    justify-content: center;
}

/* Score wrapper & backgrounds for clarity on narrow widths */
.vs-column .score-wrapper { display:flex; flex-direction:column; align-items:center; gap:0.2rem; }
/* .vs-separator styling now handled by Tailwind classes in template */
.team-a-score, .team-b-score { font-size:1.5rem; font-weight:700; line-height:1; padding:2px 6px; border-radius:6px; display:inline-block; min-width:48px; text-align:center; }
.score-winner { background:#3b82f6; color:#fff; }
.score-loser { background:#9ca3af; color:#fff; }
.score-leader { background:#f59e0b; color:#fff; }
.score-tie { background:#fbbf24; color:#ffffff; }

/* Winning margin display */
.winning-margin {
    font-size: 0.75rem;
    font-weight: 500;
    text-align: left;
    margin-top: 0.25rem;
    opacity: 0.8;
}

/* Responsive adjustments for winning margin */
@media (max-width: 640px) {
    .winning-margin {
        font-size: 0.65rem;
        margin-top: 0.2rem;
    }
}

/* Chip effect displays */
.chip-savings-display,
.chip-comparison-display,
.chip-multiplier-display {
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

/* Responsive adjustments for chip displays */
@media (max-width: 640px) {
    .chip-savings-display,
    .chip-comparison-display,
    .chip-multiplier-display {
        font-size: 0.7rem;
        gap: 0.2rem;
    }
}

/* --- Dark-theme overrides for the detailed matchup breakdown (team page) ---
   The matchup breakdown template historically used Tailwind utility classes like
   bg-white / bg-gray-50 for row striping. On the dark theme, these read as bright
   blocks. We override them *only* inside .matchup-detail.
*/
.matchup-detail .bg-white { background-color: rgb(15 23 42) !important; }         /* slate-900 */
.matchup-detail .bg-gray-50 { background-color: rgb(2 6 23 / 0.65) !important; } /* slate-950/65 */
.matchup-detail .border-gray-200 { border-color: rgb(51 65 85) !important; }     /* slate-700 */
.matchup-detail .border-gray-100 { border-color: rgb(30 41 59) !important; }     /* slate-800 */
.matchup-detail .text-gray-900 { color: rgb(241 245 249) !important; }           /* slate-100 */
.matchup-detail .text-gray-800 { color: rgb(226 232 240) !important; }           /* slate-200 */
.matchup-detail .text-gray-700 { color: rgb(203 213 225) !important; }           /* slate-300 */
.matchup-detail .text-gray-600 { color: rgb(148 163 184) !important; }           /* slate-400 */
.matchup-detail .text-gray-500 { color: rgb(148 163 184) !important; }           /* slate-400 */
.matchup-detail .text-gray-400 { color: rgb(100 116 139) !important; }           /* slate-500 */

/* Dark background: highlighted (common) rows and their badges use light gray text */
.matchup-detail .highlighted-common,
.matchup-detail .driver-row.highlighted-common,
.matchup-detail .constructor-row.highlighted-common {
    color: rgb(203 213 225) !important; /* slate-300 light gray */
}
.matchup-detail .highlighted-common .mobile-badge-d,
.matchup-detail .highlighted-common .mobile-badge-c,
.matchup-detail .highlighted-common .badge-driver,
.matchup-detail .highlighted-common .badge-constructor,
.matchup-detail .driver-row.highlighted-common .driver-badge,
.matchup-detail .driver-row.highlighted-common .mobile-badge-d,
.matchup-detail .constructor-row.highlighted-common .constructor-badge,
.matchup-detail .constructor-row.highlighted-common .mobile-badge-c {
    color: rgb(203 213 225) !important;
    border-color: rgb(148 163 184) !important;
}
.matchup-detail .highlighted-common .driver-badge span,
.matchup-detail .highlighted-common .constructor-badge span {
    color: rgb(203 213 225) !important;
}

