* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font-family: var(--fuente);
  -webkit-text-size-adjust: 100%;
}

.editor {
  max-width: 480px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.editor h1 { margin: 0; font-size: 1.5rem; }
.editor h2 { margin: 0 0 8px; font-size: 1.05rem; }
.editor-aviso { color: var(--texto-suave); }

/* Lista de productos */
.productos { display: flex; flex-direction: column; gap: 10px; }
.producto {
  display: block;
  padding: 16px;
  border-radius: 12px;
  background: var(--area-fondo);
  box-shadow: var(--sombra);
  color: inherit;
  text-decoration: none;
}
.producto strong { display: block; }
.producto span { color: var(--texto-suave); font-size: .9rem; }

/* Formulario */
.formulario { display: flex; flex-direction: column; gap: 16px; }
.campo { display: flex; flex-direction: column; gap: 6px; border: 0; margin: 0; padding: 0; }
.campo-etiqueta { font-weight: 600; font-size: .95rem; padding: 0; }
.campo-contador { align-self: flex-end; font-size: .8rem; color: var(--texto-suave); }

.campo input[type="text"], .campo textarea {
  width: 100%;
  padding: 12px;
  font: inherit;
  font-size: 16px; /* evita el zoom automático en iPhone */
  color: var(--texto);
  background: var(--area-fondo);
  border: 1px solid rgba(0, 0, 0, .15);
  border-radius: 10px;
  resize: vertical;
}
.campo input[type="text"]:focus, .campo textarea:focus { outline: 2px solid var(--acento); outline-offset: 1px; }

.opciones { display: flex; gap: 8px; flex-wrap: wrap; }
.opcion input { position: absolute; opacity: 0; pointer-events: none; }
.opcion span {
  display: inline-block;
  min-width: 96px;
  padding: 10px 16px;
  text-align: center;
  border-radius: 999px;
  background: var(--area-fondo);
  border: 1px solid rgba(0, 0, 0, .15);
  cursor: pointer;
}
.opcion input:checked + span { background: var(--texto); color: var(--fondo); border-color: var(--texto); }
.opcion input:focus-visible + span { outline: 2px solid var(--acento); outline-offset: 2px; }

/* Vista previa */
.vista-previa { display: flex; flex-direction: column; gap: 8px; }
.vista-previa-marco {
  width: 100%;
  height: 560px;
  border: 0;
  border-radius: 16px;
  background: var(--fondo);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1);
}
.boton-texto {
  align-self: flex-start;
  padding: 4px 0;
  background: none;
  border: 0;
  color: var(--acento);
  font: inherit;
  font-size: .9rem;
  cursor: pointer;
}

/* Acciones */
.acciones { display: flex; flex-direction: column; gap: 10px; }
.boton {
  display: block;
  width: 100%;
  padding: 14px;
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  border-radius: 12px;
  border: 0;
  cursor: pointer;
  background: var(--texto);
  color: var(--fondo);
}
.boton--secundario { background: var(--area-fondo); color: var(--texto); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
.boton[aria-disabled="true"] { opacity: .4; pointer-events: none; }
.acciones-nota { margin: 0; font-size: .85rem; color: var(--texto-suave); min-height: 1.2em; }
.acciones-nota--alerta { color: var(--acento); min-height: 0; margin: -8px 0 0; }
.acciones-nota--alerta:empty { display: none; }
