/* F1 上海站 AI 观赛助手 - Styles v4 */
/* AWS x F1 branded, animated */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'DM Sans', sans-serif;
    background: #000000;
    color: #ffffff;
    overflow-x: hidden;
    position: relative;
}

html { scroll-behavior: smooth; }

/* ===== BACKGROUND EFFECTS ===== */

/* Grid lines - checkered flag feel */
.bg-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(0, 128, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 128, 255, 0.04) 1px, transparent 1px);
    background-size: 50px 50px;
}

/* Rotating sweep light */
.bg-sweep {
    position: fixed;
    inset: -50%;
    z-index: 0;
    pointer-events: none;
    background: conic-gradient(
        from 0deg at 50% 50%,
        transparent 0deg,
        rgba(0, 128, 255, 0.04) 15deg,
        transparent 30deg,
        transparent 180deg,
        rgba(255, 153, 0, 0.02) 195deg,
        transparent 210deg
    );
    animation: sweepRotate 25s linear infinite;
}

@keyframes sweepRotate {
    to { transform: rotate(360deg); }
}

/* Ambient glow spots */
.bg-glow-blue {
    position: fixed;
    top: 10%;
    right: 10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(0, 128, 255, 0.06) 0%, transparent 70%);
    z-index: 0;
    pointer-events: none;
    animation: glowPulse 8s ease-in-out infinite;
}

.bg-glow-orange {
    position: fixed;
    bottom: 15%;
    left: 5%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 153, 0, 0.04) 0%, transparent 70%);
    z-index: 0;
    pointer-events: none;
    animation: glowPulse 10s ease-in-out infinite reverse;
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes trackDraw {
    from { stroke-dashoffset: 2000; }
    to { stroke-dashoffset: 0; }
}

@keyframes raceStripe {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(300%); }
}

@keyframes breathe {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

/* Stagger children */
.stagger-children > * { opacity: 0; animation: fadeInUp 0.4s ease forwards; }
.stagger-children > *:nth-child(1) { animation-delay: 0.03s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.06s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.09s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.12s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.18s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.21s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.24s; }
.stagger-children > *:nth-child(9) { animation-delay: 0.27s; }
.stagger-children > *:nth-child(10) { animation-delay: 0.30s; }
.stagger-children > *:nth-child(11) { animation-delay: 0.33s; }
.stagger-children > *:nth-child(12) { animation-delay: 0.36s; }
.stagger-children > *:nth-child(13) { animation-delay: 0.39s; }
.stagger-children > *:nth-child(14) { animation-delay: 0.42s; }
.stagger-children > *:nth-child(15) { animation-delay: 0.45s; }
.stagger-children > *:nth-child(16) { animation-delay: 0.48s; }
.stagger-children > *:nth-child(17) { animation-delay: 0.51s; }
.stagger-children > *:nth-child(18) { animation-delay: 0.54s; }
.stagger-children > *:nth-child(19) { animation-delay: 0.57s; }
.stagger-children > *:nth-child(20) { animation-delay: 0.60s; }
.stagger-children > *:nth-child(n+21) { animation-delay: 0.63s; }

.animate-in { animation: fadeInUp 0.5s ease forwards; }

/* ===== SCROLLBAR (global) ===== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); border-radius: 3px; }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #0080FF, #00CCFF); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #0090FF, #00DDFF); }
* { scrollbar-width: thin; scrollbar-color: rgba(0,128,255,0.4) rgba(255,255,255,0.05); }

/* ===== RACING STRIPE ===== */
.racing-stripe {
    height: 4px;
    background: linear-gradient(90deg, #E8002D 0%, #E8002D 25%, #FF9900 25%, #FF9900 50%, #0080FF 50%, #0080FF 75%, #00CC88 75%, #00CC88 100%);
    position: relative;
    overflow: hidden;
    z-index: 2;
}

.racing-stripe::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 25%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
    animation: raceStripe 2.5s ease-in-out infinite;
}

/* ===== HERO BANNER ===== */
.hero-banner {
    position: relative;
    z-index: 1;
    background: linear-gradient(135deg, rgba(10,14,39,0.97), rgba(0,0,0,0.95));
    border-bottom: 1px solid rgba(255,255,255,0.06);
    overflow: hidden;
    min-height: 190px;
}

.hero-banner .hero-bg {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(135deg, rgba(232,0,45,0.1) 0%, transparent 50%),
        linear-gradient(225deg, rgba(255,153,0,0.08) 0%, transparent 50%);
    pointer-events: none;
}

/* GIF background - semi-transparent loop */
.hero-banner .hero-gif {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.hero-banner .hero-gif img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.18;
    filter: saturate(0.6) contrast(1.2);
}

/* Car image - right side accent */
.hero-banner .hero-car {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 45%;
    overflow: hidden;
    pointer-events: none;
    mask-image: linear-gradient(to left, rgba(0,0,0,0.2) 0%, transparent 80%);
    -webkit-mask-image: linear-gradient(to left, rgba(0,0,0,0.2) 0%, transparent 80%);
}

.hero-banner .hero-car img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.5;
    filter: saturate(1.2);
}

