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

:root {
    /* 原始变量保留，但不再作为主要颜色 */
    --form-control-color: rgb(75, 75, 75);
    --border-color: rgb(75, 75, 75);
    --fill-color: rgb(75, 75, 75);
    --text-color: rgb(75, 75, 75);
    
    /* 新增变量 - 更浅的蓝色色调 */
    --primary: #3b82f6;
    --secondary: #60a5fa;
    --accent: #3b82f6;
    --highlight: #60a5fa;
    --light: #f6fbff;
    --text-primary: #2a3a4a;
    --text-secondary: #4b5563;
    --border-light: rgba(59, 130, 246, 0.2);
    --card-bg: #f6fbff;
    --button-gradient: linear-gradient(90deg, #60a5fa 0%, #3b82f6 100%);
    --button-hover-gradient: linear-gradient(90deg, #3b82f6 0%, #60a5fa 100%);
    --title-gradient: linear-gradient(90deg, #3b82f6, #60a5fa);
    --bg-gradient: linear-gradient(135deg, #f6fbff 0%, #e6f0fa 100%);
    --container-bg: #eaf4fb;
    --chart-bg: #fff;
    --chart-border: #e3eaf5;
}

body {
    font-family: 'Noto Sans SC', 'Segoe UI', Arial, sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    background: var(--bg-gradient);
    color: var(--text-primary);
    height: 100vh;
    padding: 10px;
    margin: 0;
    overflow: hidden;
    box-sizing: border-box;
}

/* 三栏布局容器 */
#main-layout {
    display: grid;
    grid-template-columns: 320px 1fr 340px; /* 左右边栏分别增宽40px */
    grid-template-rows: 1fr; /* 移除顶部的auto行，只保留一行 */
    gap: 15px;
    width: 100%;
    flex: 1;
    overflow: hidden;
    align-items: stretch; /* 改为stretch使所有区域高度一致 */
    height: 100vh; /* 使用全屏高度 */
    padding: 15px; /* 增加整体内边距 */
    box-sizing: border-box; /* 确保 padding 包含在总宽度内 */
}

/* 新的标题区域样式 */
#title-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-bottom: 10px; /* 减小标题区域底部距离 */
    text-align: center;
}

.title-text {
    font-family: 'Orbitron', 'Noto Sans SC', sans-serif;
    font-size: 1.6em;
    color: #3b82f6;
    font-weight: 600;
    margin-bottom: 12px;
    letter-spacing: 1.5px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.title-divider {
    height: 1px;
    width: 80%;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.5), transparent);
    margin: 15px 0;
}

.return-button {
    display: inline-block;
    background: linear-gradient(135deg, #3b82f6, #1e40af);
    color: white;
    padding: 6px 15px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.9em;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    margin-top: 5px;
}

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

/* 左侧边栏：数据可视化 */
#visualization-sidebar, #controls-sidebar {
    grid-row: 1; /* 修改为第一行，因为现在只有一行 */
    overflow-y: auto; /* 内容过多时可滚动 */
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: calc(100vh - 30px); /* 增加高度占用更多空间 */
    justify-content: space-between; /* 添加空间平均分布，确保底部对齐 */
    gap: 35px; /* 进一步增大左侧栏元素间距 */
    padding: 20px 15px 30px; /* 增加底部内边距确保对齐 */
}

#visualization-sidebar {
    grid-column: 1;
    display: flex;
    flex-direction: column;
    height: 100%; /* 确保高度填充 */
}

/* 中间主区域：流体模拟 */
#center-content {
    grid-column: 2;
    grid-row: 1; /* 修改为第一行，因为现在只有一行 */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between; /* 使内容平均分布，确保底部对齐 */
    height: 100%; /* 确保有足够的高度 */
    overflow: hidden;
    padding-bottom: 20px; /* 添加底部内边距确保与其他区域对齐 */
}

/* 右侧边栏：模拟控制参数 */
#controls-sidebar {
    grid-column: 3;
    grid-row: 1; /* 确保与其他面板一致 */
}


/* ---------------------------------------------------------------------------------------------- */
/* FLUID SIMULATION */


/* 旧的simulation容器样式调整，适应新布局 */
#simulation {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0;
    margin: 0;
    background-color: transparent;
    border-radius: 0;
    border: none;
    box-shadow: none;
}

