:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #eef2ff;
  background: #070811;
  font-synthesis: none;
  --canvas: #070811;
  --surface: #10121e;
  --surface-raised: #151827;
  --line: #292d42;
  --muted: #9da4bb;
  --indigo: #8c86ff;
  --indigo-bright: #b1adff;
  --green: #62ddb5;
  --amber: #f1c56c;
  --red: #ff8d91;
}

* { box-sizing: border-box; }
html { overflow-x: hidden; scroll-behavior: smooth; }
body { min-width: 320px; min-height: 100vh; margin: 0; overflow-x: hidden; background: radial-gradient(circle at 55% -15%, rgba(88, 79, 200,.24), transparent 38rem), var(--canvas); }
button, textarea, code, pre { font: inherit; }
a { color: inherit; }
.skip-link { position: fixed; z-index: 10; top: .75rem; left: .75rem; padding: .7rem 1rem; transform: translateY(-150%); border-radius: 8px; color: #080914; background: #fff; }
.skip-link:focus { transform: none; }

.site-header { display: flex; align-items: center; justify-content: space-between; width: min(1240px, calc(100% - 2.5rem)); margin: 0 auto; padding: 1.25rem 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; }
.brand-group { display: flex; align-items: center; gap: 1rem; }
.parent-brand { display: inline-flex; align-items: center; gap: .4rem; padding-left: 1rem; border-left: 1px solid var(--line); color: #aeb3c5; font-size: .68rem; text-decoration: none; }
.parent-brand img { width: 1.7rem; height: 1.7rem; border-radius: 5px; }
.parent-brand:hover { color: #fff; }
.brand-mark, .authority-icon { display: grid; place-items: center; width: 2.35rem; height: 2.35rem; border: 1px solid #7974dd; border-radius: 10px; color: #dddafe; background: linear-gradient(145deg, #373274, #171832); font-weight: 850; }
.brand strong, .brand small { display: block; }
.brand small { margin-top: .1rem; color: var(--muted); font-size: .67rem; letter-spacing: .04em; }
nav { display: flex; align-items: center; gap: 1.5rem; color: var(--muted); font-size: .82rem; }
nav a { text-decoration: none; }
nav a:hover { color: #fff; }
.local-badge { display: inline-flex; align-items: center; gap: .5rem; padding: .42rem .72rem; border: 1px solid var(--line); border-radius: 999px; color: #cbd0df; }
.local-badge span { width: .45rem; height: .45rem; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(241,197,108,.1); }
.auth-controls { display: flex; align-items: center; gap: .65rem; }
.auth-controls span { max-width: 18rem; overflow: hidden; color: #cbd0df; text-overflow: ellipsis; white-space: nowrap; }
.auth-controls span.error { color: var(--red); }
.compact-button { min-height: 36px; padding: .45rem .7rem; border-radius: 8px; font-size: .72rem; }

.shell { width: min(1180px, calc(100% - 2.5rem)); margin: 0 auto; padding: 2.5rem 0 5rem; }
.hero { max-width: 1060px; margin-bottom: 2rem; }
.eyebrow, .section-label { margin: 0 0 .55rem; color: var(--indigo-bright); font-size: .68rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.section-label.warning { color: var(--amber); }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 1060px; margin-bottom: .9rem; font-size: clamp(2.25rem, 4.4vw, 4.25rem); line-height: 1; letter-spacing: -.055em; }
h1 span { color: #aaa6ff; }
h2 { margin-bottom: .55rem; font-size: clamp(1.35rem, 2.5vw, 2rem); letter-spacing: -.025em; }
.intro { max-width: 710px; color: #b0b6ca; font-size: 1.08rem; line-height: 1.7; }
.process { display: flex; max-width: 650px; margin: 1.25rem 0 0; padding: 0; list-style: none; color: #777e96; font-size: .75rem; }
.process li { position: relative; display: flex; align-items: center; flex: 1; gap: .45rem; }
.process li:not(:last-child)::after { content: ""; height: 1px; flex: 1; margin: 0 .65rem; background: #30334a; }
.process span { display: grid; place-items: center; width: 1.45rem; height: 1.45rem; border: 1px solid #40445d; border-radius: 50%; font-size: .65rem; }
.process .current { color: #e9e8ff; }
.process .current span { border-color: var(--indigo); background: rgba(140,134,255,.2); }
.process .complete { color: var(--green); }
.process .complete span { border-color: rgba(98,221,181,.55); background: rgba(98,221,181,.12); }

.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(270px, .7fr); gap: 1.25rem; align-items: start; }
.composer-panel, .instrument-panel, .result-panel, .raw-card { border: 1px solid var(--line); border-radius: 20px; background: rgba(16,18,30,.9); box-shadow: 0 28px 80px rgba(0,0,0,.22); }
.composer-panel { padding: clamp(1.35rem, 4vw, 2.25rem); }
.authority-heading { display: flex; align-items: center; gap: .85rem; }
.authority-heading h2 { margin: 0; }
.authority-heading .section-label { margin-bottom: .25rem; }
.authority-icon.ai { color: #dad7ff; }
.authority-icon.engine { border-color: #397d6b; color: #b8ffea; background: linear-gradient(145deg, #215848, #112620); }
.section-note { max-width: 42rem; margin-bottom: 0; color: var(--muted); line-height: 1.6; }
.composer-panel > .section-note { margin: 1.2rem 0 1.5rem; }
.composer-panel label:not(.confirmation) { display: block; margin-bottom: .5rem; color: #d4d8e5; font-size: .82rem; font-weight: 750; }
textarea { width: 100%; min-height: 9rem; padding: 1rem 1.1rem; resize: vertical; border: 1px solid #363a53; border-radius: 14px; outline: 0; color: #f0f1fa; background: #0a0c15; line-height: 1.6; }
textarea:focus { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(140,134,255,.14); }
.action-row { display: flex; align-items: center; gap: 1rem; margin-top: .9rem; }
.scope-note { margin: 0; color: #777e96; font-size: .72rem; }
button { min-height: 46px; padding: .75rem 1.1rem; border: 0; border-radius: 11px; color: #0d0d1b; background: linear-gradient(135deg, #aaa6ff, #817af0); font-weight: 800; cursor: pointer; }
@media (hover: hover) and (pointer: fine) {
  button:hover { filter: brightness(1.08); }
}
button:focus-visible, summary:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
button:disabled { cursor: not-allowed; opacity: .48; }
.request-state { min-height: 1.4rem; margin: .9rem 0 0; color: #7f879f; font-size: .78rem; }
.request-state.error { color: var(--red); }

.instrument-panel { overflow: hidden; }
.instrument-top, .fixed-test { padding: 1.5rem; }
.instrument-top { background: linear-gradient(145deg, rgba(50,47,100,.35), transparent); }
.instrument-top p:last-child, .fixed-test p { color: var(--muted); line-height: 1.55; }
.trust-list { border-block: 1px solid var(--line); }
.trust-list > div { display: flex; align-items: center; gap: .8rem; padding: .85rem 1.5rem; }
.trust-list > div + div { border-top: 1px solid rgba(255,255,255,.05); }
.trust-icon { display: grid; place-items: center; flex: 0 0 auto; width: 1.8rem; height: 1.8rem; border-radius: 8px; font-size: .72rem; font-weight: 850; }
.trust-icon.proposal { color: #dcd9ff; background: rgba(140,134,255,.18); }
.trust-icon.confirm { color: #ffe4ab; background: rgba(241,197,108,.14); }
.trust-icon.engine { color: #baffea; background: rgba(98,221,181,.14); }
.trust-list p { margin: 0; }
.trust-list strong, .trust-list small { display: block; }
.trust-list small { margin-top: .15rem; color: #858ca2; font-size: .7rem; }
code { color: #dbd9ff; }
.secondary-button { width: 100%; border: 1px solid #454963; color: #e8e9f4; background: #181b2a; }
.saved-workspace { margin-top: 1.25rem; padding: 1.25rem; border: 1px solid var(--line); border-radius: 20px; background: rgba(16,18,30,.9); }
.saved-workspace .section-heading { align-items: center; margin-bottom: .5rem; }
.saved-workspace .secondary-button { width: auto; }
.saved-heading-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .55rem; }
.saved-list { display: grid; gap: .55rem; margin-top: .85rem; }
.saved-list[hidden] { display: none; }
.usage-state { margin: .8rem 0 0; color: #baffea; font-size: .72rem; }
.saved-item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem; border: 1px solid var(--line); border-radius: 12px; background: #0c0e18; }
.saved-item strong, .saved-item small { display: block; }
.saved-item small { margin-top: .25rem; color: #81889f; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .66rem; overflow-wrap: anywhere; }
.saved-actions { display: flex; gap: .45rem; flex: 0 0 auto; }
.saved-actions button { min-height: 34px; padding: .4rem .65rem; }
.danger-button { border: 1px solid rgba(255,141,145,.45); color: #ffc8ca; background: rgba(255,141,145,.08); }

.candidate-panel { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.boundary-banner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .65rem .8rem; border-radius: 9px; font-size: .72rem; }
.boundary-banner strong { text-transform: uppercase; letter-spacing: .08em; }
.boundary-banner span { color: #aeb3c5; }
.boundary-banner.proposal { color: #d9d6ff; background: rgba(140,134,255,.12); }
.boundary-banner.confirmation-title { padding: 0 0 .75rem; color: #ffe2a6; }
.candidate-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1.25rem 0; }
.candidate-columns ul, .explanation-panel ul, .failures-card ul { margin: 0; padding-left: 1.2rem; color: #c9cddc; line-height: 1.55; }
.candidate-panel details { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #0b0d17; }
summary { cursor: pointer; }
.candidate-panel summary { padding: .85rem 1rem; color: #c9cddd; font-size: .8rem; font-weight: 750; }
.confirmation-box { margin-top: 1rem; padding: 1rem; border: 1px solid rgba(241,197,108,.28); border-radius: 13px; background: rgba(241,197,108,.04); }
.confirmation { display: flex; align-items: flex-start; gap: .65rem; margin: .3rem 0 1rem; color: #dfe1ea; font-size: .82rem; line-height: 1.5; }
.confirmation input { margin-top: .2rem; accent-color: var(--amber); }

.result-panel { margin-top: 1.25rem; padding: clamp(1.35rem, 4vw, 2.25rem); }
.result-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.outcome { margin: 0; padding: .45rem .75rem; border-radius: 999px; font-size: .78rem; font-weight: 800; }
.outcome.success { color: #baffea; background: rgba(98,221,181,.13); }
.outcome.failure { color: #ffc8ca; background: rgba(255,141,145,.13); }
.provenance-strip { display: grid; grid-template-columns: 1.4fr 1fr .6fr; gap: 1px; margin: 1.5rem 0 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--line); }
.provenance-strip div { min-width: 0; padding: .85rem 1rem; background: #0c0e18; }
.provenance-strip span, .provenance-strip strong { display: block; }
.provenance-strip span { margin-bottom: .3rem; color: #7f879d; font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; }
.provenance-strip strong { overflow-wrap: anywhere; color: #cdd1df; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .72rem; font-weight: 500; }
.explanation-panel { margin-top: 1.2rem; padding: 1rem; border: 1px solid rgba(140,134,255,.2); border-radius: 13px; background: rgba(140,134,255,.04); }
.explanation-panel small { display: block; margin-top: .25rem; color: #8188a0; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .68rem; overflow-wrap: anywhere; }
.explanation-panel > .section-note { margin: .85rem 0 1rem; }
.explanation-conversation { display: grid; gap: .75rem; }
.conversation-message { padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 12px; background: #0b0d17; }
.conversation-message.user { margin-left: 12%; border-color: rgba(140,134,255,.3); background: rgba(140,134,255,.08); }
.conversation-message.assistant { margin-right: 8%; border-color: rgba(83,208,166,.22); }
.conversation-message > strong { color: #aaa6ff; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; }
.conversation-message > p { margin: .45rem 0 0; color: #d7dae5; line-height: 1.6; white-space: pre-wrap; }
.explanation-form { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.billing-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; margin: .8rem 0 1rem; }
.billing-actions span { color: #81889f; font-size: .72rem; }
.explanation-form > label { display: block; margin-bottom: .5rem; color: #d4d8e5; font-size: .8rem; font-weight: 750; }
.explanation-input-row { display: grid; grid-template-columns: 1fr auto; gap: .7rem; align-items: end; }
.explanation-input-row textarea { min-height: 4.7rem; }
.explanation-input-row button { min-width: 8.5rem; }
.numerical-section { margin-top: 2.4rem; }
.numerical-summary { display: grid; grid-template-columns: 1.2fr .8fr .8fr 1fr; gap: 1px; margin: 1rem 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--line); }
.numerical-summary div { min-width: 0; padding: .8rem .9rem; background: #0c0e18; }
.numerical-summary span, .numerical-summary strong { display: block; }
.numerical-summary span { margin-bottom: .3rem; color: #7f879d; font-size: .62rem; letter-spacing: .07em; text-transform: uppercase; }
.numerical-summary strong { overflow-wrap: anywhere; color: #d8dbe7; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .72rem; }
.plot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.plot-card { min-width: 0; padding: 1rem; border: 1px solid var(--line); border-radius: 15px; background: #0c0e18; }
.plot-card.wide { grid-column: 1 / -1; }
.plot-card h3 { margin-bottom: .5rem; font-size: .9rem; }
.chart { width: 100%; overflow: hidden; border-radius: 9px; background: #080a12; }
.chart svg { display: block; width: 100%; height: auto; }
.chart-grid { stroke: #202337; stroke-width: 1; }
.chart-axis { stroke: #555b75; stroke-width: 1.2; }
.chart-line { fill: none; stroke: var(--green); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart-label { fill: #858ca2; font: 11px ui-monospace, SFMono-Regular, Consolas, monospace; }
.sample-data { margin-top: .8rem; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #0c0e18; }
.sample-data summary { padding: .85rem 1rem; color: #c9cddd; font-size: .78rem; font-weight: 750; }
.sample-data > p { margin: .75rem 1rem 1rem; color: #81889f; font-size: .68rem; }
.table-scroll { overflow-x: auto; border-block: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .68rem; }
th, td { padding: .55rem .8rem; border-bottom: 1px solid rgba(255,255,255,.05); text-align: right; white-space: nowrap; }
th { color: #9097ac; background: #090b14; }
td { color: #cdd1df; }
.equations-section { margin-top: 2.4rem; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 1rem; }
.section-heading h2 { margin-bottom: 0; }
.section-heading .section-note { max-width: 34rem; font-size: .8rem; }
.equation-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.equation-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: #0c0e18; }
.equation-card.verified { border-color: rgba(98,221,181,.28); }
.equation-card.blocked { border-color: rgba(255,141,145,.35); }
.equation-header { display: flex; align-items: center; justify-content: space-between; gap: .7rem; padding: 1rem 1rem 0; }
.equation-header h3 { margin: 0; font-size: .9rem; }
.proof-badge { flex: 0 0 auto; padding: .3rem .5rem; border-radius: 999px; font-size: .6rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.proof-badge.verified { color: #baffea; background: rgba(98,221,181,.14); }
.proof-badge.blocked { color: #ffc8ca; background: rgba(255,141,145,.14); }
.equation-display { min-height: 7rem; padding: 1.6rem 1rem; overflow-x: auto; color: #f6f5ff; font-size: clamp(.9rem, 2vw, 1.15rem); }
.latex-fallback { white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.blocked-message, .empty-message { margin: 1.2rem 1rem; color: var(--red); }
.equation-evidence { border-top: 1px solid var(--line); }
.equation-evidence summary { padding: .8rem 1rem; color: #9da4bb; font-size: .75rem; font-weight: 750; }
.evidence-body { display: grid; gap: .65rem; padding: 0 1rem 1rem; margin: 0; }
.evidence-body div { display: grid; grid-template-columns: minmax(7rem,.3fr) 1fr; gap: .7rem; }
.evidence-body dt { color: #7f879d; font-size: .7rem; }
.evidence-body dd { margin: 0; overflow-wrap: anywhere; color: #cdd1df; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .68rem; line-height: 1.5; }
.failures-card { margin-top: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 13px; background: #0c0e18; }

.raw-card { margin-top: 1rem; overflow: hidden; }
.raw-card summary { padding: 1rem 1.2rem; }
.raw-card summary span, .raw-card summary strong, .raw-card summary small { display: block; }
.raw-card summary small { margin-top: .25rem; color: #81889f; font-size: .7rem; font-weight: 500; }
.capability-card { margin-top: 1.25rem; box-shadow: none; }
.manifest-state { margin: 0; padding: 0 1.2rem 1rem; color: #81889f; font-size: .75rem; }
.manifest-state.error { color: var(--red); }
.capability-preview { margin-top: 1.25rem; padding: clamp(1.35rem, 4vw, 2.25rem); border: 1px solid rgba(140,134,255,.3); border-radius: 20px; background: linear-gradient(135deg, rgba(44,40,94,.55), rgba(16,18,30,.92)); }
.capability-preview h2 { max-width: 48rem; }
.capability-preview > p:not(.section-label) { max-width: 43rem; color: #b7bccd; line-height: 1.65; }
.button-link { display: inline-flex; align-items: center; gap: .55rem; margin-top: .6rem; padding: .75rem 1.1rem; border-radius: 11px; color: #0d0d1b; background: linear-gradient(135deg, #aaa6ff, #817af0); font-size: .82rem; font-weight: 800; text-decoration: none; }
@media (hover: hover) and (pointer: fine) {
  .button-link:hover { filter: brightness(1.08); }
}
pre { max-height: 34rem; margin: 0; padding: 1.2rem; overflow: auto; border-top: 1px solid var(--line); color: #bdc2d1; background: #080a12; font-size: .7rem; line-height: 1.55; }
footer { padding: 1.5rem; border-top: 1px solid rgba(255,255,255,.06); color: #656c82; text-align: center; font-size: .7rem; }
footer p { margin: 0; }
.footer-links { justify-content: center; gap: 1rem; margin-top: .75rem; }
.footer-links a { color: #aeb3c5; text-decoration: underline; text-underline-offset: .2rem; }

@media (max-width: 850px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .instrument-panel { display: grid; grid-template-columns: 1fr 1fr; }
  .instrument-top { grid-column: 1 / -1; }
  .trust-list { border-bottom: 0; border-left: 0; }
  .fixed-test { border-left: 1px solid var(--line); }
  .equation-list { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  button { touch-action: manipulation; }
  html { scroll-behavior: auto; }
  .site-header, .shell { width: min(100% - 1.25rem, 1180px); }
  .site-header nav a { display: none; }
  .local-badge, .auth-controls span { display: none; }
  .brand small { display: none; }
  .parent-brand { padding-left: .65rem; font-size: 0; }
  .shell { padding-top: 2rem; }
  h1 { font-size: clamp(2.25rem, 11vw, 3.4rem); }
  .process li { gap: .25rem; font-size: .65rem; }
  .process li:not(:last-child)::after { margin: 0 .25rem; }
  .instrument-panel { display: block; }
  .fixed-test { border-top: 1px solid var(--line); border-left: 0; }
  .candidate-columns, .provenance-strip { grid-template-columns: 1fr; }
  .numerical-summary, .plot-grid { grid-template-columns: 1fr; }
  .plot-card.wide { grid-column: auto; }
  .action-row, .result-header, .section-heading, .boundary-banner { align-items: stretch; flex-direction: column; }
  .explanation-input-row { grid-template-columns: 1fr; }
  .conversation-message.user, .conversation-message.assistant { margin-inline: 0; }
  .saved-item { align-items: stretch; flex-direction: column; }
  .saved-actions { flex-wrap: wrap; }
  .scope-note { padding-left: .2rem; }
  .evidence-body div { grid-template-columns: 1fr; gap: .2rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
