:root {
  --bg: #faf7f2;
  --ink: #161514;
  --muted: #6d6862;
  --line: #e6e0d6;
  --card: #fff;
  --accent: #ff4d2e;
  --accent-ink: #fff;
  --stage: #efeae2;
  --radius: 18px;
  --ui: "Bricolage Grotesque", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--ui); font-size: 16px; line-height: 1.45; }
button, input, textarea { font: inherit; color: inherit; }
a { color: inherit; }

.top { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; max-width: 1200px; margin: 0 auto; }
.logo { font-weight: 800; font-size: 22px; text-decoration: none; letter-spacing: -.02em; }
.logo b { color: var(--accent); display: inline-block; margin-left: .1em; padding: 0 .14em; line-height: 1; border-bottom: .14em solid currentColor; } /* la X es el espacio en blanco por llenar */
.lang { font-size: 14px; color: var(--muted); text-decoration: none; border: 1px solid var(--line); padding: 6px 12px; border-radius: 99px; }
.lang:hover { color: var(--ink); border-color: var(--ink); }

.hero { max-width: 900px; margin: 0 auto; padding: 40px 20px 24px; text-align: center; }
.hero h1 { font-size: clamp(36px, 7vw, 76px); line-height: 1; letter-spacing: -.035em; font-weight: 800; margin: 0 0 28px; }
.rot { color: var(--accent); display: inline-block; transition: opacity .25s, transform .25s; }
.rot.out { opacity: 0; transform: translateY(-.25em); }
.phrase { display: flex; gap: 10px; background: #fff; border: 2px solid var(--ink); border-radius: 99px; padding: 6px; box-shadow: 0 6px 0 var(--ink); }
.phrase input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: clamp(18px, 2.6vw, 24px); padding: 10px 18px; font-weight: 600; }
.examples { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 22px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 7px 14px; cursor: pointer; font-size: 14px; }
.chip:hover { border-color: var(--ink); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.btn { border: 2px solid var(--ink); background: #fff; border-radius: 99px; padding: 10px 20px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.big { padding: 14px 28px; font-size: 18px; }
.btn:disabled { opacity: .5; cursor: wait; }

.results { max-width: 1200px; margin: 0 auto; padding: 10px 20px 40px; }
.filters { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.card { background: var(--card); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); display: flex; flex-direction: column; animation: pop .35s both; }
.card .stage { background: var(--stage); cursor: pointer; aspect-ratio: 400/440; }
.card .stage svg { display: block; width: 100%; height: 100%; }
.card .meta { padding: 10px 12px 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card .meta small { color: var(--muted); font-size: 13px; line-height: 1.2; }
.card .meta .btn { padding: 7px 14px; font-size: 14px; }
.batch-sep { grid-column: 1 / -1; text-align: center; color: var(--muted); font-size: 13px; padding-top: 8px; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.more { text-align: center; margin-top: 26px; }

.how { max-width: 900px; margin: 30px auto 0; padding: 0 20px 50px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.how div { text-align: center; }
.how b { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: #fff; }
.how p { margin: 8px 0 0; color: var(--muted); }
.foot { text-align: center; color: var(--muted); font-size: 14px; padding: 20px; border-top: 1px solid var(--line); }

/* Editor */
dialog { border: 0; padding: 0; border-radius: 22px; width: min(1040px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); background: var(--bg); color: var(--ink); }
dialog::backdrop { background: rgba(20, 18, 16, .55); }
.ed { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 0; position: relative; }
.ed-preview { background: var(--stage); position: sticky; top: 0; align-self: start; }
.ed-preview svg { display: block; width: 100%; height: auto; }
.ed-panel { padding: 22px 22px 26px; overflow: auto; max-height: calc(100dvh - 24px); }
.x { position: absolute; right: 10px; top: 8px; z-index: 2; width: 38px; height: 38px; border-radius: 50%; border: 0; background: #fff; font-size: 24px; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.lbl { display: block; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 0 7px; }
.ed-panel input:not([type=range]), .ed-panel textarea { width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff; outline: 0; }
.ed-panel input:focus, .ed-panel textarea:focus { border-color: var(--ink); }
.seg { display: flex; gap: 6px; }
.seg.wrap { flex-wrap: wrap; }
.seg button { border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 7px 11px; cursor: pointer; font-size: 14px; }
.seg button.on { border-color: var(--ink); background: var(--ink); color: #fff; }
.swatches { display: flex; flex-wrap: wrap; gap: 7px; }
.sw { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(0,0,0,.12); cursor: pointer; padding: 0; }
.sw.on { outline: 3px solid var(--ink); outline-offset: 2px; }
.fonts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.fonts button { border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 6px 4px; cursor: pointer; font-size: 16px; line-height: 1.2; white-space: nowrap; overflow: hidden; }
.fonts button.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.toggles { display: flex; gap: 8px; margin-top: 16px; }
.tog { width: 46px; height: 40px; border: 1.5px solid var(--line); background: #fff; border-radius: 10px; cursor: pointer; font-size: 17px; }
.tog.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.sliders { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin-top: 14px; }
.sliders label { font-size: 13px; color: var(--muted); font-weight: 600; display: flex; flex-direction: column; }
.sliders input { accent-color: var(--accent); width: 100%; }
.buy { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.price { font-size: 24px; font-weight: 800; }
.linkbtn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 10px 0 0; font-size: 14px; text-decoration: underline; }
#checkout h2, #done h2 { margin: 8px 0 4px; font-size: 28px; letter-spacing: -.02em; }
.sum { color: var(--muted); margin: 0; }
#checkout .btn { width: 100%; margin-top: 18px; }
.fine { font-size: 13px; color: var(--muted); text-align: center; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 99px; z-index: 99; font-size: 15px; }

@media (max-width: 760px) {
  .ed { grid-template-columns: 1fr; }
  .ed-preview { position: relative; }
  .ed-preview svg { max-height: 46dvh; margin: 0 auto; width: auto; max-width: 100%; }
  .ed-panel { max-height: none; overflow: visible; padding: 16px; }
  dialog { overflow: auto; }
  .how { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card .meta { flex-direction: column; align-items: stretch; }
  .phrase { flex-direction: column; border-radius: 22px; }
  .phrase input { text-align: center; }
  .fonts { grid-template-columns: repeat(3, 1fr); }
}
[hidden] { display: none !important; }
