:root {
  --canvas: #f6f3ed;
  --paper: #fffdfa;
  --paper-deep: #ece7dd;
  --ink: #181612;
  --ink-soft: #474239;
  --muted: #6d665a;
  --line: #d4ccbf;
  --line-strong: #81786a;
  --accent: #a33b0b;
  --accent-ink: #762804;
  --warning: #805600;
  --danger: #96252a;
  --success: #285a3d;
  --focus: #bd4b13;
  --source-signal: #2f6265;
  --source-soft: #dce8e4;
  --target-signal: #a33b0b;
  --target-soft: #f1dfd4;
  --visual-well: #f0ebe1;
  --backdrop: rgb(24 22 18 / 0.58);
  --font-serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 24px;
  --s7: 32px;
  --s8: 40px;
  --s9: 56px;
  --radius-sm: 5px;
  --radius-md: 10px;
  --radius-pill: 999px;
}

html[data-theme="dark"] {
  --canvas: #12110e;
  --paper: #1b1915;
  --paper-deep: #25221c;
  --ink: #f4efe5;
  --ink-soft: #cbc3b5;
  --muted: #a49a88;
  --line: #39342c;
  --line-strong: #766c5e;
  --accent: #ff8c46;
  --accent-ink: #ffb17d;
  --warning: #e3b95d;
  --danger: #ff8588;
  --success: #83cba0;
  --focus: #ff9d61;
  --source-signal: #79b8ba;
  --source-soft: #203638;
  --target-signal: #ff8c46;
  --target-soft: #43291b;
  --visual-well: #211e18;
  --backdrop: rgb(0 0 0 / 0.7);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    --canvas: #12110e;
    --paper: #1b1915;
    --paper-deep: #25221c;
    --ink: #f4efe5;
    --ink-soft: #cbc3b5;
    --muted: #a49a88;
    --line: #39342c;
    --line-strong: #766c5e;
    --accent: #ff8c46;
    --accent-ink: #ffb17d;
    --warning: #e3b95d;
    --danger: #ff8588;
    --success: #83cba0;
    --focus: #ff9d61;
    --source-signal: #79b8ba;
    --source-soft: #203638;
    --target-signal: #ff8c46;
    --target-soft: #43291b;
    --visual-well: #211e18;
    --backdrop: rgb(0 0 0 / 0.7);
  }
}

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

html {
  min-width: 320px;
  overflow-x: clip;
  background: var(--canvas);
  color-scheme: light dark;
  text-size-adjust: 100%;
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: clip;
  background: var(--canvas);
  color: var(--ink-soft);
  font: 400 16px/1.55 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

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

button,
select,
input[type="checkbox"] {
  accent-color: var(--accent);
}

button,
a,
summary,
select,
input,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

a {
  color: var(--accent-ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent);
}

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

h1,
h2,
h3,
p,
dl,
dd,
figure {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--ink);
}

h1 {
  max-width: 900px;
  margin-bottom: var(--s2);
  font: 400 clamp(25px, 3.1vw, 36px)/1.13 var(--font-serif);
  letter-spacing: -0.015em;
}

h2 {
  margin-bottom: var(--s3);
  font-size: 20px;
  line-height: 1.25;
}

h3 {
  margin: var(--s6) 0 var(--s2);
  font-size: 16px;
  line-height: 1.35;
}

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

[hidden] {
  display: none !important;
}

.shell {
  width: min(1080px, calc(100% - 48px));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  z-index: 100;
  inset: var(--s2) auto auto var(--s2);
  padding: var(--s3) var(--s4);
  transform: translateY(-160%);
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font-weight: 700;
}

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

.site-header {
  min-height: 56px;
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
}

.wordmark {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: var(--s2);
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}

.wordmark__tail {
  color: var(--muted);
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--s1);
}

