/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #F1F4F2;
  --card: #FCFDFB;
  --ink: #12181A;
  --muted: #5C6B65;
  --border: rgba(18,24,26,0.12);
  --accent: #0E9C87;
  --accent-ink: #063F36;
  --accent-2: #C96A2E;
  --ok: #187A4C;
  --bad: #C23B22;
  --mid: #96650A;
  --radius: 14px;
  --radius-sm: 9px;
  --display: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-sm: 0 1px 2px rgba(18,24,26,0.06), 0 1px 1px rgba(18,24,26,0.04);
  --shadow-md: 0 8px 24px rgba(18,24,26,0.10);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121615;
    --card: #1B211F;
    --ink: #EDF2EF;
    --muted: #93A39B;
    --border: rgba(237,242,239,0.14);
    --card: #1A211F;
  }
}
:root[data-theme="dark"] {
  --bg: #121615;
  --card: #1A211F;
  --ink: #EDF2EF;
  --muted: #93A39B;
  --border: rgba(237,242,239,0.14);
}

/* =============================================================
   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;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  overscroll-behavior-y: none;
}
img, svg, video, canvas { display: block; max-width: 100%; }
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.12; letter-spacing: -0.01em; font-family: var(--display); font-weight: 600; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: min(1120px, 100% - 2.5rem); margin-inline: auto; }
.visually-hidden { 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(--ink); color: var(--bg);
  z-index: 9999; border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 1rem; }
.is-hidden { display: none !important; }

/* =============================================================
   4. Header / footer
   ============================================================= */
.site-header { padding: 1.1rem 0; border-bottom: 1px solid var(--border); }
.header-row { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: .5rem; font-family: var(--display); font-weight: 700; font-size: 1.2rem; color: var(--ink); }
.brand-mark { color: var(--accent); }
.header-nav { display: flex; gap: 1.4rem; font-size: .92rem; font-weight: 500; }
.header-nav a { color: var(--muted); transition: color .2s 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); padding: 2rem 0; margin-top: 3rem; color: var(--muted); font-size: .9rem; }
.footer-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.footer-row nav { display: flex; gap: 1.2rem; }
.footer-row a:hover { color: var(--ink); }

/* =============================================================
   5. Hero
   ============================================================= */
.hero { padding: 2.6rem 0 1.6rem; text-align: center; }
.hero h1 { font-size: clamp(1.9rem, 4.4vw, 2.9rem); max-width: 24ch; margin-inline: auto; }
.hero-sub { color: var(--muted); font-size: clamp(1rem, 1.6vw, 1.15rem); max-width: 56ch; margin: .9rem auto 0; }

/* =============================================================
   6. Tool card
   ============================================================= */
.tool-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  max-width: 1120px;
  margin: 0 auto 2.2rem;
  padding: 1.6rem;
}
@media (min-width: 720px) { .tool-card { padding: 2.2rem; } }
.tool-grid { display: grid; gap: 2rem; }
@media (min-width: 960px) { .tool-grid { grid-template-columns: 1fr 1fr; gap: 2.6rem; } }
.tool-col-3d { border-top: 1px dashed var(--border); padding-top: 1.6rem; }
@media (min-width: 960px) { .tool-col-3d { border-top: 0; border-left: 1px dashed var(--border); padding-top: 0; padding-left: 2.6rem; } }

.field-group { margin-bottom: 1.3rem; }
.field-group.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field-label { display: block; font-size: .84rem; font-weight: 600; color: var(--muted); margin-bottom: .4rem; }

.text-input {
  width: 100%; padding: .7rem .85rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--ink); font-size: .96rem; font-family: var(--sans);
  transition: border-color .2s var(--ease-out);
}
.text-input:focus { border-color: var(--accent); outline: none; }
.text-input + .text-input { margin-top: .6rem; }
select.text-input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%236B6560' stroke-width='2'%3E%3Cpath d='M5 8l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .7rem center; background-size: 18px; padding-right: 2.2rem; }

.color-input { width: 100%; height: 44px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 3px; background: var(--bg); cursor: pointer; }

