/* calibrate UI: the sao.dev tokens (/ui/tokens.css, served from dev/sao/design)
   and the surfaces built on them. Square, 1px rules, mono labels, color only
   where it means something. Phone-first.
   Thread: systems/calibrate/threads/zt_2026-10-11_beta.md (step C5) */

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); touch-action: manipulation; }
body {
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px 96px;
  min-height: 100dvh;
  -webkit-text-size-adjust: 100%;
}
a { color: inherit; }

.label, .kicker, .meta, .chip, button, .topbar, .bar-legend {
  font-family: var(--font-mono);
}
.label { font-size: 11px; font-weight: 500; letter-spacing: var(--track-label); text-transform: uppercase; color: var(--text-muted); }
.kicker { font-size: 11px; font-weight: 500; letter-spacing: var(--track-kicker); text-transform: uppercase; color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.kicker::before { content: ''; width: 6px; height: 6px; background: var(--accent); }
.meta { font-size: 10px; letter-spacing: 0.06em; color: var(--text-dim); }
.data { font-family: var(--font-mono); font-weight: 600; letter-spacing: -0.02em; }
h1 { font-family: var(--font-mono); font-size: 25px; font-weight: 600; line-height: 1.1; letter-spacing: -0.01em; margin: 8px 0 4px; }
h2 { font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: var(--track-label); text-transform: uppercase; color: var(--text-muted); margin: 24px 0 8px; }
p { margin: 4px 0; }
.panel > h2:first-child, .panel > .label:first-child { margin-top: 0; display: block; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 0; background: var(--bg);
  border-bottom: var(--rule-strong) solid var(--border-strong);
  font-size: 11px; letter-spacing: var(--track-label); text-transform: uppercase;
}
.topbar .mark { font-weight: 600; color: var(--text); text-decoration: none; }
.topbar .spacer { flex: 1; }
.dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; }
.dot-ok { background: var(--ok); }
.dot-bad { background: var(--bad); }
.dot-run { background: var(--text); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }

.panel { background: var(--surface); border: var(--rule-hair) solid var(--border); padding: 14px; margin: 12px 0; }
.row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: var(--rule-hair) solid var(--border); text-decoration: none; }
.row:hover { background: var(--surface); box-shadow: inset 2px 0 0 var(--accent); }
.row .grow { flex: 1; min-width: 0; }
.chip { font-size: 10px; letter-spacing: 0.06em; border: var(--rule-hair) solid var(--border); padding: 2px 7px; border-radius: var(--radius-sm); color: var(--text-muted); white-space: nowrap; }
.chip.ok { color: var(--ok); border-color: var(--ok); }
.chip.warn { color: var(--warn); border-color: var(--warn); }
.chip.bad { color: var(--bad); border-color: var(--bad); }

