:root {
  --paper: #FFFFFF;
  --sheet: #FAF8F5;
  --ink: #0A0A0A;
  --ink-soft: #5F5B55;
  --rule: #ECE8E2;
  --rule-strong: #DCD6CD;
  --tang: #0A0A0A;
  --tang-ink: #82633A;
  --tang-wash: #F5EFE6;
  --on-tang: #FFFFFF;
  --good: #2E6FDB;
  --good-wash: #E8F0FF;
  --warn: #7a4f00;
  --warn-wash: #f8ecd0;
  --bad: #a3261a;
  --bad-wash: #f8e2de;
  --code: #F4F1EC;
  --round: 12px;
  --stack: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    --check-b: #EEEAE4;
  }

:root[data-theme="dark"] {
    --paper: #000000;
    --sheet: #0F0E0D;
    --ink: #FFFFFF;
    --ink-soft: #A8A39C;
    --rule: #24221F;
    --rule-strong: #35322E;
    --tang: #FFFFFF;
    --tang-ink: #C9AE8A;
    --tang-wash: #1C1813;
    --good: #9CC0FF;
    --good-wash: #1B2740;
    --warn: #f2c46b;
    --warn-wash: #352a12;
    --bad: #ff9a8c;
    --bad-wash: #3a1d19;
    --code: #171614;
    --on-tang: #000000;
    --check-a: #1A1917;
    --check-b: #111010;
  }

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

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 var(--stack);
}

h1, h2, h3, p, ul, ol, dl, dd, fieldset, legend { margin: 0; padding: 0; }

fieldset { border: 0; min-width: 0; }

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

a { color: var(--tang-ink); }

code, pre { font-family: var(--mono); }

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

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 0;
  border-bottom: 1px solid var(--rule);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand svg { width: 28px; height: 28px; flex: none; }

.pledge {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 14px;
}

.pledge svg { width: 16px; height: 16px; flex: none; color: var(--tang-ink); }

.intro { padding: 56px 0 32px; max-width: 760px; }

.intro h1 {
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.08;
  letter-spacing: -0.025em;
}

.intro h1 em { font-style: normal; color: var(--tang-ink); }

.intro p {
  margin-top: 16px;
  color: var(--ink-soft);
  font-size: 18px;
}

.callout {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(118,118,128,.08);
  font-size: 14px;
}