.header-action {
  min-width: 44px;
  min-height: 44px;
  padding: 0 var(--s3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 650;
}

.header-action:hover {
  background: var(--paper-deep);
  color: var(--ink);
}

.header-action--square {
  padding: 0;
  font: 700 17px/1 var(--font-mono);
}

.hero {
  padding-top: var(--s6);
}

.eyebrow,
.section-kicker {
  margin-bottom: var(--s1);
  color: var(--accent-ink);
  font-size: 12.5px;
  font-weight: 750;
  letter-spacing: 0.06em;
  line-height: 1.3;
  text-transform: uppercase;
}

.lead {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: clamp(14px, 1.5vw, 17px);
  line-height: 1.45;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--s6);
  align-items: start;
  margin-top: var(--s6);
}

.desk {
  min-width: 0;
  display: grid;
  gap: var(--s4);
}

.control-group {
  min-width: 0;
}

.control-label,
.control-label-row {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.25;
}

.control-label {
  display: block;
  margin-bottom: var(--s2);
}

.control-label-row {
  min-height: 20px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s3);
  margin-bottom: var(--s2);
}

.text-button {
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.text-button--strong {
  min-height: 44px;
  font-size: 14px;
}

.segmented {
  display: grid;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--paper);
}

.segmented--direction {
  grid-template-columns: 1fr 1fr;
}

.segmented button {
  min-width: 0;
  min-height: 48px;
  padding: 0 var(--s3);
  border: 0;
  border-right: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
}

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

.segmented button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  font-weight: 750;
}

.segmented button:not([aria-pressed="true"]):hover {
  background: var(--paper-deep);
}

.source-mode {
  display: grid;
  gap: var(--s3);
}

.source-mode__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
}

.source-mode__head > .control-label {
  margin: 0;
}

.mode-switch {
  display: inline-flex;
  border-bottom: 1px solid var(--line-strong);
}

.mode-switch button {
  min-height: 36px;
  padding: 0 var(--s3);
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.mode-switch button[aria-pressed="true"] {
  border-bottom-color: var(--accent);
  color: var(--ink);
}

.stepper {
  display: grid;
  grid-template-columns: 56px minmax(94px, 1fr) 56px;
  gap: var(--s2);
}

.stepper button,
.stepper input {
  height: 56px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
}

.stepper button {
  padding: 0;
  font-size: 25px;
  line-height: 1;
}

.stepper button:hover:not(:disabled) {
  background: var(--paper-deep);
}

.stepper input {
  min-width: 0;
  width: 100%;
  padding: 0 var(--s2);
  text-align: center;
  font: 400 44px/1 var(--font-serif);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.015em;
}

.stepper input[aria-invalid="true"],
#foot-input[aria-invalid="true"] {
  border: 2px solid var(--danger);
}

.input-hint,
.micro-note {
  min-height: 20px;
  margin: var(--s1) 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}

.input-hint[data-kind="error"] {
  color: var(--danger);
  font-weight: 650;
}

.region-row {
  display: flex;
  min-width: 0;
}

.tabs {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line-strong);
}

