/* Bulk QR code generator – one stylesheet for every page. No external fonts. */

:root {
  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-2: #eef3f1;
  --text: #15201c;
  --muted: #51605a;
  --border: #d6dfdb;
  --border-strong: #aebcb6;
  --accent: #0d6b58;
  --accent-hover: #09594a;
  --accent-soft: #e2f1ec;
  --on-accent: #ffffff;
  --ok: #1d7340;
  --ok-soft: #e5f4ea;
  --warn: #8a5300;
  --warn-soft: #fff3d9;
  --error: #b3261e;
  --error-soft: #fdeceb;
  --focus: #1b64d8;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgb(16 32 26 / 0.06), 0 6px 20px rgb(16 32 26 / 0.06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --maxw: 1040px;
  --gutter: 16px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1412;
    --surface: #151d1a;
    --surface-2: #1b2622;
    --text: #e5ece9;
    --muted: #a3b2ac;
    --border: #2b3934;
    --border-strong: #43554e;
    --accent: #45c9a7;
    --accent-hover: #6ad8bc;
    --accent-soft: #143329;
    --on-accent: #04201a;
    --ok: #74d593;
    --ok-soft: #122e1c;
    --warn: #f2bd57;
    --warn-soft: #33270e;
    --error: #ff8f86;
    --error-soft: #3b1714;
    --focus: #86b6ff;
    --shadow: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  overflow-x: hidden;
}
img, svg, canvas { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
code, pre, .mono { font-family: var(--mono); font-size: 0.92em; }
code { background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 4px; overflow-wrap: anywhere; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5em; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: 8px; top: -60px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip-link:focus { top: 8px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.block { display: block; margin-top: 4px; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }

/* ------------------------------------------------------------------ header / footer */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; padding-top: 10px; padding-bottom: 10px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); text-decoration: none; font-size: 1.05rem; }
.brand svg { flex: none; }
.site-nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; padding: 0; font-size: 0.95rem; }
.site-nav a { color: var(--muted); text-decoration: none; padding: 6px 0; display: inline-block; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--text); text-decoration: underline; }

.site-footer { margin-top: 64px; background: var(--surface); border-top: 1px solid var(--border); font-size: 0.9rem; color: var(--muted); }
.site-footer .wrap { padding-top: 28px; padding-bottom: 28px; display: grid; gap: 12px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.site-footer a { color: var(--muted); }

/* ------------------------------------------------------------------ hero */
.hero { padding: 28px 0 8px; }
.hero h1 { font-size: clamp(1.6rem, 4.5vw, 2.4rem); letter-spacing: -0.01em; }
.hero .lede { font-size: 1.08rem; color: var(--muted); max-width: 62ch; }
.pills { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; padding: 0; }
.pills li { background: var(--accent-soft); color: var(--text); border-radius: 999px; padding: 4px 12px; font-size: 0.875rem; font-weight: 600; }
.pills li::before { content: "✓ "; color: var(--accent); }

/* ------------------------------------------------------------------ tool */
.tool { max-width: 960px; margin: 16px auto 0; min-height: 900px; }
.tool.is-ready { min-height: 0; }
.tool-loading { padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.tool-inner { display: grid; gap: 16px; }

.step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px var(--gutter) 20px; box-shadow: var(--shadow); min-width: 0; }
@media (min-width: 700px) { .step { padding: 22px 26px 24px; } }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.step-head h2 { margin: 0; font-size: 1.2rem; }
.step-num { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 700; font-size: 0.95rem; }

.field { margin: 0 0 14px; min-width: 0; }
.field > label, .label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 0.95rem; }
.unit { font-weight: 400; color: var(--muted); }
.hint { color: var(--muted); font-size: 0.875rem; margin: 4px 0 0; }
.inline-field { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inline-field > label { margin: 0; }
.inline-field select { width: auto; min-width: 12rem; }

input[type="text"], input[type="number"], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 11px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
input.mono, textarea.mono { font-family: var(--mono); font-size: 0.9rem; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
[aria-invalid="true"] { border-color: var(--error) !important; box-shadow: 0 0 0 1px var(--error); }
select:disabled, input:disabled { opacity: 0.6; }

.tpl-row { display: flex; gap: 6px; }
.tpl-row .tpl { flex: 1 1 auto; min-width: 0; }
.tpl-row .insert-col { flex: 0 0 auto; width: auto; max-width: 9.5rem; font-size: 0.875rem; color: var(--accent); }

.check, .radio { display: flex; align-items: flex-start; gap: 10px; margin: 8px 0; cursor: pointer; }
.check input, .radio input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
fieldset { border: 0; margin: 0 0 14px; padding: 0; min-width: 0; }
legend { font-weight: 600; padding: 0; margin-bottom: 6px; font-size: 0.95rem; }
.radios-inline .radio, .checks-inline .check { margin: 6px 0; }

.grid-2, .grid-3 { display: grid; gap: 0 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 860px) { .grid-3 { grid-template-columns: 1fr 1fr 1fr; } }

/* tabs */
.tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 10px; margin-bottom: 14px; max-width: 100%; }
.tabs [role="tab"] { font: inherit; font-size: 0.95rem; font-weight: 600; border: 0; background: transparent; color: var(--muted); padding: 8px 14px; border-radius: 7px; cursor: pointer; min-height: 40px; }
.tabs [role="tab"][aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / 0.12); }

