@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;600;800&family=Oswald:ital,wght@0,500;0,700;1,700&display=swap');

:root { 
    --bg-color: #000000; 
    --racing-red: #d31027; 
    --glass-bg: rgba(255, 255, 255, 0.03); 
    --glass-border: rgba(211, 16, 39, 0.3); 
    --text-main: #f4f4f4; 
    --text-muted: #a0a0a0; 
    --checker-pattern: repeating-linear-gradient(45deg, #d31027, #d31027 10px, #ffffff 10px, #ffffff 20px);
}

body, html { 
    margin: 0; padding: 0; width: 100%; height: 100%; 
    background-color: var(--bg-color); 
    color: var(--text-main); font-family: 'Montserrat', sans-serif; overflow-x: hidden; 
}

/* DYNAMIC SPEED LINES BACKGROUND */
.speed-lines-bg {
    position: fixed; inset: 0; z-index: -10; pointer-events: none;
    background: linear-gradient(to bottom, transparent 50%, rgba(255,255,255,0.02) 50%);
    background-size: 100% 4px;
    animation: warpSpeed 0.5s linear infinite;
}
.speed-lines-bg::after {
    content: ''; position: absolute; inset: 0;
    background-image: 
        linear-gradient(90deg, transparent 0%, transparent 10%, rgba(255,255,255,0.04) 10.2%, transparent 10.5%),
        linear-gradient(90deg, transparent 0%, transparent 40%, rgba(211,16,39,0.03) 40.2%, transparent 40.5%),
        linear-gradient(90deg, transparent 0%, transparent 80%, rgba(255,255,255,0.04) 80.2%, transparent 80.5%);
    background-size: 100% 100%;
}
@keyframes warpSpeed { 0% { background-position: 0 0; } 100% { background-position: 0 100%; } }

/* 6 AM FLOUR DUST & MIST (AR VIBE) - UPGRADED VISIBILITY */
.morning-mist-container {
    position: fixed; inset: 0; z-index: -5; pointer-events: none; overflow: hidden;
    background: radial-gradient(circle at 20% 30%, rgba(255, 230, 200, 0.08) 0%, transparent 50%),
                radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    animation: pulseMist 6s infinite alternate ease-in-out;
}

.flour-dust {
    position: absolute; inset: -50%; width: 200%; height: 200%;
    background-image: 
        radial-gradient(circle at 15% 25%, rgba(255, 240, 220, 0.9) 1px, transparent 1px),
        radial-gradient(circle at 35% 65%, rgba(255, 255, 255, 0.7) 1.5px, transparent 1.5px),
        radial-gradient(circle at 75% 35%, rgba(255, 230, 200, 1) 2px, transparent 2px),
        radial-gradient(circle at 90% 85%, rgba(255, 255, 255, 0.6) 1px, transparent 1px),
        radial-gradient(circle at 45% 15%, rgba(255, 240, 220, 0.8) 2px, transparent 2px),
        radial-gradient(circle at 65% 90%, rgba(255, 255, 255, 0.9) 1.5px, transparent 1.5px);
    background-repeat: repeat;
}

.flour-dust.layer-1 {
    background-size: 100px 100px;
    animation: driftFlour 30s linear infinite;
    opacity: 1;
}

.flour-dust.layer-2 {
    background-size: 150px 150px;
    animation: driftFlour 45s linear infinite reverse;
    opacity: 0.8; 
    transform: scale(1.5);
}

@keyframes driftFlour {
    0% { transform: translateY(0) translateX(0) rotate(0deg); }
    100% { transform: translateY(-150px) translateX(40px) rotate(3deg); }
}

@keyframes pulseMist {
    0% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* BURNOUT SMOKE PUFF */
.smoke-puff {
    position: fixed; width: 60px; height: 60px; background: radial-gradient(circle, rgba(200,200,200,0.8) 0%, rgba(200,200,200,0) 70%);
    border-radius: 50%; pointer-events: none; z-index: 9999; transform: translate(-50%, -50%) scale(0.5);
    animation: burnout 0.8s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}
@keyframes burnout {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 1; filter: blur(2px); }
    100% { transform: translate(-50%, -150px) scale(4); opacity: 0; filter: blur(15px); }
}

#progress-container { position: fixed; top: 0; left: 0; width: 100%; height: 6px; background: #000; z-index: 4000; }
#progress-bar { height: 100%; width: 0%; background: var(--checker-pattern); box-shadow: 0 0 15px var(--racing-red); transition: width 0.1s; }

.glow { position: fixed; border-radius: 50%; filter: blur(120px); z-index: -2; background: rgba(211, 16, 39, 0.15); width: 60vw; height: 60vw; top: -10vw; right: -10vw; }

nav { display: flex; flex-direction: row; justify-content: space-between; align-items: center; padding: 0.8rem 5%; background: rgba(0, 0, 0, 0.98); backdrop-filter: blur(15px); position: sticky; top: 0; z-index: 2000; }
.checker-strip { width: 100%; height: 6px; background: var(--checker-pattern); position: sticky; top: 62px; z-index: 1950; box-shadow: 0 4px 10px rgba(0,0,0,0.5); }

.nav-left { display: flex; align-items: center; gap: 12px; }
.nav-logo { height: 40px; width: auto; cursor: pointer; }
.logo-text { font-family: 'Oswald', sans-serif; font-size: 1.5rem; font-weight: 700; font-style: italic; text-transform: uppercase; color: white; white-space: nowrap; text-shadow: 2px 2px 0px #000; }
.logo-text span { color: var(--racing-red); }
.nav-spacer { flex-grow: 1; }
.nav-right { display: flex; align-items: center; gap: 15px; }

.pit-pass-btn { font-family: 'Oswald'; font-size: 0.75rem; color: var(--racing-red); border: 2px solid var(--racing-red); padding: 4px 12px; border-radius: 2px; cursor: pointer; transition: 0.3s; white-space: nowrap; background: white; font-weight: 800; text-transform: uppercase; font-style: italic; clip-path: polygon(10% 0, 100% 0, 90% 100%, 0% 100%); }
.pit-pass-btn:hover { background: var(--racing-red); color: white; transform: scale(1.05); }

.cart-container { font-family: 'Oswald'; font-size: 1.1rem; cursor: pointer; color: white; display: flex; align-items: center; transition: 0.2s; }
.cart-count { background: var(--racing-red); padding: 1px 8px; border-radius: 20px; font-size: 0.8rem; margin-left: 5px; box-shadow: 0 0 8px rgba(211,16,39,0.5); }

/* CART REVVING ANIMATION */
@keyframes revCart {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.3) rotate(-15deg); color: var(--racing-red); text-shadow: 0 0 15px red; }
    50% { transform: scale(1.3) rotate(15deg); }
    75% { transform: scale(1.3) rotate(-15deg); }
}
.rev-cart { animation: revCart 0.4s ease-in-out; }

