/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #F7F5F0;
  --surface: #FFFFFF;
  --surface-2: #F0EDE5;
  --ink: #1C1A16;
  --muted: #6B665C;
  --border: #E4DFD2;
  --accent: #FF5A1F;
  --accent-ink: #FFFFFF;
  --accent-soft: #FFE7DA;
  --ok: #1C7C4E;
  --bad: #C23B22;
  --mid: #A9720C;
  --radius: 14px;
  --radius-sm: 8px;
  --sans: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", "IBM Plex Mono", monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-card: 0 1px 2px rgba(20,18,12,.04), 0 8px 24px -12px rgba(20,18,12,.18);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17150F;
    --surface: #201D16;
    --surface-2: #26221A;
    --ink: #F3F0E7;
    --muted: #A69E8C;
    --border: #362F22;
    --accent: #FF7A45;
    --accent-ink: #1C1A16;
    --accent-soft: #3A2417;
    --shadow-card: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.5);
  }
}

/* =============================================================
   2. Reset
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  overscroll-behavior-y: none;
}
img, svg, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
input, select { font: inherit; color: inherit; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.15; letter-spacing: -0.01em; font-weight: 800; }
::selection { background: var(--accent-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--ink); color: var(--bg);
  z-index: 9999; border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* =============================================================
   4. Buttons
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  padding: .8rem 1.3rem; border-radius: 999px; font-weight: 700; font-size: .95rem;
  transition: transform .18s var(--ease-out), background .18s var(--ease-out), border-color .18s var(--ease-out);
  border: 1px solid transparent; white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-secondary { background: var(--surface-2); color: var(--ink); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--accent); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover { color: var(--ink); border-color: var(--ink); }
.btn-small { padding: .5rem .9rem; font-size: .85rem; }
.btn-big { width: 100%; padding: 1.05rem 1.5rem; font-size: 1.05rem; }
.file-btn { position: relative; cursor: pointer; }

/* =============================================================
   5. Header / Footer
   ============================================================= */
.site-header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.header-row { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.logo { display: flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.1rem; }
.logo-img { height: 32px; width: auto; display: block; }
.header-nav { display: flex; gap: 1.5rem; font-weight: 600; font-size: .92rem; }
.header-nav a { color: var(--muted); transition: color .18s var(--ease-out); }
.header-nav a:hover { color: var(--ink); }
@media (max-width: 719px) { .header-nav { display: none; } }

.site-footer { border-top: 1px solid var(--border); margin-top: 3rem; padding: 2rem 0; color: var(--muted); font-size: .9rem; }
.footer-row { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; }
.footer-row nav { display: flex; gap: 1.2rem; }
.footer-row a:hover { color: var(--ink); }

/* =============================================================
   6. Hero
   ============================================================= */
.hero { padding: 2.6rem 0 1.6rem; text-align: center; }
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.7rem); }
.hero-sub { max-width: 62ch; margin: .9rem auto 0; color: var(--muted); font-size: 1.05rem; }

/* =============================================================
   7. Tool card
   ============================================================= */
.tool-section { padding-bottom: 1.5rem; }
.tool-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 1.4rem; box-shadow: var(--shadow-card);
}
.tool-grid { display: grid; grid-template-columns: 1fr; gap: 1.6rem; }
@media (min-width: 960px) { .tool-grid { grid-template-columns: 1fr 1fr; } }
.tool-controls, .tool-preview { min-width: 0; }

.ctrl-block { margin-bottom: 1.3rem; }
.ctrl-label { display: block; font-weight: 700; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: .55rem; }

.tabs { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 4px; margin-bottom: 1rem; }
.tab { padding: .5rem 1rem; border-radius: 999px; font-weight: 700; font-size: .88rem; color: var(--muted); transition: background .18s var(--ease-out), color .18s var(--ease-out); }
.tab.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.field { display: block; margin-bottom: .8rem; }
.field span { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .35rem; }
.field input[type="text"] {
  width: 100%; padding: .75rem .9rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--ink); transition: border-color .18s var(--ease-out);
}
.field input[type="text"]:focus { border-color: var(--accent); }
.field-hint { font-size: .82rem; color: var(--muted); margin-top: -.4rem; }
.field-inline { display: flex; align-items: center; gap: .5rem; }
.field-inline input { width: auto; }

.style-grid { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .8rem; }
.style-opt {
  padding: .55rem 1rem; border-radius: 999px; border: 1px solid var(--border); font-weight: 600; font-size: .88rem;
  background: var(--surface-2); transition: border-color .18s var(--ease-out), background .18s var(--ease-out);
}
.style-opt.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.color-row { display: flex; gap: 1.2rem; }
.color-field { display: flex; align-items: center; gap: .6rem; font-weight: 600; font-size: .88rem; }
.color-field input[type="color"] { width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 8px; padding: 2px; background: var(--surface); cursor: pointer; }

.center-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.emoji-picker { display: flex; flex-wrap: wrap; gap: .3rem; }
.emoji-picker button { font-size: 1.3rem; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); display: grid; place-items: center; transition: border-color .18s var(--ease-out); }
.emoji-picker button.is-active { border-color: var(--accent); background: var(--accent-soft); }

