/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #f4f5f8;
  --card: #ffffff;
  --ink: #14161c;
  --muted: #596070;
  --line: #e2e5eb;
  --line-strong: #cbd0d9;
  --soft: #f1f2f6;
  --accent: #4f46e5;
  --accent-dark: #3f37c9;
  --accent-soft: #eeedfd;
  --ok: #0f7b55;
  --ok-soft: #e7f6ef;
  --warn: #8a4b00;
  --warn-soft: #fff4de;
  --bad: #b42318;
  --bad-soft: #fdecea;
  --radius: 16px;
  --radius-sm: 10px;
  --gutter: 16px;
  --sans: "Manrope", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow: 0 1px 2px rgba(20, 22, 28, .04), 0 8px 24px rgba(20, 22, 28, .05);
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, canvas { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; }
p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; line-height: 1.15; letter-spacing: -0.02em; }
fieldset { border: 0; padding: 0; min-width: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: 100%; max-width: 1120px; margin-inline: auto; padding-inline: var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; top: -100px; left: 1rem; padding: .6rem 1rem; background: var(--ink); color: #fff; z-index: 9999; border-radius: 8px; font-weight: 600; }
.skip-link:focus { top: 1rem; }
.center { text-align: center; }

/* =============================================================
   4. Header & hero
   ============================================================= */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; justify-content: space-between; height: 52px; }
.brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.1rem; letter-spacing: -0.02em; text-decoration: none; }
.brand-mark { width: 28px; height: 28px; color: var(--accent); }
.header-nav { display: none; gap: 1.5rem; font-size: .92rem; font-weight: 600; color: var(--muted); }
.header-nav a { text-decoration: none; }
.header-nav a:hover { color: var(--ink); }

.hero { padding-block: 18px 14px; }
.hero h1 { font-size: clamp(1.5rem, 5.4vw, 2.5rem); font-weight: 800; }
.hero-sub { margin-top: .5rem; color: var(--muted); font-size: clamp(.95rem, 2.6vw, 1.08rem); max-width: 62ch; }
.hero-sub strong { color: var(--ink); font-weight: 700; }

/* =============================================================
   5. Tool
   ============================================================= */
.tool { display: grid; gap: 16px; }
.tool-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.tool-title { display: flex; align-items: center; gap: .6rem; font-size: 1.08rem; font-weight: 800; margin-bottom: 14px; }
.step-n { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-size: .85rem; font-weight: 800; }

.tool-grid { display: flex; flex-direction: column; gap: 16px; }
/* móvil: el contenido primero, justo después el QR, luego el diseño */
.tool-grid-a .col-left { display: contents; }
.tool-grid-a .panel-content { order: 1; }
.tool-grid-a .preview-2d { order: 2; }
.tool-grid-a .panel-design { order: 3; }

