/* QR Gratis: generador sencillo, con anuncios a los lados y entre bloques. */

:root {
  --bg: #f2f4f7;
  --card: #ffffff;
  --ink: #1d2433;
  --muted: #5d6676;
  --line: #dde2ea;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --ok: #1f8f5f;
  --error: #b3261e;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font); }
img, canvas { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2 { line-height: 1.2; margin: 0; }
p { margin: 0; }
:focus-visible { outline: 3px solid #2f6fd0; outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------- cabecera */

.top { background: var(--card); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1400px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.25rem; text-decoration: none; }
.logo { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--brand); color: #fff; font-size: 0.875rem; }
.top nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.top nav a { padding: 8px 12px; border-radius: 6px; text-decoration: none; font-weight: 600; font-size: 0.9375rem; color: var(--muted); }
.top nav a:hover { background: var(--bg); color: var(--ink); }

/* ------------------------------------------------- columnas y anuncios */

.layout {
  display: grid;
  grid-template-columns: 160px minmax(0, 1000px) 160px;
  justify-content: center;
  gap: 24px;
  padding: 20px 20px 40px;
}
.layout.no-ads { grid-template-columns: minmax(0, 1000px); }
.side { position: relative; }
.side .ad { position: sticky; top: 16px; }
main { min-width: 0; }

.ad { text-align: center; }
.ad-label { display: block; font-size: 0.6875rem; color: #9aa3b2; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.ad-demo {
  display: grid;
  place-items: center;
  margin: 0 auto;
  background: #e4e8ee;
  border: 1px dashed #b9c1cd;
  color: #8a93a3;
  font-size: 0.8125rem;
}
.ad-side .ad-demo { width: 160px; height: 600px; }
.ad-top { margin-bottom: 20px; }
.ad-top .ad-demo { width: 100%; max-width: 728px; height: 90px; }
.ad-wide { margin: 24px 0; }
.ad-wide .ad-demo { width: 100%; height: 120px; }
.ad-box { margin-top: 18px; }
.ad-box .ad-demo { width: 300px; max-width: 100%; height: 250px; }
.ad ins { min-height: 90px; }

/* -------------------------------------------------------------- portada */

.intro { text-align: center; padding: 16px 0 8px; }
.intro h1 { font-size: clamp(1.75rem, 1.2rem + 2vw, 2.5rem); }
.intro > p { margin: 8px 0 20px; color: var(--muted); font-size: 1.0625rem; }
.search {
  width: 100%;
  max-width: 560px;
  height: 52px;
  padding: 0 18px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font: inherit;
  font-size: 1.0625rem;
}
.search:focus { outline: none; border-color: var(--brand); }
.no-results { margin-top: 16px; color: var(--muted); }

.group { margin-top: 28px; scroll-margin-top: 12px; }
.group h2 { font-size: 1.375rem; margin-bottom: 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tool-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color 150ms, box-shadow 150ms, transform 150ms;
}
.tool-card:hover { border-color: var(--brand); box-shadow: 0 6px 18px rgb(29 36 51 / 0.1); transform: translateY(-2px); }
.tool-text b { display: block; font-size: 1rem; }
.tool-text span { display: block; margin-top: 2px; font-size: 0.875rem; color: var(--muted); line-height: 1.35; }
.tool-icon { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; color: #fff; }
.tool-icon .icon { width: 24px; height: 24px; }
.g-tamano { background: #e5322d; }
.g-editar { background: #2f6fd0; }
.g-crear { background: #1f8f5f; }
.g-convertir { background: #d9731f; }

.pairs { margin-top: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 16px; }
.pair-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pair-row:last-child { border-bottom: 0; }
.pair-source { width: 110px; font-weight: 700; font-size: 0.9375rem; }
.chip { text-decoration: none; padding: 3px; border-radius: 6px; }
.chip:hover { background: var(--bg); }
.fmt { display: inline-block; min-width: 46px; padding: 3px 6px; border-radius: 4px; background: var(--c); color: #fff; font-weight: 700; font-size: 0.75rem; text-align: center; }
.pair { display: inline-flex; align-items: center; gap: 4px; }
.pair .arrow { color: var(--muted); font-weight: 700; }
.pair.big { gap: 10px; font-size: 1.5rem; }
.pair.big .fmt { font-size: 1.25rem; padding: 8px 14px; min-width: 80px; border-radius: 8px; }

/* -------------------------------------------------- página de herramienta */

.tool-head { text-align: center; padding: 8px 0 20px; }
.tool-head .tool-icon { width: 60px; height: 60px; margin: 0 auto 12px; border-radius: 14px; }
.tool-head .tool-icon .icon { width: 32px; height: 32px; }
.tool-head .pair.big { margin-bottom: 14px; }
.tool-head h1 { font-size: clamp(1.75rem, 1.2rem + 2vw, 2.5rem); }
.tool-head p { margin-top: 8px; color: var(--muted); font-size: 1.0625rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }

.button, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font: 700 1rem var(--font);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 150ms, transform 150ms;
}
.button:hover, button:hover { background: var(--brand-dark); }
.button:active, button:active { transform: scale(0.97); }
.button.small, button.small { min-height: 36px; padding: 0 14px; font-size: 0.875rem; }
button.secondary { background: #e8ecf2; color: var(--ink); }
button.secondary:hover { background: #d9dfe8; }
button.big { width: 100%; min-height: 56px; font-size: 1.25rem; }
button:disabled { opacity: 0.55; cursor: progress; }

.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 280px;
  padding: 28px 16px;
  border: 3px dashed #c9d0db;
  border-radius: 12px;
  background: #fafbfc;
  text-align: center;
  cursor: pointer;
  transition: background-color 150ms, border-color 150ms;
}
.drop:hover { border-color: var(--brand); background: #fff6f5; }
.drop.over { border-color: var(--brand); background: #ffe9e7; }
.big-select { min-height: 64px; padding: 0 40px; font-size: 1.375rem; border-radius: 12px; box-shadow: 0 6px 16px rgb(229 50 45 / 0.3); }
.drop > span:nth-child(2) { font-size: 1.0625rem; color: var(--muted); }
.drop-hint { font-size: 0.875rem; color: #8a93a3; }

.work-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: 20px; }
.preview-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  padding: 12px;
  border-radius: 10px;
  background-color: #eef1f5;
  background-image: conic-gradient(#e2e6ec 25%, transparent 0 50%, #e2e6ec 0 75%, transparent 0);
  background-size: 20px 20px;
}
.preview-wrap canvas { max-height: 60vh; width: auto; touch-action: none; }
.info { margin-top: 8px; color: var(--muted); font-size: 0.9375rem; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.panel { display: flex; flex-direction: column; }
#options { display: grid; gap: 12px; margin-bottom: 16px; }
.field label, .field .label { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; font-size: 0.9375rem; margin-bottom: 4px; }
.field output { color: var(--muted); font-variant-numeric: tabular-nums; }
.field.check label { justify-content: flex-start; align-items: center; gap: 8px; cursor: pointer; }
.field input[type=text], .field input[type=number], .field select {
  width: 100%;
  height: 42px;
  padding: 0 10px;
  border: 1px solid #c9d0db;
  border-radius: 8px;
  background: #fff;
  font: inherit;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--brand); }
.field input[type=range] { width: 100%; accent-color: var(--brand); }
.field input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); }
.field input[type=color] { width: 60px; height: 38px; padding: 2px; border: 1px solid #c9d0db; border-radius: 6px; background: #fff; }
.btns { display: flex; flex-wrap: wrap; gap: 6px; }
.note { font-size: 0.875rem; color: var(--muted); }

.files { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.files li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: #f6f8fa; border: 1px solid var(--line); border-radius: 8px; }
.files .name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; font-size: 0.9375rem; }
.files .meta { display: block; font-weight: 400; font-size: 0.8125rem; color: var(--muted); }
.files .saved { color: var(--ok); font-weight: 700; }
.files img { width: 56px; height: 56px; object-fit: contain; background: #e8ecf2; border-radius: 6px; }
button.icon { min-width: 36px; padding: 0 10px; }
#results { margin-top: 24px; padding: 18px; border-radius: 12px; background: #eaf7ef; border: 1px solid #bfe5cd; }
#results h2 { font-size: 1.375rem; color: #146c45; margin-bottom: 4px; }
#results .files li { background: #fff; }
#results .button.small { background: var(--ok); }
#results .button.small:hover { background: #17734b; }
#zip { margin-top: 12px; background: var(--ok); }
.error { margin-top: 12px; padding: 12px 14px; border-radius: 8px; background: #fde8e6; color: var(--error); font-weight: 600; }
.spinner { display: inline-block; width: 16px; height: 16px; vertical-align: -3px; border: 3px solid #d9dfe8; border-top-color: var(--brand); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.privacy { margin-top: 12px; text-align: center; font-size: 0.875rem; color: var(--muted); }

.about { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 24px; }
.about h1 { font-size: 2rem; margin-bottom: 16px; }
.about h2 { font-size: 1.25rem; margin-bottom: 10px; }
.about p { margin-bottom: 10px; color: #333b4a; }
.legal h2 { margin-top: 20px; }
.howto { margin: 12px 0 0; padding-left: 22px; }
.howto li { margin-bottom: 4px; }

/* ------------------------------------------------------------- pie */

.foot { border-top: 1px solid var(--line); background: var(--card); padding: 24px 20px; text-align: center; font-size: 0.875rem; color: var(--muted); }
.foot p + p { margin-top: 6px; }

/* ---------------------------------------------------------- pantallas */

@media (max-width: 1240px) {
  .layout { grid-template-columns: minmax(0, 1000px); }
  .side { display: none; }
}
@media (max-width: 800px) {
  .top nav { display: none; }
  .layout { padding: 12px 12px 32px; }
  .work-grid { grid-template-columns: 1fr; }
  .ad-top .ad-demo { height: 60px; }
  .card, .about { padding: 14px; }
  .drop { min-height: 220px; }
  .big-select { font-size: 1.125rem; padding: 0 24px; }
  .pair-source { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .tool-card, .button, button { transition: none; }
  .tool-card:hover { transform: none; }
}

/* ------------------------------------------------------------ donar */

.donate-top { flex: none; padding: 8px 14px; border-radius: 999px; background: #ffc439; color: #111; font-weight: 700; font-size: 0.9375rem; text-decoration: none; }
.donate-top:hover { background: #f2b52a; }
.donate { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: #fff8e1; font-size: 0.9375rem; text-align: center; }
.donate a { font-weight: 700; }

/* ------------------------------------------------------- generador QR */

.types { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 16px; }
.types a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-weight: 600; font-size: 0.9375rem; text-decoration: none; }
.types a:hover { border-color: var(--brand); }
.types a[aria-current] { background: var(--brand); border-color: var(--brand); color: #fff; }
.types .icon { width: 18px; height: 18px; }

.qr-tool { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, 1fr); gap: 28px; }
.qr-tool h2 { font-size: 1.125rem; margin: 4px 0 12px; }
.qr-form h2 + .field, .qr-form .field { margin-bottom: 12px; }
.qr-form h2:not(:first-child) { margin-top: 20px; }
.field textarea { width: 100%; padding: 10px; border: 1px solid #c9d0db; border-radius: 8px; font: inherit; resize: vertical; }
.field textarea:focus { outline: none; border-color: var(--brand); }
.field input[type=url], .field input[type=email], .field input[type=tel] { width: 100%; height: 42px; padding: 0 10px; border: 1px solid #c9d0db; border-radius: 8px; background: #fff; font: inherit; }
.field input[type=url]:focus, .field input[type=email]:focus, .field input[type=tel]:focus { outline: none; border-color: var(--brand); }
.field input[type=file] { width: 100%; font-size: 0.875rem; }
.field small { display: block; margin-top: 2px; color: var(--muted); font-size: 0.8125rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.more summary { cursor: pointer; font-weight: 600; color: var(--brand); margin-bottom: 10px; }
#o-logo-clear { margin-top: 6px; }

.qr-out { text-align: center; }
.qr-frame { padding: 14px; border-radius: 12px; background: #f6f8fa; border: 1px solid var(--line); }
#qr-canvas { width: 100%; max-width: 320px; height: auto; margin: 0 auto; image-rendering: pixelated; }
#qr-canvas.sample { opacity: 0.18; }
.qr-msg { min-height: 1.5em; margin: 8px 0; font-size: 0.875rem; color: var(--muted); }
.qr-msg.bad { color: #b45309; font-weight: 600; }
.qr-out .field { text-align: left; }
.dl { display: grid; gap: 8px; }

.faq details { border-top: 1px solid var(--line); padding: 10px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 8px 0 0; }

@media (max-width: 800px) {
  .qr-tool { grid-template-columns: 1fr; }
  #qr-canvas { max-width: 240px; }
  .donate-top { padding: 6px 12px; margin-left: auto; }
}