/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #f7f7f4;
  --surface: #ffffff;
  --ink: #16181d;
  --muted: #5b616e;
  --line: #dcdcd4;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #e2f3f1;
  --warn: #9a3412;
  --warn-bg: #fff1e6;
  --ok: #166534;
  --ok-bg: #e7f6ec;
  --radius: 14px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121416; --surface: #1b1e22; --ink: #eceef1; --muted: #a0a6b1; --line: #33373e;
    --accent: #2dd4bf; --accent-ink: #06201d; --accent-soft: #14312e;
    --warn: #fdba74; --warn-bg: #3a2414; --ok: #86efac; --ok-bg: #12301d;
  }
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--sans); font-size: 16px; line-height: 1.6; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; overflow-x: clip;
}
img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; line-height: 1.15; letter-spacing: -0.015em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: min(100% - 2rem, 1040px); margin-inline: auto; }
.skip-link { position: fixed; top: -100px; left: 1rem; padding: .6rem 1rem; background: var(--ink); color: var(--bg);
  z-index: 99; border-radius: 8px; }
.skip-link:focus { top: 1rem; }
[hidden] { display: none !important; }

/* =============================================================
   4. Header / footer
   ============================================================= */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-header .container { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; padding-block: .75rem; }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.brand span { color: var(--accent); }
.main-nav { display: flex; gap: 1rem; flex: 1; }
.main-nav a { color: var(--muted); text-decoration: none; font-size: .95rem; }
.main-nav a:hover, .main-nav a[aria-current="page"] { color: var(--ink); }
.lang-switch { display: flex; gap: .25rem; margin-left: auto; }
.lang-switch a { padding: .2rem .55rem; border: 1px solid var(--line); border-radius: 999px; font-size: .85rem;
  text-decoration: none; color: var(--muted); }
.lang-switch a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.site-footer { border-top: 1px solid var(--line); margin-top: 3rem; padding-block: 1.5rem; color: var(--muted); font-size: .9rem; }
.site-footer .container { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; }
.site-footer a { color: var(--muted); }

/* =============================================================
   5. Hero + tool card
   ============================================================= */
.hero { padding-block: 1.75rem 1rem; }
.hero h1 { font-size: clamp(1.6rem, 4.5vw, 2.4rem); }
.hero .sub { margin-top: .5rem; color: var(--muted); max-width: 60ch; }
.tool-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; margin-top: 1rem; }
.needs-js { color: var(--warn); }
.badge { margin-top: .9rem; padding: .6rem .85rem; background: var(--accent-soft); border-radius: 10px; font-size: .92rem; }
.honest { margin-top: 1rem; padding: .85rem 1rem; border-left: 4px solid var(--accent); background: var(--surface);
  border-radius: 0 10px 10px 0; font-size: .95rem; }
.honest strong { display: block; margin-bottom: .15rem; }

