/* Textur.as ----------------------------------------------------------------- */

:root {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --ink: #151515;
  --ink-2: #3a3935;
  --muted: #7a776f;
  --line: #e2e0d9;
  --line-2: #d3d0c7;
  --hover: #ecebe6;
  --accent: #ff5a1f;          /* color de la máscara */
  --on-solid: #ffffff;
  --danger: #b3261e;
  --shadow: 0 1px 2px rgba(20, 20, 18, .06), 0 8px 28px rgba(20, 20, 18, .08);
  --r: 14px;
  --r-sm: 9px;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Instrument Serif", ui-serif, Georgia, serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111110;
    --surface: #1b1b19;
    --ink: #f1efe9;
    --ink-2: #cfccc4;
    --muted: #8d8a82;
    --line: #2b2a27;
    --line-2: #3a3935;
    --hover: #242421;
    --on-solid: #111110;
    --danger: #ff8a80;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 32px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
body.booting .stage > * { visibility: hidden; }
.stage { transition: opacity .28s ease; }
body.booting .stage { opacity: 0; transition: none; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ── botones ───────────────────────────────────────────────────────────── */

.btn {
  height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: none;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .15s, border-color .15s, opacity .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .35; cursor: default; }
.btn:focus-visible, .rbtn:focus-visible, .chips button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.solid { background: var(--ink); color: var(--on-solid); }
.btn.solid:hover:not(:disabled) { opacity: .88; }
.btn.ghost { border-color: var(--line-2); }
.btn.ghost:hover:not(:disabled) { background: var(--hover); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.icon { width: 32px; padding: 0; font-size: 16px; }

.btn.google {
  height: 38px;
  padding: 0 16px 0 13px;
  gap: 8px;
  background: var(--surface);
  border-color: var(--line-2);
  font-size: 13.5px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.btn.google:hover { background: var(--hover); }
.btn.google svg { width: 16px; height: 16px; }
.btn.google[hidden], .gsi[hidden] { display: none; }
/* El botón de Google (el que abre su ventana sin pasar por Supabase) va ENCIMA del
   nuestro, en su mismo hueco y transparente: se ve el nuestro y el clic es de Google.
   Así no cambia de color ni de tamaño ni pisa la frase. */
.gsi {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  overflow: hidden; border-radius: 999px; color-scheme: light;
  opacity: 0.001; pointer-events: none;            /* invisible: se ve SIEMPRE nuestro botón */
}
.gsi.listo { pointer-events: auto; cursor: pointer; }
.login-btn:has(.gsi.listo:hover) .btn.google { background: var(--hover); }

/* ── escenario ─────────────────────────────────────────────────────────── */

.stage { flex: 1; position: relative; overflow: hidden; min-height: 0; }

.panel {
  position: absolute; inset: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px 60px;
}
.wordmark {
  margin: 0 0 26px;
  font: 400 30px/1 var(--serif);
  letter-spacing: -.01em;
}
.wordmark i { color: var(--accent); font-style: normal; }
.eyebrow {
  margin: 0 0 18px;
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.panel h1 {
  margin: 0;
  font: 400 clamp(38px, 6vw, 64px)/1.02 var(--serif);
  letter-spacing: -.02em;
}
.panel h1 em { font-style: italic; color: var(--muted); }
.panel.minimal .wordmark { margin-bottom: 44px; font-size: 34px; }
.tagline { margin: 22px 0 0; font: italic 400 19px/1.3 var(--serif); color: var(--muted); letter-spacing: -.005em; }
.lead { margin: 18px 0 34px; max-width: 460px; color: var(--ink-2); font-size: 15px; }
.fine { min-height: 20px; max-width: 420px; margin: 16px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }

.drop {
  width: min(560px, 100%);
  padding: 44px 24px;
  border: 1px dashed var(--line-2);
  border-radius: 20px;
  background: var(--surface);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.drop:hover, .drop:focus-within { border-color: var(--ink); }
.drop-mark {
  width: 44px; height: 44px; margin-bottom: 10px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink); color: var(--on-solid);
}
.drop-mark svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.drop-title { font-weight: 500; font-size: 16px; }
.drop-sub { color: var(--muted); font-size: 13px; }

/* sin imagen: el editor ya se ve; la caja, en el hueco sobre el prompt */
#intro { padding-bottom: 170px; }
.card.sin-imagen .side .adds button:not(#addImage), .card.sin-imagen #apply, .card.sin-imagen #helpBtn { opacity: .35; pointer-events: none; }
.card.sin-imagen textarea { cursor: default; }

.add-img {
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  padding: 24px 32px;
  border-radius: 24px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.add-box { width: 92px; height: 92px; overflow: visible; transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
.add-box path { stroke: var(--ink); stroke-width: 1.3; stroke-linejoin: round; fill: var(--surface); }
.add-box .inside { fill: var(--hover); }
.add-img:hover .add-box, .add-img:focus-within .add-box { transform: translateY(-3px); }
.add-label { font: italic 400 16px/1.2 var(--serif); color: var(--ink-2); transition: color .18s; }
.add-img:hover .add-label, .add-img:focus-within .add-label { color: var(--ink); }
.add-img:focus-within { outline: none; }

/* acceso: la frase con el botón dentro */
/* firma «texturas»: un solo trazo, suave y redondeado, sin animación.
   Blanco hueso roto sobre fondo oscuro; con fondo claro, tinta cálida (el hueso no se vería). */
.firma { width: min(300px, 72vw); height: auto; margin: 0 0 30px; overflow: visible; color: #2b2926; }
@media (prefers-color-scheme: dark) { .firma { color: #ece6da; } }

.login-copy {
  max-width: 560px;
  margin: 0;
  font: 400 clamp(24px, 3.4vw, 32px)/1.55 var(--serif);
  letter-spacing: -.01em;
  color: var(--ink);
  text-wrap: balance;
}
/* beta privada: misma voz que el acceso; el formulario, sobrio */
.beta { display: flex; flex-direction: column; align-items: center; max-width: 520px; }
.beta[hidden] { display: none; }
.beta-tit em { font-style: italic; color: var(--muted); }
.beta-txt { margin: 14px 0 0; max-width: 440px; color: var(--ink-2); font-size: 14.5px; line-height: 1.55; text-wrap: pretty; }
.beta-txt b { font-weight: 500; color: var(--ink); }
.beta-form { width: min(440px, 100%); margin: 22px 0 0; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.beta-form[hidden] { display: none; }
.beta-form textarea {
  width: 100%; resize: none; padding: 12px 14px;
  border: 1px solid var(--line-2); border-radius: 14px; background: var(--surface); color: var(--ink);
  font: 400 14px/1.45 var(--sans);
}
.beta-form textarea:focus { outline: none; border-color: var(--ink); }
.linkbtn.beta-salir { margin-top: 18px; color: var(--muted); font-weight: 400; font-size: 13px; }
#login.en-beta .login-copy:not(.beta-tit), #login.en-beta .como-btn, #login.en-beta .demo { display: none; }
.login-btn { position: relative; display: inline-flex; vertical-align: middle; margin: 0 4px; transform: translateY(-2px); }
.login-btn .btn.google { font-family: var(--sans); }
@media (max-width: 600px) { .br-ancho { display: none; } }
.version { margin: 22px 0 0; font: 400 11.5px/1.4 var(--sans); letter-spacing: .03em; color: var(--muted); }
.version .copy { white-space: nowrap; opacity: .8; }
.version .copy i { font-style: normal; }
@media (max-width: 600px) { .version .copy { display: block; margin-top: 2px; } .version .copy i { display: none; } }

.how {
  display: flex; gap: 28px;
  list-style: none; padding: 0; margin: 30px 0 0;
  color: var(--muted); font-size: 13px;
}
.how li { display: flex; align-items: center; gap: 8px; }
.how b {
  width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--line-2); font-size: 11px; font-weight: 500;
}

/* ── lienzo ────────────────────────────────────────────────────────────── */

.viewport { position: absolute; inset: 0; overflow: hidden; touch-action: none; }
.viewport.paint { cursor: none; }
.viewport.pan, .viewport.paint.pan { cursor: grab; }
.viewport.panning { cursor: grabbing !important; }

.board {
  position: absolute; left: 0; top: 0;
  transform-origin: 0 0;
  box-shadow: 0 0 0 1px var(--line), 0 12px 40px rgba(0, 0, 0, .08);
  background: #fff;
}
.board canvas { position: absolute; inset: 0; display: block; }
.over { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 4; }
.viewport.on-man { cursor: move !important; }
/* articulación del maniquí: icono de rotar · tirador de altura: arriba/abajo */
.viewport.on-handle { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg stroke='%23fff' stroke-width='4.5'%3E%3Cpath d='M19 12a7 7 0 1 1-2.05-4.95'/%3E%3Cpath d='M19 4.5v3.5h-3.5'/%3E%3C/g%3E%3Cg stroke='%23111' stroke-width='2'%3E%3Cpath d='M19 12a7 7 0 1 1-2.05-4.95'/%3E%3Cpath d='M19 4.5v3.5h-3.5'/%3E%3C/g%3E%3C/svg%3E") 12 12, grab !important; }
.viewport.on-scale { cursor: ns-resize !important; }
.viewport.on-cintura { cursor: move !important; }
#mask { opacity: .5; transition: opacity .2s; }
.board.busy #mask { animation: breathe 1.8s ease-in-out infinite; }
.board.done #mask, .board.compare #mask { opacity: 0; }
@keyframes breathe { 0%, 100% { opacity: .5; } 50% { opacity: .22; } }

.cursor {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  border: 1.5px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(0, 0, 0, .25);
  transform: translate(-50%, -50%);
  z-index: 5;
}
.cursor.erase { border-style: dashed; }

.hint {
  position: absolute;
  top: 18px; left: 50%;
  transform: translateX(-50%);
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--on-solid);
  font-size: 13px; font-weight: 500;
  pointer-events: none;
  z-index: 6;
  box-shadow: var(--shadow);
  white-space: nowrap;
}

/* ── carril de herramientas (a la izquierda de la imagen) ────────────── */

.rail {
  position: absolute;
  left: 0; top: 0;
  z-index: 9;
  width: 52px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  transition: opacity .15s;
}
.rail.placing { transition: none; }
.rgroup { display: flex; flex-direction: column; gap: 2px; width: 100%; }
.rgroup + .rgroup, .rsize + .rgroup, .rgroup + .rsize {
  padding-top: 6px;
  border-top: 1px solid var(--line);
}
.rbtn {
  position: relative;
  width: 100%; height: 38px;
  display: grid; place-items: center;
  border: 0; border-radius: 10px;
  background: none;
  color: var(--ink-2);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .12s, color .12s;
}
.rbtn svg {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
.rbtn:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.rbtn.on { background: var(--ink); color: var(--on-solid); }
.rbtn.solid { background: var(--ink); color: var(--on-solid); }
.rbtn.solid:hover { background: var(--ink); opacity: .88; }
.rbtn:disabled { opacity: .3; cursor: default; }

/* tamaño del pincel: deslizador vertical, arriba = más grande */
.rsize {
  position: relative;
  width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding-bottom: 4px;
}
.rsize input[type=range] {
  writing-mode: vertical-lr;
  direction: rtl;
  width: 22px; height: 96px;
  margin: 0;
  accent-color: var(--ink);
  cursor: pointer;
}
.rsize .dot { width: 16px; height: 16px; display: grid; place-items: center; }
.rsize .dot::after {
  content: ""; display: block;
  width: var(--d, 8px); height: var(--d, 8px);
  border-radius: 50%; background: var(--accent);
}

/* etiquetas al pasar el ratón, a la derecha del carril */
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 12px); top: 50%;
  transform: translate(-4px, -50%);
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--ink); color: var(--on-solid);
  font: 500 12px/1.2 var(--sans);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s, transform .12s;
  z-index: 20;
}
@media (hover: hover) {
  [data-tip]:hover::after { opacity: 1; transform: translate(0, -50%); transition-delay: .35s; }
}

/* ── dock: el prompt ───────────────────────────────────────────────────── */

.dock {
  position: absolute;
  left: 50%; bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(820px, calc(100% - 32px));
  z-index: 10;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.card { padding: 12px; }
.ask { display: flex; align-items: stretch; gap: 10px; }
.side {
  flex: none;
  display: flex; flex-direction: column; align-items: stretch; justify-content: space-between;
  gap: 8px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}
.adds { display: flex; gap: 2px; justify-content: space-between; }
.side #apply { width: 100%; justify-content: center; }

/* el prompt y su «?» */
.field { position: relative; flex: 1; display: flex; min-width: 0; }
.field textarea { padding-right: 36px; }
.qbtn {
  position: absolute; right: 4px; bottom: 6px;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border: 1px solid var(--line-2); border-radius: 50%;
  background: var(--surface); color: var(--muted);
  font: 600 12.5px/1 var(--sans);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .12s, color .12s, border-color .12s;
}
.qbtn:hover { color: var(--ink); border-color: var(--ink-2); }
.qbtn.on { background: var(--ink); border-color: var(--ink); color: var(--on-solid); }
.qbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.qbtn[data-tip-up]::after { left: auto; right: -6px; transform: translate(0, 4px); }
@media (hover: hover) { .qbtn[data-tip-up]:hover::after { transform: translate(0, 0); } }

/* ayuda desplegable */
.help {
  padding: 2px 4px 10px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.help-text { margin: 0 0 2px; color: var(--ink-2); font-size: 13.5px; line-height: 1.45; }

/* botón-icono pequeño (caja del prompt) */
.ibtn {
  position: relative;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 0; border-radius: 10px;
  background: none;
  color: var(--ink-2);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .12s, color .12s;
}
.ibtn svg {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
.ibtn:hover { background: var(--hover); color: var(--ink); }
.ibtn.on { background: var(--ink); color: var(--on-solid); }
.ibtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* etiquetas hacia arriba (la caja está abajo del todo) */
[data-tip-up]::after {
  content: attr(data-tip-up);
  position: absolute;
  left: 50%; bottom: calc(100% + 10px);
  transform: translate(-50%, 4px);
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--ink); color: var(--on-solid);
  font: 500 12px/1.2 var(--sans);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s, transform .12s;
  z-index: 20;
}
@media (hover: hover) {
  [data-tip-up]:hover::after { opacity: 1; transform: translate(-50%, 0); transition-delay: .35s; }
}
.adds .ibtn:last-child::after, .ctx .ibtn:last-child::after { left: auto; right: 0; transform: translate(0, 4px); }
@media (hover: hover) {
  .adds .ibtn:last-child:hover::after, .ctx .ibtn:last-child:hover::after { transform: translate(0, 0); }
}

/* fila de contexto: persona u objeto */
.ctx {
  display: flex; align-items: center; gap: 10px;
  padding: 0 2px 10px 4px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
  min-height: 44px;
}
.ctx-ico { display: grid; place-items: center; color: var(--accent); }
.ctx-ico svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ctx-title { font-weight: 500; white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.ctx-sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ctx .grow { flex: 1; }
.ctx-sub.working { display: inline-flex; align-items: center; gap: 7px; }
.ctx-sub.working::before {
  content: ""; width: 12px; height: 12px; flex: none;
  border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%;
  animation: tx-spin .8s linear infinite;
}
@keyframes tx-spin { to { transform: rotate(360deg); } }
/* thumbnail de un objeto sin fondo: damero */
.ctx-thumb {
  background-color: #fff;
  background-image: linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%),
    linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%);
  background-size: 10px 10px; background-position: 0 0, 5px 5px;
}
.ctx-thumb {
  width: 36px; height: 36px; flex: none;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 0 0 1px var(--line);
}
.seg { display: flex; padding: 3px; background: var(--hover); border-radius: 999px; }
.seg button {
  height: 28px; padding: 0 12px;
  border: 0; border-radius: 999px;
  background: none; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--muted);
  white-space: nowrap;
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.ask textarea {
  flex: 1;
  resize: none;
  border: 0;
  outline: none;
  background: none;
  padding: 9px 8px;
  font-size: 16px;
  line-height: 1.45;
  min-height: 56px;
  max-height: 180px;
}
.ask textarea::placeholder { color: var(--muted); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 6px 4px 2px; }
.chips button {
  height: 28px; padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: none;
  font-size: 12.5px; color: var(--ink-2);
  cursor: pointer;
}
.chips button:hover { border-color: var(--line-2); background: var(--hover); }

.row { display: flex; align-items: center; gap: 8px; padding: 2px 4px; }
.row.wrap { flex-wrap: wrap; }
.row .grow { flex: 1; }
.label { font-weight: 500; }
.muted { color: var(--muted); font-variant-numeric: tabular-nums; margin-left: auto; }
.bar { height: 2px; margin: 12px 4px 6px; background: var(--line); border-radius: 2px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--ink); transition: width .6s linear; }
#hold { user-select: none; -webkit-user-select: none; touch-action: none; }
#hold.on { background: var(--ink); color: var(--on-solid); }

.said {
  margin: 0 6px 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.error { margin: 8px 6px 2px; color: var(--danger); font-size: 13px; }

/* ── varios ────────────────────────────────────────────────────────────── */

.veil {
  position: absolute; inset: 12px;
  border: 1.5px dashed var(--ink);
  border-radius: 20px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  display: grid; place-items: center;
  font: 400 32px var(--serif);
  z-index: 30;
  pointer-events: none;
}
.toast {
  position: fixed;
  top: 18px; left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink); color: var(--on-solid);
  font-size: 13px;
  box-shadow: var(--shadow);
  z-index: 50;
}
.toast.bad { background: var(--danger); color: #fff; }

/* ── móvil ─────────────────────────────────────────────────────────────── */

/* ── créditos ──────────────────────────────────────────────────────────── */

.coin { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.coin path { fill: currentColor; stroke: none; }

.credits {
  position: absolute; left: 0; top: 0;
  z-index: 12;
  height: 34px;
  padding: 0 13px 0 10px;
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: 500 14px/1 var(--sans);
  font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .12s, border-color .12s;
}
.credits { padding-right: 3px; gap: 8px; }
.cr-count { display: inline-flex; align-items: center; gap: 7px; }
.cr-count[hidden] { display: none; }
.credits .coin { width: 18px; height: 18px; color: var(--accent); }
.credits.demo #creditsN { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.avatar {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: var(--hover);
  color: var(--ink-2);
  font: 500 12px/1 var(--sans);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.credits.zero .avatar { background: rgba(255,255,255,.14); color: var(--on-solid); }
.wallet-n[hidden], .wallet-rule[hidden] { display: none; }
.pack:disabled { cursor: default; }
.linkbtn.demo { margin-top: 26px; color: var(--muted); font-weight: 400; font-size: 13px; }
.linkbtn[hidden] { display: none; }
.credits:hover { background: var(--hover); }
.credits:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.credits[aria-expanded="true"] { border-color: var(--line-2); }
.credits.low span { color: var(--accent); }
.credits.zero { background: var(--ink); color: var(--on-solid); border-color: var(--ink); }
.credits.zero .coin { color: var(--on-solid); }

/* selección automática */
.auto {
  position: absolute; left: 0; top: 0;
  z-index: 13;
  width: min(300px, calc(100% - 16px));
  padding: 14px 14px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  animation: wallet-in .16s ease-out;
}
.auto-title { margin: 0; font-weight: 500; font-size: 14px; }
.auto-sub { margin: 3px 0 10px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.auto-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.auto-chips button {
  height: 28px; padding: 0 11px;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: var(--surface); color: var(--ink-2);
  font: 400 12.5px var(--sans);
  cursor: pointer;
}
.auto-chips button:hover:not(:disabled) { border-color: var(--ink); color: var(--ink); }
.auto-chips button.on { background: var(--ink); color: var(--on-solid); border-color: var(--ink); }
.auto-chips button:disabled { opacity: .5; cursor: default; }
.auto-form { display: flex; gap: 6px; margin-top: 10px; }
.auto-form input {
  flex: 1; min-width: 0; height: 32px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: var(--bg); color: var(--ink);
  font: 400 13px var(--sans);
}
.auto-form input:focus { outline: none; border-color: var(--ink); }
.auto-state { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.4; }
.auto-state.bad { color: var(--danger); }
.auto-state .spin {
  flex: none; width: 14px; height: 14px;
  border: 2px solid var(--line-2); border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.board.scan #mask { opacity: .5; }

.wallet {
  position: absolute; left: 0; top: 0;
  z-index: 13;
  width: min(340px, calc(100% - 16px));
  overflow-y: auto;
  padding: 16px 16px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  animation: wallet-in .16s ease-out;
}
@keyframes wallet-in { from { opacity: 0; margin-top: -4px; } }
.wallet-head { display: flex; align-items: center; justify-content: space-between; margin: -4px -6px 0 0; }
.wallet-title { margin: 0; font-size: 13px; color: var(--muted); }
.wallet-n {
  margin: 4px 0 2px;
  display: flex; align-items: center; gap: 10px;
  font: 400 44px/1.05 var(--serif);
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.wallet-n .coin { width: 28px; height: 28px; color: var(--accent); stroke-width: 1.4; }
.wallet-msg {
  margin: 8px 0 4px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--hover);
  font-size: 13px; line-height: 1.4;
}
.wallet-rule { margin: 6px 0 14px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.packs { display: flex; flex-direction: column; gap: 8px; }
.pack {
  display: flex; align-items: center; gap: 6px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: 400 14px/1.2 var(--sans);
  text-align: left;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.pack:hover:not(:disabled) { border-color: var(--ink); }
.pack:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pack:disabled { opacity: .6; cursor: progress; }
.pack.wait { cursor: progress; }
.pack .grow { flex: 1; }
.pack-n { font: 400 22px/1 var(--serif); font-variant-numeric: tabular-nums; }
.pack-u { color: var(--muted); font-size: 13px; }
.pack-tag {
  margin-left: 4px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--accent); color: #fff;
  font-size: 10.5px; font-weight: 500; letter-spacing: .02em;
}
.pack-right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.pack-each { color: var(--muted); font-size: 11px; white-space: nowrap; }
.pack-price { font-weight: 500; font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.packs-off { margin: 0; padding: 12px; border: 1px dashed var(--line-2); border-radius: 12px; color: var(--muted); font-size: 13px; text-align: center; }
.wallet-note { margin: 10px 0 0; color: var(--muted); font-size: 11.5px; text-align: center; }
.wallet-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 12px; padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 12px; color: var(--muted);
}
.wallet-user { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linkbtn {
  flex: none;
  padding: 4px 0;
  border: 0; background: none;
  color: var(--ink-2);
  font: 500 12px var(--sans);
  cursor: pointer;
}
.linkbtn:hover { color: var(--ink); text-decoration: underline; }

/* coste dentro de «Aplicar» y «Otra variante» */
.btn .cost {
  display: inline-flex; align-items: center; gap: 3px;
  margin-left: 8px; padding-left: 8px;
  border-left: 1px solid currentColor;
  border-left-color: color-mix(in srgb, currentColor 28%, transparent);
  font-size: 12px; font-weight: 500;
  font-variant-numeric: tabular-nums;
  opacity: .8;
}
.btn .cost .coin { width: 13px; height: 13px; }
.btn .cost[hidden] { display: none; }

@media (max-width: 600px) {
  .dock { width: calc(100% - 16px); bottom: max(8px, env(safe-area-inset-bottom)); }
  .card { border-radius: 16px; padding: 10px; }
  .ask textarea { min-height: 48px; }
  .ask { gap: 6px; }
  .side { padding-left: 6px; }
  .adds .ibtn { width: 30px; height: 30px; }
  .ctx { gap: 6px; }
  #ctxPerson .ctx-title { display: none; }
  .ctx-title { max-width: 110px; }
  .ctx-sub { display: none; }
  .seg button { padding: 0 9px; }
  .rail { width: 46px; padding: 4px; gap: 4px; border-radius: 14px; }
  .rbtn { height: 34px; }
  .rsize input[type=range] { height: 72px; }
  .how { flex-direction: column; gap: 10px; align-items: center; }
  .row.wrap .grow { display: none; }
  .row.wrap .btn { flex: 1; }
  #hold { flex-basis: 100%; }
}

/* ── tutorial de inicio ────────────────────────────────────────────────── */

.tour { position: fixed; inset: 0; z-index: 60; }
.tour-hole {
  position: fixed;
  border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(17, 17, 16, .46), 0 0 0 2px rgba(255, 255, 255, .9);
  pointer-events: none;
  transition: left .28s cubic-bezier(.2, .8, .2, 1), top .28s cubic-bezier(.2, .8, .2, 1),
    width .28s cubic-bezier(.2, .8, .2, 1), height .28s cubic-bezier(.2, .8, .2, 1);
}
.tour-tip {
  position: fixed;
  width: min(290px, calc(100vw - 24px));
  padding: 16px 16px 12px;
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .08), 0 18px 48px rgba(0, 0, 0, .22);
  transition: left .28s cubic-bezier(.2, .8, .2, 1), top .28s cubic-bezier(.2, .8, .2, 1);
  animation: tour-in .22s ease-out;
}
@keyframes tour-in { from { opacity: 0; transform: translateY(4px); } }
.tour-arrow {
  position: absolute;
  width: 12px; height: 12px;
  background: var(--surface);
  transform: rotate(45deg);
  border-radius: 2px;
}
.tour-title { margin: 0 0 4px; font-weight: 600; font-size: 14.5px; letter-spacing: -.005em; }
.tour-text { margin: 0; color: var(--ink-2); font-size: 13.5px; line-height: 1.5; }
.tour-foot { display: flex; align-items: center; gap: 6px; margin-top: 14px; }
.tour-dots { display: flex; gap: 5px; flex: 1; }
.tour-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); transition: background .2s, width .2s; }
.tour-dots i.on { width: 16px; border-radius: 3px; background: var(--ink); }
.tour-foot .btn.ghost { border-color: transparent; color: var(--muted); }
.tour-foot .btn.ghost:hover { color: var(--ink); }

/* ── colocar un modelo 3D (.glb) ───────────────────────────────────────── */
.g3d {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column;
  background: var(--bg);
  animation: g3d-in .22s ease;
}
@keyframes g3d-in { from { opacity: 0; } }
.g3d-zona { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 20px 20px 8px; }
.g3d-lienzo { position: relative; box-shadow: var(--shadow); border-radius: 6px; overflow: hidden; touch-action: none; }
.g3d-foto, .g3d-gl, .g3d-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.g3d-gl { cursor: grab; touch-action: none; }
.g3d-gl.g3d-sobre { cursor: move; }
.g3d-gl.g3d-agarra { cursor: grabbing; }
.g3d-svg { pointer-events: none; overflow: visible; }
.g3d-hz { stroke: #fff; stroke-width: 1; stroke-dasharray: 6 5; opacity: .75; filter: drop-shadow(0 0 1.5px rgba(0, 0, 0, .7)); }
.g3d-hzt { fill: #fff; font: 500 10.5px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; opacity: .85; filter: drop-shadow(0 0 2px rgba(0, 0, 0, .8)); }
.g3d-barra {
  flex: none; padding: 10px 20px calc(14px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.g3d-ayuda { margin: 0; color: var(--muted); font-size: 13px; text-align: center; }
.g3d-ayuda b { color: var(--ink-2); font-weight: 500; }
.g3d-ctl {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 8px 10px; box-shadow: var(--shadow); max-width: 100%;
}
.g3d-fila { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 14px; }
.g3d-estado {
  display: inline-block; margin-right: 8px; padding: 2px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font-weight: 500;
}
.g3d-estado.clic { cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.g3d-estado[hidden] { display: none; }
.g3d-link { border: 0; background: none; padding: 0; font: inherit; color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.g3d-link:hover { color: var(--ink); }
.g3d-fila[hidden] { display: none; }
.g3d-grande input { width: 170px; }
.g3d-pct { min-width: 44px; font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 12.5px; }
.g3d-rng { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.g3d-rng input { width: 120px; accent-color: var(--ink); }
.g3d-rej.on { background: var(--hover); border-color: var(--ink-2); }
.g3d-sp { width: 1px; height: 22px; background: var(--line); margin: 0 2px; }
.ctx-thumb { cursor: default; }
.ctx.es3d .ctx-thumb, .ctx.es3d .ctx-title, .ctx.es3d .ctx-sub { cursor: pointer; }
.ctx.es3d .ctx-sub { color: var(--accent); }
.ctx.es3d .ctx-sub:hover { text-decoration: underline; text-underline-offset: 2px; }
@media (max-width: 600px) {
  .g3d-zona { padding: 10px 10px 4px; }
  .g3d-barra { padding: 6px 10px calc(10px + env(safe-area-inset-bottom)); }
  .g3d-rng input { width: 96px; }
  .g3d-sp { display: none; }
  .g3d-ctl .btn { height: 34px; padding: 0 12px; }
}

/* ── «¿Cómo funciona?» ─────────────────────────────────────────────────── */
.como-btn {
  display: inline-flex; align-items: center; gap: 10px;
  margin: 20px 0 0; padding: 6px 4px;
  border: 0; background: none; cursor: pointer;
  color: var(--ink-2);
  font: italic 400 19px/1.2 var(--serif); letter-spacing: -.005em;
  transition: color .18s;
}
.como-btn i {
  display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--line-2);
  transition: background .18s, border-color .18s;
}
.como-btn i svg { width: 10px; height: 10px; margin-left: 2px; fill: var(--accent); transition: fill .18s; }
.como-btn:hover { color: var(--ink); }
.como-btn:hover i { background: var(--accent); border-color: var(--accent); }
.como-btn:hover i svg { fill: #fff; }
.como-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
.como-btn + .version { margin-top: 16px; }

dialog.cf {
  --cf-desk: #ebe8e1;
  position: fixed; inset: 0;
  width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 16px; border: 0;
  background: transparent; color: var(--ink);
  place-items: center; overflow: auto;
}
dialog.cf[open] { display: grid; }
dialog.cf::backdrop { background: rgba(21, 21, 21, .44); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: cf-bd .3s ease; }
@media (prefers-color-scheme: dark) { dialog.cf { --cf-desk: #1a1a18; } dialog.cf::backdrop { background: rgba(0, 0, 0, .6); } }
@keyframes cf-bd { from { opacity: 0; } }
@keyframes cf-pop { from { opacity: 0; transform: translateY(14px) scale(.985); } }
@keyframes cf-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes cf-fd { from { opacity: 0; } }

.cf-box {
  width: min(880px, 100%, calc((100dvh - 230px) * 1.5));
  min-width: min(340px, 100%);
  overflow: hidden;
  background: var(--surface);
  border-radius: 22px;
  box-shadow: 0 2px 6px rgba(20, 20, 18, .08), 0 30px 80px rgba(20, 20, 18, .22);
  animation: cf-pop .38s cubic-bezier(.2, .8, .2, 1);
}
.cf-stage { position: relative; background: var(--cf-desk); }
.cf-stage > svg { display: block; width: 100%; height: auto; aspect-ratio: 600 / 400; }
.cf-x {
  position: absolute; top: 12px; right: 12px;
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 50%;
  border: 0; background: var(--surface); color: var(--ink-2);
  box-shadow: 0 1px 2px rgba(20, 20, 18, .1); cursor: pointer;
  transition: color .15s, transform .15s;
}
.cf-x:hover { color: var(--ink); transform: rotate(90deg); }
.cf-x svg, .cf-b svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.cf-x:focus-visible, .cf-b:focus-visible, .cf-bars button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.cf-foot {
  display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 28px;
  padding: 22px 28px 26px;
  border-top: 1px solid var(--line);
}
.cf-copy.in { animation: cf-in .45s cubic-bezier(.2, .8, .2, 1); }
.cf-n { display: flex; gap: 10px; margin: 0; font: 500 11px/1 var(--sans); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.cf-n b { font-weight: 500; color: var(--accent); font-variant-numeric: tabular-nums; }
.cf-title { margin: 10px 0 6px; font: 400 34px/1.05 var(--serif); letter-spacing: -.012em; color: var(--ink); }
.cf-text { margin: 0; max-width: 50ch; min-height: 3em; font-size: 14px; line-height: 1.5; color: var(--muted); text-wrap: pretty; }

.cf-nav { display: flex; flex-direction: column; align-items: flex-end; gap: 16px; }
.cf-bars { display: flex; gap: 4px; }
.cf-bars button { position: relative; width: 24px; height: 16px; padding: 0; border: 0; background: none; cursor: pointer; }
.cf-bars button::before, .cf-bars i {
  content: ""; position: absolute; left: 0; right: 0; top: 6.5px; height: 3px; border-radius: 2px;
}
.cf-bars button::before { background: var(--line-2); }
.cf-bars i { background: var(--ink); transform-origin: left center; transform: scaleX(0); }
.cf-btns { display: flex; gap: 8px; }
.cf-b {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; min-width: 40px; padding: 0 11px; border-radius: 20px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font: 500 13px/1 var(--sans); cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
}
.cf-b:hover { background: var(--hover); }
.cf-b:disabled { opacity: .35; cursor: default; background: var(--surface); }
.cf-next { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.cf-next:hover { background: var(--ink-2); }
.cf-next span { display: none; }
.cf-next.fin { padding: 0 18px; }
.cf-next.fin svg { display: none; }
.cf-next.fin span { display: inline; }
.cf-play .ps, .cf-play .pl, .cf-play .rp { display: none; }
.cf-play[data-st="pause"] .ps, .cf-play[data-st="play"] .pl, .cf-play[data-st="replay"] .rp { display: inline; }
.cf-play .pl { fill: currentColor; stroke: none; }

/* lo que se dibuja dentro del escenario */
.cf-fade { animation: cf-fd .3s ease; }
.cf-stage path { fill-rule: evenodd; clip-rule: evenodd; }
.cf-dot0 { fill: var(--line-2); }
.cf-cardsh { fill: rgba(20, 20, 18, .12); }
.cf-tape { fill: rgba(240, 232, 212, .86); }
.cf-mask { fill: #ff5a1f; fill-opacity: .4; }
.cf-dz { fill: none; stroke: var(--line-2); stroke-width: 1.5; stroke-dasharray: 7 6; }
.cf-dzt { fill: var(--muted); font: italic 400 22px var(--serif); }
.cf-hand { fill: #7a776f; font: italic 400 13px var(--serif); }
.cf-chip rect { fill: var(--surface); stroke: var(--line-2); stroke-width: 1; }
.cf-chip text { fill: var(--ink-2); font-family: var(--sans); font-size: 12.5px; font-weight: 500; }
.cf-chip .cf-ic { fill: none; stroke: currentColor; color: var(--ink-2); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.cf-chip.ghost rect { fill: transparent; stroke-dasharray: 3 3; }
.cf-chip.ghost text { fill: var(--muted); font-weight: 400; }
.cf-chip.solid rect { fill: var(--ink); stroke: var(--ink); }
.cf-chip.solid text { fill: var(--bg); }
.cf-chip.solid .cf-ic { color: var(--bg); }
.cf-chip.dark rect { fill: rgba(21, 21, 21, .74); stroke: none; }
.cf-chip.dark text { fill: #fff; }
.cf-chip.dark .cf-ic { color: #fff; }
.cf-chip.on rect, .cf-chip.solid.on rect { fill: var(--accent); stroke: var(--accent); stroke-dasharray: none; }
.cf-chip.on text { fill: #fff; }
.cf-chip.on .cf-ic { color: #fff; }
.cf-pill { fill: var(--surface); stroke: var(--line-2); stroke-width: 1; }
.cf-ptx { fill: var(--ink); font-family: var(--sans); font-size: 13.5px; }
.cf-slip { stroke: var(--line-2); stroke-width: 1; filter: drop-shadow(0 3px 6px rgba(20, 20, 18, .12)); }
.cf-slip1 { fill: #151515; font: 600 13px var(--sans); }
.cf-slip2 { fill: #7a776f; font: 400 11px var(--sans); }

@media (max-width: 640px) {
  dialog.cf { padding: 10px; }
  .cf-box { border-radius: 18px; }
  .cf-foot { grid-template-columns: 1fr; gap: 18px; padding: 18px 18px 18px; }
  .cf-title { font-size: 28px; }
  .cf-text { font-size: 13.5px; min-height: 4.5em; }
  .cf-nav { flex-direction: row; align-items: center; justify-content: space-between; }
  .cf-bars { gap: 3px; }
  .cf-bars button { width: 12px; }
  .cf-x { top: 8px; right: 8px; width: 30px; height: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  .cf-box, .cf-copy.in, .cf-fade, dialog.cf::backdrop { animation: none; }
}

/* ── textura exacta (textura.js) ── */
.txm .g3d-lienzo { cursor: grab; }
.txm .g3d-lienzo.txm-agarra { cursor: grabbing; }
.txm-gl, .txm-sup { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.txm .g3d-lienzo.txm-mano { cursor: pointer; }
.txm-lbl { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.txm-chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.txm-chip:hover { border-color: var(--ink-2); }
.txm-chip.on { background: var(--ink); color: var(--on-solid); border-color: var(--ink); }
.txm-chk { cursor: pointer; }
.txm-chk input { accent-color: var(--ink); width: auto; }
.txm-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.txm-quad { fill: none; stroke: #fff; stroke-width: 1.2; stroke-dasharray: 6 5; filter: drop-shadow(0 0 1.5px rgba(0, 0, 0, .7)); }
.txm-h { fill: var(--accent); stroke: #fff; stroke-width: 2; pointer-events: all; cursor: grab; touch-action: none; }
.txm-h:active { cursor: grabbing; }
.txm-col input { width: 30px; height: 24px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; cursor: pointer; }
.txm-seg button { white-space: nowrap; }
.txm-mover { pointer-events: all; cursor: move; touch-action: none; }
.txm-mover circle { fill: rgba(0, 0, 0, .45); stroke: #fff; stroke-width: 1.5; }
.txm-mover path { stroke: #fff; stroke-width: 1.6; fill: none; }
.txm-quad { pointer-events: none; }

/* motor de edición (Klein / Nano Banana), junto a Aplicar: solo si config.php lo activa */
.motor-sel { padding: 2px; }
.motor-sel button { padding: 0 10px; height: 26px; font-size: 12.5px; }
.motor-sel[hidden] { display: none; }

/* lagunas: trozos que la selección automática se dejó (v1.0.64) */
:root { --gap: #1f6bff; }
#gaps { width: 100%; height: 100%; pointer-events: none; animation: gapPulse 1.6s ease-in-out infinite; }
.board.done #gaps, .board.compare #gaps, .board.busy #gaps { display: none; }
@keyframes gapPulse { 0%, 100% { opacity: .95; } 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { #gaps { animation: none; opacity: .85; } }
.lagunas {
  display: flex; align-items: center; gap: 10px;
  padding: 0 2px 10px 4px; margin-bottom: 8px;
  border-bottom: 1px solid var(--line); min-height: 40px;
}
.lagunas .grow { flex: 1; }
.lag-ico {
  flex: none; width: 16px; height: 16px; border-radius: 4px;
  background: repeating-linear-gradient(135deg, var(--gap) 0 3px, rgba(31, 107, 255, .35) 3px 6px);
}
.lag-txt { font-size: 13.5px; line-height: 1.3; }
@media (max-width: 600px) { .lag-txt { font-size: 12.5px; } }

/* cartel de lagunas: centrado sobre la imagen, como los demás paneles (v1.0.65) */
.lag-card {
  position: absolute; left: 0; top: 0; z-index: 14;
  width: min(330px, calc(100% - 24px));
  padding: 16px 16px 12px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .08), 0 18px 48px rgba(0, 0, 0, .18);
  animation: none; transition: none;                  /* aparece tal cual, sin fundido ni movimiento */
}
.lag-card-head { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.lag-card-title { margin: 0; font-weight: 600; font-size: 14.5px; letter-spacing: -.005em; }
.lag-card-text { margin: 0; color: var(--ink-2); font-size: 13.5px; line-height: 1.5; }
.lag-card-foot { display: flex; justify-content: flex-end; gap: 6px; margin-top: 14px; }
.lag-card-foot .btn.ghost { border-color: transparent; color: var(--muted); }
.lag-card-foot .btn.ghost:hover { color: var(--ink); }
/* cartel sin huecos: «revisa la selección» (rayas naranjas, el color de la máscara) */
.lag-card.ok .lag-ico { background: repeating-linear-gradient(135deg, var(--accent) 0 3px, rgba(255, 90, 31, .35) 3px 6px); }

/* tamaño con el botón derecho: deslizador junto al círculo del pincel (v1.0.71) */
.viewport.ajustando, .viewport.paint.ajustando { cursor: ns-resize !important; }
.size-hud {
  position: absolute; left: 0; top: 0; z-index: 6;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: 46px; padding: 10px 0 9px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow);
  pointer-events: none; user-select: none;
}
.sh-label { font-size: 11px; color: var(--muted); letter-spacing: .01em; }
.sh-track { position: relative; width: 4px; height: 120px; border-radius: 2px; background: var(--line); }
.sh-track i { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 2px; background: var(--ink); }
.sh-track b {
  position: absolute; left: 50%; width: 14px; height: 14px; margin: 0 0 -7px -7px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--ink);
}
.sh-val { font-size: 12.5px; font-weight: 500; font-variant-numeric: tabular-nums; }

/* menú de descarga: imagen · capa · máscara (v1.0.74) */
.dl-menu {
  position: absolute; left: 0; top: 0; z-index: 13;
  width: min(290px, calc(100% - 16px));
  padding: 6px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow);
}
.dl-menu button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  width: 100%; padding: 9px 10px;
  border: 0; border-radius: 10px; background: none; color: inherit;
  font: inherit; text-align: left; cursor: pointer;
}
.dl-menu button:hover, .dl-menu button:focus-visible { background: var(--hover); outline: none; }
.dl-menu b { font-weight: 500; font-size: 13.5px; }
.dl-menu span { color: var(--muted); font-size: 12px; }
.dl-todas {
  display: flex; align-items: center; gap: 8px;
  margin: 4px 4px 2px; padding: 8px 6px 4px;
  border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--ink-2); cursor: pointer;
}
.dl-todas input { accent-color: var(--ink); margin: 0; }

/* seleccionar con un clic (v1.0.75) */
.viewport.clic, .viewport.paint.clic { cursor: crosshair; }
.rail .rbtn#toolClick svg path:first-child { fill: currentColor; fill-opacity: .12; }
.clic-dot {
  position: absolute; left: 0; top: 0; z-index: 6; pointer-events: none;
  width: 0; height: 0;
}
.clic-dot::before, .clic-dot::after {
  content: ""; position: absolute; left: -7px; top: -7px; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); background: var(--accent);
}
.clic-dot::after { background: none; animation: clicPulso 1.2s ease-out infinite; }
.clic-dot.quitar::before { background: var(--ink); }
@keyframes clicPulso { from { transform: scale(1); opacity: .9; } to { transform: scale(3); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .clic-dot::after { animation: none; } }

/* motores: Simple · Intenso, en naranja */
.motor-sel { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.motor-sel button { color: var(--accent); }
.motor-sel button:hover:not(.on) { color: color-mix(in srgb, var(--accent) 80%, var(--ink)); }
.motor-sel button.on { background: var(--accent); color: #fff; box-shadow: none; }
.motor-sel button[hidden] { display: none; }

/* caja de texto vacía: «Escribe» centrado con un cursor que parpadea */
.escribe {
  position: absolute; inset: 0 36px 0 0;
  display: flex; align-items: center; justify-content: center; gap: 3px;
  cursor: text;                                    /* se pulsa para empezar a escribir */
  font: italic 400 17px/1 var(--serif); color: var(--muted); letter-spacing: -.005em;
  transition: opacity .15s;
}
.escribe i { width: 1.5px; height: 1.15em; background: var(--accent); border-radius: 1px; animation: tx-cursor 1.06s steps(1, end) infinite; }
@keyframes tx-cursor { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .escribe i { animation: none; } }
.field:not(.vacia) .escribe, .field:focus-within .escribe { opacity: 0; pointer-events: none; }
.card.sin-imagen .escribe { cursor: default; }
.card.sin-imagen .escribe { opacity: .55; }

/* deshacer: cuántos trazos lleva la máscara */
.trazos-n {
  position: absolute; top: 3px; right: 4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--accent); color: #fff;
  font: 600 10px/16px var(--sans); text-align: center; pointer-events: none;
}
.trazos-n[hidden] { display: none; }
.rbtn:disabled .trazos-n { display: none; }

.motor-sel button:disabled { opacity: .38; cursor: default; }

/* entrada: «¿Cómo funciona?» incrustado bajo el logo (mismo «vídeo» que el modal) */
#login { justify-content: safe center; }
.como-inline { width: 100%; display: flex; justify-content: center; margin: -6px 0 30px; }
.cf-inline { --cf-desk: #ebe8e1; color: var(--ink); text-align: left; width: min(760px, 100%, max(580px, calc((100dvh - 430px) * 1.5))); min-width: min(320px, 100%); container-type: inline-size; }
@container (max-width: 560px) {
  .cf-inline .cf-foot { grid-template-columns: 1fr; gap: 16px; }
  .cf-inline .cf-nav { flex-direction: row; align-items: center; justify-content: space-between; }
}
@media (prefers-color-scheme: dark) { .cf-inline { --cf-desk: #1a1a18; } }
.cf-inline .cf-box { width: 100%; min-width: 0; animation: none; box-shadow: 0 2px 6px rgba(20, 20, 18, .06), 0 22px 60px rgba(20, 20, 18, .14); }
.cf-inline .cf-foot { padding: 18px 22px 20px; gap: 20px; }
.cf-inline .cf-title { font-size: 28px; margin: 8px 0 4px; }
.cf-inline .cf-text { font-size: 13.5px; min-height: 3em; }
#login.en-beta .como-inline { display: none; }
.como-btn[hidden] { display: none; }
@media (max-width: 640px) {
  .cf-inline { width: 100%; }
  .como-inline { margin: -10px 0 22px; }
  .cf-inline .cf-title { font-size: 24px; }
}

/* entrada: el botón de entrar, grande y centrado; debajo, la frase más pequeña */
.login-cta { display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: none; }
.login-cta .login-btn { margin: 0; transform: none; }
.login-cta .btn.google { height: 52px; padding: 0 28px 0 22px; gap: 11px; font-size: 16px; font-weight: 500; box-shadow: 0 1px 2px rgba(20, 20, 18, .06), 0 8px 24px rgba(20, 20, 18, .08); }
.login-cta .btn.google svg { width: 20px; height: 20px; }
.login-sub { margin: 0; font: italic 400 clamp(18px, 2.2vw, 22px)/1.3 var(--serif); color: var(--ink-2); letter-spacing: -.005em; }
/* ® del logo */
.firma-r { fill: currentColor; stroke: none; font: 400 14px var(--sans); }
.firma { width: min(310px, 75vw); }
.txm-naranja { color: var(--accent); }