.tabs button {
  min-width: 0;
  min-height: 44px;
  padding: 0 var(--s2);
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.tabs button[aria-selected="true"] {
  border-bottom-color: var(--accent);
  color: var(--ink);
}

.tabs button:hover:not(:disabled) {
  background: var(--paper-deep);
}

.legend {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.chip-strip {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  contain: inline-size layout paint;
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
}

.chip {
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.chip:hover {
  border-color: var(--ink);
  background: var(--paper-deep);
  color: var(--ink);
}

.chip[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.chip__exception,
.chip sup {
  margin-left: 2px;
  color: currentColor;
  font: 800 11px/1 var(--font-mono);
}

.width-control select,
.measurement-input > input {
  width: 100%;
  min-height: 48px;
  padding: 0 42px 0 var(--s3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background-color: var(--paper);
  color: var(--ink);
}

.ledger {
  position: relative;
  min-width: 0;
  min-height: 480px;
  padding: 22px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--paper);
  color: var(--ink-soft);
  transition: opacity 140ms ease-out;
}

.result-sentinel {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
}

.downgrade {
  margin: 0 0 var(--s3);
  padding: var(--s2) var(--s3);
  border-left: 3px solid var(--warning);
  background: var(--paper-deep);
  color: var(--warning);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.45;
}

.badge {
  width: fit-content;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  margin: 0 0 var(--s2);
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 750;
  line-height: 1.2;
}

.badge::before {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  content: "";
}

.badge[data-confidence="exact"],
.badge[data-confidence="derived"] {
  border-color: var(--ink);
  background: var(--paper-deep);
  color: var(--ink);
}

.badge[data-confidence="exact"]::before {
  background: currentColor;
}

.badge[data-confidence="derived"]::before {
  border-radius: 50% 0 0 50%;
  background: currentColor;
}

.badge[data-confidence="range"] {
  border-color: var(--warning);
  color: var(--warning);
}

.badge[data-confidence="range"]::before {
  width: 0;
  height: 0;
  border-width: 0 5px 9px;
  border-style: solid;
  border-color: transparent transparent currentColor;
  border-radius: 0;
  background: transparent;
}

.answer-block {
  min-height: 112px;
}

.answer {
  min-height: 78px;
  display: flex;
  align-items: flex-end;
  gap: var(--s3);
  margin: 0;
  color: var(--ink);
}

.answer__value {
  max-width: 100%;
  font: 400 clamp(46px, 8vw, 76px)/1 var(--font-serif);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.answer__meta {
  display: grid;
  gap: 1px;
  padding-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.05;
  text-transform: uppercase;
}

.ledger[data-state="no-equivalent"] .answer__value,
.ledger[data-state="out-of-range"] .answer__value {
  max-width: 560px;
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.08;
}

.action-line {
  min-height: 48px;
  margin: var(--s1) 0 var(--s3);
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4;
}

.source-line {
  margin: 0 0 var(--s4);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.45;
}

.cross-system {
  display: grid;
  gap: 2px;
  padding: var(--s3) 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font: 400 13px/1.45 var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.cross-system p {
  margin: 0;
  overflow-wrap: anywhere;
}

.label-difference {
  margin: var(--s3) 0 0;
  padding: var(--s2) var(--s3);
  border-left: 3px solid var(--accent);
  background: var(--paper-deep);
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.45;
}

.ladder {
  width: 100%;
  height: auto;
  max-height: 126px;
  display: block;
  margin: var(--s3) 0 var(--s2);
  overflow: visible;
}

.ladder__rule,
.ladder__tick {
  stroke: var(--line-strong);
  stroke-width: 1.25;
  vector-effect: non-scaling-stroke;
}

.ladder__connector,
.ladder__range {
  stroke: var(--accent);
  stroke-width: 2.25;
  vector-effect: non-scaling-stroke;
}

.ladder__marker circle,
.ladder__static-marker {
  fill: var(--accent);
  stroke: var(--paper);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.ladder__row-label,
.ladder__tick-label,
.ladder__active-label,
.ladder__gs-label,
.ladder__empty {
  fill: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.ladder__active-label {
  fill: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.ladder__gs-band {
  fill: var(--paper-deep);
  stroke: var(--line-strong);
  stroke-width: 1;
}

.width-result {
  min-height: 46px;
  margin: var(--s2) 0 var(--s4);
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.48;
}

.result-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s2);
}

.result-actions button,
.intent-shortcuts button,
.secondary-button {
  min-height: 44px;
  padding: 0 var(--s3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.25;
}

.result-actions button:hover,
.intent-shortcuts button:hover,
.secondary-button:hover {
  border-color: var(--ink);
  background: var(--paper-deep);
  color: var(--ink);
}

.copy-fallback {
  width: 100%;
  min-height: 100px;
  margin-top: var(--s3);
  padding: var(--s3);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font: 13px/1.45 var(--font-mono);
}

.ledger--stale {
  opacity: 0.95;
  border-style: dashed;
}

.intent-shortcuts {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  contain: inline-size layout paint;
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin-top: var(--s3);
}

.intent-shortcuts button {
  border-style: dashed;
  background: transparent;
  color: var(--accent-ink);
}

.kids-block {
  margin-top: var(--s7);
  padding: var(--s4) var(--s5);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--paper-deep);
}

.kids-block h2 {
  margin-bottom: var(--s2);
  font: 400 32px/1 var(--font-serif);
  font-variant-numeric: tabular-nums;
}

.kids-block p:last-child {
  max-width: 760px;
  margin-bottom: 0;
}

.exceptions,
.method-summary,
.disclosure,
.noscript-note {
  margin-top: 48px;
}

.section-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.55fr);
  gap: var(--s6);
  align-items: end;
  margin-bottom: var(--s4);
}

.section-heading h2,
.method-summary h2 {
  margin-bottom: 0;
  font: 400 clamp(24px, 3vw, 31px)/1.15 var(--font-serif);
  letter-spacing: -0.012em;
}

.section-heading > p {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 14px;
}

.table-wrap {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  contain: inline-size layout paint;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--line-strong);
  background: var(--paper);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.45;
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--paper-deep);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.data-table tbody th,
.data-table--chart td,
.data-table--chart tbody th {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.data-table tbody tr:last-child > * {
  border-bottom: 0;
}

.data-table button {
  min-height: 44px;
  margin: -8px -10px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--accent-ink);
  font-weight: 750;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.data-table tr[aria-current="true"],
.data-table tr[data-active="true"] {
  box-shadow: inset 3px 0 0 var(--accent);
  color: var(--ink);
  font-weight: 700;
}

.data-table--exceptions {
  min-width: 760px;
}

.data-table--chart {
  min-width: 720px;
}

.data-table caption {
  padding: var(--s3) var(--s4);
  color: var(--ink);
  font-weight: 700;
  text-align: left;
}

.disclosure {
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line);
}

.disclosure > summary {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  color: var(--ink);
  font-size: 16px;
  font-weight: 750;
  list-style: none;
  cursor: pointer;
}

.disclosure > summary::-webkit-details-marker {
  display: none;
}

.disclosure > summary::after {
  flex: 0 0 auto;
  color: var(--accent-ink);
  content: "→";
  font: 700 18px/1 var(--font-mono);
  transition: transform 180ms ease-out;
}

.disclosure[open] > summary::after {
  transform: rotate(90deg);
}

.disclosure__body {
  padding: var(--s5) 0 var(--s6);
  border-top: 1px solid var(--line);
}

.foot-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.7fr) minmax(0, 1.3fr);
  gap: var(--s7);
  align-items: start;
}

.measurement-input {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) auto;
  gap: var(--s2);
}

.measurement-input > input {
  min-width: 0;
  padding: 0 var(--s3);
  font: 400 30px/1 var(--font-serif);
  font-variant-numeric: tabular-nums;
}

.segmented--unit {
  grid-template-columns: repeat(3, 48px);
}

.segmented--unit button {
  min-height: 48px;
  padding: 0;
}

.measure-guide {
  position: relative;
  min-height: 126px;
  padding: 40px var(--s4) var(--s3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--paper);
}

.measure-guide__heel,
.measure-guide__toe {
  position: absolute;
  top: 12px;
  color: var(--muted);
  font: 12px/1 var(--font-mono);
}

.measure-guide__heel {
  left: var(--s4);
}

.measure-guide__toe {
  right: var(--s4);
}

.measure-guide__rule {
  position: absolute;
  top: 29px;
  right: var(--s4);
  left: var(--s4);
  height: 8px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  border-left: 2px solid var(--accent);
}

.measure-guide p {
  margin: var(--s3) 0 0;
  color: var(--ink-soft);
  font-size: 13.5px;
}

.prose-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s6);
}

