
:root {
    --primary-color: #d84315;
    --secondary-color: #f9a825;
    --accent-color: #e53935;
    --bg-color: #fffaf0;
    --card-bg: #ffffff;
    --text-color: #5d4037;
    --text-light: #8d6e63;
    --border-color: #d7ccc8;
    --shadow: 0 4px 12px rgba(216, 67, 21, 0.1);
    --success-color: #2e7d32;
    --warning-color: #f57c00;
    --danger-color: #c62828;

    /* 来自 range-controls.css */
    --range-fill: #d84315;
    --range-fill-soft: #f57c00;
    --range-track: #ead9c7;
}

.back-row {
    width: 100%;
    margin-bottom: 10px;
}

h1, h2, h3 {
    margin-bottom: 15px;
    color: var(--text-color);
}

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

hr {
    margin: 20px 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

.description {
    width: 100%;
    margin-bottom: 20px;
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

/* 布局 */
.experiment-section {
    width: 100%;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.visualization-container {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 20px;
}

.canvas-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.canvas-column .card {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 380px;
    padding: 16px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.canvas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.canvas-header h3 {
    margin-bottom: 0;
}

.canvas-container {
    flex: 1 1 auto;
    width: 100%;
    min-height: 100px;
    height: 0; /* 强制依靠 flex-grow 填充剩余空间 */
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.canvas-container svg {
    display: block;
}

.control-column {
    width: 400px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

@media (max-width: 1100px) {
    .visualization-container {
        flex-direction: column;
    }

    .control-column {
        width: 100%;
    }
}

/* 面板样式 */
.control-panel {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--shadow);
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h3 {
    color: var(--primary-color);
    margin: 0;
    font-size: 1.2em;
}

.collapse-btn {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 1.2em;
    padding: 0 5px;
    transition: transform 0.3s ease;
}

.panel-content {
    transition: all 0.3s ease;
}

.control-panel.collapsed {
    padding-bottom: 10px;
}

.control-panel.collapsed .panel-header {
    margin-bottom: 0;
    border-bottom: none;
}

.control-panel.collapsed .panel-content {
    display: none;
}

.control-panel.collapsed .collapse-btn {
    transform: rotate(-90deg);
}

.control-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.pan-zoom-row {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.pan-buttons, .zoom-buttons {
    display: flex;
    gap: 10px;
    width: 100%;
}

.pan-buttons .btn, .zoom-buttons .btn {
    flex: 1;
    padding: 8px;
    margin: 0;
}

.data-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.data-buttons .btn {
    width: 100%;
    margin: 0;
    padding: 10px;
}

.sliders-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
    padding: 15px;
    background: #fff8e1;
    border-radius: 8px;
    border: 1px dashed var(--secondary-color);
}

.sliders-panel:empty {
    display: none !important;
}

.status-display {
    margin-top: 15px;
    padding: 10px;
    background: #fdf5e6;
    border-radius: 6px;
    border-left: 4px solid var(--primary-color);
}

.status-item {
    margin-bottom: 5px;
    font-size: 0.9em;
    display: flex;
    justify-content: space-between;
}

.result-box {
    margin-top: 15px;
    padding: 10px;
    background: #efebe9;
    border-radius: 6px;
}

/* 模块容器 */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
}

/* 表格样式 */
.data-table-container {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin: 15px 0;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: #efebe9;
    position: sticky;
    top: 0;
}

/* 已迁移至前面的定义 */

/* 控制区域 */
.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    font-weight: 600;
    font-size: 15px;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: #ead9c7;
    border-radius: 999px;
    outline: none;
    cursor: pointer;
    accent-color: var(--primary-color);
}

input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 999px;
    background: transparent;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    margin-top: -5px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: var(--primary-color);
    box-shadow: 0 2px 7px rgba(216, 67, 21, 0.3);
    cursor: pointer;
    transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:active {
    transform: scale(1.2);
}

input[type="range"]::-moz-range-track {
    height: 6px;
    border-radius: 999px;
    background: #ead9c7;
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: var(--primary-color);
    box-shadow: 0 2px 7px rgba(216, 67, 21, 0.3);
    cursor: pointer;
}

input[type="range"]::-moz-range-progress {
    background-color: var(--primary-color);
    height: 6px;
    border-radius: 999px 0 0 999px;
}

.value-display {
    font-family: monospace;
    color: var(--primary-color);
    font-weight: bold;
}

/* 按钮样式 */
.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 15px 0;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background-color: var(--secondary-color);
}

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

.btn-secondary:hover {
    background-color: #e9aa67;
}

.btn-secondary:disabled {
    background-color: #d7ccc8;
    cursor: not-allowed;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background-color: #fbe9e7;
}

.btn-small {
    padding: 5px 10px;
    font-size: 12px;
    background-color: #efebe9;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.btn-small:hover {
    background-color: #e9aa67;
    color: white;
}

/* 右侧面板 */
.info-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.status-panel {
    border-left: 4px solid var(--primary-color);
}

.result-item {
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
}

.result-label {
    color: var(--text-light);
}

.result-value {
    font-weight: bold;
}

/* 动画播放控制已迁移至 .control-buttons */

.speed-control {
    margin-top: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 13px;
}

.speed-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* 画布缩放已迁移至 .pan-zoom-row */

.status-display {
    padding: 12px;
    background: #fdf5e6;
    border-radius: 6px;
    border-left: 4px solid var(--primary-color);
}

.step-info {
    font-weight: bold;
    color: var(--primary-color);
}

.exp-notes-section {
    width: 100%;
    margin: 20px 0;
}

/* --- 合并自 range-controls.css --- */
.range-slider-wrap {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: block;
    align-self: stretch;
}

.control-group .range-slider-wrap,
.algorithm-panel .range-slider-wrap,
.global-controls .range-slider-wrap,
.visualization-section .range-slider-wrap,
.sliders-panel .range-slider-wrap,
.speed-control .range-slider-wrap {
    width: 100%;
    max-width: 100%;
    align-self: stretch;
}

.dropdown-wrap {
    position: relative;
    display: inline-block;
    vertical-align: top;
}

.dropdown-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 200px;
    max-width: min(300px, 92vw);
    padding: 6px 0;
    background: #fff;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 12px;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.12), 0 6px 16px rgba(15, 23, 42, 0.08);
    z-index: 25000;
}

.dropdown-option {
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    padding: 11px 18px;
    font-size: 14px;
    line-height: 1.35;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-color, #334155);
    font-family: inherit;
}

.dropdown-option:hover {
    background: #f1f5f9;
    color: #1d4ed8;
}

.dropdown-option:not(:last-child) {
    border-bottom: 1px solid #f1f5f9;
}

/* --- 合并自 application-custom.css --- */
/* 自定义下拉框样式 */
select {
    width: 100%;
    padding: 8px 38px 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: #fff;
    color: var(--text-color);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    background-image: linear-gradient(45deg, transparent 50%, var(--text-light) 50%),
    linear-gradient(135deg, var(--text-light) 50%, transparent 50%);
    background-position: calc(100% - 18px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

select:focus {
    outline: none;
    border-color: rgba(216, 67, 21, 0.55);
    box-shadow: 0 0 0 3px rgba(216, 67, 21, 0.12);
}

/* 迭代日志弹窗样式 */
.modal-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    z-index: 2000;
}

.modal-panel {
    max-width: 880px;
    width: 96%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    background: #fffaf0;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
    overflow: hidden;
}

.modal-panel .modal-header {
    padding: 10px 16px;
    border-bottom: 1px solid #f0e0cc;
    background: linear-gradient(180deg, #fff7e3, #fff3d5);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-panel .modal-header h3 {
    font-size: 18px;
    color: #5d4037;
    margin: 0;
}

.modal-close {
    cursor: pointer;
    font-size: 20px;
    color: var(--text-light);
}

.modal-close:hover {
    color: #c62828;
}

.modal-body {
    padding: 10px 16px 16px;
    overflow: auto;
}

.modal-summary {
    font-size: 13px;
    color: #555;
    margin-bottom: 8px;
}

.modal-final-box {
    font-size: 13px;
    color: #b71c1c;
    background: #fff3e0;
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 10px;
}

.modal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.modal-table th, .modal-table td {
    padding: 6px 4px;
    border-bottom: 1px solid #ddd;
    text-align: left;
}

.modal-table thead th {
    background-color: #efebe9;
    position: sticky;
    top: 0;
}

/* 定价与利润最大化特有布局样式 */
.profit-config-card {
    padding: 15px 25px !important;
}

.profit-config-card h2 {
    margin-bottom: 12px;
    font-size: 1.4em;
    color: var(--primary-color);
}

.profit-config-container {
    display: flex;
    align-items: center;
    gap: 40px;
}

.profit-config-container .control-group {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
}

.profit-config-container .control-group input {
    width: 100px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1.1em;
    font-weight: 600;
}

.derivation-box {
    flex: 1;
    background: #fff3e0;
    padding: 12px 20px;
    border-radius: 8px;
    border-left: 4px solid var(--secondary-color);
    font-size: 1.05em;
}

#profitSection {
    gap: 20px;
}


