@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/archivo-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/archivo-latin-500-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/archivo-latin-700-normal.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
}

:root {
  --canvas: #f4f2ea;
  --surface: #ffffff;
  --ink: #111513;
  --graphite: #252b28;
  --line: #d8d8cf;
  --muted: #656b67;
  --signal: #f3b43f;
  --healthy: #49a66b;
  --fault: #d45b4e;
  --dark-line: #3a423e;
  --dark-muted: #aeb7b1;
  --radius-control: 6px;
  --radius-panel: 12px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--canvas);
  color: var(--ink);
  font-family: "Archivo", Arial, sans-serif;
  font-synthesis: none;
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  padding: 24px;
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

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

button {
  cursor: pointer;
}

.product-bar {
  width: min(100%, 1536px);
  height: 64px;
  margin: 0 auto 18px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  width: 18px;
  height: 18px;
  border: 5px solid var(--ink);
  border-radius: 999px;
  background: var(--signal);
}

.custody {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.guide-nav-link {
  padding-left: 10px;
  border-left: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}

.guide-nav-link:hover,
.guide-nav-link:focus-visible {
  color: var(--healthy);
}

.custody-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--healthy);
}

.workspace {
  width: min(100%, 1536px);
  min-height: calc(100svh - 130px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 57fr) minmax(430px, 43fr);
  gap: 18px;
}

.input-panel,
.result-panel {
  border-radius: var(--radius-panel);
}

.input-panel {
  min-height: 770px;
  padding: 44px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.input-heading {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.eyebrow,
.field-label {
  margin: 0;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 690px;
  font-size: clamp(38px, 3.1vw, 48px);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.035em;
}

#evidence-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.digest-field {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.digest-control {
  height: 54px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--ink);
  border-radius: var(--radius-control);
}

.digest-control input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
}

.digest-control:focus-within {
  outline: 3px solid rgb(243 180 63 / 35%);
  outline-offset: 2px;
}

.digest-state {
  color: var(--healthy);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  font-weight: 500;
}

.digest-state[data-valid="false"] {
  color: var(--fault);
}

.measure-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.measure {
  min-width: 0;
  min-height: 92px;
  margin: 0;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
}

.measure legend,
.measure > span {
  padding: 0;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  line-height: 16px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.measure input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 2px;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 28px;
  font-weight: 700;
  line-height: 34px;
}

.measure input:focus {
  box-shadow: 0 2px 0 var(--signal);
}

.measure input::-webkit-inner-spin-button {
  appearance: none;
}

.number-pair {
  display: flex;
  align-items: center;
  gap: 3px;
}

.number-pair input {
  text-align: center;
}

.number-pair span {
  color: var(--muted);
  font-size: 22px;
}

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

.signal {
  min-height: 44px;
  padding: 0 8px 0 0;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  font-weight: 500;
}

.signal:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.signal:nth-child(even) {
  padding-left: 14px;
}

.signal:last-child {
  grid-column: 1 / -1;
  border-right: 0;
}

.signal input {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  accent-color: var(--healthy);
}

.form-action {
  margin-top: auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.privacy-note {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}

.privacy-note span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--healthy);
}

.primary-action {
  min-width: 222px;
  height: 54px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 34px;
  border: 0;
  border-radius: var(--radius-control);
  color: var(--ink);
  background: var(--signal);
  font-weight: 700;
}

.primary-action:hover {
  background: #f8c45f;
}

.primary-action:focus-visible,
.export-action:focus-visible,
.interest-action:focus-visible,
.share-action:focus-visible {
  outline: 3px solid var(--surface);
  outline-offset: 3px;
}

.result-panel {
  min-height: 770px;
  padding: 44px;
  display: flex;
  flex-direction: column;
  color: var(--canvas);
  background: var(--ink);
}

.result-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow.dark {
  color: var(--dark-muted);
}

.result-heading h2 {
  margin-top: 7px;
  font-size: 22px;
  line-height: 28px;
}

