:root {
    --china: #d9534f;
    --world: #5bc0de;
    --bg: #f9f7f2;
    --text: #333;
    --card: #fff;
    --shadow: rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

header {
    text-align: center;
    padding: 2rem 1rem 1rem;
    background: linear-gradient(180deg, #fff 0%, var(--bg) 100%);
}

h1 {
    margin: 0 0 0.5rem;
    font-size: 1.8rem;
}

.intro {
    max-width: 700px;
    margin: 0 auto 1rem;
    color: #666;
}

.legend {
    display: inline-flex;
    align-items: center;
    gap: 1.25rem;
    font-size: 0.95rem;
}

.legend-line {
    width: 36px;
    height: 5px;
    border-radius: 3px;
    display: inline-block;
    vertical-align: middle;
}

.legend-line.china { background: var(--china); }
.legend-line.world { background: var(--world); }

main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1rem;
}

.timeline-section {
    background: var(--card);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px var(--shadow);
}

.timeline-section h2 {
    margin: 0 0 0.25rem;
    font-size: 1.25rem;
    color: #444;
}

.hint {
    margin: 0 0 1rem;
    font-size: 0.85rem;
    color: #888;
}

.timeline-wrapper {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.snake-timeline {
    flex: 1;
    overflow-x: auto;
}

.snake-timeline svg {
    display: block;
    width: 100%;
    height: auto;
    min-width: 1000px;
    user-select: none;
}

.timeline-path {
    fill: none;
    stroke-width: 5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.timeline-path.china { stroke: var(--china); }
.timeline-path.world { stroke: var(--world); }

.event-node {
    cursor: pointer;
    transition: transform 0.15s ease;
}

.event-node:hover {
    transform: scale(1.25);
}

.event-node circle {
    stroke: #fff;
    stroke-width: 2;
}

.event-node.china circle { fill: var(--china); }
.event-node.world circle { fill: var(--world); }

.event-label {
    font-size: 12px;
    fill: #444;
    text-anchor: middle;
    pointer-events: none;
}

.event-year {
    font-size: 10px;
    fill: #888;
    text-anchor: middle;
    pointer-events: none;
}

.event-period {
    font-size: 9px;
    fill: #999;
    text-anchor: middle;
    pointer-events: none;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    justify-content: center;
    align-items: center;
    z-index: 10;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card);
    border-radius: 12px;
    max-width: 420px;
    width: 100%;
    padding: 1.5rem;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.modal-content h3 {
    margin: 0 0 0.5rem;
    font-size: 1.2rem;
}

#modal-year {
    margin: 0 0 0.75rem;
    color: #888;
    font-size: 0.9rem;
}

#modal-desc {
    margin: 0;
    color: #444;
}

.close {
    position: absolute;
    top: 0.75rem;
    right: 0.9rem;
    border: none;
    background: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
}

footer {
    text-align: center;
    padding: 1rem;
    color: #999;
    font-size: 0.85rem;
}
