/* 全局样式 */
:root {
    --primary-color: #4a6bff;
    --secondary-color: #ff6b6b;
    --accent-color: #ffd166;
    --dark-color: #2c3e50;
    --light-color: #f8f9fa;
    --success-color: #06d6a0;
    --warning-color: #ffc145;
    --danger-color: #ef476f;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: var(--dark-color);
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 标题和模式选择器 */
header {
    text-align: center;
    margin-bottom: 30px;
}

.title {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: var(--primary-color);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
}

.title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
}

.mode-selector {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.mode-selector button {
    background-color: var(--light-color);
    color: var(--dark-color);
    border: none;
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 8px;
}

.mode-selector button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.mode-selector button.active {
    background-color: var(--primary-color);
    color: white;
}

/* 主要内容区域 */
main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

/* 动画容器 */
.animation-container {
    width: 100%;
    height: 300px;
    position: relative;
    margin-bottom: 20px;
    perspective: 1000px;
}

.animation-effect {
    position: absolute;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
}

.animation-effect.active {
    display: flex;
}

/* 轮盘动画 */
.wheel-container {
    position: relative;
    width: 280px;
    height: 280px;
}

.wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(
        var(--primary-color) 0% 10%,
        var(--secondary-color) 10% 20%,
        var(--accent-color) 20% 30%,
        var(--success-color) 30% 40%,
        var(--warning-color) 40% 50%,
        var(--danger-color) 50% 60%,
        var(--primary-color) 60% 70%,
        var(--secondary-color) 70% 80%,
        var(--accent-color) 80% 90%,
        var(--success-color) 90% 100%
    );
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    transition: transform 4s cubic-bezier(0.17, 0.67, 0.83, 0.67);
    transform: rotate(0deg);
}

.wheel-name {
    position: absolute;
    color: white;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    transform-origin: center;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 20px;
}

.wheel-pointer {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 50px;
    background-color: var(--dark-color);
    clip-path: polygon(50% 100%, 0 0, 100% 0);
    z-index: 10;
}

/* 飞入飞出动画 */
.fly-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.fly-name {
    position: absolute;
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 30px;
    font-weight: bold;
    box-shadow: var(--shadow);
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.5s ease;
}

/* 3D旋转动画 */
.scene {
    width: 200px;
    height: 200px;
    perspective: 600px;
}

.cube {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transform: translateZ(-100px);
    transition: transform 1s;
}

.cube__face {
    position: absolute;
    width: 200px;
    height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.5);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.2);
}

.cube__face--front  { 
    background: var(--primary-color); 
    transform: rotateY(0deg) translateZ(100px); 
}
.cube__face--right  { 
    background: var(--secondary-color); 
    transform: rotateY(90deg) translateZ(100px); 
}
.cube__face--back   { 
    background: var(--accent-color); 
    transform: rotateY(180deg) translateZ(100px); 
}
.cube__face--left   { 
    background: var(--success-color); 
    transform: rotateY(-90deg) translateZ(100px); 
}
.cube__face--top    { 
    background: var(--warning-color); 
    transform: rotateX(90deg) translateZ(100px); 
}
.cube__face--bottom { 
    background: var(--danger-color); 
    transform: rotateX(-90deg) translateZ(100px); 
}

/* 结果容器 */
.result-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
}

.result-box {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    text-align: center;
    width: 100%;
    max-width: 500px;
}

