:root {
  --page: #f4f5f2;
  --paper: #ffffff;
  --ink: #142235;
  --body: #33475b;
  --muted: #607386;
  --line: #cfd8de;
  --navy: #143a52;
  --navy-deep: #0e2c40;
  --blue: #1d6894;
  --blue-soft: #e8f1f6;
  --orange: #c8522f;
  --orange-soft: #fff0ea;
  --green: #1b7056;
  --green-soft: #e6f3ee;
  --shadow: 0 18px 50px rgba(22, 45, 61, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family:
    Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC",
    Arial, sans-serif;
  font-size: 17px;
  line-height: 1.7;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  z-index: 50;
  top: 0;
  min-height: 76px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 32px;
  padding: 0 max(28px, calc((100vw - 1240px) / 2));
  border-bottom: 1px solid #d5dde1;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  line-height: 1.2;
}

.wordmark-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--navy);
  color: white;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.wordmark strong,
.wordmark small {
  display: block;
}

.wordmark strong {
  font-size: 18px;
}

.wordmark small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.topbar nav {
  display: flex;
  gap: 30px;
}

.topbar nav a {
  color: var(--body);
  font-size: 15px;
  font-weight: 650;
}

.topbar nav a:hover,
.github-link:hover {
  color: var(--blue);
}

.github-link {
  justify-self: end;
  padding-bottom: 2px;
  border-bottom: 1px solid currentColor;
  color: var(--navy);
  font-size: 15px;
  font-weight: 700;
}

main {
  overflow: hidden;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(500px, 1.05fr);
  gap: 72px;
  align-items: center;
  min-height: 720px;
  padding: 90px max(28px, calc((100vw - 1240px) / 2));
  background:
    linear-gradient(90deg, rgba(20, 58, 82, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(20, 58, 82, 0.04) 1px, transparent 1px),
    #f8f9f7;
  background-size: 32px 32px;
}

.overline {
  margin: 0 0 14px;
  color: var(--blue);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 650px;
  margin: 0;
  font-family: Georgia, "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(48px, 5vw, 72px);
  line-height: 1.16;
  letter-spacing: -0.035em;
}

.hero-lead {
  max-width: 650px;
  margin: 28px 0 0;
  color: var(--body);
  font-size: 20px;
  line-height: 1.85;
}

.hero-actions,
.demo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.button {
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 750;
  cursor: pointer;
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button-primary {
  border-color: var(--navy);
  background: var(--navy);
  color: #fff;
}

.button-primary:hover {
  background: var(--navy-deep);
}

.button-secondary {
  border-color: #9eb0bc;
  background: white;
  color: var(--navy);
}

.button-secondary:hover {
  border-color: var(--navy);
}

.privacy-line {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.hero-figure {
  display: grid;
  grid-template-columns: 0.9fr 50px 1.1fr;
  align-items: center;
}

.paper {
  border: 1px solid #b8c6ce;
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.paper-source {
  transform: rotate(-2deg);
}

.paper-result {
  transform: rotate(1.4deg);
}

.paper-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 17px;
  border-bottom: 1px solid #d7dfe3;
  color: var(--navy);
  font-size: 14px;
}

.paper-head strong {
  color: var(--green);
}

.paper-table {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  padding: 18px;
  color: var(--body);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 14px;
}

.paper-table span {
  padding: 8px;
  border-bottom: 1px solid #e2e7e9;
}

.paper-table span:nth-child(-n + 2) {
  background: #edf2f5;
  color: var(--navy);
  font-weight: 800;
}

.flow-arrow {
  color: var(--orange);
  font-size: 34px;
  font-weight: 800;
  text-align: center;
}

.paper-result svg {
  display: block;
  width: 100%;
  padding: 14px 18px 0;
}

.paper-result svg line {
  stroke: #8a9aa4;
  stroke-width: 1;
}

.paper-result svg path {
  fill: none;
  stroke: var(--blue);
  stroke-width: 4;
  stroke-linecap: round;
}

.paper-result svg circle {
  fill: var(--orange);
  stroke: white;
  stroke-width: 2;
}

.paper-result > p {
  margin: 4px 18px 18px;
  padding-top: 12px;
  border-top: 1px solid #d7dfe3;
  color: var(--body);
  font-size: 15px;
  font-weight: 700;
}

.plain-explanation,
.demo-section,
.outputs-section {
  padding: 110px max(28px, calc((100vw - 1240px) / 2));
  scroll-margin-top: 72px;
}

.plain-explanation {
  background: var(--navy);
  color: white;
}

.section-heading {
  max-width: 820px;
}

.section-heading h2 {
  margin: 0;
  font-family: Georgia, "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(38px, 4vw, 54px);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.section-heading > p:not(.overline),
.demo-heading > div > p:not(.overline) {
  margin: 20px 0 0;
  color: var(--body);
  font-size: 18px;
  line-height: 1.85;
}

.plain-explanation .overline {
  color: #9cd2ef;
}

.explanation-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 50px;
  overflow: hidden;
  border: 1px solid #688295;
  border-radius: 8px;
  background: #688295;
}

.explanation-grid article {
  min-height: 300px;
  padding: 34px;
  background: #173f59;
}

.step-number {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid #a4c5d7;
  border-radius: 50%;
  color: #cde7f4;
  font-weight: 800;
}

.explanation-grid h3 {
  margin: 30px 0 14px;
  font-size: 23px;
}

.explanation-grid p {
  margin: 0;
  color: #d5e2e9;
  font-size: 17px;
  line-height: 1.85;
}

.one-line-summary {
  margin-top: 20px;
  padding: 22px 26px;
  border-left: 5px solid #e07a55;
  background: #0e3046;
  font-size: 17px;
}

.one-line-summary strong {
  color: #ffc0a9;
}

.demo-section {
  background: #f6f7f4;
}

.demo-heading {
  max-width: none;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 50px;
}

.demo-heading > div:first-child {
  max-width: 780px;
}

.demo-actions {
  flex-shrink: 0;
  margin: 0;
}

.demo-shell {
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr);
  margin-top: 46px;
  overflow: hidden;
  border: 1px solid #b8c5cc;
  border-radius: 10px;
  background: white;
  box-shadow: var(--shadow);
}

.analysis-steps {
  padding: 26px;
  border-right: 1px solid #c7d1d6;
  background: #edf1f2;
}

.dataset-card {
  padding: 18px;
  border: 1px solid #c6d0d5;
  border-radius: 6px;
  background: white;
}

.dataset-card span,
.dataset-card strong,
.dataset-card small {
  display: block;
}

.dataset-card span {
  color: var(--muted);
  font-size: 14px;
}

.dataset-card strong {
  overflow: hidden;
  margin-top: 5px;
  color: var(--navy);
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dataset-card small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
}

.analysis-steps ol {
  display: grid;
  gap: 10px;
  margin: 24px 0;
  padding: 0;
  list-style: none;
}

.analysis-steps li {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 11px;
  align-items: center;
  padding: 14px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #687b88;
}

.analysis-steps li > span {
  font-size: 14px;
  font-weight: 800;
}

.analysis-steps li strong,
.analysis-steps li small {
  display: block;
}

.analysis-steps li strong {
  font-size: 16px;
}

.analysis-steps li small {
  margin-top: 2px;
  font-size: 14px;
}

.analysis-steps li em {
  font-size: 13px;
  font-style: normal;
}

.analysis-steps li.running {
  border-color: #8db5cc;
  background: white;
  color: var(--blue);
}

.analysis-steps li.running em {
  font-weight: 800;
}

.analysis-steps li.done {
  color: var(--green);
}

.analysis-steps li.done > span::after {
  content: " ✓";
}

.analysis-steps li.error {
  color: var(--orange);
}

.status-message {
  min-height: 74px;
  padding: 14px;
  border-left: 4px solid #8fa3ae;
  background: white;
  color: var(--body);
  font-size: 15px;
}

.chart-workspace {
  min-width: 0;
  padding: 28px;
}

.chart-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.chart-toolbar strong,
.chart-toolbar span {
  display: block;
}

.chart-toolbar strong {
  font-size: 20px;
}

.chart-toolbar > div:first-child span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 14px;
  color: var(--body);
  font-size: 14px;
}

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

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #376f91;
}

