:root {
    --primary-bg: #f4f7f6;
    --secondary-bg: #ffffff;
    --border-color: #e1e8ed;
    --text-color: #333;
    --primary-color: #007bff;
    --light-gray-text: #6c757d;
    --chart-color-1: #5e7ce2;
    --chart-color-2: #4ecbc4;
    --chart-color-3: #fdd475;
    --chart-color-4: #a4a4a4;
    --chart-color-5: #f87979;
    --chart-color-6: #9d7fe0;
    --chart-color-7: #5fb878;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    background-color: var(--primary-bg);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
}

.container {
    max-width: 1300px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 25px;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.logo {
    width: 80px;
    height: 80px;
    border-radius: 10px;
    object-fit: contain;
}

.header-text {
    text-align: left;
}

header h1 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 5px;
}

header h2 {
    font-size: 1.1rem;
    color: var(--light-gray-text);
    font-weight: normal;
    margin-top: 0;
}

.main-content {
    display: flex;
    gap: 20px;
    align-items: stretch;
}

.left-panel, .right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.left-panel {
    flex: 1.2;
}

.right-panel {
    flex: 0.8;
}

.card {
    background-color: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
}

.left-panel .card {
    flex-grow: 1;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.tab-buttons {
    margin-bottom: 20px;
}

.tab-btn {
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    background-color: #fff;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.tab-btn:first-child {
    border-radius: 6px 0 0 6px;
}

.tab-btn:last-child {
    border-radius: 0 6px 6px 0;
    border-left: none;
}

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

fieldset {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
}

legend {
    font-weight: 600;
    padding: 0 10px;
    color: var(--primary-color);
}

.input-group {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.throughput-display {
    min-width: 100px;
    height: 30px;
    display: flex;
    align-items: center;
    padding: 0 8px;
    background-color: #f5f5f5;
    border-radius: 4px;
    border: 1px solid #ddd;
    font-size: 14px;
}

.throughput-value-container {
    flex-grow: 1;
    height: 38px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    font-size: 0.9rem;
    gap: 6px;
}

.throughput-value-container span:first-child {
    color: #f39c12;
    font-size: 1.1rem;
}

.input-group label {
    width: 160px;
    flex-shrink: 0;
    font-size: 0.9rem;
    color: var(--light-gray-text);
}

.input-group input, .input-group select {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
}

.input-group input:disabled, .input-group select:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
    color: #6c757d;
}

.help-icon {
    margin-left: 8px;
    color: var(--light-gray-text);
    border: 1px solid var(--light-gray-text);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    cursor: help;
    position: relative;
    flex-shrink: 0;
}

.tooltip {
    visibility: hidden;
    width: 220px;
    background-color: #333;
    color: #fff;
    text-align: left;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 10;
    bottom: 150%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.85rem;
    line-height: 1.4;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.help-icon:hover .tooltip {
    visibility: visible;
    opacity: 1;
}

/* 添加触摸设备支持 */
@media (hover: none) {
    .help-icon.active .tooltip {
        visibility: visible;
        opacity: 1;
    }
}

.slider-group {
    padding-bottom: 20px;
}

.slider-group label {
    display: block;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: var(--light-gray-text);
}

.slider-group label span {
    color: var(--text-color);
    font-weight: bold;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: #dbeafe;
    border-radius: 5px;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
    margin-top: -8px;
}

input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
}

input[type="range"]::-moz-range-track {
    width: 100%;
    height: 8px;
    background: #dbeafe;
    border-radius: 5px;
}

.slider-labels {
    position: relative;
    width: 100%;
    margin-top: 8px;
    height: 20px;
    overflow: visible;
    margin-bottom: 10px;
}

.slider-labels span {
    position: absolute;
    transform: translateX(-50%);
    color: var(--light-gray-text);
    font-size: 11px;
    white-space: nowrap;
    text-align: center;
    min-width: 24px;
    background-color: rgba(255, 255, 255, 0.7); /* 半透明背景，提高可读性 */
    padding: 0 2px;
    border-radius: 2px;
}

/* 确保标签不会超出容器 */
.slider-labels span:first-child {
    transform: translateX(0);
    text-align: left;
    padding-left: 0;
}

.slider-labels span:last-child {
    transform: translateX(-100%);
    text-align: right;
    padding-right: 0;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .slider-labels {
        height: 24px;
        margin-bottom: 15px;
    }
    
    .slider-labels span {
        font-size: 10px;
    }
}

.chart-container {
    position: relative;
    width: 90%;
    max-width: 300px;
    margin: 0 auto 20px auto;
}

.memory-legend {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0;
    margin: 0;
    list-style: none;
}

.legend-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    align-items: center;
    font-size: 0.9rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}
