:root {
  --bg: #f4efe6;
  --bg-paper: rgba(255, 251, 245, 0.84);
  --bg-panel: rgba(255, 252, 247, 0.92);
  --bg-soft: rgba(255, 249, 241, 0.72);
  --line: rgba(92, 74, 49, 0.18);
  --line-soft: rgba(92, 74, 49, 0.1);
  --text: #231a12;
  --muted: #7d6a58;
  --accent: #a67c52;
  --accent-deep: #7d5d3d;
  --china: #9f4b32;
  --china-soft: rgba(159, 75, 50, 0.1);
  --world: #44627d;
  --world-soft: rgba(68, 98, 125, 0.1);
  --shadow-soft: 0 22px 55px rgba(81, 61, 36, 0.07);
  --shadow-card: 0 10px 24px rgba(81, 61, 36, 0.04);
  --radius-shell: 30px;
  --radius-card: 20px;
  --max-width: 1280px;
  --font-body:
    "TsangerJinKai02", "STKaiti", "KaiTi", "Kaiti SC", "Noto Serif SC",
    "Source Han Serif SC", serif;
  --font-ui:
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at top right, rgba(214, 194, 163, 0.3), transparent 24%),
    radial-gradient(circle at left 18% bottom 16%, rgba(173, 115, 88, 0.14), transparent 26%),
    linear-gradient(180deg, #f7f1e7 0%, #f4efe6 34%, #efe7da 100%);
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

.ambient {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  border-radius: 50%;
  filter: blur(42px);
  opacity: 0.42;
}

.ambient-a {
  top: 56px;
  right: 6%;
  width: 260px;
  height: 260px;
  background: rgba(189, 150, 96, 0.18);
}

.ambient-b {
  left: 3%;
  bottom: 10%;
  width: 320px;
  height: 320px;
  background: rgba(138, 96, 73, 0.14);
}

.ambient-c {
  top: 36%;
  left: 42%;
  width: 220px;
  height: 220px;
  background: rgba(112, 132, 154, 0.11);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(calc(100% - 184px), var(--max-width));
  margin: 0 auto;
  padding: 28px 0 72px;
}

.hero,
.timeline-shell,
.rail-nav {
  position: relative;
  background: var(--bg-paper);
  border: 1px solid rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(10px);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 22px;
  padding: 32px 34px 28px;
  border-radius: var(--radius-shell);
  overflow: hidden;
}

.hero::before,
.timeline-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.36), transparent 30%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 45%);
}

.hero-copy {
  display: grid;
  gap: 18px;
  align-content: start;
}

.hero-kicker,
.timeline-intro,
.rail-title,
.timeline-jump-range,
.period-chip,
.event-date,
.event-side-label,
.event-meta-inline,
.hero-meta,
.hero-note,
.timeline-column-head {
  font-family: var(--font-ui);
}

.hero-kicker,
.timeline-intro,
.rail-title {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.dataset-tabs {
  display: inline-flex;
  width: fit-content;
  gap: 8px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(255, 247, 237, 0.88);
  border: 1px solid var(--line-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.dataset-tab {
  border: 0;
  padding: 10px 18px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background-color 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease;
}

.dataset-tab:hover {
  color: var(--text);
}

.dataset-tab.active {
  color: #fffaf3;
  background: linear-gradient(180deg, #b68c63 0%, #97704a 100%);
  box-shadow: 0 8px 18px rgba(125, 93, 61, 0.22);
}

.hero h1,
.timeline-column-head h3,
.event-line h4 {
  margin: 0;
  font-weight: 600;
}

.hero h1 {
  font-size: clamp(38px, 5vw, 64px);
  line-height: 1.02;
  letter-spacing: 0.01em;
}

.hero-deck {
  margin: 0;
  max-width: 18em;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.9;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.hero-meta span,
.hero-note p {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 248, 240, 0.9);
  border: 1px solid var(--line-soft);
}

.hero-note {
  display: grid;
  align-content: end;
}

.hero-note p {
  margin: 0;
  padding: 18px 18px 20px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 253, 249, 0.96), rgba(249, 241, 228, 0.92));
  color: var(--muted);
  font-size: 14px;
  line-height: 1.9;
}

.timeline-shell {
  margin-top: 18px;
  border-radius: var(--radius-shell);
  overflow: hidden;
}

.timeline-header {
  position: relative;
  padding: 24px 28px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.timeline-grid-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 126px minmax(0, 1fr);
  gap: 16px;
  align-items: end;
  margin-top: 12px;
}

.timeline-column-head h3 {
  font-size: 28px;
  line-height: 1.15;
}

.china-head {
  text-align: right;
  color: var(--china);
}

.world-head {
  color: var(--world);
}

.timeline-board {
  position: relative;
  display: grid;
  gap: 0;
  padding: 18px 28px 10px;
}

.timeline-board::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  transform: translateX(-50%);
  background:
    linear-gradient(180deg, transparent, rgba(166, 124, 82, 0.54) 12%, rgba(166, 124, 82, 0.54) 88%, transparent);
}

.timeline-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 126px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  padding: 26px 0 30px;
  scroll-margin-top: 28px;
}

.timeline-column {
  position: relative;
}

.timeline-column-left {
  padding-right: 22px;
}

.timeline-column-right {
  padding-left: 22px;
}

.timeline-card-stack {
  display: grid;
  gap: 14px;
}

.timeline-center {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 10px;
}