.gen-grid { display: grid; gap: 1.25rem; }
.field { margin-bottom: .8rem; }
.field label, .field legend { display: block; font-size: .88rem; font-weight: 600; margin-bottom: .25rem; }
input[type="text"], input[type="tel"], input[type="email"], textarea, select {
  width: 100%; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
textarea { resize: vertical; min-height: 4.5rem; }
.row { display: grid; gap: .6rem; grid-template-columns: 1fr 1fr; }
.row.three { grid-template-columns: repeat(3, 1fr); }
input[type="color"] { width: 100%; height: 2.5rem; padding: .15rem; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.check { display: flex; gap: .5rem; align-items: center; font-weight: 400 !important; }
.check input { width: auto; }
fieldset.design { border: 1px solid var(--line); border-radius: 12px; padding: .8rem; margin-top: .4rem; }
fieldset.design legend { padding-inline: .4rem; font-weight: 600; font-size: .9rem; }
.emoji-row { display: flex; flex-wrap: wrap; gap: .35rem; }
.emoji-btn { width: 2.4rem; height: 2.4rem; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font-size: 1.25rem; line-height: 1; }
.emoji-btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.logo-row { display: flex; gap: .5rem; align-items: center; margin-top: .5rem; flex-wrap: wrap; }
.logo-row input[type="file"] { max-width: 100%; font-size: .85rem; }

.gen-out { display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.qr-preview { width: min(100%, 300px); min-height: 200px; display: grid; place-items: center; padding: .5rem; background: var(--surface);
  border: 1px dashed var(--line); border-radius: 12px; }
.qr-preview canvas, .qr-preview svg { width: 100% !important; height: auto !important; }
.qr-preview .empty { color: var(--muted); font-size: .92rem; text-align: center; padding: 1rem; }
.qr-msg, .qr-scan { width: 100%; font-size: .9rem; }
.warn { padding: .5rem .7rem; border-radius: 8px; background: var(--warn-bg); color: var(--warn); margin-top: .35rem; }
.qr-scan { color: var(--muted); min-height: 1.4em; }
.qr-scan.ok { color: var(--ok); }
.qr-scan.bad { color: var(--warn); }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; width: 100%; justify-content: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; padding: .65rem 1.1rem; border: 1px solid var(--line);
  border-radius: 10px; background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 600; min-height: 2.75rem;
  transition: transform .2s var(--ease-out), background .2s; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.print-note { width: 100%; font-size: .85rem; color: var(--muted); text-align: center; }

/* Rescue */
.state { display: none; }
.tool-card[data-state="idle"] .state-idle,
.tool-card[data-state="working"] .state-working,
.tool-card[data-state="empty"] .state-empty,
.tool-card[data-state="error"] .state-error,
.tool-card[data-state="done"] .state-done { display: block; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: .25rem; text-align: center; padding: 2.2rem 1rem;
  border: 2px dashed var(--line); border-radius: var(--radius); cursor: pointer; background: var(--bg); }
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone strong { font-size: 1.1rem; }
.dropzone span { color: var(--muted); font-size: .92rem; }
.alt-actions { display: flex; justify-content: center; margin-top: .8rem; }
.hint, .res-note { margin-top: .6rem; color: var(--muted); font-size: .88rem; text-align: center; }
.state p { margin-bottom: .6rem; }
.res-kind { display: inline-block; padding: .15rem .6rem; border-radius: 999px; background: var(--accent-soft); font-size: .82rem; font-weight: 600; }
.res-label { color: var(--muted); font-size: .82rem; margin: .5rem 0 0 !important; }
.res-host { font-size: 1.5rem; font-weight: 800; word-break: break-all; }
.res-text { font-family: var(--mono); font-size: .88rem; white-space: pre-wrap; word-break: break-all; padding: .7rem .8rem;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; margin-bottom: .7rem; max-height: 14rem; overflow: auto; }
.res-hint { padding: .6rem .8rem; border-radius: 10px; background: var(--accent-soft); font-size: .93rem; }
.res-hint.bad { background: var(--warn-bg); color: var(--warn); }
.state-done .actions, .state-empty .actions { justify-content: flex-start; margin-top: .6rem; }
.state-done > .btn, .state-empty > .btn, .state-error > .btn { margin-top: .4rem; }

/* =============================================================
   6. Content sections
   ============================================================= */
.ad-slot { margin-block: 1.5rem; min-height: 100px; border: 1px dashed var(--line); border-radius: 10px; display: grid;
  place-items: center; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
.section { margin-top: 2rem; }
.section h2 { font-size: 1.35rem; margin-bottom: .6rem; }
.section p + p, .section ul { margin-top: .7rem; }
.section ul, .section ol { padding-left: 1.25rem; }
.section li + li { margin-top: .35rem; }
.steps { display: grid; gap: .8rem; list-style: none; padding: 0 !important; counter-reset: s; }
.steps li { counter-increment: s; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .8rem .9rem .8rem 3rem; position: relative; margin: 0 !important; }
.steps li::before { content: counter(s); position: absolute; left: .85rem; top: .8rem; width: 1.6rem; height: 1.6rem; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .7rem .9rem; }
details + details { margin-top: .6rem; }
summary { cursor: pointer; font-weight: 600; }
details p { margin-top: .5rem; color: var(--muted); }
.cards { display: grid; gap: .8rem; }
.card-link { display: block; padding: .9rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); }
.card-link strong { display: block; color: var(--accent); }
.card-link span { color: var(--muted); font-size: .92rem; }
.legal h2 { margin-top: 1.6rem; font-size: 1.15rem; }
.legal p { margin-top: .5rem; }
.todo { background: var(--warn-bg); color: var(--warn); padding: 0 .3rem; border-radius: 4px; }

/* =============================================================
   7. Responsive (mobile-first)
   ============================================================= */
@media (min-width: 720px) {
  .gen-grid { grid-template-columns: 1.15fr 1fr; align-items: start; }
  .gen-out { position: sticky; top: 1rem; }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .steps li { padding: 3rem .9rem .9rem; }
  .steps li::before { top: .85rem; }
  .cards { grid-template-columns: 1fr 1fr; }
  .tool-card { padding: 1.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn { transition: none; }
}
