/* =================================== */
/* Complete styles.css                 */
/* =================================== */

/* Basic Reset & Body Styles */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* UPDATED: Body styles with parallax background AND padding for fixed header */
body {
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 400;
    background-color: #1a202c; /* Dark fallback color */
    color: #333;
    line-height: 1.6;

    /* --- ADD Parallax Background --- */
    background-image: url('images/background-texture.webp');
    background-attachment: fixed;
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;

    /* --- IMPORTANT: Add padding-top equal to initial header height --- */
    /* --- Desktop Default Padding --- */
    padding-top: 300px; /* <<< Adjusted based on user feedback */
    /* --- End Padding --- */
}

/* UPDATED: Header with Racetrack Background & Shrink Transition */
.site-header {
    text-align: center;
    padding: 2rem 1rem; /* Initial padding */
    box-shadow: 0 3px 6px rgba(0,0,0,0.2);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    overflow: visible;
    transition: padding 0.4s ease-in-out;

    /* --- Racetrack Background --- */
    background-image: url('images/racetrack-straight.webp');
    background-repeat: repeat-x;
    background-position: center center;
    background-size: auto 100%;
}

/* --- ADJUSTED Overlay for Content Readability --- */
.site-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.55);
    z-index: 0;
    transition: background-color 0.4s ease-in-out;
}

/* --- Ensure Header Content is Above Overlay --- */
.site-header > .header-content, /* Group logo/title/p */
.site-header > .main-nav,
.site-header > .mobile-menu-button {
    position: relative;
    z-index: 1;
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out, margin 0.4s ease-in-out;
}
.header-content > * {
     transition: opacity 0.3s ease-in-out, max-height 0.4s ease-in-out, margin 0.4s ease-in-out, font-size 0.4s ease-in-out;
}


/* --- Footer Styling --- */
.site-footer {
    margin-top: 3rem;
    padding: 1rem;
    font-size: 0.9em;
    color: #555;
    background-color: rgba(226, 232, 240, 0.9);
    box-shadow: none;
    border-top: 1px solid #cbd5e1;
    text-align: center;
    position: relative;
    z-index: 1;
}

/* --- Logo Styling --- */
.site-logo {
    display: block;
    max-height: 60px;
    width: auto;
    margin: 0 auto 1rem auto;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5)) brightness(1.1);
    transition: max-height 0.4s ease-in-out, opacity 0.3s ease-in-out, margin 0.4s ease-in-out;
}

/* --- Header H1 and P styles - ADJUSTED FOR DARK OVERLAY --- */
.site-header h1 {
    color: #ffffff;
    margin-bottom: 0.5rem;
    font-weight: 700;
    font-size: 2.2em;
    text-transform: uppercase;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.7);
    transition: font-size 0.4s ease-in-out, opacity 0.3s ease-in-out, margin 0.4s ease-in-out;
}
.site-header p {
    font-size: 1.1em;
    color: #e2e8f0;
    margin-bottom: 0;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    transition: font-size 0.4s ease-in-out, opacity 0.3s ease-in-out, margin 0.4s ease-in-out;
}

/* --- Styles for Shrunk Header State --- */
.header-shrunk {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}
.header-shrunk::before {
    background-color: rgba(0, 0, 0, 0.75);
}
.header-shrunk .header-content > * { /* Target children for hiding */
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    font-size: 0;
    overflow: hidden;
}
.header-shrunk .main-nav {
    margin-top: 0;
    margin-bottom: 0;
}
/* --- End Shrunk Header Styles --- */


/* Grid Layout (for homepage & trivia & tips & CYOA) */
.card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr; /* Default: 3 columns */
    gap: 0.75rem; /* Default gap */
    padding: 0.75rem; /* Default padding */
    max-width: 1200px;
    margin: 0 auto;
    position: relative; /* Ensure grid layers correctly */
    z-index: 1; /* Lower z-index than header/nav */
    width: 100%; /* Ensure grid fits parent */
}

/* Specific page content styling (basic) */
.page-content {
    max-width: 900px; /* Adjust width as needed */
    margin: 0 auto 2rem auto; /* Center content, add bottom margin */
    padding: 1.5rem;
    background-color: rgba(255, 255, 255, 0.9); /* White background for readability */
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: relative; /* Ensure layers correctly */
    z-index: 1; /* Lower z-index than header/nav */
}
.page-content h2 {
    color: #1e3a8a;
    margin-bottom: 1rem;
    border-bottom: 2px solid #e0e7ff;
    padding-bottom: 0.5rem;
     text-align: center; /* Center section titles */
}
.page-content p {
    margin-bottom: 1rem;
    line-height: 1.7;
}


/* Card Styles (Base - For homepage and inherited by trivia/tips/CYOA) */
.card-container {
    perspective: 1000px;
    height: 350px; /* Default height for brand cards */
    cursor: pointer; /* Default cursor */
    transition: height 0.3s ease;
    position: relative;
    z-index: 1; /* Keep cards at base level */
    border-radius: 12px; /* Added to container for pulse effect */
}
.card-inner {
    width: 100%;
    height: 100%;
    transition: transform 0.6s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s ease; /* Flip transition */
    transform-style: preserve-3d;
    transform-origin: center center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border-radius: 12px;
}
/* Default card hover effect */
.card-container:hover .card-inner {
    box-shadow: 0 10px 20px rgba(0,0,0,0.25);
    transform: translateY(-5px);
    /* z-index: 10; Optional: lift card slightly higher visually */
}
.card-inner.is-flipped {
    transform: rotateY(180deg);
}
.card-container:hover .card-inner.is-flipped {
    transform: rotateY(180deg) translateY(-5px);
}

.card-face {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden; /* Base rule */
    border-radius: 12px;
    overflow: hidden;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    text-align: center;
    transition: padding 0.3s ease;
}

/* Default Front Face (Homepage Cards) */
.card-face-front {
    background-color: #2d3748;
    background-image: url('images/carbon-circuit-texture.webp');
    background-size: auto;
    background-repeat: repeat;
    background-position: center center;
    color: #f7fafc;
    border: 1px solid #4a5568;
    z-index: 1; /* Base z-index for front */
}
.card-face-front::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0, 0, 0, 0.4); border-radius: inherit; z-index: 1; pointer-events: none; }
.card-face-front::after { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: inherit; pointer-events: none; z-index: 2; background: linear-gradient( 110deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0) 40%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0) 60%, rgba(255, 255, 255, 0) 100% ); animation: cardShine 15s ease-in-out var(--shine-delay, 2s) infinite; transform: translateX(-150%) skewX(-25deg); opacity: 0; }
@keyframes cardShine { 0% { transform: translateX(-150%) skewX(-25deg); opacity: 0; } 10% { opacity: 1; } 90% { opacity: 1; } 100% { transform: translateX(150%) skewX(-25deg); opacity: 0; } }

