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

body {
    font-family: 'Roboto Mono', monospace;
    background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 50%, #16213e 100%);
    color: #ffffff;
    min-height: 100vh;
    overflow-x: hidden;
}

.game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 2px solid rgba(64, 224, 255, 0.3);
    margin-bottom: 20px;
}

.game-title {
    font-family: 'Orbitron', monospace;
    font-size: 2.5rem;
    font-weight: 900;
    background: linear-gradient(45deg, #40e0ff, #ff40a0, #40e0ff);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleGlow 3s ease-in-out infinite;
}

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

.stats {
    display: flex;
    gap: 30px;
    align-items: center;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.stat-label {
    font-size: 0.8rem;
    color: #8892b0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #40e0ff;
    text-shadow: 0 0 10px rgba(64, 224, 255, 0.5);
}

.time-flow-bar {
    width: 100px;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(64, 224, 255, 0.3);
}

.time-flow-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff4040, #ffff40, #40ff40);
    border-radius: 4px;
    transition: width 0.2s ease;
    box-shadow: 0 0 10px rgba(255, 255, 64, 0.5);
}

/* Game Area */
.game-area {
    flex: 1;
    position: relative;
    background: radial-gradient(ellipse at center, rgba(64, 224, 255, 0.1) 0%, transparent 70%);
    border: 2px solid rgba(64, 224, 255, 0.3);
    border-radius: 15px;
    min-height: 400px;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.baseline {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #ff4040, #ff8040, #ff4040);
    box-shadow: 0 0 20px rgba(255, 64, 64, 0.8);
    animation: baselinePulse 2s ease-in-out infinite;
}

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

/* Anomaly Styles */
.anomaly {
    position: absolute;
    padding: 15px 20px;
    background: linear-gradient(135deg, rgba(64, 224, 255, 0.9), rgba(255, 64, 160, 0.9));
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    color: #ffffff;
    font-weight: 500;
    font-size: 1.1rem;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    box-shadow: 0 5px 25px rgba(64, 224, 255, 0.4);
    transition: all 0.3s ease;
    cursor: pointer;
    min-width: 80px;
    text-align: center;
}

.anomaly.active {
    background: linear-gradient(135deg, rgba(255, 255, 64, 0.9), rgba(255, 128, 64, 0.9));
    border-color: rgba(255, 255, 64, 0.6);
    box-shadow: 0 5px 30px rgba(255, 255, 64, 0.6);
    transform: scale(1.05);
}

.anomaly.typing {
    background: linear-gradient(135deg, rgba(64, 255, 64, 0.9), rgba(64, 255, 255, 0.9));
    animation: typingPulse 0.5s ease-in-out infinite;
}

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

/* Input Area */
.input-area {
    margin: 20px 0;
    padding: 20px;
    background: rgba(26, 26, 46, 0.8);
    border-radius: 15px;
    border: 2px solid rgba(64, 224, 255, 0.3);
    backdrop-filter: blur(10px);
}

.current-target {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.target-label {
    font-size: 1.2rem;
    color: #8892b0;
    font-weight: 500;
}

.target-word {
    font-size: 1.5rem;
    font-weight: 700;
    color: #40e0ff;
    text-shadow: 0 0 10px rgba(64, 224, 255, 0.5);
    padding: 8px 16px;
    background: rgba(64, 224, 255, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(64, 224, 255, 0.3);
}

.game-input {
    width: 100%;
    padding: 15px 20px;
    font-size: 1.2rem;
    font-family: 'Roboto Mono', monospace;
    background: rgba(22, 33, 62, 0.8);
    border: 2px solid rgba(64, 224, 255, 0.3);
    border-radius: 10px;
    color: #ffffff;
    outline: none;
    transition: all 0.3s ease;
}

.game-input:focus {
    border-color: #40e0ff;
    box-shadow: 0 0 20px rgba(64, 224, 255, 0.4);
}

.input-feedback {
    margin-top: 10px;
    font-size: 0.9rem;
    min-height: 20px;
    color: #8892b0;
}

.input-feedback.correct {
    color: #40ff40;
}

.input-feedback.incorrect {
    color: #ff4040;
}

/* Game Controls */
.game-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 20px 0;
}

.btn {
    padding: 12px 24px;
    font-size: 1.1rem;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, #40e0ff, #ff40a0);
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(64, 224, 255, 0.4);
}

.btn-secondary {
    background: rgba(26, 26, 46, 0.8);
    color: #8892b0;
    border: 2px solid rgba(136, 146, 176, 0.3);
}

.btn-secondary:hover {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.5);
}

.btn-audio {
    background: rgba(26, 26, 46, 0.8);
    color: #8892b0;
    border: 2px solid rgba(136, 146, 176, 0.3);
    padding: 12px 16px;
    font-size: 1.2rem;
    min-width: 50px;
}

.btn-audio:hover {
    color: #40e0ff;
    border-color: rgba(64, 224, 255, 0.5);
}

.btn-audio.muted {
    color: #ff4040;
    border-color: rgba(255, 64, 64, 0.5);
}

/* Game Over Screen */
.game-over {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 15, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.game-over-content {
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.9), rgba(22, 33, 62, 0.9));
    padding: 40px;
    border-radius: 20px;
    border: 2px solid rgba(64, 224, 255, 0.5);
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.game-over-content h2 {
    font-family: 'Orbitron', monospace;
    font-size: 2rem;
    margin-bottom: 30px;
    color: #ff4040;
    text-shadow: 0 0 20px rgba(255, 64, 64, 0.5);
}

.final-stats {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.final-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(64, 224, 255, 0.2);
}

.final-stat-label {
    color: #8892b0;
    font-weight: 500;
}

.final-stat-value {
    color: #40e0ff;
    font-weight: 700;
    font-size: 1.2rem;
}

/* Instructions */
.instructions {
    background: rgba(26, 26, 46, 0.6);
    padding: 20px;
    border-radius: 15px;
    border: 2px solid rgba(64, 224, 255, 0.2);
    margin-top: 20px;
}

.instructions h3 {
    font-family: 'Orbitron', monospace;
    color: #40e0ff;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.instructions ul {
    list-style: none;
    padding: 0;
}

.instructions li {
    padding: 8px 0;
    color: #8892b0;
    position: relative;
    padding-left: 20px;
}

.instructions li:before {
    content: "▶";
    position: absolute;
    left: 0;
    color: #40e0ff;
}

/* Particles */
.particles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #40e0ff;
    border-radius: 50%;
    pointer-events: none;
    animation: particleExplode 0.8s ease-out forwards;
}

@keyframes particleExplode {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.5);
    }
}