.result-box h2 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.result {
    font-size: 2rem;
    font-weight: bold;
    min-height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.action-buttons {
    display: flex;
    gap: 15px;
}

.action-buttons button {
    padding: 12px 25px;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.primary-btn {
    background-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow);
}

.primary-btn:hover {
    background-color: #3a5bef;
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.primary-btn:disabled {
    background-color: #a0a0a0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#reset-btn {
    background-color: var(--light-color);
    color: var(--dark-color);
    box-shadow: var(--shadow);
}

#reset-btn:hover {
    background-color: #e9ecef;
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* 动画选择器 */
.animation-selector {
    width: 100%;
    max-width: 500px;
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.animation-selector h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
    text-align: center;
}

.animation-buttons {
    display: flex;
    justify-content: space-around;
}

.animation-buttons button {
    background-color: var(--light-color);
    color: var(--dark-color);
    border: none;
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.animation-buttons button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.animation-buttons button.active {
    background-color: var(--primary-color);
    color: white;
}

/* 名单管理和统计分析 */
.name-management {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .name-management {
        grid-template-columns: 1fr;
    }
}

.name-list-container, .statistics-container {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.name-list-container h3, .statistics-container h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
    text-align: center;
}

.name-list-actions {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.name-list-actions button {
    background-color: var(--light-color);
    color: var(--dark-color);
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
}

.name-list-actions button:hover {
    background-color: var(--primary-color);
    color: white;
}

.name-list-wrapper {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
}

.name-list {
    list-style: none;
}

.name-item {
    padding: 10px 15px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.name-item:last-child {
    border-bottom: none;
}

.name-item:hover {
    background-color: #f5f5f5;
}

.name-item.called {
    background-color: rgba(6, 214, 160, 0.1);
}

.name-item.absent {
    background-color: rgba(239, 71, 111, 0.1);
    text-decoration: line-through;
}

.name-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.name-weight {
    background-color: var(--accent-color);
    color: var(--dark-color);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: bold;
}

.name-actions {
    display: flex;
    gap: 10px;
}

.name-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
}

.name-actions .edit-btn {
    color: var(--primary-color);
}

.name-actions .absent-btn {
    color: var(--danger-color);
}

.name-actions .delete-btn {
    color: #777;
}

.name-actions button:hover {
    transform: scale(1.2);
}

/* 统计分析 */
.statistics-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.stat-item {
    background-color: #f8f9fa;
    padding: 10px;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.chart-container {
    width: 100%;
    height: 200px;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 400px;
    position: relative;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #777;
    transition: var(--transition);
}

.close-btn:hover {
    color: var(--danger-color);
}

.modal h3 {
    margin-bottom: 20px;
    color: var(--primary-color);
    text-align: center;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

/* 动画效果 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.spin {
    animation: spin 1s linear infinite;
}

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

.pulse {
    animation: pulse 1.5s ease infinite;
}

/* 响应式设计 */
@media (max-width: 992px) {
    .container {
        padding: 15px;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .mode-selector {
        flex-wrap: wrap;
    }
    
    .animation-container {
        height: 250px;
    }
    
    .wheel-container {
        width: 220px;
        height: 220px;
    }
    
    .scene {
        width: 150px;
        height: 150px;
    }
    
    .cube__face {
        width: 150px;
        height: 150px;
    }
    
    .cube__face--front { transform: rotateY(0deg) translateZ(75px); }
    .cube__face--right { transform: rotateY(90deg) translateZ(75px); }
    .cube__face--back { transform: rotateY(180deg) translateZ(75px); }
    .cube__face--left { transform: rotateY(-90deg) translateZ(75px); }
    .cube__face--top { transform: rotateX(90deg) translateZ(75px); }
    .cube__face--bottom { transform: rotateX(-90deg) translateZ(75px); }
}

@media (max-width: 576px) {
    .title {
        font-size: 1.8rem;
    }
    
    .mode-selector button {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
    
    .animation-container {
        height: 200px;
    }
    
    .wheel-container {
        width: 180px;
        height: 180px;
    }
    
    .result {
        font-size: 1.5rem;
    }
    
    .action-buttons button {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .animation-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .animation-buttons button {
        width: 100%;
        justify-content: center;
    }
    
    .name-list-actions {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .name-list-actions button {
        flex: 1;
        min-width: 80px;
        justify-content: center;
    }
    
    .statistics-content {
        grid-template-columns: 1fr;
    }
}
