* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    min-height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: #ffffff;
    color: #2c3e50;
    line-height: 1.6;
}

.container {
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
    min-height: 100vh;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
}

.content {
    flex: 1;
    padding-bottom: 60px;
    animation: fadeIn 0.5s ease;
}

.back-link {
    margin-bottom: 28px;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    color: #666;
    text-decoration: none;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.back-btn:hover {
    color: #2c3e50;
    border-color: #2c3e50;
    transform: translateX(-3px);
}

.seal-section {
    animation: fadeInUp 0.55s ease;
}

.hero-card {
    margin-bottom: 18px;
}

.page-title {
    font-size: 42px;
    font-weight: 300;
    letter-spacing: 2px;
    margin-bottom: 12px;
    color: #1a1a1a;
}

.page-subtitle {
    font-size: 16px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 300;
}

.legend-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    border-radius: 999px;
    height: 24px;
    padding: 0 10px;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
    flex: 0 0 auto;
    border: 1px solid #d5dce4;
    background: #f7f9fb;
    color: #425465;
}

.legend-item.mainline {
    border-color: #bfcada;
    background: #edf2f8;
    color: #3f566e;
}

.legend-item.dispute {
    border-color: #edcd9c;
    background: #fff4e4;
    color: #9d6212;
}

.legend-item.rumor {
    border-color: #d9cfbf;
    background: #f8f4ed;
    color: #6b5d4d;
}

.timeline-wrapper {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.timeline-showcase,
.summary-panel,
.detail-panel {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 10px;
}

.timeline-showcase {
    position: relative;
    height: var(--timeline-showcase-height, auto);
}

.timeline-view {
    padding: 14px 16px 12px;
    min-height: 560px;
}

.metro-legend-row {
    display: flex;
    justify-content: flex-end;
    margin: 0 2px 6px;
}

.metro-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
}

.metro-scroll::-webkit-scrollbar {
    height: 8px;
}

.metro-scroll::-webkit-scrollbar-thumb {
    background: #c8ced6;
    border-radius: 999px;
}

.metro-list {
    position: relative;
    display: flex;
    align-items: center;
    gap: 30px;
    padding: 218px 22px 218px;
    min-width: max-content;
}

.metro-list::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 2px;
    transform: translateY(-50%);
    background: linear-gradient(90deg, #6f8195, #9fb0c0);
}

.metro-item {
    position: relative;
    background: transparent;
    border: none;
    min-width: 148px;
    height: 196px;
    cursor: pointer;
    color: inherit;
}

.metro-item.branch-placeholder {
    min-width: 72px;
}

.metro-item.branch-placeholder .metro-label {
    display: none;
}

.metro-item.branch-placeholder .metro-title,
.metro-item.branch-placeholder .metro-year,
.metro-item.branch-placeholder .metro-meta-row {
    display: none;
}

.metro-item.split-point .metro-dot {
    box-shadow: 0 0 0 4px rgba(44, 62, 80, 0.26);
}

.metro-item.side-up {
    padding-top: 0;
}

.metro-item.side-down {
    padding-top: 0;
}

