:root {
  --brand: #0f766e;
  --brand-dark: #115e59;
  --brand-soft: #ccfbf1;
  --accent: #f59e0b;
  --ink: #0f172a;
  --muted: #475569;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --card: #ffffff;
  --field: #ffffff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #2dd4bf; --brand-dark: #5eead4; --brand-soft: #134e4a;
    --ink: #e2e8f0; --muted: #94a3b8; --line: #1e293b; --bg: #0b1120; --card: #111827; --field: #0f172a;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
img, svg { max-width: 100%; }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--brand-dark); }
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); margin: 0 0 .4em; }
h2 { font-size: clamp(1.3rem, 2.6vw, 1.7rem); margin: 1.8em 0 .5em; }
h3 { font-size: 1.1rem; margin: 1.4em 0 .4em; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 760px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--card); padding: 8px 12px; z-index: 10; }

/* Header */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 750; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.site-nav { display: flex; gap: 4px; }
.site-nav a { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 550; }
.site-nav a:hover, .site-nav a[aria-current] { color: var(--brand); background: var(--brand-soft); }
.menu-btn { display: none; background: none; border: 0; padding: 10px; cursor: pointer; }
.menu-btn span { display: block; width: 22px; height: 2px; background: var(--ink); margin: 4px 0; border-radius: 2px; }
@media (max-width: 720px) {
  .menu-btn { display: block; }
  .site-nav { display: none; position: absolute; left: 0; right: 0; top: 60px; background: var(--card); flex-direction: column; padding: 8px 16px 16px; border-bottom: 1px solid var(--line); }
  .site-nav.open { display: flex; }
}

/* Hero */
.hero { padding: 36px 0 20px; text-align: center; }
.hero p.lead { color: var(--muted); font-size: 1.1rem; max-width: 680px; margin: 0 auto; }
.badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 16px 0 0; padding: 0; list-style: none; }
.badges li { background: var(--brand-soft); color: var(--brand-dark); border-radius: 999px; padding: 4px 12px; font-size: .88rem; font-weight: 600; }

