/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #f6f7f5;
  --surface: #ffffff;
  --ink: #15201f;
  --muted: #5d6b69;
  --line: #dfe5e3;
  --accent: #0f766e;
  --accent-2: #14b8a6;
  --accent-soft: #e3f4f1;
  --warn: #b45309;
  --warn-soft: #fff4e5;
  --bad: #b42318;
  --bad-soft: #fdecea;
  --ok: #157f3b;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 40, 36, .06), 0 8px 24px rgba(16, 40, 36, .06);
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --display: "Manrope", "Inter", system-ui, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* =============================================================
   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; -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}
img, svg, video, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
p { text-wrap: pretty; }
h1, h2, h3 { font-family: var(--display); line-height: 1.12; letter-spacing: -0.02em; text-wrap: balance; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: 16px; }
.skip-link { position: fixed; top: -100px; left: 1rem; padding: .6rem 1rem; background: var(--ink); color: #fff; z-index: 9999; border-radius: 8px; }
.skip-link:focus { top: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.noscript { padding: 1rem; background: var(--warn-soft); border-radius: 12px; }

/* =============================================================
   4. Header / hero
   ============================================================= */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.brand { display: flex; align-items: center; gap: .5rem; font-family: var(--display); font-weight: 800; font-size: 1.25rem; color: var(--ink); text-decoration: none; }
.brand b { color: var(--accent); }
.nav { display: none; gap: 1.4rem; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 500; font-size: .95rem; }
.nav a:hover { color: var(--ink); }

.hero { padding-top: 22px; padding-bottom: 14px; }
.hero h1 { font-size: clamp(1.55rem, 4.6vw, 2.55rem); font-weight: 800; }
.lead { margin-top: .5rem; color: var(--muted); font-size: clamp(.95rem, 2.2vw, 1.08rem); max-width: 62ch; }

/* =============================================================
   5. Tool layout
   ============================================================= */
.tool {
  display: grid; gap: 14px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "content" "preview" "design" "object";
}
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; min-width: 0; }
.panel-content { grid-area: content; }
.panel-preview { grid-area: preview; display: grid; gap: 16px; }
.panel-design { grid-area: design; }
.panel-object { grid-area: object; }
.panel-title { font-size: 1.05rem; font-weight: 800; display: flex; align-items: center; gap: .55rem; margin-bottom: 12px; }
.step { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-size: .85rem; flex: none; }

/* Fields */
.field { display: block; margin-bottom: 12px; }
.label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 5px; }
.field input[type=url], .field input[type=text], .field select, .field textarea {
  width: 100%; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfb;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hint { font-size: .82rem; color: var(--muted); margin-top: -4px; }
.grid-2 { display: grid; gap: 0 12px; grid-template-columns: minmax(0, 1fr); }
input[type=range] { width: 100%; accent-color: var(--accent); }

/* Tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tab { padding: .45rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: #fbfcfb; font-size: .9rem; font-weight: 500; transition: background .2s, border-color .2s; }
.tab.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Segmented controls */
.seg { display: grid; gap: 8px; }
.seg-style { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.seg-btn { display: flex; align-items: center; gap: .5rem; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfb; font-size: .9rem; font-weight: 500; transition: border-color .2s, background .2s; }
.seg-btn.is-active, .fmt-btn.is-active { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.ico { width: 18px; height: 18px; flex: none; background: var(--ink); }
.ico-sq { border-radius: 2px; }
.ico-rd { border-radius: 6px; }
.ico-dt { background: radial-gradient(circle, var(--ink) 3px, transparent 3.5px) 0 0 / 9px 9px; }
.ico-el { border-radius: 9px 2px 9px 2px; }

.seg-format { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 14px; }
.fmt-btn { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: .7rem .4rem; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfb; color: var(--accent); transition: border-color .2s, background .2s; }
.fmt-btn svg { width: 44px; height: 34px; }
.fmt-btn b { color: var(--ink); font-size: .85rem; line-height: 1.2; }
.fmt-btn small { color: var(--muted); font-size: .72rem; line-height: 1.2; }

/* Colors */
.color-wrap { display: inline-flex; align-items: center; gap: .5rem; padding: 4px 10px 4px 4px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfb; }
.color-wrap input[type=color] { width: 36px; height: 30px; border: 0; padding: 0; background: none; cursor: pointer; }
.color-wrap code { font-size: .82rem; color: var(--muted); }
.filament-row { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.filament { display: grid; gap: 6px; padding: 10px; border: 1px dashed var(--line); border-radius: 12px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.sw { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); transition: transform .15s; }
.sw:hover { transform: scale(1.1); }
.sw.is-active { box-shadow: 0 0 0 2px var(--accent); }

/* Emojis */
.emoji-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
.emoji-btn { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 10px; font-size: 1.25rem; background: #fbfcfb; display: grid; place-items: center; transition: border-color .15s, background .15s; }
.emoji-btn.is-active { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.emoji-btn.none { font-size: .72rem; color: var(--muted); }

/* Buttons */
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .6rem 1rem; border-radius: 10px; font-weight: 600; font-size: .92rem; transition: background .2s, transform .15s, border-color .2s; }
.btn:active { transform: translateY(1px); }
.btn-ghost { border: 1px solid var(--line); background: #fbfcfb; }
.btn-ghost:hover { border-color: var(--accent); }
.btn-file { cursor: pointer; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #0b5f58; }
.btn-primary[disabled] { opacity: .6; cursor: progress; }
.btn-big { width: 100%; flex-direction: column; gap: 0; padding: .85rem 1rem; font-size: 1.05rem; }
.btn-big small { font-weight: 400; font-size: .8rem; opacity: .9; }
.link-btn { display: block; margin: 0 auto; font-size: .85rem; color: var(--accent); text-decoration: underline; padding: .3rem; }

/* Preview */
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.chip { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: .2rem .55rem; border-radius: 999px; background: #eef1f0; color: var(--muted); }
.chip-accent { background: var(--accent-soft); color: var(--accent); }
.preview-2d .btn-row { justify-content: center; margin-top: 10px; }
.qr-canvas { width: min(100%, 230px); aspect-ratio: 1; margin: 0 auto; border-radius: 12px; overflow: hidden; background: #fff; box-shadow: 0 0 0 1px var(--line); }
.qr-canvas canvas, .qr-canvas svg { width: 100% !important; height: 100% !important; }
.viewer { position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; touch-action: none;
  background: radial-gradient(120% 90% at 50% 20%, #ffffff 0%, #e7ecea 70%, #dce3e1 100%); }
.viewer canvas { width: 100% !important; height: 100% !important; cursor: grab; }
.viewer canvas:active { cursor: grabbing; }
.viewer-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 1rem; color: var(--muted); font-size: .9rem; }
.viewer[data-state=ready] .viewer-msg { display: none; }
.warnings { display: grid; gap: 6px; margin: 10px 0; }
.warn { font-size: .82rem; line-height: 1.4; padding: .5rem .7rem; border-radius: 10px; background: var(--warn-soft); color: #7a3e06; }
.warn.bad { background: var(--bad-soft); color: var(--bad); }
.warn.ok { background: #eaf6ee; color: var(--ok); }

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

/* =============================================================
   6. Ads (placeholders)
   ============================================================= */
.ad-slot { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 2px dashed #c8d0ce; border-radius: 12px; background: repeating-linear-gradient(45deg, #f1f4f3 0 10px, #eceff0 10px 20px); color: #8a9593; text-align: center; }
.ad-label { font-weight: 800; letter-spacing: .18em; font-size: .85rem; }
.ad-size { font-size: .72rem; }
.ad-leaderboard { min-height: 90px; max-width: 728px; margin: 18px auto 0; }
.ad-incontent { min-height: 250px; margin-block: 8px; }

/* =============================================================
   7. Content sections
   ============================================================= */
.section { padding-top: 48px; }
.section > h2 { font-size: clamp(1.35rem, 3.4vw, 1.9rem); font-weight: 800; margin-bottom: 18px; }
.steps { list-style: none; padding: 0; display: grid; gap: 14px; counter-reset: s; }
.steps li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; counter-increment: s; position: relative; }
.steps li::after { content: counter(s); position: absolute; top: 14px; right: 18px; font-family: var(--display); font-weight: 800; font-size: 2rem; color: var(--accent-soft); }
.step-ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); margin-bottom: 10px; }
.step-ico svg { width: 24px; height: 24px; }
.steps h3, .idea h3 { font-size: 1.05rem; margin-bottom: 4px; }
.steps p, .idea p { color: var(--muted); font-size: .93rem; }
.ideas { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.idea { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.idea-emoji { font-size: 1.8rem; display: block; margin-bottom: 6px; }
.prose { max-width: 820px; }
.prose p, .prose li { color: #2f3b3a; margin-bottom: .8rem; }
.prose h3 { font-size: 1.2rem; margin: 1.4rem 0 .6rem; }
.prose ul { padding-left: 1.2rem; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; padding: 0 16px; }
.faq summary { cursor: pointer; padding: 14px 0; font-weight: 600; list-style-position: outside; }
.faq details p { padding-bottom: 14px; color: var(--muted); }
.faq { max-width: 820px; }

.site-footer { margin-top: 56px; padding: 24px 0 90px; border-top: 1px solid var(--line); background: var(--surface); font-size: .88rem; color: var(--muted); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
.footer-inner nav { display: flex; gap: 1rem; }
.legal { max-width: 760px; padding-block: 32px; }
.legal h1 { font-size: 1.8rem; margin-bottom: 1rem; }
.legal h2 { font-size: 1.2rem; margin: 1.4rem 0 .5rem; }
.legal p { margin-bottom: .7rem; }

/* =============================================================
   8. Responsive
   ============================================================= */
@media (max-width: 539px) {
  .header-inner { height: 50px; }
  .hero { padding-top: 14px; padding-bottom: 10px; }
  .lead { font-size: .9rem; line-height: 1.45; }
  .panel { padding: 14px; }
  .panel-title { margin-bottom: 10px; }
  .tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .tab { padding: .4rem .1rem; font-size: .74rem; white-space: nowrap; text-align: center; letter-spacing: -.01em; }
  .hint { font-size: .78rem; }
  .qr-canvas { width: 200px; }
}
@media (min-width: 540px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .seg-style { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .seg-btn { flex-direction: column; gap: .3rem; }
  .filament-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .emoji-grid { grid-template-columns: repeat(10, minmax(0, 1fr)); }
}
@media (min-width: 720px) {
  .nav { display: flex; }
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ideas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-preview { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); align-items: start; }
}
@media (min-width: 960px) {
  .tool {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "content preview" "design preview" "object preview";
    align-items: start;
  }
  .panel-preview { grid-row: 1 / span 3; position: sticky; top: 12px; grid-template-columns: minmax(0, 1fr); }
  .qr-canvas { width: 190px; }
  .preview-2d { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 0 14px; align-items: center; }
  .preview-2d .preview-head { grid-column: 1 / -1; }
  .preview-2d .btn-row { flex-direction: column; margin: 0; }
  .ideas { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero { padding-top: 30px; }
}
@media (min-width: 1280px) {
  .tool { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
}

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