/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f5f5f5;
  --text: #141414;
  --text-muted: #62626a;
  --border: #e6e6e8;
  --accent: #e2231a;
  --accent-strong: #b91912;
  --accent-soft: #fdeceb;
  --ok: #1a8a53;
  --warn: #b5680b;
  --danger: #b8342a;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06), 0 1px 1px rgba(0,0,0,.04);
  --shadow-md: 0 8px 24px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.05);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121113;
    --surface: #1c1b1e;
    --surface-2: #242327;
    --text: #f5f5f5;
    --text-muted: #a8a6ac;
    --border: #333238;
    --accent: #ff5147;
    --accent-strong: #ff7a70;
    --accent-soft: #3a1613;
    --ok: #4fd087;
    --warn: #e0a94a;
    --danger: #ef6b6b;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
    --shadow-md: 0 8px 24px rgba(0,0,0,.45);
  }
}
:root[data-theme="dark"] {
  --bg: #121113;
  --surface: #1c1b1e;
  --surface-2: #242327;
  --text: #f5f5f5;
  --text-muted: #a8a6ac;
  --border: #333238;
  --accent: #ff5147;
  --accent-strong: #ff7a70;
  --accent-soft: #3a1613;
  --ok: #4fd087;
  --warn: #e0a94a;
  --danger: #ef6b6b;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
  --shadow-md: 0 8px 24px rgba(0,0,0,.45);
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; overflow-x: clip; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  overscroll-behavior-y: none;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.08; letter-spacing: -0.01em; font-family: var(--display); font-weight: 600; }
ul { list-style: none; padding: 0; }
::selection { background: var(--accent); color: #fff; }
: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(--text); color: var(--bg); z-index: 9999; border-radius: 8px; font-weight: 600;
  transition: top .2s var(--ease-out);
}
.skip-link:focus { top: 1rem; }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: 1.25rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.section { padding-block: clamp(2.5rem, 6vw, 5rem); }
.section-tight { padding-block: clamp(1.5rem, 4vw, 2.5rem); }
.eyebrow {
  display: inline-flex; align-items: center; gap: .4em;
  font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent);
}
.section-head { max-width: 46rem; margin-bottom: clamp(1.5rem, 4vw, 2.5rem); }
.section-head p { color: var(--text-muted); margin-top: .6rem; font-size: 1.05rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  padding: .8rem 1.4rem; border-radius: var(--radius-sm); font-weight: 600; font-size: .95rem;
  transition: transform .15s var(--ease-out), box-shadow .15s var(--ease-out), background .15s var(--ease-out);
  border: 1px solid transparent; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-strong); box-shadow: var(--shadow-md); }
.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--accent); }
.btn-block { width: 100%; }
.btn-lg { padding: 1rem 1.6rem; font-size: 1.05rem; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* =============================================================
   4. Header
   ============================================================= */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
@supports not (backdrop-filter: blur(1px)) { .site-header { background: var(--bg); } }
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: .55rem; font-family: var(--display); font-weight: 600; font-size: 1.15rem; }
.brand-mark { width: 30px; height: 30px; flex-shrink: 0; }
.header-nav { display: flex; align-items: center; gap: 1.5rem; }
.header-nav a { font-size: .92rem; font-weight: 500; color: var(--text-muted); }
.header-nav a:hover { color: var(--accent); }
.header-nav .btn { font-size: .88rem; padding: .55rem 1.1rem; }
.nav-links { display: none; }
@media (min-width: 720px) { .nav-links { display: flex; gap: 1.5rem; } }

/* =============================================================
   5. Hero
   ============================================================= */
.hero { padding-block: clamp(2rem, 6vw, 3.5rem) 1rem; text-align: center; }
.hero h1 { font-size: clamp(2rem, 4.6vw, 3.2rem); max-width: 20ch; margin-inline: auto; }
.hero .lede { max-width: 42rem; margin: 1rem auto 0; color: var(--text-muted); font-size: clamp(1rem, 1.6vw, 1.2rem); }
.hero-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; margin-top: 1.3rem; }
.pill {
  display: inline-flex; align-items: center; gap: .4em; padding: .35rem .8rem;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border);
  font-size: .82rem; font-weight: 600; color: var(--text-muted);
}
.pill svg { width: 14px; height: 14px; }

