:root {
    --f1-red: #000000;
    --f1-dark-red: #b00500;
    --f1-bg:rgb(225, 15, 15);
    --f1-black: #000000;
    --f1-dark-gray: #1e1e2a;
    --f1-light-gray: #27272f;
    --f1-white: #ffffff;
    --f1-off-white: #f0f0f0;
    --f1-accent: #010101;
    --f1-yellow: #000000;
    --transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    font-family: 'Titillium Web', sans-serif;
    background: linear-gradient(to bottom, var(--f1-bg), var(--f1-black));    color: var(--f1-white);
    overflow-x: hidden; /* Prevent horizontal scroll */
    width: 100%;
    height: 100%;
    scroll-behavior: smooth;
    text-align: center; /* Center text by default */
}

/* Loader Styles */
.loader-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--f1-black);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

.loader {
    position: relative;
    width: 100px;
    height: 100px;
}

.loader-circle {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid var(--f1-red);
    border-radius: 50%;
    animation: spin 1s infinite linear;
}

.checkered-flag {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    background: repeating-conic-gradient(#ffffff 0% 25%, #000000 0% 50%) 0 0/25% 25%;
    transform: translate(-50%, -50%);
    animation: flag-wave 1.5s infinite ease-in-out;
    clip-path: polygon(0 0, 100% 0, 85% 100%, 15% 100%);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes flag-wave {
    0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
    50% { transform: translate(-50%, -50%) rotate(10deg); }
}

/* Main Container Styles */
.container {
    width: 100%;
    min-height: 100vh;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s ease, transform 1s ease;
    display: flex; /* Use flexbox for centering */
    flex-direction: column; /* Stack children vertically */
    align-items: center; /* Center children horizontally */
}

.container.loaded {
    opacity: 1;
    transform: translateY(0);
}

/* Header Styles */
header {
    display: flex;
    justify-content: space-around; /* Adjust for centering with logo and nav */
    align-items: center;
    padding: 30px 20px; /* Reduced padding for smaller screens */
    width: 100%;
    max-width: 1200px; /* Max width for header content */
    position: relative;
    z-index: 10;
}

.logo {
    font-size: 32px;
    font-weight: 900;
    letter-spacing: 1px;
    color: var(--f1-white);
    transform: translateY(-50px);
    opacity: 0;
    transition: var(--transition);
    transition-delay: 0.3s;
}

.logo.appear {
    transform: translateY(0);
    opacity: 1;
}

.logo span {
    color: var(--f1-red);
}

nav ul {
    display: flex;
    list-style: none;
    justify-content: center; /* Center nav items */
}

nav ul li {
    margin: 0 15px; /* Adjusted margin for single item */
    opacity: 0;
    transform: translateY(-20px);
    transition: var(--transition);
}

nav ul li:nth-child(1) {
    transition-delay: 0.4s;
}

nav ul li.appear {
    opacity: 1;
    transform: translateY(0);
}

nav ul li a {
    color: var(--f1-off-white);
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.5px;
    position: relative;
    padding: 5px 0;
    transition: var(--transition);
}

nav ul li a:hover, nav ul li a.active {
    color: var(--f1-white);
}

nav ul li a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--f1-red);
    transition: var(--transition);
}

nav ul li a:hover::after, nav ul li a.active::after {
    width: 100%;
}

/* Hero Section Styles */
.hero {
    display: flex;
    flex-direction: column; /* Stack content and car vertically */
    align-items: center; /* Center hero content */
    justify-content: center; /* Center content vertically */
    min-height: calc(100vh - 100px); /* Adjust based on header height */
    padding: 20px; /* Add padding */
    width: 100%;
    max-width: 1200px; /* Max width for hero content */
    position: relative;
    text-align: center; /* Ensure text within hero is centered */
}

.content {
    width: 100%; /* Full width for content block */
    max-width: 600px; /* Max width for text content */
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center; /* Center items within the content div */
}

.title {
    font-size: 64px;
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 20px;
    transform: translateX(-50px);
    opacity: 0;
    transition: var(--transition);
    transition-delay: 0.7s;
}

.title.appear {
    transform: translateX(0);
    opacity: 1;
}
.title span{
    background-color: white;
}
.title{
    background-color: #000000;
    padding: 10px;
}

.title span {
    color: var(--f1-red);
    display: block;
}

.subtitle {
    font-size: 18px;
    line-height: 1.6;
    margin-bottom: 40px;
    max-width: 500px;
    transform: translateX(-50px);
    opacity: 0;
    transition: var(--transition);
    transition-delay: 0.8s;
}

.subtitle.appear {
    transform: translateX(0);
    opacity: 1;
}