.metro-label {
    --label-min-height: 60px;
    --label-gap: 14px;
    position: relative;
    z-index: 1;
    border: 1px solid #dce3ea;
    border-radius: 8px;
    background: #ffffff;
    padding: 8px;
    width: 100%;
    min-height: var(--label-min-height);
    text-align: left;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.metro-item.side-up .metro-label {
    position: absolute;
    bottom: calc(50% + var(--label-gap));
    left: 0;
}

.metro-item.side-down .metro-label {
    position: absolute;
    top: calc(50% + var(--label-gap));
    left: 0;
}

.metro-item.is-branch .metro-dot {
    top: calc(50% + var(--track-offset));
}

.metro-item.is-branch {
    --branch-label-gap: 12px;
}

.metro-item.is-branch .metro-label {
    position: absolute;
    left: 0;
}

.metro-item.is-branch.branch-up .metro-label {
    top: calc(50% + var(--track-offset) + var(--branch-label-gap));
}

.metro-item.is-branch.branch-down .metro-label {
    bottom: calc(50% - var(--track-offset) + var(--branch-label-gap));
}

.branch-guide-layer {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    pointer-events: none;
}

.branch-guide {
    position: absolute;
    right: 0;
    height: 1px;
    opacity: 0.5;
}

.branch-vertical {
    position: absolute;
    width: 1px;
    opacity: 0.45;
}

.branch-joint {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.branch-guide.branch-north {
    border-top: 1px dashed #7d8fa4;
}

.branch-vertical.branch-north {
    border-left: 1px dashed #7d8fa4;
}

.branch-joint.branch-north {
    background: #7d8fa4;
}

.branch-guide.branch-south {
    border-top: 1px dashed #d2a762;
}

.branch-vertical.branch-south {
    border-left: 1px dashed #d2a762;
}

.branch-joint.branch-south {
    background: #d2a762;
}

.branch-guide.branch-rumor {
    border-top: 1px dashed #9a8d7f;
}

.branch-vertical.branch-rumor {
    border-left: 1px dashed #9a8d7f;
}

.branch-joint.branch-rumor {
    background: #9a8d7f;
}

.metro-year {
    font-size: 12px;
    color: #5f7388;
}

.metro-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.lineage-badge,
.lineage-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid #d2dae3;
    background: #f4f7fa;
    color: #445768;
    font-weight: 600;
    line-height: 1;
}

.lineage-badge {
    min-width: 28px;
    height: 18px;
    padding: 0 6px;
    font-size: 11px;
}

.lineage-chip {
    height: 22px;
    padding: 0 9px;
    font-size: 12px;
}

.lineage-a {
    border-color: #b7c7df;
    background: #eaf1fb;
    color: #35537d;
}

.lineage-b {
    border-color: #d2c2e3;
    background: #f3ecfa;
    color: #6f4f92;
}

.lineage-c {
    border-color: #c4d8c0;
    background: #edf7eb;
    color: #3f6f46;
}

.lineage-d {
    border-color: #e0cb9d;
    background: #fbf3e5;
    color: #906525;
}

.lineage-multi {
    border-color: #d2d8df;
    background: #f5f7f9;
    color: #4d5f70;
}

.metro-title {
    font-size: 13px;
    color: #2c3e50;
    margin-top: 2px;
    word-break: break-word;
}

.metro-dot {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 14px;
    height: 14px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 3px solid #f8f9fa;
    background: #4f6276;
    box-shadow: 0 0 0 3px rgba(79, 98, 118, 0.15);
    z-index: 2;
}

.metro-item.status-mainline .metro-dot {
    background: #4f6276;
    box-shadow: 0 0 0 3px rgba(79, 98, 118, 0.15);
}

.metro-item.status-controversy .metro-dot {
    background: #c67a13;
    box-shadow: 0 0 0 3px rgba(198, 122, 19, 0.2);
}

.metro-item.status-rumor .metro-dot {
    background: #7a6853;
    box-shadow: 0 0 0 3px rgba(122, 104, 83, 0.18);
}

.metro-item.status-mainline .metro-label {
    border-color: #c8d2df;
}

.metro-item.status-controversy .metro-label {
    border-color: #f0d3ab;
    background: #fffaf2;
}

.metro-item.status-rumor .metro-label {
    border-color: #ddd2c3;
    background: #fdfbf8;
}

.metro-item.active .metro-label {
    border-color: #2c3e50;
    box-shadow: 0 8px 18px rgba(44, 62, 80, 0.1);
}

.metro-item.active .metro-dot {
    width: 16px;
    height: 16px;
    box-shadow: 0 0 0 4px rgba(44, 62, 80, 0.2);
}

.summary-panel,
.detail-panel {
    padding: 14px 16px;
}

.empty-tip {
    color: #7b8a99;
    font-size: 14px;
}

.summary-header {
    margin-bottom: 8px;
}

.summary-title {
    font-size: 20px;
    color: #1a1a1a;
    margin: 6px 0 4px;
}

.summary-text {
    color: #56626e;
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.year {
    color: #5f7388;
    font-size: 13px;
}

.status-chip,
.confidence-chip,
.type-chip,
.tag {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 12px;
    line-height: 1.6;
}

.status-chip {
    border: 1px solid #d5dce4;
    color: #425465;
    background: #f4f7fa;
}

.type-chip {
    border: 1px solid #d5dce4;
    color: #5b6b79;
    background: #f4f7fa;
}

.confidence-chip[data-confidence='高'] {
    color: #fff;
    background: #2e7d4f;
}

.confidence-chip[data-confidence='中'] {
    color: #fff;
    background: #9f7b2f;
}

.confidence-chip[data-confidence='低'] {
    color: #fff;
    background: #934646;
}

.expand-btn {
    margin-top: 10px;
    border: 1px solid #d3dbe4;
    background: #ffffff;
    color: #2c3e50;
    border-radius: 6px;
    padding: 7px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.expand-btn:hover {
    border-color: #2c3e50;
}

.hidden {
    display: none;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.detail-box {
    background: #ffffff;
    border: 1px solid #e1e7ee;
    border-radius: 8px;
    padding: 10px;
}

.detail-box h4 {
    font-size: 13px;
    color: #647687;
    margin-bottom: 4px;
}

.detail-box p {
    font-size: 14px;
    color: #425465;
}

.controversy {
    margin: 10px 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: #fff6f6;
    border: 1px solid #f0dede;
}

.controversy h4 {
    color: #9b4747;
    font-size: 13px;
    margin-bottom: 4px;
}

.controversy p {
    color: #724646;
    font-size: 14px;
}

.viewpoints h4 {
    color: #647687;
    font-size: 13px;
    margin-bottom: 6px;
}

.viewpoint-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.viewpoint-list li {
    border-left: 2px solid #cad4df;
    padding-left: 8px;
    color: #425465;
    font-size: 14px;
}

.tags {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    border: 1px solid #d5dce4;
    background: #f4f7fa;
    color: #506173;
}

.footer {
    text-align: center;
    padding: 20px 0;
    border-top: 1px solid #e9ecef;
    margin-top: auto;
}

.footer p {
    margin: 5px 0;
    font-size: 13px;
    color: #999;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .page-title {
        font-size: 32px;
    }

    .metro-item {
        min-width: 124px;
        height: 180px;
    }

    .timeline-view {
        min-height: 500px;
    }

    .timeline-showcase {
        height: var(--timeline-showcase-height, auto);
    }

    .metro-label {
        --label-min-height: 56px;
        --label-gap: 10px;
    }

    .lineage-chip {
        height: 20px;
        padding: 0 8px;
        font-size: 11px;
    }

    .metro-list {
        gap: 24px;
        padding-top: 188px;
        padding-bottom: 188px;
    }

    .summary-title {
        font-size: 18px;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (prefers-color-scheme: dark) {
    body {
        background: #1a1a1a;
        color: #e0e0e0;
    }

    .page-title {
        color: #ffffff;
    }

    .page-subtitle,
    .empty-tip {
        color: #9aa7b4;
    }

    .back-btn {
        color: #b7c1ca;
        border-color: #3a4652;
    }

    .back-btn:hover {
        color: #ffffff;
        border-color: #d8dde2;
    }

    .timeline-showcase,
    .summary-panel,
    .detail-panel,
    .controls-card {
        background: #232b33;
        border-color: #33404b;
    }

    .mode-switch {
        background: #2b3440;
        border-color: #3a4652;
    }

    .metro-list::before {
        background: linear-gradient(90deg, #8fa0b1, #698095);
    }

    .metro-label,
    .detail-box,
    .expand-btn {
        background: #1f2730;
        border-color: #364452;
        color: #d6dde4;
    }

    .metro-title,
    .detail-box p,
    .summary-text,
    .viewpoint-list li {
        color: #c0cad4;
    }

    .metro-year,
    .year,
    .detail-box h4,
    .viewpoints h4 {
        color: #95a5b5;
    }

    .status-chip,
    .type-chip,
    .tag,
    .lineage-badge,
    .lineage-chip {
        border-color: #3c4b59;
        background: #2c3743;
        color: #b3bfcb;
    }

    .lineage-a {
        border-color: #4a6484;
        background: #2f3f53;
        color: #b6c9df;
    }

    .lineage-b {
        border-color: #6f5a82;
        background: #3a3145;
        color: #d1c3df;
    }

    .lineage-c {
        border-color: #4f6d53;
        background: #2f4133;
        color: #bfd8c2;
    }

    .lineage-d {
        border-color: #826c44;
        background: #433a2c;
        color: #e0cfad;
    }

    .lineage-multi {
        border-color: #495968;
        background: #313a44;
        color: #c1cbd5;
    }

    .controversy {
        background: #3a2a2a;
        border-color: #664545;
    }

    .controversy h4 {
        color: #d28c8c;
    }

    .controversy p {
        color: #d4b3b3;
    }

    .footer {
        border-top-color: #33404b;
    }

    .legend-item.mainline {
        border-color: #5f7388;
        background: #2a3542;
        color: #9fb2c5;
    }

    .legend-item.dispute {
        border-color: #8e672f;
        background: #3e3224;
        color: #e5be81;
    }

    .legend-item.rumor {
        border-color: #6b635a;
        background: #312d28;
        color: #c6beb4;
    }
}
