:root {
  color-scheme: light;
  --canvas: #f3f2ed;
  --surface: #fbfaf7;
  --surface-strong: #ffffff;
  --ink: #20231f;
  --muted: #6f746d;
  --faint: #969b94;
  --line: #dcded7;
  --line-strong: #c8cbc3;
  --reference: #7a7d78;
  --grounded: #718579;
  --harness: #71849a;
  --zeroshot: #a57968;
  --multiround: #8a769a;
  --success: #55735e;
  --warning: #9a7546;
  --danger: #995f5a;
  --empty: #161917;
  --radius: 14px;
  --radius-small: 9px;
  --shadow: 0 16px 40px rgba(35, 39, 34, 0.06);
  --site-nav-height: 66px;
  font-family:
    Inter, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", ui-sans-serif,
    system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--canvas);
}

body {
  margin: 0;
  min-width: 320px;
  padding-bottom: 104px;
  color: var(--ink);
  background:
    linear-gradient(rgba(36, 40, 35, 0.025) 1px, transparent 1px),
    var(--canvas);
  background-size: 100% 48px;
}

body.principles-active {
  padding-bottom: 0;
}

body.realworld-active {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  padding-bottom: 0;
}

body.realworld-active .page-shell {
  height: 100%;
}

body.realworld-active main {
  height: calc(100% - var(--site-nav-height));
  overflow: hidden;
}

button,
select,
input {
  font: inherit;
}

button,
select {
  color: inherit;
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--harness);
  outline-offset: 2px;
}

.page-shell {
  width: min(1780px, calc(100% - 64px));
  margin: 0 auto;
}

.site-nav {
  position: sticky;
  z-index: 60;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--site-nav-height);
  border-bottom: 1px solid color-mix(in srgb, var(--line-strong) 82%, transparent);
  background: var(--canvas);
}

.site-mark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 720;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.site-mark-dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--grounded), var(--harness));
}

.view-switcher {
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.48);
  padding: 4px;
}

.view-tab {
  border-radius: 999px;
  padding: 9px 14px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
  text-decoration: none;
  transition: background-color 160ms ease, color 160ms ease;
}

.view-tab:hover {
  color: var(--ink);
}

.view-tab[aria-current="page"] {
  background: var(--ink);
  color: #fff;
}

.page-view[hidden] {
  display: none;
}

.realworld-page {
  width: 100vw;
  height: 100%;
  min-height: 0;
  margin-left: calc(50% - 50vw);
  overflow: hidden;
}

.realworld-page iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--canvas);
}

.site-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  min-height: 0;
  padding: 28px 0 24px;
  border-bottom: 1px solid var(--line-strong);
}

.kicker,
.section-label {
  margin: 0 0 11px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: none;
}

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

h1 {
  margin-bottom: 12px;
  font-size: clamp(1.9rem, 3.2vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.08;
}

.lede {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
}

.dataset-note {
  display: flex;
  align-items: baseline;
  gap: 9px;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  text-transform: none;
}

.dataset-count {
  color: var(--ink);
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

section {
  padding: 42px 0;
  border-bottom: 1px solid var(--line);
}

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

.compact-heading {
  align-items: center;
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
  font-weight: 620;
  letter-spacing: -0.02em;
}

.section-note {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.control-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(300px, 1.1fr) minmax(300px, 1.1fr);
  gap: 16px;
}

.case-control-row {
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(360px, 1.28fr);
  align-items: end;
  gap: 24px;
}

.case-description {
  max-width: 680px;
  margin: 0 0 11px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.65;
}

.case-browser {
  position: relative;
  display: grid;
}

.control-panel {
  position: sticky;
  z-index: 55;
  top: 66px;
  padding: 10px 0;
  background: var(--canvas);
}

.gallery-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr)) auto;
  align-items: end;
  gap: 16px;
  padding: 22px 0;
}

.gallery-result-count {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 11px 14px;
  color: var(--muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

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

.gallery-item {
  display: grid;
  min-width: 0;
  align-content: start;
}

.gallery-item-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: rgba(255, 255, 255, 0.5);
  padding: 10px 13px;
  color: var(--muted);
  font-size: 0.68rem;
}

.gallery-item-heading strong {
  overflow: hidden;
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-item .video-card {
  border-radius: 0 0 var(--radius) var(--radius);
}

.gallery-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 28px 0 104px;
}

.gallery-page-button {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-strong);
  padding: 10px 16px;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 650;
}