/* =============================================================
   6. Tool card
   ============================================================= */
.tool-section { padding-top: clamp(1.5rem, 3vw, 2rem); }
.tool-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); padding: clamp(1.1rem, 3vw, 2rem);
}
.tool-grid { display: grid; gap: clamp(1.5rem, 3vw, 2.5rem); grid-template-columns: 1fr; }
@media (min-width: 960px) { .tool-grid { grid-template-columns: 1.05fr .95fr; align-items: start; } }

.field-group { margin-bottom: 1.35rem; }
.field-group:last-child { margin-bottom: 0; }
.field-label {
  display: block; font-size: .82rem; font-weight: 700; color: var(--text);
  margin-bottom: .5rem; letter-spacing: .01em;
}
.field-hint { font-size: .78rem; color: var(--text-muted); margin-top: .35rem; }
.text-input, select.text-input {
  width: 100%; padding: .75rem .9rem; border-radius: var(--radius-sm); border: 1.5px solid var(--border);
  background: var(--bg); color: var(--text); font-size: .95rem; font-family: var(--sans);
  transition: border-color .15s var(--ease-out);
}
.text-input:focus { border-color: var(--accent); }
.input-row { display: flex; gap: .6rem; }
.input-row > * { flex: 1; }

.mode-tabs { display: inline-flex; padding: .25rem; background: var(--surface-2); border-radius: var(--radius-sm); gap: .2rem; }
.mode-tab {
  padding: .5rem 1rem; border-radius: 7px; font-size: .85rem; font-weight: 600; color: var(--text-muted);
  transition: background .15s var(--ease-out), color .15s var(--ease-out);
}
.mode-tab[aria-selected="true"] { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }

.style-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .55rem; }
.style-option { position: relative; }
.style-option input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.style-option .style-card {
  display: flex; flex-direction: column; align-items: center; gap: .4rem; padding: .6rem .3rem;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: .74rem; font-weight: 600;
  color: var(--text-muted); text-align: center; transition: border-color .15s var(--ease-out), background .15s var(--ease-out);
}
.style-option input:checked + .style-card { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.style-option input:focus-visible + .style-card { outline: 2px solid var(--accent); outline-offset: 2px; }
.style-swatch { width: 30px; height: 30px; }

.color-row { display: flex; gap: .75rem; flex-wrap: wrap; }
.color-field { display: flex; align-items: center; gap: .55rem; background: var(--bg); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: .45rem .7rem; flex: 1; min-width: 130px; }
.color-field input[type="color"] { width: 30px; height: 30px; border: 0; border-radius: 6px; padding: 0; background: none; cursor: pointer; }
.color-field input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-field input[type="color"]::-webkit-color-swatch { border: 1px solid var(--border); border-radius: 6px; }
.color-field span { font-size: .8rem; font-weight: 600; color: var(--text-muted); }

.center-row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: .3rem; max-height: 128px; overflow-y: auto; padding: .5rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); }
.emoji-btn { font-size: 1.2rem; padding: .35rem; border-radius: 6px; line-height: 1; transition: background .12s; }
.emoji-btn:hover, .emoji-btn.is-active { background: var(--accent-soft); }
.upload-btn { display: inline-flex; align-items: center; gap: .4em; padding: .55rem .9rem; border: 1.5px dashed var(--border); border-radius: var(--radius-sm); font-size: .82rem; font-weight: 600; color: var(--text-muted); }
.upload-btn:hover { border-color: var(--accent); color: var(--accent); }
.center-clear { font-size: .8rem; color: var(--text-muted); text-decoration: underline; }
.center-clear:hover { color: var(--danger); }

.preview-col { display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 84px; }
@media (max-width: 959px) { .preview-col { position: static; } }
.preview-2d {
  aspect-ratio: 1; width: 100%; max-width: 320px; margin-inline: auto; border-radius: var(--radius-md);
  background: var(--surface-2); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center;
  padding: .8rem; overflow: hidden;
}
.preview-2d canvas { width: 100%; height: 100%; image-rendering: pixelateD; border-radius: 6px; }

.download-row { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; }
.download-row .btn { flex: 1; min-width: 120px; }

