/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #faf8f4;
  --surface: #ffffff;
  --surface-2: #f2efe7;
  --ink: #1c1f26;
  --ink-soft: #5b606b;
  --ink-faint: #8b8f98;
  --border: #e3e0d6;
  --border-strong: #cfcabb;
  --accent: #ff6a3d;
  --accent-ink: #ffffff;
  --accent-soft: #fff1ea;
  --ok: #2e8b57;
  --warn: #b8860b;
  --error: #c8452c;
  --radius-s: 8px;
  --radius-m: 14px;
  --radius-l: 22px;
  --shadow-card: 0 1px 2px rgba(28,31,38,.04), 0 12px 32px -16px rgba(28,31,38,.18);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --display: "Sora", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  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, canvas { 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 { font-family: var(--display); text-wrap: balance; line-height: 1.12; letter-spacing: -0.01em; font-weight: 700; }
ul, ol { list-style: none; padding: 0; }
input, select { font: inherit; color: inherit; }
::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(--ink); color: #fff;
  z-index: 9999; border-radius: var(--radius-s); font-weight: 600;
  transition: top .25s var(--ease-out);
}
.skip-link:focus { top: 1rem; }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* =============================================================
   3. Header / footer
   ============================================================= */
.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(250,248,244,.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 40;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; }
.logo { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 800; font-size: 1.15rem; }
.logo-mark { color: var(--accent); }
.header-tag { color: var(--ink-faint); font-size: .85rem; display: none; }
@media (min-width: 720px) { .header-tag { display: block; } }

.site-footer { border-top: 1px solid var(--border); margin-top: 64px; padding: 28px 0 48px; color: var(--ink-soft); font-size: .88rem; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; }
.footer-inner a { text-decoration: underline; text-underline-offset: 2px; }
.footer-inner nav { display: flex; gap: 18px; }

/* =============================================================
   4. Hero
   ============================================================= */
.hero { padding: 44px 0 20px; }
.hero h1 { font-size: clamp(1.7rem, 1.15rem + 2.4vw, 2.6rem); max-width: 18ch; }
.hero .subtitle { margin-top: 14px; max-width: 62ch; color: var(--ink-soft); font-size: clamp(1rem, .95rem + .3vw, 1.15rem); }

/* =============================================================
   5. Tool card
   ============================================================= */
.tool-section { padding-bottom: 8px; }
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-card);
  padding: 20px;
  margin-top: 8px;
}
@media (min-width: 720px) { .tool-card { padding: 32px; } }

.tool-grid { display: grid; gap: 28px; grid-template-columns: 1fr; }
@media (min-width: 960px) { .tool-grid { grid-template-columns: 1.05fr .95fr; align-items: start; } }

.field-group { margin-bottom: 20px; }
.field-group label, #styleLabel, #formatLabel, #centerLabel { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 8px; }
.field-group input[type="text"], .field-group select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border-strong); border-radius: var(--radius-s);
  background: var(--surface); font-size: .96rem; transition: border-color .15s var(--ease-out);
}
.field-group input[type="text"]:focus, .field-group select:focus { border-color: var(--accent); }
.field-group input + label { margin-top: 12px; }

.mode-tabs { display: flex; gap: 6px; margin-bottom: 14px; background: var(--surface-2); padding: 4px; border-radius: var(--radius-s); width: fit-content; }
.mode-tab { padding: 8px 16px; border-radius: 6px; font-weight: 600; font-size: .88rem; color: var(--ink-soft); }
.mode-tab.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.mode-panel input, .mode-panel select { margin-bottom: 10px; }

.style-grid, .format-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.format-grid { grid-template-columns: 1fr; }
@media (min-width: 540px) { .format-grid { grid-template-columns: repeat(3, 1fr); } }

.style-opt {
  padding: 10px 12px; border: 1.5px solid var(--border-strong); border-radius: var(--radius-s);
  font-size: .88rem; font-weight: 600; text-align: center; transition: border-color .15s var(--ease-out), background .15s var(--ease-out);
}
.style-opt.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.style-opt:hover { border-color: var(--accent); }

