body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

header h1 { margin: 0 0 12px; }
nav a { margin-right: 12px; text-decoration: none; }
.card { background: #fff; padding: 16px; border: 1px solid #e5e7eb; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
button { padding: 8px 14px; border: 1px solid #2563eb; background: #3b82f6; color: #fff; border-radius: 8px; cursor: pointer; }
button:hover { opacity: .9; }
.table-wrapper { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid #eee; padding: 8px; text-align: left; }
.error { margin-top: 12px; color: #b91c1c; }

.charts-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 0.5cm;
    margin: 20px 0;
    flex-wrap: wrap;
}

.chart-item {
    flex: 0 0 auto;
    max-width: 45%;
}
.chart-item img {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
}

.download-section {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
}

.download-button {
    width: 210px;
    height: 40px;
    background: #3b82f6;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    border: 1px solid #3b82f6;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 22px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Times New Roman';
    font-weight: bold;
}
.download-button:hover {
    background-color: white;
    color: #3b82f6;
    border: 2px solid #3b82f6;
}

@media (max-width: 768px) {
    .charts-container {
        flex-direction: column;
        gap: 20px;
    }
    
    .chart-item {
        max-width: 100%;
    }
}

.form-group {
    margin-bottom: 20px;
    width: 100%;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.fasta-input {
    width: 10cm;
    height: 5cm;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 12px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    resize: none;
    overflow-y: auto;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-modal {
    width: 15cm;
    height: 7.5cm;
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.loading-text {
    font-family: 'Times New Roman', serif !important;
    font-size: 24px !important;
    font-weight: bold !important;
    color: #374151;
    margin-bottom: 20px;
    line-height: 1.5;
}

.loading-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #f3f4f6;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    gap: 10px;
    font-family: 'Times New Roman', serif !important;
    font-size: 18px !important;
    font-weight: bold !important;
}

.pagination-button {
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #374151;
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    font-family: 'Times New Roman', serif !important;
    font-weight: bold !important;
    transition: all 0.2s;
}
.pagination-button:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}
.pagination-button:disabled {
    background: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
}
.pagination-button.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.page-input {
    width: 50px;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    text-align: center;
    font-size: 18px;
    font-family: 'Times New Roman', serif !important;
    font-weight: normal !important;
}

.pagination-info {
    font-size: 18px;
    font-family: 'Times New Roman', serif !important;
    font-weight: bold !important;
    color: #6b7280;
}

.results-table {
    margin-bottom: 0;
}

.results-container {
    margin-top: 10px;
}

.disabled-pagination {
    background-color: #f3f4f6 !important;
    color: #9ca3af !important;
    cursor: not-allowed !important;
    border-color: #e5e7eb !important;
    font-family: 'Times New Roman', serif !important;
    font-size: 18px !important;
    font-weight: bold !important;
}
.disabled-pagination:hover {
    background-color: #f3f4f6 !important;
    opacity: 1 !important;
}

input.disabled-pagination {
    background-color: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
    font-family: 'Times New Roman', serif !important;
    font-size: 18px !important;
    font-weight: normal !important;
}

.pagination-button.disabled-pagination {
    pointer-events: none;
}

.form-group label {
    font-family: 'Times New Roman', sans-serif !important;
    font-size: 22px !important;
    font-weight: bold !important;
}

select {
    font-family: 'Times New Roman', serif !important;
    font-size: 16px !important;
    font-weight: normal !important;
    padding: 5px;
    width: 100% !important;
}

.fasta-input {
    font-family: 'Times New Roman', monospace !important;
    font-size: 20px !important;
    width: 100% !important;
    height: 6cm !important;
    resize: both;
}

#predict-button {
    font-family: 'Times New Roman', sans-serif !important;
    font-size: 22px !important;
    font-weight: bold !important;
    background: #3b82f6;
    color: white;
    border: 1px solid #3b82f6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
}
#predict-button:hover {
    background-color: white;
    color: #3b82f6;
    border: 2px solid #3b82f6;
}

.card {
    width: 100%;
    max-width: 1200px;
    margin-bottom: 0.5cm;
}

#prediction-form.card,
.results-container .card {
    width: 100%;
    max-width: 1200px;
    margin-top: 20px;
}

.results-container h2 {
    font-family: 'Times New Roman', serif !important;
    font-size: 24px !important;
    font-weight: bold !important;
    padding: 0 !important;
    line-height: 1.2;
    margin-top: 0px !important;
    margin-bottom: 10px !important;
}

.table-wrapper {
    margin-top: 10px;
}

.results-container table {
    font-size: 16px !important;
    font-weight: normal !important;
}
.results-container th {
    font-weight: bold !important;
    text-align: center !important;
}
.results-container td {
    font-weight: normal !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
    text-align: center;
}

.results-container td:nth-child(4) {
    max-width: 300px;
}

.form-group input[type="file"] {
    font-family: 'Times New Roman', serif !important;
    font-size: 18px !important;
    font-weight: normal !important;
}

.custom-file-upload {
    position: relative;
    display: inline-block;
}
.custom-file-upload input[type="file"] {
    position: absolute;
    left: -9999px;
    opacity: 0;
}
.custom-file-upload .file-upload-btn {
    display: inline-block;
    padding: 8px 16px;
    background: #f8f9fa;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Times New Roman', serif !important;
    font-size: 18px !important;
    font-weight: normal !important;
    color: #374151;
    transition: all 0.2s;
}
.custom-file-upload .file-upload-btn:hover {
    background: #e9ecef;
    border-color: #9ca3af;
}

.file-name-display {
    margin-left: 10px;
    font-family: 'Times New Roman', serif !important;
    font-size: 18px !important;
    color: #6b7280;
    font-style: italic;
}

.chart-selector-container {
    margin-bottom: 30px;
    text-align: center;
}

.chart-buttons-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.chart-button {
    padding: 8px 16px;
    background-color: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Times New Roman', serif !important;
    font-size: 18px !important;
    font-weight: bold !important;
    color: #374151;
    transition: all 0.2s;
    min-width: 120px;
}

.chart-button:hover {
    background-color: #e5e7eb;
    border-color: #9ca3af;
}

.chart-button.active {
    background-color: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.chart-container {
    display: none;
    margin-bottom: 30px;
}

.chart-container.active {
    display: block;
}

.chart-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .chart-row {
        flex-direction: column;
    }
}

.chart-item {
    flex: 1;
    text-align: center;
}

.chart-item img {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
    max-width: 100%;
    height: auto;
}

.chart-title {
    margin-bottom: 10px;
    font-family: 'Times New Roman', serif;
    font-size: 18px;
    font-weight: bold;
    color: #6b7280;
}

/* 新增的多选下拉框样式 */
.multi-select-container {
    position: relative;
    width: 100%;
}

.multi-select-display {
    min-height: 45px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    transition: border-color 0.2s;
}

.multi-select-display:hover {
    border-color: #9ca3af;
}

.selected-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #edf2fa;
    border: 1px solid #edf2fa;
    border-radius: 6px;
    font-family: 'Times New Roman', serif;
    font-size: 18px;
    color: #374151;
    white-space: nowrap;
    line-height: 1.4;
}

.remove-tag {
    color: #3b82f6;
    font-family: 'Times New Roman';
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 0 2px;
    transition: color 0.2s;
    margin-left: 2px;
}

.remove-tag:hover {
    color: #ef4444;
}

.select-arrow {
    margin-left: auto;
    color: #6b7280;
    font-size: 12px;
    user-select: none;
    padding-left: 8px;
}

.multi-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 320px;
    overflow-y: auto;
}