/* Logo image */
.hero-logo-img {
    height: 72px;
    width: auto;
    object-fit: contain;
    border-radius: 4px;
}

.hero-content {
    position: relative;
    z-index: 2;
    padding: 38px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.hero-title {
    font-family: 'Space Grotesk', sans-serif;
}

.hero-event {
    text-align: right;
    font-size: 12px;
    color: rgba(255,255,255,0.4);
}

.hero-event .event-name {
    font-size: 15px;
    font-weight: 600;
    color: rgba(255,255,255,0.75);
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 230px;
    background: rgba(10, 14, 39, 0.97);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255,255,255,0.05);
    z-index: 40;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.sidebar-nav {
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: rgba(255,255,255,0.45);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.sidebar-link::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0,128,255,0.1), transparent);
    opacity: 0;
    transition: opacity 0.2s ease;
    border-radius: 10px;
}

.sidebar-link:hover { color: #ffffff; }
.sidebar-link:hover::before { opacity: 1; }

.sidebar-link.active {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(0,128,255,0.15), rgba(0,128,255,0.05));
    border: 1px solid rgba(0,128,255,0.2);
    border-left: 3px solid #0080FF;
    padding-left: 11px;
}
.sidebar-link.active .link-icon { color: #0080FF; }

.sidebar-link .link-icon {
    width: 18px; height: 18px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.sidebar-link:hover .link-icon { transform: scale(1.15); }

/* Sidebar footer */
.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.aws-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255,153,0,0.06);
    border: 1px solid rgba(255,153,0,0.12);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.aws-badge:hover {
    background: rgba(255,153,0,0.1);
    border-color: rgba(255,153,0,0.25);
}

.aws-badge .aws-logo {
    font-size: 16px;
    font-weight: 700;
    font-family: 'Space Grotesk', sans-serif;
    color: #FF9900;
}

.aws-badge .aws-label {
    font-size: 9px;
    color: rgba(255,255,255,0.35);
    line-height: 1.3;
}

/* Kiro badge */
.kiro-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: rgba(0,204,136,0.8);
    background: rgba(0,204,136,0.08);
    border: 1px solid rgba(0,204,136,0.15);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

/* ===== TABS ===== */
.tab-btn {
    position: relative;
    color: rgba(255,255,255,0.45);
    border-bottom: 2px solid transparent;
    transition: all 0.25s ease;
    font-weight: 500;
}
.tab-btn:hover { color: rgba(255,255,255,0.8); background: rgba(0,128,255,0.04); }
.tab-btn.active { color: #0080FF; border-bottom-color: #0080FF; }
.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px; left: 0; right: 0;
    height: 2px;
    background: #0080FF;
    box-shadow: 0 0 8px rgba(0,128,255,0.5);
}

/* ===== SELECTION CARDS ===== */
.selection-card {
    position: relative;
    background: rgba(15,22,41,0.45);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 16px;
    transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
    cursor: pointer;
    overflow: hidden;
}

.selection-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    background: radial-gradient(circle at var(--mouse-x,50%) var(--mouse-y,50%), rgba(0,128,255,0.1), transparent 60%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.selection-card:hover {
    background: rgba(15,22,41,0.75);
    border-color: rgba(0,128,255,0.3);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3), 0 0 12px rgba(0,128,255,0.08);
}
.selection-card:hover::after { opacity: 1; }
.selection-card:active { transform: translateY(-1px); transition-duration: 0.1s; }

.selection-card.selected {
    background: rgba(0,128,255,0.1);
    border-color: #0080FF;
    box-shadow: 0 0 20px rgba(0,128,255,0.12);
}
.selection-card.selected::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #0080FF, #00CCFF);
    border-radius: 12px 12px 0 0;
}

