:root {
    --primary-color: #00ff41;
    --secondary-color: #ff006e;
    --accent-color: #ffbe0b;
    --background-color: #0a0a0a;
    --surface-color: #1a1a1a;
    --text-color: #ffffff;
    --text-secondary: #b0b0b0;
    --border-color: #333333;
    --error-color: #ff4757;
    --success-color: #2ed573;
    --warning-color: #ffa502;
    
    --neon-glow: 0 0 10px currentColor, 0 0 20px currentColor, 0 0 30px currentColor;
    --soft-glow: 0 0 5px currentColor, 0 0 10px currentColor;
    --grid-size: 20px;
}

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

body {
    font-family: 'Courier New', monospace;
    background: var(--background-color);
    color: var(--text-color);
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

.app-container {
    min-height: 100vh;
    padding-bottom: 80px;
    position: relative;
}

/* Digital Grid Background */
.digital-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0, 255, 65, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 65, 0.1) 1px, transparent 1px);
    background-size: var(--grid-size) var(--grid-size);
    pointer-events: none;
    z-index: -1;
    animation: gridPulse 4s ease-in-out infinite;
}

@keyframes gridPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.1; }
}

/* Screen Management */
.screen {
    display: none;
    min-height: calc(100vh - 80px);
    padding: 20px;
}

.screen.active {
    display: block;
}

/* Typography */
.neon-title {
    font-size: clamp(2rem, 8vw, 4rem);
    text-align: center;
    color: var(--primary-color);
    text-shadow: var(--neon-glow);
    margin-bottom: 1rem;
    font-weight: bold;
    letter-spacing: 2px;
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

/* Buttons */
.neon-button {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 15px 30px;
    font-size: 1.1rem;
    font-family: inherit;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 200px;
    position: relative;
    overflow: hidden;
}

.neon-button:hover {
    background: var(--primary-color);
    color: var(--background-color);
    box-shadow: var(--soft-glow);
    transform: translateY(-2px);
}

.neon-button.secondary {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.neon-button.secondary:hover {
    background: var(--secondary-color);
    color: var(--background-color);
}

.danger-btn {
    background: transparent;
    border: 2px solid var(--error-color);
    color: var(--error-color);
    padding: 12px 24px;
    font-family: inherit;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.danger-btn:hover {
    background: var(--error-color);
    color: white;
}

/* Home Screen */
.home-header {
    text-align: center;
    margin-bottom: 3rem;
}

.home-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.high-score-display {
    text-align: center;
    padding: 20px;
    border: 2px solid var(--accent-color);
    border-radius: 12px;
    background: rgba(255, 190, 11, 0.1);
    min-width: 200px;
}

.high-score-display h3 {
    color: var(--accent-color);
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.score-value {
    font-size: 2rem;
    color: var(--accent-color);
    text-shadow: var(--soft-glow);
    font-weight: bold;
}

/* Game Screen */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--surface-color);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.game-info {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.score-display, .level-display, .high-score-display {
    color: var(--primary-color);
    font-weight: bold;
    font-size: 1.1rem;
}

.pause-btn {
    background: transparent;
    border: 2px solid var(--warning-color);
    color: var(--warning-color);
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.pause-btn:hover {
    background: var(--warning-color);
    color: var(--background-color);
}

.game-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

#game-canvas {
    border: 3px solid var(--primary-color);
    border-radius: 12px;
    background: #000;
    box-shadow: var(--soft-glow);
    max-width: 100%;
    height: auto;
}

/* Mobile Controls */
.mobile-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.control-row {
    display: flex;
    gap: 10px;
}

.control-btn {
    background: var(--surface-color);
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    width: 60px;
    height: 60px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    touch-action: manipulation;
}

.control-btn:hover,
.control-btn:active {
    background: var(--primary-color);
    color: var(--background-color);
    transform: scale(0.95);
}

/* Screen Headers */
.screen-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 2rem;
    padding: 15px 0;
    border-bottom: 2px solid var(--border-color);
}

.back-btn {
    background: transparent;
    border: 2px solid var(--text-secondary);
    color: var(--text-secondary);
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.back-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.screen-header h2 {
    color: var(--primary-color);
    font-size: 1.8rem;
    text-shadow: var(--soft-glow);
}

/* Instructions */
.instructions-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.instruction-card {
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.instruction-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.3);
}

.instruction-card h3 {
    color: var(--accent-color);
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.instruction-card ul {
    list-style: none;
    padding-left: 0;
}

.instruction-card li {
    margin-bottom: 10px;
    padding-left: 20px;
    position: relative;
    color: var(--text-color);
    line-height: 1.6;
}

.instruction-card li::before {
    content: "▶";
    position: absolute;
    left: 0;
    color: var(--primary-color);
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.control-item {
    padding: 15px;
    background: rgba(0, 255, 65, 0.1);
    border-radius: 8px;
    border: 1px solid var(--primary-color);
}

.control-item strong {
    color: var(--primary-color);
    display: block;
    margin-bottom: 5px;
}

/* Settings */
.settings-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.setting-card {
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.setting-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.3);
}

.setting-card h3 {
    color: var(--accent-color);
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.setting-item {
    margin-bottom: 15px;
}

.setting-item label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-size: 1.1rem;
}

/* Toggle Switch */
.setting-item input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    width: 50px;
    height: 25px;
    background: var(--border-color);
    border-radius: 25px;
    position: relative;
    transition: background 0.3s ease;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    width: 21px;
    height: 21px;
    border-radius: 50%;
    background: white;
    top: 2px;
    left: 2px;
    transition: transform 0.3s ease;
}

.setting-item input[type="checkbox"]:checked + .toggle-slider {
    background: var(--primary-color);
}

.setting-item input[type="checkbox"]:checked + .toggle-slider::after {
    transform: translateX(25px);
}

/* Theme Selector */
.theme-selector, .difficulty-selector, .language-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.theme-btn, .difficulty-btn, .lang-btn {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-color);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.theme-btn:hover, .difficulty-btn:hover, .lang-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.theme-btn.active, .difficulty-btn.active, .lang-btn.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: var(--background-color);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface-color);
    border: 3px solid var(--primary-color);
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--neon-glow);
}