.card-logo-image { display: block; width: auto; max-width: 85%; margin-left: auto; margin-right: auto; margin-bottom: 1rem; object-fit: contain; border-radius: 6px; background-color: rgba(255, 255, 255, 0.05); transition: height 0.3s ease; height: 80px; position: relative; z-index: 2; }
.card-product-image { display: block; width: auto; max-width: 90%; margin-left: auto; margin-right: auto; margin-bottom: 1.2rem; object-fit: contain; border-radius: 8px; transition: height 0.3s ease; height: 130px; border: 1px solid rgba(255, 255, 255, 0.2); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2); position: relative; z-index: 2; }
.card-face-front h3 { color: #e2e8f0; font-weight: 700; text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7); position: relative; z-index: 3; }
.card-face-front p.tagline { color: #cbd5e1; text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7); position: relative; z-index: 3; font-size: 0.9em; line-height: 1.4; margin-bottom: 0.5rem;}
.card-face-front p.flip-indicator { color: #a0aec0; text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6); position: relative; z-index: 3; display: flex; align-items: center; margin-top: auto; font-size: 0.8em; }
.card-face-front p.flip-indicator svg { fill: #a0aec0; width: 14px; height: 14px; margin-right: 4px; }

/* Default Back Face (Homepage Cards) */
.card-face-back {
    background-color: #333;
    background-image: url('images/gold-texture.webp');
    background-size: auto;
    background-repeat: repeat;
    background-position: center center;
    color: #ffffff;
    transform: rotateY(180deg); /* Initial rotation */
    border: 1px solid #a88e40;
    z-index: 0; /* Base z-index for back */
    justify-content: center;
    position: relative;
    backface-visibility: hidden; /* Ensure it's hidden when not facing */
}
.card-face-back::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0, 0, 0, 0.35); border-radius: inherit; z-index: 1; pointer-events: none; }
.card-face-back > * { opacity: 0; transition: opacity 0.4s ease 0.2s; position: relative; z-index: 2; }
.card-inner.is-flipped .card-face-back > * { opacity: 1; }

.card-face h3 { font-size: 1.4em; margin-bottom: 0.3rem; transition: font-size 0.3s ease; font-weight: 700; }
.card-face-back h3 { color: #ffffff; font-size: 1.3em; margin-bottom: 1rem; transition: font-size 0.3s ease; font-weight: 700; }
.card-face p.tagline { font-size: 0.9em; margin-bottom: 1rem; line-height: 1.6; transition: all 0.3s ease; font-weight: 400; }

/* --- MODIFIED DISCOUNT BADGE STYLING --- */
.discount-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #dc2626; /* Red background */
    color: white; /* White text */
    border-radius: 9999px; /* Pill shape */
    padding: 0.3rem 0.7rem; /* Padding around text */
    font-size: 0.8em; /* Text size */
    font-weight: 700; /* Bold text */
    line-height: 1.2; /* Line height */
    text-align: center;
    white-space: nowrap; /* Prevent text wrapping */
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 4; /* Ensure it's on top */
    transition: all 0.3s ease;
    display: inline-block;
    vertical-align: top;
}
/* --- REMOVED the ::before pseudo-element styling that set content --- */
/* --- END MODIFICATION --- */


.cta-button { display: inline-block; background-color: #ffffff; color: #504219; padding: 0.8rem 1.8rem; border-radius: 8px; text-decoration: none; font-weight: 700; transition: all 0.25s ease; border: none; cursor: pointer; margin-top: 1.2rem; font-size: 1em; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15); }
.cta-button:hover, .cta-button:focus { background-color: #fffbeb; color: #000000; outline: none; transform: translateY(-2px) scale(1.02); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2); }
.cta-button svg { width: 16px; height: 16px; margin-right: 8px; vertical-align: middle; fill: #504219; transition: fill 0.25s ease; }
.cta-button:hover svg, .cta-button:focus svg { fill: #000000; }

/* ================================================================ */
/* == Navigation Styles - V13 - Mobile First Simplified Display == */
/* ================================================================ */

/* --- Mobile Menu Button (Hidden >= 992px) --- */
.mobile-menu-button {
    display: none; /* Hidden by default */
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 120; /* Above nav */
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 4px;
}
.mobile-menu-button span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: #fff;
    margin: 5px 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
/* Hamburger animation */
.mobile-nav-open .mobile-menu-button span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.mobile-nav-open .mobile-menu-button span:nth-child(2) { opacity: 0; }
.mobile-nav-open .mobile-menu-button span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
/* --- End Mobile Menu Button --- */


/* --- Default Desktop Nav Styles --- */
.main-nav {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 50;
    transition: margin 0.4s ease-in-out;
}
.main-nav ul { /* This targets the main UL */
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex; /* Horizontal layout */
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.main-nav li {
    display: inline-block; /* Inline items */
    position: relative;
}
.main-nav a {
    display: block;
    text-decoration: none;
    color: #ffffff;
    font-weight: 700;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: background-color 0.2s ease, color 0.2s ease, padding 0.4s ease-in-out;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.4);
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    white-space: nowrap;
    cursor: pointer;
}
.main-nav a:hover, .main-nav a:focus {
    background-color: rgba(255, 255, 255, 0.8);
    color: #1e3a8a;
    text-shadow: none;
    outline: none;
}
.main-nav a.active,
.main-nav li.active > a {
    background-color: #ffffff;
    color: #1e3a8a;
    text-shadow: none;
    cursor: default;
    border-color: #ffffff;
}
.main-nav a.active:hover, .main-nav a.active:focus,
.main-nav li.active > a:hover, .main-nav li.active > a:focus {
    background-color: #ffffff;
    color: #1e3a8a;
}

/* --- Desktop Dropdown Styles --- */
.main-nav li.has-submenu > a::after {
    content: ' ▼';
    font-size: 0.7em;
    display: inline-block;
    margin-left: 4px;
    vertical-align: middle;
    transition: transform 0.3s ease;
}
.main-nav li.has-submenu:hover > a::after,
.main-nav li.has-submenu.submenu-open > a::after { /* Added .submenu-open */
    transform: rotate(180deg);
}

.main-nav ul ul.submenu {
    display: none; /* Hidden by default */
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 100%;
    background-color: rgba(255, 255, 255, 0.98);
    border-radius: 6px;
    padding: 0.5rem 0;
    margin: 5px 0 0 0;
    min-width: 220px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    z-index: 110; /* Higher z-index for dropdown */
    text-align: left;
    border: 1px solid #e2e8f0;
    max-height: 60vh;
    overflow-y: auto;
}

/* *** MODIFIED: Show on hover OR when .submenu-open class is present *** */
.main-nav li.has-submenu:hover > ul.submenu,
.main-nav li.has-submenu.submenu-open > ul.submenu {
    display: block;
}

.main-nav ul ul.submenu li {
    display: block;
    width: 100%;
}

.main-nav ul ul.submenu li a {
    padding: 0.6rem 1.2rem;
    color: #1e3a8a;
    background-color: transparent;
    border: none;
    text-shadow: none;
    border-radius: 0;
    white-space: normal;
    font-size: 0.9em;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.main-nav ul ul.submenu li a:hover,
.main-nav ul ul.submenu li a:focus {
    background-color: #e0e7ff;
    color: #1c388a;
}
/* --- End Desktop Dropdown Styles --- */


/* =================================== */
/* Mobile Navigation Styles Override   */
/* =================================== */
@media (max-width: 991px) {
    .mobile-menu-button {
        display: block; /* Show hamburger */
    }

    .main-nav {
        /* Hide the nav container itself using display */
        display: none;
        position: fixed; /* Use fixed for overlay */
        top: 0;
        left: 0;
        width: 100%; /* Full width for background */
        height: 100%; /* Full height */
        background-color: rgba(45, 55, 72, 0.95); /* Dark background */
        z-index: 115; /* Above header overlay */
        overflow-y: auto; /* Allow scrolling within menu */
        padding-top: 60px; /* Space for header */
        margin: 0;
    }

    /* Show menu when header has .mobile-nav-open */
    .site-header.mobile-nav-open .main-nav {
        display: block; /* Show the container */
    }

    /* Style the list inside the container */
     .main-nav > ul {
        display: block; /* Stack items vertically */
        width: 100%;
        padding: 0;
        margin: 0;
        background: none; /* Remove any inherited background */
        box-shadow: none; /* Remove any inherited shadow */
        position: static; /* Reset positioning */
        max-height: none; /* Reset max-height */
        overflow-y: visible; /* Reset overflow */
     }

    .main-nav li {
        display: block; /* Stack items */
        width: 100%;
        text-align: left;
    }

    .main-nav a {
        padding: 1rem 1.5rem; /* Consistent padding */
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 0;
        background-color: transparent;
        white-space: normal; /* Allow wrapping */
        color: #ffffff;
        text-shadow: none;
    }
    .main-nav a:hover, .main-nav a:focus {
         background-color: rgba(255, 255, 255, 0.1);
         color: #ffffff;
    }
    .main-nav a.active, .main-nav li.active > a {
        background-color: rgba(255, 255, 255, 0.9);
        color: #1e3a8a;
    }

    /* Mobile Submenu Styles */
    .main-nav ul ul.submenu {
        position: static;
        display: none; /* Hide by default */
        transform: none;
        box-shadow: none;
        border: none;
        border-radius: 0;
        background-color: rgba(0, 0, 0, 0.2);
        padding: 0;
        margin: 0;
        max-height: none;
        overflow-y: visible;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transition: none;
        width: 100%;
    }
    /* Show only when class is added on mobile */
    .main-nav li.has-submenu.submenu-open > ul.submenu {
        display: block !important;
    }
    .main-nav ul ul.submenu li a {
        padding-left: 2.5rem;
        font-size: 0.9em; /* Adjusted size */
        font-weight: normal;
        color: #cbd5e1;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }
     .main-nav ul ul.submenu li a:hover,
     .main-nav ul ul.submenu li a:focus {
        background-color: rgba(255, 255, 255, 0.1);
        color: #ffffff;
    }
    .main-nav li.has-submenu > a::after {
        float: right;
        margin-top: 4px;
    }

}

/* =================================== */
/* Games Page Specific Styles        */
/* =================================== */

/* Override background for the games page main content */
main#games-page.page-content {
    background-color: #333; /* Dark fallback color */
    background-image: url('images/gold-texture.webp');
    background-size: auto; /* Or 'cover' if you prefer */
    background-repeat: repeat;
    background-position: center center;
    border: 1px solid #a88e40; /* Add a gold border */
    color: #ffffff; /* Change default text color to white for contrast */
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5); /* Add text shadow for readability */
}

/* Adjust heading colors on the games page */
main#games-page.page-content h2 {
    color: #ffffff; /* White heading */
    border-bottom-color: #a88e40; /* Gold border */
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
}

/* Adjust paragraph color on the games page */
main#games-page.page-content p {
    color: #f0f0f0; /* Light grey/off-white for paragraphs */
}

/* Keep score display background light for contrast, but adjust text */
#score-display-area {
    background-color: rgba(255, 255, 255, 0.9); /* Keep light background */
    color: #1e3a8a; /* Dark blue text */
    text-shadow: none; /* Remove text shadow from score area */
    padding: 0.5rem 1rem; /* Add some padding */
    border-radius: 6px;
    margin-bottom: 1rem;
    display: inline-block; /* Fit content */
}
#score-display-area #score-counter,
#score-display-area #level-counter {
     color: #1e3a8a; /* Ensure numbers are dark blue */
     font-weight: bold;
}
#score-display-area #level-counter {
     /* background-color: #e0e7ff; */ /* Removed different background */
     margin-left: 0.5rem;
     padding-left: 0.5rem;
     border-left: 1px solid #ccc;
}


/* Ensure end game message is readable */
#end-game-message {
    color: #ffffff; /* White text */
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Keep trivia card front light */
.trivia-card-face-front {
    background-color: #f0f4f8; /* Already light */
    color: #1f2937; /* Dark text */
    text-shadow: none;
    border: 1px solid #cbd5e1;
}
.trivia-statement {
    color: #1f2937; /* Dark text */
}

/* Keep pagination button text readable (already white, should be fine) */
/* Keep footer background light */
.site-footer {
     background-color: rgba(226, 232, 240, 0.9);
     color: #555;
     text-shadow: none;
}


/* =================================== */
/* Trivia Game Styles (True/False)   */
/* =================================== */

/* Score display area styling moved above to Games Page Specific Styles */

/* --- Trivia Card Specific Styles --- */
#trivia-grid .card-container { height: 300px; } /* Height for trivia cards */
.trivia-card-container { cursor: default; }
.trivia-card-container:hover .card-inner { transform: none; box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
.trivia-card-container:hover .card-inner.is-flipped { transform: rotateY(180deg); box-shadow: 0 4px 8px rgba(0,0,0,0.1); }

/* Front Face (Statement + Buttons) */
.trivia-card-face-front {
    /* background-color: #f0f4f8; */ /* Moved to page specific */
    /* color: #1f2937; */ /* Moved to page specific */
    justify-content: space-between;
    padding: 1.5rem;
    /* text-shadow: none; */ /* Moved to page specific */
    /* border: 1px solid #cbd5e1; */ /* Moved to page specific */
    z-index: 2;
    backface-visibility: hidden;
}
.trivia-statement { font-size: 1.1em; line-height: 1.5; font-weight: 700; flex-grow: 1; display: flex; align-items: center; justify-content: center; margin-bottom: 1rem; padding: 0 0.5rem; /* color: #1f2937; */ /* Moved to page specific */ }

/* *** MODIFIED: Button Container - Stack Vertically *** */
.trivia-tf-buttons {
    display: flex;
    flex-direction: column; /* Stack vertically */
    align-items: center;    /* Center buttons horizontally */
    width: 100%;
    gap: 0.5rem;            /* Add space BETWEEN buttons */
    flex-shrink: 0;
    margin-top: 0.5rem;     /* Add some space above the button group */
}

/* *** MODIFIED: Button Styling *** */
.trivia-tf-button {
    padding: 0.6rem 1rem; /* Adjust padding */
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.9em; /* Slightly smaller font */
    transition: all 0.2s ease;
    width: 85%; /* Make buttons take up more width */
    max-width: 200px; /* Prevent them getting too wide on large screens */
    pointer-events: auto !important;
    position: relative;
    z-index: 5;
    text-align: center; /* Ensure text is centered */
}
/* Keep specific button colors */
.true-button { background-color: #10b981; color: white; border-color: #059669; }
.true-button:hover { background-color: #059669; transform: scale(1.02); } /* Subtle hover */
.false-button { background-color: #ef4444; color: white; border-color: #dc2626; }
.false-button:hover { background-color: #dc2626; transform: scale(1.02); } /* Subtle hover */

/* Styles when buttons are disabled after answer */
.trivia-tf-button:disabled { opacity: 0.5; cursor: default; transform: none; pointer-events: none; }
.trivia-tf-button.selected-correct { box-shadow: 0 0 15px 5px rgba(255, 255, 0, 0.8); opacity: 1; }
.trivia-tf-button.selected-incorrect { opacity: 0.4; }

/* --- Back Face (Correct/Incorrect Texture) --- */
.trivia-card-face-back {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background-size: cover;
    background-position: center;
    border: 3px solid white;
    color: #ffffff;
    background-color: #4a5568;
    background-image: none;
    transform: rotateY(180deg);
    z-index: 1;
    backface-visibility: hidden;
}
.trivia-card-face-back::before { display: none; }
.back-correct {
    background-color: #10b981 !important;
    background-image: url('images/correct-texture.webp') !important;
    border-color: #6ee7b7 !important;
    position: relative;
}
.back-incorrect {
    background-color: #ef4444 !important;
    background-image: url('images/incorrect-texture.webp') !important;
    border-color: #fca5a5 !important;
    position: relative;
}

/* --- General Trivia Card Adjustments --- */
.trivia-card-inner.answered { /* Optional styling */ }

/* =================================== */
/* Trivia Game Enhancements          */
/* =================================== */

/* Score Increase Animation */
@keyframes scoreIncrease {
  0% { transform: scale(1); color: #1e3a8a; } /* Start color */
  50% { transform: scale(1.25); color: #10b981; } /* Scale up and turn green */
  100% { transform: scale(1); color: #1e3a8a; } /* Return to normal */
}

.score-increase-animation {
  display: inline-block; /* Needed for transform to work correctly */
  animation: scoreIncrease 0.5s ease-in-out;
}

/* Level Car Image Styling */
#level-car-image {
    height: 30px; /* Adjust height as needed */
    width: auto; /* Maintain aspect ratio */
    margin-left: 10px; /* Space from level text */
    vertical-align: middle; /* Align nicely with the text */
    transition: opacity 0.3s ease, transform 0.3s ease; /* Optional smooth transition */
}

/* Optional: Add a subtle animation when the car changes */
#level-car-image.level-up {
    transform: scale(1.1);
    opacity: 0.8;
}

/* =================================== */
/* Sim Racing Tips Page Styles       */
/* =================================== */

/* --- Tip Card Specific Styles --- */
#tips-grid .card-container {
    height: 280px;
    cursor: pointer;
}
#tips-grid .card-container:hover .card-inner,
#tips-grid .card-container:active .card-inner {
    transform: none !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
#tips-grid .card-container:hover .card-inner.is-flipped,
#tips-grid .card-container:active .card-inner.is-flipped {
    transform: rotateY(180deg) !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Front Face (Tip Text + Indicator) */
.tip-card-face-front {
    background-color: #e0f2fe;
    background-image: none;
    color: #075985;
    justify-content: space-between;
    padding: 1.5rem;
    text-shadow: none;
    border: 1px solid #bae6fd;
    z-index: 2;
    backface-visibility: hidden;
}

.tip-front-text { font-size: 1.15em; line-height: 1.5; font-weight: 700; flex-grow: 1; display: flex; align-items: center; justify-content: center; margin-bottom: 0.5rem; padding: 0 0.5rem; color: #075985; }
.tip-flip-indicator { color: #0ea5e9; text-shadow: none; position: relative; display: flex; align-items: center; justify-content: center; margin-top: auto; font-size: 0.8em; width: 100%; }
.tip-flip-indicator svg { fill: #0ea5e9; width: 14px; height: 14px; margin-right: 4px; }

/* Back Face (Explanation) */
.tip-card-face-back {
    background-color: #ffffff;
    color: #333;
    justify-content: flex-start;
    align-items: flex-start;
    padding: 1.5rem;
    text-align: left;
    font-size: 0.95em;
    line-height: 1.6;
    border: 1px solid #e2e8f0;
    overflow-y: auto;
    transform: rotateY(180deg);
    background-image: none;
     z-index: 1;
     backface-visibility: hidden;
}
.tip-card-face-back::before { display: none; }

.tip-back-explanation { width: 100%; }
.tip-back-explanation strong { color: #1e3a8a; }

/* --- Pagination Styles --- */
#tips-pagination { padding: 1rem 0; text-align: center; margin-top: 1.5rem; display: flex; justify-content: center; align-items: center; gap: 1rem; }
.pagination-btn { background-color: #3b82f6; color: white; font-size: 1em; padding: 0.6rem 1.2rem; min-width: 100px; border: none; border-radius: 6px; cursor: pointer; transition: background-color 0.2s ease; }
.pagination-btn:hover { background-color: #2563eb; }
.pagination-btn:disabled { background-color: #9ca3af; cursor: not-allowed; }
#page-indicator { min-width: 80px; text-align: center; font-weight: bold; color: #1e3a8a; }


/* =================================== */
/* Build-a-Rig Page Styles           */
/* =================================== */

#configurator-page h2 { text-align: center; margin-bottom: 1.5rem; }
#rig-builder-container { display: flex; flex-direction: column; gap: 2rem; }
#component-options-panel { flex: 1; min-width: 280px; max-width: 400px; margin: 0 auto; }
#component-categories { max-height: 70vh; overflow-y: auto; padding-right: 10px; border: 1px solid #e2e8f0; border-radius: 6px; background-color: #f8fafc; }
.category-selector { margin-bottom: 1.5rem; padding: 1rem; border-bottom: 1px solid #e2e8f0; }
.category-selector:last-child { border-bottom: none; }
.category-selector h3 { font-size: 1.1em; color: #1e3a8a; margin-bottom: 0.8rem; padding-bottom: 0.3rem; border-bottom: 1px solid #dbeafe; }
.component-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.component-option { border: 1px solid #d1d5db; border-radius: 6px; padding: 0.6rem; font-size: 0.85em; text-align: center; background-color: #ffffff; cursor: pointer; transition: background-color 0.2s ease, box-shadow 0.2s ease; display: flex; flex-direction: column; justify-content: space-between; min-height: 80px; }
.component-option:hover { background-color: #f0f9ff; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.component-option strong { display: block; margin-bottom: 0.3rem; color: #334155; }
.component-tier, .component-price { font-size: 0.8em; color: #64748b; margin-top: 0.3rem; }
#rig-assembly-panel { flex: 1.5; background-color: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 1.5rem; }
#rig-template { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1rem; border: 2px dashed #d1d5db; padding: 1rem; border-radius: 6px; min-height: 200px; margin-bottom: 1.5rem; background-color: #ffffff; }
.rig-slot { border: 1px solid #e5e7eb; background-color: #f9fafb; border-radius: 4px; padding: 0.5rem; text-align: center; font-size: 0.9em; color: #9ca3af; min-height: 80px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.rig-slot.filled { color: #374151; background-color: #f0f9ff; border-color: #bfdbfe; justify-content: flex-start; font-size: 0.8em; }
.rig-slot img { max-width: 80%; max-height: 50px; margin-bottom: 0.3rem; object-fit: contain; }
.rig-slot .component-name { font-weight: bold; word-break: break-word; }
.feedback-area { margin-top: 1rem; padding: 1rem; border-radius: 6px; background-color: #f3f4f6; border: 1px solid #e5e7eb; font-size: 0.9em; }
.feedback-area h3, .feedback-area h4 { color: #1e3a8a; margin-bottom: 0.5rem; }
@media (min-width: 768px) { #rig-builder-container { flex-direction: row; } #component-options-panel { margin: 0; } }

/* =================================== */
/* Build-a-Rig Enhancements Styles   */
/* =================================== */

/* --- Platform Selector --- */
#platform-selector {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #e0e7ff; /* Light blue background */
    border-radius: 6px;
    border: 1px solid #c7d2fe;
}
#platform-selector h3 {
    font-size: 1.1em;
    color: #1e3a8a;
    margin-bottom: 0.75rem;
    text-align: center;
}
.platform-options {
    display: flex;
    justify-content: space-around;
    gap: 1rem;
}
.platform-options label {
    cursor: pointer;
    font-weight: 500;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.platform-options input[type="radio"] {
    accent-color: #2563eb; /* Style the radio button color */
    transform: scale(1.1);
}

/* --- Quick Build Buttons --- */
#quick-build-buttons {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #f3f4f6;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}
#quick-build-buttons h3 {
     font-size: 1.1em;
     color: #1f2937;
     margin-bottom: 0.75rem;
     text-align: center;
}
#quick-build-buttons button.quick-build-btn {
    display: block; /* Stack buttons */
    width: 100%;
    margin-bottom: 0.5rem;
    padding: 0.6rem 1rem;
    font-size: 0.9em;
    background-color: #4b5563; /* Darker grey */
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-align: center;
}
#quick-build-buttons button.quick-build-btn:last-child {
    margin-bottom: 0;
}
#quick-build-buttons button.quick-build-btn:hover {
    background-color: #374151;
}

/* --- Component Option Enhancements --- */
.component-option {
    position: relative; /* Needed for discount text absolute positioning */
    overflow: hidden; /* Keep sparkle contained */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.component-option-image {
    display: block;
    max-width: 90%;
    max-height: 60px; /* Increased max height */
    margin: 0 auto 0.5rem auto; /* Center image */
    object-fit: contain;
}
.component-option-details {
    margin-top: auto; /* Push details to bottom */
    padding-top: 0.3rem;
}
.component-discount-text {
    display: block;
    font-size: 0.75em;
    color: #dc2626; /* Red for discount */
    font-weight: bold;
    margin-top: 3px;
}

/* Style for platform incompatibility */
.component-option.platform-incompatible {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #fecaca !important; /* Light red background */
    border-color: #f87171 !important;
}
.component-option.platform-incompatible:hover {
    box-shadow: none;
    transform: none;
}

/* Style for selected component */
.component-option.selected {
    border-color: #2563eb;
    box-shadow: 0 0 8px 1px #60a5fa;
    background-color: #eff6ff;
}

/* --- Discounted Item Visual Cue (Component Options) --- */
.component-option.has-discount {
    border: 1px solid #facc15; /* Gold border */
    animation: gentleComponentPulse 1.8s infinite ease-in-out alternate; /* Use alternate */
}

.component-option.has-discount:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 12px rgba(250, 204, 21, 0.4); /* Gold shadow */
    animation-play-state: paused; /* Pause pulse on hover */
}

/* Gentle Pulse Animation for components */
@keyframes gentleComponentPulse {
  0% { box-shadow: 0 0 2px rgba(250, 204, 21, 0.2); border-color: #facc15; }
  100% { box-shadow: 0 0 6px rgba(250, 204, 21, 0.5); border-color: #eab308; }
}


/* --- Build Button Styling --- */
.build-button {
    font-size: 1.2em !important;
    padding: 0.8rem 1.8rem !important;
    background-color: #16a34a !important; /* Green */
    border-color: #15803d !important;
    font-weight: bold;
    transition: all 0.3s ease;
}
.build-button:hover {
    background-color: #15803d !important;
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(22, 163, 74, 0.4);
}

/* --- Evaluation Celebration Effect --- */
#celebration-container.celebrate::before {
    content: '';
    position: absolute;
    top: -20px; left: -20px; right: -20px; bottom: -20px; /* Expand slightly */
    background: radial-gradient(circle, rgba(255,215,0,0.5) 0%, rgba(255,215,0,0) 70%);
    border-radius: 15px; /* Match container */
    animation: celebrationGlow 1.5s ease-out forwards;
    z-index: -1; /* Behind the results box */
    pointer-events: none;
}

@keyframes celebrationGlow {
    0% { opacity: 0; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.05); }
    100% { opacity: 0; transform: scale(1); }
}

/* --- Consultancy Section Styling --- */
.consultancy-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb; /* Separator line */
}

/* --- General Config Section Styling --- */
.config-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #f9fafb;
    border-radius: 6px;
    border: 1px solid #f3f4f6;
}
.config-section h3 {
    font-size: 1.1em;
    color: #111827;
    margin-bottom: 0.75rem;
    text-align: center;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.4rem;
}

/* --- Responsive Adjustments for Builder --- */
@media (max-width: 768px) {
    .component-list {
        grid-template-columns: 1fr 1fr; /* 2 columns on smaller screens */
    }
    #rig-template {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 0.5rem;
    }
    .rig-slot {
        font-size: 0.8em;
        min-height: 70px;
    }
    .rig-slot img {
        max-height: 40px;
    }
    .platform-options {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }
     #quick-build-buttons {
         display: grid;
         grid-template-columns: 1fr 1fr; /* 2 columns for buttons */
         gap: 0.5rem;
     }
     #quick-build-buttons button.quick-build-btn {
         margin-bottom: 0; /* Remove bottom margin when in grid */
     }
}

@media (max-width: 480px) {
    .component-list {
        grid-template-columns: 1fr; /* 1 column on very small screens */
    }
     #quick-build-buttons {
         grid-template-columns: 1fr; /* Stack buttons */
     }
     #quick-build-buttons button.quick-build-btn {
         margin-bottom: 0.5rem;
     }
     #quick-build-buttons button.quick-build-btn:last-child {
         margin-bottom: 0;
     }
}

/* ================================================================ */
/* == CYOA Game Styles == */
/* ================================================================ */
#cyoa-page h2 { text-align: left; }
#cyoa-page h3 { margin-top: 1.5rem; margin-bottom: 0.5rem; color: #1e3a8a; text-align: center;}
#situation-area p { font-size: 1.1em; background-color: #f9fafb; padding: 1rem; border-radius: 6px; border: 1px solid #e5e7eb; }
#resource-area { text-align: center; margin-bottom: 1.5rem; display: flex; flex-wrap: wrap; justify-content: space-around; background-color:#e0e7ff; padding: 0.75rem; border-radius: 6px; }
#resource-area span { font-size: 0.95em; margin: 0 10px;}
#resource-area strong { color: #1e3a8a; font-size: 1.1em; }
#choice-cards { grid-template-columns: 1fr 1fr; min-height: 180px; width: 100%; }
.cyoa-card-container { height: 180px; cursor: pointer; border: 2px solid transparent; transition: border-color 0.3s ease; }
#choice-cards .cyoa-card-container:hover .card-inner,
#choice-cards .cyoa-card-container:active .card-inner { transform: none !important; box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
#choice-cards .cyoa-card-container:hover .card-inner.is-flipped,
#choice-cards .cyoa-card-container:active .card-inner.is-flipped { transform: rotateY(180deg) !important; box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
.cyoa-card-container.selected { border-color: #2563eb; box-shadow: 0 0 10px 2px #60a5fa; }
.cyoa-card-container.disabled { opacity: 0.6; cursor: not-allowed; }
.cyoa-card-front, .cyoa-card-back { justify-content: center; background-color: #ffffff; border: 1px solid #d1d5db; color: #1f2937; font-size: 1em; text-shadow: none; padding: 1rem; backface-visibility: hidden; }
.cyoa-card-back { background-color: #f0f9ff; transform: rotateY(180deg); }
.cyoa-front-text, .cyoa-back-text { font-weight: normal; line-height: 1.5; }
.cyoa-front-text { font-weight: bold; }
.cyoa-requirement-text { font-size: 0.7em; color: #dc2626; margin-top: 0.5rem; }
#action-buttons { text-align: center; margin-top: 1.5rem; }
#confirm-choice-button { background-color: #10b981; margin-right: 0.5rem; }
#confirm-choice-button:hover { background-color: #059669; }
#inventory-display { margin-top: 2rem; padding: 1rem; background-color: #f3f4f6; border: 1px solid #e5e7eb; border-radius: 6px; }
#inventory-display h4 { margin-bottom: 0.5rem; color: #1e3a8a; }
#inventory-display ul { list-style: none; padding: 0; margin: 0; font-size: 0.9em; color: #374151; }
#inventory-display li { margin-bottom: 0.3rem; }

/* =================================== */
/* All Brands Page Specific Styles   */
/* =================================== */

#brands-card-grid { grid-template-columns: repeat(4, 1fr); gap: 0.75rem; max-width: 1400px; }
.small-brand-card { height: 220px; cursor: pointer; }
.small-brand-card .card-face { padding: 0.8rem; justify-content: space-between; }
.small-brand-card .card-logo-image { height: 50px; max-width: 80%; margin-bottom: 0.5rem; }
.small-brand-card .card-face h3 { font-size: 1.0em; margin-bottom: 0.2rem; }
.small-brand-card .card-face p.tagline { font-size: 0.75em; line-height: 1.3; margin-bottom: 0.3rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.small-brand-card .card-face-front p.flip-indicator { font-size: 0.7em; margin-top: 0.5rem; }
.small-brand-card .card-face-front p.flip-indicator svg { width: 12px; height: 12px; }
.small-brand-card .card-face-back { justify-content: center; }
.small-brand-card .card-face-back h3 { font-size: 1.0em; margin-bottom: 0.8rem; }
.small-brand-card .cta-button { padding: 0.5rem 1rem; font-size: 0.85em; margin-top: 0; }
.small-brand-card .cta-button svg { width: 14px; height: 14px; margin-right: 5px; }
@media (max-width: 991px) { #brands-card-grid { grid-template-columns: repeat(4, 1fr); gap: 0.5rem; } .small-brand-card { height: 200px; } .small-brand-card .card-logo-image { height: 40px; } .small-brand-card .card-face h3 { font-size: 0.9em; } .small-brand-card .card-face p.tagline { font-size: 0.7em; -webkit-line-clamp: 2; } .small-brand-card .card-face-front p.flip-indicator { font-size: 0.6em; } .small-brand-card .cta-button { font-size: 0.8em; padding: 0.4rem 0.8rem; } }
@media (max-width: 640px) { #brands-card-grid { grid-template-columns: repeat(4, 1fr); gap: 0.4rem; } .small-brand-card { height: 180px; } .small-brand-card .card-logo-image { height: 35px; } .small-brand-card .card-face h3 { font-size: 0.8em; } .small-brand-card .card-face p.tagline { font-size: 0.65em; -webkit-line-clamp: 1; } .small-brand-card .card-face-front p.flip-indicator { display: none; } .small-brand-card .card-face-back h3 { font-size: 0.9em; margin-bottom: 0.5rem; } .small-brand-card .cta-button { font-size: 0.75em; padding: 0.3rem 0.6rem; } .small-brand-card .cta-button svg { width: 12px; height: 12px; } }
.small-brand-card:hover .card-inner { transform: none; box-shadow: 0 6px 12px rgba(0,0,0,0.2); }
.small-brand-card:hover .card-inner.is-flipped { transform: rotateY(180deg); box-shadow: 0 6px 12px rgba(0,0,0,0.2); }


/* ================================================================ */
/* == Media Queries (General - Apply AFTER specific page styles) == */
/* ================================================================ */

@media (max-width: 640px) {
     body { padding-top: 400px; }
     .card-grid:not(#brands-card-grid) { grid-template-columns: 1fr 1fr; gap: 0.6rem; }
     .card-container:not(.small-brand-card) { height: 280px; }
     .card-face:not(.small-brand-card .card-face) { padding: 0.8rem; }
     .card-logo-image:not(.small-brand-card .card-logo-image) { height: 55px; margin-bottom: 0.4rem; max-width: 85%; }
     .card-product-image:not(.small-brand-card .card-product-image) { height: 90px; margin-bottom: 0.6rem; max-width: 85%; }
     .card-face:not(.small-brand-card .card-face) h3 { font-size: 1.0em; margin-bottom: 0.15rem; }
     .card-face-back:not(.small-brand-card .card-face-back) h3 { font-size: 1.0em; margin-bottom: 0.5rem; }
     .card-face:not(.small-brand-card .card-face) p.tagline { font-size: 0.7em; margin-bottom: 0.4rem; line-height: 1.2;}
     .card-face-front:not(.small-brand-card .card-face-front) p.flip-indicator { font-size: 0.6em; margin-top: 0.4rem; }
     .card-face-front:not(.small-brand-card .card-face-front) p.flip-indicator svg { width: 10px; height: 10px; margin-right: 3px;}
     .cta-button:not(.small-brand-card .cta-button) { padding: 0.6rem 1rem; font-size: 0.8em; margin-top: 0.6rem; }
     .cta-button:not(.small-brand-card .cta-button):hover,
     .cta-button:not(.small-brand-card .cta-button):focus { transform: translateY(-1px) scale(1.01); }
     .cta-button:not(.small-brand-card .cta-button) svg { width: 12px; height: 12px; margin-right: 4px; }
     .discount-badge { top: 6px; right: 6px; font-size: 0.7em; padding: 0.2rem 0.5rem; }
     .site-header h1 { font-size: 1.8em; }
     .site-header p { font-size: 1.0em; }
     .site-logo { max-height: 50px; }
     .page-content { padding: 1rem; }
     #trivia-grid .card-container { height: 260px; }
     .trivia-statement { font-size: 0.95em; margin-bottom: 0.8rem;}
     .trivia-tf-button { padding: 0.6rem 1rem; font-size: 0.9em; width: 90%; max-width: 180px; }
     #score-display-area { font-size: 1.2em; padding: 0.6rem; }
     #tips-grid .card-container { height: 250px; }
     .tip-front-text { font-size: 1.0em; }
     .tip-card-face-back { font-size: 0.9em; padding: 1rem; }
     .pagination-btn { font-size: 0.9em; padding: 0.5rem 1rem; min-width: 80px; }
     .component-list { grid-template-columns: 1fr; }
     .rig-slot { min-height: 60px;}
     .rig-slot img { max-height: 35px;}
     .component-option { font-size: 0.8em; padding: 0.5rem; min-height: 70px;}
     #choice-cards { grid-template-columns: 1fr; }
     .cyoa-card-container { height: auto; min-height: 120px; }
}

@media (max-width: 480px) {
     body { padding-top: 400px; }
     .card-grid:not(#brands-card-grid) { grid-template-columns: 1fr 1fr; gap: 0.6rem; }
     .card-container:not(.small-brand-card) { height: 300px; }
     .site-header h1 { font-size: 1.6em; }
     .site-header p { font-size: 0.9em; }
     #trivia-grid .card-container { height: 240px; }
     .trivia-statement { font-size: 0.85em; line-height: 1.4; }
     .trivia-tf-button { padding: 0.5rem 0.8rem; font-size: 0.8em; width: 90%; max-width: 160px; }
     #tips-grid .card-container { height: 230px; }
     .tip-front-text { font-size: 0.9em; }
     .tip-card-face-back { font-size: 0.85em; }
     #choice-cards { grid-template-columns: 1fr; }
     .cyoa-card-container { min-height: 110px; }
}

/* ================================================================ */
/* == Header Car & Plane Animation Styles == */
/* ================================================================ */

.track-animations {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 0; /* Below header content */
}

.animated-car, .animated-plane { /* Combined common styles */
    position: absolute;
    height: auto;
    pointer-events: none;
    opacity: 0;
    transform: translateX(0); /* Base transform state */
}

.animated-car img, .animated-plane img {
    display: block;
    width: 100%;
    height: auto;
}

/* Car Specific Positioning & Sizing */
.animated-car {
    left: -150px; /* Start off-screen left */
    width: 100px; /* Base width */
    z-index: 1; /* Cars below plane */
}
.animated-car.car-f1 { width: 95px; bottom: 55%; }
.animated-car.car-wec { width: 110px; bottom: 45%; }
.animated-car.car-gt3 { width: 100px; bottom: 35%; }
.animated-car.car-gt4 { width: 90px; bottom: 25%; }

/* Plane Specific Positioning & Sizing */
.animated-plane {
    top: 10%; /* Position near top */
    right: -300px; /* Start off-screen right */
    left: auto; /* Override any inherited left */
    width: 250px; /* Adjust size as needed */
    z-index: 2; /* Plane above cars */
}


/* Car Animation Keyframes (L -> R) */
@keyframes driveAcross {
    0% { transform: translateX(0); opacity: 1; }
    98% { opacity: 1; }
    100% { transform: translateX(calc(100vw + 150px)); opacity: 0; }
}

/* Plane Animation Keyframes (R -> L) */
@keyframes flyAcross {
    0% { transform: translateX(0); opacity: 1; } /* Starts at its 'right: -300px' position */
    98% { opacity: 1; }
    100% { transform: translateX(calc(-100vw - 300px)); opacity: 0; } /* Moves left */
}


/* Car Animation Class */
.animated-car.driving {
    opacity: 1;
    animation-name: driveAcross;
    animation-timing-function: linear;
    animation-iteration-count: 1;
    animation-fill-mode: forwards;
}
/* Car Speeds */
.animated-car.car-f1.driving { animation-duration: 8s; }
.animated-car.car-wec.driving { animation-duration: 10s; }
.animated-car.car-gt3.driving { animation-duration: 12s; }
.animated-car.car-gt4.driving { animation-duration: 14s; }

/* Plane Animation Class */
.animated-plane.flying {
    opacity: 1;
    animation-name: flyAcross;
    animation-timing-function: linear;
    animation-iteration-count: 1;
    animation-fill-mode: forwards;
    animation-duration: 18s; /* Plane speed */
}

/* =================================== */
/* Discount Card Visual Enhancements   */
/* =================================== */

.card-container.has-discount {
    /* Add a subtle border and initial glow */
    border: 2px solid rgba(255, 215, 0, 0.5); /* Gold border */
    box-shadow: 0 0 8px 2px rgba(255, 215, 0, 0.4); /* Initial gold glow */
    animation: discountGlowPulse 2.5s infinite ease-in-out;
    position: relative; /* Ensure z-index works if needed */
    z-index: 2; /* Bring discounted cards slightly forward visually */
}

/* Make the inner card inherit the border radius if needed */
.card-container.has-discount .card-inner {
   border-radius: 10px; /* Adjust slightly smaller than container's effective radius */
}


@keyframes discountGlowPulse {
  0% {
    box-shadow: 0 0 8px 2px rgba(255, 215, 0, 0.4);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 18px 6px rgba(255, 215, 0, 0.7); /* More intense glow */
    transform: scale(1.01); /* Very subtle scale */
  }
  100% {
    box-shadow: 0 0 8px 2px rgba(255, 215, 0, 0.4);
    transform: scale(1);
  }
}

/* Optional: Slight hover effect adjustment for discounted cards */
.card-container.has-discount:hover {
    animation-play-state: paused; /* Pause pulse on hover */
    box-shadow: 0 0 20px 8px rgba(255, 215, 0, 0.8); /* Stronger glow on hover */
    transform: translateY(-6px) scale(1.02); /* Slightly more lift */
}

/* Ensure discount badge stays above the glow */
.discount-badge {
    z-index: 5; /* Already high, but confirm */
}

/* =================================== */
/* Background Falling Cards Effect   */
/* =================================== */

.background-animation-container {
    position: fixed; /* Fixed position so they fall regardless of scroll */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Prevent interaction */
    overflow: hidden; /* Hide cards outside viewport */
    z-index: 0; /* Behind main content but above body background */
}

.falling-card {
    position: absolute;
    top: -80px; /* Start above the screen */
    width: 50px;  /* Small card size */
    height: 70px; /* Small card size */
    /* background-color: rgba(255, 255, 255, 0.15); << REMOVED */
    background-image: url('images/carbon-circuit-texture.webp'); /* << ADDED Texture */
    background-size: cover; /* << ADDED Ensure texture covers */
    background-position: center center; /* << ADDED Center texture */
    border: 1px solid rgba(180, 180, 180, 0.4); /* << ADJUSTED border to be more visible on dark texture */
    border-radius: 5px;
    opacity: 0; /* Start invisible */
    animation: fallWobble 10s linear infinite; /* Base animation */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3); /* << Slightly darker shadow */
}

@keyframes fallWobble {
  0% {
    transform: translateY(0) rotate(0deg) translateX(0);
    opacity: 0;
  }
  10% {
     opacity: 1; /* Fade in */
  }
  90% {
     opacity: 1; /* Stay visible */
  }
  100% {
    transform: translateY(calc(100vh + 80px)) rotate(720deg) translateX(20px); /* Fall down, rotate, slight drift */
    opacity: 0; /* Fade out */
  }
}

/* Apply random horizontal positions, delays, and durations */
.falling-card:nth-child(1) { left: 10%; animation-delay: 0s; animation-duration: 12s; }
.falling-card:nth-child(2) { left: 25%; animation-delay: 3s; animation-duration: 10s; width: 45px; height: 65px; }
.falling-card:nth-child(3) { left: 40%; animation-delay: 1s; animation-duration: 14s; }
.falling-card:nth-child(4) { left: 55%; animation-delay: 5s; animation-duration: 9s; width: 55px; height: 75px; }
.falling-card:nth-child(5) { left: 70%; animation-delay: 2s; animation-duration: 11s; }
.falling-card:nth-child(6) { left: 85%; animation-delay: 6s; animation-duration: 13s; width: 40px; height: 60px; }
.falling-card:nth-child(7) { left: 5%; animation-delay: 8s; animation-duration: 10s; }
.falling-card:nth-child(8) { left: 90%; animation-delay: 4s; animation-duration: 15s; }

/* Hide on smaller screens if it becomes too distracting */
@media (max-width: 768px) {
  .background-animation-container {
    display: none;
  }
}
/* ========================================== */
/* Premium Discount Card Enhancements (V2)    */
/* ========================================== */

/* --- Pokémon-Style Shine Effect on Front Face --- */

/* Target the shine pseudo-element ONLY on discounted cards */
.card-container.has-discount .card-face-front::after {
    /* Override the default shine with a pink/blue/purple gradient */
    /* REVERTED ANGLE to 110deg to match original shine animation */
    background: linear-gradient(
        110deg, /* << CHANGED BACK FROM 135deg */
        rgba(255, 105, 180, 0) 0%,   /* Wider Transparent Start */
        rgba(255, 105, 180, 0) 40%,  /* Wider Transparent Start */
        rgba(255, 105, 180, 0.25) 48%, /* Pink highlight */
        rgba(138, 43, 226, 0.25) 51%, /* BlueViolet highlight */
        rgba(0, 191, 255, 0.25) 54%,  /* DeepSkyBlue highlight */
        rgba(255, 255, 255, 0.3) 56%,  /* Brighter white highlight */
        rgba(0, 191, 255, 0.25) 58%,  /* DeepSkyBlue highlight */
        rgba(138, 43, 226, 0.25) 61%, /* BlueViolet highlight */
        rgba(255, 105, 180, 0.25) 64%, /* Pink highlight */
        rgba(255, 105, 180, 0) 70%,   /* Wider Transparent End */
        rgba(255, 105, 180, 0) 100%  /* Wider Transparent End */
    );
    /* Keep the existing animation, maybe slightly faster */
    animation: cardShine 11s ease-in-out var(--shine-delay, 2s) infinite;
    transform: translateX(-150%) skewX(-25deg);
    opacity: 0;
    z-index: 3; /* Ensure shine is above texture overlay */
}

/* --- "Ultra Rare" Filter + Full Shine on Back Face --- */
/* (Keep the existing back face styles - no changes needed here) */
.card-container.has-discount .card-face-back {
    /* Keep the gold texture */
    background-image: url('images/gold-texture.webp');
    background-size: auto;
    background-repeat: repeat;
    background-position: center center;
    color: #ffffff; /* Ensure text stays white */

    /* Apply the filter combo for the underlying texture */
    filter: hue-rotate(150deg) /* Shift colors towards blues/purples */
            saturate(1.6)    /* Make colors more vibrant */
            contrast(1.1)    /* Increase contrast slightly */
            brightness(1.05); /* Slightly brighter */

    position: relative; /* Ensure overlay works */
    overflow: hidden; /* Keep overlay contained */
}

/* Modify the ::before overlay to INCLUDE the static shine */
.card-container.has-discount .card-face-back::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    /* Layered background: Shine gradient ON TOP of dark overlay */
    background:
        /* Static Shine Layer (subtle, angled pink/blue/purple) */
        linear-gradient(55deg, /* Different angle for static effect */
            rgba(255, 105, 180, 0.15), /* Subtle Pink */
            rgba(138, 43, 226, 0.15) 40%, /* Subtle BlueViolet */
            rgba(0, 191, 255, 0.15) 70%,  /* Subtle DeepSkyBlue */
            rgba(255, 255, 255, 0.2) 85%, /* Subtle white highlight */
            rgba(138, 43, 226, 0.15) 100% /* Subtle BlueViolet end */
        ),
        /* Base Dark Overlay */
        rgba(0, 0, 0, 0.45); /* Slightly darker base overlay */

    border-radius: inherit;
    z-index: 1; /* Below content, above filtered background */
    pointer-events: none;
}

/* Ensure back face content is visible above the filtered background and overlay/shine */
.card-container.has-discount .card-face-back > * {
    position: relative;
    z-index: 2; /* Above the ::before overlay */
    /* Opacity transition remains the same */
    opacity: 0;
    transition: opacity 0.4s ease 0.2s;
}
.card-container.has-discount .card-inner.is-flipped .card-face-back > * {
    opacity: 1;
}

/* Optional: Adjust the CTA button contrast on the filtered/shined back */
.card-container.has-discount .card-face-back .cta-button {
    background-color: rgba(255, 255, 255, 0.9); /* Brighter white */
    color: #1e3a8a; /* Dark blue text for contrast */
    box-shadow: 0 2px 4px rgba(0,0,0,0.3); /* Add shadow for pop */
}
.card-container.has-discount .card-face-back .cta-button svg {
    fill: #1e3a8a; /* Dark blue icon */
}
.card-container.has-discount .card-face-back .cta-button:hover {
     background-color: #ffffff; /* Full white on hover */
     color: #0d3a8e;
     box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}
.card-container.has-discount .card-face-back .cta-button:hover svg {
    fill: #0d3a8e;
}