.gallery-page-button:hover:not(:disabled) {
  border-color: var(--ink);
}

.gallery-page-button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.gallery-page-status {
  min-width: 92px;
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.case-navigator {
  display: grid;
  grid-template-columns: minmax(96px, 0.22fr) minmax(280px, 1fr) minmax(96px, 0.22fr);
  gap: 8px;
}

.case-step-button,
.current-case-button,
.case-result {
  border: 1px solid var(--line-strong);
  background: var(--surface-strong);
  color: var(--ink);
  cursor: pointer;
}

.case-step-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 62px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 680;
  transition: border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.case-step-button:hover:not(:disabled) {
  border-color: var(--ink);
  color: var(--ink);
  transform: translateX(-2px);
}

.case-step-button.next:hover:not(:disabled) {
  transform: translateX(2px);
}

.case-step-button:disabled {
  cursor: default;
  opacity: 0.42;
}

.current-case-button {
  display: grid;
  justify-items: start;
  min-height: 62px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #fff, #f6f6f1);
  padding: 8px 16px;
  text-align: left;
  box-shadow: var(--shadow);
}

.current-case-button:hover {
  border-color: var(--ink);
}

.current-case-position {
  color: var(--faint);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.current-case-button strong {
  margin-top: 1px;
  font-size: 0.92rem;
  letter-spacing: -0.015em;
}

.current-case-meta {
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.68rem;
}

.case-picker-panel {
  position: absolute;
  z-index: 80;
  top: calc(100% + 9px);
  right: 0;
  left: 0;
  display: grid;
  gap: 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(251, 250, 247, 0.98);
  padding: 11px;
  box-shadow: 0 22px 60px rgba(27, 31, 27, 0.18);
  backdrop-filter: blur(20px);
}

.case-picker-panel[hidden] {
  display: none;
}

.case-filter-bar {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(180px, 0.7fr) minmax(210px, 0.8fr) auto;
  align-items: end;
  gap: 10px;
}

.case-search-field,
.case-filter-field {
  display: grid;
  gap: 7px;
}

.case-search-field > span,
.case-filter-field > span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
}

.case-search-field input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  background: var(--surface-strong);
  padding: 12px 13px;
  color: var(--ink);
  font-size: 0.82rem;
}

.case-search-field input::placeholder {
  color: var(--faint);
}

.case-match-count {
  min-width: 86px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 11px 13px;
  color: var(--muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.case-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.52);
  padding: 9px;
}

.case-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  border-radius: var(--radius-small);
  padding: 12px 13px;
  text-align: left;
}

.case-result:hover,
.case-result.is-selected {
  border-color: color-mix(in srgb, var(--harness) 64%, var(--line-strong));
  background: color-mix(in srgb, var(--harness) 7%, #fff);
}

.case-result-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.case-result-copy strong,
.case-result-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-result-copy strong {
  font-size: 0.8rem;
}

.case-result-copy small {
  color: var(--muted);
  font-size: 0.68rem;
}

.case-result-meta {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
}

.case-result-meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 6px;
  color: var(--muted);
  font-size: 0.62rem;
  font-variant-numeric: tabular-nums;
}

.case-results-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 24px;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.field {
  display: grid;
  gap: 8px;
}

.field > span,
.speed-control > span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: none;
}

select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%) calc(100% - 16px) 50% / 5px 5px no-repeat,
    linear-gradient(135deg, var(--muted) 50%, transparent 50%) calc(100% - 11px) 50% / 5px 5px no-repeat,
    var(--surface-strong);
  padding: 12px 38px 12px 13px;
  font-size: 0.82rem;
}

select:disabled {
  color: var(--faint);
  background-color: #ecece7;
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 0;
  border-bottom: 1px solid var(--ink);
  background: transparent;
  padding: 5px 0;
  cursor: pointer;
  font-size: 0.8rem;
}

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

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

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

.trace-count {
  margin: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  padding: 7px 11px;
  color: var(--muted);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}

.harness-label {
  color: var(--harness);
}

.zeroshot-label {
  color: var(--zeroshot);
}

