:root {
  --bg: #f5f6fb; --surface: #ffffff; --ink: #1d2050; --brand: #262a6e; --muted: #4f5380; /* 7:1 on white, 6.5:1 on --bg */ --line: #e1e3ef;
  --teal: #0b7268; --on-teal: #ffffff; --teal-soft: #e3f5f2; /* 5:1 or more on every light background (WCAG AA) */ --red: #c23a48; --red-soft: #fbe9eb; --amber: #a86a12; --amber-soft: #fbf1df;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11132b; --surface: #1a1d3f; --ink: #e9eaf8; --brand: #e9eaf8; --muted: #b4b7d9; --line: #2c3061;
    --teal: #33c2b2; --on-teal: #0d1f1d; --teal-soft: #163a43; --red: #f07a86; --red-soft: #3d1d2b; --amber: #e5b15b; --amber-soft: #3a2d1c; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11132b; --surface: #1a1d3f; --ink: #e9eaf8; --brand: #e9eaf8; --muted: #b4b7d9; --line: #2c3061;
  --teal: #33c2b2; --on-teal: #0d1f1d; --teal-soft: #163a43; --red: #f07a86; --red-soft: #3d1d2b; --amber: #e5b15b; --amber-soft: #3a2d1c; color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.55;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  padding: 24px max(16px, env(safe-area-inset-right, 0px)) 48px max(16px, env(safe-area-inset-left, 0px));
}
.wrap { max-width: 820px; margin: 0 auto; display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
.card > * { min-width: 0; }
header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; color: var(--brand); margin: 0; }
.privacy { margin: 0; font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.privacy svg { width: 16px; height: 16px; }
h1 { font-size: clamp(24px, 5vw, 32px); line-height: 1.15; letter-spacing: -0.02em; margin: 0; font-weight: 650; }
h2 { font-size: 19px; margin: 0; }
h3 { font-size: 17px; margin: 8px 0 0; }
p { margin: 0; }
a { color: var(--teal); }
.lede, .small, .empty { color: var(--muted); }
.small { font-size: 14px; }
/* Form fields at 16px or more: iPhones zoom the page into anything smaller. */
input, select, textarea { font-size: 16px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; min-height: 44px; padding: 8px 12px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; flex: 0 0 auto; }
/* Phones: all six tabs in view, three to a row, rather than some scrolled off the edge. */
@media (max-width: 620px) {
  .tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; overflow: visible; }
  .tabs button { padding: 9px 4px; white-space: normal; text-align: center; line-height: 1.25; }
}
.tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--teal); }
.parts { margin-top: 12px; }
.parts button[aria-selected="true"] { color: var(--ink); border-color: var(--teal); background: var(--card, transparent); font-weight: 600; }
.drop, .card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; display: grid; gap: 16px; }
/* A <details> card: Safari doesn't lay out a details element's contents as a grid, so the space
   between them is set the same way everywhere, with margins. */
