/* ===== Tokens ===== */
:root {
  --bg: #FBF7F0; --surface: #FFFFFF; --ink: #1F1A17; --muted: #6B625B; --line: #E9E1D6;
  --accent: #B4441E; --accent-ink: #FFFFFF; --soft: #F4ECE1;
  --ok: #2F6B3A; --warn: #9A5B00; --bad: #B42318;
  --display: 'Fraunces', Georgia, serif;
  --body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 18px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171412; --surface: #211D1A; --ink: #F3EEE8; --muted: #B3A99F; --line: #3A332E;
    --accent: #E0693F; --soft: #2A2420; --ok: #7BC48A; --warn: #E8B04B; --bad: #FF8A80;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.55; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
a { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ===== Header / footer ===== */
.site-header { max-width: 1120px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; }
.logo { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); text-decoration: none; font-weight: 800; font-size: 19px; }
.logo span { color: var(--ink); }
.header-link { color: var(--muted); font-weight: 700; text-decoration: none; font-size: 15px; }
.site-footer { border-top: 1px solid var(--line); margin-top: 48px; padding: 24px 16px; text-align: center; color: var(--muted); font-size: 14px; }

/* ===== Hero ===== */
main { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.hero { padding: 6px 0 14px; }
.hero h1 { font-family: var(--display); font-size: clamp(26px, 5vw, 44px); letter-spacing: -0.01em; }
.subtitle { margin: 6px 0 0; color: var(--muted); max-width: 720px; font-size: clamp(15px, 2vw, 17px); }

/* ===== Tool card ===== */
.tool-card { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 12px 32px -18px rgba(60,30,10,.25); }
#herramienta { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "input" "preview" "design"; }
.tool-input { grid-area: input; min-width: 0; }
.tool-preview { grid-area: preview; text-align: center; min-width: 0; }
.tool-design { grid-area: design; min-width: 0; }
@media (min-width: 860px) {
  #herramienta { grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); grid-template-areas: "input preview" "design preview"; padding: 24px; gap: 20px 32px; }
  .tool-preview { position: sticky; top: 16px; align-self: start; }
}
.noscript { grid-column: 1 / -1; margin: 0; padding: 12px; background: var(--soft); border-radius: 12px; font-weight: 700; }

.modes { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; margin-bottom: 12px; }
.modes::-webkit-scrollbar { display: none; }
.mode { flex: none; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); font-weight: 700; font-size: 14px; color: var(--muted); }
.mode[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.field { display: block; font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.field input[type="text"], .field input[type="url"], .field input[type="tel"], .field select {
  display: block; width: 100%; margin-top: 5px; min-height: 46px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg); font-weight: 500; font-size: 16px;
}
.field input:focus, .field select:focus { border-color: var(--accent); outline: none; }
.field input[type="range"] { display: block; width: 100%; margin-top: 6px; accent-color: var(--accent); }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.field.compact { flex: 1 1 180px; margin-bottom: 0; }
.check { display: inline-flex; gap: 8px; align-items: center; font-weight: 700; font-size: 14px; }
.hint { margin: -2px 0 0; color: var(--muted); font-size: 14px; }

.qr-frame { width: min(100%, 300px); aspect-ratio: 1; margin: 0 auto; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; }
.qr-frame svg, .qr-frame canvas { width: 100%; height: 100%; display: block; }
.payload-error { color: var(--bad); font-weight: 700; margin: 8px 0 0; font-size: 14px; }
.downloads { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.dl-note { color: var(--muted); font-size: 13px; margin: 8px 0 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 50px; padding: 0 22px; border-radius: 14px; border: 0; font-weight: 800; font-size: 16px; text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: progress; }
.link-btn { background: none; border: 0; padding: 6px 2px; color: var(--accent); font-weight: 700; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }

.mini-title { font-family: var(--body); font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; }
.styles, .formats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
.formats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.style { min-height: 42px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--bg); font-weight: 700; font-size: 14px; padding: 0 6px; }
.style[aria-checked="true"] { border-color: var(--accent); color: var(--accent); background: var(--soft); }
.colors { margin-bottom: 12px; }
.color { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.color input { width: 44px; height: 36px; padding: 0; border: 1.5px solid var(--line); border-radius: 10px; background: none; }
.center-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.center-pick .label { font-weight: 700; font-size: 14px; }
.emojis { display: flex; flex-wrap: wrap; gap: 4px; }
.emoji { width: 40px; height: 40px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg); font-size: 20px; line-height: 1; }
.emoji[aria-pressed="true"] { border-color: var(--accent); background: var(--soft); }
.upload { cursor: pointer; }

.warnings { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.warnings li { font-size: 14px; padding: 8px 10px; border-radius: 10px; background: var(--soft); }
.warnings li.bad { color: var(--bad); font-weight: 700; }
.warnings li.warn { color: var(--warn); font-weight: 700; }
.warnings li.info { color: var(--muted); }

.privacy { margin: 12px 4px 20px; color: var(--muted); font-size: 14px; text-align: center; }

/* ===== 3D ===== */
.card-3d { padding: 20px; }
.d3-head h2 { font-family: var(--display); font-size: clamp(22px, 3.5vw, 30px); }
.d3-head p { margin: 6px 0 16px; color: var(--muted); max-width: 720px; }
.d3-grid { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .d3-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.viewer { position: relative; aspect-ratio: 4 / 3; border-radius: 16px; background: radial-gradient(ellipse at 50% 30%, var(--soft), var(--bg)); border: 1px solid var(--line); overflow: hidden; }
.viewer canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.viewer-msg { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; padding: 20px; text-align: center; color: var(--muted); font-weight: 700; }
.viewer[data-state="ready"] .viewer-msg { display: none; }
.module-size { margin: 0; font-weight: 700; font-size: 14px; }
.module-size.bad { color: var(--bad); }
.module-size.ok { color: var(--ok); }
.d3-controls .btn.block { margin-top: 14px; }

/* ===== Ads ===== */
.ad-slot { display: grid; place-items: center; border: 1.5px dashed var(--line); border-radius: 14px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; margin: 24px 0; }
.ad-leader { min-height: 100px; }
.ad-content { min-height: 280px; }

/* ===== Content ===== */
.content { max-width: 760px; margin: 0 auto; }
.content h2 { font-family: var(--display); font-size: clamp(22px, 3.2vw, 30px); margin: 36px 0 12px; }
.content h3 { font-size: 19px; margin: 24px 0 8px; }
.content p { margin: 0 0 12px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.steps li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 4px; }
.steps svg { width: 28px; height: 28px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; }
.steps span { color: var(--muted); font-size: 15px; }
.tips { padding-left: 20px; }
.tips li { margin-bottom: 8px; }
.faq details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.faq summary { font-weight: 700; cursor: pointer; }
.faq details p { margin: 8px 0 0; color: var(--muted); }
.more { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.more-card { display: grid; gap: 2px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); text-decoration: none; }
.more-card span { color: var(--muted); font-size: 14px; }
.more-card:hover { border-color: var(--accent); }

/* ===== Legal pages ===== */
.legal { max-width: 760px; margin: 0 auto; padding: 8px 16px 24px; }
.legal h1 { font-family: var(--display); font-size: 32px; margin-bottom: 16px; }
.legal h2 { font-size: 20px; margin: 24px 0 8px; }
.todo { background: #FFF3C4; color: #5C4300; padding: 0 4px; border-radius: 4px; }