/* dropzone */
.dropzone { position: relative; margin-bottom: 10px; }
.dropzone-label {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  min-height: 140px; padding: 20px; border: 2px dashed var(--border-strong); border-radius: var(--radius); cursor: pointer;
  background: var(--surface-2); color: var(--text); transition: border-color 0.15s, background 0.15s;
}
.dropzone-label svg { color: var(--accent); }
.dropzone-label:hover, .dropzone.is-dragover .dropzone-label { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input:focus-visible + .dropzone-label { outline: 3px solid var(--focus); outline-offset: 2px; }
.linkish { color: var(--accent); text-decoration: underline; }

.data-status { margin: 12px 0 8px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.data-status.is-ok { background: var(--ok-soft); }
.data-status.is-warn { background: var(--warn-soft); }
.data-status.is-error { background: var(--error-soft); color: var(--error); }
.data-status.is-busy::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; border: 2px solid var(--accent); border-right-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .data-status.is-busy::before { animation: none; } }
.privacy-note { display: flex; align-items: center; gap: 6px; margin: 10px 0 0; color: var(--muted); font-size: 0.875rem; }

.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); margin: 8px 0; }
.data-table { border-collapse: collapse; width: 100%; font-size: 0.85rem; }
.data-table caption { text-align: left; padding: 6px 10px; color: var(--muted); caption-side: bottom; }
.data-table th, .data-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: left; max-width: 16rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.data-table th { background: var(--surface-2); font-weight: 600; position: sticky; top: 0; }
.data-table .rownum { color: var(--muted); }

