* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Comic Sans MS', 'Arial Rounded MT Bold', '微软雅黑', sans-serif;
    background: linear-gradient(180deg, #0a0e27 0%, #1a1f4b 30%, #2d1b69 70%, #0f0f23 100%);
    min-height: 100vh;
    overflow: hidden;
    touch-action: manipulation;
    position: relative;
}

/* 星空背景 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(2px 2px at 20px 30px, #fff, transparent),
        radial-gradient(2px 2px at 40px 70px, #fff, transparent),
        radial-gradient(1px 1px at 90px 40px, #fff, transparent),
        radial-gradient(2px 2px at 130px 80px, #fff, transparent),
        radial-gradient(1px 1px at 160px 120px, #fff, transparent),
        radial-gradient(2px 2px at 200px 50px, #fff, transparent),
        radial-gradient(1px 1px at 230px 90px, #fff, transparent),
        radial-gradient(2px 2px at 280px 20px, #fff, transparent),
        radial-gradient(1px 1px at 320px 60px, #fff, transparent),
        radial-gradient(2px 2px at 350px 100px, #fff, transparent),
        radial-gradient(1px 1px at 400px 30px, #fff, transparent),
        radial-gradient(2px 2px at 450px 80px, #fff, transparent),
        radial-gradient(1px 1px at 500px 50px, #fff, transparent),
        radial-gradient(2px 2px at 550px 110px, #fff, transparent),
        radial-gradient(1px 1px at 600px 40px, #fff, transparent),
        radial-gradient(2px 2px at 650px 90px, #fff, transparent),
        radial-gradient(1px 1px at 700px 20px, #fff, transparent),
        radial-gradient(2px 2px at 750px 70px, #fff, transparent),
        radial-gradient(1px 1px at 800px 100px, #fff, transparent),
        radial-gradient(2px 2px at 850px 30px, #fff, transparent),
        radial-gradient(1px 1px at 900px 60px, #fff, transparent),
        radial-gradient(2px 2px at 950px 120px, #fff, transparent);
    background-repeat: repeat;
    background-size: 1000px 150px;
    animation: twinkle 3s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* 流星动画 */
.meteor {
    position: fixed;
    width: 4px;
    height: 4px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 10px 2px #fff, 0 0 20px 4px #a78bfa;
    animation: meteor-fall 3s linear infinite;
    pointer-events: none;
    z-index: 1;
}

.meteor::before {
    content: '';
    position: absolute;
    top: 50%;
    right: 0;
    width: 80px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #fff, #a78bfa);
    transform: translateY(-50%);
}

@keyframes meteor-fall {
    0% {
        transform: translateX(0) translateY(0) rotate(-45deg);
        opacity: 1;
    }
    100% {
        transform: translateX(-300px) translateY(300px) rotate(-45deg);
        opacity: 0;
    }
}

.game-container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