/* ===== DRIVER CARDS ===== */
.driver-card {
    position: relative;
    background: rgba(15,22,41,0.45);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 8px;
    padding: 8px 10px;
    transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
    cursor: pointer;
    overflow: hidden;
}

.driver-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    background: radial-gradient(circle at var(--mouse-x,50%) var(--mouse-y,50%), rgba(0,128,255,0.1), transparent 60%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.driver-card:hover {
    background: rgba(15,22,41,0.75);
    border-color: rgba(0,128,255,0.3);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3), 0 0 12px rgba(0,128,255,0.08);
}
.driver-card:hover::after { opacity: 1; }
.driver-card:active { transform: translateY(-1px); transition-duration: 0.1s; }

.driver-card.selected {
    background: rgba(0,128,255,0.1);
    border-color: #0080FF;
    box-shadow: 0 0 20px rgba(0,128,255,0.12);
}

.driver-card .driver-number {
    font-size: 18px; font-weight: 700;
    font-family: 'Space Grotesk', sans-serif;
    color: #0080FF;
    transition: transform 0.2s ease;
}
.driver-card:hover .driver-number { color: #00CCFF; }
.driver-card.selected .driver-number { color: #00CCFF; }
.driver-card .driver-name { font-size: 11px; font-weight: 600; margin-top: 2px; }
.driver-card .driver-name-cn { font-size: 10px; color: rgba(255,255,255,0.25); margin-top: 1px; }
.driver-card .driver-team { font-size: 10px; color: rgba(255,255,255,0.35); margin-top: 1px; }

.driver-card .aws-partner-tag {
    position: absolute;
    top: 8px; right: 8px;
    font-size: 9px; font-weight: 600;
    color: #FF9900;
    background: rgba(255,153,0,0.08);
    border: 1px solid rgba(255,153,0,0.18);
    padding: 2px 6px;
    border-radius: 4px;
}

/* ===== PANELS ===== */
.panel-section {
    position: relative;
    z-index: 1;
    background: rgba(10,14,39,0.55);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    transition: border-color 0.3s ease;
}
.panel-section:hover { border-color: rgba(255,255,255,0.08); }

.section-label {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; font-weight: 600;
    letter-spacing: 0.08em; text-transform: uppercase;
    color: rgba(255,255,255,0.4);
    margin-bottom: 12px;
    padding-left: 10px;
    border-left: 3px solid #0080FF;
}
.section-label .label-icon { width: 16px; height: 16px; opacity: 0.45; }
.section-label .label-cn { color: rgba(255,255,255,0.2); font-size: 11px; font-weight: 400; letter-spacing: 0; }

.data-source { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: rgba(255,255,255,0.3); margin-top: 8px; }
.data-source a { color: rgba(0,128,255,0.55); text-decoration: none; transition: color 0.2s ease; }
.data-source a:hover { color: #0080FF; text-decoration: underline; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 10px;
    font-size: 13px; font-weight: 500;
    border: none; cursor: pointer;
    transition: all 0.2s ease;
    position: relative; overflow: hidden;
}
.btn::before { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(255,255,255,0.08), transparent); opacity: 0; transition: opacity 0.2s ease; }
.btn:hover::before { opacity: 1; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: #0080FF; color: #fff; }
.btn-primary:hover { background: #0066CC; box-shadow: 0 4px 15px rgba(0,128,255,0.35); }
.btn-ghost { background: rgba(255,255,255,0.04); color: rgba(255,255,255,0.6); border: 1px solid rgba(255,255,255,0.07); }
.btn-ghost:hover { background: rgba(255,255,255,0.08); color: #fff; border-color: rgba(255,255,255,0.12); }

/* ===== INPUTS ===== */
.input-field {
    width: 100%;
    background: rgba(15,22,41,0.5);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px;
    padding: 10px 14px;
    color: #fff; font-size: 14px;
    transition: all 0.25s ease;
}
.input-field::placeholder { color: rgba(255,255,255,0.2); }
.input-field:focus { outline: none; border-color: rgba(0,128,255,0.45); box-shadow: 0 0 0 3px rgba(0,128,255,0.07); }
.input-field:hover:not(:focus) { border-color: rgba(255,255,255,0.12); }
select.input-field {
    cursor: pointer; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.35)' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* ===== STEP INDICATOR ===== */
.step-indicator { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; }
.step-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.1); transition: all 0.3s ease; }
.step-dot.active { background: #0080FF; box-shadow: 0 0 8px rgba(0,128,255,0.5); }
.step-dot.completed { background: #00CC88; box-shadow: 0 0 8px rgba(0,204,136,0.5); }
.step-line { flex: 1; height: 2px; background: rgba(255,255,255,0.06); position: relative; }
.step-line.completed::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, #00CC88, #0080FF); }

/* ===== BEST LAP ===== */
.best-lap-card {
    background: rgba(15,22,41,0.45);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 14px 18px;
    transition: all 0.2s ease;
}
.best-lap-card:hover { border-color: rgba(0,128,255,0.15); }

/* ===== LANG TOGGLE ===== */
.lang-toggle { display: inline-flex; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); border-radius: 8px; overflow: hidden; }
.lang-toggle button { padding: 4px 10px; font-size: 12px; color: rgba(255,255,255,0.35); background: transparent; border: none; cursor: pointer; transition: all 0.2s ease; }
.lang-toggle button.active { background: rgba(0,128,255,0.12); color: #0080FF; }

/* ===== SHANGHAI TRACK SVG ===== */
.track-decoration {
    position: fixed;
    bottom: 30px; right: 30px;
    width: 220px; height: 220px;
    opacity: 0.06;
    pointer-events: none;
    z-index: 0;
}

.track-decoration svg {
    width: 100%; height: 100%;
}

.track-decoration svg path {
    stroke: #0080FF;
    stroke-width: 3;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    animation: trackDraw 6s ease forwards;
}

/* ===== LOADING ===== */
.loading-spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid rgba(255,255,255,0.08); border-radius: 50%; border-top-color: #0080FF; animation: spin 0.8s linear infinite; }

/* ===== RESPONSIVE ===== */

/* Mobile: < 768px */
@media (max-width: 768px) {
    .sidebar { 
        width: 100%; 
        height: auto; 
        position: fixed; 
        bottom: 0; 
        top: auto; 
        left: 0; 
        flex-direction: row;
        border-top: 1px solid rgba(255,255,255,0.08);
        border-right: none;
        padding: 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        z-index: 40;
    }
    .sidebar .link-text, .sidebar .logo-text, .sidebar-footer, .sidebar-logo { display: none; }
    .sidebar-nav { 
        display: flex; 
        flex-direction: row; 
        justify-content: space-around; 
        width: 100%; 
        padding: 8px 0;
        gap: 0;
    }
    .sidebar-link { 
        padding: 6px 8px; 
        flex-direction: column; 
        align-items: center; 
        gap: 2px;
        font-size: 9px;
    }
    .sidebar-link .link-icon { width: 20px; height: 20px; }
    .main-content { margin-left: 0; margin-bottom: 60px; }
    .hero-section { display: none; }
    
    /* Race grid: 2 columns on mobile */
    .race-scroll-grid { grid-template-columns: repeat(2, 1fr); max-height: 200px; }
    
    /* Analysis layout: stack vertically */
    .main-content .flex.gap-5 { flex-direction: column; }
    .main-content .flex.gap-5 > div { max-width: 100% !important; width: 100% !important; }
    
    /* Charts smaller */
    #chartContainer { height: 300px !important; }
    #positionChart { height: 250px !important; }
    
    /* Modals full screen on mobile */
    #teamModal > div, #driverModal > div { 
        max-width: 100%; 
        margin: 0; 
        border-radius: 12px 12px 0 0;
        max-height: 85vh;
    }
    #teamModal, #driverModal { padding-top: 10px; align-items: flex-end; }
    
    /* Smaller text */
    .panel-section { padding: 12px; }
    .section-label span { font-size: 11px; }
}

/* Tablet: 769px - 1024px */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar { width: 64px; }
    .sidebar .link-text, .sidebar .logo-text, .sidebar-footer .aws-label { display: none; }
    .main-content { margin-left: 64px; }
    .race-scroll-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Desktop: > 1024px */
@media (min-width: 1025px) { 
    .main-content { margin-left: 230px; } 
}

/* ===== FOCUS ===== */
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid #0080FF; outline-offset: 2px; }

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

@media print { .sidebar, header, footer, .bg-grid, .bg-sweep, .bg-glow-blue, .bg-glow-orange, .track-decoration { display: none; } body { background: #fff; color: #000; } .main-content { margin-left: 0; } }

/* ===== DATA LOADING ANIMATION ===== */
.data-loader {
    display: none;
    text-align: center;
    padding: 40px 20px;
    animation: fadeIn 0.3s ease;
}

.data-loader.active {
    display: block;
}

.data-loader .loader-bars {
    display: inline-flex;
    gap: 4px;
    margin-bottom: 16px;
}

.data-loader .loader-bars span {
    display: block;
    width: 6px;
    height: 28px;
    background: #FF9900;
    border-radius: 3px;
    animation: loaderBar 0.8s ease-in-out infinite;
}

.data-loader .loader-bars span:nth-child(1) { animation-delay: 0s; }
.data-loader .loader-bars span:nth-child(2) { animation-delay: 0.1s; }
.data-loader .loader-bars span:nth-child(3) { animation-delay: 0.2s; }
.data-loader .loader-bars span:nth-child(4) { animation-delay: 0.3s; }
.data-loader .loader-bars span:nth-child(5) { animation-delay: 0.4s; }

@keyframes loaderBar {
    0%, 100% { transform: scaleY(0.4); opacity: 0.4; }
    50% { transform: scaleY(1); opacity: 1; }
}

.data-loader .loader-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 6px;
}

.data-loader .loader-subtitle {
    font-size: 11px;
    letter-spacing: 0.1em;
    color: #0080FF;
    text-transform: uppercase;
}

/* Section loading overlay */
.section-loading {
    position: relative;
    pointer-events: none;
}

.section-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 16px;
    z-index: 5;
}

/* Progress bar under selection */
.selection-progress {
    height: 3px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    margin-top: 16px;
    overflow: hidden;
}

.selection-progress .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0080FF, #00CCFF);
    border-radius: 2px;
    width: 0%;
    transition: width 0.5s ease;
}

/* ===== RACE SCROLL GRID (3 rows, horizontal scroll) ===== */
.race-scroll-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-height: 360px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,128,255,0.4) rgba(255,255,255,0.05);
    padding-right: 4px;
}

