:root {
  --paper: #f7f8fb;
  --panel: #ffffff;
  --ink: #162033;
  --muted: #5e6a80;
  --line: #dce2ec;
  --blue: #2f64d6;
  --cyan: #0f8c9f;
  --rose: #c23b62;
  --gold: #b7791f;
  --green: #177245;
  --shadow: 0 18px 42px rgba(30, 44, 74, 0.10);
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(47, 100, 214, 0.08), rgba(247, 248, 251, 0) 310px),
    var(--paper);
  font-family: var(--sans);
  line-height: 1.55;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

code {
  overflow-wrap: anywhere;
}

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

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-weight: 800;
  text-decoration: none;
}

.brand span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.nav a,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 12px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
}

.nav a[aria-current="page"],
.button.primary {
  color: #ffffff;
  background: var(--blue);
  border-color: var(--blue);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.14fr) minmax(310px, 0.86fr);
  gap: clamp(22px, 4vw, 46px);
  align-items: end;
  max-width: 1180px;
  min-height: calc(100vh - 64px);
  margin: 0 auto;
  padding: clamp(34px, 6vw, 70px) clamp(18px, 4vw, 44px) 32px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.08;
  letter-spacing: 0;
}

h1 {
  max-width: 920px;
  font-size: clamp(2.35rem, 7vw, 5.6rem);
}

h2 {
  font-size: clamp(1.7rem, 3vw, 2.45rem);
}

h3 {
  font-size: 1.1rem;
}

.lede {
  max-width: 760px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.7vw, 1.25rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.hero-panel {
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.run-id {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.82rem;
}

.run-id:last-child {
  border-bottom: 0;
}

.run-id b {
  color: var(--blue);
}

.section {
  max-width: 1180px;
  margin: 0 auto;
  padding: 52px clamp(18px, 4vw, 44px);
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.section-head p {
  max-width: 670px;
  margin: 8px 0 0;
  color: var(--muted);
}

.concept-panel {
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.concept-figure {
  margin: 0;
}

.concept-figure img {
  display: block;
  width: 100%;
  height: auto;
  background: #ffffff;
}

.concept-figure figcaption {
  padding: 16px 18px 18px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
}

.concept-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.concept-card {
  min-height: 118px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.concept-card b {
  display: block;
  margin-bottom: 8px;
  color: var(--blue);
}

.concept-card span {
  color: var(--muted);
  font-size: 0.92rem;
}

.duality-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

.duality-card {
  min-height: 146px;
  padding: 18px;
  background: #fbfdfc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.duality-card h3 {
  color: var(--blue);
}

.duality-card p {
  margin: 10px 0 0;
  color: var(--muted);
}

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

.metric {
  min-height: 132px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric .label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metric .value {
  margin-top: 12px;
  color: var(--blue);
  font-size: clamp(1.7rem, 3.5vw, 2.8rem);
  font-weight: 850;
  line-height: 1;
}

.metric .note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.88rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.chart-panel {
  padding: 18px;
}

.chart {
  width: 100%;
  height: auto;
  min-height: 230px;
  overflow: visible;
}

.chart text {
  fill: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.chart .axis {
  stroke: var(--line);
  stroke-width: 1;
}

.chart .seed42 {
  fill: none;
  stroke: var(--blue);
  stroke-width: 3;
}

.chart .seed43 {
  fill: none;
  stroke: var(--rose);
  stroke-width: 3;
}

.chart .seed44 {
  fill: none;
  stroke: var(--gold);
  stroke-width: 3;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.88rem;
}

.legend span::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 3px;
  margin-right: 7px;
  vertical-align: middle;
  background: var(--blue);
}

.legend .s43::before {
  background: var(--rose);
}

.legend .s44::before {
  background: var(--gold);
}

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

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

.card {
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
}

.card p {
  margin: 10px 0 0;
  color: var(--muted);
}

.mini-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.mini-table th,
.mini-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.mini-table tr:last-child td {
  border-bottom: 0;
}

.mini-table th {
  color: var(--muted);
  background: #eef3fa;
  font-family: var(--mono);
  font-size: 0.74rem;
  text-transform: uppercase;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 800;
}

.pill.good {
  color: #075633;
  background: #dff7e9;
}

.pill.warn {
  color: #724505;
  background: #fff3cc;
}

.pill.bad {
  color: #8a1f3e;
  background: #fde2eb;
}

.example {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 14px;
  margin-top: 16px;
}

.example pre,
.skill pre {
  max-height: 440px;
  margin: 0;
  padding: 16px;
  overflow: auto;
  color: #172033;
  background: #f3f6fa;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.8rem;
  white-space: pre-wrap;
}

.skill pre {
  max-height: none;
}

.storyline {
  display: grid;
  gap: 12px;
}

.step {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 104px;
  gap: 14px;
  align-items: center;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.step strong {
  font-family: var(--mono);
  font-size: 0.86rem;
}

.bar {
  height: 9px;
  overflow: hidden;
  background: #e7ebf1;
  border-radius: 999px;
}

.bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--blue));
}

.footer {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px clamp(18px, 4vw, 44px) 56px;
  color: var(--muted);
  font-size: 0.9rem;
}

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

  .hero,
  .two-col,
  .three-col,
  .duality-band,
  .concept-grid,
  .example {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 540px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 2.35rem;
  }
}
