@layer reset, base, components, responsive, utilities;

@layer reset {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  html {
    scroll-behavior: smooth;
    text-size-adjust: 100%;
  }

  body,
  h1,
  h2,
  h3,
  p,
  ul,
  ol,
  dl,
  dd,
  fieldset,
  legend {
    margin: 0;
  }

  ul,
  ol {
    padding: 0;
  }

  button,
  input,
  select,
  textarea {
    font: inherit;
  }

  button,
  label,
  select {
    -webkit-tap-highlight-color: transparent;
  }

  img,
  svg {
    display: block;
  }

  [hidden] {
    display: none !important;
  }
}

@layer base {
  :root {
    --canvas: #f3f0e8;
    --paper: #fffdf7;
    --paper-raised: #fbf9f2;
    --paper-muted: #eae6dc;
    --ink: #11161b;
    --ink-soft: #44505a;
    --ink-faint: #6d767e;
    --line: #11161b;
    --line-soft: #c9c5ba;
    --signal: #2457ff;
    --signal-dark: #1639b3;
    --signal-soft: #e6ebff;
    --verified: #08765e;
    --verified-soft: #e1f2ec;
    --warning: #a66109;
    --warning-soft: #fff0d4;
    --danger: #a7332d;
    --danger-soft: #f9e4df;
    --content: 1280px;
    --reading: 720px;
    --sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --mono: ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  }

  html {
    min-width: 320px;
    background: var(--canvas);
  }

  body {
    min-width: 320px;
    overflow-x: hidden;
    color: var(--ink);
    background:
      linear-gradient(90deg, transparent calc(50% - 640px), rgb(17 22 27 / 10%) calc(50% - 640px), rgb(17 22 27 / 10%) calc(50% - 639px), transparent calc(50% - 639px)),
      linear-gradient(90deg, transparent calc(50% + 639px), rgb(17 22 27 / 10%) calc(50% + 639px), rgb(17 22 27 / 10%) calc(50% + 640px), transparent calc(50% + 640px)),
      var(--canvas);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.55;
    text-rendering: optimizeLegibility;
  }

  body::before {
    position: fixed;
    z-index: -1;
    inset: 0;
    opacity: 0.28;
    background-image: radial-gradient(rgb(17 22 27 / 22%) 0.55px, transparent 0.55px);
    background-size: 6px 6px;
    content: "";
    pointer-events: none;
  }

  a {
    color: inherit;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
  }

  button,
  select,
  textarea,
  input {
    color: inherit;
  }

  button {
    border: 0;
    cursor: pointer;
  }

  button:disabled,
  select:disabled,
  textarea:disabled,
  input:disabled {
    cursor: not-allowed;
  }

  :focus-visible {
    outline: 3px solid var(--signal);
    outline-offset: 3px;
  }

  ::selection {
    color: var(--paper);
    background: var(--signal);
  }

  h1,
  h2,
  h3 {
    font-weight: 760;
    letter-spacing: -0.035em;
    line-height: 1.02;
  }

  h1 {
    font-size: clamp(2.25rem, 5.4vw, 5.2rem);
  }

  h2 {
    font-size: clamp(1.8rem, 3.6vw, 3.5rem);
  }

  h3 {
    font-size: 1rem;
  }

  code,
  kbd,
  output,
  .section-code,
  .panel-number,
  .analysis-state-label,
  .character-line {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
  }
}

