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

body {
    font-family: Arial, sans-serif;
    background: linear-gradient(to bottom, #223340 0%, #000 90%);
    color: white;
    overflow-x: hidden;
    height: 100vh;
}

header {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
    z-index: 1002;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

header.show {
    opacity: 1;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 0 0 16px rgba(0,0,0,0.75);
    font-family: "Comic Sans MS", sans-serif;
    font-weight: normal;
    white-space: nowrap;
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.8;
}

.controls {
    position: fixed;
    right: 17px;
    top: 17px;
    min-width: 120px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 90vh;
    overflow-y: auto;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    text-align: center;
}

.control-group label {
    font-weight: 500;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 13px;
    text-transform: uppercase;
    opacity: 0.8;
}

.control-icon {
    font-size: 1.2rem;
}

.toggle-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    background: #90f;
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 13px;
    opacity: 0.6;
    text-transform: uppercase;
}

.toggle-btn:hover {
    opacity: 1;
}

.toggle-btn.inactive {
    background: #666;
    opacity: 0.5;
}

input[type="range"] {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: #333;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    opacity: 0.6;
    transition: opacity 0.15s ease;
}

input[type="range"]:hover {
    opacity: 1;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    transition: all 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: #90f;
}

select {
    padding: 6px 10px;
    border: 1px solid #333;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    opacity: 0.6;
}

select:hover {
    opacity: 1;
    border-color: #90f;
}

select:focus {
    outline: none;
    border-color: #90f;
    opacity: 1;
}

.volume-meter {
    width: 100%;
    height: 16px;
    background: #333;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    opacity: 0.6;
    transition: opacity 0.15s ease;
}

.volume-meter:hover {
    opacity: 1;
}

.volume-bar {
    height: 100%;
    background: linear-gradient(90deg, #90f 0%, #f09 50%, #fb0 100%);
    width: 0%;
    transition: width 0.1s ease;
    border-radius: 8px;
}

.canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, #223340 0%, #000 90%);
    z-index: 1;
}

#ballCanvas {
    display: block;
    width: 100%;
    height: 100%;
    background: transparent;
}

.status-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 20px 30px;
    border-radius: 8px;
    font-size: 16px;
    text-align: center;
    pointer-events: none;
    opacity: 0.9;
    z-index: 1001;
    max-width: 300px;
}

/* 🔥 移除自定义字体，使用系统大气字体 */

.volume-alert {
    position: fixed;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    color: #FFFFFF !important;
    padding: 40px 60px;
    border-radius: 25px;
    font-size: 52px !important;
    font-weight: 900 !important;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    z-index: 1003;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.8),
        0 0 0 2px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    backdrop-filter: blur(20px);
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.8);
    letter-spacing: 3px;
    white-space: nowrap;
    min-width: 650px;
    max-width: 90vw;
    font-family: "Source Han Sans SC", "思源黑体", "Noto Sans CJK SC", "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", "Droid Sans Fallback", "Arial", sans-serif;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    font-style: normal;
    font-variant: normal;
    filter: none;
}

.volume-alert.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.02);
    animation: alertFadeIn 0.5s ease-out;
}

/* 🔥 淡入动画 */
@keyframes alertFadeIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.02);
    }
}

/* 🔥 淡出动画 */
@keyframes alertFadeOut {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.02);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }
}

/* 🔥 淡出类 */
.volume-alert.fade-out {
    animation: alertFadeOut 0.8s ease-in-out forwards;
}

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

@keyframes alertShake {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1.05);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translate(-50%, -50%) scale(1.05) translateX(-2px);
    }
    20%, 40%, 60%, 80% {
        transform: translate(-50%, -50%) scale(1.05) translateX(2px);
    }
}

footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.6);
    color: rgba(255, 255, 255, 0.7);
    padding: 8px 15px;
    font-size: 12px;
    text-align: center;
    z-index: 999;
    backdrop-filter: blur(5px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

footer p {
    margin: 2px 0;
    line-height: 1.3;
}

footer a {
    color: #90f;
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: #fff;
    text-decoration: underline;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .controls {
        grid-template-columns: 1fr;
        padding: 20px;
    }
    
    #ballCanvas {
        height: 300px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .controls {
        padding: 15px;
    }
    
    #ballCanvas {
        height: 250px;
    }
}

/* 动画效果 */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.control-group:hover {
    transform: translateY(-2px);
    transition: transform 0.3s ease;
}

/* 音量条动画 */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(102, 126, 234, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0);
    }
}

.volume-bar.active {
    animation: pulse 1s infinite;
}