/* KTAPEOUT site styles — direction A "Silicon Blueprint". Requires tokens.css.
   Layers: base (elements) → components (shared UI) → pages (page-specific). No overrides outside layers. */
@layer base, components, pages;

@layer base {
  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
  body {
    margin: 0;
    background-color: var(--paper);
    background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 16px 16px;
    color: var(--text);
    font: 400 var(--fs-16)/1.6 var(--sans);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }
  h1, h2, h3 { margin: 0; color: var(--ink); font-weight: 720; text-wrap: balance; }
  p { margin: 0; text-wrap: pretty; }
  a { color: inherit; }
  img, svg { display: block; max-width: 100%; }
  code, pre, kbd { font-family: var(--mono); }
  :focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
  [hidden] { display: none !important; }
  @media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; } }
}

@layer components {
  .skip-link { position: absolute; left: var(--s-2); top: -48px; z-index: 10; padding: 8px 12px; border-radius: var(--radius); background: var(--ink); color: #fff; }
  .skip-link:focus { top: var(--s-2); }

  .shell { max-width: var(--max); margin: 0 auto; padding: 0 var(--s-4); }

  /* Header */
  .site-header { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: 20px 0 18px; border-bottom: 1px solid var(--line); }
  .brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
  .brand img { width: 30px; height: 30px; }
  .brand b { color: var(--ink); font-size: var(--fs-19); font-weight: 760; letter-spacing: .05em; }
  .nav { display: flex; align-items: center; gap: 2px; font-size: var(--fs-14); font-weight: 520; white-space: nowrap; }
  .nav a { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 8px; color: var(--text); text-decoration: none; transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease); }
  .nav a:hover { background: rgba(17, 16, 58, .05); color: var(--ink); }
  .nav a[aria-current] { background: rgba(17, 16, 58, .07); color: var(--ink); }
  .nav .nav-status { margin-left: 6px; border: 1px solid var(--line); }
  .status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--signal-mark); }

  /* Annotation label: the one place mono small caps are used */
  .label { margin: 0; color: var(--muted); font: 600 var(--fs-12)/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; }

  /* Actions */
  .btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 13px 20px; border: 1px solid var(--line-strong); border-radius: var(--radius-control); background: var(--surface); color: var(--ink); font: 600 15px/1.2 var(--sans); text-decoration: none; transition: border-color var(--fast) var(--ease), background-color var(--fast) var(--ease), transform var(--fast) var(--ease); }
  .btn:hover { border-color: var(--ink); }
  .btn:active { transform: translateY(1px); }
  .btn-primary { border-color: var(--ink); background: var(--ink); color: #fff; }
  .btn-primary:hover { background: #24225e; border-color: #24225e; }
  .link { color: var(--ink); font-weight: 620; text-decoration: none; }
  .link:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 4px; }

  /* Panel with registration marks (primary clickable cards only) */
  .panel { position: relative; padding: var(--s-3); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
  .panel-marked::before, .panel-marked::after { content: ""; position: absolute; width: 10px; height: 10px; border: 0 solid var(--ink); pointer-events: none; transition: width var(--fast) var(--ease), height var(--fast) var(--ease); }
  .panel-marked::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
  .panel-marked::after { right: -1px; bottom: -1px; border-width: 0 2px 2px 0; }
  .panel-link { transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease); }
  .panel-link:hover { border-color: var(--line-strong); box-shadow: 0 8px 24px rgba(17, 16, 58, .06); }
  .panel-link:hover::before, .panel-link:hover::after { width: 16px; height: 16px; }
  .panel-link:focus-within { outline: 2px solid var(--brand); outline-offset: 3px; }
  .stretched::after { content: ""; position: absolute; inset: 0; }
  .stretched:focus-visible { outline: none; }

  /* Tags and status */
  .tags { display: flex; flex-wrap: wrap; gap: 6px; }
  .tag { padding: 3px 9px; border-radius: 999px; background: rgba(17, 16, 58, .055); color: var(--text); font-size: var(--fs-12); font-weight: 560; }
  .status { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 560; }
  .status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
  .status-ok { background: var(--signal-tint); color: var(--signal); }
  .status-wait { background: var(--warn-tint); color: var(--warn); }
  .status-bad { background: var(--danger-tint); color: var(--danger); }

  /* Title block: engineering-drawing cell grid */
  .title-block { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0; padding: 0; list-style: none; border: 1px solid var(--ink); border-radius: var(--radius); background: var(--surface); }
  .title-block > * { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 14px 18px 16px; border-left: 1px solid var(--line-strong); }
  .title-block > :first-child { border-left: 0; }
  .title-block b { color: var(--ink); font-size: var(--fs-16); font-weight: 680; }
  .title-block .label { font-size: 11px; }

  /* Code */
  .code { margin: 0; border-radius: var(--radius); background: var(--code-bg); color: var(--code-text); overflow: hidden; }
  .code-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid rgba(255, 255, 255, .1); color: #b9b7e2; font: 600 var(--fs-12)/1.4 var(--mono); letter-spacing: .04em; }
  .code pre { margin: 0; padding: 18px 20px; overflow-x: auto; font-size: 13.5px; line-height: 1.75; }
  .copy { padding: 5px 11px; border: 1px solid rgba(255, 255, 255, .22); border-radius: 8px; background: transparent; color: #fff; font: 600 var(--fs-12)/1.2 var(--sans); cursor: pointer; transition: background-color var(--fast) var(--ease); }
  .copy:hover { background: rgba(255, 255, 255, .1); }

  /* Section heading */
  .section { margin-top: var(--s-12); }
  .section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-2); margin-bottom: var(--s-3); }
  .section-head h2 { margin-top: 8px; font-size: clamp(26px, 3vw, var(--fs-32)); line-height: 1.15; letter-spacing: -.025em; }

  /* Footer */
  .site-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; margin-top: var(--s-12); padding: var(--s-3) 0 var(--s-6); border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
  .site-footer a { color: var(--text); text-decoration: none; }
  .site-footer a:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }

  /* Die diagram (shared illustration) */
  .die { width: 100%; height: auto; }
  .die .die-body { fill: var(--surface); stroke: var(--ink); stroke-width: 1.5; }
  .die .die-grid { fill: none; stroke: rgba(17, 16, 58, .07); stroke-width: 1; }
  .die .pin { stroke: var(--ink); stroke-width: 2; }
  .die .trace { fill: none; stroke: var(--signal-mark); stroke-width: 2; }
  .die .block rect { fill: var(--surface); stroke: var(--ink); stroke-width: 1.25; }
  .die .core rect { fill: var(--ink); }
  .die text { fill: var(--ink); font: 600 12px/1 var(--mono); letter-spacing: .06em; text-anchor: middle; dominant-baseline: middle; }
  .die .core text { fill: #fff; }
  .die .open circle { fill: var(--signal-mark); }
  .die .open path { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: square; }
  .die .note { fill: var(--muted); font-weight: 500; font-size: 11px; text-anchor: start; }

  @media (max-width: 760px) {
    .shell { padding: 0 18px; }
    .site-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .nav { width: 100%; overflow-x: auto; scrollbar-width: none; margin: 0 -6px; padding: 0 6px; }
    .nav::-webkit-scrollbar { display: none; }
    .nav a { padding: 8px 7px; }
    .nav .nav-status { margin-left: 2px; }
    .title-block { grid-template-columns: 1fr 1fr; }
    .title-block > :nth-child(3) { border-left: 0; }
    .title-block > :nth-child(n+3) { border-top: 1px solid var(--line-strong); }
    .section { margin-top: var(--s-8); }
    .section-head { flex-direction: column; align-items: flex-start; }
  }
}