.canary-badge {
  padding: 7px 10px;
  border: 1px solid #4c5550;
  border-radius: 999px;
  color: var(--signal);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  line-height: 16px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.health-instrument {
  padding: 48px 0 38px;
  display: flex;
  align-items: center;
  gap: 28px;
  border-bottom: 1px solid var(--dark-line);
}

.score-ring {
  position: relative;
  width: 220px;
  height: 220px;
  flex: 0 0 220px;
}

.score-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.score-ring circle {
  fill: none;
  stroke-width: 13;
}

.score-track {
  stroke: var(--dark-line);
}

.score-reading {
  stroke: var(--signal);
  stroke-linecap: butt;
}

.score-number {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-number strong {
  font-size: 76px;
  line-height: 74px;
  letter-spacing: -0.06em;
}

.score-number span {
  color: var(--dark-muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.score-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.score-summary p {
  color: var(--signal);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.score-summary h3 {
  max-width: 230px;
  font-size: 28px;
  line-height: 32px;
  letter-spacing: -0.03em;
}

.result-panel[data-state="stop"] .score-reading,
.result-panel[data-state="weak"] .score-reading {
  stroke: var(--fault);
}

.result-panel[data-state="stop"] .score-summary p,
.result-panel[data-state="weak"] .score-summary p {
  color: var(--fault);
}

.result-panel[data-state="revise"] .score-reading,
.result-panel[data-state="revise"] .score-summary p {
  color: var(--signal);
  stroke: var(--signal);
}

.score-breakdown {
  padding-top: 26px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.score-breakdown label {
  display: grid;
  grid-template-columns: 110px minmax(70px, 1fr) 38px;
  align-items: center;
  gap: 14px;
  color: #d7ddd9;
  font-size: 14px;
}

.score-breakdown output {
  color: var(--canvas);
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  text-align: right;
}

progress {
  width: 100%;
  height: 5px;
  appearance: none;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: var(--dark-line);
}

progress::-webkit-progress-bar {
  border-radius: 999px;
  background: var(--dark-line);
}

progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--signal);
}

progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--signal);
}

#operability-progress::-webkit-progress-value {
  background: var(--healthy);
}

#operability-progress::-moz-progress-bar {
  background: var(--healthy);
}

