/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Microsoft YaHei', Arial, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: relative;
}

.nav-bar {
    position: absolute;
    top: 1rem;
    left: 2rem;
}

.back-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.back-link:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(-3px);
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

h1, h2, h3 {
    margin-bottom: 1rem;
}

/* 容器布局 */
.container {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
    }
}

/* 模拟区域样式 */
.simulation-container {
    background-color: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.simulation {
    width: 100%;
    height: 200px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1rem;
}

.simulation-box {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background-color: #f8f9fa;
}

.wall {
    width: 10px;
    height: 80px;
    background-color: #34495e;
    border-radius: 0 3px 3px 0;
    position: absolute;
    left: 0;
}

.spring-container {
    display: flex;
    align-items: center;
    position: relative;
    height: 100%;
    width: 100%;
}

.spring {
    height: 40px;
    position: absolute;
    left: 10px;
    display: flex;
    align-items: center;
}

.spring-coil {
    height: 40px;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 5px,
        #95a5a6 5px,
        #95a5a6 10px
    );
    width: 150px;
    position: relative;
}

.mass {
    width: 60px;
    height: 60px;
    background-color: #e74c3c;
    border-radius: 50%;
    position: absolute;
    left: 160px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

/* 控制按钮 */
.controls {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

button {
    padding: 0.75rem 1.5rem;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #2980b9;
}

#reset-btn {
    background-color: #95a5a6;
}

#reset-btn:hover {
    background-color: #7f8c8d;
}

/* 参数设置区域 */
.parameters {
    background-color: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.parameter {
    margin-bottom: 1.5rem;
}

.parameter label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.parameter input[type="range"] {
    width: 100%;
    margin-bottom: 0.5rem;
}

/* 物理量显示区域 */
.physics-values {
    background-color: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.physics-value {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #eee;
}

.physics-value:last-child {
    border-bottom: none;
}

/* 图表区域 */
.charts-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (max-width: 1024px) {
    .charts-container {
        grid-template-columns: 1fr;
    }
}

.chart-wrapper {
    background-color: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

canvas {
    width: 100% !important;
    height: 200px !important;
}

/* 解释区域 */
.explanation {
    background-color: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.explanation p, .explanation ul {
    margin-bottom: 1rem;
}

.explanation ul {
    padding-left: 1.5rem;
}

/* 页脚 */
footer {
    background-color: #34495e;
    color: white;
    text-align: center;
    padding: 1rem 0;
    margin-top: 2rem;
} 