.warnings { display: flex; flex-direction: column; gap: .5rem; margin-top: .5rem; }
.warn { padding: .6rem .85rem; border-radius: var(--radius-sm); font-size: .85rem; border: 1px solid var(--border); }
.warn-bad { background: color-mix(in srgb, var(--bad) 12%, var(--surface)); border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); color: var(--bad); }
.warn-mid { background: color-mix(in srgb, var(--mid) 12%, var(--surface)); border-color: color-mix(in srgb, var(--mid) 40%, var(--border)); color: var(--mid); }
.warn-ok { background: color-mix(in srgb, var(--ok) 12%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 35%, var(--border)); color: var(--ok); }
.warn-info { color: var(--muted); }

.tool-preview { display: flex; flex-direction: column; gap: 1rem; }
.preview-label { font-weight: 700; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: .5rem; }
.preview-2d, .preview-3d {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem;
}
.qr-preview { display: flex; align-items: center; justify-content: center; min-height: 280px; }
.qr-preview canvas, .qr-preview svg { border-radius: 8px; }
.qr-empty { color: var(--muted); font-size: .9rem; text-align: center; padding: 2rem; }

.canvas-3d { position: relative; width: 100%; height: 320px; border-radius: var(--radius-sm); overflow: hidden; touch-action: none; background: radial-gradient(circle at 50% 20%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 70%); }
.canvas-3d canvas { width: 100% !important; height: 100% !important; display: block; }
.preview-3d-fallback { color: var(--muted); font-size: .88rem; padding: 1rem; text-align: center; }

.download-zone { display: flex; flex-direction: column; gap: .7rem; }
.download-row { display: flex; flex-wrap: wrap; gap: .6rem; }
.download-row .btn-ghost { margin-left: auto; }

.privacy-badge { font-size: .85rem; color: var(--muted); }
.limits-note { font-size: .8rem; color: var(--muted); }

/* =============================================================
   8. Ad slots
   ============================================================= */
.ad-slot {
  position: relative; display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--border); border-radius: var(--radius-sm); color: var(--muted);
  background: var(--surface-2); margin: 1.6rem auto;
}
.ad-label { font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.ad-leaderboard { max-width: 1160px; height: 90px; margin-left: 20px; margin-right: 20px; }
@media (min-width: 720px) { .ad-leaderboard { margin-left: auto; margin-right: auto; } }
.ad-in-content { max-width: 728px; height: 90px; margin-left: 20px; margin-right: 20px; }
@media (min-width: 780px) { .ad-in-content { margin-left: auto; margin-right: auto; } }

.ad-corner {
  position: fixed; right: 16px; bottom: 16px; z-index: 40;
  width: 220px; height: 90px; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card); display: flex; align-items: center; justify-content: center;
  animation: adCornerIn .4s var(--ease-out);
}
@keyframes adCornerIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.ad-corner-close {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface-2); font-size: 1rem; line-height: 1; display: grid; place-items: center;
}

.ad-dialog { border: 0; border-radius: var(--radius); padding: 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-card); max-width: 380px; width: calc(100% - 40px); }
.ad-dialog::backdrop { background: rgba(10,9,6,.55); }
.ad-dialog-inner { position: relative; padding: 1.4rem; display: flex; flex-direction: column; align-items: center; gap: .9rem; text-align: center; }
.ad-dialog-close { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); font-size: 1.1rem; }
.ad-dialog-slot { width: 100%; height: 200px; border: 1px dashed var(--border); border-radius: var(--radius-sm); display: grid; place-items: center; color: var(--muted); background: var(--surface-2); }

/* =============================================================
   9. Content sections
   ============================================================= */
.section { padding: 2.6rem 0; }
.section h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin-bottom: 1.3rem; }

.steps-grid { display: grid; gap: 1.1rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .steps-grid { grid-template-columns: repeat(3, 1fr); } }
.step-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.3rem; }
.step-num { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; display: grid; place-items: center; margin-bottom: .8rem; }
.step-card h3 { font-size: 1.05rem; margin-bottom: .4rem; }
.step-card p { color: var(--muted); font-size: .92rem; }

.seo-copy { max-width: 800px; }
.seo-copy p { color: var(--muted); margin-bottom: 1rem; }
.seo-copy p strong { color: var(--ink); }

.uses-grid { display: grid; gap: 1.1rem; grid-template-columns: 1fr; }
@media (min-width: 540px) { .uses-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .uses-grid { grid-template-columns: repeat(3, 1fr); } }
.use-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; }
.use-emoji { font-size: 1.6rem; margin-bottom: .5rem; }
.use-card h3 { font-size: 1rem; margin-bottom: .35rem; }
.use-card p { color: var(--muted); font-size: .88rem; }

.faq-list { display: flex; flex-direction: column; gap: .6rem; max-width: 820px; }
.faq-list details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .9rem 1.1rem; }
.faq-list summary { font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: "+"; color: var(--accent); font-weight: 800; }
.faq-list details[open] summary::after { content: "−"; }
.faq-list p { color: var(--muted); margin-top: .6rem; font-size: .92rem; }

.tools-grid { display: grid; gap: .8rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .tools-grid { grid-template-columns: repeat(3, 1fr); } }
.tool-mini { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; color: var(--muted); font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.tool-mini span { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); opacity: .7; }

/* =============================================================
   10. Reduced-motion — only intrusive effects
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .ad-corner { animation: none; }
}
