:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-2: #eef2f6;
  --ink: #15171c;
  --muted: #5f6673;
  --line: #d8dee8;
  --blue: #1769aa;
  --green: #0d7f62;
  --red: #b93d47;
  --gold: #9a6a14;
  --violet: #6554c0;
  --shadow: 0 18px 45px rgba(21, 23, 28, 0.08);
}

* {
  box-sizing: border-box;
}

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

a {
  color: inherit;
}

button,
select {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px clamp(18px, 4vw, 56px);
  background: rgba(246, 247, 249, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.kicker,
.section-label {
  margin: 0 0 5px;
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 3vw, 2.6rem);
  line-height: 1.06;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(1.3rem, 2vw, 1.9rem);
  line-height: 1.18;
}

h3 {
  margin-bottom: 6px;
  font-size: 1rem;
  line-height: 1.25;
}

main {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 26px clamp(16px, 4vw, 56px) 56px;
}

.timestamp {
  min-width: 188px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.timestamp span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
}

.timestamp strong {
  display: block;
  font-size: 0.94rem;
}

.thesis {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 460px);
  gap: 24px;
  align-items: stretch;
  padding: clamp(22px, 4vw, 44px);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.thesis p {
  max-width: 820px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.02rem;
}

.formula {
  display: flex;
  min-height: 132px;
  flex-direction: column;
  justify-content: center;
  padding: 18px;
  background: #101820;
  color: #f7fafc;
}

.formula span {
  color: #9dd2ff;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.formula code {
  display: block;
  margin-top: 10px;
  white-space: normal;
  color: #ffffff;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.92rem;
}

.formula small {
  display: block;
  margin-top: 12px;
  color: #c8d2dd;
  font-size: 0.8rem;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.metric-card,
.route-card,
.company-card,
.detail-panel,
.trigger-card,
.source-card {
  border: 1px solid var(--line);
  background: var(--panel);
}

.metric-card {
  padding: 16px;
}

.metric-card span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.metric-card strong {
  display: block;
  margin: 5px 0;
  font-size: clamp(1.18rem, 2.2vw, 1.8rem);
  line-height: 1.12;
}

.metric-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.controls {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 24px 0 18px;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.control-group {
  display: grid;
  gap: 8px;
}

.control-group > span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segmented button,
select {
  min-height: 38px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
}

.segmented button {
  padding: 0 12px;
  cursor: pointer;
}

.segmented button.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

select {
  min-width: 220px;
  padding: 0 12px;
}

.section-block {
  margin-top: 24px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 14px;
}

.section-head > p {
  max-width: 540px;
  margin: 22px 0 0;
  color: var(--muted);
}

.section-head.compact {
  margin-bottom: 10px;
}

.route-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.route-card {
  padding: 18px;
}

.route-card.selected {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 2px rgba(23, 105, 170, 0.12);
}

.route-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.route-title span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  background: var(--panel-2);
  color: var(--blue);
  font-weight: 800;
}

.edge {
  color: var(--ink);
  font-weight: 650;
}

dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.mini-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.mini-tags span,
.route-pill,
.timeline-type,
.source-links a,
.conf-high,
.conf-med,
.conf-low {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  font-size: 0.72rem;
  font-weight: 800;
}

.mini-tags span {
  background: var(--panel-2);
  color: var(--muted);
}

.company-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  gap: 16px;
  align-items: start;
}

.company-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.company-card {
  display: grid;
  gap: 12px;
  width: 100%;
  min-height: 192px;
  padding: 16px;
  text-align: left;
  cursor: pointer;
}

.company-card.active {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 2px rgba(23, 105, 170, 0.12);
}

.company-head,
.company-foot {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.company-head strong {
  color: var(--blue);
  font-size: 1.9rem;
  line-height: 1;
}

.company-card p {
  min-height: 48px;
  margin-bottom: 0;
  color: var(--muted);
}

.company-foot {
  color: var(--muted);
  font-size: 0.82rem;
}

.route-pill {
  margin-bottom: 8px;
  background: #e7f0f8;
  color: var(--blue);
}

.overall-track,
.bar-track {
  overflow: hidden;
  background: var(--panel-2);
}

.overall-track {
  height: 8px;
}

.overall-track div,
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--green));
}

.detail-panel {
  position: sticky;
  top: 108px;
  padding: 18px;
}

.detail-top p {
  color: var(--muted);
}

.score-list {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.score-row {
  display: grid;
  grid-template-columns: 112px minmax(70px, 1fr) 38px;
  gap: 10px;
  align-items: center;
  font-size: 0.84rem;
}

.score-row span {
  color: var(--muted);
}

.bar-track {
  height: 9px;
}

.score-row strong {
  text-align: right;
}

.callout,
.next-trigger {
  margin-top: 10px;
  padding: 12px;
  background: var(--panel-2);
}

.callout span,
.next-trigger span {
  display: block;
  margin-bottom: 5px;
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.callout p,
.next-trigger p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.callout.bull span {
  color: var(--green);
}

.callout.bear span {
  color: var(--red);
}

.next-trigger span {
  color: var(--gold);
}

.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.source-links a {
  background: #111820;
  color: #fff;
  text-decoration: none;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 18px;
}

.timeline {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.timeline time {
  color: var(--blue);
  font-weight: 900;
}

.timeline p {
  margin: 7px 0 0;
  color: var(--muted);
}

.timeline-type {
  background: var(--panel-2);
  color: var(--muted);
}

.trigger-list {
  display: grid;
  gap: 10px;
}

.trigger-card {
  padding: 14px;
}

.trigger-card p {
  margin-bottom: 8px;
  color: var(--muted);
}

.trigger-card span {
  color: var(--blue);
  font-weight: 700;
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.source-card {
  display: grid;
  gap: 8px;
  min-height: 146px;
  padding: 14px;
  color: inherit;
  text-decoration: none;
}

.source-card strong {
  line-height: 1.25;
}

.source-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.conf-high {
  background: #e5f5ef;
  color: var(--green);
}

.conf-med {
  background: #fff3d7;
  color: var(--gold);
}

.conf-low {
  background: #fde8eb;
  color: var(--red);
}

@media (max-width: 1100px) {
  .metrics,
  .route-grid,
  .source-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .company-layout,
  .split,
  .thesis {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  .topbar,
  .controls,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .timestamp {
    min-width: 0;
  }

  .metrics,
  .route-grid,
  .company-grid,
  .source-grid {
    grid-template-columns: 1fr;
  }

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

  select {
    width: 100%;
    min-width: 0;
  }

  .score-row {
    grid-template-columns: 96px minmax(64px, 1fr) 34px;
  }
}
