/* ── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: "PingFang SC", "PingFang HK", "Heiti SC", "Heiti TC", "STHeiti",
                 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background: #f5f0eb;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: #5c6bc0; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navbar ───────────────────────────────────────────── */
.navbar {
    background: #3e2723;
    color: #fff;
    padding: 10px 24px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: baseline;
    gap: 16px;
    flex-wrap: wrap;
}
.nav-brand {
    font-size: 1.5em;
    font-weight: 700;
    color: #ffcc80;
    letter-spacing: 0.5px;
}
.nav-brand:hover { text-decoration: none; color: #ffb74d; }
.nav-subtitle { font-size: 0.85em; color: #bcaaa4; }
.nav-count { margin-left: auto; font-size: 0.8em; color: #8d6e63; }

/* ── Search Bar ───────────────────────────────────────── */
.search-bar {
    max-width: 1200px;
    margin: 16px auto 0;
    padding: 0 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.search-input {
    flex: 1;
    min-width: 200px;
    padding: 8px 14px;
    border: 1px solid #bcaaa4;
    border-radius: 4px;
    font-size: 1em;
    font-family: inherit;
    background: #fff;
}
.search-input:focus { outline: none; border-color: #5c6bc0; box-shadow: 0 0 0 2px rgba(92,107,192,0.2); }
.search-btn {
    padding: 8px 18px;
    background: #5c6bc0;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95em;
    font-family: inherit;
}
.search-btn:hover { background: #3f51b5; }
.filter-toggle {
    padding: 8px 18px;
    background: #efebe9;
    color: #5d4037;
    border: 1px solid #bcaaa4;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95em;
    font-family: inherit;
}
.filter-toggle:hover { background: #d7ccc8; }

/* ── Filter Panel ─────────────────────────────────────── */
.filter-panel {
    width: 100%;
    background: #fff;
    border: 1px solid #d7ccc8;
    border-radius: 4px;
    padding: 12px 16px;
    margin-top: 4px;
}
.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
    align-items: center;
    margin-bottom: 8px;
}
.filter-row:last-child { margin-bottom: 0; }
.filter-row label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.9em;
    color: #5d4037;
}
.filter-num {
    width: 80px;
    padding: 4px 6px;
    border: 1px solid #bcaaa4;
    border-radius: 3px;
    font-family: inherit;
    font-size: 0.9em;
}
.filter-sep { margin: 0 2px; color: #8d6e63; }
.filter-select {
    padding: 4px 6px;
    border: 1px solid #bcaaa4;
    border-radius: 3px;
    font-family: inherit;
    font-size: 0.9em;
    max-width: 280px;
}
.filter-clear {
    font-size: 0.85em;
    color: #8d6e63;
    margin-left: 8px;
}

/* ── Content ──────────────────────────────────────────── */
.content {
    max-width: 1200px;
    width: 100%;
    margin: 16px auto;
    padding: 0 24px;
    flex: 1;
}

/* ── Pagination ───────────────────────────────────────── */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 20px 0;
    flex-wrap: wrap;
}
.page-link, .page-current, .page-ellipsis {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid #d7ccc8;
    border-radius: 3px;
    font-size: 0.9em;
    background: #fff;
}
.page-link:hover { background: #efebe9; text-decoration: none; }
.page-current {
    background: #5c6bc0;
    color: #fff;
    border-color: #5c6bc0;
    font-weight: 600;
}
.page-ellipsis { border: none; background: none; color: #8d6e63; }
.page-info { font-size: 0.85em; color: #8d6e63; margin-left: 12px; }

/* ── Results Table ────────────────────────────────────── */
.results-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.results-table th {
    background: #5d4037;
    color: #fff;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85em;
    white-space: nowrap;
}
.results-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #efebe9;
    font-size: 0.9em;
}
.results-table tr:hover { background: #faf7f4; }
.results-table .id-col { font-family: monospace; font-weight: 600; width: 80px; }
.results-table .title-col { max-width: 500px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results-table .num-col { text-align: right; width: 80px; }
.results-table .method-col { font-size: 0.8em; color: #5d4037; white-space: nowrap; }

.quality-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
}
.quality-excellent { background: #c8e6c9; color: #1b5e20; }
.quality-good { background: #b3e5fc; color: #01579b; }
.quality-reasonable { background: #fff9c4; color: #827717; }
.quality-suspicious { background: #ffcdd2; color: #b71c1c; }

.no-results {
    text-align: center;
    padding: 40px 20px;
    color: #8d6e63;
    font-size: 1.1em;
}

/* ── Detail Page ──────────────────────────────────────── */
.detail-header {
    background: #fff;
    border-radius: 4px;
    padding: 20px 24px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.detail-header h1 {
    font-size: 1.4em;
    color: #3e2723;
    margin-bottom: 8px;
}
.detail-header .entry-id {
    font-family: monospace;
    font-size: 1.1em;
    color: #5c6bc0;
    font-weight: 600;
}
.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    font-size: 0.85em;
    color: #6d4c41;
    margin-top: 8px;
}
.detail-meta span { white-space: nowrap; }

/* ── Plot Row ─────────────────────────────────────────── */
.plot-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}
.plot-box {
    flex: 1;
    background: #fff;
    border-radius: 4px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    text-align: center;
}
.plot-box h3 {
    font-size: 0.9em;
    color: #5d4037;
    margin-bottom: 8px;
    font-weight: 600;
}
.plot-box img {
    max-width: 100%;
    height: auto;
    max-height: 350px;
    border-radius: 2px;
}
.plot-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #bcaaa4;
    font-size: 0.9em;
    background: #faf7f4;
    border-radius: 4px;
}

/* ── Collapsible Sections ─────────────────────────────── */
.section {
    background: #fff;
    border-radius: 4px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    overflow: hidden;
}
.section-header {
    padding: 12px 20px;
    cursor: pointer;
    background: #faf7f4;
    border-bottom: 1px solid #efebe9;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}
.section-header:hover { background: #efebe9; }
.section-header h2 {
    font-size: 1em;
    color: #3e2723;
    flex: 1;
}
.section-icon {
    font-size: 0.7em;
    color: #8d6e63;
}
.section-body {
    padding: 16px 20px;
}

/* ── KV Table ─────────────────────────────────────────── */
.kv-table {
    width: 100%;
    border-collapse: collapse;
}
.kv-table td {
    padding: 6px 12px;
    border-bottom: 1px solid #f5f0eb;
    font-size: 0.88em;
    vertical-align: top;
}
.kv-table .kv-key {
    width: 200px;
    color: #6d4c41;
    font-weight: 600;
    white-space: nowrap;
    font-family: monospace;
    font-size: 0.82em;
}
.kv-table .kv-val {
    word-break: break-all;
    max-width: 600px;
}
.kv-table .kv-unit {
    color: #8d6e63;
    font-size: 0.85em;
    margin-left: 4px;
}
.kv-table tr:last-child td { border-bottom: none; }

.text-truncate {
    display: block;
    max-height: 3em;
    overflow: hidden;
    position: relative;
}

/* ── Entity Cards ─────────────────────────────────────── */
.entity-card {
    border: 1px solid #efebe9;
    border-radius: 4px;
    padding: 12px 16px;
    margin-bottom: 12px;
}
.entity-card:last-child { margin-bottom: 0; }
.entity-card h3 {
    font-size: 0.95em;
    color: #5d4037;
    margin-bottom: 8px;
}
.entity-type {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 3px;
    background: #efebe9;
    font-size: 0.8em;
    color: #5d4037;
    margin-left: 8px;
}

.seq-box {
    font-family: monospace;
    font-size: 0.78em;
    background: #faf7f4;
    padding: 8px;
    border-radius: 3px;
    max-height: 120px;
    overflow-y: auto;
    word-break: break-all;
    line-height: 1.5;
}

/* ── Citation Cards ───────────────────────────────────── */
.cite-card {
    padding: 10px 0;
    border-bottom: 1px solid #efebe9;
    font-size: 0.88em;
}
.cite-card:last-child { border-bottom: none; }
.cite-title { font-weight: 600; color: #3e2723; }
.cite-journal { color: #6d4c41; }
.cite-id { font-family: monospace; font-size: 0.82em; color: #8d6e63; }
.cite-primary {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    background: #c8e6c9;
    color: #1b5e20;
    font-size: 0.75em;
    font-weight: 600;
    margin-left: 6px;
}

/* ── File List ────────────────────────────────────────── */
.file-list {
    list-style: none;
    padding: 0;
}
.file-list li {
    padding: 3px 0;
    font-size: 0.82em;
    font-family: monospace;
    color: #5d4037;
    border-bottom: 1px dotted #efebe9;
}
.file-cat {
    display: inline-block;
    width: 120px;
    color: #8d6e63;
    font-size: 0.9em;
}

/* ── Back Link ────────────────────────────────────────── */
.back-link {
    display: inline-block;
    margin-bottom: 16px;
    font-size: 0.85em;
    color: #5c6bc0;
}
.back-link:hover { text-decoration: underline; }

/* ── Error Page ───────────────────────────────────────── */
.error-box {
    text-align: center;
    padding: 60px 24px;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.error-box h1 { font-size: 3em; color: #b71c1c; margin-bottom: 8px; }
.error-box p { font-size: 1.1em; color: #6d4c41; margin-bottom: 20px; }

/* ── Footer ───────────────────────────────────────────── */
.footer {
    text-align: center;
    padding: 16px 24px;
    color: #bcaaa4;
    font-size: 0.78em;
    border-top: 1px solid #efebe9;
    margin-top: 24px;
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
    .plot-row { flex-direction: column; }
    .filter-row { flex-direction: column; align-items: flex-start; }
    .kv-table .kv-key { width: 120px; }
    .results-table .title-col { max-width: 200px; }
}

/* ── Download ─────────────────────────────────────────── */

/* 导航栏下载链接 */
.nav-dl {
    margin-left: 16px;
    color: #ffcc80;
    font-size: 0.9em;
    text-decoration: none;
}
.nav-dl:hover { color: #fff; text-decoration: underline; }

/* 文件类型选择器 */
.type-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #e0d6cc;
}
.type-check {
    font-size: 0.9em;
    color: #444;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}
.type-check input { accent-color: #5c6bc0; }
.all-check { font-weight: 600; }

/* 前缀分组卡片网格 */
.prefix-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}
.prefix-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #fff;
    border: 2px solid #e0d6cc;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.prefix-card:hover { border-color: #5c6bc0; }
.prefix-card:has(input:checked) {
    border-color: #5c6bc0;
    background: #e8eaf6;
}
.prefix-card input { accent-color: #5c6bc0; width: 16px; height: 16px; }
.prefix-char {
    font-size: 1.5em;
    font-weight: 700;
    color: #3e2723;
    min-width: 28px;
    text-align: center;
}
.prefix-count { flex: 1; font-size: 0.85em; color: #666; }
.prefix-size { font-size: 0.8em; color: #999; }

/* 下载底栏 */
.download-bar {
    position: sticky;
    bottom: 0;
    background: #fff;
    border-top: 2px solid #e0d6cc;
    padding: 12px 20px;
    border-radius: 8px 8px 0 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    z-index: 100;
}
.bar-actions { margin-left: auto; display: flex; align-items: center; }
.download-btn {
    padding: 8px 24px;
    background: #5c6bc0;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 0.95em;
    cursor: pointer;
}
.download-btn:hover { background: #3f51b5; }
.download-btn:disabled { background: #ccc; cursor: not-allowed; }

/* 详情页下载面板 */
.download-panel {
    padding: 8px 0;
}
.download-panel .dl-types {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
}