.prose-grid h2 {
  margin-bottom: var(--s2);
  font-size: 16px;
}

.prose-grid p {
  margin-bottom: 0;
  font-size: 14px;
}

.chart-note {
  max-width: 820px;
  color: var(--muted);
  font-size: 14px;
}

.method-summary {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1.3fr);
  gap: var(--s6);
  align-items: start;
  padding: var(--s7) 0;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--line);
}

.method-summary > p {
  margin-bottom: 0;
}

.method-summary > button {
  grid-column: 2;
  justify-self: start;
}

.noscript-note {
  padding: var(--s4);
  border-left: 3px solid var(--warning);
  background: var(--paper-deep);
}

.noscript-note h2 {
  margin-bottom: var(--s2);
  font-size: 17px;
}

.noscript-note p {
  margin-bottom: 0;
}

.site-footer {
  margin-top: var(--s9);
  padding: var(--s5) 0 calc(var(--s6) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: var(--s3) var(--s6);
  align-items: center;
}

.theme-control {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.theme-control button {
  min-height: 34px;
  padding: 0 9px;
  border: 0;
  border-right: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.theme-control button:last-child {
  border-right: 0;
}

.theme-control button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s3);
}

.footer-links button {
  min-height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-ink);
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.privacy-line {
  grid-column: 1 / -1;
  margin: 0;
}

body[data-offline="true"] #offline-status {
  color: var(--warning);
  font-weight: 750;
}