details.card { display: block; }
details.card > * + * { margin-top: 16px; }
details.card > summary { min-height: 44px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; cursor: pointer; }
details.card > summary::before { content: '▸'; content: '▸' / ''; font-size: 0.9em; }
details.card[open] > summary::before { content: '▾'; content: '▾' / ''; }
details:not(.card) > summary { padding: 10px 0; cursor: pointer; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary { list-style: none; }
/* A field's label sits close above it, well apart from what's above. */
.field-label { display: block; }
.field-label + .field, .field-label + .file-pick { margin-top: 8px; }
.drop { border-style: dashed; border-width: 1.5px; }
.drop.over { border-color: var(--teal); background: var(--teal-soft); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
/* On a phone, a field in a row takes the whole width, so its text and hint are seen in full. */
@media (max-width: 620px) { .row > .field { flex: 1 1 100%; } }
.between { justify-content: space-between; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 8px 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.btn.primary { background: var(--teal); border-color: var(--teal); color: var(--on-teal); }
.btn.small { min-height: 44px; padding: 6px 14px; font-size: 15px; }
.btn:focus-visible, label.btn:focus-visible, .link:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.link { background: none; border: 0; color: var(--teal); font: inherit; font-weight: 600; cursor: pointer; padding: 10px 8px; min-height: 44px; min-width: 44px; }
.items { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.item { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: grid; gap: 6px; }
.item .top { display: flex; gap: 10px; align-items: center; min-width: 0; }
.item .name { font-weight: 600; overflow-wrap: anywhere; flex: 1; min-width: 0; }
.item .words { color: var(--muted); font-size: 14px; }
.badge { flex: none; padding: 3px 10px; border-radius: 999px; font-size: 14px; font-weight: 700; background: var(--line); color: var(--muted); }
.badge.ok { background: var(--teal-soft); color: var(--teal); }
.badge.warn { background: var(--amber-soft); color: var(--amber); }
.badge.bad { background: var(--red-soft); color: var(--red); }
.stage { position: relative; align-self: center; justify-self: center; max-width: 100%; touch-action: none; user-select: none; }
.stage img { display: block; max-width: 100%; max-height: 60vh; border-radius: 8px; }
.shape { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.5); cursor: move; font-size: 13px; font-weight: 700; color: #fff; padding: 2px 4px; }
.shape.box { background: #000; } /* as solid as in the copy */
.shape.blur { background: rgba(120,130,150,.6); border-style: dashed; }
.shape.crop { border-color: var(--amber); background: transparent; border-width: 3px; color: var(--amber); padding: 0; pointer-events: none; }
.shape.crop .crop-tab, .shape.crop .crop-edge, .shape.crop .corner { pointer-events: auto; }
.shape.crop .crop-tab { position: absolute; left: -3px; top: -26px; background: var(--amber); color: #fff; padding: 2px 8px; border-radius: 6px 6px 0 0; cursor: move; }
.shape.crop .crop-edge { position: absolute; cursor: move; }
.crop-edge.top, .crop-edge.bottom { left: 0; right: 0; height: 14px; }
.crop-edge.top { top: -9px; }
.crop-edge.bottom { bottom: -9px; }
.crop-edge.left, .crop-edge.right { top: 0; bottom: 0; width: 14px; }
.crop-edge.left { left: -9px; }
.crop-edge.right { right: -9px; }
.shape.sel { border-color: var(--teal); }
.shape .corner { position: absolute; right: -10px; bottom: -10px; width: 22px; height: 22px; border-radius: 50%; background: var(--teal); border: 2px solid #fff; cursor: nwse-resize; }
.redactions { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.redactions li { display: flex; gap: 8px; align-items: center; border-bottom: 1px solid var(--line); padding: 4px 0; }
.redactions li span { flex: 1; }
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; }
.check input[type="checkbox"], .check input[type="radio"] { width: 22px; height: 22px; flex: none; margin: 0; }
.result { padding: 12px; border-radius: 10px; background: var(--teal-soft); display: grid; gap: 8px; }
.result.bad { background: var(--red-soft); }
footer { color: var(--muted); font-size: 15px; text-align: center; display: grid; gap: 4px; justify-items: center; }
/* The footer's links: each a whole tap target, spaced apart. */
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 8px; margin: 0; padding: 0; list-style: none; }
.footer-links a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 10px; font-size: 16px; }
.field { width: 100%; font: inherit; font-size: 16px; min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 15px; overflow-wrap: anywhere; padding: 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); user-select: all; display: block; max-width: 100%; }
.code.long { max-height: 9.5em; overflow-y: auto; font-size: 14px; }
.qrcode svg { display: block; width: 100%; max-width: 300px; height: auto; margin: 8px 0; }
.code-tools { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; margin-bottom: 4px; }
.nowrap { white-space: nowrap; }
.result.warn { background: var(--amber-soft); }
body.locked main, body.locked .tabs { display: none !important; }
.ai-log { display: grid; gap: 8px; margin-bottom: 10px; }
.ai-msg { padding: 10px 12px; border-radius: 10px; }
.ai-msg.me { background: var(--teal-soft); justify-self: end; max-width: 90%; }
.ai-msg.ai { background: var(--bg); border: 1px solid var(--line); }
.ai-msg.action { border: 1px dashed var(--teal); }
.ai-msg.note { color: var(--muted); font-size: 14px; }
.ai-msg p + p, .ai-msg ul { margin-top: 6px; }
dialog:not([open]) { display: none !important; } /* .card sets display; a closed dialog must still vanish */
dialog.card { max-width: min(440px, calc(100vw - 32px)); border: 1px solid var(--line); color: var(--ink); background: var(--surface); }
dialog::backdrop { background: rgba(10, 12, 30, 0.45); }
.stack { display: grid; gap: 10px; }
.notice { background: var(--amber-soft); border-radius: 10px; padding: 12px 14px; font-size: 15px; color: var(--ink); }
.notice summary { cursor: pointer; min-height: 44px; }
.notice .more { color: var(--teal); text-decoration: underline; }
.notice p { margin-top: 8px; }
.code.spoken { font-size: 28px; letter-spacing: 0.08em; text-align: center; }

.grow { flex: 1; }
.live-preview { width: 100%; border-radius: 12px; background: #000; }
.oauth-page { font: 16px system-ui, sans-serif; margin: 2rem; color: #222; background: #fff; }

.lang-switch { background: none; border: 1px solid var(--line, #ccc); border-radius: 999px; min-height: 44px; padding: 6px 12px; font: inherit; font-size: 16px; color: inherit; cursor: pointer; max-width: 100%; }

.overview { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 10px; }
.overview li { border-top: 1px solid var(--line, #ddd); padding-top: 8px; }

/* The Create tab: Creator-plan sections are shown but locked until the plan includes them. */
[data-creator][data-locked] { opacity: 0.72; }
[data-creator][data-locked] .creator-action { cursor: not-allowed; }
ol.nb li, ol.checklist li { margin: 6px 0; }
.cite { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; word-break: break-word; }
.ok { color: var(--teal); }
.bad { color: var(--red); }
.muted { color: var(--muted); }

/* The signature pad: drawing with a finger mustn't scroll the page. */
.sigpad { width: 100%; max-width: 600px; aspect-ratio: 5 / 2; height: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; touch-action: none; display: block; }
/* Marks that lead back to the seal, codes and labels (patent pending). */
fieldset.marks { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 0; display: grid; gap: 8px; min-width: 0; }
fieldset.marks legend { font-weight: 600; padding: 0 4px; }
fieldset.marks[disabled] { opacity: 0.6; }
#projPromissa fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin: 0; display: grid; gap: 6px; min-width: 0; }
#projPromissa fieldset legend { padding: 0 4px; }
#projSentList code, #projectOut code { word-break: break-all; }
.patent { font-size: 14px; font-style: italic; }
.found-code { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.found-code code, .result code.find { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.04em; }
.label-preview { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; max-width: 100%; justify-self: start; }
.label-preview img { display: block; max-width: 100%; height: auto; width: 240px; }
#findCode { text-transform: uppercase; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; min-width: 0; }
/* Video and sound redaction: edits not in force at the frame shown are faint; each edit's row wraps on phones. */
.stage video { display: block; max-width: 100%; max-height: 60vh; border-radius: 8px; background: #000; }
.shape.off { opacity: 0.35; }
.redactions li.media-edit { flex-wrap: wrap; }
.redactions li.media-edit > span:first-child { flex: 1 0 100%; }
.field.num { width: 6.5em; padding: 8px; min-height: 44px; }
#projectStatus code, #projectItems code { overflow-wrap: anywhere; font-size: 14px; }
/* The pre-publish check and Scan a file: findings, fixes, the answers to tick. */
dialog.card.wide { max-width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; }
.findings { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.findings li { border-top: 1px solid var(--line); padding-top: 8px; overflow-wrap: anywhere; }
.findings li .small { display: block; }
.check.top { align-items: flex-start; }
.check.top input { margin-top: 2px; flex: none; }
.name { overflow-wrap: anywhere; }
.terms-changes { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
#termsNotice form { align-items: center; gap: 16px; }

.result .badge.bad, .result .badge.warn { background: var(--surface); }
/* Every independent proof a seal has (web/proofs.mjs): one line each, its status shown by a mark and in words for screen readers. */
.proofs-panel { border-top: 1px solid var(--line); padding-top: 8px; display: grid; gap: 8px; min-width: 0; }
.proofs { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.proofs li { overflow-wrap: anywhere; padding-left: 22px; position: relative; }
.proofs .mark { position: absolute; left: 0; top: 0; width: 18px; text-align: center; font-weight: 700; }
.proofs li.ok .mark::before { content: '✓'; color: var(--teal); }
.proofs li.bad .mark::before { content: '✗'; color: var(--red); }
.proofs li.pending .mark::before { content: '…'; color: var(--amber); }
.proofs li.unchecked .mark::before { content: '?'; color: var(--amber); }
.proofs li.none .mark::before { content: '–'; color: var(--muted); }
.proofs li.none .value, .proofs li.unchecked .value { color: var(--muted); }
.proofs li.bad .value { color: var(--red); }
.proofs .label { font-weight: 600; }
.proofs li[data-line="earliest"] { border-top: 1px solid var(--line); padding-top: 6px; }
.proofs li[data-line="earliest"] .mark { top: 6px; }
.proofs .ask { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.proofs .ask .field { flex: 1 1 220px; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.log-alert { background: var(--red-soft); border: 2px solid var(--red); }
.log-alert h2 { color: var(--red); margin: 0; }
/* A file field (ui.mjs fileButtons): the browser's own small "Choose File" control is covered by a
   full-size button, with the chosen file's name beside it. The real input stays on top of the
   button, invisible, so a tap, the keyboard and screen readers all reach the input itself. */
.file-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; max-width: 100%; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 16px; }
.file-btn:focus-within { outline: 2px solid var(--teal); outline-offset: 2px; }
.file-btn:has(input:disabled) { opacity: 0.6; }
.file-name { color: var(--muted); font-size: 15px; overflow-wrap: anywhere; min-width: 0; }
/* Fields one after another in a box that isn't a grid. */
#storeS3, #storeLighthouse { display: grid; gap: 12px; }
.items:empty { display: none; }
details:not(.card):not(.notice) > * + * { margin-top: 12px; }
#langSwitch { min-width: 0; max-width: 100%; }
/* "Protect your passkey" (web/protect-passkey.mjs) and who signed, in plain words. */
.checklist { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 8px; }
.checklist li p.small { margin: 2px 0 0 28px; }
.signed-by, .card-status, .sent-by { color: var(--muted); }
/* A long key (did:key…) in a result wraps instead of widening the page on a phone. */
.result > * { min-width: 0; }
.result code { overflow-wrap: anywhere; }
