:root {
    --primary: #FF006E;
    --secondary: #FB5607;
    --tertiary: #FFBE0B;
    --quaternary: #8338EC;
    --quinary: #3A86FF;
    --bg-dark: #0a0a0a;
    --bg-card: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --border-glow: rgba(255, 0, 110, 0.5);
}

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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1a0033 50%, var(--bg-dark) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Holographic Effects */
.holographic {
    background: linear-gradient(45deg, var(--primary), var(--secondary), var(--tertiary), var(--quaternary), var(--quinary));
    background-size: 400% 400%;
    animation: holographicShift 3s ease-in-out infinite;
}

@keyframes holographicShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Header */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-glow);
    padding: 1rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.header-content h1 {
    font-size: 1.5rem;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.score-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border-radius: 25px;
    border: 1px solid var(--border-glow);
}

.score-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

#currentScore {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary);
}

/* Main Content */
.app-main {
    padding-top: 80px;
    padding-bottom: 80px;
    min-height: 100vh;
}

.content-section {
    display: none;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.content-section.active {
    display: block;
}

/* Game Section */
.game-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

#gameCanvas {
    width: 100%;
    max-width: 800px;
    height: auto;
    border: 2px solid var(--border-glow);
    border-radius: 15px;
    background: #000;
    box-shadow: 0 0 30px var(--border-glow);
}

.game-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
    z-index: 10;
}

.speed-meter, .drift-meter {
    background: rgba(0, 0, 0, 0.8);
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-glow);
    text-align: center;
    min-width: 100px;
}

.meter-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.meter-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
}