.header {
    background: linear-gradient(180deg, rgba(26, 31, 75, 0.95) 0%, rgba(45, 27, 105, 0.9) 100%);
    padding: 15px;
    border-radius: 0 0 30px 30px;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4), 0 0 30px rgba(139, 92, 246, 0.2);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-bottom: 2px solid rgba(167, 139, 250, 0.5);
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    width: 100%;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.target-box {
    text-align: center;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.target-box .label {
    font-size: 20px;
    color: #a78bfa;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(167, 139, 250, 0.8);
}

.target-box .value {
    font-size: 72px;
    font-weight: bold;
    color: #fde047;
    text-shadow: 0 0 20px #fde047, 0 0 40px #f59e0b, 3px 3px 0 #f59e0b;
    display: inline-block;
    animation: starGlow 2s ease-in-out infinite;
}

@keyframes starGlow {
    0%, 100% {
        transform: scale(1);
        text-shadow: 0 0 20px #fde047, 0 0 40px #f59e0b, 3px 3px 0 #f59e0b;
    }
    50% {
        transform: scale(1.05);
        text-shadow: 0 0 30px #fde047, 0 0 60px #f59e0b, 0 0 80px #f59e0b, 3px 3px 0 #f59e0b;
    }
}

.target-box .progress {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    color: #c4b5fd;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(167, 139, 250, 0.8);
    animation: progressPulse 2s ease-in-out infinite;
}

@keyframes progressPulse {
    0%, 100% {
        opacity: 0.8;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.timer-box {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #FFFFFF;
    flex-shrink: 1;
}

.timer-box .label {
    font-size: clamp(10px, 2vw, 14px);
    color: #c4b5fd;
}

.timer-box .value {
    font-size: clamp(20px, 5vw, 36px);
    font-weight: bold;
    color: #60a5fa;
    text-shadow: 0 0 15px #60a5fa, 0 0 30px #3b82f6;
}

.raindrop-area {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.raindrop {
    position: absolute;
    background: radial-gradient(circle at 30% 30%, #fef3c7 0%, #fbbf24 40%, #f59e0b 100%);
    border-radius: 50%;
    width: 100px;
    height: 100px;
    font-size: clamp(16px, 4vw, 28px);
    font-weight: bold;
    color: #1e1b4b;
    box-shadow: 
        0 0 20px #fbbf24,
        0 0 40px #f59e0b,
        0 0 60px rgba(245, 158, 11, 0.5),
        inset -5px -5px 15px rgba(0,0,0,0.2),
        inset 5px 5px 15px rgba(255,255,255,0.5);
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: starTwinkle 1.5s ease-in-out infinite;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    padding: 0 10px;
}

.raindrop::before {
    content: '⭐';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 24px;
    filter: drop-shadow(0 0 10px #fde047);
    animation: starRotate 3s linear infinite;
}

@keyframes starTwinkle {
    0%, 100% { 
        box-shadow: 
            0 0 20px #fbbf24,
            0 0 40px #f59e0b,
            0 0 60px rgba(245, 158, 11, 0.5),
            inset -5px -5px 15px rgba(0,0,0,0.2),
            inset 5px 5px 15px rgba(255,255,255,0.5);
    }
    50% { 
        box-shadow: 
            0 0 30px #fbbf24,
            0 0 60px #f59e0b,
            0 0 90px rgba(245, 158, 11, 0.7),
            inset -5px -5px 15px rgba(0,0,0,0.2),
            inset 5px 5px 15px rgba(255,255,255,0.5);
    }
}

@keyframes starRotate {
    0% { transform: translateX(-50%) rotate(0deg); }
    100% { transform: translateX(-50%) rotate(360deg); }
}

.raindrop:active {
    transform: scale(0.9);
}

.raindrop.correct {
    background: radial-gradient(circle at 30% 30%, #86efac 0%, #22c55e 40%, #16a34a 100%);
    box-shadow: 
        0 0 30px #22c55e,
        0 0 60px #16a34a,
        0 0 90px rgba(22, 163, 74, 0.7);
    animation: correctPop 0.5s ease-out;
}

.raindrop.wrong {
    background: radial-gradient(circle at 30% 30%, #fca5a5 0%, #ef4444 40%, #dc2626 100%);
    box-shadow: 
        0 0 30px #ef4444,
        0 0 60px #dc2626,
        0 0 90px rgba(220, 38, 38, 0.7);
    animation: wrongShake 0.5s ease-out;
}

@keyframes correctPop {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.8; }
    100% { transform: scale(0); opacity: 0; }
}

@keyframes wrongShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.footer {
    background: linear-gradient(180deg, #4FC3F7 0%, #29B6F6 100%);
    padding: 15px;
    border-radius: 30px 30px 0 0;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.2);
    z-index: 100;
}

.score-box {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #FFFFFF;
    flex-shrink: 1;
}

.score-box .label {
    font-size: clamp(10px, 2vw, 14px);
    color: #c4b5fd;
}

.score-box .value {
    font-size: clamp(20px, 5vw, 36px);
    font-weight: bold;
    color: #fde047;
    text-shadow: 0 0 15px #fde047, 0 0 30px #f59e0b;
}

.btn-group {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.game-btn {
    background: linear-gradient(180deg, #8b5cf6 0%, #7c3aed 100%);
    border: none;
    border-radius: 25px;
    padding: clamp(8px, 2vw, 12px) clamp(15px, 3vw, 25px);
    font-size: clamp(12px, 3vw, 16px);
    font-weight: bold;
    color: #FFFFFF;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.5), 0 4px 10px rgba(0,0,0,0.3);
    transition: transform 0.1s, box-shadow 0.1s;
    font-family: inherit;
    white-space: nowrap;
    border: 2px solid rgba(167, 139, 250, 0.5);
}

.game-btn:hover {
    box-shadow: 0 0 25px rgba(139, 92, 246, 0.8), 0 4px 15px rgba(0,0,0,0.3);
    transform: translateY(-2px);
}

.game-btn:active {
    transform: translateY(1px);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5), 0 2px 5px rgba(0,0,0,0.3);
}

.game-btn.restart {
    background: linear-gradient(180deg, #ec4899 0%, #db2777 100%);
    box-shadow: 0 0 15px rgba(236, 72, 153, 0.5), 0 4px 10px rgba(0,0,0,0.3);
    border: 2px solid rgba(244, 114, 182, 0.5);
}

.game-btn.restart:hover {
    box-shadow: 0 0 25px rgba(236, 72, 153, 0.8), 0 4px 15px rgba(0,0,0,0.3);
}

.feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 20px 60px;
    border-radius: 25px;
    font-size: 32px;
    font-weight: bold;
    color: #FFFFFF;
    z-index: 1000;
    animation: feedbackPop 1s ease-out forwards;
    pointer-events: none;
    text-shadow: 0 0 20px rgba(255,255,255,0.8);
    white-space: nowrap;
    min-width: 200px;
    text-align: center;
}

.feedback.correct {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    box-shadow: 0 0 30px rgba(34, 197, 94, 0.8), 0 6px 20px rgba(0,0,0,0.3);
    border: 2px solid rgba(134, 239, 172, 0.5);
}

.feedback.wrong {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.8), 0 6px 20px rgba(0,0,0,0.3);
    border: 2px solid rgba(252, 165, 165, 0.5);
}

.feedback.new-target {
    background: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
    box-shadow: 0 0 30px rgba(168, 85, 247, 0.8), 0 6px 20px rgba(0,0,0,0.3);
    border: 2px solid rgba(192, 132, 252, 0.5);
    font-size: 28px;
}

@keyframes feedbackPop {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    20% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
    80% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
}

@keyframes scoreFeedback {
    0% { transform: translateX(0) translateY(0) scale(0.8); opacity: 0; }
    20% { transform: translateX(10px) translateY(-5px) scale(1.1); opacity: 1; }
    80% { transform: translateX(20px) translateY(-10px) scale(1); opacity: 1; }
    100% { transform: translateX(30px) translateY(-15px) scale(0.8); opacity: 0; }
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 39, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.overlay.hidden {
    display: none;
}

.modal {
    background: linear-gradient(135deg, rgba(26, 31, 75, 0.95) 0%, rgba(45, 27, 105, 0.9) 100%);
    border-radius: 30px;
    padding: 40px;
    text-align: center;
    max-width: 90%;
    box-shadow: 0 0 50px rgba(139, 92, 246, 0.5), 0 10px 40px rgba(0,0,0,0.5);
    border: 2px solid rgba(167, 139, 250, 0.3);
}

.modal h2 {
    font-size: 42px;
    color: #fde047;
    margin-bottom: 20px;
    text-shadow: 0 0 30px #fde047, 0 0 60px #f59e0b;
}

.modal p {
    font-size: 20px;
    color: #c4b5fd;
    margin-bottom: 30px;
    line-height: 1.8;
}

.modal .game-btn {
    font-size: 24px;
    padding: 18px 50px;
}

@media (max-width: 480px) {
    .header {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }

    .top-bar {
        flex-direction: row;
        gap: 8px;
    }

    .target-box .value {
        font-size: 48px;
    }

    .raindrop {
        font-size: 24px;
        padding: 12px 18px;
        min-width: 80px;
    }

    .btn-group {
        gap: 6px;
    }

    .modal h2 {
        font-size: 28px;
    }

    .modal p {
        font-size: 16px;
    }
}