/* fluid simulation canvas ------------------------*/
#titleCaption {
    font-size: 1.5em;
    margin-left: 0;
    width: 100%;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-light);
}

#plots {
    background-color: var(--container-bg);
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.07);
    border: 1px solid var(--border-light);
    margin-bottom: 24px;
    width: 100%;
}

#xPos {
    width: 600px;
}

input[type="range"] {
    accent-color: var(--accent);
    height: 6px;
    border-radius: 5px;
    background-color: rgba(59, 130, 246, 0.1);
    margin: 15px 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--highlight);
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(59, 130, 246, 0.2);
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--highlight);
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(59, 130, 246, 0.2);
    border: none;
}

#contourControl {
    display: flex;
    align-items: center;
}

#plotContour {
    border-radius: 0;
    border-top-left-radius: 15px;
    border-bottom-left-radius: 15px;
    border: none;
    height: 30px;
    background: var(--button-gradient);
    color: white;
    font-weight: 500;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

#plotContour:hover {
    background: var(--button-hover-gradient);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

#contourSpinner {
    width: 40px;
    font-size: 1em;
    text-align: center;
    border-top-right-radius: 15px;
    border-bottom-right-radius: 15px;
    border: 1px solid var(--border-light);
    border-left: none;
    height: 30px;
    background-color: rgba(14, 65, 102, 0.5);
    color: var(--text-primary);
}

#fluidPlotContainer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    margin-bottom: 10px; /* 减小底部外边距 */
    background-color: var(--chart-bg);
    border-radius: 12px;
    padding: 15px 15px; /* 减小内边距 */
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
    border: 1px solid var(--chart-border);
    width: 100%;
    max-width: 100%;
    margin: 0 auto; /* 水平居中 */
    flex: 1; /* 允许容器根据可用空间自适应增长 */
    min-height: 400px; /* 减小最小高度 */
}

#fluidPlot {
    position: relative;
    width: 100%;
    height: 500px; /* 显著增加高度 */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#colorMapLegend {
    position: absolute;
    right: 10px; /* 向左移动，使其更近主容器 */
    top: 10px;
    z-index: 10; /* 确保图例在最上层 */
    background-color: rgba(255, 255, 255, 0.8); /* 增加不透明度 */
    padding: 3px; /* 小内边距 */
    border-radius: 4px; /* 圆角 */
    border: 1px solid rgba(96, 165, 250, 0.3); /* 添加边框使其更明显 */
}

.chart canvas {
    display: block; /* 移除 canvas 下方的额外空间 */
    width: 100%;    /* 使 canvas 宽度填充容器 */
    height: 180px;   /* 保持固定的绘图高度 */
    box-sizing: border-box; /* 确保边框和内边距包含在宽度内（如果添加的话） */
}

#videoControlButtons {
    display: flex;
    gap: 20px;
    grid-column-start: 2;
}

/* 滑块容器样式 */
.slider-container {
    display: flex;
    align-items: center;
    justify-content: center; /* 水平居中 */
    gap: 15px;
    width: 90%; /* 缩小宽度以便更好居中 */
    padding: 15px 0;
    margin: 10px auto; /* 增加上下边距并居中 */
    text-align: center; /* 文本居中 */
}

/* 滑块标签样式 */
.slider-label {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: 60px;
}

#videoControlButtons>* {
    border: none;
    background: var(--button-gradient);
    color: white;
    cursor: pointer;
    height: 30px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    padding: 0 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#videoControlButtons>*:hover {
    background: var(--button-hover-gradient);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

/* 控件容器样式 */
.control-container {
    background-color: rgba(14, 65, 102, 0.2);
    border-radius: 8px;
    padding: 18px 15px; /* 增加内边距，特别是上下方向 */
    margin-bottom: 20px; /* 增加底部外边距 */
    border: 1px solid rgba(59, 130, 246, 0.15);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.control-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(96, 165, 250, 0.5), transparent);
}

/* 分辨率选择器 */
#resolutionSelector {
    text-align: center;
    font-size: 15px;
    width: 90px;
    height: 32px;
    border-radius: 5px;
    background-color: var(--chart-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    box-shadow: 0 2px 5px rgba(59, 130, 246, 0.05);
}

/* 播放图标 */
#playIcon {
    display: none;
    padding-bottom: 2px;
}