.multiround-label {
  color: var(--multiround);
}

.harness-section {
  border-top: 2px solid color-mix(in srgb, var(--harness) 55%, transparent);
}

.zeroshot-section {
  border-top: 2px solid color-mix(in srgb, var(--zeroshot) 55%, transparent);
}

.multiround-section {
  border-top: 2px solid color-mix(in srgb, var(--multiround) 55%, transparent);
}

.section-intro {
  max-width: 720px;
  margin: -14px 0 22px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.6;
}

.multiround-grid {
  align-items: start;
}

.empty-state,
.loading-copy {
  grid-column: 1 / -1;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.45);
  padding: 34px;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.video-card {
  --method-color: var(--reference);
  overflow: hidden;
  border: 1px solid var(--line);
  border-top: 3px solid var(--method-color);
  border-radius: var(--radius);
  background: var(--surface-strong);
  box-shadow: 0 8px 28px rgba(33, 37, 32, 0.035);
}

.video-card[data-method="grounded"] {
  --method-color: var(--grounded);
}

.video-card[data-method="harness"] {
  --method-color: var(--harness);
}

.video-card[data-method="zeroshot"] {
  --method-color: var(--zeroshot);
}

.video-card[data-method="multiround"] {
  --method-color: var(--multiround);
}

.card-header {
  min-height: 106px;
  padding: 16px 17px 14px;
}

.card-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-eyebrow {
  margin-bottom: 5px;
  color: var(--method-color);
  font-size: 0.66rem;
  font-weight: 760;
  letter-spacing: 0.11em;
  text-transform: none;
}

.card-header h3 {
  margin-bottom: 0;
  font-size: 0.98rem;
  font-weight: 650;
}

.card-model {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.73rem;
  line-height: 1.5;
}

.meta-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 13px;
}

.meta-badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.65rem;
  font-weight: 680;
  line-height: 1;
  white-space: nowrap;
}

.revision-badge {
  border-color: #d7c8ae;
  background: #f5eee1;
  color: #816b45;
}

.model-gpt {
  border-color: #abc9c0;
  background: #e4f0ec;
  color: #315f55;
}

.model-fable {
  border-color: #b9c6dc;
  background: #e9edf6;
  color: #4d6284;
}

.model-sonnet {
  border-color: #d9b9ae;
  background: #f5e9e5;
  color: #865b4d;
}

.model-neutral {
  border-color: var(--line-strong);
  background: #efefeb;
  color: #5e635d;
}

.effort-badge {
  border-color: #dfc99d;
  background: #f7efd9;
  color: #80602e;
}

.backend-badge {
  border-color: #cdd0ca;
  background: #f2f2ee;
  color: #656a63;
}

.status-pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  background: #eef2ed;
  padding: 6px 8px;
  color: var(--success);
  font-size: 0.64rem;
  font-weight: 720;
  white-space: nowrap;
}

.status-pill::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.status-pill.compile-error,
.status-pill.code-generation-error,
.status-pill.api-error {
  background: #f5eae8;
  color: var(--danger);
}

.status-pill.pending {
  background: #efefeb;
  color: var(--muted);
}

.status-pill.running {
  background: #eef1f7;
  color: #49617e;
}

.media-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--empty);
}

.card-title-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.expand-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  padding: 0;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1;
}

.expand-button:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.card-backdrop {
  position: fixed;
  z-index: 190;
  inset: 0;
  background: rgba(20, 23, 20, 0.62);
}

/* The card stays where it is in the document and is only restyled, so a scene
   iframe keeps running instead of reloading. */
/* The bottom inset clears the floating timeline, which stays above the
   backdrop so playback can still be driven while a card is enlarged. */
.video-card.is-expanded {
  position: fixed;
  z-index: 200;
  inset: 3vh 6vw 108px;
  display: grid;
  grid-template:
    "header header" auto
    "reference output" minmax(0, 1fr)
    "metrics metrics" auto
    "footer footer" auto /
    minmax(0, 1fr) minmax(0, 1fr);
  box-shadow: 0 30px 80px rgba(20, 23, 20, 0.4);
}

.video-card.is-expanded > .card-header {
  grid-area: header;
}

.video-card.is-expanded > .expanded-reference {
  grid-area: reference;
}