.modal-content h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.8rem;
    text-shadow: var(--soft-glow);
}

.final-stats {
    margin: 20px 0;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(0, 255, 65, 0.1);
    border-radius: 8px;
}

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

.new-record-text {
    color: var(--success-color);
    font-weight: bold;
    text-shadow: var(--soft-glow);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

/* FAQ Section */
.faq-section {
    margin: 40px 20px;
    padding: 20px;
    background: var(--surface-color);
    border-radius: 15px;
    border: 2px solid var(--border-color);
}

.faq-section h2 {
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.8rem;
    text-shadow: var(--soft-glow);
}

.faq-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.faq-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-item:hover {
    border-color: var(--primary-color);
}

.faq-question {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-color);
    padding: 15px 20px;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.faq-question:hover {
    background: rgba(0, 255, 65, 0.1);
    color: var(--primary-color);
}

.faq-icon {
    color: var(--primary-color);
    font-size: 1.2rem;
    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;
    background: rgba(0, 255, 65, 0.05);
}

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

.faq-answer p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface-color);
    border-top: 2px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

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

.nav-item:hover,
.nav-item.active {
    color: var(--primary-color);
    background: rgba(0, 255, 65, 0.1);
    text-shadow: var(--soft-glow);
}

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

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

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
    background: var(--surface-color);
    margin-top: 40px;
}

/* Theme Variations */
.theme-retro {
    --primary-color: #3a86ff;
    --secondary-color: #8338ec;
    --accent-color: #fb5607;
}

.theme-classic {
    --primary-color: #2ed573;
    --secondary-color: #ff4757;
    --accent-color: #ffa502;
}

/* Responsive Design */
@media (max-width: 768px) {
    .neon-title {
        font-size: 2.5rem;
    }
    
    .game-info {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
    
    .game-header {
        flex-direction: column;
        gap: 15px;
    }
    
    #game-canvas {
        width: 100%;
        max-width: 350px;
    }
    
    .modal-content {
        margin: 20px;
        padding: 20px;
    }
    
    .controls-grid {
        grid-template-columns: 1fr;
    }
    
    .theme-selector, .difficulty-selector, .language-selector {
        flex-direction: column;
    }
    
    .theme-btn, .difficulty-btn, .lang-btn {
        width: 100%;
    }
    
    .modal-buttons {
        gap: 15px;
    }
    
    .neon-button {
        min-width: 100%;
        padding: 18px 20px;
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: 10px;
        padding-bottom: 80px;
    }
    
    .screen {
        padding: 10px;
    }
    
    .neon-title {
        font-size: 2rem;
        margin-bottom: 1rem;
    }
    
    .instruction-card, .setting-card {
        padding: 15px;
    }
    
    .control-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .faq-section {
        margin: 20px 10px;
        padding: 15px;
    }
}

/* Desktop Optimizations */
@media (min-width: 1024px) {
    .app-container {
        max-width: 1200px;
        margin: 0 auto;
        padding: 20px;
        padding-bottom: 80px;
    }
    
    .menu-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .instructions-main, .settings-main {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
        gap: 2rem;
    }
    
    .mobile-controls {
        display: none;
    }
    
    #game-canvas {
        width: 500px;
        height: 500px;
    }
    
    .modal-buttons {
        flex-direction: row;
        justify-content: center;
    }
    
    .faq-container {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
        gap: 15px;
    }
}

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

/* Focus styles for keyboard navigation */
button:focus,
.nav-item:focus,
.faq-question:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --background-color: #000000;
        --surface-color: #111111;
        --text-color: #ffffff;
        --border-color: #666666;
    }
}
