/* CryptoQR Maker — a spec-sheet workbench. Inputs on the left, the QR on a
   dotted cutting mat on the right, and the payment URI dissected underneath. */
:root {
  --bg: #edf0f5;
  --panel: #ffffff;
  --ink: #121826;
  --muted: #586174;
  --line: #d6dbe4;
  --mat: #f6f7fa;
  --dot: #c9cfdb;
  --cobalt: #2a44d4;
  --cobalt-ink: #ffffff;
  --cobalt-soft: #e2e7ff;
  --ok: #137a52;
  --bad: #c2322d;
  --warn-soft: #fff1c9;
  --focus: #2a44d4;
  /* URI anatomy tints */
  --t-scheme: #e2e7ff;
  --t-addr: #eceef3;
  --t-chain: #e6ddff;
  --t-amount: #fff1c9;
  --t-label: #d9f3e7;
  --t-message: #fde2ea;
  --font-display: "Red Hat Display", "Segoe UI", system-ui, sans-serif;
  --font-body: "Red Hat Text", "Segoe UI", system-ui, sans-serif;
  --font-mono: "Red Hat Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r-in: 7px;
  --r-panel: 16px;
  --max: 1180px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0f19; --panel: #131a29; --ink: #e8ecf5; --muted: #8e98ad; --line: #263047;
    --mat: #0f1522; --dot: #2a3550; --cobalt: #8ea0ff; --cobalt-ink: #0b0f19; --cobalt-soft: #1f2849;
    --ok: #5fd3a2; --bad: #ff8a85; --warn-soft: #3b3112; --focus: #8ea0ff;
    --t-scheme: #222c52; --t-addr: #1c2333; --t-chain: #2d2350; --t-amount: #3d3214; --t-label: #15382a; --t-message: #42202c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0f19; --panel: #131a29; --ink: #e8ecf5; --muted: #8e98ad; --line: #263047;
  --mat: #0f1522; --dot: #2a3550; --cobalt: #8ea0ff; --cobalt-ink: #0b0f19; --cobalt-soft: #1f2849;
  --ok: #5fd3a2; --bad: #ff8a85; --warn-soft: #3b3112; --focus: #8ea0ff;
  --t-scheme: #222c52; --t-addr: #1c2333; --t-chain: #2d2350; --t-amount: #3d3214; --t-label: #15382a; --t-message: #42202c;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--font-body); }
img, svg { max-width: 100%; }
a { color: var(--cobalt); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.wrap { max-width: var(--max); margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.1; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(1.9rem, 1.2rem + 2.6vw, 3rem); font-weight: 800; letter-spacing: -0.025em; }
h2 { font-size: clamp(1.4rem, 1.1rem + 1vw, 1.85rem); font-weight: 800; letter-spacing: -0.015em; }
h3 { font-size: 1.08rem; font-weight: 700; }
p { margin: 0; }
.mono { font-family: var(--font-mono); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--panel); padding: 8px 12px; z-index: 20; }
.skip:focus { left: 8px; }

/* Header */
.site-head { border-bottom: 1px solid var(--line); background: var(--panel); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; padding-block: 14px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 800 1.15rem/1 var(--font-display); letter-spacing: -0.01em; }
.brand svg { width: 30px; height: 30px; flex: none; }
.nav { display: flex; flex-wrap: wrap; gap: 2px; font-size: 0.93rem; }
.nav a { color: var(--muted); text-decoration: none; padding: 7px 10px; border-radius: var(--r-in); font-weight: 500; }
.nav a:hover { color: var(--ink); background: var(--bg); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--cobalt-soft); }

/* Hero */
.hero { padding-block: 34px 6px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px 40px; align-items: start; }
.hero .lede { color: var(--muted); font-size: 1.06rem; max-width: 56ch; }
.std-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; padding: 0; list-style: none; }
.std-row li { font: 500 0.82rem/1 var(--font-mono); border: 1px solid var(--line); border-radius: 999px; padding: 7px 11px; background: var(--panel); color: var(--muted); }
.std-row b { color: var(--ink); font-weight: 600; }
.crumbs { font-size: 0.88rem; color: var(--muted); margin-bottom: 12px; }
.crumbs a { color: var(--muted); }