/* 播放速度 */
#playbackSpeed {
    font-size: 16px;
    text-align: center;
    font-weight: bolder;
    color: white;
}

/* 流体按钮容器 */
#fluidButtons {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    justify-items: center;
    align-items: center;
    margin-bottom: 20px; /* 增加底部外边距 */
    padding: 12px 12px 18px 12px; /* 增加底部内边距 */
    background-color: var(--container-bg);
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.05);
    border: 1px solid var(--border-light);
    gap: 10px;
}

/* 图表容器 */
#chartContainer {
    margin-top: 0;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    padding: 15px 10px;
    background-color: var(--container-bg);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.05);
    border: 1px solid var(--border-light);
    position: relative;
    overflow: visible; /* 允许坐标轴标签超出容器 */
    flex: 1;
    height: 100%; /* 确保高度填充整个父容器 */
    max-height: none; /* 移除最大高度限制 */
    box-sizing: border-box; /* 确保 padding 和 border 包含在容器尺寸内 */
}

/* 图表容器装饰 - 已移除以与右侧栏保持一致 */

/* 图表样式 */
.chart {
    position: relative;
    text-align: center;
    margin: 0 0 25px 0; /* 增加底部外边距 */
    background-color: var(--chart-bg);
    border-radius: 8px; /* 与右侧栏容器保持一致 */
    /* 增加底部内边距，为 X 轴标签留出更多空间 */
    padding: 35px 15px 45px 35px; /* 增加内边距使内容更加宽松 */
    box-shadow: 0 3px 8px rgba(59, 130, 246, 0.08); /* 与右侧栏保持一致 */
    border: 1px solid var(--chart-border);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
    box-sizing: border-box; /* 确保 padding 不会增加元素总宽度 */
    min-width: 0;
    max-height: none; /* 移除固定最大高度，让其自适应 */
    overflow: visible;
    height: 250px; /* 设置固定高度使各图表大小一致 */
    flex: 1; /* 允许元素自适应空间 */
}

.chart:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

/* 图表标题 */
/* 控件标题样式 */
.control-title {
    font-family: 'Orbitron', 'Noto Sans SC', sans-serif;
    font-size: 0.9em;
    color: #93c5fd;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    letter-spacing: 1px;
}

.control-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 0.9em;
    background-color: #60a5fa;
    margin-right: 6px;
    border-radius: 2px;
}

.figureCaption {
    font-family: 'Noto Sans SC', 'Segoe UI', sans-serif;
    color: var(--text-primary);
    font-size: 0.9em; /* 稍微减小标题字号 */
    margin-bottom: 8px; /* 减小标题和图表间距 */
    letter-spacing: 0.5px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: calc(100% - 20px); /* 限制最大宽度防止溢出 */
    position: absolute; /* 绝对定位标题 */
    top: 5px; /* 向上移动标题位置 */
    left: 50%; /* 水平居中 */
    transform: translateX(-50%); /* 精确居中 */
    width: auto; /* 让宽度自适应内容 */
}

/* y轴标签 */
.yLabel {
    position: absolute;
    /* 调整位置，使其在图表区域左侧并垂直居中 */
    top: 50%; 
    left: 20px; /* 从10px改为20px */
    transform: translateY(-50%) rotate(-90deg); /* 先旋转再平移 */
    transform-origin: left center; /* 修改旋转中心为center以保证垂直居中 */
    font-size: 0.8em; /* 减小字号 */
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
    text-align: center; /* 确保文本居中 */
}

/* x轴标签容器 */
.xLabelContainer {
    position: absolute;
    bottom: 0; /* 定位到底部 */
    left: 35px; /* 与图表左侧内边距对齐 */
    right: 15px; /* 与图表右侧内边距对齐 */
    text-align: center;
    padding-bottom: 10px; /* 底部内边距 */
}

/* x轴标签 */
.xLabel {
    font-size: 0.8em; /* 减小字号 */
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block; /* 允许设置最大宽度 */
    max-width: 100%; /* 防止溢出 */
}

/* 控件标题样式 */
.control-title {
    font-family: 'Orbitron', 'Noto Sans SC', sans-serif;
    font-size: 1em; /* 增大字体 */
    color: #3b82f6; /* 使用更深的蓝色提高对比度 */
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    letter-spacing: 1px;
    font-weight: 500; /* 增加字重提高可读性 */
    text-shadow: 0 1px 2px rgba(0,0,0,0.05); /* 添加轻微文字阴影增强可读性 */
}