@layer pages {
  /* Home */
  .home-hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: var(--s-6); align-items: center; padding: 64px 0 var(--s-6); }
  .home-hero h1 { margin: 14px 0 18px; font-size: clamp(40px, 5.2vw, var(--fs-58)); line-height: 1.03; letter-spacing: -.035em; font-weight: 760; }
  .home-hero .lede { max-width: 540px; color: var(--muted); font-size: clamp(17px, 1.6vw, var(--fs-19)); line-height: 1.6; }
  .home-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
  .home-hero figure { margin: 0; }
  .home-hero figcaption { margin-top: 10px; text-align: center; }

  .app-grid, .step-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-2); }
  .app-card { display: flex; flex-direction: column; }
  .app-mark { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--ink); font: 700 14px/1 var(--mono); letter-spacing: .04em; }
  .app-card h3 { margin: 18px 0 6px; font-size: var(--fs-19); letter-spacing: -.01em; }
  .app-card p { flex: 1; color: var(--muted); font-size: 15px; }
  .app-card .tags { margin-top: 18px; }
  .app-card .link { margin-top: 20px; }

  .step-grid { margin: 0; padding: 0; list-style: none; }
  .step .label { margin-top: 16px; }
  .step h3 { margin: 14px 0 8px; font-size: var(--fs-19); }
  .step p:not(.label) { margin-bottom: 16px; color: var(--muted); font-size: 15px; }
  .step img { width: 36px; height: 36px; }
  .step .link { font-size: var(--fs-14); }

  .build { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: var(--s-6); align-items: center; }
  .build h2 { margin-top: 8px; font-size: clamp(26px, 3vw, var(--fs-32)); line-height: 1.15; letter-spacing: -.025em; }
  .build > div > p { margin-top: 14px; color: var(--muted); }
  .link-list { display: grid; gap: 10px; margin: 22px 0 0; padding: 0; list-style: none; font-size: 15px; }

  .modes { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); }
  .modes h3 { margin-bottom: 8px; font-size: 18px; }
  .modes p { color: var(--muted); font-size: 15px; }

  .resources > a { text-decoration: none; transition: background-color var(--fast) var(--ease); }
  .resources > a:hover { background: rgba(17, 16, 58, .03); }
  .resources > a span:last-child { color: var(--muted); font-size: var(--fs-14); }

  @media (max-width: 980px) {
    .home-hero { grid-template-columns: 1fr; padding-top: 40px; }
    .home-hero figure { max-width: 520px; }
    .app-grid, .step-grid { grid-template-columns: 1fr 1fr; }
    .build { grid-template-columns: 1fr; gap: 28px; }
  }
  @media (max-width: 760px) {
    .home-actions .btn { flex: 1 1 100%; }
    .app-grid, .step-grid, .modes { grid-template-columns: 1fr; }
  }
}