/* Race card inside scroll grid */
.race-scroll-grid .race-card {
    background: rgba(15,22,41,0.45);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
    overflow: hidden;
    font-family: 'Space Grotesk', sans-serif;
}

.race-scroll-grid .race-card:hover {
    background: rgba(15,22,41,0.75);
    border-color: rgba(0,128,255,0.3);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3), 0 0 12px rgba(0,128,255,0.08);
}

.race-scroll-grid .race-card.selected {
    background: rgba(0,128,255,0.12);
    border-color: #0080FF;
    box-shadow: 0 0 12px rgba(0,128,255,0.15);
}

.race-scroll-grid .race-card .race-num {
    font-size: 9px;
    font-weight: 700;
    color: #0080FF;
    letter-spacing: 0.1em;
}

.race-scroll-grid .race-card .race-name {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
    margin-top: 2px;
    line-height: 1.3;
}

.race-scroll-grid .race-card .race-cn {
    font-size: 10px;
    color: rgba(255,255,255,0.3);
    font-family: 'DM Sans', sans-serif;
}

.race-scroll-grid .race-card .race-date {
    font-size: 9px;
    color: rgba(255,255,255,0.2);
    margin-top: 1px;
}

/* ===== SHANGHAI HOME RACE HIGHLIGHT ===== */
.race-scroll-grid .race-card.shanghai-home {
    border: 1px solid rgba(255, 153, 0, 0.4);
    background: rgba(255, 153, 0, 0.08);
    position: relative;
}

.race-scroll-grid .race-card.shanghai-home .race-num {
    color: #FF9900;
}

.race-scroll-grid .race-card.shanghai-home .home-tag {
    font-size: 8px;
    font-weight: 700;
    color: #FF9900;
    letter-spacing: 0.05em;
    margin-top: 3px;
}

/* ===== ZHOU GUANYU HOME DRIVER ===== */
.driver-card.zhou-home {
    border-color: rgba(255, 153, 0, 0.3) !important;
    background: rgba(255, 153, 0, 0.06);
}

.driver-card .home-driver-tag {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 9px;
    font-weight: 600;
    color: #FF9900;
    background: rgba(255, 153, 0, 0.1);
    border: 1px solid rgba(255, 153, 0, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
}


/* Modal fade-in animation */
@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
#teamModal.flex, #driverModal.flex {
    animation: modalFadeIn 0.25s ease;
}
#teamModal.flex > div, #driverModal.flex > div {
    animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Chart panel: solid background */
.chart-panel {
    background: rgba(10,14,39,0.85) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