.dropdown-option {
    padding: 10px 16px;
    font-family: 'Times New Roman', serif;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dropdown-option:hover {
    background-color: #f3f4f6;
}

.dropdown-option.select-all-option {
    border-bottom: 2px solid #e5e7eb;
    font-weight: bold;
    color: #3b82f6;
    background-color: #f9fafb;
}

.dropdown-option.select-all-option:hover {
    background-color: #eff6ff;
}

.dropdown-option[data-selected="true"] {
    background-color: #eff6ff;
}

.dropdown-option[data-selected="true"]:hover {
    background-color: #dbeafe;
}

.option-checkbox {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    color: white;
    flex-shrink: 0;
}

.dropdown-option[data-selected="true"] .option-checkbox {
    background-color: #3b82f6;
    border-color: #3b82f6;
}

.warning-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.warning-modal-box {
    width: 450px;
    background: white;
    border-radius: 12px;
    padding: 40px 30px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.warning-icon-large {
    font-size: 48px;
    line-height: 1;
}

.warning-message {
    font-family: 'Times New Roman', serif;
    font-size: 28px;
    font-weight: normal;
    color: #374151;
    line-height: 1.6;
}

.warning-ok-button {
    padding: 10px 40px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    font-family: 'Times New Roman', serif;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.warning-ok-button:hover {
    background-color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

select[name="ptm_type"] {
    display: none;
}

/* 按钮容器样式 */
.button-container {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-top: 20px;
    white-space: nowrap;
    gap: 10px;
}

#example-button,
#reset-button {
    font-family: 'Times New Roman', sans-serif !important;
    font-size: 22px !important;
    font-weight: bold !important;
    background: #3b82f6;
    color: white;
    border: 1px solid #3b82f6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100px;
    height: 40px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 0;
}

#example-button:hover,
#reset-button:hover {
    background-color: white;
    color: #3b82f6;
    border: 2px solid #3b82f6;
}

#predict-button {
    font-family: 'Times New Roman', sans-serif !important;
    font-size: 22px !important;
    font-weight: bold !important;
    background: #3b82f6;
    color: white;
    border: 1px solid #3b82f6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100px;
    height: 40px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    margin: 0;
}

#predict-button:hover {
    background-color: white;
    color: #3b82f6;
    border: 2px solid #3b82f6;
}