@layer components {
  .skip-link {
    position: fixed;
    z-index: 1000;
    top: 12px;
    left: 12px;
    transform: translateY(-170%);
    padding: 0.75rem 1rem;
    color: var(--paper);
    background: var(--ink);
    font-weight: 750;
  }

  .skip-link:focus {
    transform: translateY(0);
  }

  .site-header,
  main,
  .site-footer {
    width: min(calc(100% - 40px), var(--content));
    margin-inline: auto;
  }

  .site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 76px;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    text-decoration: none;
  }

  .brand__mark {
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
    color: var(--ink);
  }

  .brand__mark path {
    fill: none;
    stroke: currentColor;
    stroke-width: 6;
    stroke-linecap: square;
    stroke-linejoin: miter;
  }

  .brand__mark rect {
    fill: var(--signal);
  }

  .brand__copy {
    display: grid;
    gap: 0.06rem;
  }

  .brand__copy strong {
    font-size: 0.93rem;
    letter-spacing: -0.02em;
  }

  .brand__copy small {
    color: var(--ink-faint);
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .header-state {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--ink-soft);
    font-family: var(--mono);
    font-size: 0.72rem;
  }

  .header-state__signal {
    width: 8px;
    height: 8px;
    border: 1px solid var(--verified);
    background: var(--verified);
  }

  .header-state__clear {
    min-height: 36px;
    padding-inline: 0.7rem;
    border: 1px solid var(--line-soft);
    color: var(--ink);
    background: var(--paper);
    font-family: var(--mono);
    font-size: 0.66rem;
    font-weight: 760;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .header-state__clear:hover {
    color: var(--paper);
    border-color: var(--ink);
    background: var(--ink);
  }

  .workspace {
    padding-block: clamp(1.75rem, 3.5vw, 3.5rem) clamp(5rem, 9vw, 9rem);
  }

  .workspace-heading {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(320px, 1.05fr);
    align-items: end;
    gap: clamp(2rem, 8vw, 8rem);
    margin-bottom: clamp(1rem, 2vw, 1.65rem);
  }

  .workspace-heading > div {
    display: grid;
    gap: 0.75rem;
  }

  .workspace-heading > p {
    max-width: 640px;
    padding-bottom: 0.45rem;
    color: var(--ink-soft);
    font-size: clamp(1rem, 1.5vw, 1.22rem);
  }

  .section-code {
    color: var(--signal-dark);
    font-size: 0.67rem;
    font-weight: 780;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  .proof-desk {
    display: grid;
    grid-template-columns: minmax(380px, 0.78fr) minmax(0, 1.22fr);
    align-items: start;
    border: 1px solid var(--line);
    background: var(--paper);
  }

  .source-column {
    position: sticky;
    top: 12px;
    min-width: 0;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    border-right: 1px solid var(--line);
    background: var(--paper);
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  .source-column > .panel-heading {
    position: sticky;
    z-index: 5;
    top: 0;
    background: var(--paper);
  }

  .output-column {
    min-width: 0;
    background: var(--paper);
  }

  .panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 58px;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--line);
  }

  .panel-heading > div {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
  }

  .panel-heading h2 {
    font-size: 1rem;
    letter-spacing: -0.015em;
  }

  .panel-number {
    color: var(--signal);
    font-size: 0.72rem;
    font-weight: 800;
  }

  .text-action,
  .output-block__heading button,
  .sample-row button,
  .bundle-actions button,
  .follow-up-result__heading button {
    padding: 0;
    color: var(--ink-soft);
    background: transparent;
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 760;
    letter-spacing: 0.055em;
    text-transform: uppercase;
  }

  .text-action {
    min-width: 52px;
    min-height: 36px;
    padding-inline: 0.4rem;
  }

  .follow-up-result__heading button {
    min-width: 64px;
    min-height: 36px;
    padding-inline: 0.55rem;
  }

  .text-action:hover,
  .output-block__heading button:hover:not(:disabled),
  .sample-row button:hover,
  .follow-up-result__heading button:hover {
    color: var(--signal);
    text-decoration: underline;
    text-underline-offset: 0.2em;
  }

  .source-frame {
    position: relative;
    min-height: min(28vh, 250px);
    background:
      linear-gradient(90deg, transparent calc(50% - 0.5px), rgb(17 22 27 / 9%) calc(50% - 0.5px), rgb(17 22 27 / 9%) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
      linear-gradient(transparent calc(50% - 0.5px), rgb(17 22 27 / 9%) calc(50% - 0.5px), rgb(17 22 27 / 9%) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
      var(--paper-muted);
  }

  .source-frame[data-dragging="true"] {
    color: var(--paper);
    background: var(--signal);
    box-shadow: inset 0 0 0 3px var(--signal-dark);
  }

  .source-frame[data-error="true"] {
    box-shadow: inset 0 0 0 2px var(--danger);
  }

  .source-frame[data-state="ready"] {
    background: var(--paper-muted);
  }

  .source-frame[data-dragging="true"] .drop-zone small,
  .source-frame[data-dragging="true"] .drop-zone span {
    color: var(--paper);
  }

  .drop-zone {
    position: absolute;
    inset: 0;
    display: grid;
    align-content: center;
    justify-items: center;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
  }

  .drop-zone__reticle {
    position: relative;
    width: 92px;
    height: 92px;
    margin-bottom: 1.5rem;
  }

  .drop-zone__reticle span {
    position: absolute;
    width: 28px;
    height: 28px;
    border-color: currentColor;
    border-style: solid;
  }

  .drop-zone__reticle span:nth-child(1) {
    top: 0;
    left: 0;
    border-width: 2px 0 0 2px;
  }

  .drop-zone__reticle span:nth-child(2) {
    top: 0;
    right: 0;
    border-width: 2px 2px 0 0;
  }

  .drop-zone__reticle span:nth-child(3) {
    right: 0;
    bottom: 0;
    border-width: 0 2px 2px 0;
  }

  .drop-zone__reticle span:nth-child(4) {
    bottom: 0;
    left: 0;
    border-width: 0 0 2px 2px;
  }

  .drop-zone strong {
    margin-bottom: 0.35rem;
    font-size: clamp(1.35rem, 2.3vw, 2rem);
    letter-spacing: -0.035em;
  }

  .drop-zone > span:not(.drop-zone__reticle) {
    color: var(--ink-soft);
  }

  .drop-zone small {
    margin-top: 1rem;
    color: var(--ink-faint);
    font-family: var(--mono);
    font-size: 0.65rem;
  }

  .image-preview-shell {
    display: grid;
    min-height: inherit;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .image-stage {
    position: relative;
    display: grid;
    min-height: 180px;
    max-height: 30vh;
    overflow: auto;
    place-items: center;
    padding: 1rem;
    background: #d8d5cc;
    overscroll-behavior: contain;
  }

  .image-stage::before {
    position: absolute;
    inset: 0;
    opacity: 0.42;
    background-image:
      linear-gradient(45deg, #c5c2b9 25%, transparent 25%),
      linear-gradient(-45deg, #c5c2b9 25%, transparent 25%),
      linear-gradient(45deg, transparent 75%, #c5c2b9 75%),
      linear-gradient(-45deg, transparent 75%, #c5c2b9 75%);
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    background-size: 16px 16px;
    content: "";
  }

  .image-stage img {
    position: relative;
    z-index: 1;
    max-width: 100%;
    max-height: 28vh;
    object-fit: contain;
    transform: scale(var(--image-zoom, 1));
    transform-origin: center;
    box-shadow: 0 0 0 1px rgb(17 22 27 / 20%);
  }

  .preview-toolbar {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 64px;
    padding: 0.65rem 0.85rem;
    border-top: 1px solid var(--line);
    background: var(--paper);
  }

  .preview-toolbar > div:first-child {
    display: grid;
    min-width: 0;
    gap: 0.1rem;
  }

  .preview-toolbar strong,
  .preview-toolbar span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .preview-toolbar strong {
    font-size: 0.76rem;
  }

  .preview-toolbar span {
    color: var(--ink-faint);
    font-family: var(--mono);
    font-size: 0.62rem;
  }

  .preview-toolbar__actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.3rem;
  }

  .preview-toolbar__actions button,
  .preview-toolbar__actions output {
    display: grid;
    min-width: 34px;
    min-height: 34px;
    place-items: center;
    border: 1px solid var(--line-soft);
    color: var(--ink);
    background: var(--paper);
    font-family: var(--mono);
    font-size: 0.68rem;
  }

  .preview-toolbar__actions button:last-child {
    padding-inline: 0.6rem;
  }

  .preview-toolbar__actions button:hover {
    color: var(--paper);
    border-color: var(--ink);
    background: var(--ink);
  }

  .image-processing-state {
    position: absolute;
    z-index: 3;
    inset: 0;
    display: grid;
    align-content: center;
    justify-items: center;
    padding: 2rem;
    color: var(--paper);
    background: rgb(17 22 27 / 92%);
    text-align: center;
  }

  .image-processing-state strong {
    margin-top: 1rem;
  }

  .image-processing-state span:last-child {
    max-width: 36ch;
    margin-top: 0.35rem;
    color: rgb(255 253 247 / 70%);
    font-size: 0.8rem;
  }

  .processing-cursor {
    width: 44px;
    height: 4px;
    background: var(--signal);
    animation: processing-scan 0.8s steps(4, end) infinite;
  }

  .source-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .source-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 48px;
    color: var(--ink);
    background: var(--paper);
    font-size: 0.8rem;
    font-weight: 720;
  }

  .source-actions button + button {
    border-left: 1px solid var(--line);
  }

  .source-actions button svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: var(--signal);
    stroke-width: 1.8;
    stroke-linecap: square;
    stroke-linejoin: miter;
  }

  .source-actions button:hover:not(:disabled) {
    color: var(--paper);
    background: var(--ink);
  }

  .source-actions button:hover:not(:disabled) svg {
    stroke: var(--paper);
  }

  .source-actions button:disabled,
  .sample-row button:disabled,
  .preview-toolbar__actions button:disabled {
    opacity: 0.45;
  }

  .sample-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem 0.8rem;
    min-height: 48px;
    padding: 0.55rem 0.85rem;
    border-bottom: 1px solid var(--line);
    background: var(--paper-raised);
  }

  .sample-row > span {
    color: var(--ink-faint);
    font-family: var(--mono);
    font-size: 0.64rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  .sample-row button {
    min-height: 36px;
    padding-inline: 0.35rem;
    color: var(--signal-dark);
    text-transform: none;
  }

  .analysis-controls {
    display: grid;
    grid-template-columns: 0.9fr 1.1fr;
    border-bottom: 1px solid var(--line);
  }

  .control-field,
  .depth-control {
    min-width: 0;
    padding: 0.68rem;
    border: 0;
  }

  .control-field:first-child {
    border-right: 1px solid var(--line);
  }

  .control-field--focus {
    display: block;
    width: 100%;
    border-top: 1px solid var(--line);
  }

  .control-field > span,
  .depth-control legend {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--ink-faint);
    font-family: var(--mono);
    font-size: 0.61rem;
    font-weight: 760;
    letter-spacing: 0.07em;
    text-transform: uppercase;
  }

  .control-field small {
    font: inherit;
    font-weight: 500;
    text-transform: none;
  }

  .control-field select,
  .control-field textarea {
    width: 100%;
    border: 1px solid var(--line-soft);
    color: var(--ink);
    background: var(--paper);
  }

  .control-field select {
    min-height: 44px;
    padding: 0.55rem 2.25rem 0.55rem 0.65rem;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%2311161B' stroke-width='1.6' stroke-linecap='square'/%3E%3C/svg%3E");
    background-position: right 0.65rem center;
    background-repeat: no-repeat;
  }

  .control-field textarea {
    min-height: 62px;
    padding: 0.65rem;
    resize: vertical;
    line-height: 1.4;
  }

  .control-field select:hover,
  .control-field textarea:hover,
  .control-field select:focus,
  .control-field textarea:focus {
    border-color: var(--signal);
  }

  .depth-control {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-content: start;
  }

  .depth-control legend {
    grid-column: 1 / -1;
  }

  .depth-control label {
    position: relative;
  }

  .depth-control input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
  }

  .depth-control span {
    display: grid;
    min-height: 42px;
    place-items: center;
    border: 1px solid var(--line-soft);
    font-family: var(--mono);
    font-size: 0.66rem;
    font-weight: 700;
    cursor: pointer;
  }

  .depth-control label + label span {
    border-left: 0;
  }

  .depth-control input:checked + span {
    color: var(--paper);
    border-color: var(--ink);
    background: var(--ink);
  }

  .depth-control input:focus-visible + span {
    outline: 3px solid var(--signal);
    outline-offset: 2px;
  }

  .analyze-button {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    width: 100%;
    min-height: 68px;
    padding: 0.8rem 1rem;
    color: var(--paper);
    background: var(--signal);
    text-align: left;
  }

  .analyze-button:hover:not(:disabled) {
    background: var(--signal-dark);
  }

  .analyze-button:active:not(:disabled) {
    transform: translateY(1px);
  }

  .analyze-button:disabled {
    color: var(--ink-faint);
    background: var(--paper-muted);
  }

  .analyze-button__label {
    font-size: 1.05rem;
    font-weight: 820;
    letter-spacing: -0.025em;
  }

  .analyze-button__status {
    font-family: var(--mono);
    font-size: 0.61rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .not-found-action {
    max-width: 560px;
    text-decoration: none;
  }

  .analysis-form--busy .analyze-button__status::before {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 0.45rem;
    background: currentColor;
    content: "";
    animation: busy-blink 0.75s steps(2, end) infinite;
  }

  .source-footer {
    display: grid;
    gap: 0.25rem;
    padding: 0.75rem 0.85rem;
    color: var(--ink-faint);
    background: var(--paper-raised);
    font-size: 0.7rem;
  }

  .source-footer p:first-child {
    color: var(--ink-soft);
    font-family: var(--mono);
  }

  .form-error {
    min-height: 0;
    padding-inline: 0.85rem;
    color: var(--danger);
    background: var(--danger-soft);
    font-size: 0.76rem;
    font-weight: 680;
  }

  .form-error:not(:empty) {
    padding-block: 0.7rem;
    border-top: 1px solid var(--danger);
  }

  .form-error:not(:empty)::before {
    margin-right: 0.45rem;
    font-family: var(--mono);
    content: "[!]";
  }

  .panel-heading--output {
    position: sticky;
    z-index: 4;
    top: 0;
    background: var(--paper);
  }

  .analysis-state-label {
    color: var(--ink-faint);
    font-size: 0.64rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  .output-column[data-state="complete"] .analysis-state-label {
    color: var(--verified);
  }

  .output-column[data-state="analyzing"] .analysis-state-label {
    color: var(--signal);
  }

  .analysis-progress {
    display: grid;
    gap: 0.65rem;
    padding: 0.9rem 1rem;
    color: var(--paper);
    background: var(--ink);
  }

  .analysis-progress__line {
    height: 3px;
    overflow: hidden;
    background: rgb(255 253 247 / 18%);
  }

  .analysis-progress__line span {
    display: block;
    width: 32%;
    height: 100%;
    background: var(--signal);
    transform: translateX(-120%);
  }

  .analysis-progress[data-mode="indeterminate"] .analysis-progress__line span {
    animation: progress-sweep 1.15s linear infinite;
  }

  .analysis-progress__content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
  }

  .analysis-progress__content > div {
    display: grid;
    gap: 0.15rem;
  }

  .analysis-progress strong {
    font-size: 0.82rem;
  }

  .analysis-progress span {
    color: rgb(255 253 247 / 62%);
    font-family: var(--mono);
    font-size: 0.61rem;
  }

  .analysis-progress button {
    min-width: 76px;
    min-height: 40px;
    padding-inline: 0.8rem;
    border: 1px solid rgb(255 253 247 / 55%);
    color: var(--paper);
    background: transparent;
    font-family: var(--mono);
    font-size: 0.64rem;
    font-weight: 760;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  .analysis-progress button:hover {
    color: var(--ink);
    background: var(--paper);
  }

  .output-block {
    border-bottom: 1px solid var(--line);
  }

  .output-block__heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 50px;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--line-soft);
    background: var(--paper-raised);
  }

  .output-block__heading > div {
    display: flex;
    align-items: baseline;
    gap: 0.7rem;
  }

  .output-block__heading span {
    color: var(--signal);
    font-family: var(--mono);
    font-size: 0.65rem;
    font-weight: 820;
  }

  .output-block__heading button {
    min-width: 64px;
    min-height: 36px;
    padding-inline: 0.55rem;
    border: 1px solid transparent;
  }

  .output-block__heading button:hover:not(:disabled) {
    border-color: currentColor;
    text-decoration: none;
  }

  .output-block__heading button.is-confirmed,
  .bundle-actions button.is-confirmed,
  .follow-up-result__heading button.is-confirmed {
    color: var(--paper);
    border-color: var(--ink);
    background: var(--ink);
  }

  .output-block__heading button:disabled {
    color: var(--line-soft);
  }

  .summary-output {
    padding: 1rem 1rem 0;
    color: var(--ink);
    font-size: clamp(1rem, 1.6vw, 1.2rem);
    font-weight: 680;
    letter-spacing: -0.015em;
  }

  .output-editor {
    display: block;
    width: 100%;
    min-height: 132px;
    padding: 0.85rem 1rem 1.1rem;
    overflow: hidden;
    border: 0;
    color: var(--ink-soft);
    background: var(--paper);
    line-height: 1.6;
    resize: none;
  }

  .output-editor--compact {
    min-height: 82px;
  }

  .output-editor--mono {
    min-height: 106px;
    font-family: var(--mono);
    font-size: 0.82rem;
    line-height: 1.55;
  }

  .output-editor:disabled {
    opacity: 1;
    color: var(--ink-faint);
    background: var(--paper);
  }

  .output-column[data-state="empty"] .output-block,
  .output-column[data-state="ready"] .output-block {
    color: var(--ink-faint);
  }

  .output-column[data-state="ready"] .analysis-state-label {
    color: var(--signal-dark);
  }

  .output-column[data-state="analyzing"] .output-block {
    opacity: 0.62;
  }

  .output-editor:not(:disabled):focus {
    background: #ffffff;
    outline-offset: -3px;
  }

  .character-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: 34px;
    padding: 0 1rem 0.65rem;
    color: var(--ink-faint);
    font-size: 0.61rem;
  }

  .character-line strong {
    font: inherit;
    font-weight: 760;
  }

  .character-line[data-tone="warn"] {
    color: var(--warning);
  }

  .character-line[data-tone="bad"] {
    padding: 0.45rem 1rem;
    color: var(--paper);
    background: var(--ink);
  }

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

  .data-ledger > div {
    min-width: 0;
    min-height: 126px;
    padding: 0.9rem 1rem;
  }

  .data-ledger > div:nth-child(even) {
    border-left: 1px solid var(--line-soft);
  }

  .data-ledger > div:nth-child(n + 3) {
    border-top: 1px solid var(--line-soft);
  }

  .data-ledger > div > span {
    display: block;
    margin-bottom: 0.6rem;
    color: var(--ink-faint);
    font-family: var(--mono);
    font-size: 0.61rem;
    font-weight: 760;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .data-ledger ul {
    display: grid;
    gap: 0.3rem;
    list-style: none;
  }

  .data-ledger li,
  .data-ledger p,
  .data-ledger dd,
  .data-ledger dt {
    overflow-wrap: anywhere;
    font-size: 0.78rem;
  }

  .data-ledger li {
    position: relative;
    padding-left: 0.85rem;
  }

  .data-ledger li::before {
    position: absolute;
    top: 0.65em;
    left: 0;
    width: 4px;
    height: 4px;
    background: var(--signal);
    content: "";
  }

  #color-list li {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr);
    align-items: center;
    gap: 0.45rem;
    padding-left: 0;
  }

  #color-list li::before {
    position: static;
    width: 10px;
    height: 10px;
    background: var(--swatch, var(--line-soft));
    box-shadow: 0 0 0 1px rgb(17 22 27 / 22%);
  }

  .data-ledger dl {
    display: grid;
    gap: 0.28rem;
  }

  .data-ledger dl div {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr);
    gap: 0.5rem;
  }

  .data-ledger dt {
    color: var(--ink-faint);
    font-family: var(--mono);
  }

  .output-block--uncertainty {
    background: var(--warning-soft);
  }

  .review-map-hint {
    padding: 0.75rem 1rem 0;
    color: #5d3a0a;
    font-size: 0.76rem;
  }

  .output-block--uncertainty ul {
    display: grid;
    gap: 0.55rem;
    padding: 0.75rem 1rem 1rem;
    color: #5d3a0a;
    font-size: 0.78rem;
    list-style: none;
  }

  .output-block--uncertainty li button {
    display: grid;
    width: 100%;
    min-height: 52px;
    gap: 0.2rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid rgb(93 58 10 / 35%);
    color: #5d3a0a;
    background: rgb(255 253 247 / 62%);
    text-align: left;
  }

  .output-block--uncertainty li button:hover {
    color: var(--paper);
    border-color: var(--ink);
    background: var(--ink);
  }

  .output-block--uncertainty li button span {
    font-family: var(--mono);
    font-size: 0.61rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  .output-block--uncertainty li button strong {
    font-size: 0.78rem;
    font-weight: 650;
    line-height: 1.45;
  }

  .review-map-clear {
    padding: 0.7rem 0.75rem;
    border: 1px solid rgb(93 58 10 / 28%);
    background: rgb(255 253 247 / 48%);
  }

  .output-block[data-review-active="true"] {
    outline: 3px solid var(--signal);
    outline-offset: -3px;
  }

  .bundle-actions {
    position: sticky;
    z-index: 3;
    top: 58px;
    display: grid;
    grid-template-columns: 1.2fr repeat(4, 0.8fr);
    border-bottom: 1px solid var(--line);
  }

  .bundle-actions button {
    min-height: 52px;
    border-right: 1px solid var(--line);
    color: var(--ink);
    background: var(--paper);
  }

  .bundle-actions button:last-child {
    border-right: 0;
  }

  .bundle-actions button:first-child {
    color: var(--paper);
    background: var(--ink);
  }

  .bundle-actions button:hover:not(:disabled) {
    color: var(--paper);
    background: var(--signal);
  }

  .bundle-actions button:disabled {
    color: var(--ink-faint);
    background: var(--paper-muted);
  }

  .follow-up-section,
  .trust-ledger,
  .faq-section {
    display: grid;
    grid-template-columns: minmax(260px, 0.65fr) minmax(0, 1.35fr);
    gap: clamp(2rem, 8vw, 8rem);
    padding-block: clamp(4rem, 8vw, 8rem);
    border-top: 1px solid var(--line);
  }

  .follow-up-heading,
  .trust-ledger > div:first-child,
  .faq-section > div:first-child {
    display: grid;
    align-content: start;
    gap: 0.75rem;
  }

  .follow-up-heading h2,
  .trust-ledger h2,
  .faq-section h2 {
    max-width: 12ch;
  }

  .follow-up-heading p:last-child {
    max-width: 38ch;
    color: var(--ink-soft);
  }

  .follow-up-form {
    align-self: start;
    border: 1px solid var(--line);
    background: var(--paper);
  }

  .workflow-recipes {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid var(--line);
    background: var(--paper-raised);
  }

  .workflow-recipes > span {
    margin-right: 0.25rem;
    color: var(--ink-faint);
    font-family: var(--mono);
    font-size: 0.61rem;
    font-weight: 760;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .workflow-recipes button {
    min-height: 40px;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--line-soft);
    color: var(--ink);
    background: var(--paper);
    font-size: 0.7rem;
    font-weight: 700;
  }

  .workflow-recipes button:hover:not(:disabled) {
    color: var(--paper);
    border-color: var(--ink);
    background: var(--ink);
  }

  .workflow-recipes button:disabled {
    color: var(--ink-faint);
    background: var(--paper-muted);
  }

  .follow-up-command-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    border-bottom: 1px solid var(--line);
  }

  .follow-up-command-row > label:first-child {
    display: flex;
    align-items: center;
    padding: 0.7rem 0.85rem;
    color: var(--ink-faint);
    font-family: var(--mono);
    font-size: 0.64rem;
    font-weight: 760;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .follow-up-target-control {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem 0.55rem 0.45rem 0.75rem;
    border-left: 1px solid var(--line);
    color: var(--ink-faint);
    font-family: var(--mono);
    font-size: 0.61rem;
    font-weight: 760;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  .follow-up-target-control select {
    min-height: 38px;
    padding: 0.45rem 2rem 0.45rem 0.6rem;
    border: 1px solid var(--line-soft);
    color: var(--ink);
    background-color: var(--paper);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%2311161B' stroke-width='1.6' stroke-linecap='square'/%3E%3C/svg%3E");
    background-position: right 0.55rem center;
    background-repeat: no-repeat;
    font-family: var(--sans);
    font-size: 0.72rem;
    font-weight: 680;
    text-transform: none;
    appearance: none;
  }

  .follow-up-form__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .follow-up-form textarea {
    min-height: 100px;
    padding: 0.85rem;
    border: 0;
    border-right: 1px solid var(--line);
    background: var(--paper);
    resize: vertical;
  }

  .follow-up-form__row > button {
    min-width: 170px;
    padding: 0.8rem 1rem;
    color: var(--paper);
    background: var(--ink);
    font-weight: 780;
  }

  .follow-up-form__row > button:hover:not(:disabled) {
    background: var(--signal);
  }

  .follow-up-form__row > button:disabled,
  .follow-up-form textarea:disabled,
  .follow-up-target-control select:disabled {
    color: var(--ink-faint);
    background-color: var(--paper-muted);
  }

  .follow-up-result {
    grid-column: 2;
    margin-top: calc(clamp(4rem, 8vw, 8rem) * -0.45);
    border: 1px solid var(--line);
    background: var(--paper);
  }

  .follow-up-result__heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--line);
  }

  .follow-up-result__heading span {
    color: var(--signal);
    font-family: var(--mono);
    font-size: 0.64rem;
    font-weight: 800;
  }

  .follow-up-result__heading > div {
    display: flex;
    align-items: center;
    gap: 0.35rem;
  }

  .follow-up-result > p {
    padding: 1rem;
    white-space: pre-wrap;
  }

  .follow-up-result > ul {
    padding: 0 1rem 1rem 2rem;
    color: var(--warning);
    font-size: 0.8rem;
  }

  .trust-ledger__rows {
    border-top: 1px solid var(--line);
  }

  .trust-ledger__rows > div {
    display: grid;
    grid-template-columns: 42px minmax(170px, 0.45fr) minmax(0, 1fr);
    gap: 1rem;
    padding-block: 1rem;
    border-bottom: 1px solid var(--line);
  }

  .trust-ledger__rows span {
    color: var(--signal);
    font-family: var(--mono);
    font-size: 0.7rem;
  }

  .trust-ledger__rows strong {
    font-size: 0.9rem;
  }

  .trust-ledger__rows p {
    color: var(--ink-soft);
    font-size: 0.88rem;
  }

  .faq-list {
    border-top: 1px solid var(--line);
  }

  .faq-list details {
    border-bottom: 1px solid var(--line);
  }

  .faq-list summary {
    position: relative;
    padding: 1rem 2.5rem 1rem 0;
    font-weight: 720;
    cursor: pointer;
    list-style: none;
  }

  .faq-list summary::-webkit-details-marker {
    display: none;
  }

  .faq-list summary::after {
    position: absolute;
    top: 0.85rem;
    right: 0;
    color: var(--signal);
    font-family: var(--mono);
    font-size: 1.2rem;
    content: "+";
  }

  .faq-list details[open] summary::after {
    content: "−";
  }

  .faq-list details p {
    max-width: var(--reading);
    padding: 0 2rem 1.2rem 0;
    color: var(--ink-soft);
  }

  .site-footer {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 2rem;
    min-height: 130px;
    border-top: 1px solid var(--line);
    color: var(--ink-soft);
    font-size: 0.76rem;
  }

  .site-footer > div {
    display: grid;
    gap: 0.15rem;
  }

  .site-footer strong {
    color: var(--ink);
  }

  .site-footer nav {
    display: flex;
    gap: 1.2rem;
  }

  body.dialog-open {
    overflow: hidden;
  }

  .legal-dialog {
    width: min(calc(100% - 28px), 760px);
    max-height: min(86vh, 860px);
    margin: auto;
    padding: 0;
    overflow: hidden;
    border: 2px solid var(--line);
    color: var(--ink);
    background: var(--paper);
  }

  .legal-dialog::backdrop {
    background: rgb(17 22 27 / 74%);
  }

  .legal-dialog__header {
    position: sticky;
    z-index: 2;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--line);
    background: var(--paper);
  }

  .legal-dialog__header > div {
    display: grid;
    gap: 0.3rem;
  }

  .legal-dialog__header span {
    color: var(--signal);
    font-family: var(--mono);
    font-size: 0.62rem;
    font-weight: 780;
  }

  .legal-dialog__header h2 {
    font-size: 1.8rem;
  }

  .legal-dialog__header button {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    color: var(--paper);
    background: var(--ink);
  }

  .legal-dialog__header button svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: square;
  }

  .legal-dialog__header button:hover {
    background: var(--signal);
  }

  .legal-dialog__body {
    max-height: calc(min(86vh, 860px) - 80px);
    padding: 1.2rem clamp(1rem, 5vw, 3rem) 3rem;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .legal-dialog__body h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.4rem;
    font-size: 1rem;
    letter-spacing: -0.01em;
  }

  .legal-dialog__body p {
    max-width: 68ch;
    color: var(--ink-soft);
  }

  .legal-dialog__body .legal-updated {
    color: var(--ink-faint);
    font-family: var(--mono);
    font-size: 0.68rem;
  }

  .copy-status {
    position: fixed;
    z-index: 1000;
    right: 18px;
    bottom: 18px;
    max-width: min(360px, calc(100% - 36px));
    padding: 0.75rem 0.9rem;
    transform: translateY(140%);
    color: var(--paper);
    background: var(--ink);
    font-family: var(--mono);
    font-size: 0.72rem;
    opacity: 0;
    transition: transform 140ms ease-out, opacity 140ms ease-out;
  }

  .copy-status[data-visible="true"] {
    transform: translateY(0);
    opacity: 1;
  }

  .noscript {
    position: fixed;
    z-index: 1100;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 1rem;
    color: var(--paper);
    background: var(--danger);
    text-align: center;
  }

  @keyframes processing-scan {
    50% {
      transform: translateX(20px);
    }
  }

  @keyframes busy-blink {
    50% {
      opacity: 0.2;
    }
  }

  @keyframes progress-sweep {
    from {
      transform: translateX(-120%);
    }

    to {
      transform: translateX(420%);
    }
  }
}