.seg-control { display: inline-flex; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.seg-btn { padding: .5rem 1rem; border-radius: 999px; font-size: .88rem; font-weight: 600; color: var(--muted); transition: all .2s var(--ease-out); }
.seg-btn.is-active { background: var(--ink); color: var(--bg); }

.style-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; }
.style-swatch { display: flex; flex-direction: column; align-items: center; gap: .4rem; padding: .7rem .4rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: .78rem; font-weight: 600; color: var(--muted); transition: border-color .2s var(--ease-out), color .2s; }
.style-swatch.is-active { border-color: var(--accent); color: var(--ink); }
.sw-preview { width: 26px; height: 26px; background: var(--ink); }
.sw-clasico { border-radius: 3px; }
.sw-redondeado { border-radius: 9px; }
.sw-puntos { border-radius: 50%; }
.sw-elegante { border-radius: 9px 3px 9px 3px; }

.emoji-row { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.emoji-btn { width: 40px; height: 40px; font-size: 1.25rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; transition: border-color .2s; }
.emoji-btn:hover { border-color: var(--accent); }
.emoji-custom-input { width: 52px; height: 40px; text-align: center; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 1.1rem; background: var(--bg); color: var(--ink); }
.logo-row { display: flex; align-items: center; gap: .6rem; margin-top: .7rem; flex-wrap: wrap; }
.hint-text { font-size: .82rem; color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .8rem 1.3rem; border-radius: 999px; font-weight: 600; font-size: .95rem; transition: transform .15s var(--ease-out), background .2s, opacity .2s; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--bg); color: var(--ink); border: 1.5px solid var(--border); }
.btn-secondary:hover { border-color: var(--ink); }
.btn-ghost { background: transparent; color: var(--muted); border: 1.5px solid var(--border); }
.btn-ghost:hover { color: var(--ink); border-color: var(--ink); }
.btn-sm { padding: .45rem .85rem; font-size: .82rem; }
.btn-lg { width: 100%; padding: 1rem 1.3rem; font-size: 1.02rem; }
.btn[disabled] { opacity: .6; cursor: progress; }
.link-btn { color: var(--muted); font-size: .86rem; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--ink); }

.preview-2d-wrap { display: flex; justify-content: center; padding: 1rem; background: var(--bg); border-radius: var(--radius); border: 1px solid var(--border); }
#canvas-2d { width: 100%; max-width: 320px; height: auto; border-radius: 8px; }
.download-row { display: flex; gap: .7rem; margin-top: 1rem; flex-wrap: wrap; }
.download-row .btn { flex: 1; min-width: 140px; }
.dl-status { margin-top: .6rem; font-size: .82rem; padding: .55rem .7rem; border-radius: 8px; background: var(--bg); border: 1px solid var(--border); color: var(--muted); line-height: 1.4; }
.dl-status[hidden] { display: none; }
.dl-status.is-ok { color: var(--ok); }
.dl-status.is-warn { color: var(--mid); }

.format-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.format-btn { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: .8rem .4rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: .78rem; font-weight: 600; color: var(--muted); }
.format-btn svg { width: 30px; height: 30px; }
.format-btn.is-active { border-color: var(--accent); color: var(--ink); background: color-mix(in srgb, var(--accent) 8%, transparent); }

#warnings-box ul { list-style: none; display: flex; flex-direction: column; gap: .4rem; }
.warn { font-size: .84rem; padding: .5rem .7rem; border-radius: 8px; background: var(--bg); border: 1px solid var(--border); }
.warn-ok { color: var(--ok); }
.warn-bad { color: var(--bad); border-color: var(--bad); }
.warn-mid { color: var(--mid); }