@layer components {
  .visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

  /* Long-form reading: docs, platform and other prose pages */
  .prose { color: var(--text); font-size: var(--fs-16); line-height: 1.75; }
  .prose > * + * { margin-top: 1em; }
  .prose h1 { margin: 0 0 .4em; font-size: clamp(32px, 4vw, var(--fs-44)); line-height: 1.1; letter-spacing: -.03em; }
  .prose h2 { margin-top: 2.2em; padding-top: .9em; border-top: 1px solid var(--line); font-size: var(--fs-24); line-height: 1.25; letter-spacing: -.015em; scroll-margin-top: 24px; }
  .prose h3 { margin-top: 1.8em; font-size: var(--fs-19); line-height: 1.3; scroll-margin-top: 24px; }
  .prose h4 { margin-top: 1.5em; color: var(--ink); font-size: var(--fs-16); }
  .prose a { color: var(--ink); font-weight: 560; text-decoration: underline; text-decoration-color: rgba(103, 67, 232, .45); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
  .prose a:hover { color: var(--brand); text-decoration-color: currentColor; }
  .prose ul, .prose ol { padding-left: 1.3em; }
  .prose li + li { margin-top: .35em; }
  .prose li::marker { color: var(--muted); }
  .prose strong { color: var(--ink); font-weight: 650; }
  .prose code { padding: .12em .38em; border-radius: 3px; background: rgba(17, 16, 58, .065); color: var(--ink); font-size: .88em; }
  .prose pre { margin-top: 1.25em; padding: 18px 20px; border-radius: var(--radius); background: var(--code-bg); color: var(--code-text); overflow-x: auto; font-size: 13.5px; line-height: 1.7; }
  .prose pre code { padding: 0; background: none; color: inherit; font-size: inherit; }
  .prose hr { margin: 2.2em 0; border: 0; border-top: 1px solid var(--line); }
  .prose blockquote { margin: 1.4em 0; padding: 12px 16px; border-left: 2px solid var(--ink); background: var(--surface); color: var(--text); }
  .prose table { display: block; width: 100%; margin-top: 1.4em; border-collapse: collapse; overflow-x: auto; font-size: 14.5px; line-height: 1.55; }
  .prose th, .prose td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
  .prose th { border-bottom-color: var(--ink); color: var(--ink); font-weight: 650; white-space: nowrap; }
  .prose tr:hover td { background: rgba(17, 16, 58, .025); }
}

@layer pages {
  /* Documentation */
  .docs-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr) 200px; gap: var(--s-6); align-items: start; margin-top: var(--s-4); }
  .docs-sidebar { position: sticky; top: var(--s-3); max-height: calc(100vh - 48px); overflow-y: auto; padding-right: 6px; scrollbar-width: thin; }
  .docs-nav { font-size: var(--fs-14); }
  .docs-filter input { width: 100%; margin-bottom: var(--s-2); padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; }
  .docs-filter input:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
  .docs-group + .docs-group { margin-top: var(--s-3); }
  .docs-group .label { margin-bottom: 6px; font-size: 11px; }
  .docs-group ul { margin: 0; padding: 0; list-style: none; }
  .docs-group a { display: block; padding: 5px 10px; border-left: 1px solid var(--line); color: var(--text); line-height: 1.4; text-decoration: none; transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease); }
  .docs-group a:hover { color: var(--ink); border-left-color: var(--line-strong); }
  .docs-group a[aria-current="page"] { border-left: 2px solid var(--ink); padding-left: 9px; color: var(--ink); font-weight: 650; background: rgba(17, 16, 58, .04); }
  .docs-main { min-width: 0; max-width: 760px; }
  .docs-crumb { margin-bottom: var(--s-2); color: var(--muted); font-size: var(--fs-14); }
  .docs-crumb a { color: var(--muted); text-decoration: none; }
  .docs-crumb a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
  .docs-toc { position: sticky; top: var(--s-3); font-size: 13.5px; }
  .docs-toc ul { margin: 8px 0 0; padding: 0; list-style: none; border-left: 1px solid var(--line); }
  .docs-toc a { display: block; padding: 4px 12px; color: var(--muted); line-height: 1.4; text-decoration: none; }
  .docs-toc a:hover { color: var(--ink); }
  .docs-pager { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); margin-top: var(--s-8); }
  .docs-pager a { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); font-weight: 620; text-decoration: none; transition: border-color var(--fast) var(--ease); }
  .docs-pager a:hover { border-color: var(--ink); }
  .docs-pager .next { text-align: right; }
  .docs-menu { display: none; margin-top: var(--s-2); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
  .docs-menu summary { padding: 12px 14px; color: var(--ink); font-weight: 620; cursor: pointer; }
  .docs-menu .docs-nav { padding: 0 14px 14px; }
  @media (max-width: 1180px) { .docs-layout { grid-template-columns: 220px minmax(0, 1fr); } .docs-toc { display: none; } }
  @media (max-width: 860px) {
    .docs-layout { grid-template-columns: 1fr; margin-top: var(--s-2); }
    .docs-sidebar { display: none; }
    .docs-menu { display: block; }
    .docs-pager { grid-template-columns: 1fr; }
  }
}