/* 宏观属性选择 */
fieldset {
    border: none;
}

input[type="radio"] {
    display: none;
}

/* 图表选择表单 */
#plotForm {
    margin-top: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    padding: 15px 10px;
    background-color: var(--container-bg);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.05);
    border: 1px solid var(--border-light);
}

/* 宏观属性标签 */
.macroLabel {
    width: 32px; /* 略微增大按钮 */
    height: 32px; /* 略微增大按钮 */
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid var(--border-light);
    border-radius: 50%;
    background-color: rgba(14, 65, 102, 0.7); /* 增加不透明度提高对比度 */
    color: white; /* 使用白色文字提高可读性 */
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15); /* 增强阴影效果 */
    transition: all 0.3s ease;
    font-weight: 500; /* 增加字重提高可读性 */
}

.macroLabel:hover {
    cursor: pointer;
    background-color: rgba(0, 188, 212, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

input[type="radio"]:checked+.macroLabel {
    background: var(--button-gradient);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 选择表单 */
.selectionForm {
    display: flex;
    flex-direction: column;
    gap: 15px; /* 增加内部元素间距 */
    padding: 15px 12px; /* 增加内边距 */
    position: relative;
    background-color: var(--chart-bg);
    border-radius: 8px;
    border: 1px solid var(--chart-border);
    box-shadow: 0 3px 8px rgba(59, 130, 246, 0.08);
    margin-bottom: 20px; /* 增加底部间距 */
}

/* 选项组样式 */
.option-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 10px;
    background-color: rgba(59, 130, 246, 0.05);
    border-radius: 6px;
    box-shadow: inset 0 0 8px rgba(59, 130, 246, 0.03);
}

/* 颜色图选择器 */
#colorMapSelector {
    height: 30px;
    font-size: 1em;
    background-color: var(--chart-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: 5px;
    padding: 0 10px;
    box-shadow: 0 2px 5px rgba(59, 130, 246, 0.05);
}

/* 切换按钮 */
.toggleBtn {
    background: var(--button-gradient);
    color: white;
    font-size: 1em;
    width: 100px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 5px rgba(59, 130, 246, 0.15);
    transition: all 0.3s ease;
    font-weight: 500;
}

.toggleBtn:hover {
    background: var(--button-hover-gradient);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.2);
    transform: translateY(-2px);
}

#trackHistory {
    width: 80%;
    margin: 0 auto; /* 水平居中 */
    display: block; /* 确保margin: auto生效 */
    font-weight: 500; /* 增加字重提高可读性 */
}

/* 响应式设计 */
@media (max-width: 1200px) {
    #main-layout {
        grid-template-columns: 240px 1fr 280px;
        gap: 15px;
    }
}

@media (max-width: 992px) {
    #main-layout {
        grid-template-columns: 220px 1fr 250px;
        gap: 10px;
    }
    
    #fluidButtons {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .chart {
        padding: 10px;
    }
    
    #fluidPlotContainer {
        padding: 15px 10px;
    }
}

@media (max-width: 768px) {
    #main-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto;
    }
    
    #page-header {
        grid-row: 1;
    }
    
    #center-content {
        grid-column: 1;
        grid-row: 2;
    }
    
    #visualization-sidebar {
        grid-column: 1;
        grid-row: 3;
    }
    
    #controls-sidebar {
        grid-column: 1;
        grid-row: 4;
    }
    
    #simulation {
        padding: 10px 0;
    }
    
    #fluidButtons {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    #resolutionSelector {
        grid-column: span 2;
    }
}

@media (max-width: 480px) {
    #main-layout {
        width: 98vw;
        margin: 10px auto;
        gap: 10px;
    }
    
    #titleCaption {
        font-size: 1.2em;
    }
    
    #fluidButtons {
        grid-template-columns: 1fr;
    }
    
    #resolutionSelector {
        grid-column: span 1;
    }
    
    .toggleBtn {
        width: 90px;
    }
    
    #videoControlButtons {
        gap: 10px;
    }
}

#reynoldsInput {
    /* width: 40px; */
    font-size: 1em;
}

#reLabel {
    display: flex;
    flex-direction: column;
}


#obstacleRadiusLabel {
    display: flex;
    flex-direction: column;
}