.video-card.is-expanded > .media-frame {
  grid-area: output;
  min-height: 0;
  aspect-ratio: auto;
}

.video-card.is-expanded > .run-metrics {
  grid-area: metrics;
}

.video-card.is-expanded > .card-footer {
  grid-area: footer;
}

.video-card.is-expanded .media-frame video,
.expanded-reference video {
  object-fit: contain;
}

.expanded-reference {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid #343934;
  background: var(--empty);
}

.expanded-reference video {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--empty);
}

.expanded-media-label,
.video-card.is-expanded > .media-frame::before {
  position: absolute;
  z-index: 3;
  top: 10px;
  left: 10px;
  border-radius: 999px;
  background: rgba(15, 18, 16, 0.78);
  padding: 5px 9px;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 650;
  pointer-events: none;
}

.video-card.is-expanded > .media-frame::before {
  content: "Model output";
}

.video-card.is-expanded.is-multiround-expanded {
  display: block;
  overflow: hidden;
  background: var(--canvas);
}

.video-card.is-multiround-expanded > :not(.multiround-expanded-grid) {
  display: none;
}

.multiround-expanded-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  height: 100%;
  padding: 14px;
}

.multiround-expanded-grid > .video-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
}

.multiround-expanded-grid .card-header {
  min-height: 0;
  padding: 10px 12px 8px;
}

.multiround-expanded-grid .media-frame {
  min-height: 0;
  aspect-ratio: auto;
}

.multiround-expanded-grid .card-footer {
  min-height: 0;
  padding: 7px 12px;
}

.multiround-close {
  position: absolute;
  z-index: 8;
  top: 20px;
  right: 20px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  background: rgba(20, 23, 20, 0.82);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}

.media-frame video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--empty);
}

.media-frame video.is-padded {
  opacity: 0;
}

.media-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.scene-hint {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 11px;
  pointer-events: none;
}

.padding-overlay,
.failure-frame {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 7px;
  padding: 22px;
  text-align: center;
}

.padding-overlay {
  color: #d9ddd7;
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 11px),
    var(--empty);
}

.padding-overlay[hidden] {
  display: none;
}

.padding-overlay strong,
.failure-frame strong {
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: none;
}

.padding-overlay span,
.failure-frame span {
  color: #aeb4ad;
  font-size: 0.7rem;
  line-height: 1.5;
}

.failure-frame {
  position: relative;
  min-height: 100%;
  color: #e2d9d7;
  background:
    linear-gradient(90deg, transparent 49.8%, rgba(255, 255, 255, 0.07) 50%, transparent 50.2%),
    linear-gradient(transparent 49.8%, rgba(255, 255, 255, 0.07) 50%, transparent 50.2%),
    var(--empty);
}

.clip-clock {
  position: absolute;
  right: 9px;
  bottom: 8px;
  border-radius: 5px;
  background: rgba(15, 18, 16, 0.78);
  padding: 4px 6px;
  color: #f4f5f2;
  font-variant-numeric: tabular-nums;
  font-size: 0.64rem;
}

.card-footer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  min-height: 61px;
  padding: 13px 17px 14px;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.45;
}

.run-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  padding: 12px 13px 0;
}

.run-metric {
  display: grid;
  gap: 4px;
  min-width: 0;
  border: 1px solid #dfe1da;
  border-radius: 8px;
  background: #f3f3ef;
  padding: 9px 10px;
}

.run-metric span {
  color: var(--muted);
  font-size: 0.61rem;
}

.run-metric strong {
  overflow: hidden;
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cost-metric {
  border-color: #e2c5b3;
  background: #f7ece5;
}

.cost-metric span,
.cost-metric strong {
  color: #89593f;
}

.runtime-metric {
  border-color: #c7d5dd;
  background: #eaf0f4;
}

.runtime-metric span,
.runtime-metric strong {
  color: #4b6879;
}

.token-metric {
  border-color: #c9d7c9;
  background: #ebf1e9;
}

.token-metric span,
.token-metric strong {
  color: #526e55;
}

.turn-metric {
  border-color: #d6cde1;
  background: #f0ecf4;
}

.turn-metric span,
.turn-metric strong {
  color: #6f5d81;
}

.card-footer strong {
  color: var(--ink);
  font-weight: 650;
}

.timeline-panel {
  position: fixed;
  z-index: 210;
  bottom: 18px;
  left: 50%;
  width: min(960px, calc(100% - 32px));
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px 14px;
  box-shadow: 0 18px 52px rgba(27, 31, 27, 0.16);
  transform: translateX(-50%);
}

.transport-row,
.modal-transport {
  display: grid;
  grid-template-columns: auto auto minmax(140px, 1fr) auto auto;
  align-items: center;
  gap: 12px;
}

.play-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  line-height: 1;
}

