:root {
  --bg: #030403;
  --surface: #080a08;
  --surface-2: #0d100d;
  --ink: #f5f7f1;
  --muted: #a6ada0;
  --dim: #727a6d;
  --lime: #ccff00;
  --coral: #ff8b7c;
  --line: rgba(255, 255, 255, .14);
  --serif: Georgia, "Times New Roman", serif;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { color-scheme: dark; scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--bg); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
.skip { position: fixed; top: -5rem; left: 1rem; z-index: 100; padding: .8rem 1rem; color: #000; background: var(--lime); }
.skip:focus { top: 1rem; }

.site-header {
  position: sticky; top: 0; z-index: 30; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2rem;
  min-height: 76px; padding: .8rem clamp(1rem, 3.4vw, 3rem); border-bottom: 1px solid rgba(255,255,255,.09);
  background: rgba(3,4,3,.9); backdrop-filter: blur(16px);
}
.brand { display: inline-flex; align-items: center; gap: .7rem; font-size: 1.25rem; font-weight: 700; text-decoration: none; }
.brand img { width: 45px; height: 45px; border: 1px solid rgba(204,255,0,.5); border-radius: 50%; object-fit: cover; }
.site-nav { display: flex; align-items: center; justify-content: flex-end; gap: 1.6rem; }
.site-nav a { color: #d9ddd4; font-size: .9rem; text-decoration: none; }
.site-nav a:hover, .site-nav a:focus-visible, .site-nav a[aria-current="page"] { color: var(--lime); }

.hero { position: relative; overflow: hidden; padding: clamp(3.5rem, 8vw, 7rem) 1.2rem clamp(2.5rem, 5vw, 4rem); border-bottom: 1px solid var(--line); }
.hero::before {
  content: ""; position: absolute; inset: 0; opacity: .17; pointer-events: none;
  background-image: linear-gradient(rgba(204,255,0,.18) 1px, transparent 1px), linear-gradient(90deg, rgba(204,255,0,.18) 1px, transparent 1px);
  background-size: 54px 54px; mask-image: radial-gradient(circle at 50% 20%, #000, transparent 68%);
}
.hero-inner { position: relative; width: min(1180px, 100%); margin: 0 auto; }
.eyebrow { margin: 0 0 1rem; color: var(--lime); font: 700 .72rem/1 var(--mono); letter-spacing: .15em; text-transform: uppercase; }
h1 { max-width: 930px; margin: 0; font: 400 clamp(2.7rem, 6.5vw, 6rem)/.94 var(--serif); letter-spacing: -.045em; }
.hero-copy { max-width: 680px; margin: 1.5rem 0 0; color: #c9cec4; font-size: clamp(1rem, 1.5vw, 1.22rem); line-height: 1.55; }
.replay-promise { display: inline-flex; align-items: center; gap: .6rem; margin-top: 1.6rem; color: #dce2d6; font: 700 .72rem/1.3 var(--mono); letter-spacing: .055em; text-transform: uppercase; }
.replay-promise::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 14px rgba(204,255,0,.7); }
.hero-actions { display: flex; gap: .7rem; margin-top: 1.35rem; }
.hero-actions a { display: inline-flex; padding: .72rem 1rem; color: var(--lime); border: 1px solid rgba(204,255,0,.35); border-radius: 999px; background: rgba(204,255,0,.04); font: 700 .68rem/1 var(--mono); text-decoration: none; }
.hero-actions a:hover, .hero-actions a:focus-visible { color: #000; background: var(--lime); }

.builder-shell { width: min(1280px, calc(100% - 2rem)); margin: 0 auto; padding: clamp(2rem, 5vw, 4.5rem) 0; }
.builder-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(330px, .65fr); gap: clamp(1.2rem, 3vw, 2.4rem); align-items: start; }
.builder-form, .contract-card { border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(145deg, rgba(13,16,13,.98), rgba(5,7,5,.98)); }
.builder-form { padding: clamp(1.2rem, 3vw, 2.2rem); }
.form-step { padding: 0 0 2rem; margin: 0 0 2rem; border: 0; border-bottom: 1px solid var(--line); }
.form-step:last-of-type { margin-bottom: 1.4rem; }
.step-head { display: grid; grid-template-columns: 2rem 1fr; gap: .8rem; align-items: start; margin-bottom: 1rem; }
.step-number { display: grid; place-items: center; width: 2rem; height: 2rem; color: #000; border-radius: 50%; background: var(--lime); font: 800 .75rem/1 var(--mono); }
.step-head h2 { margin: .15rem 0 .3rem; font: 400 clamp(1.25rem, 2vw, 1.55rem)/1.1 var(--serif); }
.step-head p { margin: 0; color: var(--muted); font-size: .86rem; line-height: 1.5; }
label { color: #dce1d8; }
textarea, select, input[type="text"] {
  width: 100%; min-height: 50px; padding: .85rem 1rem; color: var(--ink); border: 1px solid rgba(255,255,255,.2);
  border-radius: 9px; outline: none; background: #050705;
}
textarea { min-height: 132px; resize: vertical; line-height: 1.55; }
textarea::placeholder, input::placeholder { color: #697064; }
textarea:focus, select:focus, input[type="text"]:focus { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(204,255,0,.12); }
.field-label { display: block; margin: 0 0 .6rem; font: 700 .69rem/1 var(--mono); letter-spacing: .09em; text-transform: uppercase; }
.title-field { margin-bottom: 1rem; }
.radio-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.radio-card { position: relative; display: block; min-height: 155px; padding: 1.05rem; border: 1px solid rgba(255,255,255,.16); border-radius: 11px; background: #060806; cursor: pointer; }
.radio-card input { position: absolute; opacity: 0; }
.radio-card:has(input:disabled) { opacity: .56; cursor: not-allowed; }
.radio-card::before { content: ""; position: absolute; top: 1rem; right: 1rem; width: 14px; height: 14px; border: 1px solid #6f776a; border-radius: 50%; }
.radio-card:has(input:checked) { border-color: var(--lime); background: rgba(204,255,0,.045); }
.radio-card:has(input:checked)::before { border: 4px solid #101400; background: var(--lime); box-shadow: 0 0 0 1px var(--lime); }
.radio-kicker { display: block; margin-bottom: .65rem; color: var(--lime); font: 700 .62rem/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.radio-card strong { display: block; margin-bottom: .55rem; font-size: 1.04rem; }
.radio-card small { display: block; max-width: 38ch; color: var(--muted); font-size: .78rem; line-height: 1.48; }
.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.range-row { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: center; }
input[type="range"] { width: 100%; accent-color: var(--lime); }
.cutoff-value { min-width: 88px; padding: .7rem; color: var(--lime); border: 1px solid rgba(204,255,0,.35); border-radius: 8px; background: #050705; font: 800 1rem/1 var(--mono); text-align: center; }
.field-note { margin: .6rem 0 0; color: var(--dim); font: .68rem/1.45 var(--mono); }
.custom-fields { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: .8rem; padding: .85rem; border: 1px solid rgba(255,139,124,.35); border-radius: 8px; background: rgba(255,139,124,.035); }
.custom-fields p { grid-column: 1 / -1; margin: 0; color: #dfa49c; font-size: .78rem; line-height: 1.45; }
.build-button { width: 100%; min-height: 56px; padding: .85rem 1.2rem; color: #000; border: 0; border-radius: 999px; background: var(--lime); cursor: pointer; font-weight: 800; }
.build-button:hover { background: #d8ff3b; transform: translateY(-1px); }
.build-button:disabled { color: #79806f; background: #20251c; cursor: wait; transform: none; }
.build-button:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.form-error { min-height: 1.3rem; margin: .75rem 0 0; color: #ff9c90; font-size: .82rem; line-height: 1.4; }
.draft-note { margin: 0 0 1rem; color: var(--dim); font-size: .75rem; line-height: 1.5; text-align: center; }

.contract-card { position: sticky; top: 100px; overflow: hidden; }
.contract-head { padding: 1.2rem 1.35rem; border-bottom: 1px solid var(--line); }
.contract-head-row { display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.contract-label { display: block; margin-bottom: .45rem; color: var(--dim); font: 700 .58rem/1 var(--mono); letter-spacing: .09em; text-transform: uppercase; }
.contract-head h2 { max-width: 21ch; margin: 0; font: 400 1.25rem/1.15 var(--serif); overflow-wrap: anywhere; }
.status-pill { display: inline-flex; align-items: center; gap: .4rem; padding: .42rem .58rem; color: #f0b0a7; border: 1px solid rgba(255,139,124,.4); border-radius: 999px; font: 800 .58rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--coral); }
.contract-phrase { min-height: 100px; margin: 0; padding: 1.35rem; color: #e8ebe4; border-bottom: 1px solid var(--line); font: 400 1.2rem/1.4 var(--serif); overflow-wrap: anywhere; }
.contract-rows { margin: 0; }
.contract-rows > div { display: grid; grid-template-columns: 1fr auto; gap: 1rem; padding: .8rem 1.35rem; border-bottom: 1px solid rgba(255,255,255,.075); }
.contract-rows dt { color: var(--dim); font: 700 .62rem/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.contract-rows dd { margin: 0; color: #dce2d7; font: 700 .72rem/1.3 var(--mono); text-align: right; }
.replay-gate { padding: 1.3rem 1.35rem; }
.replay-gate strong { display: block; margin-bottom: .8rem; font-size: .84rem; }
.gate-track { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.gate-stage { min-height: 65px; padding: .65rem; border: 1px solid rgba(255,255,255,.12); background: #050705; }
.gate-stage:first-child { border-color: rgba(204,255,0,.35); }
.gate-stage span { display: block; margin-bottom: .35rem; color: var(--dim); font: 700 .56rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.gate-stage b { color: #cfd4ca; font-size: .72rem; font-weight: 600; }
.gate-stage:first-child b { color: var(--lime); }
.gate-stage.active { border-color: rgba(204,255,0,.65); background: rgba(204,255,0,.055); }
.gate-stage.complete { border-color: rgba(204,255,0,.35); }
.gate-stage.complete b, .gate-stage.active b { color: var(--lime); }
.gate-stage.complete span::after { content: " ✓"; color: var(--lime); }
.gate-note { margin: .8rem 0 0; color: var(--dim); font-size: .7rem; line-height: 1.45; }

.request-result { margin-top: 1.2rem; padding: 1.1rem; border: 1px solid rgba(204,255,0,.35); border-radius: 12px; background: rgba(204,255,0,.035); }
.request-result header { display: flex; justify-content: space-between; gap: 1rem; align-items: start; }
.request-result h3 { margin: 0 0 .3rem; font: 400 1.2rem/1 var(--serif); }
.request-result p { margin: 0; color: var(--muted); font-size: .76rem; line-height: 1.45; }
.request-result code { display: block; margin-top: .8rem; color: var(--lime); font: .68rem/1.5 var(--mono); overflow-wrap: anywhere; }
.status-pill[data-status="valid"] { color: var(--lime); border-color: rgba(204,255,0,.45); }
.status-pill[data-status="valid"]::before { background: var(--lime); }
.status-pill[data-status="running"], .status-pill[data-status="queued"] { color: #fff3b0; border-color: rgba(255,229,120,.4); }
.status-pill[data-status="running"]::before, .status-pill[data-status="queued"]::before { background: #ffe578; }
.job-progress { display: grid; grid-template-columns: minmax(110px, auto) 1fr auto; gap: .8rem; align-items: center; margin: 1rem 0 .3rem; font: 700 .62rem/1.3 var(--mono); text-transform: uppercase; letter-spacing: .055em; }
.job-progress > span { color: #d9ded3; }
.job-progress > div { height: 7px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.1); }
.job-progress i { display: block; width: 0; height: 100%; background: var(--lime); transition: width .35s ease; }
.job-progress b { color: var(--dim); font-weight: 700; }
.result-actions { display: flex; gap: .5rem; margin: 1rem 0 .8rem; }
.result-actions button { min-height: 40px; padding: .6rem .8rem; color: #dfe4da; border: 1px solid rgba(255,255,255,.2); border-radius: 999px; background: transparent; cursor: pointer; font: 700 .68rem/1 var(--mono); }
.result-actions button:hover { color: #000; border-color: var(--lime); background: var(--lime); }
pre { max-height: 360px; margin: 0; padding: .9rem; overflow: auto; color: #bfc6ba; border: 1px solid rgba(255,255,255,.1); background: #020302; font: .66rem/1.5 var(--mono); }
.request-details { margin-top: .8rem; }
.request-details summary { color: var(--dim); cursor: pointer; font: 700 .65rem/1 var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.request-details pre { margin-top: .7rem; }

.index-result { margin-top: 1.2rem; overflow: hidden; border: 1px solid rgba(204,255,0,.42); border-radius: 14px; background: #050705; }
.index-result-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.2rem; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, rgba(204,255,0,.07), transparent); }
.index-result-head span { display: block; margin-bottom: .38rem; color: var(--lime); font: 700 .62rem/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.index-result-head h3 { margin: 0; font: 400 1.45rem/1.1 var(--serif); }
.index-result-head > strong { color: var(--lime); font: 700 .66rem/1.3 var(--mono); text-align: right; }
.result-metrics { display: grid; grid-template-columns: 150px 1fr; border-bottom: 1px solid var(--line); }
.result-metrics > div { padding: .85rem 1.1rem; }
.result-metrics > div + div { border-left: 1px solid var(--line); }
.result-metrics span { display: block; margin-bottom: .38rem; color: var(--dim); font: 700 .58rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.result-metrics b { color: var(--ink); font: 700 1.1rem/1 var(--mono); }
.result-metrics code { color: #bcc4b5; font: .62rem/1.4 var(--mono); overflow-wrap: anywhere; }
.holdings-table-wrap { max-height: 680px; overflow: auto; }
.holdings-table { width: 100%; border-collapse: collapse; font-size: .78rem; }
.holdings-table th { position: sticky; top: 0; z-index: 2; padding: .7rem .8rem; color: var(--dim); border-bottom: 1px solid var(--line); background: #080b08; font: 700 .58rem/1 var(--mono); text-align: left; letter-spacing: .08em; text-transform: uppercase; }
.holdings-table td { padding: .8rem; border-bottom: 1px solid rgba(255,255,255,.075); vertical-align: top; }
.holdings-table td:nth-child(1), .holdings-table td:nth-child(3), .holdings-table td:nth-child(4) { font-family: var(--mono); }
.holdings-table td:nth-child(3) { color: var(--lime); font-weight: 800; }
.holdings-table td:nth-child(4) { white-space: nowrap; }
.holdings-table td strong { display: block; font-family: var(--mono); }
.holdings-table td small { display: block; max-width: 25ch; margin-top: .2rem; color: var(--dim); line-height: 1.25; }
.holdings-table details { min-width: 75px; }
.holdings-table summary { color: var(--lime); cursor: pointer; font: 700 .62rem/1 var(--mono); }
.reasoning-block { width: min(540px, 55vw); padding: .65rem 0 .1rem; color: #bbc2b6; font-size: .75rem; line-height: 1.5; }
.reasoning-block p { margin: 0 0 .65rem; }
.index-result > .result-actions { padding: 0 1.1rem 1.1rem; }

.validity { padding: clamp(2.5rem, 6vw, 5rem) 0 1rem; }
.validity > header { display: grid; grid-template-columns: .8fr 1fr; gap: 2rem; align-items: end; margin-bottom: 1.5rem; }
.validity h2 { margin: 0; font: 400 clamp(2rem, 4vw, 3.6rem)/1 var(--serif); letter-spacing: -.035em; }
.validity > header p { margin: 0; color: var(--muted); line-height: 1.55; }
.validity-grid { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.validity-step { min-height: 190px; padding: 1.35rem; background: var(--surface); }
.validity-step + .validity-step { border-left: 1px solid var(--line); }
.validity-step span { display: block; margin-bottom: 2.2rem; color: var(--lime); font: 700 .65rem/1 var(--mono); letter-spacing: .1em; }
.validity-step h3 { margin: 0 0 .65rem; font: 400 1.3rem/1.1 var(--serif); }
.validity-step p { margin: 0; color: var(--muted); font-size: .83rem; line-height: 1.5; }

.library-hero { padding: clamp(2.2rem, 5vw, 4rem) 1.2rem; }
.library-hero .hero-inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2rem; align-items: end; }
.library-hero .eyebrow { grid-column: 1 / -1; margin-bottom: -.6rem; }
.library-hero h1 { max-width: 1000px; font-size: clamp(2.7rem, 5vw, 4.8rem); }
.library-hero .hero-copy { max-width: 850px; margin-top: 1rem; font-size: 1rem; }
.library-hero .hero-actions { margin: 0; }
.library-shell { width: min(1440px, calc(100% - 3rem)); margin: 0 auto; padding: clamp(1.8rem, 4vw, 3.5rem) 0; }
.library-summary { display: flex; align-items: end; justify-content: space-between; gap: 2rem; padding-bottom: .9rem; border-bottom: 1px solid var(--line); }
.library-summary .eyebrow { margin-bottom: .5rem; }
.library-summary h2 { margin: 0; font: 400 clamp(1.8rem, 3vw, 2.8rem)/1 var(--serif); letter-spacing: -.035em; }
.library-count { display: flex; align-items: baseline; gap: .5rem; }
.library-count strong { color: var(--lime); font: 400 2.6rem/.8 var(--serif); }
.library-count span { color: var(--dim); font: 700 .62rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.library-status { min-height: 1rem; margin: .65rem 0; color: var(--dim); font: .66rem/1.4 var(--mono); }
.library-status[data-state="ready"] { color: #76806e; }
.library-status[data-state="error"] { color: var(--coral); }
.index-library-grid { border-top: 1px solid var(--line); }
.library-row { border-bottom: 1px solid var(--line); }
.library-row-toggle { display: grid; grid-template-columns: 36px minmax(300px, 1fr) 72px 65px 92px 105px 130px; gap: 1rem; align-items: center; width: 100%; padding: .95rem .4rem; color: var(--ink); border: 0; background: transparent; cursor: pointer; text-align: left; }
.library-row-toggle:hover, .library-row-toggle:focus-visible, .library-row-toggle[aria-expanded="true"] { background: linear-gradient(90deg, rgba(204,255,0,.055), transparent 72%); outline: none; }
.library-row-rank { color: #596053; font: 700 .62rem/1 var(--mono); }
.library-row-identity { min-width: 0; }
.library-row-identity strong { display: block; margin-bottom: .3rem; font: 400 1.22rem/1.05 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.library-row-identity small { display: -webkit-box; overflow: hidden; color: var(--muted); font-size: .73rem; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 1; }
.library-row-stat, .library-row-replay { color: #e8ece4; font: 700 .78rem/1 var(--mono); }
.library-row-stat small, .library-row-replay small { display: block; margin-top: .28rem; color: var(--dim); font: 700 .52rem/1 var(--mono); letter-spacing: .075em; text-transform: uppercase; }
.library-row-replay { color: var(--lime); }
.library-row-date { color: var(--muted); font: .64rem/1.3 var(--mono); }
.library-row-affordance { display: flex; align-items: center; justify-content: flex-end; gap: .7rem; color: var(--lime); font: 700 .58rem/1 var(--mono); letter-spacing: .045em; text-transform: uppercase; }
.library-row-affordance i, .recipe-explainer summary i { display: block; width: 8px; height: 8px; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: rotate(45deg); transition: transform .2s ease; }
.library-row-toggle[aria-expanded="true"] .library-row-affordance i, .recipe-explainer[open] summary i { transform: rotate(225deg); }
.library-row-detail { padding: 0 0 1.5rem 52px; }
.library-row-prompt { padding: .9rem 0 1rem; border-top: 1px solid rgba(204,255,0,.14); }
.library-row-prompt > span { display: block; margin-bottom: .48rem; color: var(--lime); font: 700 .55rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.library-row-prompt p { max-width: 112ch; margin: 0; color: #c9d0c3; font: 400 .91rem/1.55 var(--serif); }
.library-row-utility { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 0 1rem; border-top: 1px solid rgba(204,255,0,.14); }
.library-row-utility > span { color: #70796c; font: .57rem/1.45 var(--mono); }
.library-row-utility > div { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .45rem; }
.library-row-utility a, .library-row-utility button { min-height: 34px; padding: .55rem .72rem; color: #dfe4da; border: 1px solid rgba(255,255,255,.17); border-radius: 999px; background: transparent; cursor: pointer; font: 700 .58rem/1 var(--mono); text-decoration: none; }
.library-row-utility a:hover, .library-row-utility button:hover { color: #000; border-color: var(--lime); background: var(--lime); }
.library-row-utility button:disabled { opacity: .55; cursor: wait; }
.library-detail-grid { display: grid; grid-template-columns: minmax(300px, .7fr) minmax(620px, 1.3fr); gap: clamp(1.4rem, 3vw, 3rem); align-items: start; }
.holdings-chart header { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; }
.holdings-chart h4 { margin: 0; font: 400 1.45rem/1 var(--serif); }
.holdings-chart header span { color: var(--dim); font: .56rem/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.weight-chart { display: grid; gap: .42rem; }
.weight-row { display: grid; grid-template-columns: 22px 58px minmax(80px, 1fr) 64px; gap: .55rem; align-items: center; min-height: 19px; }
.weight-rank { color: #535b4f; font: .52rem/1 var(--mono); }
.weight-row strong { overflow: hidden; color: #e9ede4; font: 700 .66rem/1 var(--mono); text-overflow: ellipsis; }
.weight-track { display: block; height: 7px; background: rgba(255,255,255,.065); }
.weight-track i { display: block; height: 100%; background: linear-gradient(90deg, #789600, var(--lime)); }
.weight-row b { color: #cdd3c8; font: 700 .59rem/1 var(--mono); text-align: right; }
.library-holdings-table-wrap { max-height: 620px; overflow: auto; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.library-holdings-table { width: 100%; border-collapse: collapse; font-size: .7rem; }
.library-holdings-table th { position: sticky; top: 0; z-index: 2; padding: .58rem .55rem; color: var(--dim); border-bottom: 1px solid var(--line); background: #080a08; font: 700 .52rem/1 var(--mono); text-align: left; letter-spacing: .07em; text-transform: uppercase; }
.library-holdings-table td { padding: .62rem .55rem; border-bottom: 1px solid rgba(255,255,255,.065); vertical-align: top; }
.library-holdings-table td strong { display: block; font: 700 .69rem/1.2 var(--mono); }
.library-holdings-table td small { display: block; max-width: 24ch; margin-top: .18rem; color: var(--dim); font-size: .63rem; line-height: 1.25; }
.holding-rank { color: var(--dim); font-family: var(--mono); }
.holding-score, .holding-weight { color: var(--lime); font: 700 .68rem/1.2 var(--mono); white-space: nowrap; }
.holding-reasoning summary { color: #b9c1b4; cursor: pointer; font: 700 .56rem/1.3 var(--mono); white-space: nowrap; }
.holding-reasoning div { width: min(520px, 44vw); padding-top: .6rem; color: var(--muted); font-size: .69rem; line-height: 1.5; }
.holding-reasoning p { margin: 0 0 .65rem; }
.holdings-loading { margin: 0; padding: 2rem 0; color: var(--dim); font: .66rem/1.4 var(--mono); }
.holdings-loading[data-state="error"] { color: var(--coral); }
.recipe-explainer { margin-top: clamp(2rem, 5vw, 4rem); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.recipe-explainer > summary { display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding: 1.15rem .4rem; color: var(--ink); cursor: pointer; list-style: none; }
.recipe-explainer > summary::-webkit-details-marker { display: none; }
.recipe-explainer > summary strong { display: block; margin-bottom: .3rem; font: 400 1.2rem/1 var(--serif); }
.recipe-explainer > summary small { color: var(--dim); font-size: .7rem; }
.recipe-explainer > summary i { margin-right: .3rem; color: var(--lime); }
.recipe-grid { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); }
.recipe-grid article { min-height: 150px; padding: 1.1rem .8rem; }
.recipe-grid article + article { border-left: 1px solid var(--line); }
.recipe-grid span { display: block; margin-bottom: 1.5rem; color: var(--lime); font: 700 .6rem/1 var(--mono); }
.recipe-grid h3 { margin: 0 0 .5rem; font: 400 1.08rem/1.1 var(--serif); }
.recipe-grid p { margin: 0; color: var(--muted); font-size: .73rem; line-height: 1.45; }
.recipe-boundary { margin: 0; padding: .85rem; color: #8f988a; border-top: 1px solid var(--line); font: .62rem/1.5 var(--mono); }
.recipe-boundary strong { color: var(--lime); }

footer { display: grid; grid-template-columns: 1fr auto; gap: 2rem; padding: 2rem clamp(1.5rem,4vw,3rem); color: #8d9488; border-top: 1px solid var(--line); font-size: .9rem; }
.foot-links { display: flex; flex-wrap: wrap; gap: 1.3rem; }
.foot-links a { text-decoration: none; }
.foot-links a:hover { color: var(--lime); }
.footnote { grid-column: 1 / -1; max-width: 95ch; color: #666d62; line-height: 1.5; }

@media (max-width: 900px) {
  .builder-grid { grid-template-columns: 1fr; }
  .contract-card { position: static; }
  .validity > header { grid-template-columns: 1fr; gap: 1rem; }
  .library-hero .hero-inner { grid-template-columns: 1fr; gap: 1rem; }
  .library-hero .hero-actions { grid-column: 1; }
  .library-row-toggle { grid-template-columns: 30px minmax(230px, 1fr) 62px 58px 82px 118px; }
  .library-row-date { display: none; }
  .library-detail-grid { grid-template-columns: 1fr; }
  .library-row-detail { padding-left: 46px; }
  .library-metrics { grid-template-columns: 1fr 1fr; }
  .library-metrics > div:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .library-metrics > div:nth-child(4) { border-top: 1px solid var(--line); }
  .recipe-explainer > header { grid-template-columns: 1fr; }
  .recipe-grid { grid-template-columns: 1fr 1fr; }
  .recipe-grid article:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .recipe-grid article:nth-child(4) { border-top: 1px solid var(--line); }
}
@media (max-width: 680px) {
  .site-header { position: static; grid-template-columns: 1fr; gap: .8rem; }
  .site-nav { justify-content: flex-start; gap: 1rem; overflow-x: auto; padding-bottom: .2rem; }
  .hero { padding-top: 3rem; }
  .builder-shell { width: calc(100% - 1rem); }
  .library-shell { width: calc(100% - 1rem); }
  .radio-grid, .two-fields, .custom-fields { grid-template-columns: 1fr; }
  .custom-fields p { grid-column: auto; }
  .radio-card { min-height: auto; }
  .job-progress { grid-template-columns: 1fr auto; }
  .job-progress > div { grid-column: 1 / -1; grid-row: 2; }
  .result-metrics { grid-template-columns: 1fr; }
  .result-metrics > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .reasoning-block { width: 72vw; }
  .validity-grid { grid-template-columns: 1fr; }
  .validity-step + .validity-step { border-left: 0; border-top: 1px solid var(--line); }
  .validity-step { min-height: 160px; }
  .validity-step span { margin-bottom: 1.2rem; }
  .library-summary { align-items: start; }
  .library-shell { width: calc(100% - 1rem); }
  .library-row-toggle { grid-template-columns: 24px minmax(0, 1fr) 52px 28px; gap: .6rem; padding: .85rem .2rem; }
  .library-row-stat:nth-of-type(4), .library-row-replay, .library-row-date { display: none; }
  .library-row-affordance span { display: none; }
  .library-row-affordance { justify-content: center; }
  .library-row-identity strong { font-size: 1.04rem; }
  .library-row-identity small { -webkit-line-clamp: 2; }
  .library-row-detail { padding: 0 0 1.2rem; }
  .library-row-utility { align-items: flex-start; flex-direction: column; }
  .library-row-utility > div { justify-content: flex-start; }
  .library-detail-grid { gap: 1.5rem; }
  .library-holdings-table-wrap { width: 100%; overflow-x: auto; }
  .library-holdings-table { min-width: 670px; }
  .holding-reasoning div { width: min(520px, 76vw); }
  .library-card > header { flex-direction: column; }
  .library-metrics { grid-template-columns: 1fr; }
  .library-metrics > div + div, .library-metrics > div:nth-child(3), .library-metrics > div:nth-child(4) { border-left: 0; border-top: 1px solid var(--line); }
  .library-hashes { grid-template-columns: auto minmax(0, 1fr); }
  .library-card > footer { flex-direction: column; }
  .recipe-grid { grid-template-columns: 1fr; }
  .recipe-grid article + article, .recipe-grid article:nth-child(3), .recipe-grid article:nth-child(4) { border-left: 0; border-top: 1px solid var(--line); }
  footer { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .001ms !important; }
}

/* API builder controls share the existing index page typography and spacing. */
#builder-settings { margin: 0; padding: 0; border: 0; min-width: 0; }
#builder-api-key, #relevance-cutoff { width: 100%; padding: .8rem; background: var(--panel, #0c100d); color: inherit; border: 1px solid var(--line); font: inherit; }
.check-label { display: flex; align-items: flex-start; gap: .7rem; margin: 1rem 0; line-height: 1.55; }
.check-label input { flex: none; margin-top: .3rem; }
#creator-disclosure p { margin-bottom: .9rem; }
#catalog-status { margin-bottom: 1.25rem; }
#result-exclusions { font-size: .85rem; }
#open-basket { margin-top: 1rem; }
.builder-shell button:not(.build-button) { min-height: 44px; padding: .7rem 1rem; margin: .4rem 0; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); color: var(--ink); cursor: pointer; }
.builder-shell button:not(.build-button):hover { border-color: var(--lime); }
.builder-shell button:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
button:disabled { opacity: .5; cursor: not-allowed; }

#builder-wallet-status, .builder-shell button { overflow-wrap: anywhere; max-width: 100%; }

/* Basket handoff keeps allocation targets visible beside each Felix market. */
.felix-trade-leg { display: grid; gap: .65rem; padding: 1.1rem 0; border-top: 1px solid var(--line); }
.felix-trade-leg h3, .felix-trade-leg p { margin: 0; }
.felix-trade-leg a { overflow-wrap: anywhere; }
.felix-trade-leg input { width: 100%; min-width: 0; }
#felix-trades, .builder-shell > section { min-width: 0; }

#my-indexes-key { width: 100%; padding: .8rem; background: var(--panel, #0c100d); color: inherit; border: 1px solid var(--line); font: inherit; }
.saved-index-card { padding: 1.3rem 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.saved-index-card h2 { margin-top: 0; }
.saved-index-card a { display: inline-block; margin-right: 1rem; }

/* Shared saved, preview and public index inspection. */
.index-holdings { margin: 28px 0; min-width: 0; }
.index-holdings input, .library-controls input, .library-controls select { width: 100%; padding: 12px; background: #101510; color: inherit; border: 1px solid #334333; border-radius: 6px; }
.holding-detail { border-bottom: 1px solid #283528; }
.holding-detail > summary { display: grid; grid-template-columns: 70px minmax(0,1fr) 70px; gap: 12px; padding: 16px 4px; cursor: pointer; align-items: center; }
.holding-detail > summary > span { color: #b4c4b4; overflow-wrap: anywhere; }
.holding-detail > summary > b { text-align: right; }
.holding-detail > summary::after { content: none; }
.holding-content { padding: 4px 12px 20px; line-height: 1.65; }
.holding-content a { overflow-wrap: anywhere; }
.index-holdings .weight-row { grid-template-columns: 70px minmax(0,1fr) 70px; }
.library-controls { display: flex; align-items: end; gap: 18px; flex-wrap: wrap; margin: 24px 0; }
.library-controls label { flex: 1; min-width: 180px; display: grid; gap: 8px; }
.library-row summary { cursor: pointer; }
.library-row-detail { overflow-wrap: anywhere; }
.saved-index-card { min-width: 0; }
.builder-summary { min-width: 0; }
#result-holdings { width: 100%; }
@media(max-width: 760px) { .builder-grid:has(#index-result:not([hidden])) { grid-template-columns: 1fr; } .library-controls { align-items: stretch; } .holding-detail > summary { gap: 8px; grid-template-columns: 60px minmax(0,1fr) 66px; font-size: 13px; } }
.viewing-preview .hero, .viewing-preview .contract-card, .viewing-preview #builder-settings, .viewing-preview #index-builder > section[aria-label="Wallet connection"] { display: none; }
.viewing-preview .builder-grid { grid-template-columns: minmax(0,1fr); }
.index-signed-in #index-account-fields, .viewing-preview.index-signed-in #run-index { display: none; }
.result-actions { display:flex; flex-wrap:wrap; gap:12px; align-items:center; padding:16px 0; }
.result-actions .field-note { width:100%; margin:0; }
.result-actions .build-button { width:auto; }
#new-preview { margin-right: 12px; }
#wallet-execution { min-width:0; }
#wallet-execution p { overflow-wrap:anywhere; }
.felix-trade-leg { grid-template-columns:minmax(0,1fr);min-width:0;overflow-wrap:anywhere; }
.builder-shell p { overflow-wrap:anywhere; }
.skip { clip-path:inset(100%); }
.skip:focus { clip-path:none; }
#basket-amount, #basket-slippage, #basket-api-key { display:block;width:100%;padding:14px;margin-bottom:18px;border:1px solid var(--line);border-radius:8px;background:var(--surface-2);color:var(--ink); }
#buy-index-wallet { display:block;width:100%;background:var(--lime);color:#101500;font-weight:700;border-color:var(--lime); }
.basket-weights > summary, #creator-tools > summary { padding:16px 0;cursor:pointer;font-weight:600; }
#creator-tools { margin-top:22px;border-top:1px solid var(--line); }
#creator-tools .check-label { font-size:14px;color:var(--muted); }
#wallet-execution > h2 { margin-top:24px; }
