:root {
  color-scheme: light;
  --ink: #17211c;
  --muted: #5d6962;
  --paper: #f4f1e8;
  --panel: #fffdf7;
  --line: #d4d0c2;
  --green: #376753;
  --green-soft: #dfe9df;
  --red: #bb4a3a;
  --amber: #d99033;
  --blue: #326c90;
  --purple: #7a5d91;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 0%, rgba(55, 103, 83, .09), transparent 31rem),
    var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input { font: inherit; }

.shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 42px 0 88px;
}

.intro { max-width: 880px; margin-bottom: 38px; }
.back { color: var(--green); font-size: 13px; font-weight: 700; text-decoration: none; }
.kicker, .micro { margin: 22px 0 10px; color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: 0; max-width: 900px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(48px, 7.5vw, 94px); font-weight: 500; letter-spacing: -.055em; line-height: .92; }
.lede { max-width: 770px; margin: 26px 0 0; color: #3e4a43; font-family: Georgia, "Times New Roman", serif; font-size: clamp(19px, 2.3vw, 25px); line-height: 1.42; }

.demo { overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 24px 65px rgba(45, 49, 42, .09); }
.demo-head { display: flex; align-items: center; justify-content: space-between; min-height: 108px; padding: 22px 28px; border-bottom: 1px solid var(--line); }
.step-label { margin: 0 0 6px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.demo h2, .method h2, .run-summary h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(27px, 4vw, 44px); font-weight: 500; letter-spacing: -.025em; }
.event-badge { padding: 8px 12px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: 12px; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }

.stage-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr); min-height: 520px; }
figure { margin: 0; }
.patch-panel { display: flex; min-width: 0; flex-direction: column; border-right: 1px solid var(--line); }
figcaption { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.legend { display: flex; align-items: center; gap: 6px; font-weight: 600; letter-spacing: 0; text-transform: none; }
.accepted-dot, .trial-dot { display: inline-block; width: 8px; height: 8px; margin-left: 6px; border-radius: 50%; background: #e3c98e; }
.trial-dot { background: var(--red); }
#patch-canvas { display: block; width: 100%; min-height: 465px; flex: 1; }

.learning-panel { display: flex; min-width: 0; flex-direction: column; padding: 18px 20px 20px; background: #f0eee5; }
.marking-title { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.marking-title .micro { margin: 0 0 4px; }
.marking-title h3 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 24px; font-weight: 500; }
.marking-title strong { color: var(--green); font-size: 12px; white-space: nowrap; }
#marking-canvas { width: 100%; height: 330px; margin-top: 16px; }
.domain-note { min-height: 52px; margin: 8px 2px 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

.explanation { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px; align-items: center; min-height: 112px; padding: 20px 28px; border-top: 1px solid var(--line); }
#event-message { margin: 0; max-width: 680px; font-family: Georgia, "Times New Roman", serif; font-size: 20px; line-height: 1.4; }
.event-stats { display: flex; margin: 0; }
.event-stats div { min-width: 86px; padding: 0 16px; border-left: 1px solid var(--line); }
.event-stats dt { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.event-stats dd { margin: 4px 0 0; font-size: 19px; font-weight: 750; }

.transport { display: grid; grid-template-columns: 44px 80px 44px auto minmax(160px, 1fr); gap: 9px; align-items: center; padding: 14px 20px; background: #ebe7dc; border-top: 1px solid var(--line); }
.transport button { height: 38px; border: 1px solid #bdb8aa; border-radius: 9px; background: var(--panel); color: var(--ink); cursor: pointer; font-weight: 800; }
.transport button:hover { border-color: var(--green); }
.transport button:disabled { cursor: default; opacity: .4; }
.transport label { margin-left: 10px; color: var(--muted); font-size: 12px; font-weight: 700; }
input[type="range"] { width: 100%; accent-color: var(--green); }

.method, .run-summary { display: grid; grid-template-columns: .7fr 1.3fr; gap: 70px; padding: 94px 10px 28px; }
.method .kicker, .run-summary .kicker { margin-top: 0; }
.method ol { margin: 0; padding: 0; list-style: none; }
.method li { display: grid; grid-template-columns: 46px 1fr; gap: 14px; padding: 0 0 24px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.method li > span { color: var(--green); font-family: Georgia, serif; font-size: 17px; }
.method h3 { margin: 0 0 7px; font-size: 16px; }
.method li p, .caveat { margin: 0; color: var(--muted); line-height: 1.6; }

.run-summary { padding-top: 82px; }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.summary-card { min-height: 112px; padding: 18px; background: rgba(255, 253, 247, .72); border: 1px solid var(--line); border-radius: 13px; }
.summary-card strong { display: block; font-family: Georgia, serif; font-size: 31px; font-weight: 500; }
.summary-card span { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.caveat { grid-column: 2; margin-top: 18px; font-size: 13px; }

@media (max-width: 820px) {
  .shell { width: min(100% - 24px, 680px); padding-top: 24px; }
  .stage-grid { grid-template-columns: 1fr; }
  .patch-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  #patch-canvas { min-height: 390px; }
  .learning-panel { min-height: 430px; }
  .explanation, .method, .run-summary { grid-template-columns: 1fr; gap: 28px; }
  .event-stats { width: 100%; }
  .event-stats div:first-child { border-left: 0; padding-left: 0; }
  .transport { grid-template-columns: 44px 70px 44px 1fr; }
  .transport label { display: none; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .caveat { grid-column: 1; }
}

@media (max-width: 520px) {
  h1 { font-size: 49px; }
  .demo-head { align-items: flex-start; padding: 18px; }
  .event-badge { margin-left: 10px; }
  figcaption .legend { display: none; }
  #patch-canvas { min-height: 330px; }
  .explanation { padding: 18px; }
  .event-stats div { min-width: 0; padding: 0 10px; }
  .transport { padding: 12px; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
}

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