.play-button.small {
  width: 34px;
  height: 34px;
}

.play-button:disabled,
.timeline-input:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.timecode {
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.69rem;
  font-variant-numeric: tabular-nums;
}

.timeline-input {
  width: 100%;
  height: 4px;
  margin: 0;
  appearance: none;
  border-radius: 999px;
  background: var(--line-strong);
  cursor: pointer;
}

.timeline-input::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  border: 2px solid var(--surface-strong);
  border-radius: 50%;
  appearance: none;
  background: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}

.timeline-input::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 2px solid var(--surface-strong);
  border-radius: 50%;
  background: var(--ink);
}

.speed-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.speed-control select {
  width: 74px;
  padding-top: 7px;
  padding-bottom: 7px;
}

.metrics-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.72fr) minmax(600px, 1.28fr);
  gap: 28px;
}

.cost-panel,
.run-table {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.62);
  padding: 20px;
}

.cost-panel h3 {
  margin-bottom: 20px;
  font-size: 0.82rem;
  text-transform: none;
  letter-spacing: 0.08em;
}

.cost-bars {
  display: grid;
  gap: 15px;
}

.cost-row {
  display: grid;
  grid-template-columns: 90px minmax(100px, 1fr) 74px;
  align-items: center;
  gap: 10px;
  font-size: 0.7rem;
}

.cost-track {
  height: 8px;
  border-radius: 999px;
  background: #e5e6e1;
}

.cost-fill {
  width: var(--cost-width);
  height: 100%;
  min-width: 0;
  border-radius: inherit;
  background: var(--cost-color);
}

.cost-value {
  text-align: right;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.fine-print {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.6;
}

.run-table {
  display: grid;
  align-content: start;
  padding: 0;
  overflow: hidden;
}

.table-row {
  display: grid;
  grid-template-columns: 1.05fr 1.25fr 0.8fr 0.8fr 0.65fr 0.65fr;
  align-items: center;
  min-height: 54px;
  border-bottom: 1px solid var(--line);
  font-size: 0.69rem;
}

.table-row:last-child {
  border-bottom: 0;
}

.table-row.header {
  min-height: 43px;
  background: rgba(231, 232, 226, 0.58);
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 720;
  letter-spacing: 0.08em;
  text-transform: none;
}

.table-cell {
  min-width: 0;
  padding: 11px 13px;
  overflow-wrap: anywhere;
}

.table-cell.method {
  font-weight: 650;
}

.table-status {
  color: var(--success);
}

.table-status.error {
  color: var(--danger);
}

.page-shell > footer {
  display: flex;
  justify-content: space-between;
  padding: 24px 0 48px;
  color: var(--muted);
  font-size: 0.67rem;
  letter-spacing: 0.05em;
  text-transform: none;
}

.page-shell > footer[hidden] {
  display: none;
}

.page-shell > footer p {
  margin-bottom: 0;
}

.grid-modal {
  width: min(1600px, calc(100vw - 42px));
  max-width: none;
  max-height: calc(100vh - 42px);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--surface);
  padding: 0;
  box-shadow: 0 32px 90px rgba(15, 18, 16, 0.23);
}

.grid-modal::backdrop {
  background: rgba(30, 33, 29, 0.72);
  backdrop-filter: blur(3px);
}

.modal-shell {
  padding: 22px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 17px;
}

.modal-header h2 {
  margin-bottom: 5px;
  font-size: 1.2rem;
}

.modal-header p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.close-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  font-size: 1.35rem;
  font-weight: 300;
  line-height: 1;
}

.grid-video-frame {
  overflow: hidden;
  aspect-ratio: 8 / 3;
  border-radius: 10px;
  background: var(--empty);
}

