/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #f6f7f5;
  --surface: #ffffff;
  --ink: #14181b;
  --muted: #5b666d;
  --line: #e2e6e4;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #e3f3f1;
  --warn: #b45309;
  --warn-bg: #fff4e0;
  --bad: #b91c1c;
  --bad-bg: #fdeaea;
  --ok: #0f766e;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(20,24,27,.05), 0 8px 24px rgba(20,24,27,.06);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Manrope", "Inter", system-ui, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1214; --surface: #161c1f; --ink: #eef2f1; --muted: #9aa7ad;
    --line: #263034; --accent: #2dd4bf; --accent-ink: #052e2a; --accent-soft: #12302d;
    --warn-bg: #3a2a10; --bad-bg: #3a1616; --warn: #fbbf24; --bad: #fca5a5;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  }
}

/* =============================================================
   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 { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: var(--accent); }
p { text-wrap: pretty; }
h1, h2, h3 { font-family: var(--display); text-wrap: balance; line-height: 1.15; letter-spacing: -0.02em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* =============================================================
   3. Utilities
   ============================================================= */
.wrap { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: fixed; top: -100px; left: 1rem; padding: .6rem 1rem; background: var(--surface); color: var(--ink); z-index: 9999; border-radius: 8px; font-weight: 600; }
.skip-link:focus { top: 1rem; }

/* =============================================================
   4. Header / footer
   ============================================================= */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.header-in { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--display); font-weight: 700; font-size: 1.2rem; letter-spacing: -0.02em; }
.brand b { color: var(--accent); }
.nav { display: none; gap: 22px; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 500; font-size: .95rem; }
.nav a:hover { color: var(--ink); }
.site-footer { margin-top: 64px; border-top: 1px solid var(--line); background: var(--surface); padding-block: 28px; color: var(--muted); font-size: .92rem; }
.foot-in { display: flex; flex-direction: column; gap: 8px; }
.site-footer a { color: var(--muted); }

/* =============================================================
   5. Hero + tool
   ============================================================= */
.hero { padding-top: 28px; }
.hero h1 { font-size: clamp(1.8rem, 5.4vw, 3rem); font-weight: 800; }
.lead { color: var(--muted); max-width: 70ch; margin: 10px 0 20px; font-size: 1.05rem; }
.lead strong { color: var(--ink); }
.nojs { background: var(--warn-bg); color: var(--warn); padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; }