dialog {
  width: min(600px, calc(100% - 32px));
  max-height: 82vh;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--paper);
  color: var(--ink-soft);
}

dialog::backdrop {
  background: var(--backdrop);
}

.dialog-head {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--line);
}

.dialog-head h2 {
  margin: 0;
  font: 400 25px/1.15 var(--font-serif);
}

.dialog-head button {
  min-height: 44px;
  padding: 0 var(--s3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.dialog-body {
  max-height: calc(82vh - 65px);
  padding: var(--s5);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.dialog-body > :last-child {
  margin-bottom: 0;
}

.source-list {
  padding-left: 1.2em;
}

.source-list li {
  margin-bottom: var(--s2);
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: var(--s2);
  margin: var(--s5) 0 var(--s4);
  color: var(--ink);
}

.check-row input {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  margin-top: 2px;
}

.shortcut-list {
  display: grid;
  gap: var(--s2);
}

.shortcut-list > div {
  display: grid;
  grid-template-columns: minmax(126px, 0.5fr) minmax(0, 1fr);
  gap: var(--s3);
  padding-bottom: var(--s2);
  border-bottom: 1px solid var(--line);
}

.shortcut-list dt,
.shortcut-list dd {
  margin: 0;
}

kbd {
  min-width: 27px;
  min-height: 25px;
  display: inline-grid;
  place-items: center;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--paper-deep);
  color: var(--ink);
  font: 700 12px/1 var(--font-mono);
}

.toast {
  position: fixed;
  z-index: 40;
  right: 50%;
  bottom: 18px;
  width: min(360px, calc(100% - 32px));
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s2) var(--s2) var(--s2) var(--s4);
  transform: translate(50%, 4px);
  opacity: 0;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--paper);
  font-size: 13.5px;
  transition: opacity 160ms ease-out, transform 160ms ease-out;
}

.toast[data-visible="true"] {
  transform: translate(50%, 0);
  opacity: 1;
}

.toast button {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid currentColor;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  font-size: 20px;
}