.grid-video-frame video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Design principles */

.principles-page {
  --paper: #f5f0e5;
  --sage-wash: #e6ebe2;
  --blue-wash: #e5eaf0;
  --clay-wash: #f0e3dc;
  --ochre-wash: #f2ead5;
}

.principles-page .kicker,
.principles-page .section-label {
  font-size: 0.88rem;
}

.principles-page section {
  padding: 76px 0;
}

.principles-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.45fr);
  align-items: end;
  gap: clamp(48px, 8vw, 130px);
  min-height: 560px;
  padding: 112px 0 78px;
  border-bottom: 1px solid var(--line-strong);
}

.principles-intro {
  max-width: 1040px;
}

.principles-hero h1 {
  max-width: 980px;
  margin-bottom: 28px;
  font-size: clamp(4rem, 7.2vw, 8rem);
  line-height: 0.92;
}

.principles-lede {
  max-width: 770px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.55vw, 1.35rem);
  line-height: 1.55;
}

.core-claim {
  border-top: 3px solid var(--grounded);
  background: rgba(255, 255, 255, 0.54);
  padding: 22px 24px 24px;
}

.core-claim > span,
.thesis-outcomes span,
.fidelity-ladder span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.core-claim strong {
  display: block;
  margin-bottom: 11px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.3rem;
  font-weight: 400;
  line-height: 1.25;
}

.core-claim p {
  margin: 0;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.6;
}

.principles-thesis {
  display: grid;
  grid-template-columns: 78px minmax(320px, 1.1fr) minmax(320px, 0.9fr);
  align-items: start;
  gap: 34px;
}

.thesis-index {
  color: var(--grounded);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.7rem;
  line-height: 0.88;
}

.thesis-copy h2,
.principles-heading h2,
.illustrated-copy h2,
.fidelity-copy h2,
.success-section h2 {
  margin-bottom: 14px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 3.1vw, 3.4rem);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.thesis-copy > p:last-child,
.principles-heading > p,
.feature-lede,
.fidelity-copy > p:last-child {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.thesis-outcomes {
  display: grid;
  border-top: 1px solid var(--line-strong);
}

.thesis-outcomes > div {
  display: grid;
  grid-template-columns: 80px 1fr;
  align-items: baseline;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}

.thesis-outcomes span {
  margin: 0;
}

.thesis-outcomes strong {
  font-size: 0.98rem;
  font-weight: 620;
}

.principles-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 48px;
  margin-bottom: 30px;
}

.principles-heading > p {
  max-width: 380px;
  padding-bottom: 5px;
  font-size: 0.98rem;
}

.paper-figure {
  overflow: hidden;
  margin: 0;
  border: 1px solid #d6cdbd;
  border-radius: 3px;
  background: var(--paper);
  box-shadow: 0 22px 60px rgba(60, 52, 38, 0.08);
}

.paper-figure img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--paper);
}

.paper-figure figcaption {
  border-top: 1px solid #ded5c5;
  padding: 13px 16px 14px;
  color: #716b60;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.92rem;
  font-style: italic;
  line-height: 1.5;
}

.stage-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.stage-list li {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 11px;
  min-height: 184px;
  border-top: 3px solid var(--grounded);
  background: rgba(255, 255, 255, 0.48);
  padding: 17px 15px 18px;
}

.stage-list li:nth-child(2) { border-top-color: #7d917f; }
.stage-list li:nth-child(3) { border-top-color: var(--harness); }
.stage-list li:nth-child(4) { border-top-color: var(--zeroshot); }
.stage-list li:nth-child(5) { border-top-color: #ae8d48; }

.stage-letter {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.98rem;
}

.stage-list strong {
  display: block;
  margin: 3px 0 8px;
  font-size: 1.06rem;
}

.stage-list p {
  margin: 0;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.55;
}

.principle-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line-strong);
  border-left: 1px solid var(--line-strong);
}

.principle-grid article {
  min-height: 290px;
  border-right: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  padding: 24px;
}

.principle-grid article:nth-child(1) { background: var(--sage-wash); }
.principle-grid article:nth-child(2) { background: var(--blue-wash); }
.principle-grid article:nth-child(3) { background: var(--clay-wash); }
.principle-grid article:nth-child(4) { background: var(--ochre-wash); }