button {
  font-size: 12px; letter-spacing: var(--track-label); text-transform: uppercase;
  padding: 10px 14px; min-height: 44px; cursor: pointer;
  background: transparent; color: var(--text-muted);
  border: var(--rule-hair) solid var(--border-strong); border-radius: 0;
}
button.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
button.picked { border-color: var(--accent-2); color: var(--text); }
button:disabled { opacity: 0.4; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.actions button { flex: 1 1 0; }

input, textarea, select {
  width: 100%; font: inherit; font-size: 16px; color: var(--text);
  background: var(--bg-inset); border: var(--rule-hair) solid var(--border); border-radius: 0;
  padding: 10px; margin: 4px 0 10px;
}
textarea { min-height: 88px; resize: vertical; }
.field { display: block; }
.question { border-left: var(--rule-strong) solid var(--border-strong); padding-left: 12px; margin: 12px 0; }

/* The card: the question, the span in a recessed well, the proposed answer. */
.card .span {
  background: var(--bg-inset); border: var(--rule-hair) solid var(--border);
  padding: 14px; margin: 10px 0; font-size: 18px; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
}
.card .proposed { color: var(--text-muted); font-size: 14px; }
.card .proposed b { font-family: var(--font-mono); color: var(--accent-2); font-weight: 500; }

.progress { margin: 10px 0; }
.bar { height: 8px; background: var(--bg-inset); border: var(--rule-hair) solid var(--border); }
.bar > i { display: block; height: 100%; background: var(--text); }
.bar.indeterminate > i { width: 30%; animation: slide 1.6s infinite linear; }
@keyframes slide { from { margin-left: 0; } to { margin-left: 70%; } }
.bar-legend { display: flex; justify-content: space-between; font-size: 10px; letter-spacing: 0.06em; color: var(--text-dim); margin-top: 4px; }

.counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; }
.counts > * { display: block; border: var(--rule-hair) solid var(--border); padding: 8px; text-decoration: none; }
.counts > a:hover { background: var(--surface); box-shadow: inset 2px 0 0 var(--accent); }
.counts > a.active { border-color: var(--text); }
.counts .data { font-size: 25px; line-height: 1; }
.answer { display: flex; justify-content: space-between; gap: 8px; font-family: var(--font-mono); font-size: 13px; padding: 4px 0; }
.prob { flex: 1; height: 6px; align-self: center; background: var(--bg-inset); border: var(--rule-hair) solid var(--border); }
.prob > i { display: block; height: 100%; background: var(--accent-2); }
.commands { font-family: var(--font-mono); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg-inset); border: var(--rule-hair) solid var(--border); padding: 10px; margin: 10px 0 0; }
.error { color: var(--bad); font-family: var(--font-mono); font-size: 12px; }
.missing { color: var(--warn); font-family: var(--font-mono); font-size: 12px; }
.empty { color: var(--text-dim); font-size: 14px; padding: 12px 0; }
.working { color: var(--text-dim); font-family: var(--font-mono); font-size: 12px; padding: 12px 0; }
.timeline { margin: 4px 0 10px; font-size: 12px; }
.timeline ol { list-style: none; margin: 0 0 6px; padding: 0; }
.timeline li.warm { color: var(--text-dim); }
.timeline li { display: flex; justify-content: space-between; border-bottom: var(--rule-hair) solid var(--border); padding: 2px 0; }
.label-rows { list-style: none; margin: 8px 0; padding: 0; }
.label-row { border-bottom: var(--rule-hair) solid var(--border); padding: 10px 0; }
.label-row .span { font-size: 15px; white-space: pre-wrap; word-break: break-word; }
.label-row .label-meta { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
.label-row .label-meta b { color: var(--accent-2); font-weight: 500; }
.label-row .actions { margin-top: 6px; }
.label-row .actions button { flex: 0 1 auto; }
.actions.download { align-items: center; }
.actions.download button { flex: 0 0 auto; }
.judged { font-family: var(--font-mono); font-size: 12px; color: var(--ok); margin-top: 12px; }
.judged.error { color: var(--bad); }
.choices { list-style: none; margin: 8px 0; padding: 0; }
.choice { display: flex; align-items: center; gap: 10px; border-bottom: var(--rule-hair) solid var(--border); padding: 8px 0 8px 10px; }
.choice.chosen { box-shadow: inset 2px 0 0 var(--accent-2); }
.choice .grow { flex: 1; min-width: 0; }
.choice-name { font-family: var(--font-mono); font-size: 13px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.choice button { flex: 0 0 auto; }

/* The explorer: a scrolling well of rows; the page itself never scrolls sideways. */
.explore-search { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
#explore-search { flex: 1 1 200px; }
.toggle { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.toggle input { width: auto; margin: 0; }
.table-wrap { overflow-x: auto; border: var(--rule-hair) solid var(--border); background: var(--bg-inset); margin: 8px 0; }
table.explore { border-collapse: collapse; width: 100%; font-size: 14px; line-height: 1.4; }
table.explore th, table.explore td { text-align: left; vertical-align: top; padding: 6px 8px; border-bottom: var(--rule-hair) solid var(--border); }
table.explore td { max-width: 320px; overflow-wrap: anywhere; }
table.explore td.text { min-width: 220px; white-space: pre-wrap; }
table.explore tbody tr:hover { background: var(--surface); box-shadow: inset 2px 0 0 var(--accent); }
table.explore th { position: sticky; top: 0; background: var(--surface); }
button.sort { min-height: 0; padding: 2px 0; border: 0; font-size: 11px; color: var(--text-muted); white-space: nowrap; }
button.sort.active { color: var(--text); }
.explore-link { margin: 12px 0; font-family: var(--font-mono); font-size: 12px; }
.explore-chip { margin-left: 6px; }
table.explore td.answer-cell { font-family: var(--font-mono); color: var(--accent-2); }
table.explore td.answer-cell.differs { box-shadow: inset 2px 0 0 var(--warn); }
table.explore td.judge-cell { white-space: nowrap; }
.row-judge { display: flex; gap: 4px; }
.row-judge button { min-height: 32px; padding: 4px 8px; font-size: 11px; }
a.judge-link { display: inline-block; font-family: var(--font-mono); font-size: 11px; letter-spacing: var(--track-label); text-transform: uppercase; color: var(--text-muted); text-decoration: none; border: var(--rule-hair) solid var(--border-strong); padding: 6px 8px; }
a.judge-link:hover { color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
table.explore .judged, table.explore .working { display: block; margin: 4px 0 0; padding: 0; font-size: 10px; }
.segmented { display: flex; flex-wrap: wrap; margin: 4px 0 8px; }
.segmented button { flex: 1 1 0; min-height: 36px; padding: 6px 8px; font-size: 11px; }
.segmented button + button { border-left: 0; }
.segmented button.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.phrase-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
ol.phrases { list-style: none; margin: 4px 0; padding: 0; font-size: 13px; }
ol.phrases li { display: grid; grid-template-columns: 1fr auto 3.5em; gap: 8px; align-items: baseline; border-bottom: var(--rule-hair) solid var(--border); }
ol.phrases .data { font-size: 12px; text-align: right; color: var(--text-muted); }
ol.phrases .score { color: var(--accent-2); }
button.phrase { min-height: 0; padding: 4px 0; border: 0; text-align: left; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--text); overflow-wrap: anywhere; }
button.phrase:hover { color: var(--accent); }

/* The embed: one card, framed by the blog (public.js embedPage). */
.embed { padding: 4px 0; }
.embed h2 { margin: 6px 0; }