.format-opt {
  padding: 12px 14px; border: 1.5px solid var(--border-strong); border-radius: var(--radius-m);
  text-align: left; display: flex; flex-direction: column; gap: 2px; transition: border-color .15s var(--ease-out), background .15s var(--ease-out);
}
.format-opt strong { font-size: .92rem; }
.format-opt span { font-size: .8rem; color: var(--ink-faint); }
.format-opt.is-active { border-color: var(--accent); background: var(--accent-soft); }
.format-opt.is-active strong { color: var(--accent); }
.format-opt:hover { border-color: var(--accent); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.color-input { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-s); padding: 4px 8px; }
.color-input input[type="color"] { width: 34px; height: 34px; border: 0; padding: 0; background: none; border-radius: 6px; overflow: hidden; }
.color-input input[type="text"] { border: 0; padding: 6px 2px; width: 100%; text-transform: uppercase; letter-spacing: .02em; font-size: .9rem; }
.color-input input[type="text"]:focus { outline: none; }

.swap-colors { font-size: .82rem; font-weight: 600; color: var(--ink-soft); margin: -10px 0 20px; text-decoration: underline; text-underline-offset: 2px; }
.swap-colors:hover { color: var(--accent); }

.center-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.emoji-grid { display: flex; flex-wrap: wrap; gap: 6px; max-width: 260px; }
.emoji-opt {
  width: 36px; height: 36px; border-radius: var(--radius-s); border: 1.5px solid var(--border-strong);
  font-size: 1.1rem; display: flex; align-items: center; justify-content: center; transition: border-color .15s var(--ease-out);
}
.emoji-opt.is-active { border-color: var(--accent); background: var(--accent-soft); }
.upload-btn {
  padding: 9px 14px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-s);
  font-size: .85rem; font-weight: 600; color: var(--ink-soft);
}
.upload-btn:hover { border-color: var(--accent); color: var(--accent); }
.ghost-btn { font-size: .82rem; font-weight: 600; color: var(--error); text-decoration: underline; text-underline-offset: 2px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--ink-soft); margin-top: 12px; }
.checkbox-row input { width: 16px; height: 16px; }

.tool-preview { display: flex; flex-direction: column; gap: 14px; }
.preview-2d {
  background: repeating-conic-gradient(#eee 0% 25%, #fff 0% 50%) 0 0/16px 16px;
  border: 1px solid var(--border); border-radius: var(--radius-m);
  display: flex; align-items: center; justify-content: center; padding: 18px; aspect-ratio: 1/1; max-width: 420px; margin: 0 auto; width: 100%;
}
.preview-2d canvas { width: 100%; height: 100%; border-radius: 4px; }

.preview-3d {
  background: radial-gradient(120% 130% at 50% 15%, #eef0f2, #c7cbd1 78%, #b7bcc4);
  border: 1px solid var(--border); border-radius: var(--radius-m);
  aspect-ratio: 4/3.1; max-width: 460px; margin: 0 auto; width: 100%;
  position: relative; overflow: hidden;
}
.preview-3d canvas { width: 100%; height: 100%; touch-action: none; }
.viewer-placeholder {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--ink-faint); font-size: .88rem; text-align: center; padding: 20px;
}
.viewer-hint { text-align: center; font-size: .8rem; color: var(--ink-faint); }

.download-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.btn {
  padding: 12px 20px; border-radius: 999px; font-weight: 700; font-size: .92rem;
  transition: transform .15s var(--ease-out), box-shadow .15s var(--ease-out), background .15s var(--ease-out);
}
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 20px -8px rgba(255,106,61,.6); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 24px -8px rgba(255,106,61,.7); }
.btn-secondary { background: var(--surface-2); color: var(--ink); border: 1px solid var(--border-strong); }
.btn-secondary:hover { border-color: var(--ink-soft); }
.btn:disabled { opacity: .55; cursor: progress; transform: none; box-shadow: none; }