.tool { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card h2 { font-size: 1.08rem; display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.n { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: .85rem; font-weight: 700; flex: none; }
.n.big { width: 44px; height: 44px; font-size: 1.2rem; margin-bottom: 12px; }

.lbl { display: block; font-size: .86rem; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.lbl em { font-style: normal; color: var(--muted); font-weight: 400; }
.inp {
  width: 100%; font: inherit; padding: 12px 13px; border: 1.5px solid var(--line); border-radius: 11px;
  background: var(--bg); color: var(--ink); margin-bottom: 12px; min-height: 46px;
}
.inp:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.fld { margin-bottom: 18px; }
.fld:last-child { margin-bottom: 0; }
.fld.two { display: grid; gap: 12px; }
.fld.two .inp { margin-bottom: 0; }
.hint { font-size: .82rem; color: var(--muted); }
.rng { width: 100%; accent-color: var(--accent); height: 36px; }

.tabs { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 11px; padding: 3px; margin-bottom: 14px; }
.tab { padding: 8px 18px; border-radius: 8px; font-weight: 600; font-size: .92rem; color: var(--muted); }
.tab.is-on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: .84rem; color: var(--muted); background: var(--bg); }
.chip:hover { border-color: var(--accent); color: var(--accent); }
[hidden] { display: none !important; }

.seg { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.seg button { padding: 10px; border: 1.5px solid var(--line); border-radius: 11px; font-weight: 600; font-size: .9rem; background: var(--bg); }
.seg button.is-on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.preset { width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--line); position: relative; overflow: hidden; padding: 0; }
.preset i { position: absolute; inset: 0; }
.preset i:last-child { inset: auto 0 0 auto; width: 55%; height: 55%; border-top-left-radius: 8px; }
.preset.is-on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.colors { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.clr { display: flex; align-items: center; gap: 10px; border: 1.5px solid var(--line); border-radius: 11px; padding: 6px 10px 6px 6px; background: var(--bg); font-size: .85rem; font-weight: 600; cursor: pointer; }
.clr input { width: 40px; height: 36px; border: 0; padding: 0; background: none; border-radius: 8px; cursor: pointer; flex: none; }

.emojis { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.emojis button { width: 44px; height: 44px; border-radius: 11px; border: 1.5px solid var(--line); font-size: 1.4rem; line-height: 1; background: var(--bg); }
.emojis button.is-on { border-color: var(--accent); background: var(--accent-soft); }
.logo-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.formats { display: grid; gap: 8px; grid-template-columns: 1fr; }
.fmt { display: grid; grid-template-columns: 52px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; text-align: left; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg); }
.fmt svg { grid-row: span 2; width: 52px; height: 34px; color: var(--muted); }
.fmt b { font-size: .95rem; font-family: var(--display); }
.fmt small { color: var(--muted); font-size: .8rem; }
.fmt.is-on { border-color: var(--accent); background: var(--accent-soft); }
.fmt.is-on svg { color: var(--accent); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 12px; font-weight: 700; font-size: .98rem; transition: transform .15s var(--ease-out), background .15s; }
.btn:active { transform: scale(.98); }
.btn-main { width: 100%; background: var(--accent); color: var(--accent-ink); min-height: 60px; font-size: 1.1rem; flex-direction: column; gap: 0; line-height: 1.2; font-family: var(--display); }
.btn-main small { font-weight: 500; font-size: .76rem; opacity: .85; }
.btn-main:hover { filter: brightness(1.07); }
.btn-sec { background: var(--accent-soft); color: var(--accent); }
.btn-sec:hover { filter: brightness(.96); }
.btn-ghost { border: 1.5px solid var(--line); color: var(--muted); }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: .88rem; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* preview card */
.pv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pv { display: grid; gap: 6px; }
.pv figcaption { font-size: .78rem; color: var(--muted); text-align: center; }
.qr-box { aspect-ratio: 1; width: 100%; max-width: 280px; margin-inline: auto; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); display: grid; place-items: center; background: #fff; }
.qr-box canvas, .qr-box svg { width: 100% !important; height: 100% !important; }
.viewer { position: relative; aspect-ratio: 1; width: 100%; max-width: 280px; margin-inline: auto; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: radial-gradient(circle at 50% 35%, #fbfcfb, #dfe5e3); touch-action: pan-y; }
@media (prefers-color-scheme: dark) { .viewer { background: radial-gradient(circle at 50% 35%, #2a3438, #151b1d); } }
.viewer canvas { width: 100% !important; height: 100% !important; cursor: grab; }
.viewer-msg { position: absolute; inset: 0; display: grid; place-items: center; padding: 14px; text-align: center; font-size: .86rem; color: var(--muted); pointer-events: none; }
.viewer.ready .viewer-msg { display: none; }

.warns { display: grid; gap: 6px; margin: 12px 0; }
.w { font-size: .84rem; padding: 8px 11px; border-radius: 9px; line-height: 1.4; }
.w.ok { background: var(--accent-soft); color: var(--ok); }
.w.warn { background: var(--warn-bg); color: var(--warn); }
.w.bad { background: var(--bad-bg); color: var(--bad); }

.dl { display: grid; gap: 10px; }
.dl-row { display: grid; grid-template-columns: 1fr 1fr 1.5fr; gap: 8px; }
.dl-row .btn { padding: 0 8px; min-height: 44px; font-size: .9rem; }
.note { font-size: .8rem; color: var(--muted); min-height: 1.2em; }

.privacy { margin: 14px 0; font-size: .88rem; color: var(--muted); text-align: center; }

/* ads (placeholders) */
.ad { display: grid; place-items: center; border: 2px dashed var(--line); border-radius: 12px; color: var(--muted); font-weight: 700; letter-spacing: .2em; font-size: .85rem; background: repeating-linear-gradient(45deg, transparent 0 10px, rgba(128,128,128,.05) 10px 20px); }
.ad-banner { width: 100%; min-height: 90px; margin: 20px 0; }
.ad-rect { width: 100%; min-height: 250px; }
.toast-ad { position: fixed; right: 12px; bottom: 12px; width: 230px; min-height: 96px; z-index: 40; display: grid; place-items: center; border: 2px dashed var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); color: var(--muted); font-weight: 700; letter-spacing: .2em; font-size: .8rem; padding: 22px 10px 10px; animation: pop .4s var(--ease-out); }
.toast-ad .x, .modal-ad .x { position: absolute; top: 4px; right: 6px; width: 32px; height: 32px; border-radius: 50%; font-size: 1.3rem; line-height: 1; color: var(--muted); }
.toast-ad .x:hover, .modal-ad .x:hover { background: var(--bg); }
@keyframes pop { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.modal-ad { border: 0; border-radius: 18px; padding: 22px 18px 18px; width: min(92vw, 360px); background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px rgba(0,0,0,.35); position: fixed; inset: 0; margin: auto; height: fit-content; }
.modal-ad::backdrop { background: rgba(10,14,16,.55); }
.modal-ad[open] { display: grid; gap: 12px; }
.modal-ad .ok { font-weight: 700; font-family: var(--display); padding-right: 30px; }

/* =============================================================
   6. Sections
   ============================================================= */
.sec { margin-top: 56px; }
.sec h2 { font-size: clamp(1.4rem, 4vw, 2rem); margin-bottom: 20px; font-weight: 800; }
.steps { list-style: none; padding: 0; display: grid; gap: 14px; }
.steps li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.steps h3 { font-size: 1.1rem; margin-bottom: 6px; }
.steps p, .ideas p { color: var(--muted); font-size: .95rem; }
.prose > * { max-width: 820px; }
.prose > .ad { max-width: none; }
.prose p { margin-bottom: 14px; color: var(--muted); }
.prose p strong { color: var(--ink); }
.prose h3 { font-size: 1.15rem; margin: 22px 0 8px; }
.ideas { display: grid; gap: 14px; }
.ideas article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.ideas .em { font-size: 1.8rem; display: block; margin-bottom: 6px; }
.ideas h3 { font-size: 1.05rem; margin-bottom: 4px; }
.faq { display: grid; gap: 10px; max-width: 820px; }
#faq h2 { max-width: 820px; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.faq summary { font-weight: 600; cursor: pointer; list-style-position: outside; }
.faq details[open] summary { margin-bottom: 8px; color: var(--accent); }
.faq p { color: var(--muted); font-size: .95rem; }

/* legal pages */
.legal { max-width: 760px; padding-block: 36px; }
.legal h1 { font-size: 2rem; margin-bottom: 16px; }
.legal h2 { font-size: 1.15rem; margin: 22px 0 6px; }
.legal p { color: var(--muted); margin-bottom: 10px; }
.todo { background: var(--warn-bg); color: var(--warn); padding: 1px 6px; border-radius: 5px; }

/* =============================================================
   7. Responsive (mobile-first)
   ============================================================= */
@media (min-width: 540px) {
  .fld.two { grid-template-columns: 1.3fr 1fr; align-items: end; }
  .formats { grid-template-columns: repeat(3, 1fr); }
  .fmt { grid-template-columns: 1fr; grid-template-rows: auto; row-gap: 4px; text-align: center; justify-items: center; padding: 14px 8px; }
  .fmt svg { grid-row: auto; }
  .seg { grid-template-columns: repeat(4, 1fr); }
  .ideas { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 720px) {
  .nav { display: flex; }
  .foot-in { flex-direction: row; justify-content: space-between; }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .card { padding: 22px; }
}
@media (min-width: 960px) {
  .tool { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); align-items: start; }
  .c-content { grid-column: 1; grid-row: 1; }
  .c-design  { grid-column: 1; grid-row: 2; }
  .c-object  { grid-column: 1; grid-row: 3; }
  .c-preview { grid-column: 2; grid-row: 1 / span 3; position: sticky; top: 74px; }
  .ideas { grid-template-columns: repeat(3, 1fr); }
}

/* =============================================================
   8. Reduced motion (only intrusive effects)
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .toast-ad { animation: none; }
}
