/* 全局样式 */
* {
    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: 350px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1rem;
}

#motion-canvas {
    width: 100%;
    height: 300px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.trajectory-info {
    display: flex;
    justify-content: space-around;
    width: 100%;
    margin-top: 1rem;
    padding: 0.5rem;
    background-color: #f8f9fa;
    border-radius: 6px;
}

.info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.9rem;
}

.info-label {
    color: #666;
    font-weight: 500;
}

/* 控制按钮 */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
    justify-content: center;
    align-items: center;
}

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;
}

#launch-btn {
    background-color: #e74c3c;
}

#launch-btn:hover {
    background-color: #c0392b;
}

#launch-btn:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

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

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

.toggle-controls {
    display: flex;
    gap: 1.5rem;
    margin-left: 1rem;
}

.toggle-controls label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

/* 参数设置区域 */
.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;
    position: relative;
}

.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(auto-fit, minmax(350px, 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: 300px !important;
}

/* 说明区域 */
.explanation {
    background-color: white;
    border-radius: 8px;
    padding: 2rem;
    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: 2rem;
}

.key-concepts, .key-formulas, .thinking-questions, .applications {
    margin-bottom: 2rem;
}

.formula {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid #3498db;
}

.formula p {
    margin-bottom: 0.5rem;
    font-family: 'Courier New', monospace;
}

.formula p:last-child {
    margin-bottom: 0;
}

/* 交互式测验 */
.interactive-quiz {
    background-color: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.quiz-container {
    display: grid;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.quiz-question {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 6px;
}

.quiz-question label {
    min-width: 150px;
    font-weight: bold;
}

.quiz-question input[type="number"] {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 120px;
}

.quiz-question button {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.quiz-question span {
    font-weight: bold;
    min-width: 80px;
}

.quiz-question span.correct {
    color: #27ae60;
}

.quiz-question span.incorrect {
    color: #e74c3c;
}

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

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .charts-container {
        grid-template-columns: 1fr;
    }
    
    .simulation {
        height: 250px;
    }
    
    #motion-canvas {
        height: 200px;
    }
    
    .trajectory-info {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .info-item {
        flex-direction: row;
        justify-content: space-between;
    }
    
    .controls {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .toggle-controls {
        margin-left: 0;
        justify-content: center;
    }
    
    .quiz-question {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .quiz-question label {
        min-width: auto;
    }
    
    .quiz-question input[type="number"] {
        width: 100%;
    }
}

@media (max-width: 480px) {
    main {
        padding: 1rem;
    }
    
    .simulation-container,
    .parameters,
    .physics-values,
    .chart-wrapper,
    .explanation,
    .interactive-quiz {
        padding: 1rem;
    }
}