@layer responsive {
  @media (min-width: 1041px) and (max-height: 720px) {
    .source-frame {
      min-height: 190px;
    }

    .image-stage {
      min-height: 150px;
      max-height: 24vh;
    }

    .image-stage img {
      max-height: 22vh;
    }
  }

  @media (max-width: 1040px) {
    .proof-desk {
      grid-template-columns: minmax(340px, 0.85fr) minmax(0, 1.15fr);
    }

    .workspace-heading {
      gap: 3rem;
    }

    .source-column {
      position: static;
      max-height: none;
      overflow: visible;
      scrollbar-gutter: auto;
    }

    .source-column > .panel-heading {
      position: static;
    }

    .image-stage {
      min-height: 300px;
    }
  }

  @media (max-width: 820px) {
    body {
      background: var(--canvas);
    }

    .site-header,
    main,
    .site-footer {
      width: min(calc(100% - 24px), var(--content));
    }

    .workspace-heading {
      grid-template-columns: 1fr;
      gap: 1rem;
    }

    .workspace-heading > p {
      padding-bottom: 0;
    }

    .proof-desk {
      grid-template-columns: 1fr;
    }

    .source-column {
      border-right: 0;
      border-bottom: 1px solid var(--line);
    }

    .panel-heading--output,
    .bundle-actions {
      position: static;
    }

    .source-frame {
      min-height: min(48vh, 420px);
    }

    .image-stage {
      max-height: 48vh;
    }

    .image-stage img {
      max-height: 42vh;
    }

    .follow-up-section,
    .trust-ledger,
    .faq-section {
      grid-template-columns: 1fr;
      gap: 2rem;
    }

    .follow-up-heading h2,
    .trust-ledger h2,
    .faq-section h2 {
      max-width: 16ch;
    }

    .follow-up-result {
      grid-column: 1;
      margin-top: -1.2rem;
    }
  }

  @media (max-width: 620px) {
    .site-header {
      min-height: 66px;
    }

    #session-state-label {
      display: none;
    }

    .header-state__clear {
      min-height: 44px;
    }

    .workspace {
      padding-top: 2rem;
    }

    .source-frame {
      min-height: min(38vh, 330px);
    }

    .drop-zone {
      padding: 1.2rem;
    }

    .drop-zone__reticle {
      width: 68px;
      height: 68px;
      margin-bottom: 1rem;
    }

    .drop-zone__reticle span {
      width: 22px;
      height: 22px;
    }

    .drop-zone strong {
      font-size: 1.35rem;
    }

    .source-actions button,
    .sample-row button,
    .output-block__heading button,
    .follow-up-result__heading button,
    .text-action {
      min-height: 44px;
    }

    .source-actions button {
      min-height: 52px;
    }

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

    .control-field:first-child {
      border-right: 0;
      border-bottom: 1px solid var(--line);
    }

    .control-field--focus {
      grid-column: 1;
    }

    .data-ledger {
      grid-template-columns: 1fr;
    }

    .data-ledger > div:nth-child(even) {
      border-left: 0;
    }

    .data-ledger > div + div {
      border-top: 1px solid var(--line-soft);
    }

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

    .bundle-actions button:first-child {
      grid-column: 1 / -1;
      border-right: 0;
      border-bottom: 1px solid var(--line);
    }

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

    .workflow-recipes > span {
      grid-column: 1 / -1;
    }

    .workflow-recipes button {
      min-width: 0;
      min-height: 48px;
    }

    .follow-up-command-row,
    .follow-up-form__row {
      grid-template-columns: 1fr;
    }

    .follow-up-target-control {
      justify-content: space-between;
      border-top: 1px solid var(--line);
      border-left: 0;
    }

    .follow-up-target-control select {
      min-height: 44px;
    }

    .follow-up-form textarea {
      min-height: 92px;
      border-right: 0;
      border-bottom: 1px solid var(--line);
    }

    .follow-up-form__row > button {
      min-width: 0;
      min-height: 52px;
    }

    .trust-ledger__rows > div {
      grid-template-columns: 34px minmax(0, 1fr);
    }

    .trust-ledger__rows p {
      grid-column: 2;
    }

    .site-footer {
      grid-template-columns: 1fr auto;
      align-items: start;
      padding-block: 1.5rem;
    }

    .site-footer > p {
      grid-column: 1 / -1;
    }
  }

  @media (max-width: 420px) {
    .site-header,
    main,
    .site-footer {
      width: min(calc(100% - 16px), var(--content));
    }

    .brand__copy small {
      display: none;
    }

    .workspace-heading > p {
      font-size: 0.93rem;
    }

    .panel-heading {
      min-height: 54px;
    }

    .source-frame {
      min-height: min(36vh, 300px);
    }

    .drop-zone small {
      max-width: 28ch;
    }

    .preview-toolbar {
      align-items: flex-start;
      flex-direction: column;
    }

    .preview-toolbar__actions {
      width: 100%;
    }

    .preview-toolbar__actions button:last-child {
      margin-left: auto;
    }

    .source-actions button {
      gap: 0.25rem;
      font-size: 0.74rem;
    }

    .sample-row > span {
      width: 100%;
    }

    .depth-control {
      padding-inline: 0.65rem;
    }

    .depth-control span {
      font-size: 0.61rem;
    }

    .analyze-button {
      grid-template-columns: 1fr;
      gap: 0.15rem;
      min-height: 72px;
    }

    .analyze-button__status {
      font-size: 0.57rem;
    }

    .analysis-progress__content {
      align-items: stretch;
      flex-direction: column;
      gap: 0.65rem;
    }

    .analysis-progress button {
      width: 100%;
      min-height: 44px;
    }

    .output-block__heading {
      min-height: 48px;
    }

    .summary-output {
      font-size: 1rem;
    }

    .output-editor {
      min-height: 118px;
      font-size: 0.9rem;
    }

    .output-editor--compact {
      min-height: 78px;
    }

    .bundle-actions button {
      min-height: 48px;
      font-size: 0.6rem;
    }

    .follow-up-section,
    .trust-ledger,
    .faq-section {
      padding-block: 3.5rem;
    }

    .site-footer {
      grid-template-columns: 1fr;
      gap: 0.8rem;
    }

    .site-footer > p {
      grid-column: 1;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      scroll-behavior: auto !important;
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }

  @media print {
    body {
      background: #fff;
    }

    body::before,
    .site-header,
    .source-actions,
    .sample-row,
    .analysis-controls,
    .analyze-button,
    .source-footer,
    .bundle-actions,
    .follow-up-section,
    .trust-ledger,
    .faq-section,
    .site-footer,
    .copy-status {
      display: none !important;
    }

    main,
    .workspace {
      width: 100%;
      padding: 0;
    }

    .proof-desk {
      display: block;
      border: 0;
    }

    .source-column {
      position: static;
      border: 0;
    }

    .source-frame {
      min-height: 0;
      background: #fff;
    }

    .image-stage {
      min-height: 0;
      max-height: none;
      background: #fff;
    }

    .image-stage img {
      max-height: 320px;
    }

    .output-column,
    .output-block,
    .output-editor {
      break-inside: avoid;
      background: #fff;
    }
  }
}

@layer utilities {
  .visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }
}