@layer pages {
  /* Shell: open an application */
  .shell-head { padding: var(--s-6) 0 var(--s-3); }
  .shell-head h1 { margin: 10px 0 14px; font-size: clamp(30px, 3.6vw, var(--fs-44)); line-height: 1.1; letter-spacing: -.03em; }
  .shell-uri { display: inline-block; max-width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); font-size: 13.5px; overflow-wrap: anywhere; }

  .verify { padding: var(--s-4); }
  .verify-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
  .verify-head h2 { font-size: var(--fs-24); letter-spacing: -.015em; }
  .status-idle { background: rgba(17, 16, 58, .06); color: var(--text); }

  .verify-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: var(--s-3) 0 0; padding: 0; list-style: none; counter-reset: step; }
  .verify-steps li { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 0 16px 0 0; }
  .verify-steps li::after { content: ""; position: absolute; top: 13px; left: 34px; right: 10px; height: 2px; background: var(--line); }
  .verify-steps li:last-child::after { display: none; }
  .verify-steps li[data-state="done"]::after { background: var(--signal-mark); }
  .step-mark { display: grid; place-items: center; width: 28px; height: 28px; margin-bottom: 8px; border: 1.5px solid var(--line-strong); border-radius: 50%; background: var(--surface); color: var(--muted); font: 700 12px/1 var(--mono); }
  .step-mark::before { counter-increment: step; content: counter(step); }
  .verify-steps b { color: var(--ink); font-size: 15px; }
  .step-detail { color: var(--muted); font-size: 13px; line-height: 1.45; }
  [data-state="active"] .step-mark { border-color: var(--warn); color: var(--warn); box-shadow: 0 0 0 4px var(--warn-tint); animation: step-pulse 1.4s var(--ease) infinite; }
  [data-state="done"] .step-mark { border-color: var(--signal-mark); background: var(--signal-mark); color: #fff; }
  [data-state="done"] .step-mark::before { content: "✓"; }
  [data-state="failed"] .step-mark { border-color: var(--danger); background: var(--danger); color: #fff; }
  [data-state="failed"] .step-mark::before { content: "×"; font-size: 16px; }
  [data-state="failed"] .step-detail { color: var(--danger); }
  [data-state="skipped"] { opacity: .5; }
  [data-state="skipped"] .step-mark::before { content: "–"; }
  @keyframes step-pulse { 50% { box-shadow: 0 0 0 7px var(--warn-tint); } }
  @media (prefers-reduced-motion: reduce) { [data-state="active"] .step-mark { animation: none; } }

  .verify-message { margin-top: var(--s-3); padding: 12px 14px; border-left: 2px solid var(--line-strong); background: rgba(17, 16, 58, .025); color: var(--text); font-size: 15px; overflow-wrap: anywhere; }
  .verify-retry { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: var(--s-2); }
  .verify-retry p { color: var(--muted); font-size: 14px; }
  .verify-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); margin-top: var(--s-3); }
  .technical { margin-top: var(--s-3); padding-top: 14px; border-top: 1px solid var(--line); }
  .technical summary { width: max-content; max-width: 100%; color: var(--muted); font: 600 var(--fs-12)/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; cursor: pointer; }
  .technical summary:hover { color: var(--ink); }
  .technical pre { max-height: 360px; margin: 12px 0 0; padding: 14px 16px; border-radius: var(--radius); background: var(--code-bg); color: var(--code-text); overflow: auto; font-size: 12.5px; line-height: 1.6; }
  .technical p { max-width: 78ch; margin-top: 8px; color: var(--muted); font-size: 13px; }

  .runtime-panel { margin-top: var(--s-3); }
  .runtime-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 14px; border: 1px solid var(--line); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; background: var(--surface); }
  .runtime-status { flex: 1; color: var(--signal); font: 600 var(--fs-12)/1.4 var(--mono); letter-spacing: .04em; }
  .runtime-panel iframe { display: block; width: 100%; height: max(640px, calc(100vh - 260px)); border: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); background: #0b0b18; }
  .runtime-panel iframe[hidden] { display: none; }

  /* Once an application runs, the verification card condenses to a summary above it. */
  .shell-running .shell-head { padding: var(--s-3) 0 var(--s-2); }
  .shell-running .shell-head h1, .shell-running .shell-note { display: none; }
  .shell-running .verify { padding: 14px 18px; }
  .shell-running .verify-head h2 { font-size: var(--fs-16); }
  .shell-running .verify-steps { margin-top: 12px; }
  .shell-running .step-mark { width: 22px; height: 22px; margin-bottom: 4px; font-size: 11px; }
  .shell-running .verify-steps li::after { top: 10px; left: 28px; }
  .shell-running .verify-message, .shell-running .verify-actions { display: none; }
  .shell-running .technical { margin-top: 12px; padding-top: 10px; }

  .shell-note { max-width: 720px; margin-top: var(--s-8); }
  .shell-note h2 { margin: 8px 0 10px; font-size: var(--fs-24); }
  .shell-note p:not(.label) { color: var(--muted); }

  /* Release review dialog */
  .review { width: min(620px, calc(100% - 28px)); max-height: min(88dvh, 780px); padding: 0; border: 1px solid var(--ink); border-radius: var(--radius); background: var(--paper); color: var(--text); box-shadow: 0 24px 80px rgba(17, 16, 58, .3); overscroll-behavior: contain; }
  .review::backdrop { background: rgba(17, 16, 58, .55); backdrop-filter: blur(3px); }
  .review form { display: grid; gap: 14px; padding: clamp(20px, 4vw, 32px); }
  .review h2 { font-size: var(--fs-24); letter-spacing: -.015em; }
  .review-summary { color: var(--muted); }
  .review-facts { display: grid; margin: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
  .review-facts > div { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); }
  .review-facts > div:first-child { border-top: 0; }
  .review-facts dt { color: var(--muted); font-size: 13px; }
  .review-facts dd { margin: 0; color: var(--ink); font-size: 14px; overflow-wrap: anywhere; }
  .review-facts code { font-size: 12.5px; }
  .review-warning { padding: 10px 12px; border-left: 2px solid var(--warn); background: var(--warn-tint); color: var(--warn); font-size: 14px; }
  .review-actions { display: flex; justify-content: flex-end; gap: 10px; }

  @media (max-width: 760px) {
    .verify { padding: var(--s-3) 18px; }
    .verify-steps { grid-template-columns: 1fr 1fr; row-gap: var(--s-3); }
    .verify-steps li:nth-child(2)::after { display: none; }
    .review-facts > div { grid-template-columns: 1fr; gap: 2px; }
    .review-actions .btn { flex: 1; }
    .runtime-panel iframe { height: calc(100vh - 160px); min-height: 520px; }
  }
}
@layer pages { .shell-uri:empty { display: none; } }
@layer pages { .runtime-panel { display: flex; flex-direction: column; } .runtime-bar { order: 1; } .runtime-panel iframe { order: 2; } .runtime-panel .runtime-security-note { order: 3; margin-top: 12px; padding-top: 0; border-top: 0; } }