.period-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 118px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 248, 238, 0.96);
  color: var(--accent-deep);
  border: 1px solid rgba(166, 124, 82, 0.22);
  box-shadow: 0 6px 16px rgba(81, 61, 36, 0.05);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.stage-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid rgba(255, 252, 246, 0.96);
  box-shadow: 0 0 0 6px rgba(166, 124, 82, 0.12);
}

.stage-title {
  margin: 0;
  max-width: 10em;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
  text-align: center;
}

.event-line {
  position: relative;
  padding: 18px 18px 16px;
  border-radius: var(--radius-card);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 250, 244, 0.92));
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-card);
}

.timeline-column-left .event-line::after,
.timeline-column-right .event-line::before {
  content: "";
  position: absolute;
  top: 28px;
  width: 18px;
  height: 1px;
  background: rgba(166, 124, 82, 0.34);
}

.timeline-column-left .event-line::after {
  right: -18px;
}

.timeline-column-right .event-line::before {
  left: -18px;
}

.event-line-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.event-date {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.event-side-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.event-line.china .event-side-label {
  background: var(--china-soft);
  color: var(--china);
}

.event-line.world .event-side-label {
  background: var(--world-soft);
  color: var(--world);
}

.event-line h4 {
  margin-top: 10px;
  font-size: 22px;
  line-height: 1.35;
}

.event-line-summary {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.9;
}

.event-meta-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.event-meta-inline span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.event-footer {
  display: flex;
  justify-content: flex-start;
  margin-top: 14px;
}

.source-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 248, 237, 0.96);
  border: 1px solid rgba(166, 124, 82, 0.18);
  color: var(--accent-deep);
  text-decoration: none;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease;
}

.source-link::after {
  content: "↗";
  font-size: 12px;
}

.source-link:hover {
  transform: translateY(-1px);
  background: #fffdf8;
  border-color: rgba(166, 124, 82, 0.3);
}

.empty-state {
  padding: 18px 16px;
  border-radius: 18px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 250, 245, 0.78);
  border: 1px dashed rgba(166, 124, 82, 0.2);
  font-size: 14px;
  line-height: 1.8;
}

.empty-state-compact {
  min-height: 0;
}

.rail-nav {
  position: fixed;
  top: 28px;
  right: 18px;
  bottom: 22px;
  width: 122px;
  z-index: 2;
  padding: 18px 14px;
  border-radius: 24px;
}

.timeline-nav {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  padding-right: 2px;
  margin-top: 14px;
  scrollbar-width: none;
}

.timeline-nav::-webkit-scrollbar {
  display: none;
}

.timeline-jump {
  width: 100%;
  border: 0;
  padding: 10px 10px 11px;
  border-radius: 16px;
  background: rgba(255, 249, 241, 0.72);
  border: 1px solid transparent;
  text-align: left;
  cursor: pointer;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    transform 180ms ease,
    color 180ms ease;
}

.timeline-jump:hover {
  transform: translateY(-1px);
  border-color: rgba(166, 124, 82, 0.16);
}

.timeline-jump.active {
  background: rgba(166, 124, 82, 0.12);
  border-color: rgba(166, 124, 82, 0.24);
  color: var(--accent-deep);
}

.timeline-jump-range,
.timeline-jump-title {
  display: block;
}

.timeline-jump-range {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.timeline-jump-title {
  margin-top: 5px;
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 1100px) {
  .app-shell {
    width: min(calc(100% - 24px), var(--max-width));
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .rail-nav {
    position: static;
    width: min(calc(100% - 24px), var(--max-width));
    margin: 18px auto 0;
  }

  .timeline-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-height: none;
    overflow: visible;
  }

  .timeline-grid-head,
  .timeline-stage {
    grid-template-columns: 1fr;
  }

  .timeline-board::before {
    left: 28px;
    transform: none;
  }

  .timeline-center {
    order: -1;
    justify-items: start;
  }

  .stage-title,
  .china-head,
  .world-head {
    text-align: left;
  }

  .timeline-column-left,
  .timeline-column-right {
    padding: 0 0 0 28px;
  }

  .timeline-column-left .event-line::after,
  .timeline-column-right .event-line::before {
    left: -28px;
    right: auto;
    width: 28px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(calc(100% - 18px), var(--max-width));
    padding-top: 18px;
  }

  .hero,
  .timeline-shell {
    border-radius: 24px;
  }

  .hero {
    padding: 22px 20px 20px;
  }

  .timeline-header {
    padding: 18px 18px 14px;
  }

  .timeline-board {
    padding: 14px 18px 8px;
  }

  .dataset-tabs {
    width: 100%;
    flex-wrap: wrap;
  }

  .dataset-tab {
    flex: 1 1 0;
    text-align: center;
  }

  .hero h1 {
    font-size: 34px;
    line-height: 1.08;
  }

  .hero-deck {
    max-width: none;
    font-size: 16px;
  }

  .timeline-nav {
    grid-template-columns: 1fr;
  }

  .timeline-board::before {
    left: 22px;
  }

  .timeline-column-left,
  .timeline-column-right {
    padding-left: 22px;
  }

  .timeline-column-left .event-line::after,
  .timeline-column-right .event-line::before {
    left: -22px;
    width: 22px;
  }

  .timeline-stage {
    padding: 22px 0 24px;
  }

  .event-line {
    padding: 16px 15px 15px;
  }

  .event-line-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .event-line h4 {
    font-size: 20px;
  }
}