/* Mobile device optimizations */
.mobile-device .game-input {
    font-size: 16px !important; /* Prevents zoom on iOS */
    -webkit-text-size-adjust: 100%;
}

.mobile-device .anomaly {
    font-size: 1.1rem;
    padding: 14px 18px;
    min-width: 90px;
}

.mobile-device .btn {
    min-height: 50px;
    touch-action: manipulation;
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-container {
        padding: 10px;
    }
    
    .game-header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .game-title {
        font-size: 2rem;
    }
    
    .stats {
        gap: 20px;
    }
    
    .stat-value {
        font-size: 1.2rem;
    }
    
    .game-area {
        min-height: 300px;
    }
    
    .anomaly {
        font-size: 1rem;
        padding: 12px 16px;
    }
    
    .current-target {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .target-word {
        font-size: 1.3rem;
    }
    
    .game-input {
        font-size: 1.1rem;
        padding: 12px 16px;
    }
    
    .game-controls {
        flex-wrap: wrap;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 1.5rem;
    }
    
    .stats {
        flex-direction: column;
        gap: 15px;
    }
    
    .time-flow-bar {
        width: 80px;
    }
    
    .anomaly {
        font-size: 0.9rem;
        padding: 10px 14px;
        min-width: 70px;
    }
}

/* Enhanced Mobile Support */
@media (hover: none) and (pointer: coarse) {
    /* Mobile-specific styles */
    .game-input {
        font-size: 16px; /* Prevents zoom on iOS */
        user-select: none;
        -webkit-user-select: none;
    }
    
    .btn {
        padding: 14px 24px;
        font-size: 1.2rem;
        min-height: 50px;
        touch-action: manipulation;
    }
    
    .anomaly {
        font-size: 1.1rem;
        padding: 14px 18px;
        min-height: 50px;
    }
    
    /* Prevent text selection on mobile */
    .game-area, .current-target, .stats {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
}

/* Touch feedback */
.btn:active {
    transform: scale(0.98);
}

/* Virtual keyboard handling */
@media screen and (max-height: 500px) {
    .game-container {
        padding: 10px;
    }
    
    .game-header {
        padding: 10px 0;
        margin-bottom: 10px;
    }
    
    .game-title {
        font-size: 1.8rem;
    }
    
    .game-area {
        min-height: 200px;
    }
    
    .instructions {
        display: none;
    }
}