#pit-pass-drawer { position: fixed; top: -100%; left: 0; width: 100%; height: auto; background: rgba(10, 10, 10, 0.98); backdrop-filter: blur(30px); border-bottom: 4px solid var(--racing-red); z-index: 3500; transition: top 0.5s cubic-bezier(0.85, 0, 0.15, 1); padding: 3rem 5% 2rem; box-sizing: border-box; overflow-y: auto; max-height: 100vh; }
#pit-pass-drawer.active { top: 0; }
.drawer-close { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); cursor: pointer; color: var(--racing-red); font-family: 'Oswald'; text-transform: uppercase; font-size: 0.8rem; font-weight: bold; }

input, textarea { width: 100%; padding: 12px; margin-bottom: 12px; background: #111 !important; border: 1px solid #333 !important; color: white !important; font-family: 'Montserrat'; border-radius: 4px; box-sizing: border-box; outline: none; }
input:focus { border-color: var(--racing-red) !important; }

/* CUSTOM PRODUCT SELECT DROPDOWN */
.custom-select-wrapper { position: relative; width: 100%; margin-bottom: 12px; font-family: 'Oswald', sans-serif; font-size: 0.95rem; font-weight: 700; text-transform: uppercase; user-select: none; }
.custom-select-display { background-color: #ffffff; color: var(--racing-red); border: 2px solid var(--racing-red); padding: 10px 15px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; transition: 0.3s ease; }
.custom-select-display:hover { border-image: var(--checker-pattern) 1; box-shadow: 0 0 10px rgba(211, 16, 39, 0.3); }
.custom-select-options { position: absolute; top: 100%; left: 0; right: 0; background: rgba(15, 15, 15, 0.98); border: 2px solid var(--racing-red); border-top: none; z-index: 100; display: none; flex-direction: column; max-height: 180px; overflow-y: auto; box-shadow: 0 10px 20px rgba(0,0,0,0.8); }
.custom-select-options.show { display: flex; }
.custom-option { padding: 10px 15px; color: #fff; border-bottom: 1px solid #333; cursor: pointer; font-style: italic; letter-spacing: 0.5px; }
.custom-option:last-child { border-bottom: none; }
.custom-option:hover { background: rgba(211, 16, 39, 0.2); color: var(--racing-red); }

/* TACHOMETER REWARDS GAUGE */
.rewards-container { background: rgba(25,25,25,0.8); padding: 20px; border-radius: 8px; border: 1px solid var(--glass-border); margin-top: 15px; text-align: center; position: relative; overflow: hidden; }
.tach-container { position: relative; width: 100%; max-width: 250px; margin: 0 auto; }
.tach-svg-wrapper { position: relative; width: 100%; margin-bottom: 10px; }
.tach-svg { width: 100%; overflow: visible; display: block; }
.tach-needle {
    position: absolute; bottom: 10px; left: 50%; width: 4px; height: 75px;
    background: linear-gradient(to top, #fff 0%, #ff1a1a 100%);
    transform-origin: bottom center; transform: rotate(-90deg) translateX(-50%);
    transition: transform 1.5s cubic-bezier(0.2, 0.8, 0.2, 1);
    filter: drop-shadow(0 0 5px red);
    border-radius: 2px 2px 0 0;
    z-index: 1;
}
.tach-center-dot { position: absolute; bottom: 6px; left: 50%; width: 16px; height: 16px; background: #111; border: 2px solid var(--racing-red); border-radius: 50%; transform: translateX(-50%); z-index: 2; }
.tach-text { font-family: 'Oswald'; font-size: 1.5rem; color: #fff; font-style: italic; text-shadow: 0 0 10px rgba(211,16,39,0.8); margin-top: 5px; }

.controls-container { background: #000; padding: 10px 5%; border-bottom: 1px solid #222; position: sticky; top: 68px; z-index: 1900; display: flex; flex-direction: column; gap: 8px; }
#product-search { width: 100%; padding: 10px 15px; background: #111; border: 1px solid #333; color: white; font-family: 'Oswald'; font-style: italic; border-radius: 4px; outline: none; box-sizing: border-box; font-size: 0.9rem; transition: border 0.3s; }
#product-search:focus { border-color: var(--racing-red); }

.tab-bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding-bottom: 4px; }
.tab { flex: 1 1 auto; padding: 8px 10px; background: transparent; border: 1px solid #333; color: var(--text-muted); font-family: 'Oswald'; text-transform: uppercase; cursor: pointer; font-size: 0.75rem; border-radius: 2px; font-style: italic; transition: 0.3s; clip-path: polygon(5% 0, 100% 0, 95% 100%, 0% 100%); display: flex; align-items: center; justify-content: center; text-align: center; line-height: 1.2; }
.tab.active { border-color: var(--racing-red); color: white; background: var(--racing-red); box-shadow: 0 2px 8px rgba(211,16,39,0.4); }
.tab:hover:not(.active) { border-color: #fff; color: #fff; }

.tab-dropdown-menu { position: absolute; top: 100%; left: 5%; right: 5%; background: rgba(15, 15, 15, 0.98); border: 2px solid var(--racing-red); border-top: none; z-index: 1800; display: none; flex-direction: column; max-height: 45vh; overflow-y: auto; box-shadow: 0 15px 30px rgba(0,0,0,0.9); border-radius: 0 0 6px 6px; }
.tab-dropdown-menu.show { display: flex; }
.dropdown-item { padding: 12px 15px; color: #fff; font-family: 'Oswald', sans-serif; font-size: 0.95rem; border-bottom: 1px solid #333; cursor: pointer; font-style: italic; letter-spacing: 0.5px; }
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: rgba(211, 16, 39, 0.2); color: var(--racing-red); }

.garage-view { padding: 2rem 5% 4rem; max-width: 1200px; margin: 0 auto; }

.section-title { font-family: 'Oswald'; font-size: 1.6rem; color: #fff; text-transform: uppercase; font-style: italic; border-left: 6px solid var(--racing-red); margin-bottom: 20px; display: inline-block; background: linear-gradient(90deg, rgba(211, 16, 39, 0.25), transparent); padding: 4px 40px 4px 12px; clip-path: polygon(0 0, 100% 0, 90% 100%, 0% 100%); letter-spacing: 1px; text-shadow: 2px 2px 4px rgba(0,0,0,0.8); }

.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }

/* THE CRISP WHITE BORDERS */
.product-card { 
    background: linear-gradient(145deg, rgba(20, 20, 20, 0.95) 0%, rgba(5, 5, 5, 0.98) 100%); 
    border: 1px solid rgba(255, 255, 255, 0.15); 
    border-top: 2px solid rgba(255, 255, 255, 0.8); 
    border-radius: 4px; 
    position: relative; 
    overflow: visible; 
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease, border-color 0.3s ease; 
    z-index: 1; 
    display: flex; 
    flex-direction: column; 
    height: 100%; 
    scroll-margin-top: 180px; 
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.02); 
}
.product-card:hover { 
    transform: translateY(-6px); 
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.9), 0 0 25px rgba(255, 255, 255, 0.15); 
    border-color: rgba(255, 255, 255, 0.9); 
    z-index: 2; 
}

.product-img-wrapper { position: relative; width: 100%; height: 220px; overflow: hidden; border-bottom: 3px solid var(--racing-red); clip-path: polygon(0 0, 100% 0, 100% 100%, 0 92%); cursor: pointer; border-radius: 4px 4px 0 0; }
.product-img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.product-card:hover .product-img { transform: scale(1.08) rotate(1deg); }

.specs-badge { position: absolute; top: 15px; left: 15px; background: rgba(0, 0, 0, 0.85); color: #fff; font-family: 'Oswald', sans-serif; font-size: 0.65rem; padding: 6px 12px; border-left: 3px solid var(--racing-red); backdrop-filter: blur(5px); letter-spacing: 1.5px; display: flex; align-items: center; gap: 6px; pointer-events: none; z-index: 5; text-transform: uppercase; box-shadow: 0 4px 10px rgba(0,0,0,0.5); font-style: italic; }
.pulse-dot { width: 6px; height: 6px; background: var(--racing-red); border-radius: 50%; animation: pulse 1.5s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(211, 16, 39, 0.8); } 70% { box-shadow: 0 0 0 6px rgba(211, 16, 39, 0); } 100% { box-shadow: 0 0 0 0 rgba(211, 16, 39, 0); } }

.wishlist-btn { position: absolute; top: 15px; right: 15px; background: rgba(0, 0, 0, 0.85); color: #fff; font-size: 1.2rem; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 1px solid var(--racing-red); cursor: pointer; z-index: 6; transition: 0.3s; padding-top: 2px; }
.wishlist-btn:hover { background: var(--racing-red); transform: scale(1.1); }

.ingredient-overlay { position: absolute; inset: 0; background: rgba(7, 7, 7, 0.96); border-top: 4px solid var(--racing-red); color: #fff; padding: 1.5rem; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; transform: translateY(100%); opacity: 0; pointer-events: none; transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); z-index: 10; overflow-y: auto; }
.ingredient-overlay.active { transform: translateY(0); opacity: 1; pointer-events: auto; }
.ingredient-overlay p { font-size: 0.8rem; line-height: 1.6; color: #ccc; font-family: 'Montserrat', sans-serif; font-weight: 600; margin:0; }
.ingredient-overlay::before { content: "FUEL MIXTURE"; font-family: 'Oswald', sans-serif; color: var(--racing-red); font-size: 1rem; letter-spacing: 2px; margin-bottom: 10px; font-style: italic; }
.overlay-close { position: absolute; top: 10px; right: 10px; color: var(--racing-red); font-weight: bold; cursor: pointer; font-family: sans-serif; font-size: 1.2rem; }

.product-info { padding: 1.2rem; flex-grow: 1; display: flex; flex-direction: column; }
.product-title { font-family: 'Oswald', sans-serif; font-size: 1.3rem; margin: 0 0 10px; text-transform: uppercase; color: #fff; letter-spacing: 0.5px; text-shadow: 0 2px 4px rgba(0,0,0,0.8); font-style: italic; }

.price-row { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 15px; border-top: 1px dashed rgba(255, 255, 255, 0.1); }
.price { font-family: 'Oswald', sans-serif; font-size: 1.6rem; font-weight: 700; color: #ffffff; display: flex; align-items: flex-start; font-style: italic; }

.action-buttons { display: flex; gap: 8px; }
.btn { padding: 8px 12px; font-family: 'Oswald', sans-serif; text-transform: uppercase; cursor: pointer; font-size: 0.75rem; font-weight: 800; letter-spacing: 0.5px; transition: all 0.3s ease; clip-path: polygon(10% 0, 100% 0, 90% 100%, 0% 100%); display: inline-flex; align-items: center; justify-content: center; text-decoration: none; border: none; font-style: italic; }
.btn-cart { background: #1a1a1a; color: #fff; box-shadow: inset 0 0 0 1px #444; }
.btn-cart:hover { background: #2a2a2a; box-shadow: inset 0 0 0 1px var(--racing-red); color: var(--racing-red); }
.btn-buy { background: linear-gradient(90deg, #b00d20, var(--racing-red)); color: #fff; box-shadow: 0 4px 15px rgba(211, 16, 39, 0.4); }
.btn-buy:hover { background: var(--checker-pattern); color: #000; box-shadow: 0 4px 20px rgba(255, 255, 255, 0.3); text-shadow: 1px 1px 0px #fff; }

.cart-drawer { position: fixed; top: 0; right: -100%; width: 100%; max-width: 400px; height: 100vh; background: #0a0a0a; z-index: 5000; transition: 0.4s cubic-bezier(0.85, 0, 0.15, 1); border-left: 4px solid var(--racing-red); display: flex; flex-direction: column; }
.cart-drawer.open { right: 0; }

/* ENGINE START CHECKOUT BUTTON */
.engine-start-btn {
    background: radial-gradient(circle, #ff0000 0%, #990000 70%, #440000 100%);
    border: 3px solid #222; border-radius: 50px;
    box-shadow: 0 5px 15px rgba(211,16,39,0.5), inset 0 0 15px rgba(0,0,0,0.8);
    color: white; font-family: 'Oswald'; font-style: italic; font-size: 1.2rem;
    text-transform: uppercase; font-weight: 800; letter-spacing: 2px;
    padding: 15px; margin-top: 10px; cursor: pointer; transition: 0.2s;
    text-shadow: 1px 1px 3px #000; width: 100%;
}
.engine-start-btn.revving {
    animation: engineStartAnim 0.1s infinite;
    transform: scale(0.96);
    background: radial-gradient(circle, #ffffff 0%, #ff0000 30%, #880000 100%);
    box-shadow: 0 0 40px rgba(255,0,0,0.9);
    color: #000; text-shadow: none;
}
@keyframes engineStartAnim {
    0% { transform: translate(1px, 1px) scale(0.96); }
    50% { transform: translate(-1px, -1px) scale(0.96); }
    100% { transform: translate(1px, -1px) scale(0.96); }
}

footer { background: #000; padding: 2rem 5%; text-align: center; color: #777; font-family: 'Oswald'; font-size: 0.85rem; border-top: 1px solid #222; line-height: 1.6; }
footer span { color: var(--racing-red); font-weight: bold; }

@media (max-width: 600px) { 
    .logo-text { font-size: 1.1rem; } 
    .nav-right { gap: 8px; } 
    .pit-pass-btn { font-size: 0.6rem; padding: 3px 6px; } 
    .checker-strip { top: 58px; }
    .controls-container { top: 64px; }
    .tab-bar { gap: 6px; }
    .tab { font-size: 0.6rem; padding: 6px 2px; letter-spacing: -0.2px; white-space: normal; }
    .tab:nth-child(-n+3) { width: calc((100% - 12px) / 3); flex: none; }
    .tab:nth-child(n+4) { width: calc((100% - 18px) / 4); flex: none; }
    .section-title { font-size: 1.1rem; padding: 2px 20px 2px 8px; margin-bottom: 12px; }
    .garage-view { padding: 1rem 3% 2rem; }
    .shop-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .product-img-wrapper { height: 80px; border-bottom: 2px solid var(--racing-red); }
    .wishlist-btn { width: 24px; height: 24px; font-size: 0.9rem; top: 5px; right: 5px; }
    .product-info { padding: 6px; }
    .product-title { font-size: 0.85rem; margin: 0 0 4px; line-height: 1.1; }
    .specs-badge { font-size: 0.45rem; padding: 3px 6px; top: 5px; left: 5px; border-left: 2px solid var(--racing-red); }
    .pulse-dot { width: 4px; height: 4px; }
    .ingredient-overlay { padding: 0.5rem; }
    .ingredient-overlay p { font-size: 0.6rem; line-height: 1.3; }
    .ingredient-overlay::before { font-size: 0.75rem; margin-bottom: 5px; }
    .overlay-close { top: 5px; right: 5px; font-size: 1rem; }
    
    .custom-select-wrapper { font-size: 0.65rem; margin-bottom: 4px; }
    .custom-select-display { padding: 6px 10px; border-width: 1px !important; }
    .custom-option { padding: 6px 10px; font-size: 0.65rem; }
    
    .price-row { flex-direction: column; align-items: flex-start; gap: 4px; padding-top: 4px; }
    .price { font-size: 1rem; }
    .action-buttons { width: 100%; display: flex; flex-direction: column; gap: 4px; }
    .btn { width: 100%; padding: 5px; font-size: 0.6rem; letter-spacing: 0; clip-path: polygon(3% 0, 100% 0, 97% 100%, 0% 100%); }
}