@media (max-width: 768px) {
    .warning-modal-box {
        width: 90%;
        max-width: 400px;
        padding: 30px 20px;
    }
    
    .warning-message {
        font-size: 18px;
    }
}

/* 图表选择按钮样式 - 使用缩写，更紧凑 */
.chart-selector-button {
    font-family: 'Times New Roman', sans-serif !important;
    font-size: 18px !important;
    font-weight: bold !important;
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;  /* 减小最小宽度以适应缩写 */
    height: 40px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 0 12px;  /* 减小内边距 */
}

.chart-selector-button:hover {
    background-color: #e5e7eb;
    border-color: #9ca3af;
}

.chart-selector-button.active {
    background-color: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.chart-selector-button.active:hover {
    background-color: #2563eb;
    border-color: #2563eb;
}

/* 图表容器样式保持不变 */
.charts-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 0.5cm;
    margin: 20px 0;
    flex-wrap: wrap;
}

.chart-item {
    flex: 0 0 auto;
    max-width: 45%;
}

@media (max-width: 768px) {
    .charts-container {
        flex-direction: column;
        gap: 20px;
    }
    
    .chart-item {
        max-width: 100%;
    }
    
    #chart-buttons-wrapper {
        gap: 8px;  /* 移动端稍微减小间距 */
    }
    
    .chart-selector-button {
        min-width: 70px;  /* 移动端进一步减小宽度 */
        font-size: 16px !important;
    }
}

/* 确保按钮容器可以一行显示所有按钮 */
#chart-buttons-wrapper {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    max-width: 100%;
}