.qr-side .skw-nav { position: relative; }
.qr-side .skw-nav input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.qr-side .skw-nav:has(input:focus-visible) { outline: 2px solid var(--sk-accent, #5B8DEF); outline-offset: 1px; }
.qr-ico { width: 17px; height: 17px; flex: none; color: var(--sk-muted, #6E6E73); }
.skw-nav.on .qr-ico { color: var(--sk-ink, #1D1D1F); }

.qr-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--sk-muted, #6E6E73); }
.qr-tag svg { width: 15px; height: 15px; flex: none; }

.qr-pane { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.qr-pane:focus { outline: none; }

.qr-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  grid-template-areas: "f o" "s o";
  gap: 26px 30px;
  align-items: start;
}
#create-form { grid-area: f; }
#style-form { grid-area: s; }
.qr-out { grid-area: o; position: sticky; top: 12px; display: grid; gap: 14px; min-width: 0; }

.qr-col { display: grid; gap: 20px; min-width: 0; }
.qr-col > .fields { display: grid; gap: 16px; min-width: 0; }

.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field > .label { padding-left: 3px; font-size: 12.5px; font-weight: 600; color: var(--sk-muted, #6E6E73); }
.field small { font-weight: 500; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 14px; }
.hint { margin: 0; padding-left: 3px; font-size: 13px; line-height: 1.5; color: var(--sk-muted, #6E6E73); }
.skw textarea.code { font: 13.5px/1.55 var(--mono); }
.skw [aria-invalid="true"] { box-shadow: 0 0 0 1.5px #D93036; }

.skw-seg label > input, .skw-swatches label > input {
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  pointer-events: auto;
  cursor: pointer;
}

.skw-row > .skw-seg { flex: none; }
#qr-win .skw-row { flex-wrap: wrap; }
#qr-win .skw-row > span:first-child { flex: 1 1 96px; }
#qr-win .skw-row input.qr-pick { width: 26px; max-width: none; }
.qr-kinds { display: contents; }

details.more { border-radius: 14px; background: rgba(118,118,128,.07); }
details.more > summary { padding: 12px 16px; font-size: 14px; font-weight: 600; cursor: pointer; }
details.more[open] > summary { padding-bottom: 6px; }
details.more > .fields, details.more > pre { margin: 0 16px 16px; }
details.more > .fields { display: grid; gap: 16px; }

.qr-colour { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; }
.qr-c-black { --c: #000000; }
.qr-c-navy { --c: #1d3557; }
.qr-c-blue { --c: #1f4fbf; }
.qr-c-green { --c: #1e6b3a; }
.qr-c-wine { --c: #7a1f3d; }
.qr-c-white { --c: #ffffff; }
.qr-c-cream { --c: #fff8e7; }
.qr-c-ice { --c: #eef4fb; }
.qr-c-mint { --c: #eaf6ee; }
.qr-pick {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: conic-gradient(#e5484d, #e5a000, #5B98FF, #0894b3, #3b82f6, #8e4ec6, #e5484d);
  cursor: pointer;
}
.qr-pick::-webkit-color-swatch-wrapper { padding: 4px; }
.qr-pick::-webkit-color-swatch { border: 0; border-radius: 50%; box-shadow: 0 0 0 1px rgba(255,255,255,.9); }
.qr-pick::-moz-color-swatch { border: 0; border-radius: 50%; }
#fg-hex, #bg-hex { width: 96px; padding-block: 7px; font-family: var(--mono); font-size: 13.5px; text-transform: lowercase; }
#caption { width: 220px; }

.qr-logo { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.logo-thumb { width: 36px; height: 36px; border-radius: 9px; background: #fff; object-fit: contain; box-shadow: 0 0 0 1px rgba(0,0,0,.08); }

.qr-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 12px 32px rgba(20,40,70,.08), 0 0 0 .5px rgba(0,0,0,.05);
}
.frame {
  display: grid;
  place-items: center;
  min-height: 260px;
  overflow: hidden;
  border-radius: 12px;
  background: #fff;
}
.frame.is-clear { background: repeating-conic-gradient(#E6EAF0 0 25%, #fff 0 50%) 0 0 / 16px 16px; }
.frame canvas { display: block; width: auto; height: auto; max-width: 100%; max-height: 420px; }
.frame .skw-empty { min-height: 260px; }
.empty { max-width: 26ch; font-size: 14px; line-height: 1.5; }
.empty.is-error { color: #D93036; }
.qr-facts { margin: 0; font-size: 12.5px; line-height: 1.5; text-align: center; color: var(--sk-muted, #6E6E73); font-variant-numeric: tabular-nums; }

.notes { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.note { display: flex; gap: 8px; font-size: 13.5px; line-height: 1.45; color: var(--sk-muted, #6E6E73); }
.note svg { width: 16px; height: 16px; margin-top: 2px; flex: none; }
.note.is-warn svg { color: #C27C00; }
.note.is-error { color: #D93036; }
.note.is-good { color: var(--sk-ink, #1D1D1F); }
.note.is-good svg { color: #2E7CF6; stroke-width: 1.8; }

.print-size { display: flex; gap: 6px; }
#p-width { width: 84px; font-variant-numeric: tabular-nums; }
.skw .print-size select { width: auto; }
.qr-print { display: grid; gap: 10px; padding: 0 16px 14px; }
.qr-btns { display: flex; flex-wrap: wrap; gap: 8px; }

pre.file {
  max-height: 260px;
  margin: 0;
  padding: 12px 14px;
  overflow: auto;
  border-radius: 12px;
  background: rgba(118,118,128,.08);
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
details.more > pre.file { background: #fff; }
.static { margin: 0; padding: 0 4px; font-size: 12.5px; line-height: 1.5; color: var(--sk-muted, #6E6E73); }

.mini {
  position: fixed;
  left: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  padding: 6px;
  border: 0;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(20,40,70,.2), 0 0 0 .5px rgba(0,0,0,.08);
  cursor: pointer;
}
.mini canvas { display: block; width: 88px; height: 88px; }
@media (min-width: 901px) {
  .mini { display: none !important; }
}

.qr-split2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 26px 30px;
  align-items: start;
}
.qr-sum { display: grid; gap: 12px; padding: 16px; border-radius: 18px; background: rgba(118,118,128,.07); min-width: 0; }
.qr-sum-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.qr-sum-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.tally, .badge {
  min-width: 26px;
  padding: 2px 9px;
  border-radius: 999px;
  background: #fff;
  font-size: 12.5px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 0 0 .5px rgba(0,0,0,.08);
  font-variant-numeric: tabular-nums;
}
.rows { display: grid; margin: 0; padding: 0; list-style: none; border-radius: 12px; background: #fff; overflow: hidden; font-size: 13.5px; }
.rows:empty { display: none; }
.rows li { display: grid; gap: 2px; min-width: 0; padding: 9px 12px; }
.rows li + li { box-shadow: inset 0 1px 0 rgba(0,0,0,.06); }
.rows code { font-size: 12.5px; font-weight: 700; overflow-wrap: anywhere; }
.rows span { color: var(--sk-muted, #6E6E73); overflow-wrap: anywhere; }
.rows .is-error span { color: #D93036; }

.qr-drop .btn svg, .qr-sum .btn svg { width: 16px; height: 16px; }
.qr-drop > svg { width: 40px; height: 40px; fill: none; color: #9AA3AD; }
.qr-drop.is-dragging { border-color: var(--sk-accent, #5B8DEF); background: rgba(91,141,239,.06); }
.qr-drop p { margin: 0; font-size: 14px; }
.camera { display: grid; gap: 10px; }
.camera video { display: block; width: 100%; max-height: 420px; border-radius: 14px; background: #000; object-fit: cover; }
.qr-result { display: grid; gap: 12px; }
.qr-result .skw-empty { min-height: 200px; }
.facts { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 6px 12px; font-size: 14px; }
.facts dt { color: var(--sk-muted, #6E6E73); font-size: 13px; line-height: 1.65; }
.facts dd { overflow-wrap: anywhere; }

.prose {
  margin-top: 88px;
  padding: 56px 0 24px;
  border-top: 1px solid var(--rule);
}

.prose > * { max-width: 720px; }

.prose h2 {
  margin: 48px 0 12px;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.prose h2:first-child { margin-top: 0; }

.prose h3 { margin: 24px 0 4px; font-size: 17px; }

.prose p + p, .prose p + ul, .prose ul + p { margin-top: 12px; }

.prose ul { padding-left: 20px; }

.prose li { margin-top: 8px; }

.prose p, .prose li { color: var(--ink-soft); }

.prose strong { color: var(--ink); }

.prose code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--code);
  color: var(--ink);
  font-size: 0.92em;
  overflow-wrap: anywhere;
}

.colophon {
  margin-top: 40px;
  padding: 24px 0 48px;
  border-top: 1px solid var(--rule);
  color: var(--ink-soft);
  font-size: 14px;
}

.colophon a { color: inherit; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .qr-split { grid-template-columns: minmax(0, 1fr); grid-template-areas: "f" "o" "s"; }
  .qr-out { position: static; }
  .qr-card { width: 100%; max-width: 380px; justify-self: center; }
  .qr-split2 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .masthead { flex-direction: column; align-items: flex-start; gap: 6px; padding: 16px 0; }
  .intro { padding: 36px 0 24px; }
  .intro p { font-size: 17px; }
  .pair { grid-template-columns: minmax(0, 1fr); }
  .qr-colour, .qr-logo { justify-content: flex-start; }
  #caption { width: 100%; }
  .facts { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .facts dd { margin-bottom: 8px; }
  .qr-tag { display: none; }
  .prose { margin-top: 56px; padding-top: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
@media (pointer: coarse) {
  input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea { font-size: 16px !important; }
}