.sticky-summary {
  position: fixed;
  z-index: 30;
  right: 0;
  bottom: 0;
  left: 0;
  min-height: calc(44px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: 0 var(--s4) env(safe-area-inset-bottom);
  border-top: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
  font: 700 13px/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.sticky-summary button {
  min-width: 64px;
  min-height: 40px;
  padding: 0 var(--s3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  font-weight: 750;
}

@media (min-width: 900px) and (min-height: 760px) {
  .ledger {
    position: sticky;
    top: 16px;
  }
}

@media (min-width: 1080px) {
  .result-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .result-actions #swap-result {
    grid-column: 1 / -1;
  }
}

@media (max-width: 899px) {
  .shell {
    width: min(100% - 40px, 760px);
  }

  .workbench {
    grid-template-columns: minmax(0, 1fr);
  }

  .desk {
    max-width: 680px;
  }

  .ledger {
    min-height: 440px;
  }

  .section-heading,
  .method-summary {
    grid-template-columns: 1fr;
    gap: var(--s3);
  }

  .method-summary > button {
    grid-column: auto;
  }
}

@media (max-width: 680px) {
  .shell {
    width: calc(100% - 32px);
  }

  .site-header,
  .site-header__inner {
    min-height: 52px;
  }

  .wordmark {
    font-size: 13px;
  }

  .wordmark__tail {
    display: none;
  }

  .header-action {
    min-height: 42px;
    padding-inline: 9px;
    font-size: 12.5px;
  }

  .header-action--square {
    width: 42px;
    padding: 0;
  }

  .hero {
    padding-top: var(--s4);
  }

  .eyebrow {
    display: none;
  }

  h1 {
    margin-bottom: var(--s1);
    font-size: clamp(25px, 7.2vw, 30px);
  }

  .lead {
    max-width: 100%;
    font-size: 14px;
    line-height: 1.35;
  }

  .workbench {
    margin-top: var(--s4);
    gap: var(--s3);
  }

  .desk {
    display: contents;
  }

  .direction-control {
    order: 1;
  }

  .source-mode {
    order: 2;
    gap: var(--s2);
  }

  .region-control {
    order: 3;
  }

  .brand-control {
    order: 4;
  }

  .ledger {
    order: 5;
  }

  .width-control {
    order: 6;
    margin-top: var(--s2);
  }

  .segmented--direction button {
    min-height: 50px;
    padding-inline: var(--s2);
    font-size: 13.5px;
  }

  .source-mode[data-mode="label"] {
    gap: 0;
  }

  .source-mode[data-mode="label"] .source-mode__head {
    display: none;
  }

  .source-mode__head {
    min-height: 30px;
  }

  .mode-switch button {
    min-height: 32px;
    padding-inline: var(--s2);
    font-size: 12.5px;
  }

  .stepper {
    grid-template-columns: 56px minmax(94px, 1fr) 56px;
  }

  .stepper input {
    font-size: 40px;
  }

  .input-hint {
    min-height: 18px;
    margin-top: 2px;
    font-size: 12px;
  }

  .control-label-row {
    margin-bottom: var(--s1);
  }

  .tabs button {
    min-height: 42px;
    font-size: 13px;
  }

  .brand-control {
    min-width: 0;
  }

  .chip-strip {
    width: 100%;
    margin-right: 0;
    padding-right: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
  }

  .chip {
    min-height: 40px;
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  .legend {
    font-size: 11.5px;
  }

  .ledger {
    min-height: 420px;
    padding: var(--s4);
  }

  .badge {
    min-height: 24px;
    margin-bottom: var(--s1);
  }

  .answer-block {
    min-height: 96px;
  }

  .answer {
    min-height: 62px;
  }

  .answer__value {
    font-size: clamp(46px, 15vw, 60px);
  }

  .answer__meta {
    padding-bottom: 5px;
    font-size: 11.5px;
  }

  .action-line {
    min-height: 40px;
    margin-bottom: var(--s2);
    font-size: 15.5px;
  }

  .source-line {
    margin-bottom: var(--s2);
    font-size: 11.5px;
  }

  .cross-system {
    padding-block: var(--s2);
    font-size: 12px;
  }

  .ladder {
    max-height: 112px;
    margin-block: var(--s2) var(--s1);
  }

  .width-result {
    min-height: 42px;
    margin-bottom: var(--s3);
    font-size: 13px;
  }

  .result-actions {
    gap: 6px;
  }

  .result-actions button {
    min-height: 42px;
    padding-inline: var(--s2);
    font-size: 12.5px;
  }

  .intent-shortcuts {
    margin-top: var(--s2);
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .intent-shortcuts button {
    flex: 0 0 auto;
    min-height: 40px;
    font-size: 12.5px;
  }

  .exceptions,
  .method-summary,
  .disclosure,
  .noscript-note {
    margin-top: 36px;
  }

  .section-heading h2,
  .method-summary h2 {
    font-size: 25px;
  }

  .table-wrap {
    width: 100%;
    margin-right: 0;
  }

  .foot-grid,
  .prose-grid {
    grid-template-columns: 1fr;
    gap: var(--s5);
  }

  .measurement-input {
    grid-template-columns: minmax(90px, 1fr) auto;
  }

  .segmented--unit {
    grid-template-columns: repeat(3, 44px);
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--s3);
  }

  .theme-control {
    width: fit-content;
  }

  .footer-links {
    justify-content: flex-start;
  }

  .privacy-line {
    grid-column: auto;
  }

  .toast {
    bottom: calc(56px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 430px) {
  .control-label-row {
    align-items: center;
  }

  #foot-toggle {
    max-width: 150px;
    text-align: right;
  }

  .result-actions {
    grid-template-columns: 1fr 1fr;
  }

  .result-actions #swap-result {
    grid-column: 1 / -1;
  }

  .shortcut-list > div {
    grid-template-columns: 1fr;
    gap: var(--s1);
  }
}

@media (max-width: 360px) {
  .shell {
    width: calc(100% - 24px);
  }

  .header-action:first-child {
    display: none;
  }

  .lead {
    font-size: 13.5px;
  }

  .stepper {
    gap: 6px;
  }

  .stepper button {
    width: 56px;
  }

  .answer__value {
    font-size: 46px;
  }

  .ledger[data-state="no-equivalent"] .answer__value,
  .ledger[data-state="out-of-range"] .answer__value {
    font-size: 28px;
  }

  .source-line {
    overflow-wrap: anywhere;
  }

  .result-actions {
    grid-template-columns: 1fr;
  }

  .result-actions #swap-result {
    grid-column: auto;
  }
}

@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 (forced-colors: active) {
  :root {
    --canvas: Canvas;
    --paper: Canvas;
    --paper-deep: Canvas;
    --ink: CanvasText;
    --ink-soft: CanvasText;
    --muted: GrayText;
    --line: GrayText;
    --line-strong: ButtonBorder;
    --accent: Highlight;
    --accent-ink: LinkText;
    --warning: CanvasText;
    --danger: CanvasText;
    --success: CanvasText;
    --focus: Highlight;
  }

  .chip[aria-pressed="true"],
  .segmented button[aria-pressed="true"],
  .theme-control button[aria-pressed="true"],
  .sticky-summary button {
    forced-color-adjust: none;
    background: Highlight;
    color: HighlightText;
  }

  .ladder__marker circle,
  .ladder__static-marker {
    forced-color-adjust: none;
    fill: Highlight;
    stroke: Canvas;
  }

  .badge::before {
    forced-color-adjust: none;
  }
}

@media print {
  :root,
  html[data-theme="dark"],
  html[data-theme="system"] {
    --canvas: white;
    --paper: white;
    --paper-deep: white;
    --ink: black;
    --ink-soft: black;
    --muted: black;
    --line: black;
    --line-strong: black;
    --accent: black;
    --accent-ink: black;
    --warning: black;
    --danger: black;
    --success: black;
    --focus: black;
  }

  @page {
    margin: 12mm;
  }

  body {
    background: white;
    color: black;
    font-size: 11pt;
  }

  .site-header,
  .desk,
  .intent-shortcuts,
  .exceptions,
  #foot-panel,
  #fit-details,
  .method-summary,
  .site-footer,
  dialog,
  .toast,
  .sticky-summary,
  .result-actions,
  .copy-fallback,
  .skip-link,
  noscript {
    display: none !important;
  }

  .shell {
    width: 100%;
  }

  .hero {
    padding-top: 0;
  }

  .workbench {
    display: block;
    margin-top: 8mm;
  }

  .ledger {
    position: static;
    min-height: 0;
    padding: 6mm;
    break-inside: avoid;
  }

  .chart-details {
    display: block;
    margin-top: 8mm;
    border: 0;
  }

  .chart-details > summary {
    display: block;
    min-height: 0;
    margin-bottom: 4mm;
    list-style: none;
    font-size: 16pt;
  }

  .chart-details > summary::after {
    display: none;
  }

  .chart-details > .disclosure__body {
    display: block !important;
    padding: 0;
    border: 0;
  }

  .table-wrap {
    overflow: visible;
    border-color: black;
  }

  .data-table {
    min-width: 0;
    font-size: 8.5pt;
  }

  .data-table thead th {
    position: static;
    background: white;
  }

  .data-table tr {
    break-inside: avoid;
  }

  .data-table th,
  .data-table td {
    padding: 2.2mm;
  }

  .ladder {
    max-height: 28mm;
  }

  a {
    color: black;
    text-decoration: none;
  }
}