.legend-dot.outlier {
  background: var(--orange);
}

.legend-line {
  width: 20px;
  height: 3px;
  background: var(--green);
}

.chart-frame {
  position: relative;
  min-height: 430px;
  overflow: hidden;
  border: 1px solid #c3ced4;
  border-radius: 6px;
  background: #fbfcfb;
}

#analysisChart {
  display: block;
  width: 100%;
  min-height: 430px;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  padding: 30px;
  text-align: center;
}

.chart-empty strong,
.chart-empty span {
  display: block;
}

.chart-empty strong {
  color: var(--navy);
  font-size: 22px;
}

.chart-empty span {
  max-width: 420px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 16px;
}

.chart-empty.hidden {
  display: none;
}

.plain-result {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 22px;
  margin-top: 16px;
  padding: 18px 20px;
  border-left: 5px solid var(--blue);
  background: var(--blue-soft);
}

.plain-result span {
  color: var(--navy);
  font-weight: 800;
}

.plain-result p {
  margin: 0;
  color: var(--body);
}

.result-panel {
  margin-top: 24px;
  padding: 30px;
  border: 1px solid #bdc9cf;
  border-radius: 10px;
  background: white;
}

.result-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.result-heading h3 {
  margin: 0;
  font-size: 30px;
}

.result-state {
  padding: 7px 12px;
  border: 1px solid #a9b8c0;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.result-state.complete {
  border-color: #75a995;
  background: var(--green-soft);
  color: var(--green);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 24px;
}

.metric-grid article {
  min-height: 150px;
  padding: 20px;
  border: 1px solid #c6d0d5;
  border-radius: 6px;
  background: #f9faf8;
}

.metric-grid span,
.metric-grid strong,
.metric-grid small {
  display: block;
}