/* content step */
.type-panel > .check:first-child { margin-top: 0; }
.problems:empty, .example:empty { display: none; }
.example { margin-top: 12px; padding: 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.example pre, .dialog-info pre { margin: 4px 0 6px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.85rem; max-height: 12rem; overflow: auto; }
.example .label { margin: 0; font-size: 0.85rem; }

/* notices & badges */
.notice { padding: 10px 12px; border-radius: var(--radius-sm); border-left: 4px solid var(--border-strong); background: var(--surface-2); margin: 10px 0; font-size: 0.925rem; }
.notice p { margin: 0 0 4px; }
.notice p:last-child { margin: 0; }
.notice-ok { border-left-color: var(--ok); background: var(--ok-soft); }
.notice-info { border-left-color: var(--accent); }
.notice-warn { border-left-color: var(--warn); background: var(--warn-soft); }
.notice-error { border-left-color: var(--error); background: var(--error-soft); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-error { background: var(--error-soft); color: var(--error); }
.badge-muted { background: var(--surface-2); color: var(--muted); }

/* style step */
.ec-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (min-width: 760px) { .ec-options { grid-template-columns: repeat(4, 1fr); } }
.ec-option { position: relative; cursor: pointer; }
.ec-option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.ec-card { display: grid; gap: 2px; height: 100%; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }
.ec-card strong { font-size: 1.1rem; }
.ec-rec { font-weight: 700; color: var(--accent); font-size: 0.85rem; }
.ec-sum { color: var(--muted); font-size: 0.8rem; line-height: 1.35; }
.ec-option input:checked + .ec-card { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.ec-option input:focus-visible + .ec-card { outline: 3px solid var(--focus); outline-offset: 2px; }
.colour-row { display: flex; gap: 8px; align-items: center; }
.colour-row input[type="color"] { width: 52px; height: 44px; padding: 2px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); flex: none; cursor: pointer; }
.caption-block { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600;
  min-height: 44px; padding: 8px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--muted); }
.btn-small { min-height: 36px; padding: 5px 12px; font-size: 0.9rem; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); padding: 10px 22px; font-size: 1.02rem; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--accent); padding-left: 0; }
.btn-link { font: inherit; background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.icon-btn { font-size: 1.6rem; line-height: 1; width: 40px; height: 40px; border: 0; background: transparent; color: var(--text); cursor: pointer; border-radius: 8px; }
.icon-btn:hover { background: var(--surface-2); }
.download-row { margin-top: 12px; }

/* check step */
.summary p { margin: 0 0 6px; }
.issues { margin: 10px 0 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.issues summary { cursor: pointer; font-weight: 600; }
.issue-list { display: grid; gap: 8px; margin-top: 8px; }
.issue { padding: 10px; border-radius: var(--radius-sm); background: var(--surface-2); border-left: 4px solid var(--border-strong); }
.issue-error { border-left-color: var(--error); }
.issue-warn { border-left-color: var(--warn); }
.issue-ok { border-left-color: var(--ok); }
.issue-head { font-size: 0.9rem; margin-bottom: 6px; }
.issue-msg { margin-left: 6px; color: var(--muted); }
.issue-edit { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.issue-edit input[type="text"] { flex: 1 1 16rem; min-height: 38px; }
.issue-edit .check { margin: 0; }

.preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; margin-top: 12px; }
@media (min-width: 700px) { .preview-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); } }
.tile {
  display: flex; flex-direction: column; gap: 4px; padding: 8px; font: inherit; text-align: left; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; min-width: 0;
}
.tile:hover { border-color: var(--accent); }
.tile-code { display: block; background: #ffffff; border-radius: 4px; overflow: hidden; line-height: 0; }
.tile-canvas { width: 100%; height: auto; display: block; }
.tile-cap { font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-row { font-size: 0.72rem; color: var(--muted); }
.tile.is-skipped { opacity: 0.45; }
.tile.has-warning { border-color: var(--warn); }
.tile-error { cursor: default; border-style: dashed; border-color: var(--error); background: var(--error-soft); justify-content: center; min-height: 150px; }
.tile-x { font-size: 1.6rem; color: var(--error); line-height: 1; }
.tile-msg { font-size: 0.78rem; color: var(--error); overflow-wrap: anywhere; }

/* download step */
.custom-grid { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px 0; }
.custom-grid legend { padding: 0 4px; }
.progress { margin-top: 16px; padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.progress-row { display: flex; align-items: center; gap: 12px; }
.progress progress { flex: 1; height: 14px; accent-color: var(--accent); }
#progress-text { margin: 8px 0 0; }
#progress-text.is-error { color: var(--error); }
.reset-line { margin-top: 18px; }
.tool.is-busy .step:not(#step-download) { opacity: 0.7; pointer-events: none; }

/* dialog */
.qr-dialog { width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.qr-dialog::backdrop { background: rgb(0 0 0 / 0.55); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px 0 18px; }
.dialog-head h3 { margin: 0; }
.dialog-body { display: grid; gap: 16px; padding: 12px 18px 18px; }
@media (min-width: 640px) { .dialog-body { grid-template-columns: minmax(0, 300px) 1fr; } }
.dialog-code { background: #ffffff; border-radius: var(--radius-sm); padding: 8px; align-self: start; }
.dialog-code img { display: block; width: 100%; height: auto; }
.dialog-info { min-width: 0; }

/* ------------------------------------------------------------------ content pages */
.content { max-width: 760px; margin: 0 auto; }
.content section { margin-top: 44px; }
.content h2 { font-size: 1.5rem; margin-top: 0; }
.content h3 { font-size: 1.12rem; margin-top: 1.4em; }
.content ul, .content ol { padding-left: 1.3em; }
.content li { margin-bottom: 0.4em; }
.content table { border-collapse: collapse; width: 100%; margin: 12px 0 20px; font-size: 0.93rem; display: block; overflow-x: auto; }
.content th, .content td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
.content th { background: var(--surface-2); }
.steps-list { counter-reset: s; list-style: none; padding: 0 !important; display: grid; gap: 12px; }
.steps-list li { counter-increment: s; position: relative; padding: 12px 14px 12px 54px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); margin: 0; }
.steps-list li::before { content: counter(s); position: absolute; left: 14px; top: 12px; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 700; }
.cards { display: grid; gap: 12px; grid-template-columns: 1fr; padding: 0 !important; list-style: none; }
@media (min-width: 640px) { .cards { grid-template-columns: 1fr 1fr; } }
.cards li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0; }
.cards li strong { display: block; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 10px 0 0; }
.callout { background: var(--accent-soft); border-radius: var(--radius-sm); padding: 14px 16px; margin: 16px 0; }
.page-head { padding: 32px 0 4px; }
.page-head h1 { font-size: clamp(1.6rem, 4.5vw, 2.2rem); }
.updated { color: var(--muted); font-size: 0.9rem; }
.crumbs { font-size: 0.875rem; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }

/* ------------------------------------------------------------------ ad slots
   Empty slots are hidden. Once AdSense code is pasted inside, the slot reserves
   height before the ad loads, so the page doesn't jump (no layout shift). */
.ad-slot { position: relative; display: block; margin: 48px auto; padding-top: 20px; min-height: 300px; max-width: 100%; text-align: center; overflow: hidden; }
@media (min-width: 768px) { .ad-slot { min-height: 270px; } }
.ad-slot:empty { display: none; }
.ad-slot:not(:empty)::before { content: "Advertisements"; position: absolute; top: 0; left: 0; right: 0; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.ads-preview .ad-slot { display: block !important; border: 2px dashed var(--warn); background: var(--warn-soft); }
.ads-preview .ad-slot::after { content: "Ad slot: " attr(data-slot); display: block; padding: 110px 12px 0; color: var(--warn); font-weight: 700; }

@media print {
  .site-header, .site-footer, .ad-slot, .tool { display: none !important; }
}
