:root {
    --primary-color: #FF006E;
    --secondary-color: #FB5607;
    --accent-color: #FFBE0B;
    --purple-color: #8338EC;
    --blue-color: #3A86FF;
    --background-dark: #0a0a0a;
    --background-light: #1a1a1a;
    --text-light: #ffffff;
    --text-dim: #cccccc;
    --shadow-glow: 0 0 20px rgba(255, 0, 110, 0.3);
    --border-glow: 0 0 10px rgba(255, 190, 11, 0.5);
}

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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, var(--background-dark) 0%, var(--background-light) 100%);
    color: var(--text-light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.app-header {
    background: linear-gradient(90deg, var(--primary-color), var(--purple-color));
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-glow);
    position: relative;
}

.app-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    animation: shine 3s infinite;
}

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

.app-header h1 {
    font-size: 1.5rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 1;
}

.header-controls {
    position: relative;
    z-index: 1;
}

.control-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid var(--accent-color);
    color: var(--text-light);
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.control-btn:hover {
    background: rgba(255, 190, 11, 0.3);
    box-shadow: var(--border-glow);
    transform: scale(1.1);
}

.app-main {
    flex: 1;
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.screen {
    display: none;
    flex: 1;
    animation: fadeIn 0.3s ease-in-out;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

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

.screen-header {
    text-align: center;
    margin-bottom: 2rem;
}

.screen-header h2 {
    font-size: 2rem;
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

/* Game Styles */
.game-container {
    position: relative;
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

#gameCanvas {
    border: 3px solid var(--accent-color);
    border-radius: 15px;
    box-shadow: var(--shadow-glow);
    background: #000;
    max-width: 100%;
    height: auto;
}

.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.menu-screen {
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid var(--primary-color);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    backdrop-filter: blur(20px);
    pointer-events: all;
    box-shadow: var(--shadow-glow);
}

.menu-screen h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-btn {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    border: none;
    color: var(--text-light);
    padding: 1rem 2rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0.5rem;
    box-shadow: 0 5px 15px rgba(255, 0, 110, 0.3);
}

.game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 0, 110, 0.5);
}

.game-btn.secondary {
    background: linear-gradient(45deg, var(--purple-color), var(--blue-color));
    box-shadow: 0 5px 15px rgba(131, 56, 236, 0.3);
}

.game-btn.secondary:hover {
    box-shadow: 0 8px 25px rgba(131, 56, 236, 0.5);
}

.current-score {
    margin-top: 2rem;
    padding: 1rem;
    border: 1px solid var(--accent-color);
    border-radius: 15px;
    background: rgba(255, 190, 11, 0.1);
}

.score-display {
    font-size: 2rem;
    font-weight: bold;
    color: var(--accent-color);
    text-shadow: 0 0 10px rgba(255, 190, 11, 0.5);
}

.game-ui {
    position: absolute;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    pointer-events: all;
}

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

.score-info, .speed-info {
    background: rgba(0, 0, 0, 0.8);
    padding: 0.5rem 1rem;
    border-radius: 25px;
    border: 1px solid var(--accent-color);
    text-align: center;
    backdrop-filter: blur(10px);
}

.score-info span, .speed-info span {
    display: block;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--accent-color);
}

.score-info small, .speed-info small {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.pause-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 0, 110, 0.8);
    border: none;
    color: var(--text-light);
    padding: 0.75rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.pause-btn:hover {
    background: var(--primary-color);
    transform: scale(1.1);
}

.final-stats {
    margin: 1.5rem 0;
}

.stat {
    display: flex;
    justify-content: space-between;
    margin: 0.5rem 0;
    padding: 0.5rem;
    border-bottom: 1px solid rgba(255, 190, 11, 0.3);
}

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

.stat-value {
    color: var(--accent-color);
    font-weight: bold;
}

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

.hidden {
    display: none !important;
}

/* Mobile Controls */
.mobile-controls {
    display: none;
    justify-content: center;
    margin-top: 1rem;
}

.control-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.control-center {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mobile-btn {
    background: linear-gradient(45deg, var(--purple-color), var(--blue-color));
    border: 2px solid var(--accent-color);
    color: var(--text-light);
    padding: 1rem;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(131, 56, 236, 0.3);
    user-select: none;
}

.mobile-btn:hover,
.mobile-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 10px rgba(131, 56, 236, 0.5);
}

/* Leaderboard */
.leaderboard-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.leaderboard-list {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 1rem;
    margin-bottom: 2rem;
    border: 1px solid var(--accent-color);
    backdrop-filter: blur(10px);
    max-height: 400px;
    overflow-y: auto;
}