/* Form Container Styles */
.form-container {
    background-color: var(--f1-red);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    margin-bottom: 40px;
    transform: translateY(30px);
    opacity: 0;
    transition: var(--transition);
    transition-delay: 0.9s;
    width: 100%; /* Make form container take available width */
    max-width: 500px; /* Max width for the form */
    text-align: left; /* Align form elements to the left within the container */
}

.form-container.appear {
    transform: translateY(0);
    opacity: 1;
}

.form-group {
    margin-bottom: 20px;
    position: relative;
}

input, select {
    width: 100%;
    padding: 15px 20px;
    border: none;
    border-radius: 8px;
    background-color: var(--f1-light-gray);
    color: var(--f1-white);
    font-size: 16px;
    font-family: 'Titillium Web', sans-serif;
    transition: var(--transition);
}

input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

input:focus, select:focus {
    outline: none;
    background-color: rgb(0, 0, 0);
}

.input-focus-effect {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: var(--f1-red);
    transition: var(--transition);
    transform: translateX(-50%);
}

input:focus ~ .input-focus-effect,
select:focus ~ .input-focus-effect {
    width: 100%;
}

.submit-btn {
    width: 100%;
    padding: 16px 20px;
    background-color: var(--f1-dark-red);
    border: none;
    border-radius: 8px;
    color: var(--f1-white);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: var(--transition);
}

.submit-btn:hover {
    background-color: var(--f1-dark-red);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(225, 6, 0, 0.3);
}

.submit-btn:hover::before {
    left: 100%;
    transition: 0.7s;
}

.submit-btn span {
    margin-right: 10px;
}

/* Stats Section Styles */
.stats {
    display: flex;
    justify-content: space-around; /* Distribute stats evenly */
    width: 100%;
    max-width: 600px; /* Max width for stats */
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition);
    transition-delay: 1s;
    margin: 0 auto; /* Center the stats block */
}

.stats.appear {
    opacity: 1;
    transform: translateY(0);
}

.stat {
    text-align: center;
}

.number {
    font-size: 36px;
    font-weight: 900;
    color: var(--f1-white);
    display: block;
    line-height: 1;
}

.label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    display: block;
    margin-top: 5px;
}

/* Car Animation Container Styles */
.car-container {
    position: relative; /* Changed from absolute for better centering flow */
    width: 80%; /* Adjust width as needed */
    max-width: 700px; /* Max width for the car */
    height: auto; /* Auto height based on content */
    aspect-ratio: 16/9; /* Maintain aspect ratio for the car image area */
    margin-top: 40px; /* Space above the car */
    opacity: 0; /* Start hidden for animation */
    transform: translateX(100px); /* Start off-screen for animation */
    transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1) 1s, transform 1.2s cubic-bezier(0.16, 1, 0.3, 1) 1s; /* Added delay */
    z-index: 1;
}

.car-container.appear {
    opacity: 1;
    transform: translateX(0); /* Slide in */
}

.car-image {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: url('[https://i.pinimg.com/originals/b0/4f/30/b04f30197cf90dbd2b5676c309456aa0.png](https://i.pinimg.com/originals/b0/4f/30/b04f30197cf90dbd2b5676c309456aa0.png)'); /* Fallback or actual image */
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.5));
    animation: car-float 6s infinite ease-in-out;
}
/* Fallback for car image if the primary one fails */
.car-image[style*="url('[https://www.api.placeholder.com/400/320](https://www.api.placeholder.com/400/320)')"] {
    background-image: url('[https://placehold.co/600x400/e10600/ffffff?text=F1+Car](https://placehold.co/600x400/e10600/ffffff?text=F1+Car)'); /* Placeholder with F1 colors */
}


.car-shadow {
    position: absolute;
    bottom: -5%; /* Adjusted for better visual */
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 10px;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0) 70%);
    border-radius: 50%;
    animation: shadow-pulse 6s infinite ease-in-out;
}

.speed-lines {
    position: absolute;
    width: 120%; /* Make lines wider to extend beyond car */
    height: 100%;
    left: -10%; /* Adjust starting position */
    top: 0;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none; /* Lines should not interfere with mouse */
}

.car-container.appear .speed-lines {
    opacity: 0.6; /* Slightly more visible */
    transition-delay: 1.5s; /* Delay appearance of speed lines */
}

.line {
    position: absolute;
    height: 2px; /* Thinner lines */
    background: linear-gradient(to left, rgba(255, 255, 255, 0.5), transparent); /* Gradient for a fading effect */
    border-radius: 2px;
    opacity: 0;
    transform-origin: right center; /* Animate from the right */
}