.preview-3d-wrap { position: relative; aspect-ratio: 4/3; background: linear-gradient(155deg, #EFEBE3, #E4DFD4); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; touch-action: none; }
@media (prefers-color-scheme: dark) { .preview-3d-wrap { background: linear-gradient(155deg, #26242A, #201E23); } }
#canvas-3d { width: 100%; height: 100%; cursor: grab; }
#canvas-3d:active { cursor: grabbing; }
.preview-3d-hint { position: absolute; left: .7rem; bottom: .7rem; font-size: .74rem; background: rgba(28,27,31,0.7); color: #fff; padding: .3rem .6rem; border-radius: 999px; pointer-events: none; }
.preview-3d-loading, .preview-3d-fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 1.5rem; font-size: .88rem; color: var(--muted); }
.preview-3d-loading[hidden], .preview-3d-fallback[hidden] { display: none; }

.privacy-badge { text-align: center; margin-top: 1.6rem; font-size: .88rem; color: var(--muted); }
.limits-note { text-align: center; margin-top: .4rem; font-size: .78rem; color: var(--muted); }

/* =============================================================
   7. Ad slots (placeholders only)
   ============================================================= */
.ad-slot {
  min-height: 90px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem;
  border: 1.5px dashed var(--border); border-radius: var(--radius); color: var(--muted); font-size: .8rem;
  margin: 1.6rem auto; background: color-mix(in srgb, var(--muted) 5%, transparent);
}
.ad-leaderboard { max-width: 1120px; }
.ad-incontent { max-width: 728px; min-height: 250px; }
.ad-label { font-size: .68rem; letter-spacing: .08em; font-weight: 700; color: var(--muted); text-transform: uppercase; }

.corner-toast {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 60;
  background: var(--card); border: 1.5px dashed var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md); padding: .9rem 1.1rem .8rem; width: 200px; text-align: center;
}
.corner-toast p { font-size: .82rem; color: var(--muted); margin-top: .2rem; }
.corner-toast-close { position: absolute; top: .3rem; right: .5rem; font-size: 1.1rem; color: var(--muted); line-height: 1; }
.corner-toast-close:hover { color: var(--ink); }

.download-dialog { border: none; border-radius: var(--radius); padding: 1.6rem; max-width: 340px; width: 90vw; box-shadow: var(--shadow-md); position: relative; background: var(--card); color: var(--ink); }
.download-dialog::backdrop { background: rgba(28,27,31,0.45); }
.dialog-close { position: absolute; top: .6rem; right: .8rem; font-size: 1.3rem; color: var(--muted); }
.dialog-close:hover { color: var(--ink); }
.dialog-ad-slot { min-height: 160px; border: 1.5px dashed var(--border); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: .84rem; margin: .6rem 0 1rem; }

/* =============================================================
   8. How it works / SEO text / ideas / FAQ
   ============================================================= */
.how-it-works { padding: 2.4rem 0; text-align: center; }
.how-it-works h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 1.8rem; }
.steps { list-style: none; display: grid; gap: 1.4rem; text-align: left; }
@media (min-width: 720px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.4rem; }
.step-icon { width: 40px; height: 40px; color: var(--accent); margin-bottom: .8rem; }
.step-icon svg { width: 100%; height: 100%; }
.step h3 { font-size: 1.05rem; margin-bottom: .5rem; }
.step p { color: var(--muted); font-size: .92rem; }

.seo-text { max-width: 760px; margin: 0 auto; padding: 1rem 1.25rem 2rem; }
.seo-text h2 { font-size: clamp(1.35rem, 2.6vw, 1.7rem); margin-bottom: 1rem; }
.seo-text p { margin-bottom: 1rem; color: var(--ink); }
.seo-text p:last-child { margin-bottom: 0; }

.ideas { padding: 1rem 0 2.4rem; }
.ideas h2 { text-align: center; font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 1.8rem; }
.ideas-grid { display: grid; gap: 1.1rem; }
@media (min-width: 540px) { .ideas-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .ideas-grid { grid-template-columns: repeat(3, 1fr); } }
.idea-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.3rem; }
.idea-icon { font-size: 1.6rem; margin-bottom: .6rem; }
.idea-card h3 { font-size: 1rem; margin-bottom: .4rem; }
.idea-card p { color: var(--muted); font-size: .9rem; }

.faq { max-width: 760px; margin: 0 auto; padding: 1rem 1.25rem 3rem; }
.faq h2 { text-align: center; font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 1.6rem; }
.faq details { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem 1.2rem; margin-bottom: .7rem; }
.faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-size: 1.3rem; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin-top: .7rem; color: var(--muted); font-size: .94rem; }

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