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

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    overflow: hidden;
    min-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
}

.left-panel {
    width: 100%;
    padding: 30px;
    border-right: none;
    border-bottom: 1px solid #e1e5e9;
    background: #f8f9fa;
}

.right-panel {
    width: 100%;
    padding: 30px;
    background: white;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.panel-title {
    font-size: 24px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 25px;
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 3px solid #3498db;
}

.section {
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.section-title {
    font-size: 18px;
    font-weight: bold;
    color: #34495e;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.section-title.with-toggle {
    justify-content: space-between;
}

.section-title::before {
    content: "■";
    color: #3498db;
    margin-right: 8px;
}

.file-upload {
    border: 2px dashed #3498db;
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.file-upload:hover {
    border-color: #2980b9;
    background: #ecf0f1;
}

.file-upload.dragover {
    border-color: #27ae60;
    background: #d5f4e6;
}

.upload-icon {
    font-size: 48px;
    color: #3498db;
    margin-bottom: 15px;
}

.upload-text {
    font-size: 16px;
    color: #7f8c8d;
    margin-bottom: 15px;
}

.file-input {
    display: none;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #229954;
    transform: translateY(-2px);
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

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

.btn-secondary:hover {
    background: #7f8c8d;
}

.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #2c3e50;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #bdc3c7;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

.form-row {
    display: flex;
    gap: 16px;
    align-items: end;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.rule-item {
    border: 1px solid #ecf0f1;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    background: #fdfdfd;
}

.rule-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ecf0f1;
}

.tier-item {
    border: 1px solid #e1e5e9;
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 10px;
    background: white;
}

.tier-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr auto;
    gap: 8px;
    align-items: center;
}

.alert {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    border-left: 4px solid;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-color: #27ae60;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border-color: #e74c3c;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-color: #3498db;
}

.upload-status {
    margin-top: 15px;
    padding: 10px;
    border-radius: 5px;
    font-size: 14px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
}

.table th {
    background: #f8f9fa;
    font-weight: bold;
    color: #2c3e50;
}

.table tr:hover {
    background: #f8f9fa;
}

.table td {
    font-size: 13px;
}

#top50Table {
    font-size: 12px;
}

#top50Table th,
#top50Table td {
    padding: 8px;
    text-align: center;
    white-space: nowrap;
}

#top50Table th {
    background: #e8f4f8;
    font-size: 12px;
}

#top50Table td {
    font-size: 11px;
}

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

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #ecf0f1;
    border-radius: 8px;
    background: white;
}

.export-buttons {
    display: flex;
    gap: 10px;
}

.loading {
    display: none;
    text-align: center;
    padding: 20px;
    color: #7f8c8d;
}

.loading.show {
    display: block;
}

.spinner {
    border: 4px solid #ecf0f1;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

.batch-info {
    background: #e8f4f8;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #3498db;
}

/* 导出图片专用样式 */
.export-container {
    position: fixed;
    left: -99999px; /* 屏外隐藏，仅用于渲染 */
    top: 0;
    width: 1200px; /* 导出宽度 */
    background: #ffffff;
    color: #222;
    padding: 20px;
    border: 1px solid #e1e5e9;
}

.export-title {
    background: #ffeb3b;
    color: #b71c1c;
    font-weight: bold;
    font-size: 32px; /* 标题更大一些 */
    text-align: center;
    padding: 12px 10px;
    border: 2px solid #f0c000;
    margin-bottom: 12px;
}

.export-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto; /* 让列宽可自适应 */
    font-size: 14px;
}

.export-table th,
.export-table td {
    border: 1px solid #999;
    padding: 6px 8px;
    text-align: center;
    white-space: nowrap; /* 避免换行影响列宽测量 */
}

.export-table thead th {
    background: #d9ead3;
    font-weight: 800;
    font-size: 16px;
}

.section-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.hidden {
    display: none;
}

/* 折叠区域 */
.collapsible.collapsed #rulesSectionBody {
    display: none;
}

/* 调整小屏布局与输入行自适应 */
@media (max-width: 1200px) {
    .left-panel { width: 100%; }
    .right-panel { width: 100%; }
}

@media (max-width: 768px) {
    .tier-row {
        grid-template-columns: 1fr;
        gap: 5px;
    }
    .table-wrapper { overflow-x: auto; }
}