.next-evidence {
  padding-top: 22px;
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.next-evidence > span {
  width: 110px;
  flex: 0 0 110px;
  color: var(--dark-muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.next-evidence ul {
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  list-style: none;
}

.next-evidence li {
  padding: 5px 8px;
  border: 1px solid #4c5550;
  border-radius: 999px;
  color: #d7ddd9;
  font-size: 11px;
  text-transform: capitalize;
}

.result-footer {
  margin-top: auto;
  padding-top: 18px;
  display: flex;
  align-items: stretch;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid var(--dark-line);
}

.stop-trigger-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.stop-trigger-summary span {
  color: var(--dark-muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stop-trigger-summary strong {
  color: var(--canvas);
  font-size: 14px;
}

.export-action,
.share-action {
  min-height: 40px;
  padding: 0 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #59625d;
  border-radius: var(--radius-control);
  color: var(--canvas);
  background: transparent;
  font-size: 12px;
  font-weight: 600;
}

.export-action:hover,
.share-action:hover {
  border-color: var(--signal);
  color: var(--signal);
}

.export-action svg,
.share-action svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentcolor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.share-action[hidden] {
  display: none;
}

.export-action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) minmax(390px, 0.9fr);
  }

  .input-panel,
  .result-panel {
    padding: 32px;
  }

  .health-instrument {
    align-items: flex-start;
    flex-direction: column;
  }

  .score-ring {
    width: 180px;
    height: 180px;
    flex-basis: 180px;
  }
}

@media (max-width: 820px) {
  body {
    padding: 0;
  }

  .product-bar {
    height: 56px;
    margin: 0;
    padding: 0 20px;
    border-top: 1px solid var(--line);
  }

  .brand {
    gap: 9px;
    font-size: 16px;
  }

  .brand-mark {
    width: 15px;
    height: 15px;
    border-width: 4px;
  }

  .custody span:first-child,
  .custody-dot {
    display: none;
  }

  .custody {
    font-size: 10px;
  }

  .guide-nav-link {
    padding-left: 8px;
  }

  .workspace {
    min-height: 0;
    padding: 16px 16px 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .result-panel {
    min-height: 0;
    padding: 24px;
    gap: 22px;
  }

  .result-heading h2 {
    font-size: 16px;
    line-height: 21px;
  }

  .canary-badge {
    padding: 0;
    border: 0;
    font-size: 10px;
  }

  .health-instrument {
    padding: 0;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    border: 0;
  }

  .score-ring {
    width: 132px;
    height: 132px;
    flex: 0 0 132px;
  }

  .score-ring circle {
    stroke-width: 11;
  }

  .score-number strong {
    font-size: 46px;
    line-height: 43px;
  }

  .score-number span {
    font-size: 9px;
  }

  .score-summary {
    gap: 5px;
  }

  .score-summary p {
    font-size: 10px;
  }

  .score-summary h3 {
    font-size: 21px;
    line-height: 25px;
  }

  .score-breakdown {
    padding-top: 18px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-top: 1px solid var(--dark-line);
  }

  .score-breakdown label {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    font-family: "IBM Plex Mono", monospace;
    font-size: 9px;
    text-transform: uppercase;
  }

  .score-breakdown progress {
    display: none;
  }

  .score-breakdown output {
    font-family: "Archivo", Arial, sans-serif;
    font-size: 20px;
    font-weight: 700;
  }

  .next-evidence {
    padding-top: 0;
    gap: 10px;
  }

  .next-evidence > span {
    width: 82px;
    flex-basis: 82px;
    font-size: 9px;
  }

  .result-footer {
    margin-top: 0;
  }

  .stop-trigger-summary {
    display: none;
  }

  .result-actions,
  .interest-action {
    width: 100%;
  }

  .result-actions {
    flex-direction: row;
  }

  .interest-action {
    flex: 1;
    min-height: 48px;
  }

  .export-action,
  .share-action {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    padding: 0;
  }

  .compact-action-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .input-panel {
    min-height: 0;
    padding: 24px;
    gap: 22px;
  }

  h1 {
    font-size: 29px;
    line-height: 32px;
  }

  .eyebrow,
  .field-label {
    font-size: 10px;
    line-height: 16px;
  }

  #evidence-form {
    gap: 22px;
  }

  .digest-control {
    height: 48px;
    padding: 0 13px;
  }

  .digest-control input {
    font-size: 12px;
  }

  .digest-state {
    font-size: 9px;
  }

  .measure-grid {
    gap: 8px;
  }

  .measure {
    min-height: 68px;
    padding: 10px;
  }

  .measure legend,
  .measure > span {
    font-size: 8px;
    line-height: 13px;
  }

  .measure input {
    font-size: 20px;
    line-height: 25px;
  }

  .number-pair {
    gap: 0;
  }

  .number-pair span {
    font-size: 14px;
  }

  .signals {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border: 0;
  }

  .signal,
  .signal:nth-child(even),
  .signal:last-child {
    min-height: 0;
    padding: 7px 9px;
    gap: 5px;
    border: 0;
    border-radius: 999px;
    color: #276d40;
    background: #edf7f0;
    font-size: 11px;
    font-weight: 600;
  }

  .signal input {
    width: 14px;
    height: 14px;
    flex-basis: 14px;
  }

  .form-action {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 10px;
  }

  .primary-action {
    width: 100%;
    min-width: 0;
    height: 52px;
  }

  .privacy-note {
    justify-content: center;
    font-size: 9px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .score-reading,
  progress {
    transition: stroke-dasharray 180ms ease, color 180ms ease;
  }
}

@media (forced-colors: active) {
  .brand-mark,
  .custody-dot,
  .privacy-note span {
    forced-color-adjust: none;
  }
}