.divider-3d { display: flex; align-items: center; gap: .8rem; margin: 1.8rem 0 1.2rem; color: var(--text-muted); font-size: .85rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.divider-3d::before, .divider-3d::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.format-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.format-option input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.format-option { position: relative; }
.format-card {
  display: flex; flex-direction: column; align-items: center; gap: .45rem; padding: .8rem .4rem;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: .78rem; font-weight: 600;
  color: var(--text-muted); text-align: center; transition: border-color .15s var(--ease-out), background .15s var(--ease-out);
}
.format-option input:checked + .format-card { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.format-option input:focus-visible + .format-card { outline: 2px solid var(--accent); outline-offset: 2px; }
.format-card svg { width: 34px; height: 34px; }

.size-tabs { display: flex; gap: .5rem; }
.size-tabs label { flex: 1; }
.size-tabs input { position: absolute; opacity: 0; }
.size-card { display:block; text-align:center; padding: .55rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size:.82rem; font-weight:600; color: var(--text-muted); }
.size-tabs input:checked + .size-card { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }

.preview-3d-wrap {
  aspect-ratio: 1; width: 100%; max-width: 320px; margin-inline: auto; border-radius: var(--radius-md);
  background: var(--surface-2); border: 1px solid var(--border); position: relative; overflow: hidden;
}
.preview-3d-wrap canvas { width: 100%; height: 100%; touch-action: none; }
.preview-3d-status {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .5rem; font-size: .8rem; color: var(--text-muted); text-align: center; padding: 1rem; background: var(--surface-2);
  transition: opacity .2s var(--ease-out);
}
.preview-3d-wrap[data-loaded="true"] .preview-3d-status { opacity: 0; pointer-events: none; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--border); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.drag-hint { position: absolute; bottom: 8px; left: 0; right: 0; text-align: center; font-size: .72rem; color: var(--text-muted); background: color-mix(in srgb, var(--surface) 75%, transparent); padding: .25rem; pointer-events: none; }

.warnings { display: flex; flex-direction: column; gap: .5rem; margin-top: 1rem; }
.warning-item { display: flex; gap: .55rem; align-items: flex-start; font-size: .82rem; padding: .6rem .75rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); }
.warning-item svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: .1rem; }
.warning-item.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, var(--border)); }
.warning-item.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, var(--border)); }
.warning-item.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.warning-item .wtext { color: var(--text); }

.privacy-badge { display: flex; align-items: flex-start; gap: .6rem; margin-top: 1.4rem; padding: .8rem 1rem; background: var(--accent-soft); border-radius: var(--radius-sm); font-size: .84rem; color: var(--text); }
.privacy-badge svg { width: 18px; height: 18px; color: var(--accent); flex-shrink: 0; margin-top: .1rem; }
.limits-note { text-align: center; font-size: .78rem; color: var(--text-muted); margin-top: .6rem; }

.text-emoji-row { display: flex; gap: .6rem; }
.text-emoji-row .text-input { flex: 1; }

/* =============================================================
   7. Ad slots (placeholders — no third-party scripts)
   ============================================================= */
.ad-slot {
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: .3rem;
  border: 1.5px dashed var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
  color: var(--text-muted); font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.ad-slot span.small { font-size: .65rem; font-weight: 500; letter-spacing: .02em; text-transform: none; }
.ad-leaderboard { min-height: 90px; width: 100%; margin-block: 1rem; }
.ad-incontent { min-height: 250px; width: 100%; max-width: 720px; margin: 2.5rem auto; }
.ad-corner {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 60; width: 260px; min-height: 90px;
  box-shadow: var(--shadow-md); background: var(--surface); flex-direction: row; justify-content: space-between;
  padding: .8rem 1rem; text-align: left; transform: translateY(140%); transition: transform .35s var(--ease-out);
}
.ad-corner.is-visible { transform: translateY(0); }
.ad-corner .ad-close { flex-shrink: 0; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--surface-2); color: var(--text-muted); }
.ad-corner .ad-close:hover { color: var(--danger); }
@media (max-width: 539px) { .ad-corner { left: 1rem; right: 1rem; width: auto; } }