.legend-item:hover {
    background-color: #f8f9fa;
}

.legend-color-box {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}

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

.legend-value {
    font-weight: 600;
    white-space: nowrap;
    text-align: right;
    color: var(--light-gray-text);
}

.legend-item.total {
    background-color: #e9ecef;
    padding: 10px;
    margin-top: 8px;
    font-size: 1rem;
    font-weight: bold;
}

.legend-item.total .legend-label {
    color: var(--text-color);
}
.legend-item.total .legend-value {
    color: var(--primary-color);
}

.hardware-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.hardware-table th, .hardware-table td {
    border: 1px solid var(--border-color);
    padding: 12px;
    text-align: center;
}

.hardware-table th {
    background-color: var(--primary-bg);
}

/* 添加限制因素的样式 */
.limiting-factor {
    font-size: 0.8rem;
    color: #666;
    display: block;
    margin-top: 3px;
}

.limiting-factor.memory {
    color: #e67e22;
}

.limiting-factor.computing {
    color: #3498db;
}

.not-supported {
    color: #e74c3c;
    font-style: italic;
}

.specific-choice {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.specific-choice label {
    font-size: 0.9rem;
}

.specific-choice select {
    padding: 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.specific-choice span {
    font-size: 0.9rem;
}

.specific-choice strong {
    color: var(--primary-color);
}

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

.result-display {
    font-size: 1.1rem;
    text-align: center;
}

.result-display span {
    font-weight: bold;
    color: var(--primary-color);
}

.simulation-container {
    margin-top: 20px;
}

.simulation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

#simulation-speed-display {
    font-size: 0.9rem;
    color: var(--light-gray-text);
    font-weight: normal;
    margin-left: 10px;
}

#simulation-output {
    height: 300px;
    width: 100%;
    box-sizing: border-box;
    margin-top: 10px;
    font-family: monospace;
    font-size: 0.9rem;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: #e9ecef;
    color: #495057;
    resize: vertical;
}

.simulation-controls {
    flex-shrink: 0;
}

.action-btn {
    padding: 8px 16px;
    border: none;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
    border-radius: 6px;
    margin-left: 10px;
    transition: background-color 0.2s;
}

.action-btn:hover {
    background-color: #0056b3;
}

.action-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.7;
}

.action-btn.refresh {
    background-color: var(--light-gray-text);
}

.action-btn.refresh:hover {
    background-color: #5a6268;
}

/* 自定义硬件计算按钮样式 */
#calculate-custom-btn {
    width: 100%;
    margin-left: 0;
    font-size: 1rem;
    padding: 10px;
    background-color: #007bff;
    transition: background-color 0.3s;
}

#calculate-custom-btn:hover {
    background-color: #0056b3;
}

.hidden {
    display: none;
}

