/* 全局容器和背景 */
body {
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    margin: 0;
    overflow-x: hidden;
    background-color: #000;
    position: relative;
}

/* 动态背景容器 */
.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

/* 粒子背景 */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* 动态渐变背景 */
.gradient-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    opacity: 0.8;
}

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

/* 闪光效果 */
.glow-effect {
    position: absolute;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 70%);
    transform: scale(1.2);
    animation: glowPulse 6s ease-in-out infinite;
    pointer-events: none;
}

@keyframes glowPulse {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1) rotate(0deg);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.2) rotate(180deg);
    }
}

/* 网格背景 */
.grid-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.3;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 50px 50px;
    }
}

/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-x: hidden;
    position: relative;
}

/* 动态背景容器 */
.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

/* 渐变背景 */
.gradient-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #6f42c1 50%, #3a1c71 75%, #d76d77 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

/* 网格背景 */
.grid-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 30px 30px;
    background-position: -1px -1px;
    opacity: 0.5;
}

/* 光晕效果 */
.glow-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 70%);
    transform: translate(-50%, -50%);
    filter: blur(40px);
    animation: glowPulse 8s ease-in-out infinite alternate;
}

/* 粒子容器 */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* 渐变动画 */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* 光晕脉冲动画 */
@keyframes glowPulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.5;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.8;
    }
}

.container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 
                0 0 20px rgba(102, 126, 234, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 30px;
    width: 100%;
    max-width: 800px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.container:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), 
                0 0 30px rgba(102, 126, 234, 0.4);
}

h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 2.2rem;
    font-weight: 700;
}

h2 {
    color: #34495e;
    margin-bottom: 15px;
    font-size: 1.4rem;
    font-weight: 600;
}

/* 输入区域样式 */
.input-section {
    margin-bottom: 30px;
}

#nameInput {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

#nameInput:focus {
    outline: none;
    border-color: #667eea;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

/* 按钮样式 */
button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* 文件导入按钮样式 */
.file-input-label {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    display: inline-block;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    text-align: center;
    font-weight: 500;
    position: relative;
}

.file-input-label:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #764ba2, #667eea);
}

.file-input-label:active {
    transform: translateY(0);
}

.file-hint {
    display: block;
    font-size: 12px;
    opacity: 0.9;
    margin-top: 4px;
    font-weight: normal;
}

#addNamesBtn {
    background-color: #27ae60;
    color: white;
    flex: 1;
}

#addNamesBtn:hover {
    background-color: #229954;
    transform: translateY(-2px);
}

#clearNamesBtn {
    background-color: #e74c3c;
    color: white;
}

#clearNamesBtn:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
}

#drawBtn {
    background-color: #3498db;
    color: white;
    width: 100%;
    padding: 15px;
    font-size: 1.2rem;
    margin-bottom: 30px;
}

#drawBtn:hover:not(:disabled) {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
}

#drawBtn:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
    transform: none;
}

/* 参与人员列表样式 */
.participants-section {
    margin-bottom: 30px;
    max-height: 200px;
    overflow-y: auto;
}

#participantsList {
    list-style-type: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

#participantsList li {
    background-color: #ecf0f1;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.95rem;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 8px;
}

#participantsList li .remove-btn {
    background: none;
    border: none;
    color: #e74c3c;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#participantsList li .remove-btn:hover {
    color: #c0392b;
    background: none;
    transform: none;
}

/* 结果展示区域样式 */
.result-section {
    text-align: center;
}

#resultDisplay {
    font-size: 2rem;
    font-weight: 700;
    color: #e74c3c;
    padding: 30px;
    background-color: #f8f9fa;
    border-radius: 10px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

/* 动画效果 */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes glow {
    0% { box-shadow: 0 0 5px rgba(231, 76, 60, 0.5); }
    50% { box-shadow: 0 0 20px rgba(231, 76, 60, 0.8), 0 0 30px rgba(231, 76, 60, 0.5); }
    100% { box-shadow: 0 0 5px rgba(231, 76, 60, 0.5); }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-30px); }
    60% { transform: translateY(-15px); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes drawSpin {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.1); }
    100% { transform: rotate(360deg) scale(1); }
}

.result-animation {
    animation: pulse 0.6s ease-in-out, glow 1s ease-in-out;
}

.shake-animation {
    animation: shake 0.5s ease-in-out;
}

.bounce-animation {
    animation: bounce 1s ease;
}

.draw-button-active {
    animation: drawSpin 0.5s ease-in-out;
}

/* 参与者添加时的动画 */
#participantsList li {
    animation: fadeIn 0.3s ease-out;
}

/* 结果区域的背景效果 */
#resultDisplay {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    position: relative;
    overflow: hidden;
}

#resultDisplay::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255, 255, 255, 0.1) 10px,
        rgba(255, 255, 255, 0.1) 20px
    );
    transform: rotate(45deg);
    opacity: 0;
    transition: opacity 0.3s;
}

#resultDisplay.result-animation::before {
    opacity: 1;
    animation: pulse 0.6s ease-in-out;
}

/* 音乐控制按钮样式 */
.music-control {
    margin-top: 20px;
    text-align: center;
}

.music-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.music-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #764ba2, #667eea);
}

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

.music-btn.muted {
    background: linear-gradient(135deg, #cccccc, #999999);
    box-shadow: 0 4px 15px rgba(153, 153, 153, 0.3);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.2rem;
    }
    
    #resultDisplay {
        font-size: 1.6rem;
        padding: 20px;
    }
    
    .button-group {
        flex-direction: column;
    }
}