.panel { display: grid; gap: 14px; align-content: start; min-width: 0; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-2 > * { min-width: 0; }

.lbl { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; font-size: .86rem; font-weight: 700; margin-bottom: 6px; padding: 0; width: 100%; }
.lbl small { font-weight: 500; color: var(--muted); }
.lbl output { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lbl-sub { font-weight: 600; color: var(--muted); }
.hint { font-size: .82rem; color: var(--muted); margin-top: 6px; }

.field { display: block; width: 100%; min-width: 0; height: 46px; padding: 0 12px; background: #fff; border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); font-size: 1rem; transition: border-color .15s, box-shadow .15s; }
.field::placeholder { color: #9aa1ae; }
.field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select.field { appearance: auto; }
#pane-wifi { display: grid; gap: 10px; }
#pane-wifi .lbl { margin-bottom: 4px; }

.seg { display: inline-grid; grid-auto-flow: column; gap: 4px; padding: 4px; background: var(--soft); border-radius: 12px; justify-self: start; }
.seg-btn { padding: 7px 14px; border-radius: 9px; font-size: .9rem; font-weight: 700; color: var(--muted); transition: background .15s, color .15s; }
.seg-btn.is-on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(20, 22, 28, .12); }

.choices { display: grid; gap: 8px; }
.choices-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.choices-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice { position: relative; display: grid; justify-items: center; gap: 4px; padding: 10px 4px 8px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); font-size: .76rem; font-weight: 700; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; min-width: 0; }
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; }
.choice-ico svg { width: 24px; height: 24px; fill: currentColor; }
.choice:hover { border-color: var(--line-strong); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
.choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice-lg { padding: 12px 6px 10px; }
.choice-lg .choice-ico svg { width: 40px; height: 40px; }
.choice-lg strong { display: block; font-size: .82rem; line-height: 1.2; }
.choice-lg small { display: block; font-weight: 500; font-size: .72rem; color: var(--muted); line-height: 1.25; margin-top: 2px; }

.color { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 10px 0 6px; border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; }
.color input[type="color"] { flex: none; width: 34px; height: 34px; padding: 0; border: 0; background: none; border-radius: 8px; cursor: pointer; }
.color input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color input[type="color"]::-webkit-color-swatch { border: 1px solid rgba(0, 0, 0, .15); border-radius: 8px; }
.color input[type="color"]::-moz-color-swatch { border: 1px solid rgba(0, 0, 0, .15); border-radius: 8px; }
.color output { font-size: .86rem; font-variant-numeric: tabular-nums; color: var(--muted); text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; }

.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chips-sm { margin-top: 8px; }
.chips-cap { font-size: .8rem; font-weight: 600; color: var(--muted); margin-right: 2px; }
.chip { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 40px; height: 40px; padding: 0 8px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; font-size: 1.15rem; line-height: 1; cursor: pointer; transition: border-color .15s, background .15s, transform .15s var(--ease-out); }
.chip:hover { border-color: var(--line-strong); }
.chip:active { transform: scale(.94); }
.chip.is-on { border-color: var(--accent); background: var(--accent-soft); }
.chips-sm .chip { min-width: 36px; height: 36px; font-size: 1rem; }
.chip-upload, .chip-clear { font-size: .84rem; font-weight: 700; padding: 0 12px; }
.chip-upload svg { width: 16px; height: 16px; }
.chip-upload:has(+ input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip-clear { color: var(--bad); border-color: #f3c7c2; }
.chip-duo { padding: 0; width: 44px; overflow: hidden; gap: 0; }
.chip-duo i { display: block; width: 50%; height: 100%; }
.chip-duo.is-on { box-shadow: 0 0 0 2px var(--accent-soft); }

.range { display: block; width: 100%; height: 28px; accent-color: var(--accent); cursor: pointer; }

/* previews */
.preview-2d, .preview-3d { display: grid; gap: 10px; align-content: start; min-width: 0; }
.qr-frame { display: grid; place-items: center; padding: 14px; background: var(--soft); border-radius: var(--radius-sm); }
.qr-host { display: grid; place-items: center; width: min(100%, 250px); aspect-ratio: 1; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 10px rgba(20, 22, 28, .08); }
.qr-host canvas, .qr-host svg { width: 100% !important; height: 100% !important; }
.qr-wait { font-size: .85rem; color: var(--muted); padding: 1rem; text-align: center; }

.viewer { position: relative; width: 100%; aspect-ratio: 1 / 1; border-radius: var(--radius-sm); overflow: hidden; background: radial-gradient(120% 90% at 50% 20%, #ffffff 0%, #eef0f5 55%, #dfe3ec 100%); border: 1px solid var(--line); touch-action: none; }
.viewer canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; cursor: grab; }
.viewer canvas:active { cursor: grabbing; }
.viewer-msg { position: absolute; inset: 0; display: grid; place-items: center; padding: 1.5rem; text-align: center; font-size: .9rem; font-weight: 600; color: var(--muted); }
.viewer-tip { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); padding: 4px 10px; border-radius: 99px; background: rgba(20, 22, 28, .62); color: #fff; font-size: .72rem; font-weight: 600; white-space: nowrap; pointer-events: none; }

.print-notes { list-style: none; padding: 0; display: grid; gap: 6px; }
.print-notes li { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 9px; font-size: .84rem; line-height: 1.4; background: var(--soft); color: var(--ink); }
.print-notes li::before { content: "•"; flex: none; font-weight: 800; }
.print-notes .is-ok { background: var(--ok-soft); color: var(--ok); }
.print-notes .is-ok::before { content: "✓"; }
.print-notes .is-warn { background: var(--warn-soft); color: var(--warn); }
.print-notes .is-warn::before { content: "!"; }
.print-notes .is-bad { background: var(--bad-soft); color: var(--bad); }
.print-notes .is-bad::before { content: "✕"; }

.notice { padding: 9px 12px; border-radius: 9px; font-size: .86rem; line-height: 1.4; }
.notice-warn { background: var(--warn-soft); color: var(--warn); }
.notice-bad { background: var(--bad-soft); color: var(--bad); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px; padding: 0 18px; border-radius: 12px; font-weight: 700; font-size: .95rem; text-decoration: none; transition: background .15s, border-color .15s, transform .15s var(--ease-out); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .65; cursor: progress; }
.btn-ghost { background: #fff; border: 1.5px solid var(--line-strong); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 18px rgba(79, 70, 229, .28); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-xl { width: 100%; min-height: 60px; font-size: 1.08rem; text-align: left; }
.btn-xl svg { flex: none; width: 24px; height: 24px; }
.btn-xl small { display: block; font-size: .78rem; font-weight: 500; opacity: .88; line-height: 1.2; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.link { color: var(--accent-dark); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; padding: 0; text-align: left; }
.alt-dl { font-size: .86rem; color: var(--muted); text-align: center; }

.privacy-badge { display: flex; gap: 8px; align-items: flex-start; justify-content: center; font-size: .84rem; color: var(--muted); padding: 2px 4px; }
.privacy-badge svg { flex: none; width: 18px; height: 18px; margin-top: 2px; color: var(--ok); }

/* =============================================================
   6. Ad slots (solo huecos marcados — sin anuncios reales)
   ============================================================= */
.ad-slot { display: grid; place-items: center; border: 2px dashed #b9bfcb; border-radius: 12px; background: repeating-linear-gradient(45deg, #fafbfc, #fafbfc 12px, #f1f3f6 12px, #f1f3f6 24px); color: #7b8291; font-weight: 800; font-size: .82rem; letter-spacing: .22em; }
.ad-leaderboard { min-height: 100px; margin-block: 20px 4px; }
.ad-incontent { min-height: 250px; margin-block: 28px; }

/* aviso tras descargar (sin publicidad) */
.dl-done { position: relative; padding: 16px 48px 16px 18px; background: var(--ok-soft); border: 1px solid #bfe6d4; border-radius: var(--radius); color: #0b5a3e; }
.dl-done-title { font-weight: 800; font-size: 1.02rem; }
.dl-done-file { font-size: .84rem; opacity: .85; overflow-wrap: anywhere; }
.dl-done ul { margin-top: 8px; padding-left: 1.2rem; display: grid; gap: 4px; font-size: .9rem; }
.dl-done-x { position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border-radius: 50%; font-size: 1.4rem; line-height: 1; display: grid; place-items: center; color: inherit; }
.dl-done-x:hover { background: rgba(15, 123, 85, .12); }

/* =============================================================
   7. Content sections
   ============================================================= */
.section { padding-block: 34px 6px; }
.section > h2 { font-size: clamp(1.3rem, 4.4vw, 1.8rem); font-weight: 800; margin-bottom: 18px; }
.section h3 { font-size: 1.02rem; font-weight: 800; }

.steps { list-style: none; padding: 0; display: grid; gap: 12px; }
.steps li { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 18px 64px; }
.steps-n { position: absolute; left: 18px; top: 18px; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-dark); font-weight: 800; }
.steps p { margin-top: 4px; color: var(--muted); font-size: .94rem; }

.ideas { list-style: none; padding: 0; display: grid; gap: 12px; }
.ideas li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.ideas-ico { display: block; font-size: 1.6rem; line-height: 1; margin-bottom: 10px; }
.ideas p { margin-top: 4px; color: var(--muted); font-size: .94rem; }

.prose { max-width: 800px; }
.prose p { margin-bottom: 12px; color: #2c313c; }
.prose h3 { margin: 22px 0 10px; font-size: 1.1rem; }
.prose ul { padding-left: 1.2rem; display: grid; gap: 8px; color: #2c313c; }

.guides h3 a { text-decoration: none; color: var(--accent-dark); }
.guides h3 a:hover { text-decoration: underline; }

.article { padding-block: 22px 10px; }
.article h1 { font-size: clamp(1.5rem, 5vw, 2.2rem); font-weight: 800; margin-bottom: 14px; }
.article h2 { font-size: 1.25rem; font-weight: 800; margin: 28px 0 10px; }
.article .lead { font-size: 1.06rem; color: var(--ink); }
.article ol { padding-left: 1.3rem; display: grid; gap: 8px; color: #2c313c; margin-bottom: 12px; }
.article ul { margin-bottom: 12px; }
.article a:not(.btn) { color: var(--accent-dark); text-underline-offset: 3px; }
.crumbs { font-size: .84rem; color: var(--muted); }
.cta-row { margin-top: 26px; }

.faq { display: grid; gap: 8px; max-width: 800px; }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.faq summary { position: relative; list-style: none; cursor: pointer; padding: 14px 44px 14px 16px; font-weight: 700; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 1.3rem; font-weight: 500; color: var(--muted); }
.faq details[open] summary::after { content: "–"; }
.faq details p { padding: 0 16px 16px; color: var(--muted); font-size: .95rem; }

.site-footer { margin-top: 44px; padding-block: 22px 28px; border-top: 1px solid var(--line); background: #fff; font-size: .86rem; color: var(--muted); }
.footer-row { display: grid; gap: 10px; }
.footer-row nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }

.legal { max-width: 760px; padding-block: 28px; }
.legal h1 { font-size: 1.7rem; margin-bottom: 14px; }
.legal h2 { font-size: 1.1rem; margin: 22px 0 8px; }
.legal p, .legal li { color: #2c313c; margin-bottom: 10px; }
.legal mark { background: var(--warn-soft); color: var(--warn); padding: 0 4px; border-radius: 4px; }

/* =============================================================
   8. Responsive (mobile-first)
   ============================================================= */
@media (min-width: 540px) {
  :root { --gutter: 22px; }
  .tool-card { padding: 22px; }
  .choice { font-size: .82rem; }
  .ideas { grid-template-columns: 1fr 1fr; }
  .viewer { aspect-ratio: 4 / 3; }
  .footer-row { grid-template-columns: 1fr auto; align-items: center; }
}
@media (min-width: 720px) {
  .header-nav { display: flex; }
  .header-row { height: 58px; }
  .hero { padding-block: 30px 20px; }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .steps li { padding: 62px 18px 18px; }
}
@media (min-width: 960px) {
  .tool-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; align-items: start; }
  .tool-grid-a .col-left { display: grid; gap: 18px; }
  .tool-grid-b { grid-template-columns: minmax(0, 1fr) 440px; }
  .col-right { position: sticky; top: 74px; }
  .qr-host { width: min(100%, 280px); }
  .ideas { grid-template-columns: repeat(3, 1fr); }
  .viewer { aspect-ratio: 1 / 1; }
}
@media (min-width: 1280px) {
  .tool-grid { grid-template-columns: minmax(0, 1fr) 420px; }
  .tool-grid-b { grid-template-columns: minmax(0, 1fr) 480px; }
}

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