.principle-number {
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.96rem;
}

.principle-grid h3 {
  max-width: 220px;
  margin: 57px 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1.15;
}

.principle-grid p {
  margin: 0;
  color: #63685f;
  font-size: 1rem;
  line-height: 1.6;
}

.illustrated-principle {
  display: grid;
  grid-template-columns: minmax(0, 1.22fr) minmax(330px, 0.78fr);
  align-items: center;
  gap: clamp(42px, 6vw, 96px);
}

.evidence-section {
  grid-template-columns: minmax(330px, 0.76fr) minmax(0, 1.24fr);
}

.illustrated-copy {
  max-width: 540px;
}

.feature-lede {
  margin-bottom: 28px;
}

.plain-list,
.loop-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.plain-list li {
  display: grid;
  gap: 5px;
  border-top: 1px solid var(--line);
  padding: 14px 0;
}

.plain-list li:last-child {
  border-bottom: 1px solid var(--line);
}

.plain-list strong {
  font-size: 1rem;
}

.plain-list span {
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.5;
}

.loop-list {
  counter-reset: loop-step;
}

.loop-list li {
  counter-increment: loop-step;
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 15px;
  border-top: 1px solid var(--line);
  padding: 13px 0;
}

.loop-list li:last-child {
  border-bottom: 1px solid var(--line);
}

.loop-list span {
  color: var(--zeroshot);
  font-size: 0.96rem;
  font-weight: 700;
}

.loop-list p {
  margin: 0;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.5;
}

.fidelity-section {
  display: grid;
  grid-template-columns: minmax(320px, 0.7fr) minmax(0, 1.3fr);
  align-items: end;
  gap: 64px;
}

.fidelity-ladder {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 8px;
}

.fidelity-ladder > div {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.5);
  padding: 18px;
}

.fidelity-ladder > div:nth-child(1) { min-height: 128px; }
.fidelity-ladder > div:nth-child(2) { min-height: 158px; background: var(--blue-wash); }
.fidelity-ladder > div:nth-child(3) { min-height: 190px; background: var(--sage-wash); }

.fidelity-ladder strong {
  display: block;
  margin-bottom: 13px;
  font-size: 1rem;
  line-height: 1.35;
}

.fidelity-ladder p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.success-section {
  margin: 76px 0;
  border: 0;
  border-radius: 18px;
  background: var(--ink);
  padding: 58px !important;
  color: #f5f4ef;
}

.success-section .section-label {
  color: #aeb6aa;
}

.success-section h2 {
  max-width: 780px;
  margin-bottom: 38px;
}

.success-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid #4e554e;
  border-left: 1px solid #4e554e;
}

.success-grid article {
  min-height: 150px;
  border-right: 1px solid #4e554e;
  border-bottom: 1px solid #4e554e;
  padding: 19px;
}

.success-grid span {
  display: block;
  margin-bottom: 30px;
  color: #91a497;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.9rem;
}

.success-grid strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.02rem;
}

.success-grid p {
  margin: 0;
  color: #b8beb7;
  font-size: 0.94rem;
  line-height: 1.55;
}

.success-section blockquote {
  max-width: 820px;
  margin: 48px 0 0;
  color: #d9ddd6;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.35rem, 2.3vw, 2.2rem);
  font-style: italic;
  line-height: 1.3;
}

.modal-transport {
  grid-template-columns: auto auto minmax(140px, 1fr) auto;
  margin-top: 16px;
}

