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

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

/* 容器样式 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border: 2px solid #e3f2fd;
}

.header h1 {
    color: #1976d2;
    margin-bottom: 10px;
    font-size: 2.5em;
    font-weight: 700;
}

.header p {
    color: #666;
    font-size: 1.1em;
}

/* 主内容区域 */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* 动画演示区样式 */
.animation-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border: 2px solid #bbdefb;
}

.animation-area {
    width: 100%;
    height: 500px;
    position: relative;
    background: linear-gradient(180deg, #e3f2fd 0%, #f5f7fa 100%);
    overflow: hidden;
}

/* 控制面板样式 */
.control-panel {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border: 2px solid #e3f2fd;
}

/* 控制按钮样式 */
.control-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    justify-content: center;
}

/* 按钮组样式，确保相关按钮显示在一起 */
.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

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

.btn-primary {
    background: #1976d2;
    color: white;
}

.btn-primary:hover {
    background: #1565c0;
}

.btn-secondary {
    background: #757575;
    color: white;
}

.btn-secondary:hover {
    background: #616161;
}

.btn-pathogen {
    background: #f44336;
    color: white;
}

.btn-pathogen:hover {
    background: #d32f2f;
}

.btn-antibody {
    background: #4caf50;
    color: white;
}

.btn-antibody:hover {
    background: #388e3c;
}

.btn-quick-bind {
    background: #ff9800;
    color: white;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(255, 152, 0, 0.3);
}

.btn-quick-bind:hover {
    background: #f57c00;
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(255, 152, 0, 0.4);
}

/* 速度控制样式 */
.speed-control {
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.speed-control label {
    font-weight: 600;
    color: #424242;
    min-width: 80px;
}

.speed-control input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.speed-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #1976d2;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.speed-control input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #1976d2;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#speedValue {
    font-weight: 600;
    color: #1976d2;
    min-width: 40px;
}

/* 统计信息样式 */
.statistics {
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(240, 247, 255, 0.7);
    padding: 12px 20px;
    border-radius: 8px;
    border-left: 4px solid #1976d2;
}

.stat-label {
    font-weight: 600;
    color: #424242;
}

.stat-value {
    font-weight: 700;
    font-size: 1.2em;
    color: #1976d2;
    background: white;
    padding: 5px 12px;
    border-radius: 20px;
    min-width: 40px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 图例说明区域样式 */
.legend-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 30px;
    margin-top: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border: 2px solid #bbdefb;
}

.legend-section h3 {
    color: #1976d2;
    margin-bottom: 20px;
    font-size: 1.4em;
    text-align: center;
    font-weight: 600;
}

.legend-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 25px;
}

.legend-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: rgba(240, 247, 255, 0.7);
    border-radius: 10px;
    min-width: 120px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.legend-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.legend-icon {
    width: 50px;
    height: 50px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 50%;
    background-color: white;
    padding: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.legend-icon.complex {
    background-color: #e8f5e8;
    border: 3px solid #4caf50;
    position: relative;
}

.legend-icon.complex::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #4caf50;
    font-size: 1.8em;
    font-weight: bold;
}

.legend-item span {
    font-size: 0.9em;
    color: #424242;
    text-align: center;
    font-weight: 500;
}

/* 页脚样式 */
.footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: #666;
    font-size: 0.9em;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* 容器样式 */
.pathogen-container, .antibody-container, .bound-complex-container {
    position: absolute;
    text-align: center;
    display: inline-block;
}

/* 动画元素样式 */
.pathogen, .antibody, .bound-complex {
    position: relative;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    transition: transform 0.3s ease;
    margin-bottom: 5px;
}

/* 名称标签样式 */
.pathogen-name, .antibody-name, .complex-name {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    margin-top: 5px;
    white-space: nowrap;
}

.pathogen:hover, .antibody:hover {
    transform: scale(1.1);
}

/* 特异性结合文本样式 */
.binding-text {
    position: absolute;
    color: #d32f2f;
    font-size: 18px;
    font-weight: bold;
    z-index: 100;
    white-space: nowrap;
    pointer-events: none;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    animation: bindingGlow 1s ease-in-out;
}

@keyframes bindingGlow {
    0% {
        opacity: 0;
        transform: scale(0.5) translateY(0);
    }
    50% {
        opacity: 1;
        transform: scale(1.1) translateY(-10px);
        text-shadow: 0 0 10px rgba(211, 47, 47, 0.8), 2px 2px 4px rgba(0, 0, 0, 0.3);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(-20px);
    }
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .container {
        padding: 20px;
    }

    .header h1 {
        font-size: 2.2em;
    }

    .animation-area {
        height: 450px;
    }

    .control-buttons {
        gap: 10px;
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.95em;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .header h1 {
        font-size: 2em;
    }

    .animation-area {
        height: 400px;
    }

    .control-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        padding: 12px 24px;
    }

    .statistics {
        flex-direction: column;
        gap: 15px;
    }

    .stat-item {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .animation-area {
        height: 300px;
    }

    .header h1 {
        font-size: 1.8em;
    }

    .control-panel {
        padding: 20px;
    }
}