/* Cards & layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.section { padding: 8px 0 32px; }
.prose { max-width: 760px; }
.prose p, .prose li { color: var(--ink); }
.prose ul, .prose ol { padding-left: 1.3em; }
.muted { color: var(--muted); }

/* Generator */
.generator { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 0; overflow: hidden; }
.gen-form { padding: 20px; border-right: 1px solid var(--line); min-width: 0; }
.gen-preview { padding: 20px; display: flex; flex-direction: column; align-items: stretch; gap: 12px; background: color-mix(in srgb, var(--brand-soft) 30%, var(--card)); }
@media (max-width: 860px) {
  .generator { grid-template-columns: 1fr; }
  .gen-form { border-right: 0; border-bottom: 1px solid var(--line); }
}
.type-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.type-tabs button { border: 1px solid var(--line); background: var(--field); color: var(--ink); padding: 7px 13px; border-radius: 999px; font: inherit; font-size: .92rem; font-weight: 600; cursor: pointer; }
.type-tabs button:hover { border-color: var(--brand); }
.type-tabs button.active { background: var(--brand); border-color: var(--brand); color: #fff; }
@media (prefers-color-scheme: dark) { .type-tabs button.active { color: #042f2e; } }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset[hidden] { display: none; }
label { display: block; font-size: .9rem; font-weight: 600; color: var(--muted); margin-bottom: 12px; }
input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=range]), select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px; font: inherit; font-size: 1rem; color: var(--ink);
  background: var(--field); border: 1px solid var(--line); border-radius: 10px;
}
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
textarea { resize: vertical; }
input[type=color] { display: block; width: 100%; height: 42px; margin-top: 4px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); cursor: pointer; }
input[type=file] { margin-top: 6px; font-size: .9rem; max-width: 100%; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0 12px; align-items: end; }
label.check { display: flex; align-items: center; gap: 8px; padding-bottom: 12px; color: var(--ink); }
.grad-only { display: none; }
.has-gradient .grad-only { display: block; }
details.design { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 12px; }
details.design summary { cursor: pointer; font-weight: 700; margin-bottom: 12px; }
.preview-box { background: #fff; border-radius: 12px; border: 1px solid var(--line); padding: 12px; aspect-ratio: 1; display: grid; place-items: center; }
.qr-out { width: 100%; display: grid; place-items: center; }
.qr-out svg { width: 100%; height: auto; display: block; }
.qr-out .empty { color: #64748b; text-align: center; font-size: .95rem; }
.size { margin: 0; }
.dl-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.warn { margin: 0; background: #fef3c7; color: #78350f; border-radius: 8px; padding: 8px 10px; font-size: .88rem; }
.hint { font-size: .85rem; color: var(--muted); margin: 4px 0 0; }
.fineprint { font-size: .82rem; color: var(--muted); margin: 0; }

/* Buttons */
.btn { display: inline-flex; justify-content: center; align-items: center; gap: 6px; border: 0; border-radius: 10px; padding: 12px 16px; font: inherit; font-weight: 700; cursor: pointer; background: var(--brand); color: #fff; text-decoration: none; }
.btn:hover { filter: brightness(1.08); color: #fff; }
@media (prefers-color-scheme: dark) { .btn, .btn:hover { color: #042f2e; } }
.btn-alt { background: var(--ink); color: var(--card); }
.btn-alt:hover { color: var(--card); }
.btn-ghost { background: transparent; color: var(--brand); border: 1px solid var(--line); }
.btn-ghost:hover { color: var(--brand); background: var(--brand-soft); }
@media (prefers-color-scheme: dark) { .btn-ghost, .btn-ghost:hover { color: var(--brand); } .btn-alt, .btn-alt:hover { color: var(--card); } }
.btn.small { padding: 7px 12px; font-size: .9rem; font-weight: 600; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* Ads. Space is reserved up front so the page does not jump when an ad loads (CLS).
   Rules: max 2 in-content ads + 1 desktop sidebar per page; keep ads away from the
   Download / Copy buttons; always labelled "Advertisement"; never styled like a button. */
.ad { margin: 28px auto; text-align: center; min-height: 280px; max-width: 970px; }
.ad-top { margin-top: 48px; }
@media (min-width: 720px) { .ad { min-height: 120px; } }
.ad-label { display: block; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.ad-placeholder { border: 1px dashed var(--line); border-radius: 10px; display: grid; place-items: center; }
.ad:has(ins[data-ad-status="unfilled"]) { min-height: 0; }
.ad:has(ins[data-ad-status="unfilled"]) .ad-label { display: none; }

/* Desktop sidebar ad: a sticky 300x600 rail to the right of the content, 1200px+ only. */
.ad-rail { display: none; }
@media (min-width: 1200px) {
  .page-shell.has-rail { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; max-width: 1460px; margin: 0 auto; padding-right: 16px; }
  .page-shell.has-rail > main { min-width: 0; }
  .ad-rail { display: block; padding: 32px 0; }
  .ad-rail-inner { position: sticky; top: 84px; text-align: center; }
  .ad-rail-unit { width: 300px; height: 600px; }
}

/* Feature grid, tool cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.tile { padding: 18px; text-decoration: none; color: var(--ink); display: block; transition: transform .12s ease, border-color .12s ease; }
a.tile:hover { transform: translateY(-2px); border-color: var(--brand); color: var(--ink); }
.tile h3 { margin: 0 0 6px; color: var(--brand); }
.tile p { margin: 0; color: var(--muted); font-size: .95rem; }
.tile .icon { font-size: 1.6rem; display: block; margin-bottom: 6px; }
.steps { counter-reset: s; list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.steps li { counter-increment: s; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.steps li::before { content: counter(s); display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; margin-bottom: 8px; }
.steps strong { display: block; }

/* FAQ */
details.faq { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-bottom: 10px; }
details.faq summary { cursor: pointer; font-weight: 650; }
details.faq[open] summary { margin-bottom: 8px; }
details.faq p { margin: 0 0 .6em; }

/* Tool pages */
.tool { padding: 20px; }
.tool-out { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.tool-out input, .tool-out textarea { flex: 1 1 260px; margin-top: 0 !important; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .95rem !important; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-top: 12px; }
.stat { background: var(--brand-soft); border-radius: 12px; padding: 12px; text-align: center; }
.stat b { display: block; font-size: 1.6rem; color: var(--brand-dark); }
.stat span { font-size: .85rem; color: var(--muted); }
#pw-out { font-size: 1.2rem !important; letter-spacing: .03em; }
#pw-strength { font-weight: 700; }
#pw-strength[data-level=weak] { color: #dc2626; }
#pw-strength[data-level=fair] { color: #d97706; }
#pw-strength[data-level=strong], #pw-strength[data-level=very-strong] { color: #059669; }
input[type=range] { width: 100%; accent-color: var(--brand); }
.dropzone { border: 2px dashed var(--line); border-radius: 14px; padding: 32px 16px; text-align: center; color: var(--muted); }
.dropzone.over { border-color: var(--brand); background: var(--brand-soft); }
.scan-video { width: 100%; max-width: 480px; border-radius: 12px; margin: 12px auto 0; display: block; background: #000; }
.scan-status { font-weight: 600; }
.bulk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; margin-top: 16px; }
.bulk-grid figure { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.bulk-grid figcaption { font-size: .72rem; color: #475569; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bulk-grid svg { width: 100%; height: auto; display: block; }

/* Articles */
.article-meta { color: var(--muted); font-size: .9rem; margin-bottom: 1.5em; }
.callout { background: var(--brand-soft); border-left: 4px solid var(--brand); padding: 12px 16px; border-radius: 8px; margin: 1.2em 0; }
table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: .95rem; }
th, td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
th { background: var(--brand-soft); }
.table-wrap { overflow-x: auto; }
.breadcrumb { font-size: .88rem; color: var(--muted); margin: 20px 0 8px; }
.breadcrumb a { color: var(--muted); }

/* Footer */
.site-footer { background: var(--card); border-top: 1px solid var(--line); margin-top: 48px; padding: 36px 0 20px; font-size: .93rem; }
.footer-cols { display: grid; grid-template-columns: 1.3fr repeat(4, 1fr); gap: 24px; }
@media (max-width: 1000px) { .footer-cols { grid-template-columns: repeat(3, 1fr); } .footer-about { grid-column: 1 / -1; } }
@media (max-width: 760px) { .footer-cols { grid-template-columns: 1fr 1fr; } .footer-about { grid-column: 1 / -1; } }
.site-footer h2 { font-size: .95rem; margin: 0 0 10px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: 6px 0; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--brand); }
.footer-about p { color: var(--muted); max-width: 320px; }
.copyright { color: var(--muted); font-size: .82rem; border-top: 1px solid var(--line); margin-top: 24px; padding-top: 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
.dl-buttons .btn { padding: 12px 8px; }

/* Mobile: one scrollable row of QR type tabs instead of 4-5 wrapped rows */
@media (max-width: 600px) {
  .type-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: -20px; margin-right: -20px; padding: 0 20px 4px; scroll-behavior: smooth; }
  .type-tabs::-webkit-scrollbar { display: none; }
  .type-tabs button { flex: 0 0 auto; }
}
/* Related pages block (internal links) */
.related { padding: 8px 0 24px; }
.related h2 { margin-top: 1em; }
.related .tile h3 { font-size: 1rem; margin-top: 0; }
.prose .grid { margin: 1em 0; }
.toc { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 18px; margin: 1em 0 1.5em; }
.toc strong { display: block; margin-bottom: 4px; }
.toc ol { margin: 0; }

/* Cookie consent banner */
.consent { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 50; display: flex; justify-content: center; }
.consent-inner { max-width: 880px; width: 100%; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 40px rgba(15,23,42,.25); padding: 14px 16px; display: flex; gap: 12px 16px; align-items: center; flex-wrap: wrap; }
.consent-inner p { margin: 0; flex: 1 1 360px; font-size: .9rem; line-height: 1.5; }
.consent-btns { display: flex; gap: 8px; flex: 0 0 auto; }
.copyright a { color: var(--muted); }

/* Voluntary "Buy me a coffee" support link (not an ad) */
.support-note { font-size: .85rem; color: var(--muted); margin: 0; }
.support-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: #ffdd00; color: #1f2937 !important; font-weight: 650; font-size: .9rem; text-decoration: none !important; }
.support-btn:hover { filter: brightness(.96); }
.support-sub { font-size: .78rem; margin: 6px 0 0; }