/* Workbench */
.bench { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 20px; padding-block: 24px 44px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-panel); }
.form { padding: 22px; display: grid; gap: 20px; }
.form-row { display: grid; gap: 8px; min-width: 0; }
.form-row > label, .form-row > .lbl { font: 700 0.92rem/1.2 var(--font-display); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: baseline; }
.lbl small, .form-row > label small { font: 400 0.82rem/1.2 var(--font-body); color: var(--muted); }
.coins { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.seg { position: relative; display: grid; justify-items: center; gap: 4px; padding: 10px 4px 8px; border: 1px solid var(--line); border-radius: var(--r-in); cursor: pointer; text-align: center; background: var(--panel); min-width: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg:hover { border-color: var(--muted); }
.seg:has(input:checked) { border-color: var(--cobalt); background: var(--cobalt-soft); box-shadow: inset 0 0 0 1px var(--cobalt); }
.seg:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.seg .tk { font: 700 0.95rem/1 var(--font-mono); }
.seg .nm { font-size: 0.75rem; color: var(--muted); line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.pill-group { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.pill { position: relative; cursor: pointer; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill span { display: block; padding: 7px 12px; border-radius: 7px; font-size: 0.88rem; font-weight: 500; color: var(--muted); }
.pill input:checked + span { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(18, 24, 38, 0.12); }
.pill input:focus-visible + span { outline: 2px solid var(--focus); }
input[type="text"], input[type="search"], select {
  width: 100%; min-width: 0; font: 400 0.98rem/1.4 var(--font-body); color: var(--ink); background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r-in); padding: 11px 12px;
}
input.mono { font-family: var(--font-mono); font-size: 0.93rem; }
input:focus, select:focus { outline: none; border-color: var(--cobalt); box-shadow: 0 0 0 3px var(--cobalt-soft); }
input::placeholder { color: var(--muted); opacity: 0.85; }
.unit { position: relative; }
.unit input { padding-right: 64px; }
.unit span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font: 600 0.85rem/1 var(--font-mono); color: var(--muted); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }.note { font-size: 0.85rem; color: var(--muted); }
.status { font-size: 0.88rem; display: flex; gap: 7px; align-items: flex-start; min-height: 1.3em; }
.status svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.status.ok { color: var(--ok); }
.status.bad { color: var(--bad); }
.status.info { color: var(--ink); background: var(--warn-soft); border-radius: var(--r-in); padding: 8px 10px; }
.status .switch { font: inherit; font-weight: 700; color: var(--cobalt); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
details.style-box { border-top: 1px solid var(--line); padding-top: 16px; }
details.style-box summary { cursor: pointer; font: 700 0.92rem/1.2 var(--font-display); }
.style-grid { display: grid; gap: 16px; margin-top: 14px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sw { position: relative; cursor: pointer; }
.sw input { position: absolute; opacity: 0; pointer-events: none; }
.sw span { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--line); background: var(--light, #fff); }
.sw span::after { content: ""; width: 18px; height: 18px; border-radius: 4px; background: var(--dark); box-shadow: 6px 6px 0 -2px var(--eye); }
.sw input:checked + span { border-color: var(--cobalt); box-shadow: 0 0 0 2px var(--cobalt-soft); }
.sw input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.colors { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.88rem; color: var(--muted); }
.colors label { display: inline-flex; align-items: center; gap: 8px; }
.colors input[type="color"] { width: 38px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; cursor: pointer; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.93rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--cobalt); }

/* Preview mat */
.mat { position: sticky; top: calc(14px + env(safe-area-inset-top, 0px)); overflow: hidden; }
.mat-surface {
  background-color: var(--mat);
  background-image: radial-gradient(var(--dot) 1px, transparent 1.2px);
  background-size: 16px 16px;
  padding: 28px 20px 22px; display: grid; justify-items: center; gap: 14px; position: relative;
  border-bottom: 1px solid var(--line);
}
.qr-tile { width: min(100%, 340px); aspect-ratio: 1; background: #fff; border-radius: 12px; padding: 0; box-shadow: 0 1px 2px rgba(18, 24, 38, 0.08), 0 14px 32px -16px rgba(18, 24, 38, 0.4); overflow: hidden; position: relative; }
.qr-tile svg { display: block; width: 100%; height: 100%; }
.qr-tile.example svg { opacity: 0.28; }
.example-tag { position: absolute; inset: 0; display: grid; place-items: center; font: 800 1rem/1.3 var(--font-display); color: #121826; text-align: center; padding: 24px; }
.specs { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; font: 500 0.8rem/1.2 var(--font-mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.anatomy { padding: 18px 20px 6px; }
.anatomy h3 { font-size: 0.92rem; margin-bottom: 10px; }
.uri { font: 500 0.9rem/1.9 var(--font-mono); word-break: break-all; }
.uri .seg-u { border-radius: 4px; padding: 2px 3px; margin-right: 1px; }
.u-scheme { background: var(--t-scheme); }
.u-addr { background: var(--t-addr); }
.u-chain { background: var(--t-chain); }
.u-amount { background: var(--t-amount); }
.u-label { background: var(--t-label); }
.u-message { background: var(--t-message); }
.u-sep { color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; padding: 0; list-style: none; font-size: 0.82rem; color: var(--muted); }
.legend li { display: inline-flex; gap: 6px; align-items: center; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 16px 20px 20px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 700 0.92rem/1 var(--font-body); padding: 12px 14px; border-radius: var(--r-in); border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; }
.btn:hover:not(:disabled) { border-color: var(--ink); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn.primary { background: var(--cobalt); border-color: var(--cobalt); color: var(--cobalt-ink); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.1); border-color: var(--cobalt); }
.wide { grid-column: 1 / -1; }
.toast { min-height: 1.3em; text-align: center; font-size: 0.88rem; color: var(--ok); padding: 0 20px 14px; }
.dl-row { display: flex; gap: 8px; }
.dl-row select { width: auto; flex: none; padding: 11px 8px; font-size: 0.88rem; }
.dl-row .btn { flex: 1; }

/* Sections */
.section { padding-block: 46px; border-top: 1px solid var(--line); }
.section h2 { margin-bottom: 18px; }
.prose { max-width: 70ch; }
.prose > * + * { margin-top: 14px; }
.prose h2 { margin-top: 36px; margin-bottom: 0; }
.prose h3 { margin-top: 24px; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 6px; }
.prose code { font: 0.9em var(--font-mono); background: var(--cobalt-soft); padding: 1px 5px; border-radius: 4px; word-break: break-all; }
.prose pre { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-in); padding: 14px 16px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; word-break: normal; white-space: pre; }
.prose table { border-collapse: collapse; width: 100%; font-size: 0.93rem; }
.prose th, .prose td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font-family: var(--font-display); }
.table-scroll { overflow-x: auto; }
.callout { border-left: 3px solid var(--cobalt); background: var(--panel); padding: 14px 16px; border-radius: 0 var(--r-in) var(--r-in) 0; }
.spec-table { width: 100%; min-width: 720px; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-panel); overflow: hidden; font-size: 0.93rem; }
.spec-table th, .spec-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.spec-table th { font-family: var(--font-display); background: var(--mat); }
.spec-table td code { font: 0.86rem var(--font-mono); word-break: normal; overflow-wrap: anywhere; }
.faq { display: grid; gap: 0; max-width: 820px; border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); padding: 14px 2px; }
.faq summary { cursor: pointer; font-weight: 700; font-family: var(--font-display); font-size: 1.02rem; }
.faq details p { margin-top: 8px; color: var(--muted); max-width: 70ch; }
.list-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0; border-top: 1px solid var(--line); }
.list-links a { display: grid; gap: 4px; padding: 16px 16px 16px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.list-links a:hover h3 { color: var(--cobalt); }
.list-links .meta { font: 500 0.8rem/1.2 var(--font-mono); color: var(--muted); }
.list-links p { color: var(--muted); font-size: 0.93rem; }

/* Article */
.article-head { padding-block: 34px 8px; }
.article-head .meta { color: var(--muted); margin-top: 10px; font-size: 0.93rem; }
.article { padding-block: 8px 50px; }

/* Footer */
.site-foot { border-top: 1px solid var(--line); background: var(--panel); padding-block: 34px 40px; font-size: 0.9rem; color: var(--muted); }
.site-foot .cols { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 24px; }
.site-foot h3 { font-size: 0.92rem; color: var(--ink); margin-bottom: 8px; }
.site-foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.site-foot a { color: var(--muted); }
.site-foot .fine { margin-top: 22px; font-size: 0.82rem; }

.overlay { position: fixed; inset: 0; background: rgba(8, 11, 20, 0.72); display: grid; place-items: center; padding: 24px; z-index: 30; }
.overlay-box { background: var(--panel); color: var(--ink); border-radius: var(--r-panel); padding: 18px; max-width: 420px; width: 100%; display: grid; gap: 12px; text-align: center; }
.overlay-box img { width: 100%; border-radius: 8px; background: #fff; }

/* Print card (hidden on screen) */
.print-card { display: none; }

@media (max-width: 920px) {
  .bench, .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .mat { position: static; }
  .site-foot .cols { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .form { padding: 16px; }
  .coins { gap: 4px; }
  .seg .nm { display: none; }
  .seg { padding: 10px 2px; }
  .seg .tk { font-size: 0.85rem; }
  .two { grid-template-columns: 1fr; }
  .nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .nav a { white-space: nowrap; }
  .site-foot .cols { grid-template-columns: 1fr; }
  }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

@media print {
  @page { margin: 14mm; }
  body { background: #fff; color: #000; }
  body * { visibility: hidden; }
  .print-card, .print-card * { visibility: visible; }
  .print-card { position: absolute; left: 0; right: 0; top: 0; display: grid !important; gap: 10px; justify-items: center; text-align: center; width: 110mm; margin: 0 auto; border: 1px solid #bbb; border-radius: 6mm; padding: 8mm; font-family: var(--font-body); color: #000; }
  .print-card h2 { font: 800 22pt/1.1 var(--font-display); }
  .print-card .pc-amt { font: 700 16pt/1.2 var(--font-mono); }
  .print-card .pc-qr { width: 80mm; }
  .print-card .pc-qr svg { width: 100%; height: auto; }
  .print-card .pc-addr { font: 500 10pt/1.5 var(--font-mono); word-break: break-all; }
  .print-card .pc-foot { font-size: 8.5pt; color: #444; }
}