.metric-grid span {
  color: var(--body);
  font-size: 15px;
  font-weight: 750;
}

.metric-grid strong {
  margin-top: 10px;
  color: var(--navy);
  font-family: Georgia, serif;
  font-size: 30px;
  line-height: 1.25;
}

.metric-grid small {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.quality-table {
  margin-top: 20px;
  border: 1px solid #c5d0d5;
  border-radius: 6px;
}

.quality-row {
  display: grid;
  grid-template-columns: 1fr 0.8fr 1.7fr;
  gap: 20px;
  align-items: center;
  min-height: 58px;
  padding: 12px 16px;
  border-top: 1px solid #d7dfe3;
  color: var(--body);
  font-size: 15px;
}

.quality-row.header {
  border-top: 0;
  background: #eaf0f2;
  color: var(--navy);
  font-weight: 800;
}

.quality-row strong.good {
  color: var(--green);
}

.quality-row strong.warn {
  color: var(--orange);
}

.outputs-section {
  background: white;
}

.output-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 44px;
}

.output-grid article {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 18px;
  min-height: 250px;
  padding: 26px;
  border: 1px solid #becbd1;
  border-radius: 8px;
}

.file-label {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 6px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 14px;
  font-weight: 900;
}

.file-label.report {
  background: var(--orange-soft);
  color: var(--orange);
}

.file-label.source {
  background: var(--blue-soft);
  color: var(--blue);
}

.output-grid h3 {
  margin: 0;
  font-size: 20px;
}

.output-grid p {
  margin: 10px 0 0;
  color: var(--body);
  font-size: 15px;
}

.output-grid button,
.output-grid a {
  grid-column: 1 / -1;
  align-self: end;
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--navy);
  border-radius: 5px;
  background: white;
  color: var(--navy);
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
}

.output-grid button:hover:not(:disabled),
.output-grid a:hover {
  background: var(--navy);
  color: white;
}

.output-grid button:disabled,
.output-grid a[aria-disabled="true"] {
  border-color: #b9c4ca;
  color: #82929c;
  cursor: not-allowed;
  pointer-events: none;
}

.scope-note {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 36px;
  max-width: 1240px;
  margin: 0 auto 100px;
  padding: 26px 30px;
  border: 1px solid #b8c6cd;
  border-left: 6px solid var(--orange);
  background: #fff8f4;
}

.scope-note strong {
  color: var(--orange);
  font-size: 18px;
}

.scope-note p {
  margin: 0;
  color: var(--body);
  font-size: 16px;
}

footer {
  min-height: 130px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 30px;
  padding: 0 max(28px, calc((100vw - 1240px) / 2));
  background: var(--navy-deep);
  color: white;
}

footer strong,
footer span {
  display: block;
}

footer span,
footer p {
  color: #bfd0da;
  font-size: 14px;
}

footer p {
  margin: 0;
}

footer > a {
  justify-self: end;
  border-bottom: 1px solid currentColor;
  font-size: 14px;
}

@media (max-width: 1080px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .topbar nav {
    display: none;
  }

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

  .hero-copy {
    max-width: 760px;
  }

  .hero-figure {
    max-width: 820px;
  }

  .demo-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .demo-shell {
    grid-template-columns: 1fr;
  }

  .analysis-steps {
    border-right: 0;
    border-bottom: 1px solid #c7d1d6;
  }

  .analysis-steps ol {
    grid-template-columns: 1fr 1fr;
  }

  .metric-grid,
  .output-grid {
    grid-template-columns: 1fr 1fr;
  }

  .output-grid article:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 16px;
  }

  .topbar {
    min-height: 66px;
    padding: 0 18px;
  }

  .wordmark small,
  .github-link {
    display: none;
  }

  .hero,
  .plain-explanation,
  .demo-section,
  .outputs-section {
    padding: 64px 20px;
  }

  .hero h1 {
    font-size: 43px;
  }

  .hero-lead {
    font-size: 18px;
  }

  .hero-actions,
  .demo-actions,
  .button {
    width: 100%;
  }

  .hero-figure {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .paper-source,
  .paper-result {
    transform: none;
  }

  .flow-arrow {
    transform: rotate(90deg);
  }

  .section-heading h2 {
    font-size: 38px;
  }

  .explanation-grid,
  .analysis-steps ol,
  .metric-grid,
  .output-grid {
    grid-template-columns: 1fr;
  }

  .explanation-grid article {
    min-height: auto;
  }

  .chart-workspace,
  .result-panel {
    padding: 18px;
  }

  .chart-toolbar {
    flex-direction: column;
  }

  .legend {
    justify-content: flex-start;
  }

  .chart-frame,
  #analysisChart {
    min-height: 340px;
  }

  .plain-result {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .quality-row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 15px;
  }

  .quality-row.header {
    display: none;
  }

  .output-grid article:last-child {
    grid-column: auto;
  }

  .scope-note {
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 0 20px 70px;
    padding: 22px;
  }

  footer {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 30px 20px;
  }

  footer > a {
    justify-self: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