/* 蛋白质可视化区域的样式优化 */
#sequence-container {
    width: 950px !important;  /* 固定宽度而不是max-width */
    min-height: 80px !important;
    height: auto !important;
    overflow-x: auto;
    white-space: nowrap;
}

#protein-id-box {
    width: 950px !important;  /* 固定宽度而不是max-width */
    overflow-x: auto;
    white-space: nowrap;
}

/* 序列显示区域样式优化 */
#sequence-display {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
}

.amino-acid-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 2px;
    margin-bottom: 2px;
}

.amino-acid-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 20px;
}

.amino-acid {
    font-family: 'Times New Roman', serif;
    font-size: 16px;
    font-weight: bold;
    padding: 2px 4px;
    border-radius: 3px;
    text-align: center;
    min-width: 16px;
    transition: all 0.2s ease;
}

.amino-acid:hover {
    transform: scale(1.1);
    z-index: 10;
}

/* 修复position-label样式 - 使用!important确保优先级 */
.position-label {
    font-family: Arial, sans-serif !important;
    font-size: 10px !important;
    color: #6b7280 !important;
    font-weight: normal !important;
    margin-top: 2px !important;
    text-align: center !important;
    min-width: 20px !important;
    line-height: 1.2 !important;
}

/* 置信度颜色定义 */
.confidence-non-ptm { background-color: #faecd3; color: #333333; }
.confidence-low { background-color: #d1f7eb; color: #333333; }
.confidence-medium { background-color: #cbe6ff; color: #333333; }
.confidence-high { background-color: #ffc4d3; color: #333333; }
.confidence-extremely-high { background-color: #ffa2a6; color: #333333; }
.confidence-none { background-color: transparent; color: #000000; }

/* 蛋白质标识符样式 */
#protein-id-text {
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: normal;
    white-space: nowrap;
    overflow-x: auto;
}

/* 滚动条样式优化 */
#sequence-container::-webkit-scrollbar,
#protein-id-box::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

#sequence-container::-webkit-scrollbar-track,
#protein-id-box::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#sequence-container::-webkit-scrollbar-thumb,
#protein-id-box::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

#sequence-container::-webkit-scrollbar-thumb:hover,
#protein-id-box::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 确保父容器不会限制宽度 */
.protein-id-container,
.protein-sequence-container {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    font-family: 'Times New Roman', serif;
    font-size: 18px;
    font-weight: bold;
    color: #374151;
}

/* Peptide列样式 - 确保等宽对齐 */
.peptide-cell {
    font-family: 'Courier New', Consolas, monospace !important;
    font-size: 19px !important;
    white-space: nowrap !important;
    min-width: 250px !important;
    max-width: 250px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    text-align: center !important;
}

/* 中心氨基酸基础样式 */
.center-residue {
    font-weight: bold !important;
    color: #333333 !important; /* 深色文本，确保在各种背景色下可见 */
    padding: 1px 3px !important;
    border-radius: 3px !important;
    display: inline-block !important;
    min-width: 16px !important;
    text-align: center !important;
}

/* 确保肽段文本显示正确 */
.peptide-text {
    font-family: 'Courier New', Consolas, monospace !important;
    font-size: 19px !important;
    letter-spacing: 0.5px !important;
}

/* 确保表格列宽一致 */
.results-table {
    table-layout: fixed !important;
    width: 100% !important;
}

.results-table th:nth-child(5),
.results-table td:nth-child(5) {
    width: 250px !important;
    min-width: 250px !important;
    max-width: 250px !important;
}

/* 蛋白质按钮容器 - 一行最多5个按钮 */
#protein-buttons-wrapper {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    max-width: 1000px; /* 5个按钮的宽度总和 (190*5 + 间隙) */
    margin: 0 auto;
}
/* 蛋白质按钮样式 - 固定宽度，确保一行最多5个 */
#protein-buttons-wrapper .chart-selector-button {
    width: 180px;  /* 根据实际内容调整 */
    flex: 0 0 auto;
}