.score-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    margin: 0.5rem 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border-left: 4px solid var(--primary-color);
    transition: all 0.3s ease;
}

.score-entry:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.score-entry.top-score {
    border-left-color: var(--accent-color);
    background: rgba(255, 190, 11, 0.1);
}

.score-rank {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--accent-color);
    min-width: 2rem;
}

.score-details {
    flex: 1;
    margin: 0 1rem;
}

.score-distance {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--text-light);
}

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

.score-date {
    font-size: 0.8rem;
    color: var(--text-dim);
    text-align: right;
}

.leaderboard-actions {
    text-align: center;
}

.empty-leaderboard {
    text-align: center;
    padding: 3rem;
    color: var(--text-dim);
}

.empty-leaderboard i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--accent-color);
}

/* Settings */
.settings-container {
    flex: 1;
}

.setting-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255, 190, 11, 0.3);
    backdrop-filter: blur(10px);
}

.setting-item label {
    display: block;
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 1rem;
    color: var(--accent-color);
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.volume-control input[type="range"] {
    flex: 1;
    height: 8px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    -webkit-appearance: none;
}

.volume-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(255, 190, 11, 0.5);
}

.volume-control input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px rgba(255, 190, 11, 0.5);
}

#volumeValue {
    color: var(--accent-color);
    font-weight: bold;
    min-width: 3rem;
    text-align: right;
}

.controls-info, .difficulty-info {
    color: var(--text-dim);
    line-height: 1.6;
}

.control-item {
    display: flex;
    justify-content: space-between;
    margin: 0.5rem 0;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.difficulty-info ul {
    margin-top: 1rem;
    padding-left: 1.5rem;
}

.difficulty-info li {
    margin: 0.5rem 0;
}

/* FAQ */
.faq-container {
    flex: 1;
}

.faq-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 190, 11, 0.3);
    backdrop-filter: blur(10px);
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-item:hover {
    border-color: var(--accent-color);
    box-shadow: 0 5px 15px rgba(255, 190, 11, 0.2);
}

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

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

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

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

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

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

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

/* Bottom Navigation */
.bottom-nav {
    background: linear-gradient(90deg, var(--background-dark), var(--background-light));
    border-top: 2px solid var(--accent-color);
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    box-shadow: 0 -5px 15px rgba(255, 190, 11, 0.2);
    position: relative;
}

.bottom-nav::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color), var(--blue-color));
}

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

.nav-item:hover {
    color: var(--accent-color);
    background: rgba(255, 190, 11, 0.1);
}

.nav-item.active {
    color: var(--accent-color);
    background: rgba(255, 190, 11, 0.2);
    box-shadow: 0 0 15px rgba(255, 190, 11, 0.3);
}

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

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

/* Footer */
footer {
    background: var(--background-dark);
    color: var(--text-dim);
    text-align: center;
    padding: 1rem;
    font-size: 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-header h1 {
        font-size: 1.2rem;
    }
    
    .mobile-controls {
        display: flex;
    }
    
    #gameCanvas {
        width: 100%;
        max-width: 350px;
    }
    
    .menu-screen {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .game-actions {
        flex-direction: column;
    }
    
    .game-btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }
    
    .ui-top {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .score-info, .speed-info {
        padding: 0.4rem 0.8rem;
    }
    
    .score-info span, .speed-info span {
        font-size: 1rem;
    }
    
    .control-item {
        flex-direction: column;
        text-align: center;
        gap: 0.25rem;
    }
}

@media (max-width: 480px) {
    .app-main {
        padding: 0.5rem;
    }
    
    .screen-header h2 {
        font-size: 1.5rem;
    }
    
    .menu-screen h2 {
        font-size: 1.5rem;
    }
    
    .mobile-btn {
        padding: 0.75rem;
        font-size: 1rem;
    }
    
    .setting-item {
        padding: 1rem;
    }
    
    .faq-question {
        padding: 1rem;
        font-size: 1rem;
    }
    
    .faq-answer {
        padding: 0 1rem 1rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #ff0080;
        --accent-color: #ffff00;
        --text-light: #ffffff;
        --text-dim: #dddddd;
    }
}

/* Focus indicators */
button:focus,
input:focus,
.nav-item:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Touch targets */
@media (pointer: coarse) {
    .mobile-btn,
    .game-btn,
    .nav-item,
    .faq-question {
        min-height: 44px;
        min-width: 44px;
    }
}