.meter-unit {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.combo-display {
    background: rgba(255, 0, 110, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 25px;
    border: 1px solid var(--primary);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.game-controls {
    text-align: center;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: 15px;
    border: 1px solid var(--border-glow);
    width: 100%;
    max-width: 600px;
}

.control-instructions p {
    margin: 0.5rem 0;
    color: var(--text-secondary);
}

/* Garage Section */
.garage-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.garage-container h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.car-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.car-card {
    background: var(--bg-card);
    border: 2px solid transparent;
    border-radius: 15px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.car-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(255, 0, 110, 0.3);
}

.car-card.active {
    border-color: var(--primary);
    box-shadow: 0 0 20px var(--border-glow);
}

.car-preview {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.car-card h3 {
    color: var(--primary);
    margin-bottom: 1rem;
}

.car-stats {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.stat-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    margin-left: 1rem;
    overflow: hidden;
}

.stat-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 3px;
    transition: width 0.3s ease;
}

.customization-panel {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 1.5rem;
    border: 1px solid var(--border-glow);
}

.customization-panel h3 {
    margin-bottom: 1rem;
    color: var(--secondary);
}

.color-picker {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.color-picker label {
    color: var(--text-secondary);
}

.color-options {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.color-btn {
    width: 40px;
    height: 40px;
    border: 3px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.color-btn:hover {
    transform: scale(1.1);
}

.color-btn.active {
    border-color: white;
    box-shadow: 0 0 15px currentColor;
}

/* Tracks Section */
.tracks-container h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2rem;
}

.track-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.track-card {
    background: var(--bg-card);
    border: 2px solid transparent;
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.track-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(251, 86, 7, 0.3);
}

.track-card.active {
    border-color: var(--secondary);
    box-shadow: 0 0 20px rgba(251, 86, 7, 0.5);
}

.track-preview {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.track-card h3 {
    color: var(--secondary);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.track-card p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.track-difficulty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.difficulty-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.stars {
    display: flex;
    gap: 0.2rem;
}

.stars i {
    color: var(--tertiary);
}

/* Replays Section */
.replays-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.replays-container h2 {
    text-align: center;
    font-size: 2rem;
}

.replay-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.control-btn {
    background: var(--bg-card);
    border: 2px solid var(--quaternary);
    color: var(--text-primary);
    padding: 1rem 2rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
}

.control-btn:hover:not(:disabled) {
    background: var(--quaternary);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(131, 56, 236, 0.3);
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.replay-list {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 2rem;
    border: 1px solid var(--border-glow);
    min-height: 300px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-secondary);
    text-align: center;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.replay-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.replay-info h4 {
    color: var(--quaternary);
    margin-bottom: 0.5rem;
}

.replay-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.replay-actions {
    display: flex;
    gap: 0.5rem;
}

.replay-btn {
    background: var(--quaternary);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.replay-btn:hover {
    background: var(--primary);
}

/* Settings Section */
.settings-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.settings-container h2 {
    text-align: center;
    font-size: 2rem;
}

.settings-group {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 2rem;
    border: 1px solid var(--border-glow);
}

.settings-group h3 {
    color: var(--quinary);
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.setting-item label {
    color: var(--text-primary);
    font-weight: 500;
}

.setting-item input[type="range"] {
    flex: 1;
    margin: 0 1rem;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.setting-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--quinary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px var(--quinary);
}

.setting-item input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--quinary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px var(--quinary);
}

.volume-value, .sensitivity-value {
    color: var(--quinary);
    font-weight: bold;
    min-width: 50px;
    text-align: right;
}

.checkbox-item {
    justify-content: flex-start;
    gap: 1rem;
}

.checkbox-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--quinary);
}

.stats-display {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.stat-label {
    color: var(--text-secondary);
}

.stat-item span:last-child {
    color: var(--quinary);
    font-weight: bold;
}

.reset-btn {
    background: var(--primary);
    border: none;
    color: white;
    padding: 1rem 2rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.reset-btn:hover {
    background: #e6005e;
    transform: translateY(-2px);
}

/* FAQ Section */
.faq-section {
    padding: 2rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.faq-section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--tertiary);
}

.faq-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.faq-item {
    background: var(--bg-card);
    border-radius: 15px;
    border: 1px solid var(--border-glow);
    overflow: hidden;
}

.faq-question {
    width: 100%;
    background: none;
    border: none;
    color: var(--text-primary);
    padding: 1.5rem;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.faq-question:hover {
    background: rgba(255, 255, 255, 0.05);
}

.faq-question[aria-expanded="true"] {
    color: var(--tertiary);
}

.faq-question[aria-expanded="true"] .faq-icon {
    transform: rotate(45deg);
    color: var(--tertiary);
}

.faq-icon {
    font-size: 1.5rem;
    transition: transform 0.3s ease;
    color: var(--text-secondary);
}

.faq-answer {
    padding: 0 1.5rem 1.5rem;
    color: var(--text-secondary);
    line-height: 1.6;
    animation: fadeIn 0.3s ease;
}

.faq-answer[hidden] {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-glow);
    display: flex;
    justify-content: space-around;
    padding: 0.5rem;
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    border-radius: 10px;
    min-width: 60px;
}

.nav-item:hover {
    color: var(--primary);
    background: rgba(255, 0, 110, 0.1);
}

.nav-item.active {
    color: var(--primary);
    background: rgba(255, 0, 110, 0.2);
}

.nav-item i {
    font-size: 1.2rem;
    margin-bottom: 0.2rem;
}

.nav-item span {
    font-size: 0.7rem;
    font-weight: 500;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 1rem;
    background: var(--bg-dark);
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-glow);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .app-header {
        padding: 0.5rem;
    }
    
    .header-content h1 {
        font-size: 1.2rem;
    }
    
    .game-overlay {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }
    
    .speed-meter, .drift-meter {
        min-width: 80px;
        padding: 0.5rem;
    }
    
    .meter-value {
        font-size: 1.2rem;
    }
    
    .car-grid {
        grid-template-columns: 1fr;
    }
    
    .track-selection {
        grid-template-columns: 1fr;
    }
    
    .replay-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .control-btn {
        width: 100%;
        max-width: 300px;
    }
    
    .setting-item {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .setting-item input[type="range"] {
        width: 100%;
        margin: 0;
    }
    
    .faq-question {
        font-size: 1rem;
        padding: 1rem;
    }
    
    .faq-answer {
        padding: 0 1rem 1rem;
    }
}

@media (max-width: 480px) {
    .content-section {
        padding: 0.5rem;
    }
    
    .garage-container, .tracks-container, .replays-container, .settings-container {
        gap: 1rem;
    }
    
    .car-card, .track-card, .settings-group {
        padding: 1rem;
    }
    
    .nav-item {
        padding: 0.3rem;
        min-width: 50px;
    }
    
    .nav-item i {
        font-size: 1rem;
    }
    
    .nav-item span {
        font-size: 0.6rem;
    }
}

/* Touch Controls for Mobile */
@media (max-width: 768px) {
    .mobile-controls {
        position: absolute;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        display: flex;
        gap: 1rem;
        z-index: 20;
    }
    
    .touch-control {
        width: 60px;
        height: 60px;
        background: rgba(255, 0, 110, 0.3);
        border: 2px solid var(--primary);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-size: 1.5rem;
        cursor: pointer;
        user-select: none;
        touch-action: manipulation;
    }
    
    .touch-control:active {
        background: rgba(255, 0, 110, 0.6);
        transform: scale(0.95);
    }
}
