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

body {
    font-family: 'Comic Sans MS', -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.game-container {
    text-align: center;
    width: 100%;
    max-width: 600px;
}

/* 头部 */
.game-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    position: relative;
}

.back-btn {
    position: absolute;
    left: 0;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

h1 {
    color: white;
    font-size: 2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

/* 难度选择 */
.difficulty-selector {
    margin-bottom: 20px;
}

.difficulty-selector label {
    font-size: 1.1rem;
    color: white;
    margin-right: 10px;
}

.diff-btn {
    padding: 8px 20px;
    margin: 0 5px;
    border: none;
    border-radius: 20px;
    font-size: 1rem;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.3);
    color: white;
    transition: all 0.3s;
}

.diff-btn:hover {
    background: rgba(255, 255, 255, 0.5);
}

.diff-btn.active {
    background: white;
    color: #764ba2;
}

.difficulty-desc {
    width: 100%;
    margin-top: 10px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

/* 游戏区域 */
.game-area {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 30px;
    padding: 20px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

/* 气泡容器 */
.bubble-container {
    position: relative;
    width: 100%;
    height: 300px;
    border-radius: 20px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
}

/* 气泡样式 */
.bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%,
        rgba(255, 255, 255, 0.9),
        rgba(255, 255, 255, 0.4) 30%,
        rgba(100, 200, 255, 0.3) 60%,
        rgba(100, 150, 255, 0.2));
    box-shadow:
        inset -5px -5px 15px rgba(0, 0, 0, 0.1),
        inset 5px 5px 15px rgba(255, 255, 255, 0.5),
        0 5px 20px rgba(0, 0, 0, 0.1);
    animation: float 3s ease-in-out infinite;
    cursor: pointer;
    transition: transform 0.2s;
}

.bubble::before {
    content: '';
    position: absolute;
    width: 30%;
    height: 30%;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    top: 15%;
    left: 20%;
}

.bubble:hover {
    transform: scale(1.05);
}

.bubble.popping {
    animation: pop 0.15s ease-out forwards;
}

.bubble.spawning {
    transform: scale(0);
    opacity: 0;
    animation: spawn 0.2s ease-out forwards;
}

.bubble.missed {
    animation: missed 0.3s ease-out forwards;
}

.bubble.waiting {
    opacity: 0.4;
    filter: grayscale(50%);
}

.bubble.active {
    opacity: 1;
    filter: none;
    animation: float 3s ease-in-out infinite, pulse 0.5s ease-in-out infinite;
    box-shadow:
        inset -5px -5px 15px rgba(0, 0, 0, 0.1),
        inset 5px 5px 15px rgba(255, 255, 255, 0.5),
        0 0 30px rgba(255, 200, 100, 0.6);
}

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

@keyframes pulse {
    0%, 100% {
        box-shadow:
            inset -5px -5px 15px rgba(0, 0, 0, 0.1),
            inset 5px 5px 15px rgba(255, 255, 255, 0.5),
            0 0 20px rgba(255, 200, 100, 0.4);
    }
    50% {
        box-shadow:
            inset -5px -5px 15px rgba(0, 0, 0, 0.1),
            inset 5px 5px 15px rgba(255, 255, 255, 0.5),
            0 0 40px rgba(255, 200, 100, 0.8);
    }
}

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

@keyframes spawn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    70% {
        transform: scale(1.1);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes missed {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0.5) translateY(20px);
        opacity: 0;
        filter: grayscale(100%);
    }
}

/* 爆破粒子效果 */
.burst-particle {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    pointer-events: none;
    animation: burst-fly 0.25s ease-out forwards;
}

@keyframes burst-fly {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--x), var(--y)) scale(0);
        opacity: 0;
    }
}

/* 进度条 */
.progress-bar {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    margin: 15px 0 10px;
    overflow: hidden;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #feca57, #ff9f43);
    border-radius: 6px;
    transition: width 0.3s ease;
}

.progress-info {
    color: white;
    font-size: 1.1rem;
}

/* 音量指示器 */
.volume-indicator {
    margin: 20px 0;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
}

.volume-label {
    color: white;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.volume-meter {
    width: 100%;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.volume-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #48dbfb, #0abde3);
    border-radius: 12px;
    transition: width 0.05s;
}

.volume-threshold {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #ff6b6b;
    left: 30%;
}

.burst-indicator {
    margin-top: 10px;
    padding: 8px 20px;
    background: #ff6b6b;
    color: white;
    border-radius: 20px;
    font-weight: bold;
    display: inline-block;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.1s, transform 0.1s;
}

.burst-indicator.active {
    opacity: 1;
    transform: scale(1);
    animation: burst-flash 0.3s ease;
}

@keyframes burst-flash {
    0%, 100% {
        background: #ff6b6b;
    }
    50% {
        background: #ff9f43;
    }
}

/* 状态区域 */
.status {
    margin-top: 20px;
}

.instruction {
    font-size: 1.2rem;
    color: white;
    margin-bottom: 15px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.start-btn {
    padding: 15px 40px;
    font-size: 1.3rem;
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    color: #764ba2;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(252, 182, 159, 0.4);
    font-weight: bold;
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(252, 182, 159, 0.5);
}

.start-btn:disabled {
    background: rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.7);
    cursor: not-allowed;
    box-shadow: none;
}

/* 结果弹窗 */
.result-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 100;
}

.result-overlay.active {
    opacity: 1;
    visibility: visible;
}

.result-card {
    background: white;
    border-radius: 30px;
    padding: 40px;
    text-align: center;
    transform: scale(0.8);
    transition: transform 0.3s;
    max-width: 90%;
    width: 350px;
}

.result-overlay.active .result-card {
    transform: scale(1);
}

.result-icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

.result-title {
    font-size: 2rem;
    color: #764ba2;
    margin-bottom: 10px;
}

.result-message {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 25px;
}

/* 气泡颜色变体 */
.bubble.color-1 {
    background: radial-gradient(circle at 30% 30%,
        rgba(255, 255, 255, 0.9),
        rgba(255, 200, 200, 0.4) 30%,
        rgba(255, 100, 100, 0.3) 60%,
        rgba(255, 80, 80, 0.2));
}

.bubble.color-2 {
    background: radial-gradient(circle at 30% 30%,
        rgba(255, 255, 255, 0.9),
        rgba(200, 255, 200, 0.4) 30%,
        rgba(100, 255, 150, 0.3) 60%,
        rgba(80, 200, 100, 0.2));
}

.bubble.color-3 {
    background: radial-gradient(circle at 30% 30%,
        rgba(255, 255, 255, 0.9),
        rgba(255, 230, 200, 0.4) 30%,
        rgba(255, 200, 100, 0.3) 60%,
        rgba(255, 180, 80, 0.2));
}

.bubble.color-4 {
    background: radial-gradient(circle at 30% 30%,
        rgba(255, 255, 255, 0.9),
        rgba(230, 200, 255, 0.4) 30%,
        rgba(200, 100, 255, 0.3) 60%,
        rgba(180, 80, 255, 0.2));
}

/* 响应式调整 */
@media (max-width: 480px) {
    h1 {
        font-size: 1.6rem;
    }

    .bubble-container {
        height: 250px;
    }

    .back-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .diff-btn {
        padding: 6px 14px;
        font-size: 0.9rem;
        margin: 3px;
    }
}