@media (max-width: 1280px) {
  .comparison-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metrics-layout {
    grid-template-columns: 1fr;
  }

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

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

  .stage-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 860px) {
  :root {
    --site-nav-height: 60px;
  }

  .page-shell {
    width: min(100% - 30px, 1780px);
  }

  .site-nav {
    min-height: 60px;
  }

  .site-header {
    min-height: 0;
    padding: 24px 0 20px;
  }

  .control-grid,
  .comparison-grid,
  .overview-grid,
  .trace-grid {
    grid-template-columns: 1fr;
  }

  .case-navigator {
    grid-template-columns: 58px minmax(0, 1fr) 58px;
  }

  .case-step-button {
    min-height: 62px;
  }

  .case-step-button span:not([aria-hidden]) {
    display: none;
  }

  .case-filter-bar,
  .case-results {
    grid-template-columns: 1fr;
  }

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

  .gallery-result-count {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .case-results {
    max-height: 280px;
  }

  .case-match-count {
    justify-self: start;
  }

  .section-heading,
  .site-header {
    align-items: flex-start;
  }

  .section-heading {
    flex-direction: column;
    gap: 14px;
  }

  .transport-row {
    grid-template-columns: auto auto minmax(100px, 1fr) auto;
  }

  .speed-control {
    grid-column: 3 / 5;
    justify-self: end;
  }

  .run-table {
    overflow-x: auto;
  }

  .table-row {
    min-width: 780px;
  }

  .page-shell > footer {
    display: grid;
    gap: 7px;
  }

  .principles-page section {
    padding: 58px 0;
  }

  .principles-hero,
  .principles-thesis,
  .illustrated-principle,
  .evidence-section,
  .fidelity-section {
    grid-template-columns: 1fr;
  }

  .principles-hero {
    align-items: start;
    gap: 48px;
    min-height: auto;
    padding: 82px 0 58px;
  }

  .principles-hero h1 {
    font-size: clamp(3.8rem, 12vw, 6rem);
  }

  .core-claim {
    max-width: 500px;
  }

  .principles-thesis {
    gap: 24px;
  }

  .thesis-index {
    font-size: 2rem;
  }

  .principles-heading {
    align-items: start;
    flex-direction: column;
    gap: 6px;
  }

  .stage-list {
    grid-template-columns: 1fr;
  }

  .stage-list li {
    min-height: auto;
  }

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

  .illustrated-principle {
    gap: 34px;
  }

  .illustrated-copy {
    max-width: 680px;
  }

  .fidelity-section {
    align-items: start;
    gap: 34px;
  }

  .success-section {
    padding: 42px !important;
  }
}

@media (max-width: 560px) {
  body {
    padding-bottom: 132px;
  }

  .timeline-panel {
    bottom: 10px;
    width: calc(100% - 20px);
  }

  .dataset-note {
    display: none;
  }

  .gallery-controls,
  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .site-mark span:last-child {
    display: none;
  }

  .site-mark-dot {
    margin-right: 10px;
  }

  .view-tab {
    padding: 8px 10px;
    font-size: 0.78rem;
  }

  h1 {
    font-size: 1.9rem;
  }

  section {
    padding: 34px 0;
  }

  .card-header {
    min-height: auto;
  }

  .cost-row {
    grid-template-columns: 72px minmax(90px, 1fr) 62px;
  }

  .grid-modal {
    width: calc(100vw - 20px);
  }

  .modal-shell {
    padding: 14px;
  }

  .principles-hero {
    padding-top: 64px;
  }

  .principles-hero h1 {
    font-size: 3.6rem;
  }

  .principles-lede {
    font-size: 0.95rem;
  }

  .thesis-outcomes > div {
    grid-template-columns: 64px 1fr;
  }

  .workflow-figure figcaption,
  .supporting-figure figcaption {
    font-size: 0.84rem;
  }

  .principle-grid,
  .fidelity-ladder,
  .success-grid {
    grid-template-columns: 1fr;
  }

  .principle-grid article {
    min-height: 220px;
  }

  .principle-grid h3 {
    margin-top: 34px;
  }

  .fidelity-ladder > div,
  .fidelity-ladder > div:nth-child(1),
  .fidelity-ladder > div:nth-child(2),
  .fidelity-ladder > div:nth-child(3) {
    min-height: auto;
  }

  .success-section {
    margin: 50px 0;
    border-radius: 12px;
    padding: 30px 22px !important;
  }

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

  .success-section blockquote {
    margin-top: 34px;
  }
}

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

.gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: var(--canvas);
}

.gate-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(340px, 88vw);
  padding: 34px 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
  text-align: center;
}

.gate-panel h1 {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: 0.01em;
}

.gate-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.gate-panel input {
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  font-size: 1rem;
  text-align: center;
}

.gate-panel button {
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-small);
  background: var(--ink);
  color: var(--surface-strong);
  font-size: 0.95rem;
  cursor: pointer;
}

.gate-error {
  color: var(--danger);
  font-size: 0.85rem;
}