.divider { display: flex; align-items: center; gap: 14px; margin: 34px 0 26px; color: var(--ink-faint); font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.warnings { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.warning-item { padding: 10px 12px; border-radius: var(--radius-s); font-size: .84rem; border: 1px solid transparent; }
.warning-item.error { background: #fdeeea; color: var(--error); border-color: #f3c9be; }
.warning-item.warn { background: #fdf3dd; color: #8a6415; border-color: #eeddab; }
.warning-item.info { background: var(--accent-soft); color: #b24d24; border-color: #ffd8c4; }
.warning-item.ok { background: #eaf6ee; color: var(--ok); border-color: #bfe4cb; }

.hint { font-size: .8rem; color: var(--ink-faint); margin-top: 10px; }
.hosted-limit-note { background: var(--accent-soft); color: #b24d24; border: 1px solid #ffd8c4; border-radius: 10px; padding: 8px 12px; margin-top: 12px; }

/* =============================================================
   6. Ad slots (placeholders — invariant 8, sin scripts reales)
   ============================================================= */
.ad-slot {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-m);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-faint); font-weight: 700; letter-spacing: .08em; font-size: .8rem;
  background: repeating-linear-gradient(135deg, #f4f2ec, #f4f2ec 10px, #efece3 10px, #efece3 20px);
}
.ad-label { padding: 3px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border-strong); }
.ad-slot-banner { min-height: 100px; margin: 22px 0 6px; }
.ad-slot-incontent { min-height: 260px; margin: 28px 0; }

.ad-popup { border: 1px solid var(--border); border-radius: var(--radius-l); padding: 0; max-width: 340px; width: calc(100% - 40px); box-shadow: 0 24px 60px -20px rgba(0,0,0,.35); }
.ad-popup::backdrop { background: rgba(20,18,14,.5); backdrop-filter: blur(2px); }
.ad-popup-inner { padding: 22px; position: relative; text-align: center; }
.ad-popup-close { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); font-size: 1.1rem; line-height: 1; }
.ad-popup-close:hover { background: var(--border); }
.ad-popup-box { min-height: 250px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-s); display: flex; align-items: center; justify-content: center; color: var(--ink-faint); font-weight: 700; margin: 14px 0 18px; background: repeating-linear-gradient(135deg, #f4f2ec, #f4f2ec 10px, #efece3 10px, #efece3 20px); }

.corner-toast {
  position: fixed; right: 16px; bottom: 16px; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-m);
  box-shadow: var(--shadow-card); padding: 14px 40px 14px 16px; min-width: 180px; min-height: 60px;
  display: flex; align-items: center; justify-content: center;
}
.corner-toast-close { position: absolute; top: 6px; right: 8px; font-size: 1rem; color: var(--ink-faint); width: 22px; height: 22px; }
.corner-toast-close:hover { color: var(--ink); }

/* =============================================================
   7. How / SEO / Uses / FAQ sections
   ============================================================= */
.how-section, .seo-section, .uses-section, .faq-section { padding: 52px 0; }
.how-section h2, .seo-section h2, .uses-section h2, .faq-section h2 { font-size: clamp(1.4rem, 1.2rem + 1vw, 1.9rem); margin-bottom: 26px; }

.steps { display: grid; gap: 22px; }
@media (min-width: 720px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.steps li { display: flex; gap: 14px; }
.step-num {
  flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-family: var(--display);
}
.steps h3 { font-size: 1.02rem; margin-bottom: 6px; }
.steps p { color: var(--ink-soft); font-size: .92rem; }

.seo-text { max-width: 76ch; }
.seo-text p { color: var(--ink-soft); margin-bottom: 16px; }
.seo-text p strong { color: var(--ink); }

.uses-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .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-m); padding: 20px; }
.use-emoji { font-size: 1.6rem; display: block; margin-bottom: 10px; }
.use-card h3 { font-size: 1rem; margin-bottom: 6px; }
.use-card p { color: var(--ink-soft); font-size: .88rem; }

.faq-list { display: flex; flex-direction: column; gap: 10px; max-width: 78ch; }
.faq-list details { border: 1px solid var(--border); border-radius: var(--radius-m); padding: 4px 18px; background: var(--surface); }
.faq-list summary { padding: 14px 0; font-weight: 600; cursor: pointer; list-style: none; position: relative; padding-right: 26px; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: "+"; position: absolute; right: 0; top: 12px; font-size: 1.3rem; color: var(--accent); transition: transform .2s var(--ease-out); }
.faq-list details[open] summary::after { transform: rotate(45deg); }
.faq-list p { padding-bottom: 16px; color: var(--ink-soft); font-size: .92rem; }

/* =============================================================
   8. Legal pages
   ============================================================= */
.legal-section { padding: 44px 0 60px; }
.legal-text { max-width: 74ch; }
.legal-text h1 { font-size: 1.8rem; margin-bottom: 18px; }
.legal-text h2 { font-size: 1.1rem; margin: 26px 0 8px; }
.legal-text p { color: var(--ink-soft); margin-bottom: 10px; }

/* =============================================================
   9. Reduced motion — solo lo intrusivo
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* =============================================================
   10. Responsive niceties
   ============================================================= */
@media (max-width: 539px) {
  .two-col { grid-template-columns: 1fr; }
}
