/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #FF006E 0%, #8338EC 50%, #3A86FF 100%);
    color: #ffffff;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Holographic Background Effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(255, 190, 11, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(251, 86, 7, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(255, 0, 110, 0.1) 0%, transparent 50%);
    z-index: -1;
    animation: holographicShift 10s ease-in-out infinite;
}

@keyframes holographicShift {
    0%, 100% { transform: translateX(0) translateY(0); }
    25% { transform: translateX(10px) translateY(-5px); }
    50% { transform: translateX(-5px) translateY(10px); }
    75% { transform: translateX(-10px) translateY(-5px); }
}

/* Header */
header {
    text-align: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

header h1 {
    font-size: 2.5rem;
    font-weight: bold;
    text-shadow: 0 0 20px rgba(255, 190, 11, 0.8);
    background: linear-gradient(45deg, #FFBE0B, #FF006E, #3A86FF);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    0% { text-shadow: 0 0 20px rgba(255, 190, 11, 0.8); }
    100% { text-shadow: 0 0 30px rgba(255, 0, 110, 1); }
}

/* Main Content */
main {
    padding: 20px;
    padding-bottom: 100px;
    min-height: calc(100vh - 160px);
}

/* Screen Management */
.screen {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.screen.active {
    display: block;
}

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

/* Game Container */
.game-container {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

#gameCanvas {
    width: 100%;
    height: auto;
    min-height: 400px;
    display: block;
    background: linear-gradient(to bottom, #87CEEB 0%, #98FB98 100%);
    border-radius: 20px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* Game Overlay */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.game-ui {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

.score-display, .speed-display {
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 15px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.score-label, .speed-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

#currentScore, #currentSpeed {
    font-size: 1.5rem;
    font-weight: bold;
    color: #FFBE0B;
    margin: 0 5px;
}

/* Game Menu */
.game-menu {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: rgba(0, 0, 0, 0.8);
    padding: 40px;
    border-radius: 20px;
    backdrop-filter: blur(20px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    pointer-events: all;
    max-width: 90%;
}

.game-menu h2 {
    font-size: 2rem;
    margin-bottom: 15px;
    color: #FFBE0B;
}

.game-menu p {
    margin-bottom: 30px;
    opacity: 0.9;
    font-size: 1.1rem;
}

/* Game Over Screen */
.game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: rgba(0, 0, 0, 0.9);
    padding: 40px;
    border-radius: 20px;
    backdrop-filter: blur(20px);
    border: 2px solid rgba(255, 0, 110, 0.3);
    pointer-events: all;
    max-width: 90%;
}

.game-over h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: #FF006E;
}

.final-score {
    font-size: 3rem;
    font-weight: bold;
    color: #FFBE0B;
    margin: 20px 0;
    text-shadow: 0 0 20px rgba(255, 190, 11, 0.8);
}

.game-over-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 30px;
}

/* Pause Menu */
.pause-menu {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: rgba(0, 0, 0, 0.9);
    padding: 40px;
    border-radius: 20px;
    backdrop-filter: blur(20px);
    border: 2px solid rgba(58, 134, 255, 0.3);
    pointer-events: all;
    max-width: 90%;
}

.pause-menu h2 {
    font-size: 2rem;
    margin-bottom: 30px;
    color: #3A86FF;
}

.pause-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Game Controls */
.game-controls {
    position: absolute;
    top: 20px;
    right: 20px;
}

.control-button {
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 12px;
    border-radius: 50%;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    pointer-events: all;
}

.control-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Buttons */
.game-button {
    background: linear-gradient(45deg, #FF006E, #8338EC);
    border: none;
    color: white;
    padding: 15px 30px;
    font-size: 1.1rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 10px 20px rgba(255, 0, 110, 0.3);
    pointer-events: all;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.game-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(255, 0, 110, 0.4);
}

.game-button.secondary {
    background: linear-gradient(45deg, #3A86FF, #8338EC);
    box-shadow: 0 10px 20px rgba(58, 134, 255, 0.3);
}

.game-button.secondary:hover {
    box-shadow: 0 15px 30px rgba(58, 134, 255, 0.4);
}

/* Controls Info */
.controls-info {
    margin-top: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.controls-info p {
    margin: 5px 0;
    font-size: 0.95rem;
}

/* Section Headers */
.section-header {
    text-align: center;
    margin-bottom: 30px;
}

.section-header h2 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(45deg, #FFBE0B, #FF006E);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.section-header p {
    font-size: 1.2rem;
    opacity: 0.8;
}

/* Leaderboard */
.leaderboard-container {
    max-width: 600px;
    margin: 0 auto;
}

.leaderboard-list {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    margin: 10px 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.leaderboard-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(10px);
}

.leaderboard-rank {
    font-size: 1.5rem;
    font-weight: bold;
    color: #FFBE0B;
    min-width: 50px;
}

.leaderboard-score {
    font-size: 1.3rem;
    font-weight: bold;
    color: #3A86FF;
}

.leaderboard-date {
    font-size: 0.9rem;
    opacity: 0.7;
}

.empty-leaderboard {
    text-align: center;
    padding: 40px;
    opacity: 0.6;
}

/* Settings */
.settings-container {
    max-width: 600px;
    margin: 0 auto;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    margin: 15px 0;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.setting-item label {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting-item i {
    color: #FFBE0B;
    width: 20px;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 60px;
    height: 30px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 30px;
    transition: 0.3s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

input:checked + .toggle-slider {
    background: linear-gradient(45deg, #FF006E, #8338EC);
}

input:checked + .toggle-slider:before {
    transform: translateX(30px);
}

/* Select */
select {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 10px 15px;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    backdrop-filter: blur(10px);
}

select option {
    background: #1a1a1a;
    color: white;
}

/* FAQ */
.faq-container {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    margin: 15px 0;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.faq-question {
    width: 100%;
    background: none;
    border: none;
    color: white;
    padding: 20px;
    text-align: left;
    font-size: 1.1rem;
    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.1);
}

.faq-icon {
    font-size: 1.5rem;
    color: #FFBE0B;
    transition: transform 0.3s ease;
}

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

.faq-answer {
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-answer.expanded {
    max-height: 200px;
    padding: 20px;
}

.faq-answer p {
    margin: 0;
    line-height: 1.6;
    opacity: 0.9;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    border-top: 2px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.6);
    transition: all 0.3s ease;
    border-radius: 0;
}

.nav-item:hover,
.nav-item.active {
    color: #FFBE0B;
    background: rgba(255, 190, 11, 0.1);
}

.nav-item i {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

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

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 80px;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .game-menu {
        padding: 30px 20px;
    }
    
    .game-menu h2 {
        font-size: 1.8rem;
    }
    
    .section-header h2 {
        font-size: 2rem;
    }
    
    .game-button {
        padding: 12px 25px;
        font-size: 1rem;
    }
    
    .game-over-buttons,
    .pause-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .setting-item {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .setting-item label {
        justify-content: center;
    }
    
    .leaderboard-item {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .nav-item i {
        font-size: 1.3rem;
    }
    
    .nav-item span {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    main {
        padding: 15px;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .game-ui {
        top: 10px;
        left: 10px;
        right: 10px;
    }
    
    .score-display,
    .speed-display {
        padding: 8px 12px;
    }
    
    #currentScore,
    #currentSpeed {
        font-size: 1.3rem;
    }
    
    .control-button {
        padding: 10px;
    }
    
    .game-menu,
    .game-over,
    .pause-menu {
        padding: 25px 15px;
    }
    
    .final-score {
        font-size: 2.5rem;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    #gameCanvas {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: optimize-contrast;
    }
}

/* Touch Enhancements */
@media (hover: none) and (pointer: coarse) {
    .game-button,
    .control-button,
    .nav-item,
    .faq-question {
        min-height: 44px;
    }
    
    .game-button:active {
        transform: scale(0.95);
    }
    
    #gameCanvas {
        touch-action: none;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
    }
    
    .game-container {
        touch-action: none;
    }
}
