:root {
  --paper: #eeeae0; --panel: #f7f4ed; --ink: #242722; --muted: #62665c;
  --line: #c6c7b9; --accent: #c7401e; --accent-dark: #9c2e12;
  --mono: "IBM Plex Mono", "Courier New", monospace;
  --sans: "Franklin Gothic Medium", "Helvetica Neue", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--paper); color: var(--ink); }
body { margin: 0; font-family: var(--sans); font-size: 16px; line-height: 1.5; }
button, input { font: inherit; }
button, input, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .46; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
button, input, summary { touch-action: manipulation; }
img { max-width: 100%; }
.page { width: min(1360px, 100%); margin: auto; padding: 30px 48px 22px; }
.skip-link { position: absolute; left: 12px; top: -100px; padding: 12px; background: var(--ink); color: white; z-index: 100; }
.skip-link:focus { top: 12px; }
.masthead { display: flex; justify-content: space-between; gap: 20px; align-items: center; border-bottom: 1px solid var(--ink); padding-bottom: 20px; }
.brand { display: flex; align-items: center; gap: 13px; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; color: var(--paper); background: var(--ink); font-size: 16px; font-weight: 700; letter-spacing: -.1em; }
.connection { font: 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; border: 1px solid var(--line); padding: 8px 12px; white-space: nowrap; }
.connection.paired { color: #386139; border-color: #698563; }
.intro { display: grid; grid-template-columns: 1.15fr .85fr; gap: 70px; align-items: end; padding: 45px 0 35px; }
.eyebrow, .rule-label { font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .09em; }
.eyebrow { margin: 0 0 13px; color: var(--muted); }
h1 { margin: 0; font-size: clamp(48px, 6vw, 82px); font-weight: 800; line-height: .98; letter-spacing: -.065em; }
h1 span { color: var(--accent); padding-left: .03em; }
.intro-note { max-width: 425px; justify-self: end; border-left: 2px solid var(--accent); padding-left: 20px; }
.intro-note p { margin: 7px 0 0; font-size: 14px; color: var(--muted); }
.pairing { border: 1px solid var(--line); margin-bottom: 30px; background: #e5e3d9; }
summary { cursor: pointer; padding: 13px 18px; font-family: var(--mono); font-size: 12px; }
.pairing summary span { padding-left: 15px; color: var(--muted); font-size: 10px; }
.pair-form { display: flex; gap: 12px; align-items: end; padding: 4px 18px 0; }
.pair-field { flex: 1; min-width: 0; }
.pairing > p { padding: 0 18px 13px; margin: 8px 0 0; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; }
input[type=password], input[type=text], input[type=number] { width: 100%; min-width: 0; border: 1px solid #aaa99b; background: var(--panel); color: var(--ink); border-radius: 0; padding: 11px 12px; min-height: 44px; }
input::placeholder { color: #75786c; font-size: 12px; }
.button { min-height: 44px; padding: 11px 15px; border: 1px solid var(--ink); border-radius: 0; font-size: 12px; font-weight: 600; line-height: 1.5; transition: background-color .15s; }
.primary { background: var(--accent); border-color: var(--accent); color: #fff8ef; }
.primary:not(:disabled):hover { background: var(--accent-dark); }
.primary span { font-size: 17px; line-height: 0; padding-left: 10px; }
.secondary { background: transparent; }
.secondary:not(:disabled):hover { background: #deded0; }
.quiet { background: none; border-color: transparent; text-decoration: underline; text-underline-offset: 3px; color: var(--muted); }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--ink); }
.tabs button { min-width: 0; padding: 18px 17px; border: 0; border-right: 1px solid var(--ink); background: transparent; color: var(--muted); font-size: 14px; text-align: left; }
.tabs button:last-child { border-right: 0; }
.tabs button[aria-selected=true] { background: var(--ink); color: var(--panel); }
.tabs button span { font: 11px var(--mono); margin-right: 15px; opacity: .7; }
.workbench { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.35fr); border: 1px solid var(--ink); border-top: 0; background: var(--panel); }
.input-panel, .inspection-panel { min-width: 0; padding: 26px; }
.input-panel { border-right: 1px solid var(--line); }
.section-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.section-number { font: 11px var(--mono); width: 22px; height: 22px; border: 1px solid var(--ink); display: grid; place-items: center; }
h2 { font-size: 15px; margin: 0; font-weight: 600; }
.description { color: var(--muted); font-size: 14px; margin: -3px 0 17px; }
.readiness { display: flex; gap: 9px; padding-bottom: 22px; font: 10px/1.5 var(--mono); color: var(--muted); }
.status-dot { margin-top: 4px; width: 6px; height: 6px; flex-shrink: 0; background: #77796b; border-radius: 50%; }
.readiness.ready .status-dot { background: #477446; }
.readiness.unavailable .status-dot { background: var(--accent); }
.upload-field { padding: 16px; border: 1px dashed #aaa99b; margin-bottom: 17px; }
input[type=file] { font: 11px var(--mono); width: 100%; min-width: 0; }
input[type=file]::file-selector-button { color: var(--ink); font: 11px var(--mono); background: #e7e5da; border: 1px solid var(--line); padding: 9px; margin: 0 7px 6px 0; cursor: pointer; }
.small { font-size: 11px; color: var(--muted); line-height: 1.6; overflow-wrap: anywhere; }
.upload-field .small { margin: 6px 0 0; }
.field { margin-bottom: 14px; min-width: 0; }
.dimension-fields { display: grid; grid-template-columns: .65fr .65fr 1.1fr; gap: 10px; }
.optional { font-size: 9px; font-weight: 400; }
.actions { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 22px; }
.actions .primary { display: flex; justify-content: space-between; align-items: center; text-align: left; }
.feedback { font: 11px/1.6 var(--mono); color: var(--muted); margin-top: 20px; padding-left: 10px; border-left: 2px solid var(--line); overflow-wrap: anywhere; }
.feedback.error { color: var(--accent-dark); border-color: var(--accent); }
.feedback.pending { color: var(--ink); border-color: var(--ink); }
.privacy-note { color: var(--muted); font: 9px/1.8 var(--mono); margin: 25px 0 0; padding-top: 17px; border-top: 1px solid var(--line); }
.surface-kind, .record-state { margin-left: auto; font: 10px var(--mono); color: var(--muted); }
.specimen-surface { min-height: 240px; display: flex; align-items: center; justify-content: center; padding: 28px; border: 1px solid var(--line); background-color: #e5e5db; background-image: linear-gradient(#babfb033 1px, transparent 1px), linear-gradient(90deg, #babfb033 1px, transparent 1px); background-size: 18px 18px; }
.empty-preview { padding: 20px; text-align: center; color: var(--muted); }
.empty-preview p { font: 13px var(--mono); margin: 16px 0 5px; }
.empty-preview span { font-size: 11px; }
.crosshair { width: 25px; height: 25px; margin: auto; position: relative; }
.crosshair::before, .crosshair::after { content: ""; background: #868e7b; position: absolute; }
.crosshair::before { height: 1px; width: 25px; top: 12px; left: 0; }
.crosshair::after { width: 1px; height: 25px; left: 12px; top: 0; }
.image-stage { position: relative; width: fit-content; max-width: 100%; min-width: 0; line-height: 0; }
#image-preview { display: block; width: auto; max-width: 100%; height: auto; max-height: none; }
.grid-overlay { position: absolute; inset: 0; display: grid; }
.grid-cell { border: 1px solid #fff9; background: transparent; position: relative; min-width: 0; min-height: 0; padding: 0; color: white; }
.grid-cell span { position: absolute; top: 3px; left: 3px; background: #242722cf; padding: 5px; font: 10px var(--mono); line-height: 1; }
.grid-cell.selected { box-shadow: inset 0 0 0 3px var(--accent); background: #c7401e30; }
.grid-cell.reviewed { box-shadow: inset 0 0 0 3px #245f6d; background: #245f6d30; }
.grid-cell:focus-visible { outline-offset: -4px; z-index: 1; }
.slider-overlay { position: absolute; opacity: .75; outline: 2px solid var(--accent); outline-offset: 1px; pointer-events: none; }
.specimen-caption { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0 18px; font: 9px/1.5 var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.piece-inspection { display: flex; align-items: center; gap: 15px; margin-bottom: 15px; }
.piece-inspection img { max-height: 70px; max-width: 100px; object-fit: contain; border: 1px solid var(--line); }
.result-panel { border-top: 1px solid var(--ink); padding-top: 19px; }
.result-panel .section-heading { margin-bottom: 15px; }
.answer-row { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 18px; }
#result-answer { font: 26px/1.4 var(--mono); letter-spacing: -.05em; overflow-wrap: anywhere; white-space: pre-wrap; }
.telemetry { margin: 0; display: grid; grid-template-columns: 1.4fr .7fr .8fr; border: 1px solid var(--line); }
.telemetry > div { min-width: 0; padding: 12px; border-right: 1px solid var(--line); }
.telemetry > div:last-child { border-right: 0; }
.telemetry dt { font: 8px var(--mono); color: var(--muted); margin-bottom: 8px; }
.telemetry dd { margin: 0; font: 10px/1.6 var(--mono); overflow-wrap: anywhere; }
.warnings { padding: 12px 12px 12px 27px; background: #eedfc9; font: 10px/1.6 var(--mono); color: #6c461b; }
#scores-details { border-bottom: 1px solid var(--line); }
#scores-details summary { padding-left: 0; }
.score-list { font: 10px/1.7 var(--mono); display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 12px; margin: 0 0 15px; padding: 0; list-style: none; }
.expected-panel { border: 1px solid var(--line); margin-top: 20px; background: #eceadd; }
.expected-panel > p, .expected-panel > pre { padding: 0 16px; }
.expected-panel pre { font: 11px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
footer { display: flex; justify-content: space-between; gap: 15px; padding-top: 22px; font: 9px var(--mono); color: var(--muted); }
@media (min-width: 1100px) { .actions { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) {
  .page { padding: 22px 24px; }
  .intro { gap: 30px; }
  .input-panel, .inspection-panel { padding: 21px; }
  .workbench { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
  .specimen-surface { padding: 15px; }
}
@media (max-width: 680px) {
  .page { padding: 16px; }
  .masthead { padding-bottom: 15px; gap: 10px; }
  .brand { font-size: 8px; gap: 8px; }
  .brand-mark { width: 32px; height: 32px; font-size: 14px; }
  .connection { font-size: 8px; padding: 7px 8px; }
  .intro { grid-template-columns: 1fr; gap: 22px; padding: 30px 0; }
  h1 { font-size: clamp(45px, 12vw, 70px); }
  .intro-note { justify-self: start; max-width: none; }
  .intro-note p { font-size: 13px; }
  .pairing { margin-bottom: 22px; }
  .pairing summary { font-size: 11px; }
  .pairing summary span { display: block; padding-left: 13px; padding-top: 5px; }
  .pair-form { flex-wrap: wrap; gap: 8px; }
  .pair-field { flex-basis: 100%; }
  .tabs button { padding: 13px 8px; font-size: 11px; text-align: center; }
  .tabs button span { display: block; margin: 0 0 4px; font-size: 9px; }
  .workbench { grid-template-columns: minmax(0, 1fr); }
  .input-panel { border-right: 0; border-bottom: 1px solid var(--ink); }
  .input-panel, .inspection-panel { padding: 20px 16px; }
  .specimen-surface { min-height: 200px; padding: 14px; }
  .telemetry { grid-template-columns: 1.2fr .7fr .8fr; }
  .telemetry > div { padding: 10px 8px; }
  .dimension-fields { gap: 8px; }
  .dimension-fields label { font-size: 11px; }
  .optional { display: block; }
  .specimen-caption { font-size: 8px; }
  footer { font-size: 8px; flex-wrap: wrap; }
  input[type=password], input[type=text], input[type=number] { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