.ad-dialog { border: none; border-radius: var(--radius-lg); padding: 0; max-width: 420px; width: min(92vw, 420px); box-shadow: var(--shadow-md); background: var(--surface); color: var(--text); }
.ad-dialog::backdrop { background: rgba(10,9,15,.55); backdrop-filter: blur(2px); }
.ad-dialog-inner { padding: 1.4rem; }
.ad-dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .9rem; }
.ad-dialog-head h3 { font-size: 1rem; font-family: var(--sans); font-weight: 700; }
.ad-dialog .ad-close { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.ad-dialog .ad-close:hover { color: var(--danger); }
.ad-dialog .ad-slot { min-height: 220px; }
.ad-dialog-foot { margin-top: 1rem; text-align: center; }

/* =============================================================
   8. How it works / SEO text / use cases / FAQ
   ============================================================= */
.steps-grid { display: grid; gap: 1.5rem; grid-template-columns: 1fr; counter-reset: step; }
@media (min-width: 720px) { .steps-grid { grid-template-columns: repeat(3, 1fr); } }
.step-card { position: relative; padding: 1.4rem 1.2rem 1.2rem; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.step-number { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; font-family: var(--display); margin-bottom: .8rem; }
.step-card h3 { font-size: 1.05rem; margin-bottom: .4rem; }
.step-card p { color: var(--text-muted); font-size: .92rem; }

.seo-copy { max-width: 66ch; margin-inline: auto; color: var(--text-muted); }
.seo-copy h2 { color: var(--text); margin-bottom: .8rem; font-size: clamp(1.4rem, 2.6vw, 1.8rem); }
.seo-copy p { margin-bottom: 1rem; }
.seo-copy strong { color: var(--text); }

.usecases-grid { display: grid; gap: 1.1rem; grid-template-columns: 1fr; }
@media (min-width: 540px) { .usecases-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .usecases-grid { grid-template-columns: repeat(3, 1fr); } }
.usecase-card { padding: 1.3rem; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); transition: border-color .15s var(--ease-out), transform .15s var(--ease-out); }
.usecase-card:hover { border-color: var(--accent); }
.usecase-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-strong); display: flex; align-items: center; justify-content: center; margin-bottom: .8rem; }
.usecase-icon svg { width: 22px; height: 22px; }
.usecase-card h3 { font-size: 1.02rem; margin-bottom: .4rem; }
.usecase-card p { color: var(--text-muted); font-size: .9rem; }

.faq-list { max-width: 52rem; margin-inline: auto; display: flex; flex-direction: column; gap: .6rem; }
.faq-item { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); overflow: hidden; }
.faq-item summary {
  cursor: pointer; list-style: none; padding: 1rem 1.2rem; font-weight: 600; font-size: .96rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary .chev { flex-shrink: 0; width: 18px; height: 18px; color: var(--text-muted); transition: transform .2s var(--ease-out); }
.faq-item[open] summary .chev { transform: rotate(180deg); }
.faq-item .faq-a { padding: 0 1.2rem 1.1rem; color: var(--text-muted); font-size: .92rem; }

/* =============================================================
   9. Footer
   ============================================================= */
.site-footer { border-top: 1px solid var(--border); padding-block: 2.2rem; margin-top: 2rem; }
.footer-grid { display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between; align-items: center; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.1rem; font-size: .85rem; color: var(--text-muted); }
.footer-links a:hover { color: var(--accent); }
.footer-credit { font-size: .78rem; color: var(--text-muted); margin-top: 1rem; }
.footer-credit a { text-decoration: underline; }

/* =============================================================
   10. Reveal micro-interaction (functional, not gated by reduced-motion)
   ============================================================= */
[data-reveal] { opacity: 0; transform: translateY(16px); transition: opacity .5s var(--ease-out), transform .5s var(--ease-out); }
[data-reveal].is-visible { opacity: 1; transform: none; }

/* =============================================================
   11. Legal skeleton pages
   ============================================================= */
.legal-page { max-width: 60rem; margin-inline: auto; padding-block: 3rem; }
.legal-page h1 { margin-bottom: 1rem; }
.legal-page h2 { font-size: 1.15rem; margin: 1.6rem 0 .5rem; }
.legal-page p { color: var(--text-muted); margin-bottom: .8rem; }

/* =============================================================
   12. Responsive tweaks
   ============================================================= */
@media (max-width: 539px) {
  .style-grid { grid-template-columns: repeat(4, 1fr); }
  .format-grid { grid-template-columns: repeat(3, 1fr); }
  .download-row .btn { min-width: 100%; }
}
