/* ===================================
   CHINESE TYPING DEFENSE - STYLES
   Arcade/Neon aesthetic with dark background
   =================================== */

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

body {
    font-family: 'Noto Sans SC', sans-serif;
    overflow: hidden;
    background: #0a0a0a;
}

/* Main Game Container */
.game-container {
    width: 100%;
    height: 450px;
    background: linear-gradient(180deg, #0a0a0a 0%, #1a0a2e 50%, #0a0a0a 100%);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Responsive height for standalone view */
@media (min-width: 768px) and (min-height: 600px) {
    body:not(.iframe) .game-container {
        height: 90vh;
    }
}

/* Top Stats Bar */
.stats-bar {
    display: flex;
    justify-content: space-around;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.7);
    border-bottom: 2px solid #00ffff;
    box-shadow: 0 2px 10px rgba(0, 255, 255, 0.3);
    z-index: 10;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: help;
}

.stat-label {
    font-size: 10px;
    color: #00ffff;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}

.stat-value {
    font-size: 20px;
    color: #fff;
    font-weight: 700;
    text-shadow: 0 0 10px #00ffff, 0 0 20px #00ffff;
}

/* Game View Area */
.game-view {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: radial-gradient(ellipse at center, rgba(138, 43, 226, 0.1) 0%, transparent 70%);
}

/* Falling Character Styles */
.falling-char {
    position: absolute;
    font-size: 36px;
    font-weight: 700;
    color: #ff00ff;
    text-shadow: 
        0 0 10px #ff00ff,
        0 0 20px #ff00ff,
        0 0 30px #ff00ff;
    cursor: default;
    user-select: none;
    transition: transform 0.1s ease;
    animation: charGlow 2s ease-in-out infinite;
}

/* Glow animation for characters */
@keyframes charGlow {
    0%, 100% {
        text-shadow: 
            0 0 10px #ff00ff,
            0 0 20px #ff00ff,
            0 0 30px #ff00ff;
    }
    50% {
        text-shadow: 
            0 0 15px #ff00ff,
            0 0 30px #ff00ff,
            0 0 45px #ff00ff,
            0 0 60px #ff00ff;
    }
}

/* Pinyin label on falling characters */
.pinyin-label {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: #00ffff;
    background: rgba(0, 0, 0, 0.7);
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0.8;
}

/* Bottom Input Area */
.input-area {
    padding: 12px;
    background: rgba(0, 0, 0, 0.8);
    border-top: 2px solid #00ff00;
    box-shadow: 0 -2px 10px rgba(0, 255, 0, 0.3);
    z-index: 10;
}

.instruction-text {
    text-align: center;
    color: #00ff00;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 8px;
    text-shadow: 0 0 10px #00ff00;
}

.pinyin-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 20px;
    font-family: 'Noto Sans SC', sans-serif;
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #00ffff;
    border-radius: 8px;
    color: #fff;
    text-align: center;
    outline: none;
    box-shadow: 
        0 0 10px rgba(0, 255, 255, 0.5),
        inset 0 0 10px rgba(0, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.pinyin-input:focus {
    border-color: #00ff00;
    box-shadow: 
        0 0 20px rgba(0, 255, 0, 0.8),
        inset 0 0 10px rgba(0, 255, 0, 0.2);
}

/* Input shake animation for wrong answer */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.shake {
    animation: shake 0.3s ease;
    border-color: #ff0000 !important;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.8) !important;
}

/* Correct answer flash */
@keyframes correctFlash {
    0%, 100% { background: rgba(0, 0, 0, 0.9); }
    50% { background: rgba(0, 255, 0, 0.3); }
}

.correct-flash {
    animation: correctFlash 0.5s ease;
}

/* Game Overlay (Start/Game Over screens) */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(5px);
}

.game-overlay.hidden {
    display: none;
}

.overlay-content {
    text-align: center;
    padding: 20px;
}

.overlay-title {
    font-size: 48px;
    color: #ff00ff;
    font-weight: 700;
    margin-bottom: 12px;
    text-shadow: 
        0 0 10px #ff00ff,
        0 0 20px #ff00ff,
        0 0 30px #ff00ff;
}

.neon-glow {
    animation: neonPulse 2s ease-in-out infinite;
}

@keyframes neonPulse {
    0%, 100% {
        text-shadow: 
            0 0 10px #ff00ff,
            0 0 20px #ff00ff,
            0 0 30px #ff00ff;
    }
    50% {
        text-shadow: 
            0 0 20px #ff00ff,
            0 0 40px #ff00ff,
            0 0 60px #ff00ff,
            0 0 80px #ff00ff;
    }
}

.overlay-subtitle {
    font-size: 20px;
    color: #00ffff;
    margin-bottom: 20px;
    letter-spacing: 3px;
    text-shadow: 0 0 10px #00ffff;
}

.instructions {
    margin: 20px 0;
    color: #fff;
    font-size: 14px;
    line-height: 1.8;
}

.instructions p {
    margin: 8px 0;
}

.overlay-score,
.overlay-high {
    font-size: 24px;
    color: #00ff00;
    margin: 12px 0;
    text-shadow: 0 0 10px #00ff00;
}

.restart-btn {
    padding: 14px 40px;
    font-size: 18px;
    font-weight: 700;
    color: #000;
    background: linear-gradient(135deg, #00ffff, #00ff00);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 
        0 0 20px rgba(0, 255, 255, 0.5),
        0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    margin-top: 20px;
}

.restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 0 30px rgba(0, 255, 255, 0.8),
        0 6px 20px rgba(0, 0, 0, 0.4);
}

.restart-btn:active {
    transform: translateY(0);
}

/* Pulse animation for start button */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* Particle effect for correct answers */
.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #00ff00;
    border-radius: 50%;
    pointer-events: none;
    box-shadow: 0 0 10px #00ff00;
    animation: particleFloat 1s ease-out forwards;
}

@keyframes particleFloat {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) scale(0);
    }
}

/* Character destruction animation */
@keyframes charDestroy {
    0% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: scale(2) rotate(360deg);
    }
}

.destroying {
    animation: charDestroy 0.5s ease-out forwards;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .falling-char {
        font-size: 28px;
    }
    
    .overlay-title {
        font-size: 32px;
    }
    
    .stat-value {
        font-size: 16px;
    }
    
    .pinyin-input {
        font-size: 18px;
        padding: 10px 12px;
    }
}