@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }
    .left-panel, .right-panel {
        flex: 1;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    .card {
        padding: 15px;
    }
    header h1 {
        font-size: 1.5rem;
    }
    .input-group {
        flex-direction: column;
        align-items: flex-start;
        position: relative;
        padding-right: 30px;
    }
    .input-group label {
        width: 100%;
        margin-bottom: 5px;
    }
    .input-group input, .input-group select {
        width: 100%;
        box-sizing: border-box;
        padding: 12px 10px;
        font-size: 16px; /* 避免iOS缩放 */
    }
    .help-icon {
        position: absolute;
        right: 0;
        top: 0;
    }
    
    .header-content {
        flex-direction: column;
        gap: 10px;
    }
    
    .header-text {
        text-align: center;
    }
    
    /* 改进滑块在移动端的体验 */
    input[type="range"] {
        height: 10px;
        margin: 10px 0;
    }
    
    input[type="range"]::-webkit-slider-thumb {
        width: 28px;
        height: 28px;
    }
    
    input[type="range"]::-moz-range-thumb {
        width: 28px;
        height: 28px;
    }
    
    .slider-group {
        margin-bottom: 25px;
    }
    
    /* 改进表格在移动端的显示 */
    .hardware-table {
        font-size: 0.8rem;
        margin-bottom: 15px;
    }
    
    .hardware-table th, .hardware-table td {
        padding: 8px 4px;
    }
    
    /* 表格横向滚动提示 */
    .hardware-table::before {
        content: "← 左右滑动查看更多 →";
        display: block;
        text-align: center;
        font-size: 0.8rem;
        color: var(--light-gray-text);
        margin-bottom: 5px;
    }
    
    /* 改进多模态部分在移动端的显示 */
    .modal-header {
        padding: 12px 10px;
    }
    
    .specific-choice {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .specific-choice select {
        width: 100%;
        margin: 5px 0;
    }
    
    /* 改进按钮在移动端的显示 */
    .action-btn {
        padding: 12px 16px;
        margin: 5px;
    }
    
    /* 改进模拟输出区域在移动端的显示 */
    .simulation-container {
        margin-bottom: 20px;
    }
    
    .simulation-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .simulation-controls {
        width: 100%;
        display: flex;
        justify-content: space-between;
    }
    
    .simulation-controls .action-btn {
        flex: 1;
        margin: 0 5px;
        padding: 12px 5px;
        font-size: 14px;
    }
    
    #simulation-output {
        font-size: 14px;
        min-height: 150px;
        padding: 10px;
    }
    
    /* 禁用按钮的样式 */
    .action-btn:disabled {
        background-color: #cccccc;
        cursor: not-allowed;
        opacity: 0.7;
    }
    
    /* 改进多模态配置部分在移动端的显示 */
    #multimodal-inference-config h4 {
        font-size: 14px;
        margin: 10px 0;
    }
    
    #vision-inference-config .input-group,
    #audio-inference-config .input-group {
        margin-bottom: 12px;
    }
}

/* 添加更小屏幕的适配 */
@media (max-width: 480px) {
    header h1 {
        font-size: 1.3rem;
    }
    
    header h2 {
        font-size: 1rem;
    }
    
    .card-title {
        font-size: 1.1rem;
    }
    
    .logo {
        width: 60px;
        height: 60px;
    }
    
    fieldset {
        padding: 15px 10px;
    }
    
    legend {
        font-size: 0.9rem;
    }
    
    .tooltip {
        width: 180px;
        left: auto;
        right: 0;
        transform: none;
    }
    
    /* 改进模拟区域在更小屏幕上的显示 */
    #simulation-output {
        font-size: 13px;
        min-height: 120px;
    }
    
    .simulation-controls .action-btn {
        padding: 10px 5px;
        font-size: 13px;
    }
}

.modal-section {
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.modal-header {
    background-color: #f8f9fa;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.modal-header input[type="checkbox"] {
    margin-right: 10px;
}

.modal-header label {
    font-weight: 600;
    margin-bottom: 0;
    cursor: pointer;
}

#vision-modal-params, #audio-modal-params {
    padding: 10px 15px;
    border-top: 1px solid var(--border-color);
    background-color: #fcfcfc;
}

#audio-modal-params.hidden {
    display: none;
}

/* 移动端表格样式优化 */
.mobile-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}