@layer components {
  /* Page hero for inner pages */
  .page-hero { max-width: 820px; padding: 64px 0 var(--s-4); }
  .page-hero h1 { margin: 12px 0 16px; font-size: clamp(36px, 4.6vw, 52px); line-height: 1.06; letter-spacing: -.035em; font-weight: 760; }
  .page-lede, .page-lede > p { color: var(--muted); font-size: clamp(17px, 1.6vw, var(--fs-19)); line-height: 1.6; }
  .page-lede > p + p { margin-top: .8em; }
  .page-hero .home-actions { margin-top: 28px; }
  .page-prose { max-width: 760px; }

  /* Callout and disclosure */
  .note { margin-top: var(--s-3); padding: 14px 16px; border-left: 2px solid var(--ink); background: var(--surface); color: var(--text); font-size: 15px; }
  .note.prose > *:first-child { margin-top: 0; }
  .disclosure { padding: 0; }
  .disclosure > summary { display: flex; flex-direction: column; gap: 6px; padding: var(--s-3); cursor: pointer; list-style: none; }
  .disclosure > summary::-webkit-details-marker { display: none; }
  .disclosure > summary h2 { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: clamp(22px, 2.4vw, 28px); letter-spacing: -.02em; }
  .disclosure > summary h2::after { content: "+"; flex: none; display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--ink); font: 500 18px/1 var(--sans); transition: transform var(--fast) var(--ease); }
  .disclosure[open] > summary h2::after { content: "−"; }
  .disclosure > summary:hover h2::after { border-color: var(--ink); }
  .disclosure > :not(summary) { margin-left: var(--s-3); margin-right: var(--s-3); }
  .disclosure > :last-child { margin-bottom: var(--s-3); }
  .disclosure .prose { max-width: 760px; }

  /* Card grids used by platform, build and profiles */
  .platform-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--s-2); margin: var(--s-3) 0 0; padding: 0; list-style: none; }
  .platform-lifecycle { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
  .platform-grid > * h3 { margin: 6px 0 8px; font-size: 18px; }
  .platform-grid > * .label + h3 { margin-top: 8px; }
  .platform-grid .prose, .platform-grid p { color: var(--muted); font-size: 15px; line-height: 1.6; }
  .platform-grid .prose a { font-weight: 560; }
  .platform-lede { max-width: 760px; color: var(--muted); }
  .platform-grid pre { white-space: pre-wrap; word-break: break-all; font-size: 12.5px; }
  .workflow-steps code { display: inline-block; margin-top: 14px; padding: 3px 8px; border-radius: 3px; background: rgba(17, 16, 58, .06); color: var(--ink); font-size: 12.5px; }

  .profile-catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--s-2); }
  .profile-catalog h3 { font-size: 18px; }
  .profile-catalog code { display: block; margin: 8px 0 12px; color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
  .profile-catalog p { color: var(--muted); font-size: 15px; }
  .profile-catalog .tags { margin-top: 16px; }
  .modes .panel > .label + h3 { margin-top: 8px; }
  .modes p + p { margin-top: 10px; }
  .panel-link-row { margin-top: 14px !important; }

  .split { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--s-4); align-items: center; }
  .formula { display: flex; flex-direction: column; gap: 14px; }
  .formula code { color: var(--ink); font-size: 15px; }

  /* Single-column reading pages (examples) */
  .reading { max-width: 760px; margin: 0 auto; padding-top: var(--s-6); }
  .reading .prose h1 { margin-top: 8px; }
  .reading .page-lede { margin-top: 0; }
  .chain { display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px; margin: var(--s-4) 0; padding: 0; list-style: none; counter-reset: chain; }
  .chain li { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 16px; }
  .chain li:not(:last-child)::after { content: "→"; position: absolute; right: -21px; top: 50%; transform: translateY(-50%); color: var(--signal-mark); font-weight: 700; }
  .chain b { color: var(--ink); }
  .chain span { color: var(--muted); font-size: 13.5px; }

  /* Open handoff */
  .open-target-title { margin: 8px 0 12px; font-size: var(--fs-24); }
  .handoff-options { position: relative; }
  .handoff-options > summary { list-style: none; cursor: pointer; }
  .handoff-options > summary::-webkit-details-marker { display: none; }
  .handoff-menu { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 12px; }
  .not-found { padding-bottom: var(--s-12); }

  @media (max-width: 760px) {
    .page-hero { padding-top: 40px; }
    .split { grid-template-columns: 1fr; }
    .chain { grid-template-columns: 1fr; gap: 14px; }
    .chain li:not(:last-child)::after { content: "↓"; right: auto; left: 50%; top: auto; bottom: -18px; transform: translateX(-50%); }
    .disclosure > summary { padding: 18px; }
    .disclosure > :not(summary) { margin-left: 18px; margin-right: 18px; }
  }
}