/* Improved Race Line Animations */
.line-1 { top: 20%; width: 60%; animation: race-line 0.8s infinite ease-out alternate; animation-delay: 0s; }
.line-2 { top: 30%; width: 80%; animation: race-line 0.7s infinite ease-in-out alternate; animation-delay: 0.1s; }
.line-3 { top: 40%; width: 50%; animation: race-line 0.9s infinite ease-out alternate; animation-delay: 0.2s; }
.line-4 { top: 50%; width: 75%; animation: race-line 0.6s infinite ease-in alternate; animation-delay: 0.05s; }
.line-5 { top: 60%; width: 65%; animation: race-line 0.85s infinite ease-out alternate; animation-delay: 0.15s; }
.line-6 { top: 70%; width: 90%; animation: race-line 0.75s infinite ease-in-out alternate; animation-delay: 0.25s; }
.line-7 { top: 80%; width: 55%; animation: race-line 0.95s infinite ease-out alternate; animation-delay: 0.3s; }


@keyframes car-float {
    0%, 100% { transform: translateY(0) translateX(0); } /* Added translateX for subtle horizontal movement */
    50% { transform: translateY(-15px) translateX(5px); }
}

@keyframes shadow-pulse {
    0%, 100% { 
        width: 80%; 
        opacity: 0.3;
    }
    50% { 
        width: 75%; 
        opacity: 0.25;
    }
}

@keyframes race-line {
    0% {
        transform: scaleX(0.1) translateX(-200%); /* Start further back and small */
        opacity: 0.3;
    }
    20% {
        opacity: 0.8; /* Quickly become visible */
    }
    80% {
        opacity: 0.8;
    }
    100% {
        transform: scaleX(1) translateX(20%); /* End slightly ahead, full size */
        opacity: 0;
    }
}


/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(21, 21, 30, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--f1-dark-gray);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    max-width: 500px;
    width: 90%; /* Responsive width for modal */
    transform: scale(0.8);
    transition: var(--transition);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.modal.show .modal-content {
    transform: scale(1);
}

.checkmark-container {
    width: 80px;
    height: 80px;
    position: relative;
    margin: 0 auto 20px;
}

.checkmark {
    width: 80px;
    height: 80px;
}

.checkmark-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 2;
    stroke-miterlimit: 10;
    stroke: var(--f1-red);
    fill: none;
    animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark-check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    stroke-width: 3;
    stroke: var(--f1-white);
    animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

@keyframes stroke {
    100% {
        stroke-dashoffset: 0;
    }
}

.modal h2 {
    font-size: 28px;
    margin-bottom: 15px;
    color: var(--f1-white);
}

.modal p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 30px;
    line-height: 1.6;
}

.close-modal {
    background-color: var(--f1-red);
    color: var(--f1-white);
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.close-modal:hover {
    background-color: var(--f1-dark-red);
    transform: translateY(-3px);
}

/* Responsive Design Adjustments */
@media (max-width: 992px) {
    .hero {
        padding: 40px 20px 60px; /* Adjust padding */
    }
    .content {
        margin-bottom: 40px;
    }
    .car-container {
        width: 90%;
        height: auto; /* Maintain aspect ratio */
        aspect-ratio: 16/9;
        margin-top: 20px;
    }
    .title {
        font-size: 50px;
    }
    header {
        padding: 20px;
        flex-direction: column; /* Stack logo and nav on smaller screens */
    }
    nav ul {
        margin-top: 15px; /* Space between logo and nav */
    }
}

@media (max-width: 768px) {
    .title {
        font-size: 40px;
    }
    .subtitle {
        font-size: 16px;
    }
    nav ul li {
        margin: 0 10px;
    }
    .stats {
        flex-direction: column;
        gap: 20px;
        align-items: center; /* Center stats items when stacked */
    }
    .stat {
        width: 100%; /* Make each stat take full width */
        max-width: 300px; /* Max width for a single stat */
    }
    .car-container {
        height: auto;
        aspect-ratio: 16/10; /* Slightly different aspect ratio for smaller screens */
    }
    .form-container {
        padding: 20px;
    }
}

@media (max-width: 576px) {
    .logo {
        font-size: 24px;
    }
    nav ul li a {
        font-size: 14px;
    }
    .title {
        font-size: 32px;
    }
    .subtitle {
        font-size: 15px;
    }
    .modal-content {
        padding: 30px 15px;
        margin: 0 15px;
    }
    .number {
        font-size: 30px;
    }
    .label {
        font-size: 13px;
    }
    .car-container {
         aspect-ratio: 4/3;
    }
}

/* Particle Styles (dynamically added via JS but good to have here for reference) */
.particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0; /* Ensure particles are behind content */
    opacity: 0; /* Start transparent, animated by JS */
}

@keyframes float { /* This keyframe is defined in JS, ensure it's effective */
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) translateX(var(--particle-tx, 0px)); /* Use CSS variable for dynamic X */
        opacity: 0;
    }
}

input.error, select.error {
    border: 1px solid var(--f1-red) !important; /* Ensure error border is visible */
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}